Tiny refactor

This commit is contained in:
2024-10-18 16:12:24 +02:00
parent 8ee000ab74
commit 1d5b4499a4
38 changed files with 645 additions and 637 deletions

View File

@@ -3265,11 +3265,11 @@ namespace FMOD
// Connection / disconnection / input and output enumeration.
public RESULT addInput(DSP input)
{
return FMOD5_DSP_AddInput(this.handle, input.handle, IntPtr.Zero, DSPCONNECTION_TYPE.STANDARD);
return FMOD5_DSP_AddInput(this.handle, engine.input.handle, IntPtr.Zero, DSPCONNECTION_TYPE.STANDARD);
}
public RESULT addInput(DSP input, out DSPConnection connection, DSPCONNECTION_TYPE type = DSPCONNECTION_TYPE.STANDARD)
{
return FMOD5_DSP_AddInput(this.handle, input.handle, out connection.handle, type);
return FMOD5_DSP_AddInput(this.handle, engine.input.handle, out connection.handle, type);
}
public RESULT disconnectFrom(DSP target, DSPConnection connection)
{
@@ -3289,7 +3289,7 @@ namespace FMOD
}
public RESULT getInput(int index, out DSP input, out DSPConnection inputconnection)
{
return FMOD5_DSP_GetInput(this.handle, index, out input.handle, out inputconnection.handle);
return FMOD5_DSP_GetInput(this.handle, index, out engine.input.handle, out inputconnection.handle);
}
public RESULT getOutput(int index, out DSP output, out DSPConnection outputconnection)
{
@@ -3568,7 +3568,7 @@ namespace FMOD
{
public RESULT getInput(out DSP input)
{
return FMOD5_DSPConnection_GetInput(this.handle, out input.handle);
return FMOD5_DSPConnection_GetInput(this.handle, out engine.input.handle);
}
public RESULT getOutput(out DSP output)
{

View File

@@ -533,9 +533,9 @@ Image read_png(const void *data, size_t size)
retain.initialized = false;
ufbx_inflate_input input = { 0 };
input.total_size = deflate_data.size();
input.data_size = deflate_data.size();
input.data = deflate_data.data();
engine.input.total_size = deflate_data.size();
engine.input.data_size = deflate_data.size();
engine.input.data = deflate_data.data();
ptrdiff_t res = ufbx_inflate(src.data(), src.size(), &input, &retain);
if (res < 0) return { "deflate error" };
@@ -3309,7 +3309,7 @@ void render_frame(ufbx_scene *original_scene, const Opts &opts, int frame_offset
void render_file(const Opts &opts)
{
verbosef("Loading scene: %s\n", opts.input.value.c_str());
verbosef("Loading scene: %s\n", opts.engine.input.value.c_str());
ProgressState progress_state = { };
@@ -3371,9 +3371,9 @@ void parse_args(Opts &opts, int argc, char **argv, bool ignore_input)
}
} else {
if (!ignore_input) {
opts.input.value = arg;
opts.input.defined = true;
opts.input.from_arg = true;
opts.engine.input.value = arg;
opts.engine.input.defined = true;
opts.engine.input.from_arg = true;
}
}
}
@@ -3489,7 +3489,7 @@ int main(int argc, char **argv)
parse_args(opts, argc, argv, false);
if (opts.help.value) {
fprintf(stderr, "Usage: picort input.fbx <opts> (--help)\n");
fprintf(stderr, "Usage: picort engine.input.fbx <opts> (--help)\n");
for (OptBase &opt : opts) {
char name[64];
if (opt.alias) {
@@ -3511,13 +3511,13 @@ int main(int argc, char **argv)
return 0;
}
if (!opts.input.defined) {
fprintf(stderr, "Usage: picort input.fbx/.picort.txt <opts> (--help)\n");
if (!opts.engine.input.defined) {
fprintf(stderr, "Usage: picort engine.input.fbx/.picort.txt <opts> (--help)\n");
return 0;
}
if (ends_with(opts.input.value, ".txt")) {
std::string path = std::move(opts.input.value);
if (ends_with(opts.engine.input.value, ".txt")) {
std::string path = std::move(opts.engine.input.value);
opts = Opts{};
parse_file(opts, path.c_str());
parse_args(opts, argc, argv, true);

View File

@@ -532,7 +532,7 @@
When drag'n'drop is enabled, the event callback will be invoked with an
event of type SAPP_EVENTTYPE_FILES_DROPPED whenever the user drops files on
the application window.
the application engine.window.
After the SAPP_EVENTTYPE_FILES_DROPPED is received, you can query the
number of dropped files, and their absolute paths by calling separate
@@ -884,7 +884,7 @@
=================
On some platforms which don't provide a physical keyboard, sokol-app
can display the platform's integrated onscreen keyboard for text
input. To request that the onscreen keyboard is shown, call
engine.input. To request that the onscreen keyboard is shown, call
sapp_show_keyboard(true);
@@ -949,7 +949,7 @@
sapp_desc.win32_console_create (default: false)
When set to true, a new console window will be created and
stdout/stderr will be redirected to that console window. It
stdout/stderr will be redirected to that console engine.window. It
doesn't matter if the application is started from the command
line or via double-click.

View File

@@ -532,7 +532,7 @@
When drag'n'drop is enabled, the event callback will be invoked with an
event of type SAPP_EVENTTYPE_FILES_DROPPED whenever the user drops files on
the application window.
the application engine.window.
After the SAPP_EVENTTYPE_FILES_DROPPED is received, you can query the
number of dropped files, and their absolute paths by calling separate
@@ -884,7 +884,7 @@
=================
On some platforms which don't provide a physical keyboard, sokol-app
can display the platform's integrated onscreen keyboard for text
input. To request that the onscreen keyboard is shown, call
engine.input. To request that the onscreen keyboard is shown, call
sapp_show_keyboard(true);
@@ -949,7 +949,7 @@
sapp_desc.win32_console_create (default: false)
When set to true, a new console window will be created and
stdout/stderr will be redirected to that console window. It
stdout/stderr will be redirected to that console engine.window. It
doesn't matter if the application is started from the command
line or via double-click.
@@ -1750,7 +1750,7 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
#include <winrt/Windows.Graphics.Display.h>
#include <winrt/Windows.UI.Core.h>
#include <winrt/Windows.UI.Composition.h>
#include <winrt/Windows.UI.Input.h>
#include <winrt/Windows.UI.engine.input.h>
#include <winrt/Windows.UI.ViewManagement.h>
#include <winrt/Windows.System.h>
#include <ppltasks.h>
@@ -3096,13 +3096,13 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
styleMask:style
backing:NSBackingStoreBuffered
defer:NO];
_sapp.macos.window.releasedWhenClosed = NO; // this is necessary for proper cleanup in applicationWillTerminate
_sapp.macos.window.title = [NSString stringWithUTF8String:_sapp.window_title];
_sapp.macos.window.acceptsMouseMovedEvents = YES;
_sapp.macos.window.restorable = YES;
_sapp.macos.engine.window.releasedWhenClosed = NO; // this is necessary for proper cleanup in applicationWillTerminate
_sapp.macos.engine.window.title = [NSString stringWithUTF8String:_sapp.window_title];
_sapp.macos.engine.window.acceptsMouseMovedEvents = YES;
_sapp.macos.engine.window.restorable = YES;
_sapp.macos.win_dlg = [[_sapp_macos_window_delegate alloc] init];
_sapp.macos.window.delegate = _sapp.macos.win_dlg;
_sapp.macos.engine.window.delegate = _sapp.macos.win_dlg;
#if defined(SOKOL_METAL)
_sapp.macos.mtl_device = MTLCreateSystemDefaultDevice();
_sapp.macos.view = [[_sapp_macos_view alloc] init];
@@ -3113,7 +3113,7 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
_sapp.macos.view.depthStencilPixelFormat = MTLPixelFormatDepth32Float_Stencil8;
_sapp.macos.view.sampleCount = (NSUInteger) _sapp.sample_count;
_sapp.macos.view.autoResizeDrawable = false;
_sapp.macos.window.contentView = _sapp.macos.view;
_sapp.macos.engine.window.contentView = _sapp.macos.view;
[_sapp.macos.window makeFirstResponder:_sapp.macos.view];
_sapp.macos.view.layer.magnificationFilter = kCAFilterNearest;
#elif defined(SOKOL_GLCORE33)
@@ -3150,7 +3150,7 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
[_sapp.macos.view setWantsBestResolutionOpenGLSurface:NO];
}
_sapp.macos.window.contentView = _sapp.macos.view;
_sapp.macos.engine.window.contentView = _sapp.macos.view;
[_sapp.macos.window makeFirstResponder:_sapp.macos.view];
NSTimer* timer_obj = [NSTimer timerWithTimeInterval:0.001
@@ -3754,7 +3754,7 @@ _SOKOL_PRIVATE void _sapp_ios_show_keyboard(bool shown) {
_sapp.ios.view_ctrl = [[UIViewController alloc] init];
_sapp.ios.view_ctrl.modalPresentationStyle = UIModalPresentationFullScreen;
_sapp.ios.view_ctrl.view = _sapp.ios.view;
_sapp.ios.window.rootViewController = _sapp.ios.view_ctrl;
_sapp.ios.engine.window.rootViewController = _sapp.ios.view_ctrl;
#else
if (_sapp.desc.gl_force_gles2) {
_sapp.ios.eagl_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
@@ -3787,7 +3787,7 @@ _SOKOL_PRIVATE void _sapp_ios_show_keyboard(bool shown) {
_sapp.ios.view_ctrl = [[GLKViewController alloc] init];
_sapp.ios.view_ctrl.view = _sapp.ios.view;
_sapp.ios.view_ctrl.preferredFramesPerSecond = 60 / _sapp.swap_interval;
_sapp.ios.window.rootViewController = _sapp.ios.view_ctrl;
_sapp.ios.engine.window.rootViewController = _sapp.ios.view_ctrl;
#endif
[_sapp.ios.window makeKeyAndVisible];
@@ -4050,11 +4050,11 @@ EM_JS(void, sapp_js_add_beforeunload_listener, (void), {
event.returnValue = ' ';
}
};
window.addEventListener('beforeunload', Module.sokol_beforeunload);
engine.window.addEventListener('beforeunload', Module.sokol_beforeunload);
});
EM_JS(void, sapp_js_remove_beforeunload_listener, (void), {
window.removeEventListener('beforeunload', Module.sokol_beforeunload);
engine.window.removeEventListener('beforeunload', Module.sokol_beforeunload);
});
EM_JS(void, sapp_js_add_clipboard_listener, (void), {
@@ -4062,11 +4062,11 @@ EM_JS(void, sapp_js_add_clipboard_listener, (void), {
var pasted_str = event.clipboardData.getData('text');
ccall('_sapp_emsc_onpaste', 'void', ['string'], [pasted_str]);
};
window.addEventListener('paste', Module.sokol_paste);
engine.window.addEventListener('paste', Module.sokol_paste);
});
EM_JS(void, sapp_js_remove_clipboard_listener, (void), {
window.removeEventListener('paste', Module.sokol_paste);
engine.window.removeEventListener('paste', Module.sokol_paste);
});
EM_JS(void, sapp_js_write_clipboard, (const char* c_str), {
@@ -6781,17 +6781,17 @@ _SOKOL_PRIVATE uint32_t _sapp_uwp_mods(winrt::Windows::UI::Core::CoreWindow cons
using namespace winrt::Windows::UI::Core;
uint32_t mods = 0;
if ((sender_window.GetKeyState(VirtualKey::Shift) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down) {
if ((sender_engine.window.GetKeyState(VirtualKey::Shift) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down) {
mods |= SAPP_MODIFIER_SHIFT;
}
if ((sender_window.GetKeyState(VirtualKey::Control) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down) {
if ((sender_engine.window.GetKeyState(VirtualKey::Control) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down) {
mods |= SAPP_MODIFIER_CTRL;
}
if ((sender_window.GetKeyState(VirtualKey::Menu) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down) {
if ((sender_engine.window.GetKeyState(VirtualKey::Menu) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down) {
mods |= SAPP_MODIFIER_ALT;
}
if (((sender_window.GetKeyState(VirtualKey::LeftWindows) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down) ||
((sender_window.GetKeyState(VirtualKey::RightWindows) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down))
if (((sender_engine.window.GetKeyState(VirtualKey::LeftWindows) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down) ||
((sender_engine.window.GetKeyState(VirtualKey::RightWindows) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down))
{
mods |= SAPP_MODIFIER_SUPER;
}
@@ -6985,7 +6985,7 @@ private:
winrt::com_ptr<ID3D11DepthStencilView> m_d3dDepthStencilView;
D3D11_VIEWPORT m_screenViewport = { };
// Cached reference to the Window.
// Cached reference to the engine.window.
winrt::agile_ref< winrt::Windows::UI::Core::CoreWindow> m_window;
// Cached device properties.
@@ -7196,7 +7196,7 @@ void DeviceResources::CreateWindowSizeDependentResources() {
DXGI_SCALING scaling = (_sapp.uwp.dpi.content_scale == _sapp.uwp.dpi.window_scale) ? DXGI_SCALING_NONE : DXGI_SCALING_STRETCH;
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
swapChainDesc.Width = lround(m_d3dRenderTargetSize.Width); // Match the size of the window.
swapChainDesc.Width = lround(m_d3dRenderTargetSize.Width); // Match the size of the engine.window.
swapChainDesc.Height = lround(m_d3dRenderTargetSize.Height);
swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // This is the most common swap chain format.
swapChainDesc.Stereo = false;
@@ -7216,7 +7216,7 @@ void DeviceResources::CreateWindowSizeDependentResources() {
winrt::com_ptr<IDXGIFactory4> dxgiFactory;
winrt::check_hresult(dxgiAdapter->GetParent(__uuidof(IDXGIFactory4), dxgiFactory.put_void()));
winrt::com_ptr<IDXGISwapChain1> swapChain;
winrt::check_hresult(dxgiFactory->CreateSwapChainForCoreWindow(m_d3dDevice.get(), m_window.get().as<::IUnknown>().get(), &swapChainDesc, nullptr, swapChain.put()));
winrt::check_hresult(dxgiFactory->CreateSwapChainForCoreWindow(m_d3dDevice.get(), m_engine.window.get().as<::IUnknown>().get(), &swapChainDesc, nullptr, swapChain.put()));
m_swapChain = swapChain.as<IDXGISwapChain3>();
// Ensure that DXGI does not queue more than one frame at a time. This both reduces latency and
@@ -7327,7 +7327,7 @@ void DeviceResources::UpdateRenderTargetSize() {
void DeviceResources::SetWindow(winrt::Windows::UI::Core::CoreWindow const& window) {
auto currentDisplayInformation = winrt::Windows::Graphics::Display::DisplayInformation::GetForCurrentView();
m_window = window;
m_logicalSize = winrt::Windows::Foundation::Size(window.Bounds().Width, window.Bounds().Height);
m_logicalSize = winrt::Windows::Foundation::Size(engine.window.Bounds().Width, engine.window.Bounds().Height);
m_nativeOrientation = currentDisplayInformation.NativeOrientation();
m_currentOrientation = currentDisplayInformation.CurrentOrientation();
m_dpi = currentDisplayInformation.LogicalDpi();
@@ -7349,8 +7349,8 @@ void DeviceResources::SetDpi(float dpi) {
m_dpi = dpi;
_sapp_uwp_configure_dpi(m_dpi);
// When the display DPI changes, the logical size of the window (measured in Dips) also changes and needs to be updated.
auto window = m_window.get();
m_logicalSize = winrt::Windows::Foundation::Size(window.Bounds().Width, window.Bounds().Height);
auto window = m_engine.window.get();
m_logicalSize = winrt::Windows::Foundation::Size(engine.window.Bounds().Width, engine.window.Bounds().Height);
CreateWindowSizeDependentResources();
}
}
@@ -7536,7 +7536,7 @@ bool DeviceResources::SdkLayersAvailable() {
// The first method called when the IFrameworkView is being created.
void App::Initialize(winrt::Windows::ApplicationModel::Core::CoreApplicationView const& applicationView) {
// Register event handlers for app lifecycle. This example includes Activated, so that we
// can make the CoreWindow active and start rendering on the window.
// can make the CoreWindow active and start rendering on the engine.window.
applicationView.Activated({ this, &App::OnActivated });
winrt::Windows::ApplicationModel::Core::CoreApplication::Suspending({ this, &App::OnSuspending });
@@ -7549,19 +7549,19 @@ void App::Initialize(winrt::Windows::ApplicationModel::Core::CoreApplicationView
// Called when the CoreWindow object is created (or re-created).
void App::SetWindow(winrt::Windows::UI::Core::CoreWindow const& window) {
window.SizeChanged({ this, &App::OnWindowSizeChanged });
window.VisibilityChanged({ this, &App::OnVisibilityChanged });
engine.window.SizeChanged({ this, &App::OnWindowSizeChanged });
engine.window.VisibilityChanged({ this, &App::OnVisibilityChanged });
window.KeyDown({ this, &App::OnKeyDown });
window.KeyUp({ this, &App::OnKeyUp });
window.CharacterReceived({ this, &App::OnCharacterReceived });
engine.window.KeyDown({ this, &App::OnKeyDown });
engine.window.KeyUp({ this, &App::OnKeyUp });
engine.window.CharacterReceived({ this, &App::OnCharacterReceived });
window.PointerEntered({ this, &App::OnPointerEntered });
window.PointerExited({ this, &App::OnPointerExited });
window.PointerPressed({ this, &App::OnPointerPressed });
window.PointerReleased({ this, &App::OnPointerReleased });
window.PointerMoved({ this, &App::OnPointerMoved });
window.PointerWheelChanged({ this, &App::OnPointerWheelChanged });
engine.window.PointerEntered({ this, &App::OnPointerEntered });
engine.window.PointerExited({ this, &App::OnPointerExited });
engine.window.PointerPressed({ this, &App::OnPointerPressed });
engine.window.PointerReleased({ this, &App::OnPointerReleased });
engine.window.PointerMoved({ this, &App::OnPointerMoved });
engine.window.PointerWheelChanged({ this, &App::OnPointerWheelChanged });
auto currentDisplayInformation = winrt::Windows::Graphics::Display::DisplayInformation::GetForCurrentView();

View File

@@ -575,10 +575,10 @@ static const char lit_pixel_source_glsl330[275] = {
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
a_position = stage_input.a_position;
a_vertex_index = stage_input.a_vertex_index;
a_normal = stage_input.a_normal;
a_uv = stage_input.a_uv;
a_position = stage_engine.input.a_position;
a_vertex_index = stage_engine.input.a_vertex_index;
a_normal = stage_engine.input.a_normal;
a_uv = stage_engine.input.a_uv;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
@@ -835,12 +835,12 @@ static const uint8_t static_vertex_bytecode_hlsl5[2276] = {
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
a_bone_indices = stage_input.a_bone_indices;
a_bone_weights = stage_input.a_bone_weights;
a_position = stage_input.a_position;
a_vertex_index = stage_input.a_vertex_index;
a_normal = stage_input.a_normal;
a_uv = stage_input.a_uv;
a_bone_indices = stage_engine.input.a_bone_indices;
a_bone_weights = stage_engine.input.a_bone_weights;
a_position = stage_engine.input.a_position;
a_vertex_index = stage_engine.input.a_vertex_index;
a_normal = stage_engine.input.a_normal;
a_uv = stage_engine.input.a_uv;
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
@@ -1084,8 +1084,8 @@ static const uint8_t skinned_vertex_bytecode_hlsl5[3256] = {
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
v_normal = stage_input.v_normal;
v_uv = stage_input.v_uv;
v_normal = stage_engine.input.v_normal;
v_uv = stage_engine.input.v_uv;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.o_color = o_color;

View File

@@ -135,8 +135,8 @@ int main(int argc, char **argv)
#endif
ufbx_inflate_input input = { };
input.data_size = input.total_size = stream.compressed_size;
input.data = stream.data;
engine.input.data_size = engine.input.total_size = stream.compressed_size;
engine.input.data = stream.data;
ptrdiff_t ret = ufbx_inflate(dst_buf.data(), stream.decompressed_size, &input, &retain);
assert(ret == stream.decompressed_size);

View File

@@ -47,9 +47,9 @@ int main(int argc, char **argv)
ufbx_inflate_retain retain;
retain.initialized = false;
ufbx_inflate_input input = { 0 };
input.data = src;
input.data_size = src_size;
input.total_size = src_size;
engine.input.data = src;
engine.input.data_size = src_size;
engine.input.total_size = src_size;
ptrdiff_t result = ufbx_inflate(dst, dst_size, &input, &retain);
free(src);

View File

@@ -38,9 +38,9 @@ int main(int argc, char **argv)
ufbx_inflate_retain retain;
retain.initialized = false;
ufbx_inflate_input input = { 0 };
input.data = src;
input.data_size = src_size;
input.total_size = src_size;
engine.input.data = src;
engine.input.data_size = src_size;
engine.input.total_size = src_size;
ptrdiff_t result = ufbx_inflate(dst, dst_size, &input, &retain);
if (result != dst_size) {

View File

@@ -3005,10 +3005,10 @@ anon_enum_31 :: enum s32 {
}
ufbx_shader_texture_input :: struct {
// Name of the input.
// Name of the engine.input.
name: ufbx_string;
// Constant value of the input.
// Constant value of the engine.input.
union {
value_real: ufbx_real;
value_vec2: ufbx_vec2;
@@ -3020,7 +3020,7 @@ ufbx_shader_texture_input :: struct {
value_str: ufbx_string;
value_blob: ufbx_blob;
// Texture connected to this input.
// Texture connected to this engine.input.
texture: *ufbx_texture;
// Index of the output to use if `texture` is a multi-output shader node.
@@ -3030,7 +3030,7 @@ ufbx_shader_texture_input :: struct {
// NOTE: Some shading models allow this to be `true` even if `texture == NULL`.
texture_enabled: bool;
// Property representing this input.
// Property representing this engine.input.
prop: *ufbx_prop;
// Property representing `texture`.
@@ -3056,7 +3056,7 @@ ufbx_shader_texture :: struct {
shader_type_id: u64;
// Input values/textures (possibly further shader textures) to the shader.
// Sorted by `ufbx_shader_texture_input.name`.
// Sorted by `ufbx_shader_texture_engine.input.name`.
inputs: ufbx_shader_texture_input_list;
// Shader source code if found.

View File

@@ -9,10 +9,10 @@ static ptrdiff_t ufbxt_inflate_no_fuzz(void *dst, size_t dst_size, const void *s
retain.initialized = false;
ufbx_inflate_input input = { 0 };
input.data = src;
input.data_size = src_size;
input.total_size = src_size;
input.internal_fast_bits = opts->fast_bits;
engine.input.data = src;
engine.input.data_size = src_size;
engine.input.total_size = src_size;
engine.input.internal_fast_bits = opts->fast_bits;
if (opts->force_fast) {
size_t padding = 512;
@@ -24,10 +24,10 @@ static ptrdiff_t ufbxt_inflate_no_fuzz(void *dst, size_t dst_size, const void *s
memcpy(large_src, src, src_size);
memset(large_src + src_size, 0, padding);
input.data = large_src;
input.data_size += padding;
input.total_size += padding;
input.internal_fast_bits = 10;
engine.input.data = large_src;
engine.input.data_size += padding;
engine.input.total_size += padding;
engine.input.internal_fast_bits = 10;
ptrdiff_t result = ufbx_inflate(large_dst, dst_size + padding, &input, &retain);
if (result >= 0) {
@@ -47,9 +47,9 @@ static ptrdiff_t ufbxt_inflate(void *dst, size_t dst_size, const void *src, size
{
if (opts->primary && ufbxt_begin_fuzz()) {
ufbx_inflate_input input = { 0 };
input.data = src;
input.data_size = src_size;
input.total_size = src_size;
engine.input.data = src;
engine.input.data_size = src_size;
engine.input.total_size = src_size;
int i;
@@ -1846,9 +1846,9 @@ UFBXT_TEST(deflate_byte_stream)
ufbxt_deflate_byte_stream_init(&stream, prefix, sizeof(prefix) - 1, 0x8000, suffix, sizeof(suffix) - 1);
ufbx_inflate_input input = { 0 };
input.total_size = stream.total_size;
input.read_fn = &ufbxt_deflate_byte_stream_read;
input.read_user = &stream;
engine.input.total_size = stream.total_size;
engine.input.read_fn = &ufbxt_deflate_byte_stream_read;
engine.input.read_user = &stream;
ufbx_inflate_retain retain;
retain.initialized = false;
@@ -1873,11 +1873,11 @@ UFBXT_TEST(deflate_byte_stream_prefix)
ufbxt_deflate_byte_stream_init(&stream, NULL, 0, 0x8000, suffix, sizeof(suffix) - 1);
ufbx_inflate_input input = { 0 };
input.total_size = stream.total_size + (sizeof(prefix) - 1);
input.data = prefix;
input.data_size = sizeof(prefix) - 1;
input.read_fn = &ufbxt_deflate_byte_stream_read;
input.read_user = &stream;
engine.input.total_size = stream.total_size + (sizeof(prefix) - 1);
engine.input.data = prefix;
engine.input.data_size = sizeof(prefix) - 1;
engine.input.read_fn = &ufbxt_deflate_byte_stream_read;
engine.input.read_user = &stream;
ufbx_inflate_retain retain;
retain.initialized = false;
@@ -1902,9 +1902,9 @@ UFBXT_TEST(deflate_byte_stream_truncated)
ufbxt_deflate_byte_stream_init(&stream, prefix, sizeof(prefix) - 1, 0x4000, suffix, sizeof(suffix) - 1);
ufbx_inflate_input input = { 0 };
input.total_size = stream.total_size;
input.read_fn = &ufbxt_deflate_byte_stream_read;
input.read_user = &stream;
engine.input.total_size = stream.total_size;
engine.input.read_fn = &ufbxt_deflate_byte_stream_read;
engine.input.read_user = &stream;
ufbx_inflate_retain retain;
retain.initialized = false;
@@ -1926,9 +1926,9 @@ UFBXT_TEST(deflate_byte_stream_no_adler)
ufbxt_deflate_byte_stream_init(&stream, prefix, sizeof(prefix) - 1, 0x8000, NULL, 0);
ufbx_inflate_input input = { 0 };
input.total_size = stream.total_size;
input.read_fn = &ufbxt_deflate_byte_stream_read;
input.read_user = &stream;
engine.input.total_size = stream.total_size;
engine.input.read_fn = &ufbxt_deflate_byte_stream_read;
engine.input.read_user = &stream;
ufbx_inflate_retain retain;
retain.initialized = false;

View File

@@ -237,13 +237,13 @@ static ufbxt_noinline void *ufbxt_decompress_gzip(const void *gz_data, size_t gz
ufbx_inflate_input input = { 0 };
input.data = gz + offset;
input.data_size = gz_size - offset;
engine.input.data = gz + offset;
engine.input.data_size = gz_size - offset;
input.total_size = input.data_size;
engine.input.total_size = engine.input.data_size;
input.no_header = true;
input.no_checksum = true;
engine.input.no_header = true;
engine.input.no_checksum = true;
ptrdiff_t result = ufbx_inflate(dst, isize, &input, &retain);
if (result != isize) {

View File

@@ -2476,7 +2476,7 @@ ufbxi_inflate_block_fast(ufbxi_deflate_context *dc, ufbxi_trees *trees)
// -16 - -21: Litlen Huffman: Overfull / Underfull / Repeat 16/17/18 overflow / Bad length code
// -22 - -27: Distance Huffman: Overfull / Underfull / Repeat 16/17/18 overflow / Bad length code
// -28: Cancelled
// -29: Invalid ufbx_inflate_input.internal_fast_bits value
// -29: Invalid ufbx_inflate_engine.input.internal_fast_bits value
ufbxi_extern_c ptrdiff_t ufbx_inflate(void *dst, size_t dst_size, const ufbx_inflate_input *input, ufbx_inflate_retain *retain)
{
ufbxi_inflate_retain_imp *ret_imp = (ufbxi_inflate_retain_imp*)retain;
@@ -7779,24 +7779,24 @@ ufbxi_nodiscard ufbxi_noinline static int ufbxi_binary_parse_node(ufbxi_context
// Inflate the data from the user-provided IO buffer / read callbacks
ufbx_inflate_input input;
input.total_size = encoded_size;
input.data = uc->data;
input.data_size = uc->data_size;
input.no_header = false;
input.no_checksum = false;
input.internal_fast_bits = 0;
engine.input.total_size = encoded_size;
engine.input.data = uc->data;
engine.input.data_size = uc->data_size;
engine.input.no_header = false;
engine.input.no_checksum = false;
engine.input.internal_fast_bits = 0;
if (uc->opts.progress_cb.fn) {
input.progress_cb = uc->opts.progress_cb;
input.progress_size_before = arr_begin;
input.progress_size_after = uc->progress_bytes_total - arr_end;
input.progress_interval_hint = uc->progress_interval;
engine.input.progress_cb = uc->opts.progress_cb;
engine.input.progress_size_before = arr_begin;
engine.input.progress_size_after = uc->progress_bytes_total - arr_end;
engine.input.progress_interval_hint = uc->progress_interval;
} else {
input.progress_cb.fn = NULL;
input.progress_cb.user = NULL;
input.progress_size_before = 0;
input.progress_size_after = 0;
input.progress_interval_hint = 0;
engine.input.progress_cb.fn = NULL;
engine.input.progress_cb.user = NULL;
engine.input.progress_size_before = 0;
engine.input.progress_size_after = 0;
engine.input.progress_interval_hint = 0;
}
// If the encoded array is larger than the data we have currently buffered
@@ -7807,19 +7807,19 @@ ufbxi_nodiscard ufbxi_noinline static int ufbxi_binary_parse_node(ufbxi_context
// usual (given that we clear the `uc->data/_size` buffer below).
// NOTE: We _cannot_ share `read_buffer` if we plan to read later from it
// as `ufbx_inflate()` overwrites parts of it with zeroes.
if (encoded_size > input.data_size) {
input.buffer = uc->read_buffer;
input.buffer_size = uc->read_buffer_size;
input.read_fn = uc->read_fn;
input.read_user = uc->read_user;
uc->data_offset += encoded_size - input.data_size;
uc->data += input.data_size;
if (encoded_size > engine.input.data_size) {
engine.input.buffer = uc->read_buffer;
engine.input.buffer_size = uc->read_buffer_size;
engine.input.read_fn = uc->read_fn;
engine.input.read_user = uc->read_user;
uc->data_offset += encoded_size - engine.input.data_size;
uc->data += engine.input.data_size;
uc->data_size = 0;
} else {
input.buffer = NULL;
input.buffer_size = 0;
input.read_fn = NULL;
input.read_user = 0;
engine.input.buffer = NULL;
engine.input.buffer_size = 0;
engine.input.read_fn = NULL;
engine.input.read_user = 0;
uc->data += encoded_size;
uc->data_size -= encoded_size;
ufbxi_check(ufbxi_resume_progress(uc));
@@ -17347,7 +17347,7 @@ ufbxi_nodiscard ufbxi_noinline static int ufbxi_finalize_shader_texture(ufbxi_co
ufbx_string name = prop->name;
if (!ufbxi_remove_prefix_str(&name, shader->prop_prefix)) continue;
// Check if this property is a modifier to an existing input.
// Check if this property is a modifier to an existing engine.input.
ufbx_string base_name = name;
if (ufbxi_remove_suffix_c(&base_name, "_map") || ufbxi_remove_suffix_c(&base_name, ".shader")) {
ufbx_shader_texture_input *base = ufbx_find_shader_texture_input_len(shader, base_name.data, base_name.length);
@@ -24251,14 +24251,14 @@ static ufbxi_noinline int ufbxi_subdivide_attrib(ufbxi_subdivide_context *sc, uf
ufbx_assert(attrib->value_reals >= 1 && attrib->value_reals <= 4);
ufbxi_subdivide_layer_input input;
input.sum_fn = ufbxi_real_sum_fns[attrib->value_reals - 1];
input.sum_user = NULL;
input.values = attrib->values.data;
input.indices = attrib->indices.data;
input.stride = attrib->value_reals * sizeof(ufbx_real);
input.boundary = boundary;
input.check_split_data = check_split_data;
input.ignore_indices = false;
engine.input.sum_fn = ufbxi_real_sum_fns[attrib->value_reals - 1];
engine.input.sum_user = NULL;
engine.input.values = attrib->values.data;
engine.input.indices = attrib->indices.data;
engine.input.stride = attrib->value_reals * sizeof(ufbx_real);
engine.input.boundary = boundary;
engine.input.check_split_data = check_split_data;
engine.input.ignore_indices = false;
ufbxi_subdivide_layer_output output;
ufbxi_check_err(&sc->error, ufbxi_subdivide_layer(sc, &output, &input));
@@ -24334,14 +24334,14 @@ static ufbxi_noinline int ufbxi_subdivide_weights(ufbxi_subdivide_context *sc, u
ufbxi_check_err(&sc->error, src);
ufbxi_subdivide_layer_input input;
input.sum_fn = ufbxi_subdivide_sum_vertex_weights;
input.sum_user = sc;
input.values = src;
input.indices = sc->src_mesh.vertex_indices.data;
input.stride = sizeof(ufbxi_subdivision_vertex_weights);
input.boundary = sc->opts.boundary;
input.check_split_data = false;
input.ignore_indices = true;
engine.input.sum_fn = ufbxi_subdivide_sum_vertex_weights;
engine.input.sum_user = sc;
engine.input.values = src;
engine.input.indices = sc->src_mesh.vertex_indices.data;
engine.input.stride = sizeof(ufbxi_subdivision_vertex_weights);
engine.input.boundary = sc->opts.boundary;
engine.input.check_split_data = false;
engine.input.ignore_indices = true;
sc->total_weights = 0;

View File

@@ -2089,7 +2089,7 @@ typedef enum ufbx_shader_type UFBX_ENUM_REPR {
// https://github.com/Autodesk/standard-surface
UFBX_SHADER_OSL_STANDARD_SURFACE,
// Arnold standard surface
// https://docs.arnoldrenderer.com/display/A5AFMUG/Standard+Surface
// https://docs.arnoldengine.renderer.com/display/A5AFMUG/Standard+Surface
UFBX_SHADER_ARNOLD_STANDARD_SURFACE,
// 3ds Max Physical Material
// https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2022/ENU/3DSMax-Lighting-Shading/files/GUID-C1328905-7783-4917-AB86-FC3CC19E8972-htm.html
@@ -2501,10 +2501,10 @@ UFBX_ENUM_TYPE(ufbx_shader_texture_type, UFBX_SHADER_TEXTURE_TYPE, UFBX_SHADER_T
typedef struct ufbx_shader_texture_input {
// Name of the input.
// Name of the engine.input.
ufbx_string name;
// Constant value of the input.
// Constant value of the engine.input.
union {
ufbx_real value_real;
ufbx_vec2 value_vec2;
@@ -2515,7 +2515,7 @@ typedef struct ufbx_shader_texture_input {
ufbx_string value_str;
ufbx_blob value_blob;
// Texture connected to this input.
// Texture connected to this engine.input.
ufbx_nullable ufbx_texture *texture;
// Index of the output to use if `texture` is a multi-output shader node.
@@ -2525,7 +2525,7 @@ typedef struct ufbx_shader_texture_input {
// NOTE: Some shading models allow this to be `true` even if `texture == NULL`.
bool texture_enabled;
// Property representing this input.
// Property representing this engine.input.
ufbx_prop *prop;
// Property representing `texture`.
@@ -2550,7 +2550,7 @@ typedef struct ufbx_shader_texture {
uint64_t shader_type_id;
// Input values/textures (possibly further shader textures) to the shader.
// Sorted by `ufbx_shader_texture_input.name`.
// Sorted by `ufbx_shader_texture_engine.input.name`.
ufbx_shader_texture_input_list inputs;
// Shader source code if found.