├── .gitignore ├── LICENSE.md ├── README.md ├── data ├── articles │ ├── CustomShaderLanguage │ │ ├── Platform.h │ │ ├── SimpleData.hdf │ │ ├── SimpleFullscreen.hfx │ │ ├── SimpleFullscreen_ComputeTest.comp │ │ ├── SimpleFullscreen_ToScreen.frag │ │ └── SimpleFullscreen_ToScreen.vert │ ├── GpuDrivenText │ │ ├── BayerDither4x4.png │ │ ├── BayerDither8x8.png │ │ ├── debug_gpu_font.h │ │ ├── debug_gpu_text.hfx │ │ ├── gothic-hero-run.png │ │ ├── hell-hound-run.png │ │ ├── night-town-background-clouds.png │ │ ├── nightmare-galloping.png │ │ ├── pixel_art.hfx │ │ ├── platform.h │ │ └── wolf-runing-cycle.png │ ├── PixelArtFiltering │ │ ├── crt-lottes-fast.slang │ │ ├── crt-lottes.glsl │ │ ├── night-town-background-town.png │ │ ├── nightmare-galloping_edge.png │ │ ├── pixel_art_filtering.hfx │ │ ├── pixel_art_post.hfx │ │ └── platform.h │ ├── SerializationDemo │ │ ├── cutscene.json │ │ └── new_game.json │ └── StarRendering │ │ ├── bbr_color.txt │ │ ├── bsc5.bin │ │ ├── capsule_mask.png │ │ ├── constellations_lines.txt │ │ ├── platform.h │ │ └── stars.hfx ├── bin │ ├── AngeloCensorship.tbhr │ ├── FullscreenTexture.bhfx │ ├── GLTF │ │ └── DamagedHelmet │ │ │ ├── Default_AO.tbhr │ │ │ ├── Default_albedo.tbhr │ │ │ ├── Default_emissive.tbhr │ │ │ ├── Default_metalRoughness.tbhr │ │ │ └── Default_normal.tbhr │ ├── ImGui.bhfx │ ├── Lines.bhfx │ ├── Lines.mbhr │ ├── Material_MR.mbhr │ ├── PBR.bhfx │ ├── SimpleFullscreen.bhfx │ ├── SimpleFullscreen.mbhr │ ├── Swapchain.mbhr │ ├── cutscene.bin │ ├── new_game.bin │ ├── pixel_art_filtering.bin │ └── pixel_art_post.bin └── source │ ├── AngeloCensorship.png │ ├── FullscreenTexture.hfx │ ├── GLTF │ ├── Box │ │ ├── Box.gltf │ │ └── Box0.bin │ ├── DamagedHelmet │ │ ├── DamagedHelmet.bin │ │ ├── DamagedHelmet.gltf │ │ ├── Default_AO.jpg │ │ ├── Default_albedo.jpg │ │ ├── Default_emissive.jpg │ │ ├── Default_metalRoughness.jpg │ │ └── Default_normal.jpg │ └── Lantern │ │ ├── Lantern.bin │ │ ├── Lantern.gltf │ │ ├── Lantern_baseColor.png │ │ ├── Lantern_emissive.png │ │ ├── Lantern_normal.png │ │ └── Lantern_roughnessMetallic.png │ ├── ImGui.hfx │ ├── LanternPost_Mat.hmt │ ├── Lines.hfx │ ├── Lines.hmt │ ├── Material.fbs │ ├── Material_MR.hmt │ ├── PBR.hfx │ ├── PerlinNoise.png │ ├── Platform.h │ ├── RenderDefinitions.fbs │ ├── RenderPasses.fbs │ ├── RenderPipelines.json │ ├── ShaderToy.hfx │ ├── SimpleData.hdf │ ├── SimpleFullscreen.hfx │ ├── SimpleFullscreen.hmt │ ├── StarNest.hfx │ ├── StarNest.hmt │ ├── Swapchain.hmt │ ├── black.png │ ├── math.h │ └── white.png ├── project ├── CustomShaderLanguage.vcxproj ├── DataDrivenRendering.sln ├── Demos │ ├── Demos.sln │ ├── GpuDrivenText.vcxproj │ ├── PixelArtFiltering.vcxproj │ ├── Serialization.vcxproj │ └── StarMap.vcxproj ├── Materials.vcxproj ├── NodeEditor.json ├── RenderPipelines.vcxproj └── ShaderAugmentation.vcxproj └── source ├── Articles ├── CustomShaderLanguage │ ├── CodeGenerator.h │ ├── CustomShaderLanguage.cpp │ ├── CustomShaderLanguage.h │ ├── ShaderCodeGenerator.cpp │ ├── ShaderCodeGenerator.h │ ├── SimpleFullscreen.h │ └── simpledata.h ├── GpuDrivenText │ ├── generated │ │ ├── debug_gpu_text.bhfx2.h │ │ └── pixel_art.bhfx2.h │ └── main.cpp ├── MaterialSystem │ ├── MaterialSystem.cpp │ └── MaterialSystem.h ├── PixelArtFiltering │ ├── cglm │ │ ├── affine-mat.h │ │ ├── affine.h │ │ ├── affine2d.h │ │ ├── applesimd.h │ │ ├── bezier.h │ │ ├── box.h │ │ ├── call.h │ │ ├── call │ │ │ ├── affine.h │ │ │ ├── affine2d.h │ │ │ ├── bezier.h │ │ │ ├── box.h │ │ │ ├── cam.h │ │ │ ├── curve.h │ │ │ ├── ease.h │ │ │ ├── euler.h │ │ │ ├── frustum.h │ │ │ ├── io.h │ │ │ ├── mat2.h │ │ │ ├── mat3.h │ │ │ ├── mat4.h │ │ │ ├── plane.h │ │ │ ├── project.h │ │ │ ├── quat.h │ │ │ ├── ray.h │ │ │ ├── sphere.h │ │ │ ├── vec2.h │ │ │ ├── vec3.h │ │ │ └── vec4.h │ │ ├── cam.h │ │ ├── cglm.h │ │ ├── color.h │ │ ├── common.h │ │ ├── curve.h │ │ ├── ease.h │ │ ├── euler.h │ │ ├── frustum.h │ │ ├── io.h │ │ ├── mat2.h │ │ ├── mat3.h │ │ ├── mat4.h │ │ ├── plane.h │ │ ├── project.h │ │ ├── quat.h │ │ ├── ray.h │ │ ├── simd │ │ │ ├── arm.h │ │ │ ├── avx │ │ │ │ ├── affine.h │ │ │ │ └── mat4.h │ │ │ ├── intrin.h │ │ │ ├── neon │ │ │ │ └── mat4.h │ │ │ ├── sse2 │ │ │ │ ├── affine.h │ │ │ │ ├── mat2.h │ │ │ │ ├── mat3.h │ │ │ │ ├── mat4.h │ │ │ │ └── quat.h │ │ │ └── x86.h │ │ ├── sphere.h │ │ ├── struct.h │ │ ├── struct │ │ │ ├── affine.h │ │ │ ├── affine2d.h │ │ │ ├── box.h │ │ │ ├── cam.h │ │ │ ├── color.h │ │ │ ├── curve.h │ │ │ ├── euler.h │ │ │ ├── frustum.h │ │ │ ├── io.h │ │ │ ├── mat2.h │ │ │ ├── mat3.h │ │ │ ├── mat4.h │ │ │ ├── plane.h │ │ │ ├── project.h │ │ │ ├── quat.h │ │ │ ├── sphere.h │ │ │ ├── vec2-ext.h │ │ │ ├── vec2.h │ │ │ ├── vec3-ext.h │ │ │ ├── vec3.h │ │ │ ├── vec4-ext.h │ │ │ └── vec4.h │ │ ├── types-struct.h │ │ ├── types.h │ │ ├── util.h │ │ ├── vec2-ext.h │ │ ├── vec2.h │ │ ├── vec3-ext.h │ │ ├── vec3.h │ │ ├── vec4-ext.h │ │ ├── vec4.h │ │ └── version.h │ ├── external │ │ ├── json.hpp │ │ ├── stb_ds.h │ │ └── stb_leakcheck.h │ ├── hydra │ │ ├── .gitignore │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── deprecated │ │ │ ├── hydra_application.cpp │ │ │ ├── hydra_application.h │ │ │ ├── hydra_rendering.cpp │ │ │ └── hydra_rendering.h │ │ ├── hydra_animation.cpp │ │ ├── hydra_animation.h │ │ ├── hydra_application.cpp │ │ ├── hydra_application.h │ │ ├── hydra_data_format.cpp │ │ ├── hydra_data_format.h │ │ ├── hydra_graphics.cpp │ │ ├── hydra_graphics.h │ │ ├── hydra_imgui.cpp │ │ ├── hydra_imgui.h │ │ ├── hydra_input.cpp │ │ ├── hydra_input.h │ │ ├── hydra_lexer.cpp │ │ ├── hydra_lexer.h │ │ ├── hydra_lib.cpp │ │ ├── hydra_lib.h │ │ ├── hydra_render_graph.cpp │ │ ├── hydra_render_graph.h │ │ ├── hydra_rendering.cpp │ │ ├── hydra_rendering.h │ │ ├── hydra_resources.cpp │ │ ├── hydra_resources.h │ │ ├── hydra_shaderfx.cpp │ │ ├── hydra_shaderfx.h │ │ └── vk_mem_alloc.h │ ├── imgui │ │ ├── LICENSE.txt │ │ ├── TextEditor.cpp │ │ ├── TextEditor.h │ │ ├── imconfig.h │ │ ├── imgui.cpp │ │ ├── imgui.h │ │ ├── imgui_demo.cpp │ │ ├── imgui_draw.cpp │ │ ├── imgui_impl_sdl.cpp │ │ ├── imgui_impl_sdl.h │ │ ├── imgui_internal.h │ │ ├── imgui_memory_editor.h │ │ ├── imgui_widgets.cpp │ │ ├── imstb_rectpack.h │ │ ├── imstb_textedit.h │ │ ├── imstb_truetype.h │ │ └── stb_image.h │ ├── pixel_art_filtering_app.cpp │ └── pixel_art_filtering_app.h ├── RenderPipeline │ ├── RenderPipelineApplication.cpp │ └── RenderPipelineApplication.h ├── Serialization │ ├── blob.cpp │ ├── blob.hpp │ ├── hydra │ │ └── kernel │ │ │ └── primitive_types.hpp │ ├── json.hpp │ ├── serialization_demo.cpp │ ├── serialization_demo.hpp │ ├── serialization_examples.cpp │ └── serialization_examples.hpp ├── ShaderAugmentation │ ├── dirent.h │ ├── enkits │ │ ├── License.txt │ │ ├── LockLessMultiReadPipe.h │ │ ├── TaskScheduler.cpp │ │ └── TaskScheduler.h │ ├── hydra │ │ ├── hydra_application.cpp │ │ ├── hydra_application.h │ │ ├── hydra_graphics.cpp │ │ ├── hydra_graphics.h │ │ ├── hydra_imgui.cpp │ │ ├── hydra_imgui.h │ │ ├── hydra_lexer.cpp │ │ ├── hydra_lexer.h │ │ ├── hydra_lib.cpp │ │ ├── hydra_lib.h │ │ ├── hydra_shaderfx.cpp │ │ └── hydra_shaderfx.h │ ├── imgui │ │ ├── LICENSE.txt │ │ ├── TextEditor.cpp │ │ ├── TextEditor.h │ │ ├── imconfig.h │ │ ├── imgui.cpp │ │ ├── imgui.h │ │ ├── imgui_demo.cpp │ │ ├── imgui_draw.cpp │ │ ├── imgui_impl_opengl3.cpp │ │ ├── imgui_impl_opengl3.h │ │ ├── imgui_impl_sdl.cpp │ │ ├── imgui_impl_sdl.h │ │ ├── imgui_internal.h │ │ ├── imgui_memory_editor.h │ │ ├── imgui_widgets.cpp │ │ ├── imstb_rectpack.h │ │ ├── imstb_textedit.h │ │ ├── imstb_truetype.h │ │ └── stb_image.h │ ├── optick │ │ ├── LICENSE │ │ ├── optick.config.h │ │ ├── optick.h │ │ ├── optick_common.h │ │ ├── optick_core.cpp │ │ ├── optick_core.freebsd.h │ │ ├── optick_core.h │ │ ├── optick_core.linux.h │ │ ├── optick_core.macos.h │ │ ├── optick_core.platform.h │ │ ├── optick_core.win.h │ │ ├── optick_gpu.cpp │ │ ├── optick_gpu.d3d12.cpp │ │ ├── optick_gpu.h │ │ ├── optick_gpu.vulkan.cpp │ │ ├── optick_memory.h │ │ ├── optick_message.cpp │ │ ├── optick_message.h │ │ ├── optick_miniz.cpp │ │ ├── optick_miniz.h │ │ ├── optick_serialization.cpp │ │ ├── optick_serialization.h │ │ ├── optick_server.cpp │ │ └── optick_server.h │ ├── shader_augmentation.cpp │ └── stb_ds.h └── StarRendering │ ├── cglm │ ├── affine-mat.h │ ├── affine.h │ ├── affine2d.h │ ├── applesimd.h │ ├── bezier.h │ ├── box.h │ ├── call.h │ ├── call │ │ ├── affine.h │ │ ├── affine2d.h │ │ ├── bezier.h │ │ ├── box.h │ │ ├── cam.h │ │ ├── curve.h │ │ ├── ease.h │ │ ├── euler.h │ │ ├── frustum.h │ │ ├── io.h │ │ ├── mat2.h │ │ ├── mat3.h │ │ ├── mat4.h │ │ ├── plane.h │ │ ├── project.h │ │ ├── quat.h │ │ ├── ray.h │ │ ├── sphere.h │ │ ├── vec2.h │ │ ├── vec3.h │ │ └── vec4.h │ ├── cam.h │ ├── cglm.h │ ├── color.h │ ├── common.h │ ├── curve.h │ ├── ease.h │ ├── euler.h │ ├── frustum.h │ ├── io.h │ ├── mat2.h │ ├── mat3.h │ ├── mat4.h │ ├── plane.h │ ├── project.h │ ├── quat.h │ ├── ray.h │ ├── simd │ │ ├── arm.h │ │ ├── avx │ │ │ ├── affine.h │ │ │ └── mat4.h │ │ ├── intrin.h │ │ ├── neon │ │ │ └── mat4.h │ │ ├── sse2 │ │ │ ├── affine.h │ │ │ ├── mat2.h │ │ │ ├── mat3.h │ │ │ ├── mat4.h │ │ │ └── quat.h │ │ └── x86.h │ ├── sphere.h │ ├── struct.h │ ├── struct │ │ ├── affine.h │ │ ├── affine2d.h │ │ ├── box.h │ │ ├── cam.h │ │ ├── color.h │ │ ├── curve.h │ │ ├── euler.h │ │ ├── frustum.h │ │ ├── io.h │ │ ├── mat2.h │ │ ├── mat3.h │ │ ├── mat4.h │ │ ├── plane.h │ │ ├── project.h │ │ ├── quat.h │ │ ├── sphere.h │ │ ├── vec2-ext.h │ │ ├── vec2.h │ │ ├── vec3-ext.h │ │ ├── vec3.h │ │ ├── vec4-ext.h │ │ └── vec4.h │ ├── types-struct.h │ ├── types.h │ ├── util.h │ ├── vec2-ext.h │ ├── vec2.h │ ├── vec3-ext.h │ ├── vec3.h │ ├── vec4-ext.h │ ├── vec4.h │ └── version.h │ ├── external │ ├── json.hpp │ ├── stb_ds.h │ └── stb_leakcheck.h │ ├── hydra │ ├── .gitignore │ ├── LICENSE.md │ ├── README.md │ ├── hydra_application.cpp │ ├── hydra_application.h │ ├── hydra_data_format.cpp │ ├── hydra_data_format.h │ ├── hydra_graphics.cpp │ ├── hydra_graphics.h │ ├── hydra_imgui.cpp │ ├── hydra_imgui.h │ ├── hydra_lexer.cpp │ ├── hydra_lexer.h │ ├── hydra_lib.cpp │ ├── hydra_lib.h │ ├── hydra_rendering.cpp │ ├── hydra_rendering.h │ ├── hydra_resources.cpp │ ├── hydra_resources.h │ ├── hydra_shaderfx.cpp │ ├── hydra_shaderfx.h │ └── vk_mem_alloc.h │ ├── imgui │ ├── LICENSE.txt │ ├── TextEditor.cpp │ ├── TextEditor.h │ ├── imconfig.h │ ├── imgui.cpp │ ├── imgui.h │ ├── imgui_demo.cpp │ ├── imgui_draw.cpp │ ├── imgui_impl_sdl.cpp │ ├── imgui_impl_sdl.h │ ├── imgui_internal.h │ ├── imgui_memory_editor.h │ ├── imgui_widgets.cpp │ ├── imstb_rectpack.h │ ├── imstb_textedit.h │ ├── imstb_truetype.h │ └── stb_image.h │ ├── star_map_application.cpp │ └── star_map_application.h ├── NodeEditor ├── CMakeLists.txt ├── Include │ └── imgui_node_editor.h ├── Source │ ├── crude_json.cpp │ ├── crude_json.h │ ├── imgui_bezier_math.h │ ├── imgui_bezier_math.inl │ ├── imgui_canvas.cpp │ ├── imgui_canvas.h │ ├── imgui_extra_math.h │ ├── imgui_extra_math.inl │ ├── imgui_node_editor.cpp │ ├── imgui_node_editor_api.cpp │ ├── imgui_node_editor_internal.h │ └── imgui_node_editor_internal.inl └── Support │ └── imgui_node_editor.natvis ├── RenderDefinitions_generated.h ├── cglm ├── affine-mat.h ├── affine.h ├── affine2d.h ├── applesimd.h ├── bezier.h ├── box.h ├── call.h ├── call │ ├── affine.h │ ├── affine2d.h │ ├── bezier.h │ ├── box.h │ ├── cam.h │ ├── clipspace │ │ ├── ortho_lh_no.h │ │ ├── ortho_lh_zo.h │ │ ├── ortho_rh_no.h │ │ ├── ortho_rh_zo.h │ │ ├── persp_lh_no.h │ │ ├── persp_lh_zo.h │ │ ├── persp_rh_no.h │ │ ├── persp_rh_zo.h │ │ ├── project_no.h │ │ ├── project_zo.h │ │ ├── view_lh_no.h │ │ ├── view_lh_zo.h │ │ ├── view_rh_no.h │ │ └── view_rh_zo.h │ ├── curve.h │ ├── ease.h │ ├── euler.h │ ├── frustum.h │ ├── io.h │ ├── mat2.h │ ├── mat3.h │ ├── mat4.h │ ├── plane.h │ ├── project.h │ ├── quat.h │ ├── ray.h │ ├── sphere.h │ ├── vec2.h │ ├── vec3.h │ └── vec4.h ├── cam.h ├── cglm.h ├── clipspace │ ├── ortho_lh_no.h │ ├── ortho_lh_zo.h │ ├── ortho_rh_no.h │ ├── ortho_rh_zo.h │ ├── persp.h │ ├── persp_lh_no.h │ ├── persp_lh_zo.h │ ├── persp_rh_no.h │ ├── persp_rh_zo.h │ ├── project_no.h │ ├── project_zo.h │ ├── view_lh.h │ ├── view_lh_no.h │ ├── view_lh_zo.h │ ├── view_rh.h │ ├── view_rh_no.h │ └── view_rh_zo.h ├── color.h ├── common.h ├── curve.h ├── ease.h ├── euler.h ├── frustum.h ├── io.h ├── mat2.h ├── mat3.h ├── mat4.h ├── plane.h ├── project.h ├── quat.h ├── ray.h ├── simd │ ├── arm.h │ ├── avx │ │ ├── affine.h │ │ └── mat4.h │ ├── intrin.h │ ├── neon │ │ ├── affine.h │ │ ├── mat2.h │ │ ├── mat4.h │ │ └── quat.h │ ├── sse2 │ │ ├── affine.h │ │ ├── mat2.h │ │ ├── mat3.h │ │ ├── mat4.h │ │ └── quat.h │ └── x86.h ├── sphere.h ├── struct.h ├── struct │ ├── affine.h │ ├── affine2d.h │ ├── box.h │ ├── cam.h │ ├── clipspace │ │ ├── ortho_lh_no.h │ │ ├── ortho_lh_zo.h │ │ ├── ortho_rh_no.h │ │ ├── ortho_rh_zo.h │ │ ├── persp_lh_no.h │ │ ├── persp_lh_zo.h │ │ ├── persp_rh_no.h │ │ ├── persp_rh_zo.h │ │ ├── view_lh_no.h │ │ ├── view_lh_zo.h │ │ ├── view_rh_no.h │ │ └── view_rh_zo.h │ ├── color.h │ ├── curve.h │ ├── euler.h │ ├── frustum.h │ ├── io.h │ ├── mat2.h │ ├── mat3.h │ ├── mat4.h │ ├── plane.h │ ├── project.h │ ├── quat.h │ ├── sphere.h │ ├── vec2-ext.h │ ├── vec2.h │ ├── vec3-ext.h │ ├── vec3.h │ ├── vec4-ext.h │ └── vec4.h ├── types-struct.h ├── types.h ├── util.h ├── vec2-ext.h ├── vec2.h ├── vec3-ext.h ├── vec3.h ├── vec4-ext.h ├── vec4.h └── version.h ├── external ├── json.hpp ├── stb_ds.h ├── stb_leakcheck.h └── tiny_gltf.h ├── hydra ├── Deprecated.h ├── Lexer.cpp ├── Lexer.h ├── ShaderCodeGenerator.cpp ├── ShaderCodeGenerator.h ├── hydra_application.cpp ├── hydra_application.h ├── hydra_graphics.cpp ├── hydra_graphics.h ├── hydra_imgui.cpp ├── hydra_imgui.h ├── hydra_lib.cpp ├── hydra_lib.h ├── hydra_rendering.cpp ├── hydra_rendering.h ├── hydra_resources.cpp ├── hydra_resources.h └── vk_mem_alloc.h ├── hydra_next ├── project │ ├── HydraNext.sln │ ├── HydraNext.vcxproj │ └── hydra.props └── source │ ├── application │ ├── application.cpp │ ├── application.hpp │ ├── game_application.cpp │ ├── game_application.hpp │ ├── hydra_application.hpp │ ├── hydra_imgui.cpp │ ├── hydra_imgui.hpp │ ├── hydra_input.cpp │ ├── hydra_input.hpp │ ├── input.cpp │ ├── input.hpp │ ├── keys.cpp │ ├── keys.hpp │ ├── window.cpp │ └── window.hpp │ ├── external │ ├── StackWalker.cpp │ ├── StackWalker.h │ ├── stb_image.h │ ├── thsvs.h │ ├── tlsf.c │ ├── tlsf.h │ ├── vk_mem_alloc.h │ └── wyhash.h │ ├── graphics │ ├── animation.cpp │ ├── animation.hpp │ ├── camera.cpp │ ├── camera.hpp │ ├── command_buffer.cpp │ ├── command_buffer.hpp │ ├── debug_renderer.cpp │ ├── debug_renderer.hpp │ ├── gpu_device.cpp │ ├── gpu_device.hpp │ ├── gpu_device_vulkan.cpp │ ├── gpu_device_vulkan.hpp │ ├── gpu_enum.hpp │ ├── gpu_enum_vulkan.hpp │ ├── gpu_profiler.cpp │ ├── gpu_profiler.hpp │ ├── gpu_resources.cpp │ ├── gpu_resources.hpp │ ├── gpu_resources_vulkan.hpp │ ├── hydra_graphics.hpp │ ├── hydra_shaderfx.cpp │ ├── hydra_shaderfx.h │ ├── render_graph.cpp │ ├── render_graph.hpp │ ├── renderer.cpp │ ├── renderer.hpp │ ├── sprite_batch.cpp │ └── sprite_batch.hpp │ └── kernel │ ├── array.hpp │ ├── assert.cpp │ ├── assert.hpp │ ├── bit.cpp │ ├── bit.hpp │ ├── blob.hpp │ ├── blob_serialization.cpp │ ├── blob_serialization.hpp │ ├── color.cpp │ ├── color.hpp │ ├── data_structures.cpp │ ├── data_structures.hpp │ ├── file.cpp │ ├── file.hpp │ ├── hash_map.hpp │ ├── hydra_lib.cpp │ ├── hydra_lib.hpp │ ├── lexer.cpp │ ├── lexer.hpp │ ├── log.cpp │ ├── log.hpp │ ├── main.cpp │ ├── memory.cpp │ ├── memory.hpp │ ├── memory_utils.hpp │ ├── numerics.cpp │ ├── numerics.hpp │ ├── platform.hpp │ ├── primitive_types.hpp │ ├── process.cpp │ ├── process.hpp │ ├── relative_data_structures.hpp │ ├── resource_manager.cpp │ ├── resource_manager.hpp │ ├── serialization.cpp │ ├── serialization.hpp │ ├── service.cpp │ ├── service.hpp │ ├── service_manager.cpp │ ├── service_manager.hpp │ ├── string.cpp │ ├── string.hpp │ ├── time.cpp │ └── time.hpp ├── imgui ├── LICENSE.txt ├── TextEditor.cpp ├── TextEditor.h ├── imconfig.h ├── imgui.cpp ├── imgui.h ├── imgui_demo.cpp ├── imgui_draw.cpp ├── imgui_impl_sdl.cpp ├── imgui_impl_sdl.h ├── imgui_internal.h ├── imgui_memory_editor.h ├── imgui_widgets.cpp ├── imstb_rectpack.h ├── imstb_textedit.h ├── imstb_truetype.h └── stb_image.h └── rapidjson ├── allocators.h ├── cursorstreamwrapper.h ├── document.h ├── encodedstream.h ├── encodings.h ├── error ├── en.h └── error.h ├── filereadstream.h ├── filewritestream.h ├── fwd.h ├── internal ├── biginteger.h ├── diyfp.h ├── dtoa.h ├── ieee754.h ├── itoa.h ├── meta.h ├── pow10.h ├── regex.h ├── stack.h ├── strfunc.h ├── strtod.h └── swap.h ├── istreamwrapper.h ├── memorybuffer.h ├── memorystream.h ├── msinttypes ├── inttypes.h └── stdint.h ├── ostreamwrapper.h ├── pointer.h ├── prettywriter.h ├── rapidjson.h ├── reader.h ├── schema.h ├── stream.h ├── stringbuffer.h └── writer.h /.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in/ 2 | /[Bb]uild/ 3 | /[Dd]ebug/ 4 | /[Rr]elease/ 5 | /**/.vs/ 6 | /**/x64/ 7 | /**/x86/ 8 | 9 | # MSVC user extensions 10 | *.opensdf 11 | *.sdf 12 | *.suo 13 | *.filters 14 | *.user 15 | *.obj 16 | *.pdb 17 | *.idb 18 | *.log 19 | *.tlog 20 | *.lastbuildstate 21 | *.dll 22 | *.lib 23 | *.exp 24 | *.opendb 25 | *.ini 26 | *.exe 27 | *.ilk 28 | *.mbhr 29 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | zlib/libpng license 2 | 3 | Copyright (c) 2019 Gabriel Sassone 4 | 5 | This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | 9 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 10 | 11 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 12 | 13 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /data/articles/CustomShaderLanguage/Platform.h: -------------------------------------------------------------------------------- 1 | #version 450 2 | -------------------------------------------------------------------------------- /data/articles/CustomShaderLanguage/SimpleFullscreen_ComputeTest.comp: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | 4 | 5 | #define COMPUTE 6 | 7 | layout (std140, binding=7) uniform LocalConstants { 8 | 9 | float scale; 10 | float modulo; 11 | float pad_tail[2]; 12 | 13 | } local_constants; 14 | 15 | 16 | #pragma include "Platform.h" 17 | 18 | layout(binding=1) uniform sampler2D albedo_texture; 19 | 20 | layout(rgba8, binding=0) writeonly uniform image2D destination_texture; 21 | 22 | layout (local_size_x = 32, local_size_y = 32, local_size_z = 1) in; 23 | 24 | void main() { 25 | 26 | ivec2 pos = ivec2(gl_GlobalInvocationID.xy); 27 | 28 | // Returns a checkerboard pattern: 29 | vec2 scaled_pos = ceil(gl_GlobalInvocationID.xy / local_constants.scale); 30 | float color = mod(scaled_pos.x + scaled_pos.y, local_constants.modulo); 31 | 32 | imageStore(destination_texture, pos, vec4(color.rrr, 1)); 33 | } 34 | -------------------------------------------------------------------------------- /data/articles/CustomShaderLanguage/SimpleFullscreen_ToScreen.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | 4 | 5 | #define FRAGMENT 6 | 7 | layout (std140, binding=7) uniform LocalConstants { 8 | 9 | float scale; 10 | float modulo; 11 | float pad_tail[2]; 12 | 13 | } local_constants; 14 | 15 | 16 | #pragma include "Platform.h" 17 | 18 | #if defined VERTEX 19 | out vec4 vTexCoord; 20 | 21 | void main() { 22 | 23 | vTexCoord.xy = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2); 24 | vTexCoord.zw = vTexCoord.xy; 25 | 26 | gl_Position = vec4(vTexCoord.xy * 2.0f + -1.0f, 0.0f, 1.0f); 27 | } 28 | #endif // VERTEX 29 | 30 | #if defined FRAGMENT 31 | 32 | in vec4 vTexCoord; 33 | 34 | out vec4 outColor; 35 | 36 | layout(binding=0) uniform sampler2D input_texture; 37 | 38 | void main() { 39 | vec3 color = texture2D(input_texture, vTexCoord.xy).xyz; 40 | outColor = vec4(1, 1, 0, 1); 41 | outColor = vec4(color, 1); 42 | } 43 | #endif // FRAGMENT 44 | -------------------------------------------------------------------------------- /data/articles/CustomShaderLanguage/SimpleFullscreen_ToScreen.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | 4 | 5 | #define VERTEX 6 | 7 | layout (std140, binding=7) uniform LocalConstants { 8 | 9 | float scale; 10 | float modulo; 11 | float pad_tail[2]; 12 | 13 | } local_constants; 14 | 15 | 16 | #pragma include "Platform.h" 17 | 18 | #if defined VERTEX 19 | out vec4 vTexCoord; 20 | 21 | void main() { 22 | 23 | vTexCoord.xy = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2); 24 | vTexCoord.zw = vTexCoord.xy; 25 | 26 | gl_Position = vec4(vTexCoord.xy * 2.0f + -1.0f, 0.0f, 1.0f); 27 | } 28 | #endif // VERTEX 29 | 30 | #if defined FRAGMENT 31 | 32 | in vec4 vTexCoord; 33 | 34 | out vec4 outColor; 35 | 36 | layout(binding=0) uniform sampler2D input_texture; 37 | 38 | void main() { 39 | vec3 color = texture2D(input_texture, vTexCoord.xy).xyz; 40 | outColor = vec4(1, 1, 0, 1); 41 | outColor = vec4(color, 1); 42 | } 43 | #endif // FRAGMENT 44 | -------------------------------------------------------------------------------- /data/articles/GpuDrivenText/BayerDither4x4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/GpuDrivenText/BayerDither4x4.png -------------------------------------------------------------------------------- /data/articles/GpuDrivenText/BayerDither8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/GpuDrivenText/BayerDither8x8.png -------------------------------------------------------------------------------- /data/articles/GpuDrivenText/gothic-hero-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/GpuDrivenText/gothic-hero-run.png -------------------------------------------------------------------------------- /data/articles/GpuDrivenText/hell-hound-run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/GpuDrivenText/hell-hound-run.png -------------------------------------------------------------------------------- /data/articles/GpuDrivenText/night-town-background-clouds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/GpuDrivenText/night-town-background-clouds.png -------------------------------------------------------------------------------- /data/articles/GpuDrivenText/nightmare-galloping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/GpuDrivenText/nightmare-galloping.png -------------------------------------------------------------------------------- /data/articles/GpuDrivenText/platform.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined (FULLSCREEN_TRI) && defined(VERTEX) 3 | 4 | layout (location = 0) out vec2 vTexCoord; 5 | layout (location = 1) flat out uint out_texture_id; 6 | 7 | void main() { 8 | 9 | vTexCoord.xy = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2); 10 | gl_Position = vec4(vTexCoord.xy * 2.0f - 1.0f, 0.0f, 1.0f); 11 | gl_Position.y = -gl_Position.y; 12 | 13 | out_texture_id = gl_InstanceIndex; 14 | } 15 | 16 | #endif // FULLSCREEN_TRI 17 | 18 | vec3 world_position_from_depth( vec2 uv, float raw_depth, mat4 inverse_view_projection ) { 19 | 20 | vec4 H = vec4( uv.x * 2 - 1, uv.y * -2 + 1, raw_depth * 2 - 1, 1 ); 21 | vec4 D = inverse_view_projection * H; 22 | 23 | return D.xyz / D.w; 24 | } 25 | 26 | // Bindless textures test! 27 | #define HYDRA_BINDLESS 28 | 29 | #if defined(HYDRA_BINDLESS) 30 | 31 | #extension GL_EXT_nonuniform_qualifier : enable 32 | 33 | layout ( set = 1, binding = 10 ) uniform sampler2D textures[]; 34 | layout ( set = 1, binding = 10 ) uniform sampler3D textures_3d[]; 35 | 36 | #endif // HYDRA_BINDLESS 37 | -------------------------------------------------------------------------------- /data/articles/GpuDrivenText/wolf-runing-cycle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/GpuDrivenText/wolf-runing-cycle.png -------------------------------------------------------------------------------- /data/articles/PixelArtFiltering/night-town-background-town.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/PixelArtFiltering/night-town-background-town.png -------------------------------------------------------------------------------- /data/articles/PixelArtFiltering/nightmare-galloping_edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/PixelArtFiltering/nightmare-galloping_edge.png -------------------------------------------------------------------------------- /data/articles/PixelArtFiltering/pixel_art_post.hfx: -------------------------------------------------------------------------------- 1 | shader pixel_art { 2 | 3 | layout { 4 | list Local { 5 | texture2D albedo; 6 | } 7 | 8 | list crt { 9 | cbuffer Locals Locals; 10 | texture2D albedo; 11 | } 12 | } 13 | 14 | render_states { 15 | 16 | state fullscreen { 17 | Cull None 18 | ZTest Always 19 | ZWrite Off 20 | } 21 | } 22 | 23 | glsl pass_through { 24 | 25 | #pragma include "Platform.h" 26 | 27 | #if defined VERTEX 28 | 29 | layout (location = 0) out vec2 vTexCoord; 30 | 31 | void main() { 32 | 33 | vTexCoord.xy = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2); 34 | gl_Position = vec4(vTexCoord.xy * 2.0f - 1.0f, 0.0f, 1.0f); 35 | gl_Position.y = -gl_Position.y; 36 | } 37 | 38 | 39 | #endif // VERTEX 40 | 41 | 42 | #if defined FRAGMENT 43 | 44 | layout (location = 0) in vec2 uv; 45 | 46 | layout (location = 0) out vec4 out_color; 47 | 48 | layout (binding = 0) uniform sampler2D albedo; 49 | 50 | void main() { 51 | 52 | vec4 color = texture( albedo, uv.xy ); 53 | out_color = vec4(color.rgb, 1); 54 | } 55 | 56 | #endif // FRAGMENT 57 | } 58 | 59 | glsl crt_lottes { 60 | #pragma include "crt-lottes-fast.slang" 61 | } 62 | 63 | pass pass_through { 64 | resources = Local 65 | vertex = pass_through 66 | fragment = pass_through 67 | render_states = fullscreen 68 | } 69 | 70 | 71 | pass crt_lottes { 72 | resources = crt 73 | vertex = pass_through 74 | fragment = crt_lottes 75 | render_states = fullscreen 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /data/articles/PixelArtFiltering/platform.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined (FULLSCREEN_TRI) && defined(VERTEX) 3 | 4 | layout (location = 0) out vec2 vTexCoord; 5 | 6 | void main() { 7 | 8 | vTexCoord.xy = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2); 9 | gl_Position = vec4(vTexCoord.xy * 2.0f - 1.0f, 0.0f, 1.0f); 10 | gl_Position.y = -gl_Position.y; 11 | } 12 | 13 | #endif // FULLSCREEN_TRI 14 | 15 | vec3 world_position_from_depth( vec2 uv, float raw_depth, mat4 inverse_view_projection ) { 16 | 17 | vec4 H = vec4( uv.x * 2 - 1, uv.y * -2 + 1, raw_depth * 2 - 1, 1 ); 18 | vec4 D = inverse_view_projection * H; 19 | 20 | return D.xyz / D.w; 21 | } 22 | -------------------------------------------------------------------------------- /data/articles/SerializationDemo/cutscene.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"new_game", 3 | "scene": "", 4 | "commands" : [ 5 | { 6 | "type" : "fade", 7 | "start" : 0.0, 8 | "end" : 1.0, 9 | "duration" : 0.0 10 | }, 11 | { 12 | "type" : "move_entity", 13 | "x" : -16, 14 | "y" : -8, 15 | "instant" : true, 16 | "entity_name" : "cronos_mum" 17 | }, 18 | { 19 | "type" : "dialogue", 20 | "text" : "{SPEED=0.025}Crono...{PAGE}Crono!{PAGE}Crono, are you still sleeping?{PAGE} " 21 | }, 22 | { 23 | "type" : "fade", 24 | "start" : 1.0, 25 | "end" : 0.0, 26 | "duration" : 2 27 | }, 28 | { 29 | "type" : "dialogue", 30 | "text" : "{SPEED=0.025}Dear me! I had forgotten how beautiful Leene's Bell sounds!{PAGE} " 31 | }, 32 | { 33 | "type" : "parallel", 34 | "count": 2 35 | }, 36 | { 37 | "type" : "move_entity", 38 | "x" : 8, 39 | "y" : 32, 40 | "speed" : 20, 41 | "entity_name" : "cronos_mum" 42 | }, 43 | { 44 | "type" : "move_camera", 45 | "x" : 30, 46 | "y" : 0, 47 | "speed" : 1.0 48 | }, 49 | { 50 | "type" : "parallel", 51 | "count": 1 52 | }, 53 | { 54 | "type" : "change_atlas_entry", 55 | "entry_name" : "upstairs_bright1", 56 | "entity_name" : "cronos_house" 57 | }, 58 | { 59 | "type" : "move_entity", 60 | "x" : -16, 61 | "y" : -8, 62 | "speed" : 30, 63 | "entity_name" : "cronos_mum" 64 | }, 65 | { 66 | "type" : "move_entity", 67 | "x" : -60, 68 | "y" : -8, 69 | "speed" : 30, 70 | "entity_name" : "cronos_mum" 71 | }, 72 | { 73 | "type" : "move_entity", 74 | "x" : -64, 75 | "y" : -52, 76 | "speed" : 30, 77 | "entity_name" : "cronos_mum" 78 | }, 79 | { 80 | "type" : "fade", 81 | "start" : 0.0, 82 | "end" : 1.0, 83 | "duration" : 1.0 84 | }, 85 | { 86 | "type" : "move_entity", 87 | "x" : -1000, 88 | "y" : 0, 89 | "instant" : true, 90 | "entity_name" : "cronos_mum" 91 | }, 92 | { 93 | "type" : "fade", 94 | "start" : 1.0, 95 | "end" : 0.0, 96 | "duration" : 1.0 97 | } 98 | ] 99 | } -------------------------------------------------------------------------------- /data/articles/SerializationDemo/new_game.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "new_game_scene", 3 | "entities" : [ 4 | { 5 | "name" : "cronos_mum", 6 | "type" : "npc", 7 | "position_x" : -1000.0, 8 | "position_y" : 0.0, 9 | "offset_z" : 5.0, 10 | "rendering" : { 11 | "atlas_path" : "data//chrono_trigger_npcs.png", 12 | "atlas_entry": 0 13 | } 14 | }, 15 | { 16 | "name" : "crono", 17 | "type" : "npc", 18 | "position_x" : 16.0, 19 | "position_y" : 0.0, 20 | "offset_z" : 5.0, 21 | "rendering" : { 22 | "atlas_path" : "data//crono_character.png", 23 | "atlas_entry" : 0 24 | } 25 | }, 26 | { 27 | "name" : "cronos_house", 28 | "type" : "background", 29 | "rendering" : { 30 | "atlas_path" : "data//crono_house.png" 31 | } 32 | }, 33 | { 34 | "name" : "cutscene_manager", 35 | "type" : "", 36 | "cutscene" : { 37 | "path" : "..//data//chrono_newgame.json" 38 | } 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /data/articles/StarRendering/bsc5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/StarRendering/bsc5.bin -------------------------------------------------------------------------------- /data/articles/StarRendering/capsule_mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/articles/StarRendering/capsule_mask.png -------------------------------------------------------------------------------- /data/articles/StarRendering/platform.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined (FULLSCREEN_TRI) && defined(VERTEX) 3 | 4 | layout (location = 0) out vec2 vTexCoord; 5 | 6 | void main() { 7 | 8 | vTexCoord.xy = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2); 9 | gl_Position = vec4(vTexCoord.xy * 2.0f - 1.0f, 0.0f, 1.0f); 10 | gl_Position.y = -gl_Position.y; 11 | } 12 | 13 | #endif // FULLSCREEN_TRI 14 | 15 | vec3 world_position_from_depth( vec2 uv, float raw_depth, mat4 inverse_view_projection ) { 16 | 17 | vec4 H = vec4( uv.x * 2 - 1, uv.y * -2 + 1, raw_depth * 2 - 1, 1 ); 18 | vec4 D = inverse_view_projection * H; 19 | 20 | return D.xyz / D.w; 21 | } 22 | -------------------------------------------------------------------------------- /data/bin/AngeloCensorship.tbhr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/AngeloCensorship.tbhr -------------------------------------------------------------------------------- /data/bin/FullscreenTexture.bhfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/FullscreenTexture.bhfx -------------------------------------------------------------------------------- /data/bin/GLTF/DamagedHelmet/Default_AO.tbhr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/GLTF/DamagedHelmet/Default_AO.tbhr -------------------------------------------------------------------------------- /data/bin/GLTF/DamagedHelmet/Default_albedo.tbhr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/GLTF/DamagedHelmet/Default_albedo.tbhr -------------------------------------------------------------------------------- /data/bin/GLTF/DamagedHelmet/Default_emissive.tbhr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/GLTF/DamagedHelmet/Default_emissive.tbhr -------------------------------------------------------------------------------- /data/bin/GLTF/DamagedHelmet/Default_metalRoughness.tbhr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/GLTF/DamagedHelmet/Default_metalRoughness.tbhr -------------------------------------------------------------------------------- /data/bin/GLTF/DamagedHelmet/Default_normal.tbhr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/GLTF/DamagedHelmet/Default_normal.tbhr -------------------------------------------------------------------------------- /data/bin/ImGui.bhfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/ImGui.bhfx -------------------------------------------------------------------------------- /data/bin/Lines.bhfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/Lines.bhfx -------------------------------------------------------------------------------- /data/bin/Lines.mbhr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/Lines.mbhr -------------------------------------------------------------------------------- /data/bin/Material_MR.mbhr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/Material_MR.mbhr -------------------------------------------------------------------------------- /data/bin/PBR.bhfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/PBR.bhfx -------------------------------------------------------------------------------- /data/bin/SimpleFullscreen.bhfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/SimpleFullscreen.bhfx -------------------------------------------------------------------------------- /data/bin/SimpleFullscreen.mbhr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/SimpleFullscreen.mbhr -------------------------------------------------------------------------------- /data/bin/Swapchain.mbhr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/Swapchain.mbhr -------------------------------------------------------------------------------- /data/bin/cutscene.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/cutscene.bin -------------------------------------------------------------------------------- /data/bin/new_game.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/new_game.bin -------------------------------------------------------------------------------- /data/bin/pixel_art_filtering.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/pixel_art_filtering.bin -------------------------------------------------------------------------------- /data/bin/pixel_art_post.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/bin/pixel_art_post.bin -------------------------------------------------------------------------------- /data/source/AngeloCensorship.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/AngeloCensorship.png -------------------------------------------------------------------------------- /data/source/FullscreenTexture.hfx: -------------------------------------------------------------------------------- 1 | shader FullscreenTexture { 2 | 3 | // For the developer 4 | layout { 5 | list Local { 6 | texture2D input_texture; 7 | } 8 | } 9 | 10 | glsl ToScreen { 11 | 12 | #pragma include "Platform.h" 13 | 14 | #if defined VERTEX 15 | layout (location = 0) out vec4 vTexCoord; 16 | 17 | void main() { 18 | 19 | vTexCoord.xy = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2); 20 | vTexCoord.zw = vTexCoord.xy; 21 | 22 | gl_Position = vec4(vTexCoord.xy * 2.0f + -1.0f, 0.0f, 1.0f); 23 | } 24 | #endif // VERTEX 25 | 26 | #if defined FRAGMENT 27 | 28 | layout (location = 0) in vec4 vTexCoord; 29 | 30 | layout (location = 0) out vec4 outColor; 31 | 32 | layout(binding=0) uniform sampler2D input_texture; 33 | 34 | void main() { 35 | vec3 color = texture2D(input_texture, vTexCoord.xy).xyz; 36 | outColor = vec4(color, 1); 37 | } 38 | #endif // FRAGMENT 39 | } 40 | 41 | pipeline = Default 42 | 43 | pass ToScreen { 44 | stage = final 45 | resources = Local 46 | vertex = ToScreen 47 | fragment = ToScreen 48 | } 49 | } 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /data/source/GLTF/Box/Box0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/Box/Box0.bin -------------------------------------------------------------------------------- /data/source/GLTF/DamagedHelmet/DamagedHelmet.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/DamagedHelmet/DamagedHelmet.bin -------------------------------------------------------------------------------- /data/source/GLTF/DamagedHelmet/Default_AO.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/DamagedHelmet/Default_AO.jpg -------------------------------------------------------------------------------- /data/source/GLTF/DamagedHelmet/Default_albedo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/DamagedHelmet/Default_albedo.jpg -------------------------------------------------------------------------------- /data/source/GLTF/DamagedHelmet/Default_emissive.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/DamagedHelmet/Default_emissive.jpg -------------------------------------------------------------------------------- /data/source/GLTF/DamagedHelmet/Default_metalRoughness.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/DamagedHelmet/Default_metalRoughness.jpg -------------------------------------------------------------------------------- /data/source/GLTF/DamagedHelmet/Default_normal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/DamagedHelmet/Default_normal.jpg -------------------------------------------------------------------------------- /data/source/GLTF/Lantern/Lantern.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/Lantern/Lantern.bin -------------------------------------------------------------------------------- /data/source/GLTF/Lantern/Lantern_baseColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/Lantern/Lantern_baseColor.png -------------------------------------------------------------------------------- /data/source/GLTF/Lantern/Lantern_emissive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/Lantern/Lantern_emissive.png -------------------------------------------------------------------------------- /data/source/GLTF/Lantern/Lantern_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/Lantern/Lantern_normal.png -------------------------------------------------------------------------------- /data/source/GLTF/Lantern/Lantern_roughnessMetallic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/GLTF/Lantern/Lantern_roughnessMetallic.png -------------------------------------------------------------------------------- /data/source/ImGui.hfx: -------------------------------------------------------------------------------- 1 | shader ImGui { 2 | 3 | // For the artist 4 | properties { 5 | 6 | } 7 | 8 | // For the developer 9 | layout { 10 | 11 | list Local { 12 | cbuffer LocalConstants; 13 | texture2D Texture; 14 | } 15 | 16 | vertex main { 17 | binding 0 20 vertex 18 | attribute float2 Position 0 0 0 19 | attribute float2 UV 0 1 8 20 | attribute ubyte4n Color 0 2 16 21 | } 22 | 23 | } 24 | 25 | render_states { 26 | state alpha_no_z { 27 | Cull None 28 | ZWrite Off 29 | BlendMode Alpha 30 | } 31 | } 32 | 33 | glsl ToScreen { 34 | 35 | #pragma include "Platform.h" 36 | 37 | #if defined VERTEX 38 | 39 | layout (location = 0) in vec2 Position; 40 | layout (location = 1) in vec2 UV; 41 | layout (location = 2) in vec4 Color; 42 | 43 | layout (std140, binding=0) uniform LocalConstants { mat4 ProjMtx; }; 44 | 45 | layout (location = 0) out vec2 Frag_UV; 46 | layout (location = 1) out vec4 Frag_Color; 47 | 48 | void main() 49 | { 50 | Frag_UV = UV; 51 | Frag_Color = Color; 52 | gl_Position = ProjMtx * vec4(Position.xy,0,1); 53 | } 54 | 55 | #endif // VERTEX 56 | 57 | #if defined FRAGMENT 58 | layout (location = 0) in vec2 Frag_UV; 59 | layout (location = 1) in vec4 Frag_Color; 60 | 61 | layout (binding = 1) uniform sampler2D Texture; 62 | 63 | layout (location = 0) out vec4 Out_Color; 64 | 65 | void main() 66 | { 67 | Out_Color = Frag_Color * texture(Texture, Frag_UV.st); 68 | } 69 | #endif // FRAGMENT 70 | } 71 | 72 | pass ToScreen { 73 | // stage = fullscreen 74 | render_states = alpha_no_z 75 | vertex_layout = main 76 | resources = Local 77 | vertex = ToScreen 78 | fragment = ToScreen 79 | } 80 | } -------------------------------------------------------------------------------- /data/source/LanternPost_Mat.hmt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "LanternPost_Mat", 3 | "effect_path": "PBR.hfx", 4 | "bindings": [ 5 | { 6 | "name": "ViewConstants", 7 | "resource_name": "CB_Lines" 8 | }, 9 | { 10 | "name": "Transform", 11 | "resource_name": "Transform" 12 | }, 13 | { 14 | "name": "albedo", 15 | "resource_name": "albedo_texture", 16 | "sampler": "linear" 17 | }, 18 | { 19 | "name": "normals", 20 | "resource_name": "normals_texture", 21 | "sampler": "linear" 22 | }, 23 | { 24 | "name": "metalRoughness", 25 | "sampler": "linear", 26 | "resource_name": "metal_roughness_texture" 27 | }, 28 | { 29 | "name": "emissive", 30 | "sampler": "linear", 31 | "resource_name": "emissive_texture" 32 | }, 33 | { 34 | "name": "occlusion", 35 | "sampler": "linear", 36 | "resource_name": "occlusion_texture" 37 | } 38 | ], 39 | "properties": [ 40 | { 41 | "albedo_texture": "GLTF/Lantern/Lantern_baseColor.png", 42 | "normals_texture": "GLTF/Lantern/Lantern_normal.png", 43 | "metal_roughness_texture": "GLTF/Lantern/Lantern_roughnessMetallic.png", 44 | "emissive_texture": "GLTF/Lantern/Lantern_emissive.png", 45 | "occlusion_texture": "white.png" 46 | } 47 | ] 48 | } -------------------------------------------------------------------------------- /data/source/Lines.hmt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Lines", 3 | "effect_path": "Lines.hfx", 4 | "properties": [ 5 | { 6 | 7 | } 8 | ], 9 | "bindings": [ 10 | { 11 | "name": "LocalConstants", 12 | "resource_name": "CB_Lines" 13 | }, 14 | { 15 | "name": "Transform", 16 | "resource_name": "Transform" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /data/source/Material.fbs: -------------------------------------------------------------------------------- 1 | include "RenderPasses.fbs"; 2 | 3 | namespace Rendering; 4 | 5 | table Technique { 6 | pass : Pass; 7 | name : string; 8 | shaders : string; 9 | } 10 | 11 | table Material { 12 | name : string; 13 | technique : [Technique]; 14 | } 15 | 16 | root_type Material; -------------------------------------------------------------------------------- /data/source/Material_MR.hmt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Material_MR", 3 | "effect_path": "PBR.hfx", 4 | "bindings": [ 5 | { 6 | "name": "ViewConstants", 7 | "resource_name": "CB_Lines" 8 | }, 9 | { 10 | "name": "Transform", 11 | "resource_name": "Transform" 12 | }, 13 | { 14 | "name": "albedo", 15 | "sampler": "linear", 16 | "resource_name": "albedo_texture" 17 | }, 18 | { 19 | "name": "normals", 20 | "sampler": "linear", 21 | "resource_name": "normals_texture" 22 | }, 23 | { 24 | "name": "metalRoughness", 25 | "sampler": "linear", 26 | "resource_name": "metal_roughness_texture" 27 | }, 28 | { 29 | "name": "emissive", 30 | "sampler": "linear", 31 | "resource_name": "emissive_texture" 32 | }, 33 | { 34 | "name": "linear_sampler", 35 | "resource_name": "linear" 36 | }, 37 | { 38 | "name": "occlusion", 39 | "sampler": "linear", 40 | "resource_name": "occlusion_texture" 41 | } 42 | ], 43 | "properties": [ 44 | { 45 | "albedo_texture": "GLTF/DamagedHelmet/Default_albedo.jpg", 46 | "normals_texture": "GLTF/DamagedHelmet/Default_normal.jpg", 47 | "metal_roughness_texture": "GLTF/DamagedHelmet/Default_metalRoughness.jpg", 48 | "emissive_texture": "GLTF/DamagedHelmet/Default_emissive.jpg", 49 | "occlusion_texture": "GLTF/DamagedHelmet/Default_AO.jpg" 50 | } 51 | ] 52 | } -------------------------------------------------------------------------------- /data/source/PBR.hfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/PBR.hfx -------------------------------------------------------------------------------- /data/source/PerlinNoise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/PerlinNoise.png -------------------------------------------------------------------------------- /data/source/Platform.h: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | // Common defines 4 | 5 | #define UniformBuffer(slot) layout (std140, binding=slot) uniform 6 | #define StructuredBuffer(slot) layout (std430, binding=slot) buffer 7 | 8 | #if defined VULKAN 9 | 10 | #define gl_VertexID gl_VertexIndex 11 | #define gl_InstanceID gl_InstanceIndex 12 | 13 | #define texture2D texture 14 | 15 | #elif defined OPENGL 16 | 17 | #endif // VULKAN 18 | -------------------------------------------------------------------------------- /data/source/RenderPasses.fbs: -------------------------------------------------------------------------------- 1 | namespace rendering; 2 | 3 | enum Pass : byte { GBuffer, Shadow, Lighting, PostProcess } -------------------------------------------------------------------------------- /data/source/ShaderToy.hfx: -------------------------------------------------------------------------------- 1 | shader ShaderToy { 2 | // Setup all the conversion necessary to run ShaderToy shaders with minimal modifications. 3 | 4 | layout { 5 | list Main { 6 | cbuffer ShaderToyConstants; 7 | } 8 | } 9 | 10 | 11 | glsl fragment_include { 12 | 13 | layout (std140, binding=1) uniform ShaderToyConstants { 14 | 15 | vec2 iResolution; 16 | float iTime; 17 | float iPad0; 18 | }; 19 | } 20 | } -------------------------------------------------------------------------------- /data/source/SimpleFullscreen.hmt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SimpleFullscreen", 3 | "effect_path": "SimpleFullscreen.hfx", 4 | "properties": [ 5 | { 6 | "scale": 16.0, 7 | "albedo": "AngeloCensorship.png", 8 | "modulo": 2.0 9 | } 10 | ], 11 | "bindings": [ 12 | { 13 | "name": "LocalConstants", 14 | "resource_name": "LocalConstants" 15 | }, 16 | { 17 | "name": "destination_texture", 18 | "resource_name": "compute_output_texture" 19 | }, 20 | { 21 | "name": "input_texture", 22 | "resource_name": "compute_output_texture" 23 | }, 24 | { 25 | "name": "albedo_texture", 26 | "resource_name": "albedo" 27 | }, 28 | { 29 | "name": "LightingConstants", 30 | "resource_name": "lighting_constants" 31 | } 32 | ] 33 | } -------------------------------------------------------------------------------- /data/source/StarNest.hmt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "StarNest", 3 | "effect_path": "StarNest.hfx", 4 | "properties": [ 5 | { 6 | "zoom": 3.0, 7 | "tile": 0.8500000238418579 8 | } 9 | ], 10 | "bindings": [ 11 | { 12 | "ShaderToyConstants": "ShaderToyConstants", 13 | "input_texture": "pass0_output_texture" 14 | }, 15 | { 16 | "name": "ShaderToyConstants", 17 | "resource_name": "ShaderToyConstants" 18 | }, 19 | { 20 | "name": "input_texture", 21 | "resource_name": "pass0_output_texture" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /data/source/Swapchain.hmt: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Swapchain", 3 | "effect_path": "FullscreenTexture.hfx", 4 | "properties": [ 5 | 6 | ], 7 | "bindings": [ 8 | { 9 | "name": "LocalConstants", 10 | "resource_name": "LocalConstants" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /data/source/black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/black.png -------------------------------------------------------------------------------- /data/source/math.h: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // Common math 3 | //------------------------------------------------------------------------------ 4 | 5 | #define PI 3.14159265359 6 | #define HALF_PI 1.570796327 7 | 8 | #define MEDIUMP_FLT_MAX 65504.0 9 | #define MEDIUMP_FLT_MIN 0.00006103515625 10 | 11 | #ifdef TARGET_MOBILE 12 | #define FLT_EPS MEDIUMP_FLT_MIN 13 | #define saturateMediump(x) min(x, MEDIUMP_FLT_MAX) 14 | #else 15 | #define FLT_EPS 1e-5 16 | #define saturateMediump(x) x 17 | #endif 18 | 19 | #define saturate(x) clamp(x, 0.0, 1.0) 20 | 21 | //------------------------------------------------------------------------------ 22 | // Scalar operations 23 | //------------------------------------------------------------------------------ 24 | 25 | float pow5( float x ) { 26 | float x2 = x * x; 27 | return x2 * x2 * x; 28 | } 29 | -------------------------------------------------------------------------------- /data/source/white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/data/source/white.png -------------------------------------------------------------------------------- /project/NodeEditor.json: -------------------------------------------------------------------------------- 1 | {"nodes":{"node:1":{"location":{"x":69,"y":-46}},"node:10":{"location":{"x":374,"y":433}},"node:13":{"location":{"x":694,"y":289}},"node:16":{"location":{"x":-79,"y":288}},"node:23":{"location":{"x":582,"y":127}},"node:34":{"location":{"x":721,"y":128}},"node:37":{"location":{"x":870,"y":111}},"node:4":{"location":{"x":110,"y":209}},"node:7":{"location":{"x":50,"y":497}}},"selection":null,"view":{"scroll":{"x":33.8996429443359375,"y":-64.639617919921875},"zoom":0.5}} -------------------------------------------------------------------------------- /source/Articles/CustomShaderLanguage/CustomShaderLanguage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "imgui.h" 4 | #include "imgui_impl_sdl.h" 5 | #include "hydra/hydra_imgui.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include "hydra/hydra_lib.h" 12 | #include "hydra/hydra_graphics.h" 13 | 14 | 15 | #define HFX_PARSING 16 | #include "ShaderCodeGenerator.h" 17 | 18 | #include "CodeGenerator.h" 19 | 20 | // HDF generated classes 21 | #include "SimpleData.h" 22 | 23 | // HFX generated classes 24 | #include "SimpleFullscreen.h" 25 | 26 | 27 | struct CustomShaderLanguageApplication { 28 | 29 | void init(); 30 | void terminate(); 31 | 32 | void main_loop(); 33 | 34 | void manual_init_graphics(); 35 | void load_shader_effect( const char* filename ); 36 | 37 | struct SDL_Window* window = nullptr; 38 | 39 | #if defined HYDRA_OPENGL 40 | void* gl_context; 41 | #endif // HYDRA_OPENGL 42 | 43 | hydra::graphics::Device gfx_device; 44 | 45 | // hydra::gfx_device::ShaderEffect shader_effect; 46 | 47 | hydra::graphics::TextureHandle render_target; 48 | hydra::graphics::BufferHandle checker_constants; 49 | 50 | SimpleFullscreen::LocalConstantsBuffer local_constant_buffer; 51 | 52 | hydra::graphics::CommandBuffer* commands; 53 | 54 | // Language specific fields 55 | Lexer lexer; 56 | 57 | hdf::Parser parser; 58 | hdf::CodeGenerator code_generator; 59 | 60 | hfx::Parser effect_parser; 61 | hfx::CodeGenerator hfx_code_generator; 62 | 63 | 64 | }; // struct WritingLanguageApplication 65 | -------------------------------------------------------------------------------- /source/Articles/CustomShaderLanguage/SimpleFullscreen.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include 4 | #include "hydra/hydra_graphics.h" 5 | 6 | // This file is autogenerated! 7 | namespace SimpleFullscreen { 8 | 9 | struct LocalConstantsUI { 10 | 11 | float scale = 16.000000f; 12 | float modulo = 2.000000f; 13 | 14 | void reflectMembers() { 15 | ImGui::InputScalar( "Scale", ImGuiDataType_Float, &scale); 16 | ImGui::InputScalar( "Modulo", ImGuiDataType_Float, &modulo); 17 | } 18 | 19 | void reflectUI() { 20 | ImGui::Begin( "LocalConstants" ); 21 | reflectMembers(); 22 | ImGui::End(); 23 | } 24 | 25 | }; // struct LocalConstantsUI 26 | 27 | struct LocalConstants { 28 | 29 | float scale = 16.000000f; 30 | float modulo = 2.000000f; 31 | float pad_tail[2]; 32 | 33 | }; // struct LocalConstants 34 | 35 | struct LocalConstantsBuffer { 36 | 37 | hydra::graphics::BufferHandle buffer; 38 | LocalConstants constants; 39 | LocalConstantsUI constantsUI; 40 | 41 | void create( hydra::graphics::Device& device ) { 42 | using namespace hydra; 43 | 44 | graphics::BufferCreation constants_creation = { graphics::BufferType::Constant, graphics::ResourceUsageType::Dynamic, sizeof( LocalConstants ), &constants, "LocalConstants" }; 45 | buffer = device.create_buffer( constants_creation ); 46 | } 47 | 48 | void destroy( hydra::graphics::Device& device ) { 49 | device.destroy_buffer( buffer ); 50 | } 51 | 52 | void updateUI( hydra::graphics::Device& device ) { 53 | // Draw UI 54 | constantsUI.reflectUI(); 55 | // Update constants from UI 56 | hydra::graphics::MapBufferParameters map_parameters = { buffer.handle, 0, 0 }; 57 | LocalConstants* buffer_data = (LocalConstants*)device.map_buffer( map_parameters ); 58 | if (buffer_data) { 59 | buffer_data->scale = constantsUI.scale; 60 | buffer_data->modulo = constantsUI.modulo; 61 | device.unmap_buffer( map_parameters ); 62 | } 63 | } 64 | }; // struct LocalConstantBuffer 65 | 66 | } // namespace SimpleFullscreen 67 | 68 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_call_h 9 | #define cglm_call_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "cglm.h" 15 | #include "call/vec2.h" 16 | #include "call/vec3.h" 17 | #include "call/vec4.h" 18 | #include "call/mat2.h" 19 | #include "call/mat3.h" 20 | #include "call/mat4.h" 21 | #include "call/affine.h" 22 | #include "call/cam.h" 23 | #include "call/quat.h" 24 | #include "call/euler.h" 25 | #include "call/plane.h" 26 | #include "call/frustum.h" 27 | #include "call/box.h" 28 | #include "call/io.h" 29 | #include "call/project.h" 30 | #include "call/sphere.h" 31 | #include "call/ease.h" 32 | #include "call/curve.h" 33 | #include "call/bezier.h" 34 | #include "call/ray.h" 35 | #include "call/affine2d.h" 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif /* cglm_call_h */ 41 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/affine2d.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_affine2d_h 9 | #define cglmc_affine2d_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_translate2d_make(mat3 m, vec2 v); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_translate2d_to(mat3 m, vec2 v, mat3 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_translate2d(mat3 m, vec2 v); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_translate2d_x(mat3 m, float to); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_translate2d_y(mat3 m, float to); 35 | 36 | CGLM_EXPORT 37 | void 38 | glmc_scale2d_to(mat3 m, vec2 v, mat3 dest); 39 | 40 | CGLM_EXPORT 41 | void 42 | glmc_scale2d_make(mat3 m, vec2 v); 43 | 44 | CGLM_EXPORT 45 | void 46 | glmc_scale2d(mat3 m, vec2 v); 47 | 48 | CGLM_EXPORT 49 | void 50 | glmc_scale2d_uni(mat3 m, float s); 51 | 52 | CGLM_EXPORT 53 | void 54 | glmc_rotate2d_make(mat3 m, float angle); 55 | 56 | CGLM_EXPORT 57 | void 58 | glmc_rotate2d(mat3 m, float angle); 59 | 60 | CGLM_EXPORT 61 | void 62 | glmc_rotate2d_to(mat3 m, float angle, mat3 dest); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #endif /* cglmc_affine2d_h */ 68 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/bezier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_bezier_h 9 | #define cglmc_bezier_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | float 18 | glmc_bezier(float s, float p0, float c0, float c1, float p1); 19 | 20 | CGLM_EXPORT 21 | float 22 | glmc_hermite(float s, float p0, float t0, float t1, float p1); 23 | 24 | CGLM_EXPORT 25 | float 26 | glmc_decasteljau(float prm, float p0, float c0, float c1, float p1); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* cglmc_bezier_h */ 32 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/box.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_box_h 9 | #define cglmc_box_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_aabb_transform(vec3 box[2], mat4 m, vec3 dest[2]); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_aabb_merge(vec3 box1[2], vec3 box2[2], vec3 dest[2]); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_aabb_crop(vec3 box[2], vec3 cropBox[2], vec3 dest[2]); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_aabb_crop_until(vec3 box[2], 31 | vec3 cropBox[2], 32 | vec3 clampBox[2], 33 | vec3 dest[2]); 34 | 35 | CGLM_EXPORT 36 | bool 37 | glmc_aabb_frustum(vec3 box[2], vec4 planes[6]); 38 | 39 | CGLM_EXPORT 40 | void 41 | glmc_aabb_invalidate(vec3 box[2]); 42 | 43 | CGLM_EXPORT 44 | bool 45 | glmc_aabb_isvalid(vec3 box[2]); 46 | 47 | CGLM_EXPORT 48 | float 49 | glmc_aabb_size(vec3 box[2]); 50 | 51 | CGLM_EXPORT 52 | float 53 | glmc_aabb_radius(vec3 box[2]); 54 | 55 | CGLM_EXPORT 56 | void 57 | glmc_aabb_center(vec3 box[2], vec3 dest); 58 | 59 | CGLM_EXPORT 60 | bool 61 | glmc_aabb_aabb(vec3 box[2], vec3 other[2]); 62 | 63 | CGLM_EXPORT 64 | bool 65 | glmc_aabb_point(vec3 box[2], vec3 point); 66 | 67 | CGLM_EXPORT 68 | bool 69 | glmc_aabb_contains(vec3 box[2], vec3 other[2]); 70 | 71 | CGLM_EXPORT 72 | bool 73 | glmc_aabb_sphere(vec3 box[2], vec4 s); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | #endif /* cglmc_box_h */ 79 | 80 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/curve.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_curve_h 9 | #define cglmc_curve_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | float 18 | glmc_smc(float s, mat4 m, vec4 c); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif /* cglmc_curve_h */ 24 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/euler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_euler_h 9 | #define cglmc_euler_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_euler_angles(mat4 m, vec3 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_euler(vec3 angles, mat4 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_euler_xyz(vec3 angles, mat4 dest); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_euler_zyx(vec3 angles, mat4 dest); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_euler_zxy(vec3 angles, mat4 dest); 35 | 36 | CGLM_EXPORT 37 | void 38 | glmc_euler_xzy(vec3 angles, mat4 dest); 39 | 40 | CGLM_EXPORT 41 | void 42 | glmc_euler_yzx(vec3 angles, mat4 dest); 43 | 44 | CGLM_EXPORT 45 | void 46 | glmc_euler_yxz(vec3 angles, mat4 dest); 47 | 48 | CGLM_EXPORT 49 | void 50 | glmc_euler_by_order(vec3 angles, glm_euler_seq axis, mat4 dest); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif /* cglmc_euler_h */ 56 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/frustum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_frustum_h 9 | #define cglmc_frustum_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_frustum_planes(mat4 m, vec4 dest[6]); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_frustum_corners(mat4 invMat, vec4 dest[8]); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_frustum_center(vec4 corners[8], vec4 dest); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_frustum_box(vec4 corners[8], mat4 m, vec3 box[2]); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_frustum_corners_at(vec4 corners[8], 35 | float splitDist, 36 | float farDist, 37 | vec4 planeCorners[4]); 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | #endif /* cglmc_frustum_h */ 42 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/io.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_io_h 9 | #define cglmc_io_h 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include "../cglm.h" 16 | 17 | CGLM_EXPORT 18 | void 19 | glmc_mat4_print(mat4 matrix, 20 | FILE * __restrict ostream); 21 | 22 | CGLM_EXPORT 23 | void 24 | glmc_mat3_print(mat3 matrix, 25 | FILE * __restrict ostream); 26 | 27 | CGLM_EXPORT 28 | void 29 | glmc_vec4_print(vec4 vec, 30 | FILE * __restrict ostream); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_vec3_print(vec3 vec, 35 | FILE * __restrict ostream); 36 | 37 | CGLM_EXPORT 38 | void 39 | glmc_versor_print(versor vec, 40 | FILE * __restrict ostream); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif /* cglmc_io_h */ 46 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/mat2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_mat2_h 9 | #define cglmc_mat2_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_mat2_copy(mat2 mat, mat2 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_mat2_identity(mat2 mat); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_mat2_identity_array(mat2 * __restrict mat, size_t count); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_mat2_zero(mat2 mat); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_mat2_mul(mat2 m1, mat2 m2, mat2 dest); 35 | 36 | CGLM_EXPORT 37 | void 38 | glmc_mat2_transpose_to(mat2 m, mat2 dest); 39 | 40 | CGLM_EXPORT 41 | void 42 | glmc_mat2_transpose(mat2 m); 43 | 44 | CGLM_EXPORT 45 | void 46 | glmc_mat2_mulv(mat2 m, vec2 v, vec2 dest); 47 | 48 | CGLM_EXPORT 49 | float 50 | glmc_mat2_trace(mat2 m); 51 | 52 | CGLM_EXPORT 53 | void 54 | glmc_mat2_scale(mat2 m, float s); 55 | 56 | CGLM_EXPORT 57 | float 58 | glmc_mat2_det(mat2 mat); 59 | 60 | CGLM_EXPORT 61 | void 62 | glmc_mat2_inv(mat2 mat, mat2 dest); 63 | 64 | CGLM_EXPORT 65 | void 66 | glmc_mat2_swap_col(mat2 mat, int col1, int col2); 67 | 68 | CGLM_EXPORT 69 | void 70 | glmc_mat2_swap_row(mat2 mat, int row1, int row2); 71 | 72 | CGLM_EXPORT 73 | float 74 | glmc_mat2_rmc(vec2 r, mat2 m, vec2 c); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | #endif /* cglmc_mat2_h */ 80 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/mat3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_mat3_h 9 | #define cglmc_mat3_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | /* DEPRECATED! use _copy, _ucopy versions */ 17 | #define glmc_mat3_dup(mat, dest) glmc_mat3_copy(mat, dest) 18 | 19 | CGLM_EXPORT 20 | void 21 | glmc_mat3_copy(mat3 mat, mat3 dest); 22 | 23 | CGLM_EXPORT 24 | void 25 | glmc_mat3_identity(mat3 mat); 26 | 27 | CGLM_EXPORT 28 | void 29 | glmc_mat3_zero(mat3 mat); 30 | 31 | CGLM_EXPORT 32 | void 33 | glmc_mat3_identity_array(mat3 * __restrict mat, size_t count); 34 | 35 | CGLM_EXPORT 36 | void 37 | glmc_mat3_mul(mat3 m1, mat3 m2, mat3 dest); 38 | 39 | CGLM_EXPORT 40 | void 41 | glmc_mat3_transpose_to(mat3 m, mat3 dest); 42 | 43 | CGLM_EXPORT 44 | void 45 | glmc_mat3_transpose(mat3 m); 46 | 47 | CGLM_EXPORT 48 | void 49 | glmc_mat3_mulv(mat3 m, vec3 v, vec3 dest); 50 | 51 | CGLM_EXPORT 52 | float 53 | glmc_mat3_trace(mat3 m); 54 | 55 | CGLM_EXPORT 56 | void 57 | glmc_mat3_quat(mat3 m, versor dest); 58 | 59 | CGLM_EXPORT 60 | void 61 | glmc_mat3_scale(mat3 m, float s); 62 | 63 | CGLM_EXPORT 64 | float 65 | glmc_mat3_det(mat3 mat); 66 | 67 | CGLM_EXPORT 68 | void 69 | glmc_mat3_inv(mat3 mat, mat3 dest); 70 | 71 | CGLM_EXPORT 72 | void 73 | glmc_mat3_swap_col(mat3 mat, int col1, int col2); 74 | 75 | CGLM_EXPORT 76 | void 77 | glmc_mat3_swap_row(mat3 mat, int row1, int row2); 78 | 79 | CGLM_EXPORT 80 | float 81 | glmc_mat3_rmc(vec3 r, mat3 m, vec3 c); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | #endif /* cglmc_mat3_h */ 87 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/plane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_plane_h 9 | #define cglmc_plane_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_plane_normalize(vec4 plane); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif /* cglmc_plane_h */ 24 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/project.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_project_h 9 | #define cglmc_project_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_unprojecti(vec3 pos, mat4 invMat, vec4 vp, vec3 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_unproject(vec3 pos, mat4 m, vec4 vp, vec3 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_project(vec3 pos, mat4 m, vec4 vp, vec3 dest); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* cglmc_project_h */ 32 | 33 | 34 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/ray.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_ray_h 9 | #define cglmc_ray_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | #include "../cglm.h" 14 | 15 | CGLM_EXPORT 16 | bool 17 | glmc_ray_triangle(vec3 origin, 18 | vec3 direction, 19 | vec3 v0, 20 | vec3 v1, 21 | vec3 v2, 22 | float *d); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* cglmc_ray_h */ 28 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/call/sphere.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_sphere_h 9 | #define cglmc_sphere_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | float 18 | glmc_sphere_radii(vec4 s); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_sphere_transform(vec4 s, mat4 m, vec4 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_sphere_merge(vec4 s1, vec4 s2, vec4 dest); 27 | 28 | CGLM_EXPORT 29 | bool 30 | glmc_sphere_sphere(vec4 s1, vec4 s2); 31 | 32 | CGLM_EXPORT 33 | bool 34 | glmc_sphere_point(vec4 s, vec3 point); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif /* cglmc_sphere_h */ 40 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/cglm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_h 9 | #define cglm_h 10 | 11 | #include "common.h" 12 | #include "vec2.h" 13 | #include "vec3.h" 14 | #include "vec4.h" 15 | #include "mat4.h" 16 | #include "mat3.h" 17 | #include "mat2.h" 18 | #include "affine.h" 19 | #include "cam.h" 20 | #include "frustum.h" 21 | #include "quat.h" 22 | #include "euler.h" 23 | #include "plane.h" 24 | #include "box.h" 25 | #include "color.h" 26 | #include "util.h" 27 | #include "io.h" 28 | #include "project.h" 29 | #include "sphere.h" 30 | #include "ease.h" 31 | #include "curve.h" 32 | #include "bezier.h" 33 | #include "ray.h" 34 | #include "affine2d.h" 35 | 36 | #endif /* cglm_h */ 37 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/color.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_color_h 9 | #define cglm_color_h 10 | 11 | #include "common.h" 12 | #include "vec3.h" 13 | 14 | /*! 15 | * @brief averages the color channels into one value 16 | * 17 | * @param[in] rgb RGB color 18 | */ 19 | CGLM_INLINE 20 | float 21 | glm_luminance(vec3 rgb) { 22 | vec3 l = {0.212671f, 0.715160f, 0.072169f}; 23 | return glm_dot(rgb, l); 24 | } 25 | 26 | #endif /* cglm_color_h */ 27 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_common_h 9 | #define cglm_common_h 10 | 11 | #ifndef _USE_MATH_DEFINES 12 | # define _USE_MATH_DEFINES /* for windows */ 13 | #endif 14 | 15 | #ifndef _CRT_SECURE_NO_WARNINGS 16 | # define _CRT_SECURE_NO_WARNINGS /* for windows */ 17 | #endif 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #if defined(_MSC_VER) 26 | # ifdef CGLM_STATIC 27 | # define CGLM_EXPORT 28 | # elif defined(CGLM_EXPORTS) 29 | # define CGLM_EXPORT __declspec(dllexport) 30 | # else 31 | # define CGLM_EXPORT __declspec(dllimport) 32 | # endif 33 | # define CGLM_INLINE __forceinline 34 | #else 35 | # define CGLM_EXPORT __attribute__((visibility("default"))) 36 | # define CGLM_INLINE static inline __attribute((always_inline)) 37 | #endif 38 | 39 | #define GLM_SHUFFLE4(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) 40 | #define GLM_SHUFFLE3(z, y, x) (((z) << 4) | ((y) << 2) | (x)) 41 | 42 | #include "types.h" 43 | #include "simd/intrin.h" 44 | 45 | #ifndef CGLM_USE_DEFAULT_EPSILON 46 | # ifndef GLM_FLT_EPSILON 47 | # define GLM_FLT_EPSILON 1e-6 48 | # endif 49 | #else 50 | # define GLM_FLT_EPSILON FLT_EPSILON 51 | #endif 52 | 53 | #endif /* cglm_common_h */ 54 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/curve.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_curve_h 9 | #define cglm_curve_h 10 | 11 | #include "common.h" 12 | #include "vec4.h" 13 | #include "mat4.h" 14 | 15 | /*! 16 | * @brief helper function to calculate S*M*C multiplication for curves 17 | * 18 | * This function does not encourage you to use SMC, 19 | * instead it is a helper if you use SMC. 20 | * 21 | * if you want to specify S as vector then use more generic glm_mat4_rmc() func. 22 | * 23 | * Example usage: 24 | * B(s) = glm_smc(s, GLM_BEZIER_MAT, (vec4){p0, c0, c1, p1}) 25 | * 26 | * @param[in] s parameter between 0 and 1 (this will be [s3, s2, s, 1]) 27 | * @param[in] m basis matrix 28 | * @param[in] c position/control vector 29 | * 30 | * @return B(s) 31 | */ 32 | CGLM_INLINE 33 | float 34 | glm_smc(float s, mat4 m, vec4 c) { 35 | vec4 vs; 36 | glm_vec4_cubic(s, vs); 37 | return glm_mat4_rmc(vs, m, c); 38 | } 39 | 40 | #endif /* cglm_curve_h */ 41 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/plane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_plane_h 9 | #define cglm_plane_h 10 | 11 | #include "common.h" 12 | #include "vec4.h" 13 | 14 | /* 15 | Plane equation: Ax + By + Cz + D = 0; 16 | 17 | It stored in vec4 as [A, B, C, D]. (A, B, C) is normal and D is distance 18 | */ 19 | 20 | /* 21 | Functions: 22 | CGLM_INLINE void glm_plane_normalize(vec4 plane); 23 | */ 24 | 25 | /*! 26 | * @brief normalizes a plane 27 | * 28 | * @param[in, out] plane plane to normalize 29 | */ 30 | CGLM_INLINE 31 | void 32 | glm_plane_normalize(vec4 plane) { 33 | float norm; 34 | 35 | if ((norm = glm_vec3_norm(plane)) == 0.0f) { 36 | glm_vec4_zero(plane); 37 | return; 38 | } 39 | 40 | glm_vec4_scale(plane, 1.0f / norm, plane); 41 | } 42 | 43 | #endif /* cglm_plane_h */ 44 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/simd/arm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_simd_arm_h 9 | #define cglm_simd_arm_h 10 | #include "intrin.h" 11 | #ifdef CGLM_SIMD_ARM 12 | 13 | #define glmm_load(p) vld1q_f32(p) 14 | #define glmm_store(p, a) vst1q_f32(p, a) 15 | 16 | static inline 17 | float32x4_t 18 | glmm_abs(float32x4_t v) { 19 | return vabsq_f32(v); 20 | } 21 | 22 | static inline 23 | float 24 | glmm_hadd(float32x4_t v) { 25 | #if defined(__aarch64__) 26 | return vaddvq_f32(v); 27 | #else 28 | v = vaddq_f32(v, vrev64q_f32(v)); 29 | v = vaddq_f32(v, vcombine_f32(vget_high_f32(v), vget_low_f32(v))); 30 | return vgetq_lane_f32(v, 0); 31 | #endif 32 | } 33 | 34 | static inline 35 | float 36 | glmm_hmin(float32x4_t v) { 37 | float32x2_t t; 38 | t = vpmin_f32(vget_low_f32(v), vget_high_f32(v)); 39 | t = vpmin_f32(t, t); 40 | return vget_lane_f32(t, 0); 41 | } 42 | 43 | static inline 44 | float 45 | glmm_hmax(float32x4_t v) { 46 | float32x2_t t; 47 | t = vpmax_f32(vget_low_f32(v), vget_high_f32(v)); 48 | t = vpmax_f32(t, t); 49 | return vget_lane_f32(t, 0); 50 | } 51 | 52 | static inline 53 | float 54 | glmm_dot(float32x4_t a, float32x4_t b) { 55 | return glmm_hadd(vmulq_f32(a, b)); 56 | } 57 | 58 | static inline 59 | float 60 | glmm_norm(float32x4_t a) { 61 | return sqrtf(glmm_dot(a, a)); 62 | } 63 | 64 | static inline 65 | float 66 | glmm_norm2(float32x4_t a) { 67 | return glmm_dot(a, a); 68 | } 69 | 70 | static inline 71 | float 72 | glmm_norm_one(float32x4_t a) { 73 | return glmm_hadd(glmm_abs(a)); 74 | } 75 | 76 | static inline 77 | float 78 | glmm_norm_inf(float32x4_t a) { 79 | return glmm_hmax(glmm_abs(a)); 80 | } 81 | 82 | #endif 83 | #endif /* cglm_simd_arm_h */ 84 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/simd/intrin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_intrin_h 9 | #define cglm_intrin_h 10 | 11 | #if defined( _MSC_VER ) 12 | # if (defined(_M_AMD64) || defined(_M_X64)) || _M_IX86_FP == 2 13 | # ifndef __SSE2__ 14 | # define __SSE2__ 15 | # endif 16 | # elif _M_IX86_FP == 1 17 | # ifndef __SSE__ 18 | # define __SSE__ 19 | # endif 20 | # endif 21 | /* do not use alignment for older visual studio versions */ 22 | # if _MSC_VER < 1913 /* Visual Studio 2017 version 15.6 */ 23 | # define CGLM_ALL_UNALIGNED 24 | # endif 25 | #endif 26 | 27 | #if defined( __SSE__ ) || defined( __SSE2__ ) 28 | # include 29 | # include 30 | # define CGLM_SSE_FP 1 31 | # ifndef CGLM_SIMD_x86 32 | # define CGLM_SIMD_x86 33 | # endif 34 | #endif 35 | 36 | #if defined(__SSE3__) 37 | # include 38 | # ifndef CGLM_SIMD_x86 39 | # define CGLM_SIMD_x86 40 | # endif 41 | #endif 42 | 43 | #if defined(__SSE4_1__) 44 | # include 45 | # ifndef CGLM_SIMD_x86 46 | # define CGLM_SIMD_x86 47 | # endif 48 | #endif 49 | 50 | #if defined(__SSE4_2__) 51 | # include 52 | # ifndef CGLM_SIMD_x86 53 | # define CGLM_SIMD_x86 54 | # endif 55 | #endif 56 | 57 | #ifdef __AVX__ 58 | # include 59 | # define CGLM_AVX_FP 1 60 | # ifndef CGLM_SIMD_x86 61 | # define CGLM_SIMD_x86 62 | # endif 63 | #endif 64 | 65 | /* ARM Neon */ 66 | #if defined(__ARM_NEON) 67 | # include 68 | # if defined(__ARM_NEON_FP) 69 | # define CGLM_NEON_FP 1 70 | # ifndef CGLM_SIMD_ARM 71 | # define CGLM_SIMD_ARM 72 | # endif 73 | # endif 74 | #endif 75 | 76 | #if defined(CGLM_SIMD_x86) || defined(CGLM_NEON_FP) 77 | # ifndef CGLM_SIMD 78 | # define CGLM_SIMD 79 | # endif 80 | #endif 81 | 82 | #if defined(CGLM_SIMD_x86) 83 | # include "x86.h" 84 | #endif 85 | 86 | #if defined(CGLM_SIMD_ARM) 87 | # include "arm.h" 88 | #endif 89 | 90 | #endif /* cglm_intrin_h */ 91 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/simd/sse2/mat2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_mat2_sse_h 9 | #define cglm_mat2_sse_h 10 | #if defined( __SSE__ ) || defined( __SSE2__ ) 11 | 12 | #include "../../common.h" 13 | #include "../intrin.h" 14 | 15 | CGLM_INLINE 16 | void 17 | glm_mat2_mul_sse2(mat2 m1, mat2 m2, mat2 dest) { 18 | __m128 x0, x1, x2; 19 | 20 | x1 = glmm_load(m1[0]); /* d c b a */ 21 | x2 = glmm_load(m2[0]); /* h g f e */ 22 | 23 | /* 24 | dest[0][0] = a * e + c * f; 25 | dest[0][1] = b * e + d * f; 26 | dest[1][0] = a * g + c * h; 27 | dest[1][1] = b * g + d * h; 28 | */ 29 | x0 = _mm_mul_ps(_mm_movelh_ps(x1, x1), glmm_shuff1(x2, 2, 2, 0, 0)); 30 | x1 = _mm_mul_ps(_mm_movehl_ps(x1, x1), glmm_shuff1(x2, 3, 3, 1, 1)); 31 | x1 = _mm_add_ps(x0, x1); 32 | 33 | glmm_store(dest[0], x1); 34 | } 35 | 36 | CGLM_INLINE 37 | void 38 | glm_mat2_transp_sse2(mat2 m, mat2 dest) { 39 | /* d c b a */ 40 | /* d b c a */ 41 | glmm_store(dest[0], glmm_shuff1(glmm_load(m[0]), 3, 1, 2, 0)); 42 | } 43 | 44 | #endif 45 | #endif /* cglm_mat2_sse_h */ 46 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/simd/sse2/mat3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_mat3_sse_h 9 | #define cglm_mat3_sse_h 10 | #if defined( __SSE__ ) || defined( __SSE2__ ) 11 | 12 | #include "../../common.h" 13 | #include "../intrin.h" 14 | 15 | CGLM_INLINE 16 | void 17 | glm_mat3_mul_sse2(mat3 m1, mat3 m2, mat3 dest) { 18 | __m128 l0, l1, l2; 19 | __m128 r0, r1, r2; 20 | __m128 x0, x1, x2; 21 | 22 | l0 = _mm_loadu_ps(m1[0]); 23 | l1 = _mm_loadu_ps(&m1[1][1]); 24 | l2 = _mm_set1_ps(m1[2][2]); 25 | 26 | r0 = _mm_loadu_ps(m2[0]); 27 | r1 = _mm_loadu_ps(&m2[1][1]); 28 | r2 = _mm_set1_ps(m2[2][2]); 29 | 30 | x1 = glmm_shuff2(l0, l1, 1, 0, 3, 3, 0, 3, 2, 0); 31 | x2 = glmm_shuff2(l1, l2, 0, 0, 3, 2, 0, 2, 1, 0); 32 | 33 | x0 = _mm_add_ps(_mm_mul_ps(glmm_shuff1(l0, 0, 2, 1, 0), 34 | glmm_shuff1(r0, 3, 0, 0, 0)), 35 | _mm_mul_ps(x1, glmm_shuff2(r0, r1, 0, 0, 1, 1, 2, 0, 0, 0))); 36 | 37 | x0 = _mm_add_ps(x0, 38 | _mm_mul_ps(x2, glmm_shuff2(r0, r1, 1, 1, 2, 2, 2, 0, 0, 0))); 39 | 40 | _mm_storeu_ps(dest[0], x0); 41 | 42 | x0 = _mm_add_ps(_mm_mul_ps(glmm_shuff1(l0, 1, 0, 2, 1), 43 | _mm_shuffle_ps(r0, r1, _MM_SHUFFLE(2, 2, 3, 3))), 44 | _mm_mul_ps(glmm_shuff1(x1, 1, 0, 2, 1), 45 | glmm_shuff1(r1, 3, 3, 0, 0))); 46 | 47 | x0 = _mm_add_ps(x0, 48 | _mm_mul_ps(glmm_shuff1(x2, 1, 0, 2, 1), 49 | _mm_shuffle_ps(r1, r2, _MM_SHUFFLE(0, 0, 1, 1)))); 50 | 51 | _mm_storeu_ps(&dest[1][1], x0); 52 | 53 | dest[2][2] = m1[0][2] * m2[2][0] 54 | + m1[1][2] * m2[2][1] 55 | + m1[2][2] * m2[2][2]; 56 | } 57 | 58 | #endif 59 | #endif /* cglm_mat3_sse_h */ 60 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/simd/sse2/quat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_quat_simd_h 9 | #define cglm_quat_simd_h 10 | #if defined( __SSE__ ) || defined( __SSE2__ ) 11 | 12 | #include "../../common.h" 13 | #include "../intrin.h" 14 | 15 | CGLM_INLINE 16 | void 17 | glm_quat_mul_sse2(versor p, versor q, versor dest) { 18 | /* 19 | + (a1 b2 + b1 a2 + c1 d2 − d1 c2)i 20 | + (a1 c2 − b1 d2 + c1 a2 + d1 b2)j 21 | + (a1 d2 + b1 c2 − c1 b2 + d1 a2)k 22 | a1 a2 − b1 b2 − c1 c2 − d1 d2 23 | */ 24 | 25 | __m128 xp, xq, x0, r; 26 | 27 | xp = glmm_load(p); /* 3 2 1 0 */ 28 | xq = glmm_load(q); 29 | 30 | r = _mm_mul_ps(glmm_shuff1x(xp, 3), xq); 31 | 32 | x0 = _mm_xor_ps(glmm_shuff1x(xp, 0), _mm_set_ps(-0.f, 0.f, -0.f, 0.f)); 33 | r = _mm_add_ps(r, _mm_mul_ps(x0, glmm_shuff1(xq, 0, 1, 2, 3))); 34 | 35 | x0 = _mm_xor_ps(glmm_shuff1x(xp, 1), _mm_set_ps(-0.f, -0.f, 0.f, 0.f)); 36 | r = _mm_add_ps(r, _mm_mul_ps(x0, glmm_shuff1(xq, 1, 0, 3, 2))); 37 | 38 | x0 = _mm_xor_ps(glmm_shuff1x(xp, 2), _mm_set_ps(-0.f, 0.f, 0.f, -0.f)); 39 | r = _mm_add_ps(r, _mm_mul_ps(x0, glmm_shuff1(xq, 2, 3, 0, 1))); 40 | 41 | glmm_store(dest, r); 42 | } 43 | 44 | 45 | #endif 46 | #endif /* cglm_quat_simd_h */ 47 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_structs_h 9 | #define cglm_structs_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "cglm.h" 15 | #include "types-struct.h" 16 | #include "struct/vec2.h" 17 | #include "struct/vec3.h" 18 | #include "struct/vec4.h" 19 | #include "struct/mat2.h" 20 | #include "struct/mat3.h" 21 | #include "struct/mat4.h" 22 | #include "struct/affine.h" 23 | #include "struct/frustum.h" 24 | #include "struct/plane.h" 25 | #include "struct/box.h" 26 | #include "struct/color.h" 27 | #include "struct/io.h" 28 | #include "struct/cam.h" 29 | #include "struct/quat.h" 30 | #include "struct/euler.h" 31 | #include "struct/project.h" 32 | #include "struct/sphere.h" 33 | #include "struct/curve.h" 34 | #include "struct/affine2d.h" 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif /* cglm_structs_h */ 40 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/struct/color.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglms_colors_h 9 | #define cglms_colors_h 10 | 11 | #include "../common.h" 12 | #include "../types-struct.h" 13 | #include "../color.h" 14 | #include "vec3.h" 15 | 16 | /*! 17 | * @brief averages the color channels into one value 18 | * 19 | * @param[in] rgb RGB color 20 | */ 21 | CGLM_INLINE 22 | float 23 | glms_luminance(vec3s rgb) { 24 | return glm_luminance(rgb.raw); 25 | } 26 | 27 | #endif /* cglms_colors_h */ 28 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/struct/curve.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglms_curves_h 9 | #define cglms_curves_h 10 | 11 | #include "../common.h" 12 | #include "../types-struct.h" 13 | #include "../curve.h" 14 | #include "vec4.h" 15 | #include "mat4.h" 16 | 17 | /*! 18 | * @brief helper function to calculate S*M*C multiplication for curves 19 | * 20 | * This function does not encourage you to use SMC, 21 | * instead it is a helper if you use SMC. 22 | * 23 | * if you want to specify S as vector then use more generic glm_mat4_rmc() func. 24 | * 25 | * Example usage: 26 | * B(s) = glm_smc(s, GLM_BEZIER_MAT, (vec4){p0, c0, c1, p1}) 27 | * 28 | * @param[in] s parameter between 0 and 1 (this will be [s3, s2, s, 1]) 29 | * @param[in] m basis matrix 30 | * @param[in] c position/control vector 31 | * 32 | * @return B(s) 33 | */ 34 | CGLM_INLINE 35 | float 36 | glms_smc(float s, mat4s m, vec4s c) { 37 | return glm_smc(s, m.raw, c.raw); 38 | } 39 | 40 | #endif /* cglms_curves_h */ 41 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/struct/plane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglms_planes_h 9 | #define cglms_planes_h 10 | 11 | #include "../common.h" 12 | #include "../types-struct.h" 13 | #include "../plane.h" 14 | #include "vec4.h" 15 | 16 | /* 17 | Plane equation: Ax + By + Cz + D = 0; 18 | 19 | It stored in vec4 as [A, B, C, D]. (A, B, C) is normal and D is distance 20 | */ 21 | 22 | /* 23 | Functions: 24 | CGLM_INLINE vec4s glms_plane_normalize(vec4s plane); 25 | */ 26 | 27 | /*! 28 | * @brief normalizes a plane 29 | * 30 | * @param[in] plane plane to normalize 31 | * @returns normalized plane 32 | */ 33 | CGLM_INLINE 34 | vec4s 35 | glms_plane_normalize(vec4s plane) { 36 | glm_plane_normalize(plane.raw); 37 | return plane; 38 | } 39 | 40 | #endif /* cglms_planes_h */ 41 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/cglm/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_version_h 9 | #define cglm_version_h 10 | 11 | #define CGLM_VERSION_MAJOR 0 12 | #define CGLM_VERSION_MINOR 7 13 | #define CGLM_VERSION_PATCH 9 14 | 15 | #endif /* cglm_version_h */ 16 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/hydra/.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in/ 2 | /[Bb]uild/ 3 | /[Dd]ebug/ 4 | /[Rr]elease/ 5 | /**/[Bb]uild/ 6 | /**/.vs/ 7 | 8 | # MSVC user extensions 9 | *.opensdf 10 | *.sdf 11 | *.suo 12 | *.filters 13 | *.user 14 | *.obj 15 | *.pdb 16 | *.idb 17 | *.log 18 | *.tlog 19 | *.lastbuildstate 20 | *.dll 21 | *.lib 22 | *.exp 23 | *.opendb 24 | *.ini 25 | *.exe 26 | *.ilk 27 | *.bhfx 28 | *.sbhr 29 | *.mbhr 30 | *.tbhr 31 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/hydra/LICENSE.md: -------------------------------------------------------------------------------- 1 | zlib/libpng license 2 | 3 | Copyright (c) 2019 Gabriel Sassone 4 | 5 | This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | 9 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 10 | 11 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 12 | 13 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/hydra/README.md: -------------------------------------------------------------------------------- 1 | # HydraLibs 2 | Central repository for personal libraries.
3 | Used as subtree by other repositories. 4 | 5 | Includes vk_mem_alloc by AMD. 6 | 7 | ======= 8 | Library | Lastest version | Category | LoC | Description 9 | --------------------- | ---- | -------- | --- | -------------------------------- 10 | **[hydra_application.h](hydra_application.h)** | 0.11 | app | -1 | Simple window application loop. 11 | **[hydra_graphics.h](hydra_graphics.h)** | 0.12 | gfx | -1 | OpenGL/Vulkan Render API Abstraction. 12 | **[hydra_imgui.h](hydra_imgui.h)** | 0.05 | gfx | -1 | ImGui Renderer using Hydra Graphics. 13 | **[hydra_lib.h](hydra_lib.h)** | 0.12 | ker | -1 | Logging, files, strings, process, stb array and hash maps. 14 | **[hydra_rendering.h](hydra_rendering.h)** | 0.15 | gfx | -1 | High level rendering. CGLM, GLTF, Mesh, Materials, Render Pipelines. 15 | **[hydra_resources.h](hydra_resources.h)** | 0.01 | gfx | -1 | Resource Manager for graphics. 16 | **[hydra_shaderfx.h](hydra_shaderfx.h)** | 0.25 | gfx | -1 | Compiler of HFX. 17 | 18 | # TODO 19 | 20 | ## Serialization 21 | The actual idea is to convert all the serializable data to use structs/classes defined from a Data Definition Format, like HDF. 22 | Serialization can be created on top of that by generating automatically the code using an external serialization library. 23 | Some possibilities: 24 | 25 | [Bitsery](https://github.com/fraillt/bitsery) 26 | [MPack](https://github.com/ludocode/mpack) 27 | 28 | ## Allocation 29 | 30 | Still to decide the implementation details: save the allocator or pass it ? 31 | 32 | * Add allocators to all data structures (array and maps) 33 | 34 | ## Resource/Asset Management 35 | 36 | * Add an asynchronous resource/asset manager. 37 | 38 | ## High Level Rendering 39 | 40 | * Using serialization and resource/asset manager, high level rendering can be implemented. 41 | * Material + Shaders 42 | * Render Frame/Graph 43 | * Mesh/Scene 44 | 45 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2019 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/Articles/PixelArtFiltering/imgui/imgui_impl_sdl.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for SDL2 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | // (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Clipboard support. 8 | // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). 9 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 10 | // Missing features: 11 | // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. 12 | 13 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 14 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 15 | // https://github.com/ocornut/imgui 16 | 17 | #pragma once 18 | 19 | struct SDL_Window; 20 | typedef union SDL_Event SDL_Event; 21 | 22 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); 23 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); 24 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window); 25 | IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); 26 | IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(SDL_Window* window); 27 | IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event); 28 | -------------------------------------------------------------------------------- /source/Articles/Serialization/hydra/kernel/primitive_types.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef uint8_t u8; 6 | typedef uint16_t u16; 7 | typedef uint32_t u32; 8 | typedef uint64_t u64; 9 | 10 | typedef int8_t i8; 11 | typedef int16_t i16; 12 | typedef int32_t i32; 13 | typedef int64_t i64; 14 | 15 | typedef float f32; 16 | typedef double f64; 17 | 18 | typedef size_t sizet; 19 | 20 | typedef const char* cstring; 21 | 22 | static const u64 u64_max = UINT64_MAX; 23 | static const i64 i64_max = INT64_MAX; 24 | static const u32 u32_max = UINT32_MAX; 25 | static const i32 i32_max = INT32_MAX; 26 | static const u16 u16_max = UINT16_MAX; 27 | static const i16 i16_max = INT16_MAX; 28 | static const u8 u8_max = UINT8_MAX; 29 | static const i8 i8_max = INT8_MAX; 30 | -------------------------------------------------------------------------------- /source/Articles/ShaderAugmentation/enkits/License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Doug Binks 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgement in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /source/Articles/ShaderAugmentation/hydra/hydra_imgui.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4 | // Hydra ImGUI - v0.04 5 | // 6 | // ImGUI wrapper using Hydra Graphics. 7 | // 8 | // Source code : https://www.github.com/jorenjoestar/ 9 | // 10 | // Created : 2019/09/16, 19.23 11 | // 12 | // 0.04 (2020/03/20): + Added File Dialog. + Moved everything to be under hydra namespace. 13 | // 0.03 (2020/03/12): + Embedded SpirV shaders. 14 | // 0.02 (2020/03/10): + Embedded GLSL shaders and handwritten code to remove dependency on compiler. Code cleanup. 15 | // 0.01 (2019/09/16): + Initial implementation. 16 | 17 | struct ImDrawData; 18 | 19 | namespace hydra { 20 | 21 | namespace graphics { 22 | struct Device; 23 | struct CommandBuffer; 24 | } // namespace graphics 25 | 26 | 27 | bool imgui_init( hydra::graphics::Device& graphics_device ); 28 | void imgui_shutdown( hydra::graphics::Device& graphics_device ); 29 | void imgui_new_frame(); 30 | 31 | void imgui_collect_draw_data( ImDrawData* draw_data, hydra::graphics::Device& gfx_device, hydra::graphics::CommandBuffer& commands ); 32 | 33 | // 34 | // File Dialog 35 | // 36 | 37 | bool imgui_file_dialog_open(const char* button_name, const char* path, const char* extension); 38 | const char* imgui_file_dialog_get_filename(); 39 | 40 | } // namespace hydra -------------------------------------------------------------------------------- /source/Articles/ShaderAugmentation/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2019 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/Articles/ShaderAugmentation/imgui/imgui_impl_sdl.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for SDL2 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | // (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Clipboard support. 8 | // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). 9 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 10 | // Missing features: 11 | // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. 12 | 13 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 14 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 15 | // https://github.com/ocornut/imgui 16 | 17 | #pragma once 18 | 19 | struct SDL_Window; 20 | typedef union SDL_Event SDL_Event; 21 | 22 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); 23 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); 24 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window); 25 | IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); 26 | IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(SDL_Window* window); 27 | IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event); 28 | -------------------------------------------------------------------------------- /source/Articles/ShaderAugmentation/optick/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Vadim Slyusarev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_call_h 9 | #define cglm_call_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "cglm.h" 15 | #include "call/vec2.h" 16 | #include "call/vec3.h" 17 | #include "call/vec4.h" 18 | #include "call/mat2.h" 19 | #include "call/mat3.h" 20 | #include "call/mat4.h" 21 | #include "call/affine.h" 22 | #include "call/cam.h" 23 | #include "call/quat.h" 24 | #include "call/euler.h" 25 | #include "call/plane.h" 26 | #include "call/frustum.h" 27 | #include "call/box.h" 28 | #include "call/io.h" 29 | #include "call/project.h" 30 | #include "call/sphere.h" 31 | #include "call/ease.h" 32 | #include "call/curve.h" 33 | #include "call/bezier.h" 34 | #include "call/ray.h" 35 | #include "call/affine2d.h" 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif /* cglm_call_h */ 41 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/affine2d.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_affine2d_h 9 | #define cglmc_affine2d_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_translate2d_make(mat3 m, vec2 v); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_translate2d_to(mat3 m, vec2 v, mat3 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_translate2d(mat3 m, vec2 v); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_translate2d_x(mat3 m, float to); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_translate2d_y(mat3 m, float to); 35 | 36 | CGLM_EXPORT 37 | void 38 | glmc_scale2d_to(mat3 m, vec2 v, mat3 dest); 39 | 40 | CGLM_EXPORT 41 | void 42 | glmc_scale2d_make(mat3 m, vec2 v); 43 | 44 | CGLM_EXPORT 45 | void 46 | glmc_scale2d(mat3 m, vec2 v); 47 | 48 | CGLM_EXPORT 49 | void 50 | glmc_scale2d_uni(mat3 m, float s); 51 | 52 | CGLM_EXPORT 53 | void 54 | glmc_rotate2d_make(mat3 m, float angle); 55 | 56 | CGLM_EXPORT 57 | void 58 | glmc_rotate2d(mat3 m, float angle); 59 | 60 | CGLM_EXPORT 61 | void 62 | glmc_rotate2d_to(mat3 m, float angle, mat3 dest); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #endif /* cglmc_affine2d_h */ 68 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/bezier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_bezier_h 9 | #define cglmc_bezier_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | float 18 | glmc_bezier(float s, float p0, float c0, float c1, float p1); 19 | 20 | CGLM_EXPORT 21 | float 22 | glmc_hermite(float s, float p0, float t0, float t1, float p1); 23 | 24 | CGLM_EXPORT 25 | float 26 | glmc_decasteljau(float prm, float p0, float c0, float c1, float p1); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* cglmc_bezier_h */ 32 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/box.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_box_h 9 | #define cglmc_box_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_aabb_transform(vec3 box[2], mat4 m, vec3 dest[2]); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_aabb_merge(vec3 box1[2], vec3 box2[2], vec3 dest[2]); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_aabb_crop(vec3 box[2], vec3 cropBox[2], vec3 dest[2]); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_aabb_crop_until(vec3 box[2], 31 | vec3 cropBox[2], 32 | vec3 clampBox[2], 33 | vec3 dest[2]); 34 | 35 | CGLM_EXPORT 36 | bool 37 | glmc_aabb_frustum(vec3 box[2], vec4 planes[6]); 38 | 39 | CGLM_EXPORT 40 | void 41 | glmc_aabb_invalidate(vec3 box[2]); 42 | 43 | CGLM_EXPORT 44 | bool 45 | glmc_aabb_isvalid(vec3 box[2]); 46 | 47 | CGLM_EXPORT 48 | float 49 | glmc_aabb_size(vec3 box[2]); 50 | 51 | CGLM_EXPORT 52 | float 53 | glmc_aabb_radius(vec3 box[2]); 54 | 55 | CGLM_EXPORT 56 | void 57 | glmc_aabb_center(vec3 box[2], vec3 dest); 58 | 59 | CGLM_EXPORT 60 | bool 61 | glmc_aabb_aabb(vec3 box[2], vec3 other[2]); 62 | 63 | CGLM_EXPORT 64 | bool 65 | glmc_aabb_point(vec3 box[2], vec3 point); 66 | 67 | CGLM_EXPORT 68 | bool 69 | glmc_aabb_contains(vec3 box[2], vec3 other[2]); 70 | 71 | CGLM_EXPORT 72 | bool 73 | glmc_aabb_sphere(vec3 box[2], vec4 s); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | #endif /* cglmc_box_h */ 79 | 80 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/curve.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_curve_h 9 | #define cglmc_curve_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | float 18 | glmc_smc(float s, mat4 m, vec4 c); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif /* cglmc_curve_h */ 24 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/euler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_euler_h 9 | #define cglmc_euler_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_euler_angles(mat4 m, vec3 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_euler(vec3 angles, mat4 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_euler_xyz(vec3 angles, mat4 dest); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_euler_zyx(vec3 angles, mat4 dest); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_euler_zxy(vec3 angles, mat4 dest); 35 | 36 | CGLM_EXPORT 37 | void 38 | glmc_euler_xzy(vec3 angles, mat4 dest); 39 | 40 | CGLM_EXPORT 41 | void 42 | glmc_euler_yzx(vec3 angles, mat4 dest); 43 | 44 | CGLM_EXPORT 45 | void 46 | glmc_euler_yxz(vec3 angles, mat4 dest); 47 | 48 | CGLM_EXPORT 49 | void 50 | glmc_euler_by_order(vec3 angles, glm_euler_seq axis, mat4 dest); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif /* cglmc_euler_h */ 56 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/frustum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_frustum_h 9 | #define cglmc_frustum_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_frustum_planes(mat4 m, vec4 dest[6]); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_frustum_corners(mat4 invMat, vec4 dest[8]); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_frustum_center(vec4 corners[8], vec4 dest); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_frustum_box(vec4 corners[8], mat4 m, vec3 box[2]); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_frustum_corners_at(vec4 corners[8], 35 | float splitDist, 36 | float farDist, 37 | vec4 planeCorners[4]); 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | #endif /* cglmc_frustum_h */ 42 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/io.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_io_h 9 | #define cglmc_io_h 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include "../cglm.h" 16 | 17 | CGLM_EXPORT 18 | void 19 | glmc_mat4_print(mat4 matrix, 20 | FILE * __restrict ostream); 21 | 22 | CGLM_EXPORT 23 | void 24 | glmc_mat3_print(mat3 matrix, 25 | FILE * __restrict ostream); 26 | 27 | CGLM_EXPORT 28 | void 29 | glmc_vec4_print(vec4 vec, 30 | FILE * __restrict ostream); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_vec3_print(vec3 vec, 35 | FILE * __restrict ostream); 36 | 37 | CGLM_EXPORT 38 | void 39 | glmc_versor_print(versor vec, 40 | FILE * __restrict ostream); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif /* cglmc_io_h */ 46 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/mat2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_mat2_h 9 | #define cglmc_mat2_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_mat2_copy(mat2 mat, mat2 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_mat2_identity(mat2 mat); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_mat2_identity_array(mat2 * __restrict mat, size_t count); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_mat2_zero(mat2 mat); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_mat2_mul(mat2 m1, mat2 m2, mat2 dest); 35 | 36 | CGLM_EXPORT 37 | void 38 | glmc_mat2_transpose_to(mat2 m, mat2 dest); 39 | 40 | CGLM_EXPORT 41 | void 42 | glmc_mat2_transpose(mat2 m); 43 | 44 | CGLM_EXPORT 45 | void 46 | glmc_mat2_mulv(mat2 m, vec2 v, vec2 dest); 47 | 48 | CGLM_EXPORT 49 | float 50 | glmc_mat2_trace(mat2 m); 51 | 52 | CGLM_EXPORT 53 | void 54 | glmc_mat2_scale(mat2 m, float s); 55 | 56 | CGLM_EXPORT 57 | float 58 | glmc_mat2_det(mat2 mat); 59 | 60 | CGLM_EXPORT 61 | void 62 | glmc_mat2_inv(mat2 mat, mat2 dest); 63 | 64 | CGLM_EXPORT 65 | void 66 | glmc_mat2_swap_col(mat2 mat, int col1, int col2); 67 | 68 | CGLM_EXPORT 69 | void 70 | glmc_mat2_swap_row(mat2 mat, int row1, int row2); 71 | 72 | CGLM_EXPORT 73 | float 74 | glmc_mat2_rmc(vec2 r, mat2 m, vec2 c); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | #endif /* cglmc_mat2_h */ 80 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/mat3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_mat3_h 9 | #define cglmc_mat3_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | /* DEPRECATED! use _copy, _ucopy versions */ 17 | #define glmc_mat3_dup(mat, dest) glmc_mat3_copy(mat, dest) 18 | 19 | CGLM_EXPORT 20 | void 21 | glmc_mat3_copy(mat3 mat, mat3 dest); 22 | 23 | CGLM_EXPORT 24 | void 25 | glmc_mat3_identity(mat3 mat); 26 | 27 | CGLM_EXPORT 28 | void 29 | glmc_mat3_zero(mat3 mat); 30 | 31 | CGLM_EXPORT 32 | void 33 | glmc_mat3_identity_array(mat3 * __restrict mat, size_t count); 34 | 35 | CGLM_EXPORT 36 | void 37 | glmc_mat3_mul(mat3 m1, mat3 m2, mat3 dest); 38 | 39 | CGLM_EXPORT 40 | void 41 | glmc_mat3_transpose_to(mat3 m, mat3 dest); 42 | 43 | CGLM_EXPORT 44 | void 45 | glmc_mat3_transpose(mat3 m); 46 | 47 | CGLM_EXPORT 48 | void 49 | glmc_mat3_mulv(mat3 m, vec3 v, vec3 dest); 50 | 51 | CGLM_EXPORT 52 | float 53 | glmc_mat3_trace(mat3 m); 54 | 55 | CGLM_EXPORT 56 | void 57 | glmc_mat3_quat(mat3 m, versor dest); 58 | 59 | CGLM_EXPORT 60 | void 61 | glmc_mat3_scale(mat3 m, float s); 62 | 63 | CGLM_EXPORT 64 | float 65 | glmc_mat3_det(mat3 mat); 66 | 67 | CGLM_EXPORT 68 | void 69 | glmc_mat3_inv(mat3 mat, mat3 dest); 70 | 71 | CGLM_EXPORT 72 | void 73 | glmc_mat3_swap_col(mat3 mat, int col1, int col2); 74 | 75 | CGLM_EXPORT 76 | void 77 | glmc_mat3_swap_row(mat3 mat, int row1, int row2); 78 | 79 | CGLM_EXPORT 80 | float 81 | glmc_mat3_rmc(vec3 r, mat3 m, vec3 c); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | #endif /* cglmc_mat3_h */ 87 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/plane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_plane_h 9 | #define cglmc_plane_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_plane_normalize(vec4 plane); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif /* cglmc_plane_h */ 24 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/project.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_project_h 9 | #define cglmc_project_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_unprojecti(vec3 pos, mat4 invMat, vec4 vp, vec3 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_unproject(vec3 pos, mat4 m, vec4 vp, vec3 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_project(vec3 pos, mat4 m, vec4 vp, vec3 dest); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* cglmc_project_h */ 32 | 33 | 34 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/ray.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_ray_h 9 | #define cglmc_ray_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | #include "../cglm.h" 14 | 15 | CGLM_EXPORT 16 | bool 17 | glmc_ray_triangle(vec3 origin, 18 | vec3 direction, 19 | vec3 v0, 20 | vec3 v1, 21 | vec3 v2, 22 | float *d); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* cglmc_ray_h */ 28 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/call/sphere.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_sphere_h 9 | #define cglmc_sphere_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | float 18 | glmc_sphere_radii(vec4 s); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_sphere_transform(vec4 s, mat4 m, vec4 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_sphere_merge(vec4 s1, vec4 s2, vec4 dest); 27 | 28 | CGLM_EXPORT 29 | bool 30 | glmc_sphere_sphere(vec4 s1, vec4 s2); 31 | 32 | CGLM_EXPORT 33 | bool 34 | glmc_sphere_point(vec4 s, vec3 point); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif /* cglmc_sphere_h */ 40 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/cglm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_h 9 | #define cglm_h 10 | 11 | #include "common.h" 12 | #include "vec2.h" 13 | #include "vec3.h" 14 | #include "vec4.h" 15 | #include "mat4.h" 16 | #include "mat3.h" 17 | #include "mat2.h" 18 | #include "affine.h" 19 | #include "cam.h" 20 | #include "frustum.h" 21 | #include "quat.h" 22 | #include "euler.h" 23 | #include "plane.h" 24 | #include "box.h" 25 | #include "color.h" 26 | #include "util.h" 27 | #include "io.h" 28 | #include "project.h" 29 | #include "sphere.h" 30 | #include "ease.h" 31 | #include "curve.h" 32 | #include "bezier.h" 33 | #include "ray.h" 34 | #include "affine2d.h" 35 | 36 | #endif /* cglm_h */ 37 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/color.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_color_h 9 | #define cglm_color_h 10 | 11 | #include "common.h" 12 | #include "vec3.h" 13 | 14 | /*! 15 | * @brief averages the color channels into one value 16 | * 17 | * @param[in] rgb RGB color 18 | */ 19 | CGLM_INLINE 20 | float 21 | glm_luminance(vec3 rgb) { 22 | vec3 l = {0.212671f, 0.715160f, 0.072169f}; 23 | return glm_dot(rgb, l); 24 | } 25 | 26 | #endif /* cglm_color_h */ 27 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_common_h 9 | #define cglm_common_h 10 | 11 | #ifndef _USE_MATH_DEFINES 12 | # define _USE_MATH_DEFINES /* for windows */ 13 | #endif 14 | 15 | #ifndef _CRT_SECURE_NO_WARNINGS 16 | # define _CRT_SECURE_NO_WARNINGS /* for windows */ 17 | #endif 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #if defined(_MSC_VER) 26 | # ifdef CGLM_STATIC 27 | # define CGLM_EXPORT 28 | # elif defined(CGLM_EXPORTS) 29 | # define CGLM_EXPORT __declspec(dllexport) 30 | # else 31 | # define CGLM_EXPORT __declspec(dllimport) 32 | # endif 33 | # define CGLM_INLINE __forceinline 34 | #else 35 | # define CGLM_EXPORT __attribute__((visibility("default"))) 36 | # define CGLM_INLINE static inline __attribute((always_inline)) 37 | #endif 38 | 39 | #define GLM_SHUFFLE4(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) 40 | #define GLM_SHUFFLE3(z, y, x) (((z) << 4) | ((y) << 2) | (x)) 41 | 42 | #include "types.h" 43 | #include "simd/intrin.h" 44 | 45 | #ifndef CGLM_USE_DEFAULT_EPSILON 46 | # ifndef GLM_FLT_EPSILON 47 | # define GLM_FLT_EPSILON 1e-6 48 | # endif 49 | #else 50 | # define GLM_FLT_EPSILON FLT_EPSILON 51 | #endif 52 | 53 | #endif /* cglm_common_h */ 54 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/curve.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_curve_h 9 | #define cglm_curve_h 10 | 11 | #include "common.h" 12 | #include "vec4.h" 13 | #include "mat4.h" 14 | 15 | /*! 16 | * @brief helper function to calculate S*M*C multiplication for curves 17 | * 18 | * This function does not encourage you to use SMC, 19 | * instead it is a helper if you use SMC. 20 | * 21 | * if you want to specify S as vector then use more generic glm_mat4_rmc() func. 22 | * 23 | * Example usage: 24 | * B(s) = glm_smc(s, GLM_BEZIER_MAT, (vec4){p0, c0, c1, p1}) 25 | * 26 | * @param[in] s parameter between 0 and 1 (this will be [s3, s2, s, 1]) 27 | * @param[in] m basis matrix 28 | * @param[in] c position/control vector 29 | * 30 | * @return B(s) 31 | */ 32 | CGLM_INLINE 33 | float 34 | glm_smc(float s, mat4 m, vec4 c) { 35 | vec4 vs; 36 | glm_vec4_cubic(s, vs); 37 | return glm_mat4_rmc(vs, m, c); 38 | } 39 | 40 | #endif /* cglm_curve_h */ 41 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/plane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_plane_h 9 | #define cglm_plane_h 10 | 11 | #include "common.h" 12 | #include "vec4.h" 13 | 14 | /* 15 | Plane equation: Ax + By + Cz + D = 0; 16 | 17 | It stored in vec4 as [A, B, C, D]. (A, B, C) is normal and D is distance 18 | */ 19 | 20 | /* 21 | Functions: 22 | CGLM_INLINE void glm_plane_normalize(vec4 plane); 23 | */ 24 | 25 | /*! 26 | * @brief normalizes a plane 27 | * 28 | * @param[in, out] plane plane to normalize 29 | */ 30 | CGLM_INLINE 31 | void 32 | glm_plane_normalize(vec4 plane) { 33 | float norm; 34 | 35 | if ((norm = glm_vec3_norm(plane)) == 0.0f) { 36 | glm_vec4_zero(plane); 37 | return; 38 | } 39 | 40 | glm_vec4_scale(plane, 1.0f / norm, plane); 41 | } 42 | 43 | #endif /* cglm_plane_h */ 44 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/simd/arm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_simd_arm_h 9 | #define cglm_simd_arm_h 10 | #include "intrin.h" 11 | #ifdef CGLM_SIMD_ARM 12 | 13 | #define glmm_load(p) vld1q_f32(p) 14 | #define glmm_store(p, a) vst1q_f32(p, a) 15 | 16 | static inline 17 | float32x4_t 18 | glmm_abs(float32x4_t v) { 19 | return vabsq_f32(v); 20 | } 21 | 22 | static inline 23 | float 24 | glmm_hadd(float32x4_t v) { 25 | #if defined(__aarch64__) 26 | return vaddvq_f32(v); 27 | #else 28 | v = vaddq_f32(v, vrev64q_f32(v)); 29 | v = vaddq_f32(v, vcombine_f32(vget_high_f32(v), vget_low_f32(v))); 30 | return vgetq_lane_f32(v, 0); 31 | #endif 32 | } 33 | 34 | static inline 35 | float 36 | glmm_hmin(float32x4_t v) { 37 | float32x2_t t; 38 | t = vpmin_f32(vget_low_f32(v), vget_high_f32(v)); 39 | t = vpmin_f32(t, t); 40 | return vget_lane_f32(t, 0); 41 | } 42 | 43 | static inline 44 | float 45 | glmm_hmax(float32x4_t v) { 46 | float32x2_t t; 47 | t = vpmax_f32(vget_low_f32(v), vget_high_f32(v)); 48 | t = vpmax_f32(t, t); 49 | return vget_lane_f32(t, 0); 50 | } 51 | 52 | static inline 53 | float 54 | glmm_dot(float32x4_t a, float32x4_t b) { 55 | return glmm_hadd(vmulq_f32(a, b)); 56 | } 57 | 58 | static inline 59 | float 60 | glmm_norm(float32x4_t a) { 61 | return sqrtf(glmm_dot(a, a)); 62 | } 63 | 64 | static inline 65 | float 66 | glmm_norm2(float32x4_t a) { 67 | return glmm_dot(a, a); 68 | } 69 | 70 | static inline 71 | float 72 | glmm_norm_one(float32x4_t a) { 73 | return glmm_hadd(glmm_abs(a)); 74 | } 75 | 76 | static inline 77 | float 78 | glmm_norm_inf(float32x4_t a) { 79 | return glmm_hmax(glmm_abs(a)); 80 | } 81 | 82 | #endif 83 | #endif /* cglm_simd_arm_h */ 84 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/simd/intrin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_intrin_h 9 | #define cglm_intrin_h 10 | 11 | #if defined( _MSC_VER ) 12 | # if (defined(_M_AMD64) || defined(_M_X64)) || _M_IX86_FP == 2 13 | # ifndef __SSE2__ 14 | # define __SSE2__ 15 | # endif 16 | # elif _M_IX86_FP == 1 17 | # ifndef __SSE__ 18 | # define __SSE__ 19 | # endif 20 | # endif 21 | /* do not use alignment for older visual studio versions */ 22 | # if _MSC_VER < 1913 /* Visual Studio 2017 version 15.6 */ 23 | # define CGLM_ALL_UNALIGNED 24 | # endif 25 | #endif 26 | 27 | #if defined( __SSE__ ) || defined( __SSE2__ ) 28 | # include 29 | # include 30 | # define CGLM_SSE_FP 1 31 | # ifndef CGLM_SIMD_x86 32 | # define CGLM_SIMD_x86 33 | # endif 34 | #endif 35 | 36 | #if defined(__SSE3__) 37 | # include 38 | # ifndef CGLM_SIMD_x86 39 | # define CGLM_SIMD_x86 40 | # endif 41 | #endif 42 | 43 | #if defined(__SSE4_1__) 44 | # include 45 | # ifndef CGLM_SIMD_x86 46 | # define CGLM_SIMD_x86 47 | # endif 48 | #endif 49 | 50 | #if defined(__SSE4_2__) 51 | # include 52 | # ifndef CGLM_SIMD_x86 53 | # define CGLM_SIMD_x86 54 | # endif 55 | #endif 56 | 57 | #ifdef __AVX__ 58 | # include 59 | # define CGLM_AVX_FP 1 60 | # ifndef CGLM_SIMD_x86 61 | # define CGLM_SIMD_x86 62 | # endif 63 | #endif 64 | 65 | /* ARM Neon */ 66 | #if defined(__ARM_NEON) 67 | # include 68 | # if defined(__ARM_NEON_FP) 69 | # define CGLM_NEON_FP 1 70 | # ifndef CGLM_SIMD_ARM 71 | # define CGLM_SIMD_ARM 72 | # endif 73 | # endif 74 | #endif 75 | 76 | #if defined(CGLM_SIMD_x86) || defined(CGLM_NEON_FP) 77 | # ifndef CGLM_SIMD 78 | # define CGLM_SIMD 79 | # endif 80 | #endif 81 | 82 | #if defined(CGLM_SIMD_x86) 83 | # include "x86.h" 84 | #endif 85 | 86 | #if defined(CGLM_SIMD_ARM) 87 | # include "arm.h" 88 | #endif 89 | 90 | #endif /* cglm_intrin_h */ 91 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/simd/sse2/mat2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_mat2_sse_h 9 | #define cglm_mat2_sse_h 10 | #if defined( __SSE__ ) || defined( __SSE2__ ) 11 | 12 | #include "../../common.h" 13 | #include "../intrin.h" 14 | 15 | CGLM_INLINE 16 | void 17 | glm_mat2_mul_sse2(mat2 m1, mat2 m2, mat2 dest) { 18 | __m128 x0, x1, x2; 19 | 20 | x1 = glmm_load(m1[0]); /* d c b a */ 21 | x2 = glmm_load(m2[0]); /* h g f e */ 22 | 23 | /* 24 | dest[0][0] = a * e + c * f; 25 | dest[0][1] = b * e + d * f; 26 | dest[1][0] = a * g + c * h; 27 | dest[1][1] = b * g + d * h; 28 | */ 29 | x0 = _mm_mul_ps(_mm_movelh_ps(x1, x1), glmm_shuff1(x2, 2, 2, 0, 0)); 30 | x1 = _mm_mul_ps(_mm_movehl_ps(x1, x1), glmm_shuff1(x2, 3, 3, 1, 1)); 31 | x1 = _mm_add_ps(x0, x1); 32 | 33 | glmm_store(dest[0], x1); 34 | } 35 | 36 | CGLM_INLINE 37 | void 38 | glm_mat2_transp_sse2(mat2 m, mat2 dest) { 39 | /* d c b a */ 40 | /* d b c a */ 41 | glmm_store(dest[0], glmm_shuff1(glmm_load(m[0]), 3, 1, 2, 0)); 42 | } 43 | 44 | #endif 45 | #endif /* cglm_mat2_sse_h */ 46 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/simd/sse2/mat3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_mat3_sse_h 9 | #define cglm_mat3_sse_h 10 | #if defined( __SSE__ ) || defined( __SSE2__ ) 11 | 12 | #include "../../common.h" 13 | #include "../intrin.h" 14 | 15 | CGLM_INLINE 16 | void 17 | glm_mat3_mul_sse2(mat3 m1, mat3 m2, mat3 dest) { 18 | __m128 l0, l1, l2; 19 | __m128 r0, r1, r2; 20 | __m128 x0, x1, x2; 21 | 22 | l0 = _mm_loadu_ps(m1[0]); 23 | l1 = _mm_loadu_ps(&m1[1][1]); 24 | l2 = _mm_set1_ps(m1[2][2]); 25 | 26 | r0 = _mm_loadu_ps(m2[0]); 27 | r1 = _mm_loadu_ps(&m2[1][1]); 28 | r2 = _mm_set1_ps(m2[2][2]); 29 | 30 | x1 = glmm_shuff2(l0, l1, 1, 0, 3, 3, 0, 3, 2, 0); 31 | x2 = glmm_shuff2(l1, l2, 0, 0, 3, 2, 0, 2, 1, 0); 32 | 33 | x0 = _mm_add_ps(_mm_mul_ps(glmm_shuff1(l0, 0, 2, 1, 0), 34 | glmm_shuff1(r0, 3, 0, 0, 0)), 35 | _mm_mul_ps(x1, glmm_shuff2(r0, r1, 0, 0, 1, 1, 2, 0, 0, 0))); 36 | 37 | x0 = _mm_add_ps(x0, 38 | _mm_mul_ps(x2, glmm_shuff2(r0, r1, 1, 1, 2, 2, 2, 0, 0, 0))); 39 | 40 | _mm_storeu_ps(dest[0], x0); 41 | 42 | x0 = _mm_add_ps(_mm_mul_ps(glmm_shuff1(l0, 1, 0, 2, 1), 43 | _mm_shuffle_ps(r0, r1, _MM_SHUFFLE(2, 2, 3, 3))), 44 | _mm_mul_ps(glmm_shuff1(x1, 1, 0, 2, 1), 45 | glmm_shuff1(r1, 3, 3, 0, 0))); 46 | 47 | x0 = _mm_add_ps(x0, 48 | _mm_mul_ps(glmm_shuff1(x2, 1, 0, 2, 1), 49 | _mm_shuffle_ps(r1, r2, _MM_SHUFFLE(0, 0, 1, 1)))); 50 | 51 | _mm_storeu_ps(&dest[1][1], x0); 52 | 53 | dest[2][2] = m1[0][2] * m2[2][0] 54 | + m1[1][2] * m2[2][1] 55 | + m1[2][2] * m2[2][2]; 56 | } 57 | 58 | #endif 59 | #endif /* cglm_mat3_sse_h */ 60 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/simd/sse2/quat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_quat_simd_h 9 | #define cglm_quat_simd_h 10 | #if defined( __SSE__ ) || defined( __SSE2__ ) 11 | 12 | #include "../../common.h" 13 | #include "../intrin.h" 14 | 15 | CGLM_INLINE 16 | void 17 | glm_quat_mul_sse2(versor p, versor q, versor dest) { 18 | /* 19 | + (a1 b2 + b1 a2 + c1 d2 − d1 c2)i 20 | + (a1 c2 − b1 d2 + c1 a2 + d1 b2)j 21 | + (a1 d2 + b1 c2 − c1 b2 + d1 a2)k 22 | a1 a2 − b1 b2 − c1 c2 − d1 d2 23 | */ 24 | 25 | __m128 xp, xq, x0, r; 26 | 27 | xp = glmm_load(p); /* 3 2 1 0 */ 28 | xq = glmm_load(q); 29 | 30 | r = _mm_mul_ps(glmm_shuff1x(xp, 3), xq); 31 | 32 | x0 = _mm_xor_ps(glmm_shuff1x(xp, 0), _mm_set_ps(-0.f, 0.f, -0.f, 0.f)); 33 | r = _mm_add_ps(r, _mm_mul_ps(x0, glmm_shuff1(xq, 0, 1, 2, 3))); 34 | 35 | x0 = _mm_xor_ps(glmm_shuff1x(xp, 1), _mm_set_ps(-0.f, -0.f, 0.f, 0.f)); 36 | r = _mm_add_ps(r, _mm_mul_ps(x0, glmm_shuff1(xq, 1, 0, 3, 2))); 37 | 38 | x0 = _mm_xor_ps(glmm_shuff1x(xp, 2), _mm_set_ps(-0.f, 0.f, 0.f, -0.f)); 39 | r = _mm_add_ps(r, _mm_mul_ps(x0, glmm_shuff1(xq, 2, 3, 0, 1))); 40 | 41 | glmm_store(dest, r); 42 | } 43 | 44 | 45 | #endif 46 | #endif /* cglm_quat_simd_h */ 47 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_structs_h 9 | #define cglm_structs_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "cglm.h" 15 | #include "types-struct.h" 16 | #include "struct/vec2.h" 17 | #include "struct/vec3.h" 18 | #include "struct/vec4.h" 19 | #include "struct/mat2.h" 20 | #include "struct/mat3.h" 21 | #include "struct/mat4.h" 22 | #include "struct/affine.h" 23 | #include "struct/frustum.h" 24 | #include "struct/plane.h" 25 | #include "struct/box.h" 26 | #include "struct/color.h" 27 | #include "struct/io.h" 28 | #include "struct/cam.h" 29 | #include "struct/quat.h" 30 | #include "struct/euler.h" 31 | #include "struct/project.h" 32 | #include "struct/sphere.h" 33 | #include "struct/curve.h" 34 | #include "struct/affine2d.h" 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif /* cglm_structs_h */ 40 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/struct/color.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglms_colors_h 9 | #define cglms_colors_h 10 | 11 | #include "../common.h" 12 | #include "../types-struct.h" 13 | #include "../color.h" 14 | #include "vec3.h" 15 | 16 | /*! 17 | * @brief averages the color channels into one value 18 | * 19 | * @param[in] rgb RGB color 20 | */ 21 | CGLM_INLINE 22 | float 23 | glms_luminance(vec3s rgb) { 24 | return glm_luminance(rgb.raw); 25 | } 26 | 27 | #endif /* cglms_colors_h */ 28 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/struct/curve.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglms_curves_h 9 | #define cglms_curves_h 10 | 11 | #include "../common.h" 12 | #include "../types-struct.h" 13 | #include "../curve.h" 14 | #include "vec4.h" 15 | #include "mat4.h" 16 | 17 | /*! 18 | * @brief helper function to calculate S*M*C multiplication for curves 19 | * 20 | * This function does not encourage you to use SMC, 21 | * instead it is a helper if you use SMC. 22 | * 23 | * if you want to specify S as vector then use more generic glm_mat4_rmc() func. 24 | * 25 | * Example usage: 26 | * B(s) = glm_smc(s, GLM_BEZIER_MAT, (vec4){p0, c0, c1, p1}) 27 | * 28 | * @param[in] s parameter between 0 and 1 (this will be [s3, s2, s, 1]) 29 | * @param[in] m basis matrix 30 | * @param[in] c position/control vector 31 | * 32 | * @return B(s) 33 | */ 34 | CGLM_INLINE 35 | float 36 | glms_smc(float s, mat4s m, vec4s c) { 37 | return glm_smc(s, m.raw, c.raw); 38 | } 39 | 40 | #endif /* cglms_curves_h */ 41 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/struct/plane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglms_planes_h 9 | #define cglms_planes_h 10 | 11 | #include "../common.h" 12 | #include "../types-struct.h" 13 | #include "../plane.h" 14 | #include "vec4.h" 15 | 16 | /* 17 | Plane equation: Ax + By + Cz + D = 0; 18 | 19 | It stored in vec4 as [A, B, C, D]. (A, B, C) is normal and D is distance 20 | */ 21 | 22 | /* 23 | Functions: 24 | CGLM_INLINE vec4s glms_plane_normalize(vec4s plane); 25 | */ 26 | 27 | /*! 28 | * @brief normalizes a plane 29 | * 30 | * @param[in] plane plane to normalize 31 | * @returns normalized plane 32 | */ 33 | CGLM_INLINE 34 | vec4s 35 | glms_plane_normalize(vec4s plane) { 36 | glm_plane_normalize(plane.raw); 37 | return plane; 38 | } 39 | 40 | #endif /* cglms_planes_h */ 41 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/cglm/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_version_h 9 | #define cglm_version_h 10 | 11 | #define CGLM_VERSION_MAJOR 0 12 | #define CGLM_VERSION_MINOR 7 13 | #define CGLM_VERSION_PATCH 9 14 | 15 | #endif /* cglm_version_h */ 16 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/hydra/.gitignore: -------------------------------------------------------------------------------- 1 | /[Bb]in/ 2 | /[Bb]uild/ 3 | /[Dd]ebug/ 4 | /[Rr]elease/ 5 | /**/[Bb]uild/ 6 | /**/.vs/ 7 | 8 | # MSVC user extensions 9 | *.opensdf 10 | *.sdf 11 | *.suo 12 | *.filters 13 | *.user 14 | *.obj 15 | *.pdb 16 | *.idb 17 | *.log 18 | *.tlog 19 | *.lastbuildstate 20 | *.dll 21 | *.lib 22 | *.exp 23 | *.opendb 24 | *.ini 25 | *.exe 26 | *.ilk 27 | *.bhfx 28 | *.sbhr 29 | *.mbhr 30 | *.tbhr 31 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/hydra/LICENSE.md: -------------------------------------------------------------------------------- 1 | zlib/libpng license 2 | 3 | Copyright (c) 2019 Gabriel Sassone 4 | 5 | This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | 9 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 10 | 11 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 12 | 13 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /source/Articles/StarRendering/hydra/README.md: -------------------------------------------------------------------------------- 1 | # HydraLibs 2 | Central repository for personal libraries.
3 | Used as subtree by other repositories. 4 | 5 | Includes vk_mem_alloc by AMD. 6 | 7 | ======= 8 | Library | Lastest version | Category | LoC | Description 9 | --------------------- | ---- | -------- | --- | -------------------------------- 10 | **[hydra_application.h](hydra_application.h)** | 0.11 | app | -1 | Simple window application loop. 11 | **[hydra_graphics.h](hydra_graphics.h)** | 0.12 | gfx | -1 | OpenGL/Vulkan Render API Abstraction. 12 | **[hydra_imgui.h](hydra_imgui.h)** | 0.05 | gfx | -1 | ImGui Renderer using Hydra Graphics. 13 | **[hydra_lib.h](hydra_lib.h)** | 0.12 | ker | -1 | Logging, files, strings, process, stb array and hash maps. 14 | **[hydra_rendering.h](hydra_rendering.h)** | 0.15 | gfx | -1 | High level rendering. CGLM, GLTF, Mesh, Materials, Render Pipelines. 15 | **[hydra_resources.h](hydra_resources.h)** | 0.01 | gfx | -1 | Resource Manager for graphics. 16 | **[hydra_shaderfx.h](hydra_shaderfx.h)** | 0.25 | gfx | -1 | Compiler of HFX. 17 | 18 | # TODO 19 | 20 | ## Serialization 21 | The actual idea is to convert all the serializable data to use structs/classes defined from a Data Definition Format, like HDF. 22 | Serialization can be created on top of that by generating automatically the code using an external serialization library. 23 | Some possibilities: 24 | 25 | [Bitsery](https://github.com/fraillt/bitsery) 26 | [MPack](https://github.com/ludocode/mpack) 27 | 28 | ## Allocation 29 | 30 | Still to decide the implementation details: save the allocator or pass it ? 31 | 32 | * Add allocators to all data structures (array and maps) 33 | 34 | ## Resource/Asset Management 35 | 36 | * Add an asynchronous resource/asset manager. 37 | 38 | ## High Level Rendering 39 | 40 | * Using serialization and resource/asset manager, high level rendering can be implemented. 41 | * Material + Shaders 42 | * Render Frame/Graph 43 | * Mesh/Scene 44 | 45 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2019 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/imgui/imgui_impl_sdl.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for SDL2 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | // (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Clipboard support. 8 | // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). 9 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 10 | // Missing features: 11 | // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. 12 | 13 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 14 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 15 | // https://github.com/ocornut/imgui 16 | 17 | #pragma once 18 | 19 | struct SDL_Window; 20 | typedef union SDL_Event SDL_Event; 21 | 22 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); 23 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); 24 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window); 25 | IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); 26 | IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(SDL_Window* window); 27 | IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event); 28 | -------------------------------------------------------------------------------- /source/Articles/StarRendering/star_map_application.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/source/Articles/StarRendering/star_map_application.cpp -------------------------------------------------------------------------------- /source/NodeEditor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(imgui_node_editor) 2 | 3 | find_package(imgui REQUIRED) 4 | 5 | add_library(imgui_canvas STATIC 6 | Source/imgui_canvas.cpp 7 | Source/imgui_canvas.h 8 | ) 9 | target_include_directories(imgui_canvas PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Source) 10 | target_link_libraries(imgui_canvas PUBLIC imgui) 11 | source_group("" FILES Source/imgui_canvas.cpp Source/imgui_canvas.h) 12 | set_property(TARGET imgui_canvas PROPERTY FOLDER "NodeEditor") 13 | 14 | set(_imgui_node_editor_Sources 15 | Include/imgui_node_editor.h 16 | Source/crude_json.cpp 17 | Source/crude_json.h 18 | Source/imgui_bezier_math.h 19 | Source/imgui_bezier_math.inl 20 | Source/imgui_canvas.cpp 21 | Source/imgui_canvas.h 22 | Source/imgui_extra_math.h 23 | Source/imgui_extra_math.inl 24 | Source/imgui_node_editor_api.cpp 25 | Source/imgui_node_editor_internal.h 26 | Source/imgui_node_editor_internal.inl 27 | Source/imgui_node_editor.cpp 28 | Support/imgui_node_editor.natvis 29 | ) 30 | 31 | source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${_imgui_node_editor_Sources}) 32 | 33 | add_library(${PROJECT_NAME} STATIC ${_imgui_node_editor_Sources}) 34 | 35 | set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "NodeEditor") 36 | 37 | target_link_libraries(${PROJECT_NAME} PUBLIC imgui) 38 | 39 | target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Include) 40 | target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Source) 41 | -------------------------------------------------------------------------------- /source/NodeEditor/Source/imgui_node_editor_internal.inl: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // LICENSE 3 | // This software is dual-licensed to the public domain and under the following 4 | // license: you are granted a perpetual, irrevocable license to copy, modify, 5 | // publish, and distribute this file as you see fit. 6 | // 7 | // CREDITS 8 | // Written by Michal Cichon 9 | //------------------------------------------------------------------------------ 10 | # ifndef __IMGUI_NODE_EDITOR_INTERNAL_INL__ 11 | # define __IMGUI_NODE_EDITOR_INTERNAL_INL__ 12 | # pragma once 13 | 14 | 15 | //------------------------------------------------------------------------------ 16 | # include "imgui_node_editor_internal.h" 17 | 18 | 19 | //------------------------------------------------------------------------------ 20 | namespace ax { 21 | namespace NodeEditor { 22 | namespace Detail { 23 | 24 | 25 | //------------------------------------------------------------------------------ 26 | //inline ImRect ToRect(const ax::rectf& rect) 27 | //{ 28 | // return ImRect( 29 | // to_imvec(rect.top_left()), 30 | // to_imvec(rect.bottom_right()) 31 | // ); 32 | //} 33 | // 34 | //inline ImRect ToRect(const ax::rect& rect) 35 | //{ 36 | // return ImRect( 37 | // to_imvec(rect.top_left()), 38 | // to_imvec(rect.bottom_right()) 39 | // ); 40 | //} 41 | 42 | inline ImRect ImGui_GetItemRect() 43 | { 44 | return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax()); 45 | } 46 | 47 | 48 | //------------------------------------------------------------------------------ 49 | } // namespace Detail 50 | } // namespace Editor 51 | } // namespace ax 52 | 53 | 54 | //------------------------------------------------------------------------------ 55 | # endif // __IMGUI_NODE_EDITOR_INTERNAL_INL__ 56 | -------------------------------------------------------------------------------- /source/NodeEditor/Support/imgui_node_editor.natvis: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {m_Type,en} {*(crude_json::object*)&m_Storage,view(simple)} 6 | {m_Type,en} {*(crude_json::array*)&m_Storage,view(simple)} 7 | {*(crude_json::string*)&m_Storage,view(simple)} 8 | {*(crude_json::boolean*)&m_Storage} 9 | {*(crude_json::number*)&m_Storage,g} 10 | {m_Type,en} 11 | *(crude_json::string*)&m_Storage 12 | 13 | *(crude_json::object*)&m_Storage,view(simple) 14 | *(crude_json::array*)&m_Storage,view(simple) 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /source/cglm/call.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_call_h 9 | #define cglm_call_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "cglm.h" 15 | #include "call/vec2.h" 16 | #include "call/vec3.h" 17 | #include "call/vec4.h" 18 | #include "call/mat2.h" 19 | #include "call/mat3.h" 20 | #include "call/mat4.h" 21 | #include "call/affine.h" 22 | #include "call/cam.h" 23 | #include "call/quat.h" 24 | #include "call/euler.h" 25 | #include "call/plane.h" 26 | #include "call/frustum.h" 27 | #include "call/box.h" 28 | #include "call/io.h" 29 | #include "call/project.h" 30 | #include "call/sphere.h" 31 | #include "call/ease.h" 32 | #include "call/curve.h" 33 | #include "call/bezier.h" 34 | #include "call/ray.h" 35 | #include "call/affine2d.h" 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif /* cglm_call_h */ 41 | -------------------------------------------------------------------------------- /source/cglm/call/affine2d.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_affine2d_h 9 | #define cglmc_affine2d_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_translate2d_make(mat3 m, vec2 v); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_translate2d_to(mat3 m, vec2 v, mat3 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_translate2d(mat3 m, vec2 v); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_translate2d_x(mat3 m, float to); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_translate2d_y(mat3 m, float to); 35 | 36 | CGLM_EXPORT 37 | void 38 | glmc_scale2d_to(mat3 m, vec2 v, mat3 dest); 39 | 40 | CGLM_EXPORT 41 | void 42 | glmc_scale2d_make(mat3 m, vec2 v); 43 | 44 | CGLM_EXPORT 45 | void 46 | glmc_scale2d(mat3 m, vec2 v); 47 | 48 | CGLM_EXPORT 49 | void 50 | glmc_scale2d_uni(mat3 m, float s); 51 | 52 | CGLM_EXPORT 53 | void 54 | glmc_rotate2d_make(mat3 m, float angle); 55 | 56 | CGLM_EXPORT 57 | void 58 | glmc_rotate2d(mat3 m, float angle); 59 | 60 | CGLM_EXPORT 61 | void 62 | glmc_rotate2d_to(mat3 m, float angle, mat3 dest); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #endif /* cglmc_affine2d_h */ 68 | -------------------------------------------------------------------------------- /source/cglm/call/bezier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_bezier_h 9 | #define cglmc_bezier_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | float 18 | glmc_bezier(float s, float p0, float c0, float c1, float p1); 19 | 20 | CGLM_EXPORT 21 | float 22 | glmc_hermite(float s, float p0, float t0, float t1, float p1); 23 | 24 | CGLM_EXPORT 25 | float 26 | glmc_decasteljau(float prm, float p0, float c0, float c1, float p1); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* cglmc_bezier_h */ 32 | -------------------------------------------------------------------------------- /source/cglm/call/box.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_box_h 9 | #define cglmc_box_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_aabb_transform(vec3 box[2], mat4 m, vec3 dest[2]); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_aabb_merge(vec3 box1[2], vec3 box2[2], vec3 dest[2]); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_aabb_crop(vec3 box[2], vec3 cropBox[2], vec3 dest[2]); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_aabb_crop_until(vec3 box[2], 31 | vec3 cropBox[2], 32 | vec3 clampBox[2], 33 | vec3 dest[2]); 34 | 35 | CGLM_EXPORT 36 | bool 37 | glmc_aabb_frustum(vec3 box[2], vec4 planes[6]); 38 | 39 | CGLM_EXPORT 40 | void 41 | glmc_aabb_invalidate(vec3 box[2]); 42 | 43 | CGLM_EXPORT 44 | bool 45 | glmc_aabb_isvalid(vec3 box[2]); 46 | 47 | CGLM_EXPORT 48 | float 49 | glmc_aabb_size(vec3 box[2]); 50 | 51 | CGLM_EXPORT 52 | float 53 | glmc_aabb_radius(vec3 box[2]); 54 | 55 | CGLM_EXPORT 56 | void 57 | glmc_aabb_center(vec3 box[2], vec3 dest); 58 | 59 | CGLM_EXPORT 60 | bool 61 | glmc_aabb_aabb(vec3 box[2], vec3 other[2]); 62 | 63 | CGLM_EXPORT 64 | bool 65 | glmc_aabb_point(vec3 box[2], vec3 point); 66 | 67 | CGLM_EXPORT 68 | bool 69 | glmc_aabb_contains(vec3 box[2], vec3 other[2]); 70 | 71 | CGLM_EXPORT 72 | bool 73 | glmc_aabb_sphere(vec3 box[2], vec4 s); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | #endif /* cglmc_box_h */ 79 | 80 | -------------------------------------------------------------------------------- /source/cglm/call/clipspace/ortho_lh_no.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_ortho_lh_no_h 9 | #define cglmc_ortho_lh_no_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_ortho_lh_no(float left, float right, 19 | float bottom, float top, 20 | float nearZ, float farZ, 21 | mat4 dest); 22 | 23 | CGLM_EXPORT 24 | void 25 | glmc_ortho_aabb_lh_no(vec3 box[2], mat4 dest); 26 | 27 | CGLM_EXPORT 28 | void 29 | glmc_ortho_aabb_p_lh_no(vec3 box[2], float padding, mat4 dest); 30 | 31 | CGLM_EXPORT 32 | void 33 | glmc_ortho_aabb_pz_lh_no(vec3 box[2], float padding, mat4 dest); 34 | 35 | CGLM_EXPORT 36 | void 37 | glmc_ortho_default_lh_no(float aspect, mat4 dest); 38 | 39 | CGLM_EXPORT 40 | void 41 | glmc_ortho_default_s_lh_no(float aspect, float size, mat4 dest); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | #endif /* cglmc_ortho_lh_no_h */ 47 | -------------------------------------------------------------------------------- /source/cglm/call/clipspace/ortho_lh_zo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_ortho_lh_zo_h 9 | #define cglmc_ortho_lh_zo_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_ortho_lh_zo(float left, float right, 19 | float bottom, float top, 20 | float nearZ, float farZ, 21 | mat4 dest); 22 | 23 | CGLM_EXPORT 24 | void 25 | glmc_ortho_aabb_lh_zo(vec3 box[2], mat4 dest); 26 | 27 | CGLM_EXPORT 28 | void 29 | glmc_ortho_aabb_p_lh_zo(vec3 box[2], float padding, mat4 dest); 30 | 31 | CGLM_EXPORT 32 | void 33 | glmc_ortho_aabb_pz_lh_zo(vec3 box[2], float padding, mat4 dest); 34 | 35 | CGLM_EXPORT 36 | void 37 | glmc_ortho_default_lh_zo(float aspect, mat4 dest); 38 | 39 | CGLM_EXPORT 40 | void 41 | glmc_ortho_default_s_lh_zo(float aspect, float size, mat4 dest); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | #endif /* cglmc_ortho_lh_zo_h */ 47 | -------------------------------------------------------------------------------- /source/cglm/call/clipspace/ortho_rh_no.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_ortho_rh_no_h 9 | #define cglmc_ortho_rh_no_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_ortho_rh_no(float left, float right, 19 | float bottom, float top, 20 | float nearZ, float farZ, 21 | mat4 dest); 22 | 23 | CGLM_EXPORT 24 | void 25 | glmc_ortho_aabb_rh_no(vec3 box[2], mat4 dest); 26 | 27 | CGLM_EXPORT 28 | void 29 | glmc_ortho_aabb_p_rh_no(vec3 box[2], float padding, mat4 dest); 30 | 31 | CGLM_EXPORT 32 | void 33 | glmc_ortho_aabb_pz_rh_no(vec3 box[2], float padding, mat4 dest); 34 | 35 | CGLM_EXPORT 36 | void 37 | glmc_ortho_default_rh_no(float aspect, mat4 dest); 38 | 39 | CGLM_EXPORT 40 | void 41 | glmc_ortho_default_s_rh_no(float aspect, float size, mat4 dest); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | #endif /* cglmc_ortho_rh_no_h */ 47 | -------------------------------------------------------------------------------- /source/cglm/call/clipspace/ortho_rh_zo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_ortho_rh_zo_h 9 | #define cglmc_ortho_rh_zo_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_ortho_rh_zo(float left, float right, 19 | float bottom, float top, 20 | float nearZ, float farZ, 21 | mat4 dest); 22 | 23 | CGLM_EXPORT 24 | void 25 | glmc_ortho_aabb_rh_zo(vec3 box[2], mat4 dest); 26 | 27 | CGLM_EXPORT 28 | void 29 | glmc_ortho_aabb_p_rh_zo(vec3 box[2], float padding, mat4 dest); 30 | 31 | CGLM_EXPORT 32 | void 33 | glmc_ortho_aabb_pz_rh_zo(vec3 box[2], float padding, mat4 dest); 34 | 35 | CGLM_EXPORT 36 | void 37 | glmc_ortho_default_rh_zo(float aspect, mat4 dest); 38 | 39 | CGLM_EXPORT 40 | void 41 | glmc_ortho_default_s_rh_zo(float aspect, float size, mat4 dest); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | #endif /* cglmc_ortho_rh_zo_h */ 47 | -------------------------------------------------------------------------------- /source/cglm/call/clipspace/project_no.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_project_no_h 9 | #define cglmc_project_no_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_unprojecti_no(vec3 pos, mat4 invMat, vec4 vp, vec3 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_project_no(vec3 pos, mat4 m, vec4 vp, vec3 dest); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* cglmc_project_no_h */ 28 | -------------------------------------------------------------------------------- /source/cglm/call/clipspace/project_zo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_project_zo_h 9 | #define cglmc_project_zo_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_unprojecti_zo(vec3 pos, mat4 invMat, vec4 vp, vec3 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_project_zo(vec3 pos, mat4 m, vec4 vp, vec3 dest); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* cglmc_project_zo_h */ 28 | -------------------------------------------------------------------------------- /source/cglm/call/clipspace/view_lh_no.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_view_lh_no_h 9 | #define cglmc_view_lh_no_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_lookat_lh_no(vec3 eye, vec3 center, vec3 up, mat4 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_look_lh_no(vec3 eye, vec3 dir, vec3 up, mat4 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_look_anyup_lh_no(vec3 eye, vec3 dir, mat4 dest); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* cglmc_view_lh_no_h */ 32 | -------------------------------------------------------------------------------- /source/cglm/call/clipspace/view_lh_zo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_view_lh_zo_h 9 | #define cglmc_view_lh_zo_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_lookat_lh_zo(vec3 eye, vec3 center, vec3 up, mat4 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_look_lh_zo(vec3 eye, vec3 dir, vec3 up, mat4 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_look_anyup_lh_zo(vec3 eye, vec3 dir, mat4 dest); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* cglmc_view_lh_zo_h */ 32 | -------------------------------------------------------------------------------- /source/cglm/call/clipspace/view_rh_no.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_view_rh_no_h 9 | #define cglmc_view_rh_no_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_lookat_rh_no(vec3 eye, vec3 center, vec3 up, mat4 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_look_rh_no(vec3 eye, vec3 dir, vec3 up, mat4 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_look_anyup_rh_no(vec3 eye, vec3 dir, mat4 dest); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* cglmc_view_rh_no_h */ 32 | -------------------------------------------------------------------------------- /source/cglm/call/clipspace/view_rh_zo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_view_rh_zo_h 9 | #define cglmc_view_rh_zo_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_lookat_rh_zo(vec3 eye, vec3 center, vec3 up, mat4 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_look_rh_zo(vec3 eye, vec3 dir, vec3 up, mat4 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_look_anyup_rh_zo(vec3 eye, vec3 dir, mat4 dest); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* cglmc_view_rh_zo_h */ 32 | -------------------------------------------------------------------------------- /source/cglm/call/curve.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_curve_h 9 | #define cglmc_curve_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | float 18 | glmc_smc(float s, mat4 m, vec4 c); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif /* cglmc_curve_h */ 24 | -------------------------------------------------------------------------------- /source/cglm/call/euler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_euler_h 9 | #define cglmc_euler_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_euler_angles(mat4 m, vec3 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_euler(vec3 angles, mat4 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_euler_xyz(vec3 angles, mat4 dest); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_euler_zyx(vec3 angles, mat4 dest); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_euler_zxy(vec3 angles, mat4 dest); 35 | 36 | CGLM_EXPORT 37 | void 38 | glmc_euler_xzy(vec3 angles, mat4 dest); 39 | 40 | CGLM_EXPORT 41 | void 42 | glmc_euler_yzx(vec3 angles, mat4 dest); 43 | 44 | CGLM_EXPORT 45 | void 46 | glmc_euler_yxz(vec3 angles, mat4 dest); 47 | 48 | CGLM_EXPORT 49 | void 50 | glmc_euler_by_order(vec3 angles, glm_euler_seq axis, mat4 dest); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif /* cglmc_euler_h */ 56 | -------------------------------------------------------------------------------- /source/cglm/call/frustum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_frustum_h 9 | #define cglmc_frustum_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_frustum_planes(mat4 m, vec4 dest[6]); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_frustum_corners(mat4 invMat, vec4 dest[8]); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_frustum_center(vec4 corners[8], vec4 dest); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_frustum_box(vec4 corners[8], mat4 m, vec3 box[2]); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_frustum_corners_at(vec4 corners[8], 35 | float splitDist, 36 | float farDist, 37 | vec4 planeCorners[4]); 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | #endif /* cglmc_frustum_h */ 42 | -------------------------------------------------------------------------------- /source/cglm/call/io.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_io_h 9 | #define cglmc_io_h 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include "../cglm.h" 16 | 17 | CGLM_EXPORT 18 | void 19 | glmc_mat4_print(mat4 matrix, 20 | FILE * __restrict ostream); 21 | 22 | CGLM_EXPORT 23 | void 24 | glmc_mat3_print(mat3 matrix, 25 | FILE * __restrict ostream); 26 | 27 | CGLM_EXPORT 28 | void 29 | glmc_vec4_print(vec4 vec, 30 | FILE * __restrict ostream); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_vec3_print(vec3 vec, 35 | FILE * __restrict ostream); 36 | 37 | CGLM_EXPORT 38 | void 39 | glmc_versor_print(versor vec, 40 | FILE * __restrict ostream); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif /* cglmc_io_h */ 46 | -------------------------------------------------------------------------------- /source/cglm/call/mat2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_mat2_h 9 | #define cglmc_mat2_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_mat2_copy(mat2 mat, mat2 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_mat2_identity(mat2 mat); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_mat2_identity_array(mat2 * __restrict mat, size_t count); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_mat2_zero(mat2 mat); 31 | 32 | CGLM_EXPORT 33 | void 34 | glmc_mat2_mul(mat2 m1, mat2 m2, mat2 dest); 35 | 36 | CGLM_EXPORT 37 | void 38 | glmc_mat2_transpose_to(mat2 m, mat2 dest); 39 | 40 | CGLM_EXPORT 41 | void 42 | glmc_mat2_transpose(mat2 m); 43 | 44 | CGLM_EXPORT 45 | void 46 | glmc_mat2_mulv(mat2 m, vec2 v, vec2 dest); 47 | 48 | CGLM_EXPORT 49 | float 50 | glmc_mat2_trace(mat2 m); 51 | 52 | CGLM_EXPORT 53 | void 54 | glmc_mat2_scale(mat2 m, float s); 55 | 56 | CGLM_EXPORT 57 | float 58 | glmc_mat2_det(mat2 mat); 59 | 60 | CGLM_EXPORT 61 | void 62 | glmc_mat2_inv(mat2 mat, mat2 dest); 63 | 64 | CGLM_EXPORT 65 | void 66 | glmc_mat2_swap_col(mat2 mat, int col1, int col2); 67 | 68 | CGLM_EXPORT 69 | void 70 | glmc_mat2_swap_row(mat2 mat, int row1, int row2); 71 | 72 | CGLM_EXPORT 73 | float 74 | glmc_mat2_rmc(vec2 r, mat2 m, vec2 c); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | #endif /* cglmc_mat2_h */ 80 | -------------------------------------------------------------------------------- /source/cglm/call/mat3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_mat3_h 9 | #define cglmc_mat3_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | /* DEPRECATED! use _copy, _ucopy versions */ 17 | #define glmc_mat3_dup(mat, dest) glmc_mat3_copy(mat, dest) 18 | 19 | CGLM_EXPORT 20 | void 21 | glmc_mat3_copy(mat3 mat, mat3 dest); 22 | 23 | CGLM_EXPORT 24 | void 25 | glmc_mat3_identity(mat3 mat); 26 | 27 | CGLM_EXPORT 28 | void 29 | glmc_mat3_zero(mat3 mat); 30 | 31 | CGLM_EXPORT 32 | void 33 | glmc_mat3_identity_array(mat3 * __restrict mat, size_t count); 34 | 35 | CGLM_EXPORT 36 | void 37 | glmc_mat3_mul(mat3 m1, mat3 m2, mat3 dest); 38 | 39 | CGLM_EXPORT 40 | void 41 | glmc_mat3_transpose_to(mat3 m, mat3 dest); 42 | 43 | CGLM_EXPORT 44 | void 45 | glmc_mat3_transpose(mat3 m); 46 | 47 | CGLM_EXPORT 48 | void 49 | glmc_mat3_mulv(mat3 m, vec3 v, vec3 dest); 50 | 51 | CGLM_EXPORT 52 | float 53 | glmc_mat3_trace(mat3 m); 54 | 55 | CGLM_EXPORT 56 | void 57 | glmc_mat3_quat(mat3 m, versor dest); 58 | 59 | CGLM_EXPORT 60 | void 61 | glmc_mat3_scale(mat3 m, float s); 62 | 63 | CGLM_EXPORT 64 | float 65 | glmc_mat3_det(mat3 mat); 66 | 67 | CGLM_EXPORT 68 | void 69 | glmc_mat3_inv(mat3 mat, mat3 dest); 70 | 71 | CGLM_EXPORT 72 | void 73 | glmc_mat3_swap_col(mat3 mat, int col1, int col2); 74 | 75 | CGLM_EXPORT 76 | void 77 | glmc_mat3_swap_row(mat3 mat, int row1, int row2); 78 | 79 | CGLM_EXPORT 80 | float 81 | glmc_mat3_rmc(vec3 r, mat3 m, vec3 c); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | #endif /* cglmc_mat3_h */ 87 | -------------------------------------------------------------------------------- /source/cglm/call/plane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_plane_h 9 | #define cglmc_plane_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_plane_normalize(vec4 plane); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif /* cglmc_plane_h */ 24 | -------------------------------------------------------------------------------- /source/cglm/call/project.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_project_h 9 | #define cglmc_project_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | void 18 | glmc_unprojecti(vec3 pos, mat4 invMat, vec4 vp, vec3 dest); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_unproject(vec3 pos, mat4 m, vec4 vp, vec3 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_project(vec3 pos, mat4 m, vec4 vp, vec3 dest); 27 | 28 | CGLM_EXPORT 29 | void 30 | glmc_pickmatrix(vec2 center, vec2 size, vec4 vp, mat4 dest); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | #endif /* cglmc_project_h */ 36 | 37 | 38 | -------------------------------------------------------------------------------- /source/cglm/call/ray.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_ray_h 9 | #define cglmc_ray_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | #include "../cglm.h" 14 | 15 | CGLM_EXPORT 16 | bool 17 | glmc_ray_triangle(vec3 origin, 18 | vec3 direction, 19 | vec3 v0, 20 | vec3 v1, 21 | vec3 v2, 22 | float *d); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* cglmc_ray_h */ 28 | -------------------------------------------------------------------------------- /source/cglm/call/sphere.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglmc_sphere_h 9 | #define cglmc_sphere_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "../cglm.h" 15 | 16 | CGLM_EXPORT 17 | float 18 | glmc_sphere_radii(vec4 s); 19 | 20 | CGLM_EXPORT 21 | void 22 | glmc_sphere_transform(vec4 s, mat4 m, vec4 dest); 23 | 24 | CGLM_EXPORT 25 | void 26 | glmc_sphere_merge(vec4 s1, vec4 s2, vec4 dest); 27 | 28 | CGLM_EXPORT 29 | bool 30 | glmc_sphere_sphere(vec4 s1, vec4 s2); 31 | 32 | CGLM_EXPORT 33 | bool 34 | glmc_sphere_point(vec4 s, vec3 point); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif /* cglmc_sphere_h */ 40 | -------------------------------------------------------------------------------- /source/cglm/cglm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_h 9 | #define cglm_h 10 | 11 | #include "common.h" 12 | #include "vec2.h" 13 | #include "vec3.h" 14 | #include "vec4.h" 15 | #include "mat4.h" 16 | #include "mat3.h" 17 | #include "mat2.h" 18 | #include "affine.h" 19 | #include "cam.h" 20 | #include "frustum.h" 21 | #include "quat.h" 22 | #include "euler.h" 23 | #include "plane.h" 24 | #include "box.h" 25 | #include "color.h" 26 | #include "util.h" 27 | #include "io.h" 28 | #include "project.h" 29 | #include "sphere.h" 30 | #include "ease.h" 31 | #include "curve.h" 32 | #include "bezier.h" 33 | #include "ray.h" 34 | #include "affine2d.h" 35 | 36 | #endif /* cglm_h */ 37 | -------------------------------------------------------------------------------- /source/cglm/clipspace/persp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | /* 9 | Functions: 10 | CGLM_INLINE void glm_persp_decomp_far(mat4 proj, float *farZ) 11 | CGLM_INLINE float glm_persp_fovy(mat4 proj) 12 | CGLM_INLINE float glm_persp_aspect(mat4 proj) 13 | CGLM_INLINE void glm_persp_sizes(mat4 proj, float fovy, vec4 dest) 14 | */ 15 | 16 | #ifndef cglm_persp_h 17 | #define cglm_persp_h 18 | 19 | #include "../common.h" 20 | #include "../plane.h" 21 | #include "../mat4.h" 22 | 23 | /*! 24 | * @brief returns field of view angle along the Y-axis (in radians) 25 | * 26 | * if you need to degrees, use glm_deg to convert it or use this: 27 | * fovy_deg = glm_deg(glm_persp_fovy(projMatrix)) 28 | * 29 | * @param[in] proj perspective projection matrix 30 | */ 31 | CGLM_INLINE 32 | float 33 | glm_persp_fovy(mat4 proj) { 34 | return 2.0f * atanf(1.0f / proj[1][1]); 35 | } 36 | 37 | /*! 38 | * @brief returns aspect ratio of perspective projection 39 | * 40 | * @param[in] proj perspective projection matrix 41 | */ 42 | CGLM_INLINE 43 | float 44 | glm_persp_aspect(mat4 proj) { 45 | return proj[1][1] / proj[0][0]; 46 | } 47 | 48 | #endif /* cglm_persp_h */ 49 | -------------------------------------------------------------------------------- /source/cglm/color.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_color_h 9 | #define cglm_color_h 10 | 11 | #include "common.h" 12 | #include "vec3.h" 13 | 14 | /*! 15 | * @brief averages the color channels into one value 16 | * 17 | * @param[in] rgb RGB color 18 | */ 19 | CGLM_INLINE 20 | float 21 | glm_luminance(vec3 rgb) { 22 | vec3 l = {0.212671f, 0.715160f, 0.072169f}; 23 | return glm_dot(rgb, l); 24 | } 25 | 26 | #endif /* cglm_color_h */ 27 | -------------------------------------------------------------------------------- /source/cglm/curve.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_curve_h 9 | #define cglm_curve_h 10 | 11 | #include "common.h" 12 | #include "vec4.h" 13 | #include "mat4.h" 14 | 15 | /*! 16 | * @brief helper function to calculate S*M*C multiplication for curves 17 | * 18 | * This function does not encourage you to use SMC, 19 | * instead it is a helper if you use SMC. 20 | * 21 | * if you want to specify S as vector then use more generic glm_mat4_rmc() func. 22 | * 23 | * Example usage: 24 | * B(s) = glm_smc(s, GLM_BEZIER_MAT, (vec4){p0, c0, c1, p1}) 25 | * 26 | * @param[in] s parameter between 0 and 1 (this will be [s3, s2, s, 1]) 27 | * @param[in] m basis matrix 28 | * @param[in] c position/control vector 29 | * 30 | * @return B(s) 31 | */ 32 | CGLM_INLINE 33 | float 34 | glm_smc(float s, mat4 m, vec4 c) { 35 | vec4 vs; 36 | glm_vec4_cubic(s, vs); 37 | return glm_mat4_rmc(vs, m, c); 38 | } 39 | 40 | #endif /* cglm_curve_h */ 41 | -------------------------------------------------------------------------------- /source/cglm/plane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_plane_h 9 | #define cglm_plane_h 10 | 11 | #include "common.h" 12 | #include "vec3.h" 13 | #include "vec4.h" 14 | 15 | /* 16 | Plane equation: Ax + By + Cz + D = 0; 17 | 18 | It stored in vec4 as [A, B, C, D]. (A, B, C) is normal and D is distance 19 | */ 20 | 21 | /* 22 | Functions: 23 | CGLM_INLINE void glm_plane_normalize(vec4 plane); 24 | */ 25 | 26 | /*! 27 | * @brief normalizes a plane 28 | * 29 | * @param[in, out] plane plane to normalize 30 | */ 31 | CGLM_INLINE 32 | void 33 | glm_plane_normalize(vec4 plane) { 34 | float norm; 35 | 36 | if ((norm = glm_vec3_norm(plane)) == 0.0f) { 37 | glm_vec4_zero(plane); 38 | return; 39 | } 40 | 41 | glm_vec4_scale(plane, 1.0f / norm, plane); 42 | } 43 | 44 | #endif /* cglm_plane_h */ 45 | -------------------------------------------------------------------------------- /source/cglm/simd/intrin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_intrin_h 9 | #define cglm_intrin_h 10 | 11 | #if defined( _MSC_VER ) 12 | # if (defined(_M_AMD64) || defined(_M_X64)) || _M_IX86_FP == 2 13 | # ifndef __SSE2__ 14 | # define __SSE2__ 15 | # endif 16 | # elif _M_IX86_FP == 1 17 | # ifndef __SSE__ 18 | # define __SSE__ 19 | # endif 20 | # endif 21 | /* do not use alignment for older visual studio versions */ 22 | # if _MSC_VER < 1913 /* Visual Studio 2017 version 15.6 */ 23 | # define CGLM_ALL_UNALIGNED 24 | # endif 25 | #endif 26 | 27 | #if defined( __SSE__ ) || defined( __SSE2__ ) 28 | # include 29 | # include 30 | # define CGLM_SSE_FP 1 31 | # ifndef CGLM_SIMD_x86 32 | # define CGLM_SIMD_x86 33 | # endif 34 | #endif 35 | 36 | #if defined(__SSE3__) 37 | # include 38 | # ifndef CGLM_SIMD_x86 39 | # define CGLM_SIMD_x86 40 | # endif 41 | #endif 42 | 43 | #if defined(__SSE4_1__) 44 | # include 45 | # ifndef CGLM_SIMD_x86 46 | # define CGLM_SIMD_x86 47 | # endif 48 | #endif 49 | 50 | #if defined(__SSE4_2__) 51 | # include 52 | # ifndef CGLM_SIMD_x86 53 | # define CGLM_SIMD_x86 54 | # endif 55 | #endif 56 | 57 | #ifdef __AVX__ 58 | # include 59 | # define CGLM_AVX_FP 1 60 | # ifndef CGLM_SIMD_x86 61 | # define CGLM_SIMD_x86 62 | # endif 63 | #endif 64 | 65 | /* ARM Neon */ 66 | #if defined(__ARM_NEON) 67 | # include 68 | # if defined(__ARM_NEON_FP) 69 | # define CGLM_NEON_FP 1 70 | # ifndef CGLM_SIMD_ARM 71 | # define CGLM_SIMD_ARM 72 | # endif 73 | # endif 74 | #endif 75 | 76 | #if defined(CGLM_SIMD_x86) || defined(CGLM_NEON_FP) 77 | # ifndef CGLM_SIMD 78 | # define CGLM_SIMD 79 | # endif 80 | #endif 81 | 82 | #if defined(CGLM_SIMD_x86) 83 | # include "x86.h" 84 | #endif 85 | 86 | #if defined(CGLM_SIMD_ARM) 87 | # include "arm.h" 88 | #endif 89 | 90 | #endif /* cglm_intrin_h */ 91 | -------------------------------------------------------------------------------- /source/cglm/simd/neon/mat2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_mat2_neon_h 9 | #define cglm_mat2_neon_h 10 | #if defined(__ARM_NEON_FP) 11 | 12 | #include "../../common.h" 13 | #include "../intrin.h" 14 | 15 | CGLM_INLINE 16 | void 17 | glm_mat2_mul_neon(mat2 m1, mat2 m2, mat2 dest) { 18 | float32x4x2_t a1; 19 | glmm_128 x0, x1, x2; 20 | float32x2_t dc, ba; 21 | 22 | x1 = glmm_load(m1[0]); /* d c b a */ 23 | x2 = glmm_load(m2[0]); /* h g f e */ 24 | 25 | dc = vget_high_f32(x1); 26 | ba = vget_low_f32(x1); 27 | 28 | /* g g e e, h h f f */ 29 | a1 = vtrnq_f32(x2, x2); 30 | 31 | /* 32 | dest[0][0] = a * e + c * f; 33 | dest[0][1] = b * e + d * f; 34 | dest[1][0] = a * g + c * h; 35 | dest[1][1] = b * g + d * h; 36 | */ 37 | x0 = glmm_fmadd(vcombine_f32(ba, ba), a1.val[0], 38 | vmulq_f32(vcombine_f32(dc, dc), a1.val[1])); 39 | 40 | glmm_store(dest[0], x0); 41 | } 42 | 43 | #endif 44 | #endif /* cglm_mat2_neon_h */ 45 | -------------------------------------------------------------------------------- /source/cglm/simd/neon/quat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_quat_neon_h 9 | #define cglm_quat_neon_h 10 | #if defined(__ARM_NEON_FP) 11 | 12 | #include "../../common.h" 13 | #include "../intrin.h" 14 | 15 | CGLM_INLINE 16 | void 17 | glm_quat_mul_neon(versor p, versor q, versor dest) { 18 | /* 19 | + (a1 b2 + b1 a2 + c1 d2 − d1 c2)i 20 | + (a1 c2 − b1 d2 + c1 a2 + d1 b2)j 21 | + (a1 d2 + b1 c2 − c1 b2 + d1 a2)k 22 | a1 a2 − b1 b2 − c1 c2 − d1 d2 23 | */ 24 | 25 | glmm_128 xp, xq, xqr, r, x, y, z, s2, s3; 26 | glmm_128 s1 = {-0.f, 0.f, 0.f, -0.f}; 27 | float32x2_t qh, ql; 28 | 29 | xp = glmm_load(p); /* 3 2 1 0 */ 30 | xq = glmm_load(q); 31 | 32 | r = vmulq_f32(glmm_splat_w(xp), xq); 33 | x = glmm_splat_x(xp); 34 | y = glmm_splat_y(xp); 35 | z = glmm_splat_z(xp); 36 | 37 | ql = vget_high_f32(s1); 38 | s3 = vcombine_f32(ql, ql); 39 | s2 = vzipq_f32(s3, s3).val[0]; 40 | 41 | xqr = vrev64q_f32(xq); 42 | qh = vget_high_f32(xqr); 43 | ql = vget_low_f32(xqr); 44 | 45 | r = glmm_fmadd(glmm_xor(x, s3), vcombine_f32(qh, ql), r); 46 | 47 | r = glmm_fmadd(glmm_xor(y, s2), vcombine_f32(vget_high_f32(xq), 48 | vget_low_f32(xq)), r); 49 | 50 | r = glmm_fmadd(glmm_xor(z, s1), vcombine_f32(ql, qh), r); 51 | 52 | glmm_store(dest, r); 53 | } 54 | 55 | #endif 56 | #endif /* cglm_quat_neon_h */ 57 | -------------------------------------------------------------------------------- /source/cglm/simd/sse2/mat2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_mat2_sse_h 9 | #define cglm_mat2_sse_h 10 | #if defined( __SSE__ ) || defined( __SSE2__ ) 11 | 12 | #include "../../common.h" 13 | #include "../intrin.h" 14 | 15 | CGLM_INLINE 16 | void 17 | glm_mat2_mul_sse2(mat2 m1, mat2 m2, mat2 dest) { 18 | __m128 x0, x1, x2, x3, x4; 19 | 20 | x1 = glmm_load(m1[0]); /* d c b a */ 21 | x2 = glmm_load(m2[0]); /* h g f e */ 22 | 23 | x3 = glmm_shuff1(x2, 2, 2, 0, 0); 24 | x4 = glmm_shuff1(x2, 3, 3, 1, 1); 25 | x0 = _mm_movelh_ps(x1, x1); 26 | x2 = _mm_movehl_ps(x1, x1); 27 | 28 | /* 29 | dest[0][0] = a * e + c * f; 30 | dest[0][1] = b * e + d * f; 31 | dest[1][0] = a * g + c * h; 32 | dest[1][1] = b * g + d * h; 33 | */ 34 | x0 = glmm_fmadd(x0, x3, _mm_mul_ps(x2, x4)); 35 | 36 | glmm_store(dest[0], x0); 37 | } 38 | 39 | CGLM_INLINE 40 | void 41 | glm_mat2_transp_sse2(mat2 m, mat2 dest) { 42 | /* d c b a */ 43 | /* d b c a */ 44 | glmm_store(dest[0], glmm_shuff1(glmm_load(m[0]), 3, 1, 2, 0)); 45 | } 46 | 47 | #endif 48 | #endif /* cglm_mat2_sse_h */ 49 | -------------------------------------------------------------------------------- /source/cglm/simd/sse2/quat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_quat_simd_h 9 | #define cglm_quat_simd_h 10 | #if defined( __SSE__ ) || defined( __SSE2__ ) 11 | 12 | #include "../../common.h" 13 | #include "../intrin.h" 14 | 15 | CGLM_INLINE 16 | void 17 | glm_quat_mul_sse2(versor p, versor q, versor dest) { 18 | /* 19 | + (a1 b2 + b1 a2 + c1 d2 − d1 c2)i 20 | + (a1 c2 − b1 d2 + c1 a2 + d1 b2)j 21 | + (a1 d2 + b1 c2 − c1 b2 + d1 a2)k 22 | a1 a2 − b1 b2 − c1 c2 − d1 d2 23 | */ 24 | 25 | __m128 xp, xq, x1, x2, x3, r, x, y, z; 26 | 27 | xp = glmm_load(p); /* 3 2 1 0 */ 28 | xq = glmm_load(q); 29 | x1 = _mm_set_ps(-0.f, 0.f, -0.f, 0.f); /* TODO: _mm_set1_ss() + shuff ? */ 30 | r = _mm_mul_ps(glmm_splat_w(xp), xq); 31 | 32 | x2 = _mm_unpackhi_ps(x1, x1); 33 | x3 = glmm_shuff1(x1, 3, 2, 0, 1); 34 | x = glmm_splat_x(xp); 35 | y = glmm_splat_y(xp); 36 | z = glmm_splat_z(xp); 37 | 38 | x = _mm_xor_ps(x, x1); 39 | y = _mm_xor_ps(y, x2); 40 | z = _mm_xor_ps(z, x3); 41 | 42 | x1 = glmm_shuff1(xq, 0, 1, 2, 3); 43 | x2 = glmm_shuff1(xq, 1, 0, 3, 2); 44 | x3 = glmm_shuff1(xq, 2, 3, 0, 1); 45 | 46 | r = glmm_fmadd(x, x1, r); 47 | r = glmm_fmadd(y, x2, r); 48 | r = glmm_fmadd(z, x3, r); 49 | 50 | glmm_store(dest, r); 51 | } 52 | 53 | #endif 54 | #endif /* cglm_quat_simd_h */ 55 | -------------------------------------------------------------------------------- /source/cglm/struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_structs_h 9 | #define cglm_structs_h 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | #include "cglm.h" 15 | #include "types-struct.h" 16 | #include "struct/vec2.h" 17 | #include "struct/vec3.h" 18 | #include "struct/vec4.h" 19 | #include "struct/mat2.h" 20 | #include "struct/mat3.h" 21 | #include "struct/mat4.h" 22 | #include "struct/affine.h" 23 | #include "struct/frustum.h" 24 | #include "struct/plane.h" 25 | #include "struct/box.h" 26 | #include "struct/color.h" 27 | #include "struct/io.h" 28 | #include "struct/cam.h" 29 | #include "struct/quat.h" 30 | #include "struct/euler.h" 31 | #include "struct/project.h" 32 | #include "struct/sphere.h" 33 | #include "struct/curve.h" 34 | #include "struct/affine2d.h" 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif /* cglm_structs_h */ 40 | -------------------------------------------------------------------------------- /source/cglm/struct/color.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglms_colors_h 9 | #define cglms_colors_h 10 | 11 | #include "../common.h" 12 | #include "../types-struct.h" 13 | #include "../color.h" 14 | #include "vec3.h" 15 | 16 | /*! 17 | * @brief averages the color channels into one value 18 | * 19 | * @param[in] rgb RGB color 20 | */ 21 | CGLM_INLINE 22 | float 23 | glms_luminance(vec3s rgb) { 24 | return glm_luminance(rgb.raw); 25 | } 26 | 27 | #endif /* cglms_colors_h */ 28 | -------------------------------------------------------------------------------- /source/cglm/struct/curve.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglms_curves_h 9 | #define cglms_curves_h 10 | 11 | #include "../common.h" 12 | #include "../types-struct.h" 13 | #include "../curve.h" 14 | #include "vec4.h" 15 | #include "mat4.h" 16 | 17 | /*! 18 | * @brief helper function to calculate S*M*C multiplication for curves 19 | * 20 | * This function does not encourage you to use SMC, 21 | * instead it is a helper if you use SMC. 22 | * 23 | * if you want to specify S as vector then use more generic glm_mat4_rmc() func. 24 | * 25 | * Example usage: 26 | * B(s) = glm_smc(s, GLM_BEZIER_MAT, (vec4){p0, c0, c1, p1}) 27 | * 28 | * @param[in] s parameter between 0 and 1 (this will be [s3, s2, s, 1]) 29 | * @param[in] m basis matrix 30 | * @param[in] c position/control vector 31 | * 32 | * @return B(s) 33 | */ 34 | CGLM_INLINE 35 | float 36 | glms_smc(float s, mat4s m, vec4s c) { 37 | return glm_smc(s, m.raw, c.raw); 38 | } 39 | 40 | #endif /* cglms_curves_h */ 41 | -------------------------------------------------------------------------------- /source/cglm/struct/plane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglms_planes_h 9 | #define cglms_planes_h 10 | 11 | #include "../common.h" 12 | #include "../types-struct.h" 13 | #include "../plane.h" 14 | #include "vec4.h" 15 | 16 | /* 17 | Plane equation: Ax + By + Cz + D = 0; 18 | 19 | It stored in vec4 as [A, B, C, D]. (A, B, C) is normal and D is distance 20 | */ 21 | 22 | /* 23 | Functions: 24 | CGLM_INLINE vec4s glms_plane_normalize(vec4s plane); 25 | */ 26 | 27 | /*! 28 | * @brief normalizes a plane 29 | * 30 | * @param[in] plane plane to normalize 31 | * @returns normalized plane 32 | */ 33 | CGLM_INLINE 34 | vec4s 35 | glms_plane_normalize(vec4s plane) { 36 | glm_plane_normalize(plane.raw); 37 | return plane; 38 | } 39 | 40 | #endif /* cglms_planes_h */ 41 | -------------------------------------------------------------------------------- /source/cglm/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Recep Aslantas. 3 | * 4 | * MIT License (MIT), http://opensource.org/licenses/MIT 5 | * Full license can be found in the LICENSE file 6 | */ 7 | 8 | #ifndef cglm_version_h 9 | #define cglm_version_h 10 | 11 | #define CGLM_VERSION_MAJOR 0 12 | #define CGLM_VERSION_MINOR 8 13 | #define CGLM_VERSION_PATCH 4 14 | 15 | #endif /* cglm_version_h */ 16 | -------------------------------------------------------------------------------- /source/hydra/hydra_application.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4 | // Hydra Application v0.01 ///////////////////////////////////////////////////// 5 | // 6 | // Source code : https://www.github.com/jorenjoestar/ 7 | // 8 | // Created : 2019/09/24, 21.50 9 | // 10 | // 11 | // Revision history ////////////////////// 12 | // 13 | // 0.01 (2019/09/24) initial implementation. 14 | // 15 | // Documentation ///////////////////////// 16 | // 17 | // 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "imgui.h" 24 | #include "imgui_impl_sdl.h" 25 | 26 | #include "hydra_graphics.h" 27 | #include "hydra_imgui.h" 28 | 29 | namespace hydra { 30 | 31 | struct Application { 32 | 33 | void init(); 34 | void terminate(); 35 | 36 | void main_loop(); 37 | 38 | virtual void app_init() = 0; 39 | virtual void app_terminate() = 0; 40 | virtual void app_render( hydra::graphics::CommandBuffer* commands ) = 0; 41 | virtual void app_resize( uint16_t width, uint16_t height ) = 0; 42 | 43 | struct SDL_Window* window = nullptr; 44 | void* gl_context; 45 | 46 | hydra::graphics::Device gfx_device; 47 | 48 | }; // struct Application 49 | 50 | } // namespace hydra 51 | -------------------------------------------------------------------------------- /source/hydra/hydra_imgui.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4 | // Hydra ImGUI - v0.01 5 | // 6 | // ImGUI wrapper using Hydra Graphics. 7 | // 8 | // Source code : https://www.github.com/jorenjoestar/ 9 | // 10 | // Created : 2019/09/16, 19.23 11 | // 12 | 13 | #include "imgui.h" 14 | #include "hydra_graphics.h" 15 | 16 | bool hydra_Imgui_Init( hydra::graphics::Device& graphics_device ); 17 | void hydra_Imgui_Shutdown( hydra::graphics::Device& graphics_device ); 18 | void hydra_Imgui_NewFrame(); 19 | 20 | void hydra_imgui_collect_draw_data( ImDrawData* draw_data, hydra::graphics::Device& gfx_device, hydra::graphics::CommandBuffer& commands ); -------------------------------------------------------------------------------- /source/hydra_next/project/HydraNext.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31129.286 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HydraNext", "HydraNext.vcxproj", "{03706EA9-CBD7-4AC3-B78E-59BDD2444D76}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {03706EA9-CBD7-4AC3-B78E-59BDD2444D76}.Debug|x64.ActiveCfg = Debug|x64 15 | {03706EA9-CBD7-4AC3-B78E-59BDD2444D76}.Debug|x64.Build.0 = Debug|x64 16 | {03706EA9-CBD7-4AC3-B78E-59BDD2444D76}.Release|x64.ActiveCfg = Release|x64 17 | {03706EA9-CBD7-4AC3-B78E-59BDD2444D76}.Release|x64.Build.0 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {9409C7C2-BC59-493F-AC20-78F5E51E4ADD} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /source/hydra_next/project/hydra.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(SolutionDir)../../bin/ 7 | $(ProjectName)_$(Configuration) 8 | 9 | 10 | 11 | ../../source/external/;../../source/;../../source/hydra/source/;$(VULKAN_SDK)\include;$(LIB_PATH)\SDL2-2.0.12\include;%(AdditionalIncludeDirectories) 12 | true 13 | HYDRA_IMGUI;_CRT_SECURE_NO_WARNINGS;HYDRA_GFX_SDL;HYDRA_VULKAN;%(PreprocessorDefinitions) 14 | false 15 | 16 | 17 | $(VULKAN_SDK)\lib;$(LIB_PATH)\SDL2-2.0.12\lib\x64 18 | sdl2.lib;vulkan-1.lib;%(AdditionalDependencies) 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /source/hydra_next/source/application/application.cpp: -------------------------------------------------------------------------------- 1 | #include "application.hpp" 2 | 3 | namespace hydra { 4 | 5 | void Application::run( const ApplicationConfiguration& configuration ) { 6 | 7 | create( configuration ); 8 | main_loop(); 9 | destroy(); 10 | } 11 | 12 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/application/application.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/primitive_types.hpp" 4 | 5 | namespace hydra { 6 | 7 | struct ServiceManager; 8 | 9 | struct ApplicationConfiguration { 10 | 11 | u32 width; 12 | u32 height; 13 | 14 | cstring name = nullptr; 15 | 16 | bool init_base_services = false; 17 | 18 | ApplicationConfiguration& w( u32 value ) { width = value; return *this; } 19 | ApplicationConfiguration& h( u32 value ) { height = value; return *this; } 20 | ApplicationConfiguration& name_( cstring value ) { name = value; return *this; } 21 | 22 | }; // struct ApplicationConfiguration 23 | 24 | struct Application { 25 | // 26 | virtual void create( const ApplicationConfiguration& configuration ) {} 27 | virtual void destroy() {} 28 | virtual bool main_loop() { return false; } 29 | 30 | // Fixed update. Can be called more than once compared to rendering. 31 | virtual void fixed_update( f32 delta ) {} 32 | // Variable time update. Called only once per frame. 33 | virtual void variable_update( f32 delta ) {} 34 | // Rendering with optional interpolation factor. 35 | virtual void render( f32 interpolation ) {} 36 | // Per frame begin/end. 37 | virtual void frame_begin() {} 38 | virtual void frame_end() {} 39 | 40 | void run( const ApplicationConfiguration& configuration ); 41 | 42 | ServiceManager* service_manager = nullptr; 43 | 44 | }; // struct Application 45 | 46 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/application/hydra_application.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4 | // Hydra Application v0.22 5 | // 6 | // Source code : https://www.github.com/jorenjoestar/ 7 | // 8 | // Created : 2019/09/24, 21.50 9 | // 10 | // Files ///////////////////////////////// 11 | // 12 | // application.hpp/.cpp, game_application.hpp/.cpp, window.hpp/.cpp 13 | // 14 | // Revision history ////////////////////// 15 | // 16 | // 0.22 (2021/10/21): + Moved GameApplication to use Renderer instead of GPU. 17 | // 0.21 (2021/09/28): + Added game application class, with variable and fixed updates and rendering interpolation. 18 | // 0.20 (2021/06/10): + Separated into different files. + Added Window class. 19 | // 0.19 (2021/01/11): + Added option to disable camera input. 20 | // 0.18 (2020/12/29): + Fixed resize callback happening only when size is different from before. 21 | // 0.17 (2020/12/28): + Added app_reload method. + Clearer names for app load/unload. 22 | // 0.16 (2020/12/27): + Fixed camera movement taking only one key at the time. 23 | // 0.15 (2020/12/18): + Added reload resources callback. 24 | // 0.14 (2020/12/16): + Added camera input and camera movement classes. 25 | // 0.13 (2020/09/15): + Fixed passing of CommandBuffer to execution context. 26 | // 0.12 (2020/04/12): + Added renderer to application struct. + Added configuration to enable renderer. 27 | // 0.11 (2020/04/05): + Added optional macros to remove strict dependency to enkits and optick. 28 | // 0.10 (2020/03/09): + Major overhaul. Added different type of apps: command line, sdl+hydra 29 | // 0.01 (2019/09/24): + Initial implementation. 30 | // 31 | // API Documentation ///////////////////////// 32 | // 33 | // 34 | // Customization ///////////////////////// 35 | // 36 | // HYDRA_CMD_APP 37 | // Creates a command line application. 38 | // 39 | // HYDRA_SDL_APP 40 | // Creates a barebone SDL + OpenGL application. 41 | // 42 | // HYDRA_IMGUI_APP 43 | // Adds support for ImGui. 44 | // 45 | // HYDRA_APPLICATION_CAMERA 46 | // Add support for a simple camera system. 47 | 48 | -------------------------------------------------------------------------------- /source/hydra_next/source/application/input.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/source/hydra_next/source/application/input.cpp -------------------------------------------------------------------------------- /source/hydra_next/source/application/input.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace hydra { 4 | 5 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/application/window.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/service.hpp" 4 | #include "kernel/array.hpp" 5 | 6 | namespace hydra { 7 | 8 | struct WindowConfiguration { 9 | 10 | u32 width; 11 | u32 height; 12 | 13 | cstring name; 14 | 15 | Allocator* allocator; 16 | 17 | }; // struct WindowConfiguration 18 | 19 | typedef void ( *OsMessagesCallback )( void* os_event, void* user_data ); 20 | 21 | struct Window : public Service { 22 | 23 | void init( void* configuration ) override; 24 | void shutdown() override; 25 | 26 | void handle_os_messages(); 27 | 28 | void set_fullscreen( bool value ); 29 | 30 | void register_os_messages_callback( OsMessagesCallback callback, void* user_data ); 31 | void unregister_os_messages_callback( OsMessagesCallback callback ); 32 | 33 | void center_mouse( bool dragging ); 34 | 35 | Array os_messages_callbacks; 36 | Array os_messages_callbacks_data; 37 | 38 | void* platform_handle = nullptr; 39 | bool requested_exit = false; 40 | bool resized = false; 41 | bool minimized = false; 42 | u32 width = 0; 43 | u32 height = 0; 44 | f32 display_refresh = 1.0f / 60.0f; 45 | 46 | static constexpr cstring k_name = "hydra_window_service"; 47 | 48 | }; // struct Window 49 | 50 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/graphics/debug_renderer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "graphics/renderer.hpp" 4 | 5 | namespace hydra { 6 | namespace gfx { 7 | 8 | struct Camera; 9 | 10 | // 11 | // 12 | struct DebugRenderer { 13 | 14 | void init( hydra::gfx::Renderer* renderer ); 15 | void shutdown( hydra::gfx::Renderer* renderer ); 16 | 17 | void reload( hydra::gfx::Renderer* renderer, hydra::ResourceManager* resource_manager ); 18 | 19 | void render( hydra::gfx::Renderer& renderer, hydra::gfx::CommandBuffer* commands, hydra::gfx::Camera& camera ); 20 | 21 | void line( const vec3s& from, const vec3s& to, hydra::Color color ); 22 | void line( const vec3s& from, const vec3s& to, hydra::Color color0, hydra::Color color1 ); 23 | 24 | void box( const vec3s& min, const vec3s max, hydra::Color color ); 25 | 26 | hydra::gfx::Material* material; 27 | 28 | hydra::gfx::Buffer* lines_cb; 29 | hydra::gfx::Buffer* lines_vb; 30 | hydra::gfx::Buffer* lines_vb_2d; 31 | 32 | u32 current_line; 33 | u32 current_line_2d; 34 | 35 | }; // struct DebugRenderer 36 | 37 | } // namespace gfx 38 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/graphics/gpu_enum_vulkan.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | -------------------------------------------------------------------------------- /source/hydra_next/source/graphics/gpu_profiler.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/memory.hpp" 4 | #include "graphics/gpu_device.hpp" 5 | 6 | namespace hydra { 7 | namespace gfx { 8 | 9 | // GPUProfiler ////////////////////////////////////////////////////// 10 | 11 | struct GPUProfiler { 12 | 13 | void init( Allocator* allocator, u32 max_frames ); 14 | void shutdown(); 15 | 16 | void update( Device& gpu ); 17 | 18 | void imgui_draw(); 19 | 20 | Allocator* allocator; 21 | GPUTimestamp* timestamps; 22 | u16* per_frame_active; 23 | 24 | u32 max_frames; 25 | u32 current_frame; 26 | 27 | f32 max_time; 28 | f32 min_time; 29 | f32 average_time; 30 | 31 | f32 max_duration; 32 | bool paused; 33 | 34 | }; // struct GPUProfiler 35 | 36 | } // namespace hydra 37 | } // namespace gfx -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/assert.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/source/hydra_next/source/kernel/assert.cpp -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/assert.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/log.hpp" 4 | 5 | namespace hydra { 6 | 7 | #define hy_assert( condition ) if (!(condition)) { hprint(HY_FILELINE("FALSE\n")); HY_DEBUG_BREAK } 8 | #define hy_assertm( condition, message, ... ) if (!(condition)) { hprint(HY_FILELINE(HY_CONCAT(message, "\n")), __VA_ARGS__); HY_DEBUG_BREAK } 9 | 10 | } // namespace hydra 11 | -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/bit.cpp: -------------------------------------------------------------------------------- 1 | #include "bit.hpp" 2 | 3 | #include "log.hpp" 4 | 5 | #include 6 | #include 7 | 8 | namespace hydra { 9 | 10 | 11 | u32 trailing_zeros_u32( u32 x ) { 12 | /*unsigned long result = 0; // NOLINT(runtime/int) 13 | _BitScanForward( &result, x ); 14 | return result;*/ 15 | return _tzcnt_u32( x ); 16 | } 17 | 18 | u32 leading_zeroes_u32( u32 x ) { 19 | /*unsigned long result = 0; // NOLINT(runtime/int) 20 | _BitScanReverse( &result, x ); 21 | return result;*/ 22 | return __lzcnt( x ); 23 | } 24 | 25 | u32 leading_zeroes_u32_msvc( u32 x ) { 26 | unsigned long result = 0; // NOLINT(runtime/int) 27 | if ( _BitScanReverse( &result, x ) ) { 28 | return 31 - result; 29 | } 30 | return 32; 31 | } 32 | 33 | u64 trailing_zeros_u64( u64 x ) { 34 | return _tzcnt_u64( x ); 35 | } 36 | 37 | u32 round_up_to_power_of_2( u32 v ) { 38 | 39 | u32 nv = 1 << ( 32 - hydra::leading_zeroes_u32( v ) ); 40 | #if 0 41 | v--; 42 | v |= v >> 1; 43 | v |= v >> 2; 44 | v |= v >> 4; 45 | v |= v >> 8; 46 | v |= v >> 16; 47 | v++; 48 | #endif 49 | return nv; 50 | } 51 | void print_binary( u64 n ) { 52 | 53 | hprint( "0b" ); 54 | for ( u32 i = 0; i < 64; ++i ) { 55 | u64 bit = (n >> ( 64 - i - 1 )) & 0x1; 56 | hprint( "%llu", bit ); 57 | } 58 | hprint( " " ); 59 | } 60 | 61 | void print_binary( u32 n ) { 62 | 63 | hprint( "0b" ); 64 | for ( u32 i = 0; i < 32; ++i ) { 65 | u32 bit = ( n >> ( 32 - i - 1 ) ) & 0x1; 66 | hprint( "%u", bit ); 67 | } 68 | hprint( " " ); 69 | } 70 | 71 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/blob.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/primitive_types.hpp" 4 | 5 | namespace hydra { 6 | 7 | 8 | // 9 | // 10 | // Memory blob used to serialize versioned data. 11 | // Uses a serialized offset to track where to read/write memory from/to, and an allocated 12 | // offset to track where to allocate memory from when writing, so that Relative structures 13 | // like pointers and arrays can be serialized. 14 | // 15 | // TODO: when finalized and when reading, if data version matches between the one written in 16 | // the file and the root structure is marked as 'relative only', memory mappable is doable and 17 | // thus serialization is automatic. 18 | // 19 | struct BlobHeader { 20 | u32 version; 21 | u32 mappable; 22 | }; // struct BlobHeader 23 | 24 | // 25 | // 26 | struct Blob { 27 | BlobHeader header; 28 | }; // struct Blob 29 | 30 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/color.cpp: -------------------------------------------------------------------------------- 1 | #include "color.hpp" 2 | 3 | namespace hydra { 4 | 5 | // 6 | // 64 Distinct Colors. Used for graphs and anything that needs random colors. 7 | // 8 | static const u32 k_distinct_colors[] = { 9 | 0xFF000000, 0xFF00FF00, 0xFFFF0000, 0xFF0000FF, 0xFFFEFF01, 0xFFFEA6FF, 0xFF66DBFF, 0xFF016400, 10 | 0xFF670001, 0xFF3A0095, 0xFFB57D00, 0xFFF600FF, 0xFFE8EEFF, 0xFF004D77, 0xFF92FB90, 0xFFFF7600, 11 | 0xFF00FFD5, 0xFF7E93FF, 0xFF6C826A, 0xFF9D02FF, 0xFF0089FE, 0xFF82477A, 0xFFD22D7E, 0xFF00A985, 12 | 0xFF5600FF, 0xFF0024A4, 0xFF7EAE00, 0xFF3B3D68, 0xFFFFC6BD, 0xFF003426, 0xFF93D3BD, 0xFF17B900, 13 | 0xFF8E009E, 0xFF441500, 0xFF9F8CC2, 0xFFA374FF, 0xFFFFD001, 0xFF544700, 0xFFFE6FE5, 0xFF318278, 14 | 0xFFA14C0E, 0xFFCBD091, 0xFF7099BE, 0xFFE88A96, 0xFF0088BB, 0xFF2C0043, 0xFF74FFDE, 0xFFC6FF00, 15 | 0xFF02E5FF, 0xFF000E62, 0xFF9C8F00, 0xFF52FF98, 0xFFB14475, 0xFFFF00B5, 0xFF78FF00, 0xFF416EFF, 16 | 0xFF395F00, 0xFF82686B, 0xFF4EAD5F, 0xFF4057A7, 0xFFD2FFA5, 0xFF67B1FF, 0xFFFF9B00, 0xFFBE5EE8 17 | }; 18 | 19 | u32 Color::get_distinct_color( u32 index ) { 20 | return k_distinct_colors[ index % 64 ]; 21 | } 22 | 23 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/color.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/primitive_types.hpp" 4 | 5 | namespace hydra { 6 | 7 | // 8 | // Color class that embeds color in a uint32. 9 | // 10 | struct Color { 11 | 12 | void set( float r, float g, float b, float a ) { abgr = uint8_t( r * 255.f ) | ( uint8_t( g * 255.f ) << 8 ) | ( uint8_t( b * 255.f ) << 16 ) | ( uint8_t( a * 255.f ) << 24 ); } 13 | 14 | f32 r() const { return ( abgr & 0xff ) / 255.f; } 15 | f32 g() const { return ( ( abgr >> 8 ) & 0xff ) / 255.f; } 16 | f32 b() const { return ( ( abgr >> 16 ) & 0xff ) / 255.f; } 17 | f32 a() const { return ( ( abgr >> 24 ) & 0xff ) / 255.f; } 18 | 19 | Color operator=( const u32 color ) { abgr = color; } 20 | 21 | static u32 from_u8( u8 r, u8 g, u8 b, u8 a ) { return ( r | ( g << 8 ) | ( b << 16 ) | ( a << 24 ) ); } 22 | 23 | static u32 get_distinct_color( u32 index ); 24 | 25 | static const u32 red = 0xff0000ff; 26 | static const u32 green = 0xff00ff00; 27 | static const u32 blue = 0xffff0000; 28 | static const u32 yellow = 0xff00ffff; 29 | static const u32 black = 0xff000000; 30 | static const u32 white = 0xffffffff; 31 | static const u32 transparent = 0x00000000; 32 | 33 | u32 abgr; 34 | 35 | }; // struct Color 36 | 37 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/hydra_lib.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Hydra Lib - v0.36 3 | 4 | #include "hydra_lib.hpp" 5 | 6 | #define STB_IMAGE_IMPLEMENTATION 7 | #include "external/stb_image.h" 8 | -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/log.cpp: -------------------------------------------------------------------------------- 1 | #include "log.hpp" 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | namespace hydra { 10 | 11 | LogService s_log_service; 12 | 13 | static constexpr u32 k_string_buffer_size = 1024 * 1024; 14 | static char log_buffer[ k_string_buffer_size ]; 15 | 16 | static void output_console( char* log_buffer_ ) { 17 | printf( "%s", log_buffer_ ); 18 | } 19 | 20 | static void output_visual_studio( char* log_buffer_ ) { 21 | OutputDebugStringA( log_buffer_ ); 22 | } 23 | 24 | LogService* LogService::instance() { 25 | return &s_log_service; 26 | } 27 | 28 | void LogService::print_format( cstring format, ... ) { 29 | va_list args; 30 | 31 | va_start( args, format ); 32 | vsnprintf_s( log_buffer, ArraySize( log_buffer ), format, args ); 33 | log_buffer[ ArraySize( log_buffer ) - 1 ] = '\0'; 34 | va_end( args ); 35 | 36 | output_console( log_buffer ); 37 | #if defined(_MSC_VER) 38 | output_visual_studio( log_buffer ); 39 | #endif // _MSC_VER 40 | 41 | if ( print_callback ) 42 | print_callback( log_buffer ); 43 | } 44 | 45 | void LogService::set_callback( PrintCallback callback ) { 46 | print_callback = callback; 47 | } 48 | 49 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/log.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/platform.hpp" 4 | #include "kernel/primitive_types.hpp" 5 | #include "kernel/service.hpp" 6 | 7 | namespace hydra { 8 | 9 | typedef void ( *PrintCallback )( const char* ); // Additional callback for printing 10 | 11 | struct LogService : public Service { 12 | 13 | hy_declare_service( LogService ); 14 | 15 | void print_format( cstring format, ... ); 16 | 17 | void set_callback( PrintCallback callback ); 18 | 19 | PrintCallback print_callback = nullptr; 20 | 21 | static constexpr cstring k_name = "hydra_log_service"; 22 | }; 23 | 24 | #define hprint(format, ...) hydra::LogService::instance()->print_format(format, __VA_ARGS__); 25 | 26 | } // namespace hydra 27 | -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/main.cpp: -------------------------------------------------------------------------------- 1 | // Hydra Lib - v0.01 2 | 3 | 4 | #include 5 | 6 | #include "data_structures.hpp" 7 | 8 | struct Canide { 9 | float c, d, e; 10 | }; 11 | 12 | /////////////////////////////////////// 13 | int main( int, char** ) { 14 | 15 | hydra::HeapAllocator ha; 16 | 17 | { 18 | hydra::Array canide; 19 | canide.init( &ha, 1 ); 20 | 21 | hy_assert( false ); 22 | 23 | for ( u32 i = 0; i < 11; i++ ) { 24 | Canide a{ i * 1.0f,3,4 }; 25 | canide.push( a ); 26 | } 27 | } 28 | 29 | hprint( "Grande!\n" ); 30 | 31 | return 0; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/memory_utils.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/primitive_types.hpp" 4 | 5 | namespace hydra { 6 | 7 | // 8 | // Calculate aligned memory size. 9 | sizet memory_align( sizet size, sizet alignment ); 10 | 11 | 12 | 13 | // Implementation ///////////////////////////////////////////////////// 14 | 15 | inline sizet memory_align( sizet size, sizet alignment ) { 16 | const sizet alignment_mask = alignment - 1; 17 | return ( size + alignment_mask ) & ~alignment_mask; 18 | } 19 | 20 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/platform.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Macros ////////////////////////////////////////////////////////////////// 4 | 5 | #define ArraySize(array) ( sizeof(array)/sizeof((array)[0]) ) 6 | 7 | 8 | #if defined (_MSC_VER) 9 | #define HY_PERFHUD 10 | #define HY_INLINE inline 11 | #define HY_FINLINE __forceinline 12 | #define HY_DEBUG_BREAK __debugbreak(); 13 | #define HY_DISABLE_WARNING(warning_number) __pragma( warning( disable : warning_number ) ) 14 | #else 15 | 16 | #endif // MSVC 17 | 18 | #define HY_STRINGIZE( L ) #L 19 | #define HY_MAKESTRING( L ) HY_STRINGIZE( L ) 20 | #define HY_CONCAT_OPERATOR(x, y) x##y 21 | #define HY_CONCAT(x, y) HY_CONCAT_OPERATOR(x, y) 22 | #define HY_LINE_STRING HY_MAKESTRING( __LINE__ ) 23 | #define HY_FILELINE(MESSAGE) __FILE__ "(" HY_LINE_STRING ") : " MESSAGE 24 | 25 | // Unique names 26 | #define HY_UNIQUE_SUFFIX(PARAM) HY_CONCAT(PARAM, __LINE__ ) 27 | 28 | -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/primitive_types.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef uint8_t u8; 6 | typedef uint16_t u16; 7 | typedef uint32_t u32; 8 | typedef uint64_t u64; 9 | 10 | typedef int8_t i8; 11 | typedef int16_t i16; 12 | typedef int32_t i32; 13 | typedef int64_t i64; 14 | 15 | typedef float f32; 16 | typedef double f64; 17 | 18 | typedef size_t sizet; 19 | //typedef UINT_PTR uintptr; 20 | //typedef INT_PTR intptr; 21 | 22 | typedef const char* cstring; 23 | 24 | static const u64 u64_max = UINT64_MAX; 25 | static const i64 i64_max = INT64_MAX; 26 | static const u32 u32_max = UINT32_MAX; 27 | static const i32 i32_max = INT32_MAX; 28 | static const u16 u16_max = UINT16_MAX; 29 | static const i16 i16_max = INT16_MAX; 30 | static const u8 u8_max = UINT8_MAX; 31 | static const i8 i8_max = INT8_MAX; 32 | -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/process.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/primitive_types.hpp" 4 | 5 | namespace hydra { 6 | 7 | bool process_execute( cstring working_directory, cstring process_fullpath, cstring arguments, cstring search_error_string = "" ); 8 | cstring process_get_output(); 9 | 10 | } // namespace hydra 11 | -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/resource_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "resource_manager.hpp" 2 | 3 | namespace hydra { 4 | 5 | void ResourceManager::init( Allocator* allocator_, ResourceFilenameResolver* resolver ) { 6 | 7 | this->allocator = allocator_; 8 | this->filename_resolver = resolver; 9 | 10 | loaders.init( allocator, 8 ); 11 | compilers.init( allocator, 8 ); 12 | } 13 | 14 | void ResourceManager::shutdown() { 15 | 16 | loaders.shutdown(); 17 | compilers.shutdown(); 18 | } 19 | 20 | void ResourceManager::set_loader( cstring resource_type, ResourceLoader* loader ) { 21 | const u64 hashed_name = hash_calculate( resource_type ); 22 | loaders.insert( hashed_name, loader ); 23 | } 24 | 25 | void ResourceManager::set_compiler( cstring resource_type, ResourceCompiler* compiler ) { 26 | const u64 hashed_name = hash_calculate( resource_type ); 27 | compilers.insert( hashed_name, compiler ); 28 | } 29 | 30 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/service.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JorenJoestar/DataDrivenRendering/b9078ea3d2d63d1c2cbc6f9ed655e49e23747969/source/hydra_next/source/kernel/service.cpp -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/service.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/primitive_types.hpp" 4 | 5 | namespace hydra { 6 | 7 | struct Service { 8 | 9 | virtual void init( void* configuration ) { } 10 | virtual void shutdown() { } 11 | 12 | }; // struct Service 13 | 14 | #define hy_declare_service(Type) static Type* instance(); 15 | 16 | } // namespace hydra 17 | -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/service_manager.cpp: -------------------------------------------------------------------------------- 1 | #include "service_manager.hpp" 2 | #include "assert.hpp" 3 | 4 | namespace hydra { 5 | 6 | static ServiceManager s_service_manager; 7 | ServiceManager* ServiceManager::instance = &s_service_manager; 8 | 9 | void ServiceManager::init( Allocator* allocator_ ) { 10 | 11 | hprint( "ServiceManager init\n" ); 12 | allocator = allocator_; 13 | 14 | services.init( allocator, 8 ); 15 | } 16 | 17 | void ServiceManager::shutdown() { 18 | 19 | services.shutdown(); 20 | 21 | hprint( "ServiceManager shutdown\n" ); 22 | } 23 | 24 | void ServiceManager::add_service( Service* service, cstring name ) { 25 | u64 hash_name = hash_calculate( name ); 26 | FlatHashMapIterator it = services.find( hash_name ); 27 | hy_assertm( it.is_invalid(), "Overwriting service %s, is this intended ?", name ); 28 | services.insert( hash_name, service ); 29 | } 30 | 31 | void ServiceManager::remove_service( cstring name ) { 32 | u64 hash_name = hash_calculate( name ); 33 | services.remove( hash_name ); 34 | } 35 | 36 | Service* ServiceManager::get_service( cstring name ) { 37 | u64 hash_name = hash_calculate( name ); 38 | return services.get( hash_name ); 39 | } 40 | 41 | } // namespace hydra -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/service_manager.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/array.hpp" 4 | #include "kernel/hash_map.hpp" 5 | 6 | namespace hydra { 7 | 8 | struct Service; 9 | 10 | struct ServiceManager { 11 | 12 | void init( Allocator* allocator ); 13 | void shutdown(); 14 | 15 | void add_service( Service* service, cstring name ); 16 | void remove_service( cstring name ); 17 | 18 | Service* get_service( cstring name ); 19 | 20 | template 21 | T* get(); 22 | 23 | static ServiceManager* instance; 24 | 25 | FlatHashMap services; 26 | Allocator* allocator = nullptr; 27 | 28 | }; // struct ServiceManager 29 | 30 | template 31 | inline T* ServiceManager::get() { 32 | T* service = ( T* )get_service( T::k_name ); 33 | if ( !service ) { 34 | add_service( T::instance(), T::k_name ); 35 | } 36 | 37 | return T::instance(); 38 | } 39 | 40 | } // namespace hydra 41 | -------------------------------------------------------------------------------- /source/hydra_next/source/kernel/time.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kernel/primitive_types.hpp" 4 | 5 | namespace hydra { 6 | 7 | void time_service_init(); // Needs to be called once at startup. 8 | void time_service_shutdown(); // Needs to be called at shutdown. 9 | 10 | i64 time_now(); // Get current time ticks. 11 | 12 | double time_microseconds( i64 time ); // Get microseconds from time ticks 13 | double time_milliseconds( i64 time ); // Get milliseconds from time ticks 14 | double time_seconds( i64 time ); // Get seconds from time ticks 15 | 16 | i64 time_from( i64 starting_time ); // Get time difference from start to current time. 17 | double time_from_microseconds( i64 starting_time ); // Convenience method. 18 | double time_from_milliseconds( i64 starting_time ); // Convenience method. 19 | double time_from_seconds( i64 starting_time ); // Convenience method. 20 | 21 | double time_delta_seconds( i64 starting_time, i64 ending_time ); 22 | double time_delta_milliseconds( i64 starting_time, i64 ending_time ); 23 | 24 | } // namespace hydra -------------------------------------------------------------------------------- /source/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2019 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/imgui/imgui_impl_sdl.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for SDL2 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | // (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Clipboard support. 8 | // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). 9 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 10 | // Missing features: 11 | // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. 12 | 13 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 14 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 15 | // https://github.com/ocornut/imgui 16 | 17 | #pragma once 18 | 19 | struct SDL_Window; 20 | typedef union SDL_Event SDL_Event; 21 | 22 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); 23 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); 24 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window); 25 | IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); 26 | IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(SDL_Window* window); 27 | IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event); 28 | -------------------------------------------------------------------------------- /source/rapidjson/internal/swap.h: -------------------------------------------------------------------------------- 1 | // Tencent is pleased to support the open source community by making RapidJSON available. 2 | // 3 | // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4 | // 5 | // Licensed under the MIT License (the "License"); you may not use this file except 6 | // in compliance with the License. You may obtain a copy of the License at 7 | // 8 | // http://opensource.org/licenses/MIT 9 | // 10 | // Unless required by applicable law or agreed to in writing, software distributed 11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the 13 | // specific language governing permissions and limitations under the License. 14 | 15 | #ifndef RAPIDJSON_INTERNAL_SWAP_H_ 16 | #define RAPIDJSON_INTERNAL_SWAP_H_ 17 | 18 | #include "../rapidjson.h" 19 | 20 | #if defined(__clang__) 21 | RAPIDJSON_DIAG_PUSH 22 | RAPIDJSON_DIAG_OFF(c++98-compat) 23 | #endif 24 | 25 | RAPIDJSON_NAMESPACE_BEGIN 26 | namespace internal { 27 | 28 | //! Custom swap() to avoid dependency on C++ header 29 | /*! \tparam T Type of the arguments to swap, should be instantiated with primitive C++ types only. 30 | \note This has the same semantics as std::swap(). 31 | */ 32 | template 33 | inline void Swap(T& a, T& b) RAPIDJSON_NOEXCEPT { 34 | T tmp = a; 35 | a = b; 36 | b = tmp; 37 | } 38 | 39 | } // namespace internal 40 | RAPIDJSON_NAMESPACE_END 41 | 42 | #if defined(__clang__) 43 | RAPIDJSON_DIAG_POP 44 | #endif 45 | 46 | #endif // RAPIDJSON_INTERNAL_SWAP_H_ 47 | --------------------------------------------------------------------------------