├── GameTest ├── Game │ ├── bin │ │ ├── ValagTest.exe │ │ ├── config.ini │ │ ├── glfw3.dll │ │ ├── libgcc_s_seh-1.dll │ │ ├── libstdc++-6.dll │ │ └── libwinpthread-1.dll │ ├── bin_debug │ │ ├── ValagTest.exe │ │ ├── config.ini │ │ └── glfw3.dll │ ├── data │ │ ├── HDRenv.exr │ │ ├── HDRenv.hdr │ │ ├── abbeyXML.txt │ │ ├── abbey_albedo.png │ │ ├── abbey_height.png │ │ ├── abbey_normal.png │ │ ├── panorama.jpg │ │ ├── quack.jpg │ │ ├── quack.obj │ │ ├── quackMaterial.txt │ │ ├── quackXML.txt │ │ ├── sandXML.txt │ │ ├── sand_color.png │ │ ├── sand_height.png │ │ ├── sand_normal.png │ │ ├── sarcoXML.txt │ │ ├── sarco_albedo.png │ │ ├── sarco_height.png │ │ ├── sarco_normal.png │ │ ├── torusXML.txt │ │ ├── torus_albedo.png │ │ ├── torus_height.png │ │ ├── torus_normal.png │ │ ├── treeXML.txt │ │ ├── tree_albedo.png │ │ ├── tree_height.png │ │ ├── tree_normal.png │ │ ├── tree_rmt.png │ │ ├── wetsandXML.txt │ │ ├── wetsand_albedo.png │ │ ├── wetsand_height.png │ │ ├── wetsand_normal.png │ │ └── wetsand_rmt.png │ └── shaders │ │ ├── blur.frag.spv │ │ ├── blur.vert.spv │ │ ├── defaultShader.frag.spv │ │ ├── defaultShader.vert.spv │ │ ├── deferred │ │ ├── isoSpriteAlphaDetection.frag.spv │ │ ├── isoSpriteAlphaDetection.vert.spv │ │ ├── isoSpriteAlphaShader.frag.spv │ │ ├── isoSpriteShader.frag.spv │ │ ├── isoSpriteShader.vert.spv │ │ ├── isoSpriteShadow.frag.spv │ │ ├── isoSpriteShadow.vert.spv │ │ ├── isoSpriteShadowFilt.frag.spv │ │ ├── isoSpriteShadowFilt.vert.spv │ │ ├── isoSpriteShadowGen.frag.spv │ │ ├── isoSpriteShadowGen.vert.spv │ │ ├── meshDirectShadow.frag.spv │ │ ├── meshDirectShadow.vert.spv │ │ ├── meshShader.frag.spv │ │ └── meshShader.vert.spv │ │ ├── instancingShader.frag.spv │ │ ├── instancingShader.vert.spv │ │ ├── lighting │ │ ├── ambientLighting.frag.spv │ │ ├── ambientLighting.vert.spv │ │ ├── brdflut.frag.spv │ │ ├── brdflut.vert.spv │ │ ├── iblfiltering.frag.spv │ │ ├── iblfiltering.vert.spv │ │ ├── lighting.frag.spv │ │ ├── lighting.vert.spv │ │ ├── ssgiBN.frag.spv │ │ └── ssgiBN.vert.spv │ │ ├── smartBlur.frag.spv │ │ ├── smartBlur.vert.spv │ │ ├── toneMapping.frag.spv │ │ └── toneMapping.vert.spv └── Sources │ ├── ValagTest.cbp │ ├── include │ └── states │ │ └── TestingState.h │ ├── main.cpp │ └── src │ └── states │ └── TestingState.cpp ├── README.md └── Valag ├── include ├── GLFW │ ├── glfw3.h │ └── glfw3native.h ├── Valag │ ├── Types.h │ ├── assets │ │ ├── Asset.h │ │ ├── AssetHandler.h │ │ ├── MaterialAsset.h │ │ ├── MeshAsset.h │ │ ├── MeshesHandler.h │ │ └── TextureAsset.h │ ├── core │ │ ├── Config.h │ │ ├── EventsManager.h │ │ ├── GameState.h │ │ ├── NotificationListener.h │ │ ├── NotificationSender.h │ │ ├── StatesManager.h │ │ └── VApp.h │ ├── gfx │ │ ├── Drawable.h │ │ ├── Sprite.h │ │ └── SpritesBatch.h │ ├── renderers │ │ ├── AbstractRenderer.h │ │ ├── DefaultRenderer.h │ │ ├── FullRenderPass.h │ │ ├── InstancingRenderer.h │ │ ├── PBRToolbox.h │ │ ├── RenderGraph.h │ │ ├── RenderView.h │ │ ├── RenderWindow.h │ │ ├── SceneRenderer.h │ │ ├── SceneRenderingData.h │ │ └── SceneRenderingInstance.h │ ├── scene │ │ ├── CameraObject.h │ │ ├── IsoSpriteEntity.h │ │ ├── IsoSpriteModel.h │ │ ├── LightEntity.h │ │ ├── MeshEntity.h │ │ ├── Scene.h │ │ ├── SceneEntity.h │ │ ├── SceneNode.h │ │ ├── SceneObject.h │ │ └── ShadowCaster.h │ ├── utils │ │ ├── Clock.h │ │ ├── Logger.h │ │ ├── Parser.h │ │ ├── Profiler.h │ │ ├── Singleton.h │ │ └── SingletonsCleaner.h │ └── vulkanImpl │ │ ├── DynamicUBO.h │ │ ├── DynamicUBODescriptor.h │ │ ├── DynamicVBO.h │ │ ├── VBuffersAllocator.h │ │ ├── VCommandBuffer.h │ │ ├── VGraphicsPipeline.h │ │ ├── VInstance.h │ │ ├── VMemoryAllocator.h │ │ ├── VMesh.h │ │ ├── VRenderPass.h │ │ ├── VRenderTarget.h │ │ ├── VTexture.h │ │ ├── VTexturesManager.h │ │ ├── VulkanExtProxies.h │ │ ├── VulkanHelpers.h │ │ └── VulkanImpl.h ├── glm │ ├── CMakeLists.txt │ ├── common.hpp │ ├── detail │ │ ├── _features.hpp │ │ ├── _fixes.hpp │ │ ├── _noise.hpp │ │ ├── _swizzle.hpp │ │ ├── _swizzle_func.hpp │ │ ├── _vectorize.hpp │ │ ├── compute_vector_relational.hpp │ │ ├── dummy.cpp │ │ ├── func_common.inl │ │ ├── func_common_simd.inl │ │ ├── func_exponential.inl │ │ ├── func_exponential_simd.inl │ │ ├── func_geometric.inl │ │ ├── func_geometric_simd.inl │ │ ├── func_integer.inl │ │ ├── func_integer_simd.inl │ │ ├── func_matrix.inl │ │ ├── func_matrix_simd.inl │ │ ├── func_packing.inl │ │ ├── func_packing_simd.inl │ │ ├── func_trigonometric.inl │ │ ├── func_trigonometric_simd.inl │ │ ├── func_vector_relational.inl │ │ ├── func_vector_relational_simd.inl │ │ ├── glm.cpp │ │ ├── qualifier.hpp │ │ ├── setup.hpp │ │ ├── type_float.hpp │ │ ├── type_gentype.hpp │ │ ├── type_gentype.inl │ │ ├── type_half.hpp │ │ ├── type_half.inl │ │ ├── type_int.hpp │ │ ├── type_mat.hpp │ │ ├── type_mat.inl │ │ ├── type_mat2x2.hpp │ │ ├── type_mat2x2.inl │ │ ├── type_mat2x3.hpp │ │ ├── type_mat2x3.inl │ │ ├── type_mat2x4.hpp │ │ ├── type_mat2x4.inl │ │ ├── type_mat3x2.hpp │ │ ├── type_mat3x2.inl │ │ ├── type_mat3x3.hpp │ │ ├── type_mat3x3.inl │ │ ├── type_mat3x4.hpp │ │ ├── type_mat3x4.inl │ │ ├── type_mat4x2.hpp │ │ ├── type_mat4x2.inl │ │ ├── type_mat4x3.hpp │ │ ├── type_mat4x3.inl │ │ ├── type_mat4x4.hpp │ │ ├── type_mat4x4.inl │ │ ├── type_mat4x4_simd.inl │ │ ├── type_vec.hpp │ │ ├── type_vec.inl │ │ ├── type_vec1.hpp │ │ ├── type_vec1.inl │ │ ├── type_vec2.hpp │ │ ├── type_vec2.inl │ │ ├── type_vec3.hpp │ │ ├── type_vec3.inl │ │ ├── type_vec4.hpp │ │ ├── type_vec4.inl │ │ └── type_vec4_simd.inl │ ├── exponential.hpp │ ├── ext.hpp │ ├── ext │ │ ├── vec1.hpp │ │ ├── vec1.inl │ │ ├── vector_relational.hpp │ │ └── vector_relational.inl │ ├── fwd.hpp │ ├── geometric.hpp │ ├── glm.hpp │ ├── gtc │ │ ├── bitfield.hpp │ │ ├── bitfield.inl │ │ ├── color_space.hpp │ │ ├── color_space.inl │ │ ├── constants.hpp │ │ ├── constants.inl │ │ ├── epsilon.hpp │ │ ├── epsilon.inl │ │ ├── integer.hpp │ │ ├── integer.inl │ │ ├── matrix_access.hpp │ │ ├── matrix_access.inl │ │ ├── matrix_integer.hpp │ │ ├── matrix_inverse.hpp │ │ ├── matrix_inverse.inl │ │ ├── matrix_transform.hpp │ │ ├── matrix_transform.inl │ │ ├── noise.hpp │ │ ├── noise.inl │ │ ├── packing.hpp │ │ ├── packing.inl │ │ ├── quaternion.hpp │ │ ├── quaternion.inl │ │ ├── quaternion_simd.inl │ │ ├── random.hpp │ │ ├── random.inl │ │ ├── reciprocal.hpp │ │ ├── reciprocal.inl │ │ ├── round.hpp │ │ ├── round.inl │ │ ├── type_aligned.hpp │ │ ├── type_precision.hpp │ │ ├── type_precision.inl │ │ ├── type_ptr.hpp │ │ ├── type_ptr.inl │ │ ├── ulp.hpp │ │ ├── ulp.inl │ │ ├── vec1.hpp │ │ └── vec1.inl │ ├── gtx │ │ ├── associated_min_max.hpp │ │ ├── associated_min_max.inl │ │ ├── bit.hpp │ │ ├── bit.inl │ │ ├── closest_point.hpp │ │ ├── closest_point.inl │ │ ├── color_encoding.hpp │ │ ├── color_encoding.inl │ │ ├── color_space.hpp │ │ ├── color_space.inl │ │ ├── color_space_YCoCg.hpp │ │ ├── color_space_YCoCg.inl │ │ ├── common.hpp │ │ ├── common.inl │ │ ├── compatibility.hpp │ │ ├── compatibility.inl │ │ ├── component_wise.hpp │ │ ├── component_wise.inl │ │ ├── dual_quaternion.hpp │ │ ├── dual_quaternion.inl │ │ ├── easing.hpp │ │ ├── easing.inl │ │ ├── euler_angles.hpp │ │ ├── euler_angles.inl │ │ ├── extend.hpp │ │ ├── extend.inl │ │ ├── extended_min_max.hpp │ │ ├── extended_min_max.inl │ │ ├── exterior_product.hpp │ │ ├── exterior_product.inl │ │ ├── fast_exponential.hpp │ │ ├── fast_exponential.inl │ │ ├── fast_square_root.hpp │ │ ├── fast_square_root.inl │ │ ├── fast_trigonometry.hpp │ │ ├── fast_trigonometry.inl │ │ ├── float_notmalize.inl │ │ ├── functions.hpp │ │ ├── functions.inl │ │ ├── gradient_paint.hpp │ │ ├── gradient_paint.inl │ │ ├── handed_coordinate_space.hpp │ │ ├── handed_coordinate_space.inl │ │ ├── hash.hpp │ │ ├── hash.inl │ │ ├── integer.hpp │ │ ├── integer.inl │ │ ├── intersect.hpp │ │ ├── intersect.inl │ │ ├── io.hpp │ │ ├── io.inl │ │ ├── log_base.hpp │ │ ├── log_base.inl │ │ ├── matrix_cross_product.hpp │ │ ├── matrix_cross_product.inl │ │ ├── matrix_decompose.hpp │ │ ├── matrix_decompose.inl │ │ ├── matrix_factorisation.hpp │ │ ├── matrix_factorisation.inl │ │ ├── matrix_interpolation.hpp │ │ ├── matrix_interpolation.inl │ │ ├── matrix_major_storage.hpp │ │ ├── matrix_major_storage.inl │ │ ├── matrix_operation.hpp │ │ ├── matrix_operation.inl │ │ ├── matrix_query.hpp │ │ ├── matrix_query.inl │ │ ├── matrix_transform_2d.hpp │ │ ├── matrix_transform_2d.inl │ │ ├── mixed_product.hpp │ │ ├── mixed_product.inl │ │ ├── norm.hpp │ │ ├── norm.inl │ │ ├── normal.hpp │ │ ├── normal.inl │ │ ├── normalize_dot.hpp │ │ ├── normalize_dot.inl │ │ ├── number_precision.hpp │ │ ├── number_precision.inl │ │ ├── optimum_pow.hpp │ │ ├── optimum_pow.inl │ │ ├── orthonormalize.hpp │ │ ├── orthonormalize.inl │ │ ├── perpendicular.hpp │ │ ├── perpendicular.inl │ │ ├── polar_coordinates.hpp │ │ ├── polar_coordinates.inl │ │ ├── projection.hpp │ │ ├── projection.inl │ │ ├── quaternion.hpp │ │ ├── quaternion.inl │ │ ├── range.hpp │ │ ├── raw_data.hpp │ │ ├── raw_data.inl │ │ ├── rotate_normalized_axis.hpp │ │ ├── rotate_normalized_axis.inl │ │ ├── rotate_vector.hpp │ │ ├── rotate_vector.inl │ │ ├── scalar_multiplication.hpp │ │ ├── scalar_relational.hpp │ │ ├── scalar_relational.inl │ │ ├── spline.hpp │ │ ├── spline.inl │ │ ├── std_based_type.hpp │ │ ├── std_based_type.inl │ │ ├── string_cast.hpp │ │ ├── string_cast.inl │ │ ├── texture.hpp │ │ ├── texture.inl │ │ ├── transform.hpp │ │ ├── transform.inl │ │ ├── transform2.hpp │ │ ├── transform2.inl │ │ ├── type_aligned.hpp │ │ ├── type_aligned.inl │ │ ├── type_trait.hpp │ │ ├── type_trait.inl │ │ ├── vec_swizzle.hpp │ │ ├── vector_angle.hpp │ │ ├── vector_angle.inl │ │ ├── vector_query.hpp │ │ ├── vector_query.inl │ │ ├── wrap.hpp │ │ └── wrap.inl │ ├── integer.hpp │ ├── mat2x2.hpp │ ├── mat2x3.hpp │ ├── mat2x4.hpp │ ├── mat3x2.hpp │ ├── mat3x3.hpp │ ├── mat3x4.hpp │ ├── mat4x2.hpp │ ├── mat4x3.hpp │ ├── mat4x4.hpp │ ├── matrix.hpp │ ├── packing.hpp │ ├── simd │ │ ├── common.h │ │ ├── exponential.h │ │ ├── geometric.h │ │ ├── integer.h │ │ ├── matrix.h │ │ ├── packing.h │ │ ├── platform.h │ │ ├── trigonometric.h │ │ └── vector_relational.h │ ├── trigonometric.hpp │ ├── vec2.hpp │ ├── vec3.hpp │ ├── vec4.hpp │ └── vector_relational.hpp ├── stb │ ├── stb_image.h │ └── stb_image_write.h ├── tinyxml │ ├── tinystr.h │ └── tinyxml.h └── vulkan │ ├── GLSL.std.450.h │ ├── spirv.h │ ├── spirv.hpp │ ├── spirv.hpp11 │ ├── spirv.json │ ├── spirv.lua │ ├── spirv.py │ ├── vk_icd.h │ ├── vk_layer.h │ ├── vk_layer_dispatch_table.h │ ├── vk_platform.h │ ├── vk_sdk_platform.h │ ├── vulkan.h │ ├── vulkan.hpp │ ├── vulkan_android.h │ ├── vulkan_core.h │ ├── vulkan_ios.h │ ├── vulkan_macos.h │ ├── vulkan_mir.h │ ├── vulkan_vi.h │ ├── vulkan_wayland.h │ ├── vulkan_win32.h │ ├── vulkan_xcb.h │ ├── vulkan_xlib.h │ └── vulkan_xlib_xrandr.h ├── libs ├── VkLayer_api_dump.lib ├── VkLayer_core_validation.lib ├── VkLayer_device_simulation.lib ├── VkLayer_monitor.lib ├── VkLayer_object_tracker.lib ├── VkLayer_parameter_validation.lib ├── VkLayer_screenshot.lib ├── VkLayer_threading.lib ├── VkLayer_unique_objects.lib ├── VkLayer_utils.lib ├── libglfw3.a ├── libglfw3dll.a ├── shaderc_combined.lib ├── tinyxml │ ├── tinystr.cpp │ ├── tinyxml.cpp │ ├── tinyxmlerror.cpp │ ├── tinyxmlparser.cpp │ └── xmltest.cpp ├── vulkan-1.lib └── vulkan-1.pdb ├── shaders ├── blur.frag ├── blur.frag.spv ├── blur.vert ├── blur.vert.spv ├── compileAllShaders.bat ├── defaultShader.frag ├── defaultShader.frag.spv ├── defaultShader.vert ├── defaultShader.vert.spv ├── deferred │ ├── compileAllShaders.bat │ ├── isoSpriteAlphaDetection.frag │ ├── isoSpriteAlphaDetection.frag.spv │ ├── isoSpriteAlphaDetection.vert │ ├── isoSpriteAlphaDetection.vert.spv │ ├── isoSpriteAlphaShader.frag │ ├── isoSpriteAlphaShader.frag.spv │ ├── isoSpriteShader.frag │ ├── isoSpriteShader.frag.spv │ ├── isoSpriteShader.vert │ ├── isoSpriteShader.vert.spv │ ├── isoSpriteShadow.frag │ ├── isoSpriteShadow.frag.spv │ ├── isoSpriteShadow.vert │ ├── isoSpriteShadow.vert.spv │ ├── isoSpriteShadowFilt.frag │ ├── isoSpriteShadowFilt.frag.spv │ ├── isoSpriteShadowFilt.vert │ ├── isoSpriteShadowFilt.vert.spv │ ├── isoSpriteShadowGen.frag │ ├── isoSpriteShadowGen.frag.spv │ ├── isoSpriteShadowGen.vert │ ├── isoSpriteShadowGen.vert.spv │ ├── meshDirectShadow.frag │ ├── meshDirectShadow.frag.spv │ ├── meshDirectShadow.vert │ ├── meshDirectShadow.vert.spv │ ├── meshShader.frag │ ├── meshShader.frag.spv │ ├── meshShader.vert │ └── meshShader.vert.spv ├── instancingShader.frag ├── instancingShader.frag.spv ├── instancingShader.vert ├── instancingShader.vert.spv ├── lighting │ ├── ambientLighting.frag │ ├── ambientLighting.frag.spv │ ├── ambientLighting.vert │ ├── ambientLighting.vert.spv │ ├── brdflut.frag │ ├── brdflut.frag.spv │ ├── brdflut.vert │ ├── brdflut.vert.spv │ ├── compileAllShaders.bat │ ├── iblfiltering.frag │ ├── iblfiltering.frag.spv │ ├── iblfiltering.vert │ ├── iblfiltering.vert.spv │ ├── lighting.frag │ ├── lighting.frag.spv │ ├── lighting.vert │ ├── lighting.vert.spv │ ├── ssgiBN.frag │ ├── ssgiBN.frag.spv │ ├── ssgiBN.vert │ └── ssgiBN.vert.spv ├── smartBlur.frag ├── smartBlur.frag.spv ├── smartBlur.vert ├── smartBlur.vert.spv ├── toneMapping.frag ├── toneMapping.frag.spv ├── toneMapping.vert └── toneMapping.vert.spv └── src ├── assets ├── Asset.cpp ├── AssetHandler.inc ├── MaterialAsset.cpp ├── MeshAsset.cpp ├── MeshesHandler.cpp └── TextureAsset.cpp ├── core ├── Config.cpp ├── EventsManager.cpp ├── GameState.cpp ├── NotificationListener.cpp ├── NotificationSender.cpp ├── StatesManager.cpp └── VApp.cpp ├── gfx ├── Drawable.cpp ├── Sprite.cpp └── SpritesBatch.cpp ├── renderers ├── AbstractRenderer.cpp ├── DefaultRenderer.cpp ├── FullRenderPass.cpp ├── InstancingRenderer.cpp ├── PBRToolbox.cpp ├── RenderGraph.cpp ├── RenderView.cpp ├── RenderWindow.cpp ├── SceneRenderer.cpp ├── SceneRenderingData.cpp └── SceneRenderingInstance.cpp ├── scene ├── CameraObject.cpp ├── IsoSpriteEntity.cpp ├── IsoSpriteModel.cpp ├── LightEntity.cpp ├── MeshEntity.cpp ├── Scene.cpp ├── SceneEntity.cpp ├── SceneNode.cpp ├── SceneObject.cpp └── ShadowCaster.cpp ├── utils ├── Clock.cpp ├── Logger.cpp ├── Parser.cpp ├── Profiler.cpp └── SingletonsCleaner.cpp └── vulkanImpl ├── DynamicUBO.cpp ├── DynamicUBODescriptor.cpp ├── DynamicVBO.inc ├── VBuffersAllocator.cpp ├── VCommandBuffer.cpp ├── VGraphicsPipeline.cpp ├── VInstance.cpp ├── VMemoryAllocator.cpp ├── VMesh.cpp ├── VRenderPass.cpp ├── VRenderTarget.cpp ├── VTexture.cpp ├── VTexturesManager.cpp ├── VulkanExtProxies.cpp └── VulkanHelpers.cpp /GameTest/Game/bin/ValagTest.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/bin/ValagTest.exe -------------------------------------------------------------------------------- /GameTest/Game/bin/config.ini: -------------------------------------------------------------------------------- 1 | [window] 2 | width = 1024 3 | height = 768 4 | -------------------------------------------------------------------------------- /GameTest/Game/bin/glfw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/bin/glfw3.dll -------------------------------------------------------------------------------- /GameTest/Game/bin/libgcc_s_seh-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/bin/libgcc_s_seh-1.dll -------------------------------------------------------------------------------- /GameTest/Game/bin/libstdc++-6.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/bin/libstdc++-6.dll -------------------------------------------------------------------------------- /GameTest/Game/bin/libwinpthread-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/bin/libwinpthread-1.dll -------------------------------------------------------------------------------- /GameTest/Game/bin_debug/ValagTest.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/bin_debug/ValagTest.exe -------------------------------------------------------------------------------- /GameTest/Game/bin_debug/config.ini: -------------------------------------------------------------------------------- 1 | [window] 2 | width = 1024 3 | height = 768 4 | -------------------------------------------------------------------------------- /GameTest/Game/bin_debug/glfw3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/bin_debug/glfw3.dll -------------------------------------------------------------------------------- /GameTest/Game/data/HDRenv.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/HDRenv.exr -------------------------------------------------------------------------------- /GameTest/Game/data/HDRenv.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/HDRenv.hdr -------------------------------------------------------------------------------- /GameTest/Game/data/abbeyXML.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Abbaye 4 | 460 5 | abbey_albedo.png 6 | abbey_normal.png 7 | abbey_height.png 8 | .7 9 | 0 10 | 0 11 | -------------------------------------------------------------------------------- /GameTest/Game/data/abbey_albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/abbey_albedo.png -------------------------------------------------------------------------------- /GameTest/Game/data/abbey_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/abbey_height.png -------------------------------------------------------------------------------- /GameTest/Game/data/abbey_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/abbey_normal.png -------------------------------------------------------------------------------- /GameTest/Game/data/panorama.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/panorama.jpg -------------------------------------------------------------------------------- /GameTest/Game/data/quack.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/quack.jpg -------------------------------------------------------------------------------- /GameTest/Game/data/quackMaterial.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | QuackMaterial 4 | 0 5 | quack.jpg 6 | .3 7 | 1 8 | 0 9 | -------------------------------------------------------------------------------- /GameTest/Game/data/quackXML.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Quack 4 | 1 5 | quack.obj 6 | quackMaterial.txt 7 | -------------------------------------------------------------------------------- /GameTest/Game/data/sandXML.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sand 4 | 15 5 | sand_color.png 6 | sand_normal.png 7 | sand_height.png 8 | .7 9 | 0 10 | 0 11 | -------------------------------------------------------------------------------- /GameTest/Game/data/sand_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/sand_color.png -------------------------------------------------------------------------------- /GameTest/Game/data/sand_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/sand_height.png -------------------------------------------------------------------------------- /GameTest/Game/data/sand_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/sand_normal.png -------------------------------------------------------------------------------- /GameTest/Game/data/sarcoXML.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sarco 4 | 85 5 | sarco_albedo.png 6 | sarco_normal.png 7 | sarco_height.png 8 | 0.4 9 | 0 10 | 0 11 | -------------------------------------------------------------------------------- /GameTest/Game/data/sarco_albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/sarco_albedo.png -------------------------------------------------------------------------------- /GameTest/Game/data/sarco_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/sarco_height.png -------------------------------------------------------------------------------- /GameTest/Game/data/sarco_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/sarco_normal.png -------------------------------------------------------------------------------- /GameTest/Game/data/torusXML.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Torus 4 | 75 5 | torus_albedo.png 6 | torus_normal.png 7 | torus_height.png 8 | .7 9 | 0 10 | 0 11 | -------------------------------------------------------------------------------- /GameTest/Game/data/torus_albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/torus_albedo.png -------------------------------------------------------------------------------- /GameTest/Game/data/torus_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/torus_height.png -------------------------------------------------------------------------------- /GameTest/Game/data/torus_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/torus_normal.png -------------------------------------------------------------------------------- /GameTest/Game/data/treeXML.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tree 4 | 600 5 | tree_albedo.png 6 | tree_normal.png 7 | tree_height.png 8 | tree_rmt.png 9 | -------------------------------------------------------------------------------- /GameTest/Game/data/tree_albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/tree_albedo.png -------------------------------------------------------------------------------- /GameTest/Game/data/tree_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/tree_height.png -------------------------------------------------------------------------------- /GameTest/Game/data/tree_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/tree_normal.png -------------------------------------------------------------------------------- /GameTest/Game/data/tree_rmt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/tree_rmt.png -------------------------------------------------------------------------------- /GameTest/Game/data/wetsandXML.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Wet sand 4 | 5 5 | wetsand_albedo.png 6 | wetsand_normal.png 7 | wetsand_height.png 8 | wetsand_rmt.png 9 | -------------------------------------------------------------------------------- /GameTest/Game/data/wetsand_albedo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/wetsand_albedo.png -------------------------------------------------------------------------------- /GameTest/Game/data/wetsand_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/wetsand_height.png -------------------------------------------------------------------------------- /GameTest/Game/data/wetsand_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/wetsand_normal.png -------------------------------------------------------------------------------- /GameTest/Game/data/wetsand_rmt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/data/wetsand_rmt.png -------------------------------------------------------------------------------- /GameTest/Game/shaders/blur.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/blur.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/blur.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/blur.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/defaultShader.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/defaultShader.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/defaultShader.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/defaultShader.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteAlphaDetection.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteAlphaDetection.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteAlphaDetection.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteAlphaDetection.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteAlphaShader.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteAlphaShader.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteShader.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteShader.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteShader.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteShader.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteShadow.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteShadow.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteShadow.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteShadow.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteShadowFilt.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteShadowFilt.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteShadowFilt.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteShadowFilt.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteShadowGen.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteShadowGen.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/isoSpriteShadowGen.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/isoSpriteShadowGen.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/meshDirectShadow.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/meshDirectShadow.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/meshDirectShadow.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/meshDirectShadow.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/meshShader.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/meshShader.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/deferred/meshShader.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/deferred/meshShader.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/instancingShader.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/instancingShader.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/instancingShader.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/instancingShader.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/lighting/ambientLighting.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/lighting/ambientLighting.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/lighting/ambientLighting.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/lighting/ambientLighting.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/lighting/brdflut.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/lighting/brdflut.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/lighting/brdflut.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/lighting/brdflut.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/lighting/iblfiltering.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/lighting/iblfiltering.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/lighting/iblfiltering.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/lighting/iblfiltering.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/lighting/lighting.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/lighting/lighting.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/lighting/lighting.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/lighting/lighting.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/lighting/ssgiBN.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/lighting/ssgiBN.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/lighting/ssgiBN.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/lighting/ssgiBN.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/smartBlur.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/smartBlur.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/smartBlur.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/smartBlur.vert.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/toneMapping.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/toneMapping.frag.spv -------------------------------------------------------------------------------- /GameTest/Game/shaders/toneMapping.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/GameTest/Game/shaders/toneMapping.vert.spv -------------------------------------------------------------------------------- /GameTest/Sources/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "Valag/utils/Logger.h" 4 | #include "Valag/core/VApp.h" 5 | #include "states/TestingState.h" 6 | 7 | int main() 8 | { 9 | Logger::instance(); 10 | 11 | try { 12 | vlg::VAppCreateInfos createInfos; 13 | createInfos.name = "VALAG"; 14 | createInfos.xyAngle = 45.0f; 15 | createInfos.zAngle = 30.0f; 16 | 17 | vlg::VApp app(createInfos); 18 | app.run(TestingState::instance()); 19 | } catch (const std::exception& e) { 20 | Logger::fatalError(e.what()); 21 | return EXIT_FAILURE; 22 | } 23 | 24 | return EXIT_SUCCESS; 25 | } 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VALAG 2 | Vulkan version of ALAG 2.5D PBR shading engine 3 | -------------------------------------------------------------------------------- /Valag/include/Valag/assets/Asset.h: -------------------------------------------------------------------------------- 1 | #ifndef ASSET_H 2 | #define ASSET_H 3 | 4 | #include "Valag/core/NotificationSender.h" 5 | #include "Valag/Types.h" 6 | 7 | #include 8 | 9 | namespace vlg 10 | { 11 | 12 | class Asset : public NotificationSender 13 | { 14 | public: 15 | Asset(); 16 | Asset(const AssetTypeId ); 17 | virtual ~Asset(); 18 | 19 | virtual bool loadFromFile(const std::string &); 20 | virtual bool loadFromMemory(void *data, std::size_t dataSize); 21 | 22 | bool prepareLoadFromFile(const std::string &, AssetLoadType = LoadType_Now); 23 | bool prepareLoadFromMemory(void *data, std::size_t dataSize, AssetLoadType = LoadType_Now); 24 | /// bool prepareLoadFromStream(sf::InputStream *stream, AssetLoadType = LoadType_Now); 25 | 26 | bool loadNow(); 27 | 28 | bool isLoaded(); 29 | const std::string& getFilePath(); 30 | 31 | AssetTypeId getId(); 32 | AssetLoadType getLoadType(); 33 | AssetLoadSource getLoadSource(); 34 | 35 | void forceLoadType(AssetLoadType); 36 | 37 | protected: 38 | void forceLoaded(bool loaded = true); 39 | 40 | protected: 41 | 42 | bool m_allowLoadFromFile; 43 | std::string m_filePath; 44 | std::string m_fileDirectory; 45 | 46 | bool m_allowLoadFromMemory; 47 | void *m_loadData; 48 | std::size_t m_loadDataSize; 49 | 50 | ///bool m_allowLoadFromStream; 51 | ///sf::InputStream *m_loadStream; 52 | 53 | AssetLoadSource m_loadSource; 54 | AssetLoadType m_loadType; 55 | 56 | bool m_loaded; 57 | 58 | std::string m_name; 59 | 60 | private: 61 | AssetTypeId m_id; 62 | 63 | }; 64 | 65 | 66 | } 67 | 68 | #endif // ASSET_H 69 | -------------------------------------------------------------------------------- /Valag/include/Valag/assets/MaterialAsset.h: -------------------------------------------------------------------------------- 1 | #ifndef MATERIALASSET_H 2 | #define MATERIALASSET_H 3 | 4 | #include "Valag/assets/Asset.h" 5 | #include "Valag/core/NotificationListener.h" 6 | #include "Valag/vulkanImpl/VTexture.h" 7 | 8 | #include "tinyxml/tinyxml.h" 9 | #include "glm/glm.hpp" 10 | 11 | namespace vlg 12 | { 13 | 14 | class MaterialAsset : public Asset, public NotificationListener 15 | { 16 | public: 17 | MaterialAsset(); 18 | MaterialAsset(const AssetTypeId); 19 | virtual ~MaterialAsset(); 20 | 21 | bool loadFromFile(const std::string &filePath); 22 | 23 | virtual void notify(NotificationSender* , NotificationType, 24 | size_t dataSize = 0, char* data = nullptr) override; 25 | 26 | VTexture getAlbedoMap(); 27 | VTexture getNormalMap(); 28 | VTexture getHeightMap(); 29 | VTexture getRmtMap(); 30 | 31 | float getHeightFactor(); 32 | glm::vec3 getRmtFactor(); 33 | 34 | protected: 35 | bool loadFromXML(TiXmlHandle *); 36 | 37 | private: 38 | TextureAsset* m_albedoMap; //Color 39 | TextureAsset* m_normalMap; 40 | TextureAsset* m_heightMap; 41 | TextureAsset* m_rmtMap; // Roughness-Metalness-Translucency 42 | 43 | float m_heightFactor; 44 | glm::vec3 m_rmtFactor; 45 | }; 46 | 47 | } 48 | 49 | #endif // MATERIALASSET_H 50 | -------------------------------------------------------------------------------- /Valag/include/Valag/assets/MeshAsset.h: -------------------------------------------------------------------------------- 1 | #ifndef MESHASSET_H 2 | #define MESHASSET_H 3 | 4 | #include 5 | 6 | #include "Valag/assets/MaterialAsset.h" 7 | #include "Valag/vulkanImpl/VulkanImpl.h" 8 | 9 | 10 | namespace vlg 11 | { 12 | 13 | 14 | struct VertexTriangle 15 | { 16 | glm::vec3 v1; 17 | glm::vec3 v2; 18 | glm::vec3 v3; 19 | }; 20 | 21 | class MeshAsset : public Asset, public NotificationListener 22 | { 23 | friend class SceneRenderer; 24 | friend class MeshesHandler; 25 | 26 | public: 27 | MeshAsset(); 28 | MeshAsset(const AssetTypeId); 29 | virtual ~MeshAsset(); 30 | 31 | bool loadFromFile(const std::string &filePath); 32 | virtual void notify(NotificationSender* , NotificationType, 33 | size_t dataSize = 0, char* data = nullptr) override; 34 | 35 | void setMaterial(AssetTypeId materialId); 36 | void setMaterial(MaterialAsset* material); 37 | 38 | float getScale(); 39 | MaterialAsset* getMaterial(); 40 | VMesh* getMesh(); 41 | 42 | protected: 43 | bool loadFromXML(TiXmlHandle *); 44 | bool loadModelFromObj(const std::string &filePath); 45 | 46 | 47 | bool generateModel(const std::vector &vertexList, 48 | const std::vector &uvList, 49 | const std::vector &normalList, 50 | const std::vector &indexList); 51 | 52 | bool generateModel(std::vector &vertexList, 53 | std::vector &indexList); 54 | 55 | 56 | private: 57 | bool m_materialsLoaded; 58 | MaterialAsset *m_material; //Could be vector 59 | 60 | bool m_meshLoaded; 61 | VMesh *m_mesh; 62 | 63 | float m_scale; 64 | }; 65 | 66 | 67 | } 68 | 69 | #endif // MESHASSET_H 70 | -------------------------------------------------------------------------------- /Valag/include/Valag/assets/MeshesHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef MESHESHANDLER_H 2 | #define MESHESHANDLER_H 3 | 4 | #include "Valag/assets/AssetHandler.h" 5 | #include "Valag/assets/MeshAsset.h" 6 | 7 | namespace vlg 8 | { 9 | 10 | class MeshesHandler : public AssetHandler 11 | { 12 | public: 13 | MeshesHandler(); 14 | virtual ~MeshesHandler(); 15 | 16 | static MeshAsset *makeQuad(glm::vec2 corner, glm::vec2 extent, 17 | MaterialAsset *material, 18 | glm::vec2 texCorner = {0,0}, glm::vec2 texExtent = {1.0,1.0}); 19 | 20 | static MeshAsset *makeBox(glm::vec3 corner, glm::vec3 extent, 21 | MaterialAsset *material); 22 | 23 | static MeshAsset *makeMesh(std::vector &vertexList, 24 | std::vector &indexList, 25 | MaterialAsset *material); 26 | 27 | protected: 28 | 29 | private: 30 | }; 31 | 32 | } 33 | 34 | #endif // MESHESHANDLER_H 35 | -------------------------------------------------------------------------------- /Valag/include/Valag/assets/TextureAsset.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTUREASSET_H 2 | #define TEXTUREASSET_H 3 | 4 | //#define GLFW_INCLUDE_VULKAN 5 | //#include 6 | 7 | //#include 8 | //#include 9 | 10 | #include "Valag/vulkanImpl/vulkanImpl.h" 11 | #include "Valag/vulkanImpl/VTexture.h" 12 | 13 | #include "Valag/assets/Asset.h" 14 | 15 | namespace vlg 16 | { 17 | 18 | class VInstance; 19 | 20 | class TextureAsset : public Asset 21 | { 22 | friend class VApp; 23 | 24 | public: 25 | TextureAsset(); 26 | TextureAsset(const AssetTypeId); 27 | virtual ~TextureAsset(); 28 | 29 | bool loadFromFile(const std::string &filePath); 30 | bool loadFromMemory(void* data, std::size_t dataSize); 31 | 32 | ///void generateMipmap(); 33 | ///void setSmooth(bool = true); 34 | 35 | 36 | 37 | VTexture getVTexture(); 38 | 39 | protected: 40 | VTexture m_vtexture; 41 | 42 | glm::vec2 m_size; 43 | }; 44 | 45 | } 46 | 47 | #endif // TEXTUREASSET_H 48 | -------------------------------------------------------------------------------- /Valag/include/Valag/core/Config.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIG_H 2 | #define CONFIG_H 3 | 4 | #include 5 | #include 6 | #include "Valag/utils/singleton.h" 7 | 8 | namespace vlg{ 9 | 10 | typedef std::map ConfigSection; 11 | 12 | class Config : public Singleton 13 | { 14 | 15 | public: 16 | friend class Singleton; 17 | 18 | bool load(const std::string&); 19 | 20 | static bool getBool(const std::string& s, const std::string& n, const std::string& d=0); 21 | static int getInt(const std::string& s, const std::string& n, const std::string& d=0); 22 | static float getFloat(const std::string& s, const std::string& n, const std::string& d=0); 23 | static const std::string& getString(const std::string& s, const std::string& n, const std::string& d=0); 24 | 25 | protected: 26 | Config(); 27 | virtual ~Config(); 28 | 29 | private: 30 | std::map m_sections; 31 | }; 32 | 33 | } 34 | 35 | #endif // CONFIG_H 36 | -------------------------------------------------------------------------------- /Valag/include/Valag/core/GameState.h: -------------------------------------------------------------------------------- 1 | #ifndef GAMESTATE_H 2 | #define GAMESTATE_H 3 | 4 | #include "Valag/Types.h" 5 | #include "Valag/core/StatesManager.h" 6 | #include "Valag/core/EventsManager.h" 7 | 8 | namespace vlg 9 | { 10 | 11 | class GameState 12 | { 13 | public: 14 | GameState(); 15 | virtual ~GameState(); 16 | 17 | virtual void entered() = 0; 18 | virtual void leaving() = 0; 19 | virtual void revealed() = 0; 20 | virtual void obscuring() = 0; 21 | 22 | virtual void handleEvents(const EventsManager *eventsManager) = 0; 23 | virtual void update(const Time &elapsedTime) = 0; 24 | virtual void draw(RenderWindow *renderWindow) = 0; 25 | 26 | void setManager(StatesManager *); 27 | 28 | void pause(); 29 | void resume(); 30 | 31 | protected: 32 | StatesManager *m_manager; 33 | 34 | private: 35 | bool m_running; 36 | }; 37 | 38 | } 39 | 40 | #endif // GAMESTATE_H 41 | 42 | 43 | -------------------------------------------------------------------------------- /Valag/include/Valag/core/NotificationListener.h: -------------------------------------------------------------------------------- 1 | #ifndef NOTIFICATIONLISTENER_H 2 | #define NOTIFICATIONLISTENER_H 3 | 4 | #include 5 | 6 | #include "Valag/Types.h" 7 | 8 | namespace vlg 9 | { 10 | 11 | class NotificationSender; 12 | 13 | class NotificationListener 14 | { 15 | friend class NotificationSender; 16 | 17 | public: 18 | NotificationListener(); 19 | virtual ~NotificationListener(); 20 | 21 | void stopListeningTo(NotificationSender*); 22 | void startListeningTo(NotificationSender*); 23 | 24 | protected: 25 | virtual void notify(NotificationSender*, NotificationType, 26 | size_t dataSize = 0, char* data = nullptr) = 0; 27 | 28 | private: 29 | void addSender(NotificationSender*); 30 | void notifySenderDestruction(NotificationSender*); 31 | 32 | std::set m_senders; 33 | }; 34 | 35 | } 36 | 37 | #endif // NOTIFICATIONLISTENER_H 38 | -------------------------------------------------------------------------------- /Valag/include/Valag/core/NotificationSender.h: -------------------------------------------------------------------------------- 1 | #ifndef NOTIFICATIONSENDER_H 2 | #define NOTIFICATIONSENDER_H 3 | 4 | #include 5 | #include 6 | 7 | #include "Valag/Types.h" 8 | 9 | namespace vlg 10 | { 11 | 12 | class NotificationListener; 13 | 14 | class NotificationSender 15 | { 16 | public: 17 | NotificationSender(); 18 | virtual ~NotificationSender(); 19 | 20 | void addToAllNotificationList(NotificationListener *); 21 | void addToNotificationList(NotificationListener *, NotificationType); 22 | 23 | void removeFromNotificationList(NotificationListener *, NotificationType); 24 | void removeFromAllNotificationList(NotificationListener *); 25 | 26 | protected: 27 | void sendNotification(NotificationType, size_t dataSize = 0, char* data = nullptr); 28 | 29 | private: 30 | std::set m_listenerToNotifyEverything; 31 | std::map > m_listenerToNotify; 32 | }; 33 | 34 | } 35 | 36 | #endif // NOTIFICATIONSENDER_H 37 | -------------------------------------------------------------------------------- /Valag/include/Valag/core/StatesManager.h: -------------------------------------------------------------------------------- 1 | #ifndef STATESMANAGER_H 2 | #define STATESMANAGER_H 3 | 4 | #include 5 | 6 | #include "Valag/core/EventsManager.h" 7 | #include "Valag/renderers/RenderWindow.h" 8 | 9 | namespace vlg 10 | { 11 | 12 | class VApp; 13 | class GameState; 14 | 15 | class StatesManager 16 | { 17 | friend class VApp; 18 | 19 | public: 20 | StatesManager(); 21 | virtual ~StatesManager(); 22 | 23 | void stop(); 24 | void switchState(GameState*); 25 | void pushState(GameState*); 26 | GameState* popState(); //Return new current state 27 | GameState* peekState(); 28 | 29 | void handleEvents(const EventsManager *eventsManager); 30 | void update(const Time &elapsedTime); 31 | void draw(RenderWindow *renderWindow); 32 | 33 | VApp* getApp(); 34 | 35 | protected: 36 | void attachApp(VApp*); 37 | 38 | private: 39 | std::vector m_states; 40 | VApp *m_attachedApp; 41 | }; 42 | 43 | } 44 | 45 | #endif // STATESMANAGER_H 46 | -------------------------------------------------------------------------------- /Valag/include/Valag/gfx/Drawable.h: -------------------------------------------------------------------------------- 1 | #ifndef DRAWABLE_H 2 | #define DRAWABLE_H 3 | 4 | #include "Valag/vulkanImpl/VulkanImpl.h" 5 | 6 | #include "Valag/core/NotificationListener.h" 7 | 8 | namespace vlg 9 | { 10 | 11 | class DefaultRenderer; 12 | 13 | class Drawable : public NotificationListener 14 | { 15 | public: 16 | Drawable(); 17 | virtual ~Drawable(); 18 | 19 | ///Specifying framebuffer may induce better performances 20 | virtual VkCommandBuffer getDrawCommandBuffer(DefaultRenderer *renderer, size_t frameIndex, VkRenderPass renderPass, 21 | uint32_t subpass, VkFramebuffer framebuffer = VK_NULL_HANDLE); 22 | 23 | 24 | protected: 25 | virtual bool recordDrawCommandBuffers(DefaultRenderer *renderer, size_t frameIndex, VkRenderPass renderPass, 26 | uint32_t subpass, VkFramebuffer framebuffer) = 0; 27 | 28 | virtual void createDrawCommandBuffers(); 29 | virtual bool updateDrawCmb(DefaultRenderer *renderer, size_t frameIndex, VkRenderPass renderPass, 30 | uint32_t subpass, VkFramebuffer framebuffer); 31 | 32 | void askToUpdateDrawCmb(size_t frameIndex); 33 | 34 | virtual void notify(NotificationSender* , NotificationType, 35 | size_t dataSize = 0, char* data = nullptr) override; 36 | 37 | 38 | std::vector m_drawCommandBuffers; 39 | 40 | private: 41 | bool m_needToCreateDrawCmb; 42 | std::vector m_needToUpdateDrawCmb; 43 | }; 44 | 45 | } 46 | 47 | #endif // DRAWABLE_H 48 | -------------------------------------------------------------------------------- /Valag/include/Valag/gfx/SpritesBatch.h: -------------------------------------------------------------------------------- 1 | #ifndef SPRITESBATCH_H 2 | #define SPRITESBATCH_H 3 | 4 | #include 5 | #include 6 | 7 | #include "Valag/gfx/Sprite.h" 8 | #include "Valag/core/NotificationListener.h" 9 | 10 | 11 | #include "Valag/renderers/InstancingRenderer.h" 12 | 13 | namespace vlg 14 | { 15 | 16 | 17 | class SpritesBatch : public Drawable 18 | { 19 | public: 20 | SpritesBatch(bool enableSorting = true); 21 | virtual ~SpritesBatch(); 22 | 23 | void addSprite(Sprite *sprite); 24 | bool removeSprite(Sprite *sprite); 25 | 26 | VkCommandBuffer getDrawCommandBuffer(DefaultRenderer *renderer, size_t frameIndex, VkRenderPass renderPass, 27 | uint32_t subpass, VkFramebuffer framebuffer = VK_NULL_HANDLE); 28 | 29 | void draw(InstancingRenderer *renderer); 30 | 31 | protected: 32 | bool recordDrawCommandBuffers(DefaultRenderer *renderer, size_t frameIndex, VkRenderPass renderPass, 33 | uint32_t subpass, VkFramebuffer framebuffer = VK_NULL_HANDLE); 34 | 35 | virtual void notify(NotificationSender* , NotificationType, 36 | size_t dataSize = 0, char* data = nullptr) override; 37 | 38 | private: 39 | // std::set m_sprites; 40 | // std::list m_sprites; 41 | bool m_enableSorting; 42 | std::map > m_sortedSprites; 43 | }; 44 | 45 | } 46 | 47 | #endif // SPRITESBATCH_H 48 | -------------------------------------------------------------------------------- /Valag/include/Valag/renderers/DefaultRenderer.h: -------------------------------------------------------------------------------- 1 | #ifndef DEFAULTRENDERER_H 2 | #define DEFAULTRENDERER_H 3 | 4 | #include "Valag/renderers/AbstractRenderer.h" 5 | #include "Valag/vulkanImpl/DynamicUBODescriptor.h" 6 | #include "Valag/vulkanImpl/VTexturesManager.h" 7 | #include "Valag/gfx/Drawable.h" 8 | 9 | 10 | namespace vlg 11 | { 12 | 13 | class DefaultRenderer : public AbstractRenderer 14 | { 15 | friend class VApp; 16 | friend class Sprite; 17 | friend class SpritesBatch; 18 | 19 | public: 20 | DefaultRenderer(RenderWindow *targetWindow, RendererName name, RenderereOrder order); 21 | virtual ~DefaultRenderer(); 22 | 23 | virtual void update(size_t frameIndex); 24 | 25 | void draw(Drawable *drawable); 26 | 27 | protected: 28 | virtual bool init(); 29 | virtual void cleanup(); 30 | 31 | virtual bool createDescriptorSetLayouts(); 32 | virtual bool createGraphicsPipeline(); 33 | 34 | virtual bool recordPrimaryCmb(uint32_t imageIndex); 35 | 36 | void bindPipeline(VkCommandBuffer &commandBuffer, size_t frameIndex); 37 | bool bindTexture(VkCommandBuffer &commandBuffer, AssetTypeId textureId, size_t frameIndex); 38 | void bindModelDescriptorSet(size_t frameIndex, VkCommandBuffer &commandBuffer, DynamicUBODescriptor &descSet, size_t index = 0); 39 | 40 | 41 | private: 42 | std::vector m_activeSecondaryCommandBuffers; 43 | 44 | VGraphicsPipeline m_pipeline; 45 | 46 | static const char *DEFAULT_VERTSHADERFILE; 47 | static const char *DEFAULT_FRAGSHADERFILE; 48 | 49 | static const float DEPTH_SCALING_FACTOR; 50 | }; 51 | 52 | } 53 | 54 | #endif // DEFAULTRENDERER_H 55 | -------------------------------------------------------------------------------- /Valag/include/Valag/renderers/InstancingRenderer.h: -------------------------------------------------------------------------------- 1 | #ifndef INSTANCINGRENDERER_H 2 | #define INSTANCINGRENDERER_H 3 | 4 | #include "Valag/renderers/AbstractRenderer.h" 5 | 6 | #include "Valag/gfx/Sprite.h" 7 | #include "Valag/vulkanImpl/DynamicVBO.h" 8 | 9 | namespace vlg 10 | { 11 | 12 | class SpritesBatch; 13 | 14 | struct InstanciedSpriteDatum 15 | { 16 | glm::vec4 model_0; 17 | glm::vec4 model_1; 18 | glm::vec4 model_2; 19 | glm::vec4 model_3; 20 | glm::vec4 color; 21 | glm::vec2 texPos; 22 | glm::vec2 texExtent; 23 | glm::vec2 texId; 24 | 25 | static VkVertexInputBindingDescription getBindingDescription(); 26 | static std::array getAttributeDescriptions(); 27 | }; 28 | 29 | 30 | 31 | class InstancingRenderer : public AbstractRenderer 32 | { 33 | public: 34 | InstancingRenderer(RenderWindow *targetWindow, RendererName name, RenderereOrder order); 35 | virtual ~InstancingRenderer(); 36 | 37 | void update(size_t frameIndex); 38 | 39 | void draw(Sprite* sprite); 40 | void draw(SpritesBatch* spritesBatch); 41 | 42 | protected: 43 | virtual bool init(); 44 | virtual void cleanup(); 45 | 46 | virtual bool createDescriptorSetLayouts(); 47 | virtual bool createGraphicsPipeline(); 48 | 49 | virtual bool recordPrimaryCmb(uint32_t imageIndex); 50 | 51 | protected: 52 | std::vector*> m_spritesVbos; 53 | 54 | VGraphicsPipeline m_pipeline; 55 | 56 | private: 57 | static const char *INSTANCING_VERTSHADERFILE; 58 | static const char *INSTANCING_FRAGSHADERFILE; 59 | 60 | static const float DEPTH_SCALING_FACTOR; 61 | }; 62 | 63 | } 64 | 65 | #endif // INSTANCINGRENDERER_H 66 | -------------------------------------------------------------------------------- /Valag/include/Valag/renderers/PBRToolbox.h: -------------------------------------------------------------------------------- 1 | #ifndef PBRTOOLBOX_H 2 | #define PBRTOOLBOX_H 3 | 4 | #include "Valag/utils/Singleton.h" 5 | #include "Valag/vulkanImpl/VulkanImpl.h" 6 | 7 | namespace vlg 8 | { 9 | 10 | class PBRToolbox : public Singleton 11 | { 12 | public: 13 | friend class Singleton; 14 | 15 | static VFramebufferAttachment getBrdflut(); 16 | 17 | static VFramebufferAttachment generateFilteredEnvMap(VTexture src); 18 | 19 | void cleanup(); 20 | 21 | protected: 22 | PBRToolbox(); 23 | virtual ~PBRToolbox(); 24 | 25 | bool generateBrdflut(); 26 | 27 | 28 | private: 29 | VFramebufferAttachment m_brdflutAttachement; 30 | 31 | public: 32 | static const char *BRDFLUT_VERTSHADERFILE; 33 | static const char *BRDFLUT_FRAGSHADERFILE; 34 | 35 | static const char *IBLFILTERING_VERTSHADERFILE; 36 | static const char *IBLFILTERING_FRAGSHADERFILE; 37 | 38 | static const int ENVMAP_FILTERINGMIPSCOUNT; 39 | 40 | }; 41 | 42 | } 43 | 44 | #endif // PBRTOOLBOX_H 45 | -------------------------------------------------------------------------------- /Valag/include/Valag/scene/CameraObject.h: -------------------------------------------------------------------------------- 1 | #ifndef CAMERAOBJECT_H 2 | #define CAMERAOBJECT_H 3 | 4 | #include "Valag/scene/SceneObject.h" 5 | 6 | namespace vlg 7 | { 8 | 9 | ///Add viewport, etc 10 | 11 | class CameraObject : public SceneObject 12 | { 13 | public: 14 | CameraObject(); 15 | virtual ~CameraObject(); 16 | 17 | void setViewport(glm::vec2 offset, glm::vec2 extent); //Normalized viewport 18 | 19 | void setZoom(float zoom); 20 | void zoom(float zoomFactor); 21 | 22 | float getZoom(); 23 | glm::vec2 getViewportOffset(); 24 | glm::vec2 getViewportExtent(); 25 | 26 | protected: 27 | float m_zoom; 28 | glm::vec2 m_offset; 29 | glm::vec2 m_extent; 30 | 31 | private: 32 | }; 33 | 34 | } 35 | 36 | #endif // CAMERAOBJECT_H 37 | -------------------------------------------------------------------------------- /Valag/include/Valag/scene/SceneEntity.h: -------------------------------------------------------------------------------- 1 | #ifndef SCENEENTITY_H 2 | #define SCENEENTITY_H 3 | 4 | #include "Valag/scene/SceneObject.h" 5 | 6 | /** Any scene object that can be rendered on screen **/ 7 | 8 | namespace vlg 9 | { 10 | 11 | class SceneRenderingInstance; 12 | 13 | 14 | ///Maybe this should be renamed in EntityObject 15 | class SceneEntity : public SceneObject 16 | { 17 | public: 18 | SceneEntity(); 19 | virtual ~SceneEntity(); 20 | 21 | bool isVisible(); 22 | void setVisible(bool = true); 23 | 24 | //virtual void draw(SceneRenderer *renderer) = 0; 25 | virtual void generateRenderingData(SceneRenderingInstance *renderingInstance) = 0; 26 | 27 | protected: 28 | bool m_isVisible; 29 | }; 30 | 31 | } 32 | 33 | #endif // SCENEENTITY_H 34 | -------------------------------------------------------------------------------- /Valag/include/Valag/scene/SceneObject.h: -------------------------------------------------------------------------------- 1 | #ifndef SCENEOBJECT_H 2 | #define SCENEOBJECT_H 3 | 4 | #include "Valag/Types.h" 5 | #include "Valag/core/NotificationListener.h" 6 | 7 | /** Any object that can be put in a scene : instance of sprite or mesh, ligth source, camera, ambient sound, ... **/ 8 | 9 | namespace vlg 10 | { 11 | 12 | class SceneNode; 13 | 14 | class SceneObject : public NotificationListener 15 | { 16 | friend class SceneNode; 17 | 18 | public: 19 | SceneObject(); 20 | virtual ~SceneObject(); 21 | 22 | SceneNode *getParentNode(); 23 | 24 | bool isALight(); 25 | bool isAnEntity(); 26 | bool isAShadowCaster(); 27 | 28 | virtual void update(const Time &elapsedTime); 29 | virtual void notify(NotificationSender* , NotificationType, 30 | size_t dataSize = 0, char* data = nullptr) override; 31 | 32 | protected: 33 | SceneNode *setParentNode(SceneNode*); 34 | SceneNode *m_parentNode; 35 | 36 | bool m_isALight; 37 | bool m_isAnEntity; 38 | bool m_isAShadowCaster; 39 | 40 | private: 41 | }; 42 | 43 | } 44 | 45 | #endif // SCENEOBJECT_H 46 | -------------------------------------------------------------------------------- /Valag/include/Valag/scene/ShadowCaster.h: -------------------------------------------------------------------------------- 1 | #ifndef SHADOWCASTER_H 2 | #define SHADOWCASTER_H 3 | 4 | #include "Valag/scene/SceneEntity.h" 5 | 6 | namespace vlg 7 | { 8 | 9 | class LightEntity; 10 | class SceneRenderer; 11 | 12 | class ShadowCaster : public SceneEntity 13 | { 14 | public: 15 | ShadowCaster(); 16 | virtual ~ShadowCaster(); 17 | 18 | //void addLightSource(); 19 | 20 | void setShadowCasting(ShadowCastingType type); 21 | 22 | ShadowCastingType getShadowCastingType(); 23 | 24 | virtual glm::vec2 castShadow(SceneRenderer *renderer, LightEntity* light) = 0; 25 | 26 | //virtual void notify(NotificationSender*, NotificationType); 27 | 28 | protected: 29 | 30 | protected: 31 | ShadowCastingType m_shadowCastingType; 32 | 33 | // std::set m_lightSources; 34 | }; 35 | 36 | } 37 | 38 | #endif // SHADOWCASTER_H 39 | -------------------------------------------------------------------------------- /Valag/include/Valag/utils/Clock.h: -------------------------------------------------------------------------------- 1 | #ifndef CLOCK_H 2 | #define CLOCK_H 3 | 4 | #include "Valag/Types.h" 5 | 6 | namespace vlg 7 | { 8 | 9 | Time TimeZero(); 10 | 11 | class Clock 12 | { 13 | public: 14 | Clock(); 15 | virtual ~Clock(); 16 | 17 | Time restart(); 18 | Time elapsedTime(); 19 | 20 | private: 21 | std::chrono::time_point m_lastTime; 22 | }; 23 | 24 | } 25 | 26 | #endif // CLOCK_H 27 | -------------------------------------------------------------------------------- /Valag/include/Valag/utils/Logger.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGGER_H 2 | #define LOGGER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "Singleton.h" 9 | 10 | class Logger : public Singleton 11 | { 12 | public: 13 | friend class Singleton; 14 | 15 | static void write(const std::ostringstream&); 16 | static void warning(const std::ostringstream&); 17 | static void error(const std::ostringstream&); 18 | static void fatalError(const std::ostringstream&); 19 | 20 | static void write(const std::string&); 21 | static void warning(const std::string&); 22 | static void error(const std::string&); 23 | static void fatalError(const std::string&); 24 | 25 | void enableConsoleWriting(); 26 | void disableConsoleWriting(); 27 | 28 | protected: 29 | Logger(); 30 | virtual ~Logger(); 31 | 32 | std::mutex m_loggerMutex; 33 | 34 | private: 35 | std::ofstream *m_fileStream; 36 | bool m_enableConsoleWriting; 37 | bool m_enableWarnings; 38 | 39 | static const char *DEFAULT_LOG_PATH; 40 | }; 41 | 42 | #endif // LOGGER_H 43 | -------------------------------------------------------------------------------- /Valag/include/Valag/utils/Parser.h: -------------------------------------------------------------------------------- 1 | #ifndef PARSER_H 2 | #define PARSER_H 3 | 4 | #include "Valag/utils/singleton.h" 5 | 6 | ///I should maybe switch to functions in a namespace 7 | 8 | class Parser : public Singleton 9 | { 10 | public: 11 | friend class Singleton; 12 | 13 | static bool isBool(const std::string&); 14 | static bool isInt(const std::string&); 15 | static bool isFloat(const std::string&); 16 | 17 | static bool parseBool(const std::string&); 18 | static int parseInt(const std::string&); 19 | static float parseFloat(const std::string&); 20 | 21 | static std::string findFileDirectory(const std::string&); 22 | 23 | protected: 24 | Parser(); 25 | virtual ~Parser(); 26 | 27 | private: 28 | }; 29 | 30 | #endif // PARSER_H 31 | -------------------------------------------------------------------------------- /Valag/include/Valag/utils/Profiler.h: -------------------------------------------------------------------------------- 1 | #ifndef PROFILER_H 2 | #define PROFILER_H 3 | 4 | #include "Valag/utils/Clock.h" 5 | #include "Valag/utils/Singleton.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace vlg 12 | { 13 | 14 | struct ProfilerClock 15 | { 16 | Clock clock; 17 | std::string text; 18 | }; 19 | 20 | struct ProfilerTime 21 | { 22 | Time time; 23 | std::string text; 24 | }; 25 | 26 | class Profiler : public Singleton 27 | { 28 | public: 29 | friend class Singleton; 30 | 31 | static void resetLoop(bool print); 32 | static void pushClock(const std::string&); 33 | static void popClock(); 34 | 35 | protected: 36 | Profiler(); 37 | virtual ~Profiler(); 38 | 39 | std::mutex m_profilerMutex; 40 | 41 | private: 42 | Clock m_loopClock; 43 | std::stack m_clocks; 44 | std::list m_times; 45 | 46 | }; 47 | 48 | } 49 | 50 | #endif // PROFILER_H 51 | 52 | 53 | -------------------------------------------------------------------------------- /Valag/include/Valag/utils/Singleton.h: -------------------------------------------------------------------------------- 1 | #ifndef SINGLETON_H_INCLUDED 2 | #define SINGLETON_H_INCLUDED 3 | 4 | #include 5 | #include 6 | #include 7 | #include "SingletonsCleaner.h" 8 | 9 | template class Singleton : public KillableSingleton 10 | { 11 | public: 12 | 13 | static T* instance() 14 | { 15 | T* tmp = m_instance.load(std::memory_order_relaxed); 16 | std::atomic_thread_fence(std::memory_order_acquire); 17 | if (tmp == nullptr) { 18 | std::lock_guard lock(m_mutex); 19 | tmp = m_instance.load(std::memory_order_relaxed); 20 | if (tmp == nullptr) { 21 | tmp = new T; 22 | std::atomic_thread_fence(std::memory_order_release); 23 | m_instance.store(tmp, std::memory_order_relaxed); 24 | SingletonsCleaner::addToList(tmp); 25 | } 26 | } 27 | return tmp; 28 | } 29 | 30 | protected: 31 | 32 | Singleton(){} 33 | virtual ~Singleton(){} 34 | 35 | static std::atomic m_instance; 36 | static std::mutex m_mutex; 37 | 38 | private: 39 | 40 | virtual void kill() 41 | { 42 | T* tmp = m_instance.load(std::memory_order_relaxed); 43 | if(tmp != nullptr) 44 | { 45 | SingletonsCleaner::removeFromList(tmp); 46 | delete tmp; 47 | m_instance.store(nullptr); 48 | } 49 | } 50 | }; 51 | 52 | template std::atomic Singleton::m_instance; 53 | template std::mutex Singleton::m_mutex; 54 | 55 | 56 | #endif // SINGLETON_H_INCLUDED 57 | -------------------------------------------------------------------------------- /Valag/include/Valag/utils/SingletonsCleaner.h: -------------------------------------------------------------------------------- 1 | #ifndef SINGLETONSCLEANER_H 2 | #define SINGLETONSCLEANER_H 3 | 4 | #include 5 | 6 | class KillableSingleton 7 | { 8 | friend class SingletonsCleaner; 9 | 10 | protected: 11 | KillableSingleton(){} 12 | virtual ~KillableSingleton(){} 13 | 14 | private: 15 | virtual void kill() = 0; 16 | }; 17 | 18 | class SingletonsCleaner 19 | { 20 | public: 21 | static SingletonsCleaner* instance(void); 22 | static void addToList(KillableSingleton* singleton); 23 | static void cleanAll(); 24 | static void removeFromList(KillableSingleton* singleton); 25 | 26 | protected: 27 | 28 | SingletonsCleaner(){} 29 | virtual ~SingletonsCleaner(){cleanAll();} 30 | 31 | std::list m_singletonsList; 32 | 33 | static SingletonsCleaner m_instance; 34 | }; 35 | 36 | 37 | #endif // SINGLETONSCLEANER_H 38 | -------------------------------------------------------------------------------- /Valag/include/Valag/vulkanImpl/DynamicUBO.h: -------------------------------------------------------------------------------- 1 | #ifndef DYNAMICUBO_H 2 | #define DYNAMICUBO_H 3 | 4 | #include 5 | 6 | #include "Valag/vulkanImpl/VInstance.h" 7 | #include "Valag/vulkanImpl/VBuffersAllocator.h" 8 | 9 | namespace vlg 10 | { 11 | 12 | class DynamicUBO 13 | { 14 | public: 15 | DynamicUBO(size_t objectSize, size_t chunkSize ); 16 | virtual ~DynamicUBO(); 17 | 18 | DynamicUBO( const DynamicUBO& ) = delete; 19 | DynamicUBO& operator=( const DynamicUBO& ) = delete; 20 | 21 | bool allocObject(size_t &index); 22 | bool freeObject(size_t index); 23 | bool isFull(); 24 | 25 | bool updateObject(size_t index, void *data); 26 | 27 | void expandBuffers(bool destroyOldBUffers = true); 28 | 29 | uint32_t getDynamicOffset(size_t index); 30 | 31 | VBuffer getBuffer(); 32 | size_t getBufferVersion(); 33 | 34 | protected: 35 | void computeDynamicAlignment(); 36 | void createBuffers(); 37 | void cleanup(); 38 | 39 | private: 40 | size_t m_objectSize; 41 | size_t m_chunkSize; 42 | size_t m_dynamicAlignment; 43 | 44 | VBuffer m_buffer; 45 | VkDeviceSize m_bufferSize; 46 | size_t m_totalSize; 47 | 48 | std::list m_availableIndices; 49 | 50 | size_t m_bufferVersion; 51 | bool m_firstTime; 52 | }; 53 | 54 | } 55 | 56 | #endif // DYNAMICUBO_H 57 | -------------------------------------------------------------------------------- /Valag/include/Valag/vulkanImpl/DynamicUBODescriptor.h: -------------------------------------------------------------------------------- 1 | #ifndef DYNAMICUBODESCRIPTOR_H 2 | #define DYNAMICUBODESCRIPTOR_H 3 | 4 | #include "Valag/vulkanImpl/DynamicUBO.h" 5 | 6 | ///Maybe this class is to specific to be in vulkanImpl 7 | 8 | namespace vlg 9 | { 10 | 11 | class DynamicUBODescriptor 12 | { 13 | public: 14 | DynamicUBODescriptor(size_t objectSize, size_t chunkSize); 15 | virtual ~DynamicUBODescriptor(); 16 | 17 | DynamicUBODescriptor( const DynamicUBODescriptor& ) = delete; 18 | DynamicUBODescriptor& operator=( const DynamicUBODescriptor& ) = delete; 19 | 20 | bool init(size_t framesCount); 21 | void update(size_t frameIndex); //Expands UBOs 22 | void cleanup(); 23 | 24 | bool allocObject(size_t frameIndex, size_t &index); 25 | bool freeObject(size_t frameIndex, size_t index); 26 | bool updateObject(size_t frameIndex, size_t index, void *data); 27 | 28 | size_t getBufferVersion(size_t frameIndex); 29 | 30 | VkDescriptorSetLayout getDescriptorSetLayout(); 31 | VkDescriptorSet getDescriptorSet(size_t frameIndex); 32 | uint32_t getDynamicOffset(size_t frameIndex, size_t index); 33 | 34 | protected: 35 | bool createDescriptorSetLayouts(); 36 | bool createDescriptorPool(size_t framesCount); 37 | bool createDescriptorSets(size_t framesCount); 38 | 39 | void updateDescriptorSets(size_t frameIndex); 40 | 41 | private: 42 | std::vector m_needToExpandBuffers; 43 | std::vector m_buffers; 44 | VkDescriptorSetLayout m_descriptorSetLayout; 45 | VkDescriptorPool m_descriptorPool; 46 | std::vector m_descriptorSets; 47 | 48 | size_t m_objectSize; 49 | size_t m_chunkSize; 50 | 51 | }; 52 | 53 | } 54 | 55 | #endif // DYNAMICUBODESCRIPTOR_H 56 | -------------------------------------------------------------------------------- /Valag/include/Valag/vulkanImpl/DynamicVBO.h: -------------------------------------------------------------------------------- 1 | #ifndef DYNAMICVBO_H 2 | #define DYNAMICVBO_H 3 | 4 | #include "Valag/vulkanImpl/VBuffersAllocator.h" 5 | 6 | namespace vlg 7 | { 8 | 9 | template class DynamicVBO 10 | { 11 | public: 12 | DynamicVBO(size_t chunkSize); 13 | virtual ~DynamicVBO(); 14 | 15 | DynamicVBO( const DynamicVBO& ) = delete; 16 | DynamicVBO& operator=( const DynamicVBO& ) = delete; 17 | 18 | void push_back(const T &datum); 19 | 20 | size_t uploadVBO(); //return buffer size 21 | 22 | size_t getSize(); 23 | size_t getUploadedSize(); 24 | VBuffer getBuffer(); 25 | 26 | protected: 27 | void cleanup(); 28 | bool expand(); 29 | 30 | private: 31 | size_t m_chunkSize; 32 | 33 | size_t m_curSize; 34 | size_t m_lastSize; 35 | std::vector m_content; 36 | VBuffer m_buffer; 37 | }; 38 | 39 | } 40 | #include "../src/vulkanImpl/DynamicVBO.inc" 41 | 42 | #endif // DYNAMICVBO_H 43 | -------------------------------------------------------------------------------- /Valag/include/Valag/vulkanImpl/VCommandBuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef VCOMMANDBUFFER_H 2 | #define VCOMMANDBUFFER_H 3 | 4 | #include "Valag/vulkanImpl/VulkanHelpers.h" 5 | #include "Valag/vulkanImpl/VRenderPass.h" 6 | #include "Valag/vulkanImpl/VRenderTarget.h" 7 | 8 | namespace vlg 9 | { 10 | 11 | class VCommandBuffer 12 | { 13 | public: 14 | VCommandBuffer(); 15 | virtual ~VCommandBuffer(); 16 | 17 | VCommandBuffer( const VCommandBuffer& ) = delete; 18 | VCommandBuffer& operator=( const VCommandBuffer& ) = delete; 19 | 20 | bool init(size_t buffersCount); 21 | 22 | void setCmbUsage(VkFlags usage); 23 | VkFlags getCmbUsage(); 24 | 25 | const VkCommandBuffer *getVkCommandBuffer(size_t cmbIndex); 26 | 27 | VkCommandBuffer startRecording(size_t cmbIndex); 28 | VkCommandBuffer startRecording(size_t cmbIndex, size_t framebufferIndex, VkSubpassContents contents, 29 | VRenderPass* renderPass, VRenderTarget *renderTarget); 30 | void nextRenderPass(size_t framebufferIndex, VkSubpassContents contents, 31 | VRenderPass* renderPass, VRenderTarget *renderTarget); 32 | bool endRecording(); 33 | 34 | protected: 35 | bool createBuffers(); 36 | 37 | protected: 38 | size_t m_buffersCount; 39 | VkFlags m_cmbUsage; 40 | 41 | size_t m_lastRecording; 42 | bool m_inRenderPass; 43 | 44 | std::vector m_cmbs; 45 | }; 46 | 47 | } 48 | 49 | #endif // VCOMMANDBUFFER_H 50 | -------------------------------------------------------------------------------- /Valag/include/Valag/vulkanImpl/VMesh.h: -------------------------------------------------------------------------------- 1 | #ifndef VMESH_H 2 | #define VMESH_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "Valag/Types.h" 10 | #include "Valag/VulkanImpl/VBuffersAllocator.h" 11 | 12 | namespace vlg 13 | { 14 | 15 | struct MeshVertex 16 | { 17 | glm::vec3 pos; 18 | glm::vec2 uv; 19 | glm::vec3 normal; 20 | glm::vec3 tangent; 21 | glm::vec3 bitangent; 22 | 23 | /*glm::vec4 albedo_color; 24 | glm::vec3 rmt_color; 25 | 26 | glm::uvec2 albedo_texId; 27 | glm::uvec2 height_texId; 28 | glm::uvec2 normal_texId; 29 | glm::uvec2 rmt_texId;*/ 30 | 31 | 32 | static VkVertexInputBindingDescription getBindingDescription(); 33 | static std::array getAttributeDescriptions(); 34 | }; 35 | 36 | 37 | class VMesh 38 | { 39 | public: 40 | VMesh(); 41 | virtual ~VMesh(); 42 | 43 | VMesh( const VMesh& ) = delete; 44 | VMesh& operator=( const VMesh& ) = delete; 45 | 46 | bool generateMesh( std::vector &vertexList, 47 | std::vector &indexList, 48 | CommandPoolName poolName = COMMANDPOOL_SHORTLIVED); 49 | 50 | VBuffer getVertexBuffer(); 51 | VBuffer getIndexBuffer(); 52 | size_t getIndexCount(); 53 | 54 | protected: 55 | VBuffer m_vertexBuffer; 56 | VBuffer m_indexBuffer; 57 | size_t m_indexCount; 58 | 59 | }; 60 | 61 | } 62 | 63 | #endif // VMESH_H 64 | -------------------------------------------------------------------------------- /Valag/include/Valag/vulkanImpl/VRenderPass.h: -------------------------------------------------------------------------------- 1 | #ifndef VRENDERPASS_H 2 | #define VRENDERPASS_H 3 | 4 | #include 5 | #include 6 | 7 | #include "Valag/vulkanImpl/VulkanHelpers.h" 8 | 9 | 10 | namespace vlg 11 | { 12 | 13 | class VRenderPass 14 | { 15 | public: 16 | VRenderPass(); 17 | virtual ~VRenderPass(); 18 | 19 | VRenderPass( const VRenderPass& ) = delete; 20 | VRenderPass& operator=( const VRenderPass& ) = delete; 21 | 22 | bool init(); 23 | void destroy(); 24 | 25 | void addAttachmentType(const VFramebufferAttachmentType &type, 26 | VkAttachmentStoreOp storeOp = VK_ATTACHMENT_STORE_OP_STORE, bool toMemory = false, 27 | VkAttachmentLoadOp loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR, bool fromMemory = false); 28 | 29 | void setAttachmentsLoadOp(size_t attachmentIndex, VkAttachmentLoadOp loadOp, bool fromMemory = false); 30 | void setAttachmentsStoreOp(size_t attachmentIndex, VkAttachmentStoreOp storeOp, bool toMemory = false); 31 | 32 | //I could do something clever to keep encapsulating 33 | VkRenderPass getVkRenderPass() const; 34 | size_t getColorAttachmentsCount() const; 35 | 36 | protected: 37 | bool createRenderPass(); 38 | 39 | protected: 40 | VkRenderPass m_vkRenderPass; 41 | std::vector m_attachmentsType; 42 | std::vector > m_attachmentsLoadOp; //loadOp and fromMemory 43 | std::vector > m_attachmentsStoreOp; //storeOp and toMemory 44 | }; 45 | 46 | } 47 | 48 | #endif // VRENDERPASS_H 49 | -------------------------------------------------------------------------------- /Valag/include/Valag/vulkanImpl/VRenderTarget.h: -------------------------------------------------------------------------------- 1 | #ifndef VRENDERTARGET_H 2 | #define VRENDERTARGET_H 3 | 4 | #include "Valag/vulkanImpl/VRenderPass.h" 5 | 6 | namespace vlg 7 | { 8 | 9 | class VRenderTarget 10 | { 11 | public: 12 | VRenderTarget(); 13 | virtual ~VRenderTarget(); 14 | 15 | VRenderTarget( const VRenderTarget& ) = delete; 16 | VRenderTarget& operator=( const VRenderTarget& ) = delete; 17 | 18 | bool init(size_t framebuffersCount, VRenderPass *renderPass); 19 | void destroy(); 20 | 21 | ///Add preexisting attachments 22 | void addAttachments(const std::vector &attachments); 23 | ///Create new attachments (that will be created when init) 24 | void createAttachments(VFramebufferAttachmentType type); 25 | 26 | void startRendering(size_t framebufferIndex, VkCommandBuffer cmb, VkSubpassContents contents = VK_SUBPASS_CONTENTS_INLINE); 27 | void startRendering(size_t framebufferIndex, VkCommandBuffer cmb, VkSubpassContents contents, 28 | VRenderPass* renderPass); 29 | 30 | void setExtent(VkExtent2D extent); 31 | void setMipLevel(size_t mipLevel); 32 | void setClearValue(size_t attachmentIndex, glm::vec4 color, glm::vec2 depth = {0.0,0}); 33 | 34 | VkExtent2D getExtent(); 35 | const std::vector &getAttachments(size_t attachmentIndex); 36 | 37 | protected: 38 | bool createFramebuffers(size_t framebuffersCount); 39 | 40 | protected: 41 | size_t m_imagesCount; 42 | VkExtent2D m_extent; 43 | size_t m_mipLevel; 44 | 45 | std::vector m_clearValues; 46 | std::vector m_framebuffers; 47 | 48 | VRenderPass *m_defaultRenderPass; 49 | std::vector > m_attachments; 50 | 51 | }; 52 | 53 | } 54 | 55 | #endif // VRENDERTARGET_H 56 | -------------------------------------------------------------------------------- /Valag/include/Valag/vulkanImpl/VTexture.h: -------------------------------------------------------------------------------- 1 | #ifndef VTEXTURE_H 2 | #define VTEXTURE_H 3 | 4 | #include 5 | #include "Valag/Types.h" 6 | 7 | namespace vlg 8 | { 9 | 10 | class VTexture 11 | { 12 | friend class VTexturesManager; 13 | 14 | public: 15 | VTexture(); 16 | virtual ~VTexture(); 17 | 18 | bool generateTexture(int texWidth, int texHeight, 19 | unsigned char* pixels, CommandPoolName commandPoolName = COMMANDPOOL_SHORTLIVED); 20 | bool generateTexture(int texWidth, int texHeight, VkFormat format, 21 | unsigned char* pixels, CommandPoolName commandPoolName = COMMANDPOOL_SHORTLIVED); 22 | 23 | uint32_t getTextureId(); 24 | uint32_t getTextureLayer(); 25 | glm::vec2 getTexturePair(); 26 | VkExtent2D getExtent(); 27 | VkFormat getFormat(); 28 | 29 | protected: 30 | uint32_t m_textureId; 31 | uint32_t m_textureLayer; 32 | 33 | VkExtent2D m_extent; 34 | VkFormat m_format; 35 | 36 | }; 37 | 38 | } 39 | 40 | #endif // VTEXTURE_H 41 | -------------------------------------------------------------------------------- /Valag/include/Valag/vulkanImpl/VulkanExtProxies.h: -------------------------------------------------------------------------------- 1 | 2 | #define GLFW_INCLUDE_VULKAN 3 | #include 4 | 5 | VkResult CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, 6 | const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback); 7 | 8 | void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator); 9 | -------------------------------------------------------------------------------- /Valag/include/Valag/vulkanImpl/VulkanImpl.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "Valag/Types.h" 8 | #include "Valag/vulkanImpl/VInstance.h" 9 | #include "Valag/vulkanImpl/VMemoryAllocator.h" 10 | #include "Valag/vulkanImpl/VBuffersAllocator.h" 11 | #include "Valag/vulkanImpl/VTexturesManager.h" 12 | #include "Valag/vulkanImpl/VMesh.h" 13 | #include "Valag/vulkanImpl/VGraphicsPipeline.h" 14 | #include "Valag/vulkanImpl/VRenderPass.h" 15 | #include "Valag/vulkanImpl/VRenderTarget.h" 16 | #include "Valag/vulkanImpl/VCommandBuffer.h" 17 | #include "Valag/vulkanImpl/VulkanExtProxies.h" 18 | #include "Valag/vulkanImpl/VulkanHelpers.h" 19 | 20 | 21 | -------------------------------------------------------------------------------- /Valag/include/glm/detail/_fixes.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/_fixes.hpp 3 | 4 | #include 5 | 6 | //! Workaround for compatibility with other libraries 7 | #ifdef max 8 | #undef max 9 | #endif 10 | 11 | //! Workaround for compatibility with other libraries 12 | #ifdef min 13 | #undef min 14 | #endif 15 | 16 | //! Workaround for Android 17 | #ifdef isnan 18 | #undef isnan 19 | #endif 20 | 21 | //! Workaround for Android 22 | #ifdef isinf 23 | #undef isinf 24 | #endif 25 | 26 | //! Workaround for Chrone Native Client 27 | #ifdef log2 28 | #undef log2 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /Valag/include/glm/detail/compute_vector_relational.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "setup.hpp" 4 | #include 5 | #include 6 | 7 | namespace glm{ 8 | namespace detail 9 | { 10 | template ::is_iec559> 11 | struct compute_equal 12 | { 13 | GLM_FUNC_QUALIFIER static bool call(T a, T b) 14 | { 15 | return a == b; 16 | } 17 | }; 18 | 19 | template 20 | struct compute_equal 21 | { 22 | GLM_FUNC_QUALIFIER static bool call(T a, T b) 23 | { 24 | return std::memcmp(&a, &b, sizeof(T)) == 0; 25 | } 26 | }; 27 | }//namespace detail 28 | }//namespace glm 29 | -------------------------------------------------------------------------------- /Valag/include/glm/detail/func_exponential_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_exponential_simd.inl 3 | 4 | #include "../simd/exponential.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_sqrt<4, float, Q, true> 13 | { 14 | GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v) 15 | { 16 | vec<4, float, Q> Result; 17 | Result.data = _mm_sqrt_ps(v.data); 18 | return Result; 19 | } 20 | }; 21 | 22 | template<> 23 | struct compute_sqrt<4, float, aligned_lowp, true> 24 | { 25 | GLM_FUNC_QUALIFIER static vec<4, float, aligned_lowp> call(vec<4, float, aligned_lowp> const& v) 26 | { 27 | vec<4, float, aligned_lowp> Result; 28 | Result.data = glm_vec4_sqrt_lowp(v.data); 29 | return Result; 30 | } 31 | }; 32 | }//namespace detail 33 | }//namespace glm 34 | 35 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 36 | -------------------------------------------------------------------------------- /Valag/include/glm/detail/func_packing_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_packing_simd.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | 8 | }//namespace detail 9 | }//namespace glm 10 | -------------------------------------------------------------------------------- /Valag/include/glm/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/include/glm/detail/func_trigonometric_simd.inl -------------------------------------------------------------------------------- /Valag/include/glm/detail/func_vector_relational_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_vector_relational_simd.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | 8 | }//namespace detail 9 | }//namespace glm 10 | -------------------------------------------------------------------------------- /Valag/include/glm/detail/type_half.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_half.hpp 3 | 4 | #pragma once 5 | 6 | #include "setup.hpp" 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | typedef short hdata; 12 | 13 | GLM_FUNC_DECL float toFloat32(hdata value); 14 | GLM_FUNC_DECL hdata toFloat16(float const& value); 15 | 16 | }//namespace detail 17 | }//namespace glm 18 | 19 | #include "type_half.inl" 20 | -------------------------------------------------------------------------------- /Valag/include/glm/detail/type_mat.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat.inl 3 | 4 | -------------------------------------------------------------------------------- /Valag/include/glm/detail/type_mat4x4_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat4x4_sse2.inl 3 | 4 | namespace glm 5 | { 6 | 7 | }//namespace glm 8 | -------------------------------------------------------------------------------- /Valag/include/glm/detail/type_vec.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_vec.inl 3 | -------------------------------------------------------------------------------- /Valag/include/glm/detail/type_vec1.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/include/glm/detail/type_vec1.hpp -------------------------------------------------------------------------------- /Valag/include/glm/ext/vec1.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/include/glm/ext/vec1.inl -------------------------------------------------------------------------------- /Valag/include/glm/ext/vector_relational.inl: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_relational 2 | /// @file glm/ext/vector_relational.inl 3 | 4 | // Dependency: 5 | #include "../vector_relational.hpp" 6 | #include "../common.hpp" 7 | #include "../detail/type_vec.hpp" 8 | 9 | namespace glm 10 | { 11 | template 12 | GLM_FUNC_QUALIFIER bool equal(genType const& x, genType const& y, genType const& epsilon) 13 | { 14 | return abs(x - y) < epsilon; 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER vec equal(vec const& x, vec const& y, T const& epsilon) 19 | { 20 | return lessThan(abs(x - y), vec(epsilon)); 21 | } 22 | 23 | template 24 | GLM_FUNC_QUALIFIER vec equal(vec const& x, vec const& y, vec const& epsilon) 25 | { 26 | return lessThan(abs(x - y), epsilon); 27 | } 28 | 29 | template 30 | GLM_FUNC_QUALIFIER bool notEqual(genType const& x, genType const& y, genType const& epsilon) 31 | { 32 | return abs(x - y) >= epsilon; 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER vec notEqual(vec const& x, vec const& y, T const& epsilon) 37 | { 38 | return greaterThanEqual(abs(x - y), vec(epsilon)); 39 | } 40 | 41 | template 42 | GLM_FUNC_QUALIFIER vec notEqual(vec const& x, vec const& y, vec const& epsilon) 43 | { 44 | return greaterThanEqual(abs(x - y), epsilon); 45 | } 46 | }//namespace glm 47 | -------------------------------------------------------------------------------- /Valag/include/glm/gtc/matrix_access.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | /// @file glm/gtc/matrix_access.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_matrix_access GLM_GTC_matrix_access 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Defines functions to access rows or columns of a matrix easily. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../detail/setup.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTC_matrix_access extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtc_matrix_access 25 | /// @{ 26 | 27 | /// Get a specific row of a matrix. 28 | /// @see gtc_matrix_access 29 | template 30 | GLM_FUNC_DECL typename genType::row_type row( 31 | genType const& m, 32 | length_t index); 33 | 34 | /// Set a specific row to a matrix. 35 | /// @see gtc_matrix_access 36 | template 37 | GLM_FUNC_DECL genType row( 38 | genType const& m, 39 | length_t index, 40 | typename genType::row_type const& x); 41 | 42 | /// Get a specific column of a matrix. 43 | /// @see gtc_matrix_access 44 | template 45 | GLM_FUNC_DECL typename genType::col_type column( 46 | genType const& m, 47 | length_t index); 48 | 49 | /// Set a specific column to a matrix. 50 | /// @see gtc_matrix_access 51 | template 52 | GLM_FUNC_DECL genType column( 53 | genType const& m, 54 | length_t index, 55 | typename genType::col_type const& x); 56 | 57 | /// @} 58 | }//namespace glm 59 | 60 | #include "matrix_access.inl" 61 | -------------------------------------------------------------------------------- /Valag/include/glm/gtc/matrix_access.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | /// @file glm/gtc/matrix_access.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType row 8 | ( 9 | genType const& m, 10 | length_t index, 11 | typename genType::row_type const& x 12 | ) 13 | { 14 | assert(index >= 0 && index < m[0].length()); 15 | 16 | genType Result = m; 17 | for(length_t i = 0; i < m.length(); ++i) 18 | Result[i][index] = x[i]; 19 | return Result; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER typename genType::row_type row 24 | ( 25 | genType const& m, 26 | length_t index 27 | ) 28 | { 29 | assert(index >= 0 && index < m[0].length()); 30 | 31 | typename genType::row_type Result(0); 32 | for(length_t i = 0; i < m.length(); ++i) 33 | Result[i] = m[i][index]; 34 | return Result; 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER genType column 39 | ( 40 | genType const& m, 41 | length_t index, 42 | typename genType::col_type const& x 43 | ) 44 | { 45 | assert(index >= 0 && index < m.length()); 46 | 47 | genType Result = m; 48 | Result[index] = x; 49 | return Result; 50 | } 51 | 52 | template 53 | GLM_FUNC_QUALIFIER typename genType::col_type column 54 | ( 55 | genType const& m, 56 | length_t index 57 | ) 58 | { 59 | assert(index >= 0 && index < m.length()); 60 | 61 | return m[index]; 62 | } 63 | }//namespace glm 64 | -------------------------------------------------------------------------------- /Valag/include/glm/gtc/matrix_inverse.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_inverse 2 | /// @file glm/gtc/matrix_inverse.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Defines additional matrix inverting functions. 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../detail/setup.hpp" 17 | #include "../matrix.hpp" 18 | #include "../mat2x2.hpp" 19 | #include "../mat3x3.hpp" 20 | #include "../mat4x4.hpp" 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTC_matrix_inverse extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtc_matrix_inverse 29 | /// @{ 30 | 31 | /// Fast matrix inverse for affine matrix. 32 | /// 33 | /// @param m Input matrix to invert. 34 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly innacurate. 35 | /// @see gtc_matrix_inverse 36 | template 37 | GLM_FUNC_DECL genType affineInverse(genType const& m); 38 | 39 | /// Compute the inverse transpose of a matrix. 40 | /// 41 | /// @param m Input matrix to invert transpose. 42 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly innacurate. 43 | /// @see gtc_matrix_inverse 44 | template 45 | GLM_FUNC_DECL genType inverseTranspose(genType const& m); 46 | 47 | /// @} 48 | }//namespace glm 49 | 50 | #include "matrix_inverse.inl" 51 | -------------------------------------------------------------------------------- /Valag/include/glm/gtc/noise.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_noise 2 | /// @file glm/gtc/noise.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_noise GLM_GTC_noise 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Defines 2D, 3D and 4D procedural noise functions 12 | /// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise": 13 | /// https://github.com/ashima/webgl-noise 14 | /// Following Stefan Gustavson's paper "Simplex noise demystified": 15 | /// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf 16 | 17 | #pragma once 18 | 19 | // Dependencies 20 | #include "../detail/setup.hpp" 21 | #include "../detail/qualifier.hpp" 22 | #include "../detail/_noise.hpp" 23 | #include "../geometric.hpp" 24 | #include "../common.hpp" 25 | #include "../vector_relational.hpp" 26 | #include "../vec2.hpp" 27 | #include "../vec3.hpp" 28 | #include "../vec4.hpp" 29 | 30 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 31 | # pragma message("GLM: GLM_GTC_noise extension included") 32 | #endif 33 | 34 | namespace glm 35 | { 36 | /// @addtogroup gtc_noise 37 | /// @{ 38 | 39 | /// Classic perlin noise. 40 | /// @see gtc_noise 41 | template 42 | GLM_FUNC_DECL T perlin( 43 | vec const& p); 44 | 45 | /// Periodic perlin noise. 46 | /// @see gtc_noise 47 | template 48 | GLM_FUNC_DECL T perlin( 49 | vec const& p, 50 | vec const& rep); 51 | 52 | /// Simplex noise. 53 | /// @see gtc_noise 54 | template 55 | GLM_FUNC_DECL T simplex( 56 | vec const& p); 57 | 58 | /// @} 59 | }//namespace glm 60 | 61 | #include "noise.inl" 62 | -------------------------------------------------------------------------------- /Valag/include/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_swizzle 2 | /// @file glm/gtc/swizzle.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Valag/include/glm/gtc/vec1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_vec1 GLM_GTC_vec1 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Add vec1, ivec1, uvec1 and bvec1 types. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../ext/vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTC_vec1 extension included") 20 | #endif 21 | 22 | #include "vec1.inl" 23 | -------------------------------------------------------------------------------- /Valag/include/glm/gtc/vec1.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.inl 3 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/closest_point.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_closest_point GLM_GTX_closest_point 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Find the point on a straight line which is the closet of a point. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_closest_point is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_closest_point extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_closest_point 29 | /// @{ 30 | 31 | /// Find the point on a straight line which is the closet of a point. 32 | /// @see gtx_closest_point 33 | template 34 | GLM_FUNC_DECL vec<3, T, Q> closestPointOnLine( 35 | vec<3, T, Q> const& point, 36 | vec<3, T, Q> const& a, 37 | vec<3, T, Q> const& b); 38 | 39 | /// 2d lines work as well 40 | template 41 | GLM_FUNC_DECL vec<2, T, Q> closestPointOnLine( 42 | vec<2, T, Q> const& point, 43 | vec<2, T, Q> const& a, 44 | vec<2, T, Q> const& b); 45 | 46 | /// @} 47 | }// namespace glm 48 | 49 | #include "closest_point.inl" 50 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec<3, T, Q> closestPointOnLine 8 | ( 9 | vec<3, T, Q> const& point, 10 | vec<3, T, Q> const& a, 11 | vec<3, T, Q> const& b 12 | ) 13 | { 14 | T LineLength = distance(a, b); 15 | vec<3, T, Q> Vector = point - a; 16 | vec<3, T, Q> LineDirection = (b - a) / LineLength; 17 | 18 | // Project Vector to LineDirection to get the distance of point from a 19 | T Distance = dot(Vector, LineDirection); 20 | 21 | if(Distance <= T(0)) return a; 22 | if(Distance >= LineLength) return b; 23 | return a + LineDirection * Distance; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER vec<2, T, Q> closestPointOnLine 28 | ( 29 | vec<2, T, Q> const& point, 30 | vec<2, T, Q> const& a, 31 | vec<2, T, Q> const& b 32 | ) 33 | { 34 | T LineLength = distance(a, b); 35 | vec<2, T, Q> Vector = point - a; 36 | vec<2, T, Q> LineDirection = (b - a) / LineLength; 37 | 38 | // Project Vector to LineDirection to get the distance of point from a 39 | T Distance = dot(Vector, LineDirection); 40 | 41 | if(Distance <= T(0)) return a; 42 | if(Distance >= LineLength) return b; 43 | return a + LineDirection * Distance; 44 | } 45 | 46 | }//namespace glm 47 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/color_encoding.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_encoding 2 | /// @file glm/gtx/color_encoding.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_color_encoding (dependence) 6 | /// 7 | /// @defgroup gtx_color_encoding GLM_GTX_color_encoding 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// @brief Allow to perform bit operations on integer values 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/qualifier.hpp" 19 | #include "../vec3.hpp" 20 | #include 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTC_color_encoding extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_color_encoding 29 | /// @{ 30 | 31 | /// Convert a linear sRGB color to D65 YUV. 32 | template 33 | GLM_FUNC_DECL vec<3, T, Q> convertLinearSRGBToD65XYZ(vec<3, T, Q> const& ColorLinearSRGB); 34 | 35 | /// Convert a linear sRGB color to D50 YUV. 36 | template 37 | GLM_FUNC_DECL vec<3, T, Q> convertLinearSRGBToD50XYZ(vec<3, T, Q> const& ColorLinearSRGB); 38 | 39 | /// Convert a D65 YUV color to linear sRGB. 40 | template 41 | GLM_FUNC_DECL vec<3, T, Q> convertD65XYZToLinearSRGB(vec<3, T, Q> const& ColorD65XYZ); 42 | 43 | /// Convert a D65 YUV color to D50 YUV. 44 | template 45 | GLM_FUNC_DECL vec<3, T, Q> convertD65XYZToD50XYZ(vec<3, T, Q> const& ColorD65XYZ); 46 | 47 | /// @} 48 | } //namespace glm 49 | 50 | #include "color_encoding.inl" 51 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/color_encoding.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_encoding 2 | /// @file glm/gtx/color_encoding.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec<3, T, Q> convertLinearSRGBToD65XYZ(vec<3, T, Q> const& ColorLinearSRGB) 8 | { 9 | vec<3, T, Q> const M(0.490f, 0.17697f, 0.2f); 10 | vec<3, T, Q> const N(0.31f, 0.8124f, 0.01063f); 11 | vec<3, T, Q> const O(0.490f, 0.01f, 0.99f); 12 | 13 | return (M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB) * static_cast(5.650675255693055f); 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER vec<3, T, Q> convertLinearSRGBToD50XYZ(vec<3, T, Q> const& ColorLinearSRGB) 18 | { 19 | vec<3, T, Q> const M(0.436030342570117f, 0.222438466210245f, 0.013897440074263f); 20 | vec<3, T, Q> const N(0.385101860087134f, 0.716942745571917f, 0.097076381494207f); 21 | vec<3, T, Q> const O(0.143067806654203f, 0.060618777416563f, 0.713926257896652f); 22 | 23 | return M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER vec<3, T, Q> convertD65XYZToLinearSRGB(vec<3, T, Q> const& ColorD65XYZ) 28 | { 29 | vec<3, T, Q> const M(0.41847f, -0.091169f, 0.0009209f); 30 | vec<3, T, Q> const N(-0.15866f, 0.25243f, 0.015708f); 31 | vec<3, T, Q> const O(0.0009209f, -0.0025498f, 0.1786f); 32 | 33 | return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER vec<3, T, Q> convertD65XYZToD50XYZ(vec<3, T, Q> const& ColorD65XYZ) 38 | { 39 | vec<3, T, Q> const M(+1.047844353856414f, +0.029549007606644f, -0.009250984365223f); 40 | vec<3, T, Q> const N(+0.022898981050086f, +0.990508028941971f, +0.015072338237051f); 41 | vec<3, T, Q> const O(-0.050206647741605f, -0.017074711360960f, +0.751717835079977f); 42 | 43 | return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ; 44 | } 45 | 46 | }//namespace glm 47 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/compatibility.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_compatibility 2 | /// @file glm/gtx/compatibility.inl 3 | 4 | #include 5 | 6 | namespace glm 7 | { 8 | // isfinite 9 | template 10 | GLM_FUNC_QUALIFIER bool isfinite( 11 | genType const& x) 12 | { 13 | # if GLM_HAS_CXX11_STL 14 | return std::isfinite(x) != 0; 15 | # elif GLM_COMPILER & GLM_COMPILER_VC 16 | return _finite(x); 17 | # elif GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID 18 | return _isfinite(x) != 0; 19 | # else 20 | if (std::numeric_limits::is_integer || std::denorm_absent == std::numeric_limits::has_denorm) 21 | return std::numeric_limits::min() <= x && std::numeric_limits::max() >= x; 22 | else 23 | return -std::numeric_limits::max() <= x && std::numeric_limits::max() >= x; 24 | # endif 25 | } 26 | 27 | template 28 | GLM_FUNC_QUALIFIER vec<1, bool, Q> isfinite( 29 | vec<1, T, Q> const& x) 30 | { 31 | return vec<1, bool, Q>( 32 | isfinite(x.x)); 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER vec<2, bool, Q> isfinite( 37 | vec<2, T, Q> const& x) 38 | { 39 | return vec<2, bool, Q>( 40 | isfinite(x.x), 41 | isfinite(x.y)); 42 | } 43 | 44 | template 45 | GLM_FUNC_QUALIFIER vec<3, bool, Q> isfinite( 46 | vec<3, T, Q> const& x) 47 | { 48 | return vec<3, bool, Q>( 49 | isfinite(x.x), 50 | isfinite(x.y), 51 | isfinite(x.z)); 52 | } 53 | 54 | template 55 | GLM_FUNC_QUALIFIER vec<4, bool, Q> isfinite( 56 | vec<4, T, Q> const& x) 57 | { 58 | return vec<4, bool, Q>( 59 | isfinite(x.x), 60 | isfinite(x.y), 61 | isfinite(x.z), 62 | isfinite(x.w)); 63 | } 64 | 65 | }//namespace glm 66 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/extend.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_extend GLM_GTX_extend 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Extend a position from a source to a position at a defined length. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_extend extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_extend 29 | /// @{ 30 | 31 | /// Extends of Length the Origin position using the (Source - Origin) direction. 32 | /// @see gtx_extend 33 | template 34 | GLM_FUNC_DECL genType extend( 35 | genType const& Origin, 36 | genType const& Source, 37 | typename genType::value_type const Length); 38 | 39 | /// @} 40 | }//namespace glm 41 | 42 | #include "extend.inl" 43 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType extend 8 | ( 9 | genType const& Origin, 10 | genType const& Source, 11 | genType const& Distance 12 | ) 13 | { 14 | return Origin + (Source - Origin) * Distance; 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER vec<2, T, Q> extend 19 | ( 20 | vec<2, T, Q> const& Origin, 21 | vec<2, T, Q> const& Source, 22 | T const& Distance 23 | ) 24 | { 25 | return Origin + (Source - Origin) * Distance; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER vec<3, T, Q> extend 30 | ( 31 | vec<3, T, Q> const& Origin, 32 | vec<3, T, Q> const& Source, 33 | T const& Distance 34 | ) 35 | { 36 | return Origin + (Source - Origin) * Distance; 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER vec<4, T, Q> extend 41 | ( 42 | vec<4, T, Q> const& Origin, 43 | vec<4, T, Q> const& Source, 44 | T const& Distance 45 | ) 46 | { 47 | return Origin + (Source - Origin) * Distance; 48 | } 49 | }//namespace glm 50 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/exterior_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_exterior_product 2 | /// @file glm/gtx/exterior_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_exterior_product (dependence) 6 | /// 7 | /// @defgroup gtx_exterior_product GLM_GTX_exterior_product 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// @brief Allow to perform bit operations on integer values 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/qualifier.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTX_exterior_product extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtx_exterior_product 27 | /// @{ 28 | 29 | /// Returns the cross product of x and y. 30 | /// 31 | /// @tparam T Floating-point scalar types 32 | /// @tparam Q Value from qualifier enum 33 | /// 34 | /// @see Exterior product 35 | template 36 | GLM_FUNC_DECL T cross(vec<2, T, Q> const& v, vec<2, T, Q> const& u); 37 | 38 | /// @} 39 | } //namespace glm 40 | 41 | #include "exterior_product.inl" 42 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/exterior_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_geometric.inl 3 | 4 | #include 5 | 6 | namespace glm { 7 | namespace detail 8 | { 9 | template 10 | struct compute_cross_vec2 11 | { 12 | GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u) 13 | { 14 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' accepts only floating-point inputs"); 15 | 16 | return v.x * u.y - u.x * v.y; 17 | } 18 | }; 19 | }//namespace detail 20 | 21 | template 22 | GLM_FUNC_QUALIFIER T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y) 23 | { 24 | return detail::compute_cross_vec2::value>::call(x, y); 25 | } 26 | }//namespace glm 27 | 28 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/float_notmalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_float_normalize 2 | /// @file glm/gtx/float_normalize.inl 3 | 4 | #include 5 | 6 | namespace glm 7 | { 8 | template 9 | GLM_FUNC_QUALIFIER vec floatNormalize(vec const& v) 10 | { 11 | return vec(v) / static_cast(std::numeric_limits::max()); 12 | } 13 | 14 | }//namespace glm 15 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/functions.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_functions 2 | /// @file glm/gtx/functions.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_quaternion (dependence) 6 | /// 7 | /// @defgroup gtx_functions GLM_GTX_functions 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// List of useful common functions. 13 | 14 | #pragma once 15 | 16 | // Dependencies 17 | #include "../detail/setup.hpp" 18 | #include "../detail/qualifier.hpp" 19 | #include "../detail/type_vec2.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTX_functions extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtx_functions 28 | /// @{ 29 | 30 | /// 1D gauss function 31 | /// 32 | /// @see gtc_epsilon 33 | template 34 | GLM_FUNC_DECL T gauss( 35 | T x, 36 | T ExpectedValue, 37 | T StandardDeviation); 38 | 39 | /// 2D gauss function 40 | /// 41 | /// @see gtc_epsilon 42 | template 43 | GLM_FUNC_DECL T gauss( 44 | vec<2, T, Q> const& Coord, 45 | vec<2, T, Q> const& ExpectedValue, 46 | vec<2, T, Q> const& StandardDeviation); 47 | 48 | /// @} 49 | }//namespace glm 50 | 51 | #include "functions.inl" 52 | 53 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/functions.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_functions 2 | /// @file glm/gtx/functions.inl 3 | 4 | #include "../exponential.hpp" 5 | 6 | namespace glm 7 | { 8 | template 9 | GLM_FUNC_QUALIFIER T gauss 10 | ( 11 | T x, 12 | T ExpectedValue, 13 | T StandardDeviation 14 | ) 15 | { 16 | return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast(6.28318530717958647692528676655900576))); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER T gauss 21 | ( 22 | vec<2, T, Q> const& Coord, 23 | vec<2, T, Q> const& ExpectedValue, 24 | vec<2, T, Q> const& StandardDeviation 25 | ) 26 | { 27 | vec<2, T, Q> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation); 28 | return exp(-(Squared.x + Squared.y)); 29 | } 30 | }//namespace glm 31 | 32 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/gradient_paint.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | /// @file glm/gtx/gradient_paint.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_optimum_pow (dependence) 6 | /// 7 | /// @defgroup gtx_gradient_paint GLM_GTX_gradient_paint 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Functions that return the color of procedural gradient for specific coordinates. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/optimum_pow.hpp" 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_gradient_paint is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 22 | #endif 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_gradient_paint extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_gradient_paint 31 | /// @{ 32 | 33 | /// Return a color from a radial gradient. 34 | /// @see - gtx_gradient_paint 35 | template 36 | GLM_FUNC_DECL T radialGradient( 37 | vec<2, T, Q> const& Center, 38 | T const& Radius, 39 | vec<2, T, Q> const& Focal, 40 | vec<2, T, Q> const& Position); 41 | 42 | /// Return a color from a linear gradient. 43 | /// @see - gtx_gradient_paint 44 | template 45 | GLM_FUNC_DECL T linearGradient( 46 | vec<2, T, Q> const& Point0, 47 | vec<2, T, Q> const& Point1, 48 | vec<2, T, Q> const& Position); 49 | 50 | /// @} 51 | }// namespace glm 52 | 53 | #include "gradient_paint.inl" 54 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | /// @file glm/gtx/gradient_paint.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T radialGradient 8 | ( 9 | vec<2, T, Q> const& Center, 10 | T const& Radius, 11 | vec<2, T, Q> const& Focal, 12 | vec<2, T, Q> const& Position 13 | ) 14 | { 15 | vec<2, T, Q> F = Focal - Center; 16 | vec<2, T, Q> D = Position - Focal; 17 | T Radius2 = pow2(Radius); 18 | T Fx2 = pow2(F.x); 19 | T Fy2 = pow2(F.y); 20 | 21 | T Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x)); 22 | T Denominator = Radius2 - (Fx2 + Fy2); 23 | return Numerator / Denominator; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER T linearGradient 28 | ( 29 | vec<2, T, Q> const& Point0, 30 | vec<2, T, Q> const& Point1, 31 | vec<2, T, Q> const& Position 32 | ) 33 | { 34 | vec<2, T, Q> Dist = Point1 - Point0; 35 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 36 | } 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/handed_coordinate_space.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | /// @file glm/gtx/handed_coordinate_space.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_handed_coordinate_space GLM_GTX_handed_coordinate_space 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// To know if a set of three basis vectors defines a right or left-handed coordinate system. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_handed_coordinate_space is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_handed_coordinate_space 29 | /// @{ 30 | 31 | //! Return if a trihedron right handed or not. 32 | //! From GLM_GTX_handed_coordinate_space extension. 33 | template 34 | GLM_FUNC_DECL bool rightHanded( 35 | vec<3, T, Q> const& tangent, 36 | vec<3, T, Q> const& binormal, 37 | vec<3, T, Q> const& normal); 38 | 39 | //! Return if a trihedron left handed or not. 40 | //! From GLM_GTX_handed_coordinate_space extension. 41 | template 42 | GLM_FUNC_DECL bool leftHanded( 43 | vec<3, T, Q> const& tangent, 44 | vec<3, T, Q> const& binormal, 45 | vec<3, T, Q> const& normal); 46 | 47 | /// @} 48 | }// namespace glm 49 | 50 | #include "handed_coordinate_space.inl" 51 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | /// @file glm/gtx/handed_coordinate_space.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER bool rightHanded 8 | ( 9 | vec<3, T, Q> const& tangent, 10 | vec<3, T, Q> const& binormal, 11 | vec<3, T, Q> const& normal 12 | ) 13 | { 14 | return dot(cross(normal, tangent), binormal) > T(0); 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER bool leftHanded 19 | ( 20 | vec<3, T, Q> const& tangent, 21 | vec<3, T, Q> const& binormal, 22 | vec<3, T, Q> const& normal 23 | ) 24 | { 25 | return dot(cross(normal, tangent), binormal) < T(0); 26 | } 27 | }//namespace glm 28 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/log_base.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_log_base GLM_GTX_log_base 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Logarithm for any base. base can be a vector or a scalar. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_log_base is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_log_base extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_log_base 29 | /// @{ 30 | 31 | /// Logarithm for any base. 32 | /// From GLM_GTX_log_base. 33 | template 34 | GLM_FUNC_DECL genType log( 35 | genType const& x, 36 | genType const& base); 37 | 38 | /// Logarithm for any base. 39 | /// From GLM_GTX_log_base. 40 | template 41 | GLM_FUNC_DECL vec sign( 42 | vec const& x, 43 | vec const& base); 44 | 45 | /// @} 46 | }//namespace glm 47 | 48 | #include "log_base.inl" 49 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType log(genType const& x, genType const& base) 8 | { 9 | assert(!detail::compute_equal::call(x, static_cast(0))); 10 | return glm::log(x) / glm::log(base); 11 | } 12 | 13 | template 14 | GLM_FUNC_QUALIFIER vec log(vec const& x, vec const& base) 15 | { 16 | return glm::log(x) / glm::log(base); 17 | } 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/matrix_cross_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Build cross product matrices 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_matrix_cross_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_matrix_cross_product extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_matrix_cross_product 30 | /// @{ 31 | 32 | //! Build a cross product matrix. 33 | //! From GLM_GTX_matrix_cross_product extension. 34 | template 35 | GLM_FUNC_DECL mat<3, 3, T, Q> matrixCross3( 36 | vec<3, T, Q> const& x); 37 | 38 | //! Build a cross product matrix. 39 | //! From GLM_GTX_matrix_cross_product extension. 40 | template 41 | GLM_FUNC_DECL mat<4, 4, T, Q> matrixCross4( 42 | vec<3, T, Q> const& x); 43 | 44 | /// @} 45 | }//namespace glm 46 | 47 | #include "matrix_cross_product.inl" 48 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> matrixCross3 8 | ( 9 | vec<3, T, Q> const& x 10 | ) 11 | { 12 | mat<3, 3, T, Q> Result(T(0)); 13 | Result[0][1] = x.z; 14 | Result[1][0] = -x.z; 15 | Result[0][2] = -x.y; 16 | Result[2][0] = x.y; 17 | Result[1][2] = x.x; 18 | Result[2][1] = -x.x; 19 | return Result; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> matrixCross4 24 | ( 25 | vec<3, T, Q> const& x 26 | ) 27 | { 28 | mat<4, 4, T, Q> Result(T(0)); 29 | Result[0][1] = x.z; 30 | Result[1][0] = -x.z; 31 | Result[0][2] = -x.y; 32 | Result[2][0] = x.y; 33 | Result[1][2] = x.x; 34 | Result[2][1] = -x.x; 35 | return Result; 36 | } 37 | 38 | }//namespace glm 39 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/matrix_decompose.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_decompose 2 | /// @file glm/gtx/matrix_decompose.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_matrix_decompose GLM_GTX_matrix_decompose 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Decomposes a model matrix to translations, rotation and scale components 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../mat4x4.hpp" 17 | #include "../vec3.hpp" 18 | #include "../vec4.hpp" 19 | #include "../geometric.hpp" 20 | #include "../gtc/quaternion.hpp" 21 | #include "../gtc/matrix_transform.hpp" 22 | 23 | #ifndef GLM_ENABLE_EXPERIMENTAL 24 | # error "GLM: GLM_GTX_matrix_decompose is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 25 | #endif 26 | 27 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 28 | # pragma message("GLM: GLM_GTX_matrix_decompose extension included") 29 | #endif 30 | 31 | namespace glm 32 | { 33 | /// @addtogroup gtx_matrix_decompose 34 | /// @{ 35 | 36 | /// Decomposes a model matrix to translations, rotation and scale components 37 | /// @see gtx_matrix_decompose 38 | template 39 | GLM_FUNC_DECL bool decompose( 40 | mat<4, 4, T, Q> const& modelMatrix, 41 | vec<3, T, Q> & scale, tquat & orientation, vec<3, T, Q> & translation, vec<3, T, Q> & skew, vec<4, T, Q> & perspective); 42 | 43 | /// @} 44 | }//namespace glm 45 | 46 | #include "matrix_decompose.inl" 47 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/matrix_factorisation.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/include/glm/gtx/matrix_factorisation.inl -------------------------------------------------------------------------------- /Valag/include/glm/gtx/matrix_transform_2d.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_transform_2d 2 | /// @file glm/gtc/matrix_transform_2d.inl 3 | /// @author Miguel Ángel Pérez Martínez 4 | 5 | #include "../trigonometric.hpp" 6 | 7 | namespace glm 8 | { 9 | 10 | template 11 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> translate( 12 | mat<3, 3, T, Q> const& m, 13 | vec<2, T, Q> const& v) 14 | { 15 | mat<3, 3, T, Q> Result(m); 16 | Result[2] = m[0] * v[0] + m[1] * v[1] + m[2]; 17 | return Result; 18 | } 19 | 20 | 21 | template 22 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> rotate( 23 | mat<3, 3, T, Q> const& m, 24 | T angle) 25 | { 26 | T const a = angle; 27 | T const c = cos(a); 28 | T const s = sin(a); 29 | 30 | mat<3, 3, T, Q> Result; 31 | Result[0] = m[0] * c + m[1] * s; 32 | Result[1] = m[0] * -s + m[1] * c; 33 | Result[2] = m[2]; 34 | return Result; 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> scale( 39 | mat<3, 3, T, Q> const& m, 40 | vec<2, T, Q> const& v) 41 | { 42 | mat<3, 3, T, Q> Result; 43 | Result[0] = m[0] * v[0]; 44 | Result[1] = m[1] * v[1]; 45 | Result[2] = m[2]; 46 | return Result; 47 | } 48 | 49 | template 50 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearX( 51 | mat<3, 3, T, Q> const& m, 52 | T y) 53 | { 54 | mat<3, 3, T, Q> Result(1); 55 | Result[0][1] = y; 56 | return m * Result; 57 | } 58 | 59 | template 60 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearY( 61 | mat<3, 3, T, Q> const& m, 62 | T x) 63 | { 64 | mat<3, 3, T, Q> Result(1); 65 | Result[1][0] = x; 66 | return m * Result; 67 | } 68 | 69 | }//namespace glm 70 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/mixed_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Mixed product of 3 vectors. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_mixed_product is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_mixed_product 29 | /// @{ 30 | 31 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 32 | template 33 | GLM_FUNC_DECL T mixedProduct( 34 | vec<3, T, Q> const& v1, 35 | vec<3, T, Q> const& v2, 36 | vec<3, T, Q> const& v3); 37 | 38 | /// @} 39 | }// namespace glm 40 | 41 | #include "mixed_product.inl" 42 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T mixedProduct 8 | ( 9 | vec<3, T, Q> const& v1, 10 | vec<3, T, Q> const& v2, 11 | vec<3, T, Q> const& v3 12 | ) 13 | { 14 | return dot(cross(v1, v2), v3); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/normal.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_normal GLM_GTX_normal 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Compute the normal of a triangle. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_normal is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_normal extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_normal 30 | /// @{ 31 | 32 | /// Computes triangle normal from triangle points. 33 | /// 34 | /// @see gtx_normal 35 | template 36 | GLM_FUNC_DECL vec<3, T, Q> triangleNormal(vec<3, T, Q> const& p1, vec<3, T, Q> const& p2, vec<3, T, Q> const& p3); 37 | 38 | /// @} 39 | }//namespace glm 40 | 41 | #include "normal.inl" 42 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec<3, T, Q> triangleNormal 8 | ( 9 | vec<3, T, Q> const& p1, 10 | vec<3, T, Q> const& p2, 11 | vec<3, T, Q> const& p3 12 | ) 13 | { 14 | return normalize(cross(p1 - p2, p1 - p3)); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/normalize_dot.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | /// @file glm/gtx/normalize_dot.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_fast_square_root (dependence) 6 | /// 7 | /// @defgroup gtx_normalize_dot GLM_GTX_normalize_dot 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Dot product of vectors that need to be normalize with a single square root. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../gtx/fast_square_root.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_normalize_dot is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_normalize_dot extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_normalize_dot 30 | /// @{ 31 | 32 | /// Normalize parameters and returns the dot product of x and y. 33 | /// It's faster that dot(normalize(x), normalize(y)). 34 | /// 35 | /// @see gtx_normalize_dot extension. 36 | template 37 | GLM_FUNC_DECL T normalizeDot(vec const& x, vec const& y); 38 | 39 | /// Normalize parameters and returns the dot product of x and y. 40 | /// Faster that dot(fastNormalize(x), fastNormalize(y)). 41 | /// 42 | /// @see gtx_normalize_dot extension. 43 | template 44 | GLM_FUNC_DECL T fastNormalizeDot(vec const& x, vec const& y); 45 | 46 | /// @} 47 | }//namespace glm 48 | 49 | #include "normalize_dot.inl" 50 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/normalize_dot.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | /// @file glm/gtx/normalize_dot.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T normalizeDot(vec const& x, vec const& y) 8 | { 9 | return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER T fastNormalizeDot(vec const& x, vec const& y) 14 | { 15 | return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y)); 16 | } 17 | }//namespace glm 18 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_number_precision 2 | /// @file glm/gtx/number_precision.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/optimum_pow.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | /// @file glm/gtx/optimum_pow.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_optimum_pow GLM_GTX_optimum_pow 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Integer exponentiation of power functions. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_optimum_pow is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_optimum_pow extension included") 24 | #endif 25 | 26 | namespace glm{ 27 | namespace gtx 28 | { 29 | /// @addtogroup gtx_optimum_pow 30 | /// @{ 31 | 32 | /// Returns x raised to the power of 2. 33 | /// 34 | /// @see gtx_optimum_pow 35 | template 36 | GLM_FUNC_DECL genType pow2(genType const& x); 37 | 38 | /// Returns x raised to the power of 3. 39 | /// 40 | /// @see gtx_optimum_pow 41 | template 42 | GLM_FUNC_DECL genType pow3(genType const& x); 43 | 44 | /// Returns x raised to the power of 4. 45 | /// 46 | /// @see gtx_optimum_pow 47 | template 48 | GLM_FUNC_DECL genType pow4(genType const& x); 49 | 50 | /// @} 51 | }//namespace gtx 52 | }//namespace glm 53 | 54 | #include "optimum_pow.inl" 55 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | /// @file glm/gtx/optimum_pow.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType pow2(genType const& x) 8 | { 9 | return x * x; 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType pow3(genType const& x) 14 | { 15 | return x * x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow4(genType const& x) 20 | { 21 | return (x * x) * (x * x); 22 | } 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/orthonormalize.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_orthonormalize GLM_GTX_orthonormalize 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Orthonormalize matrices. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../vec3.hpp" 18 | #include "../mat3x3.hpp" 19 | #include "../geometric.hpp" 20 | 21 | #ifndef GLM_ENABLE_EXPERIMENTAL 22 | # error "GLM: GLM_GTX_orthonormalize is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 23 | #endif 24 | 25 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_GTX_orthonormalize extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup gtx_orthonormalize 32 | /// @{ 33 | 34 | /// Returns the orthonormalized matrix of m. 35 | /// 36 | /// @see gtx_orthonormalize 37 | template 38 | GLM_FUNC_DECL mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m); 39 | 40 | /// Orthonormalizes x according y. 41 | /// 42 | /// @see gtx_orthonormalize 43 | template 44 | GLM_FUNC_DECL vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y); 45 | 46 | /// @} 47 | }//namespace glm 48 | 49 | #include "orthonormalize.inl" 50 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m) 8 | { 9 | mat<3, 3, T, Q> r = m; 10 | 11 | r[0] = normalize(r[0]); 12 | 13 | T d0 = dot(r[0], r[1]); 14 | r[1] -= r[0] * d0; 15 | r[1] = normalize(r[1]); 16 | 17 | T d1 = dot(r[1], r[2]); 18 | d0 = dot(r[0], r[2]); 19 | r[2] -= r[0] * d0 + r[1] * d1; 20 | r[2] = normalize(r[2]); 21 | 22 | return r; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y) 27 | { 28 | return normalize(x - y * dot(y, x)); 29 | } 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/perpendicular.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_projection (dependence) 6 | /// 7 | /// @defgroup gtx_perpendicular GLM_GTX_perpendicular 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Perpendicular of a vector from other one 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/projection.hpp" 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_perpendicular is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 22 | #endif 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_perpendicular 31 | /// @{ 32 | 33 | //! Projects x a perpendicular axis of Normal. 34 | //! From GLM_GTX_perpendicular extension. 35 | template 36 | GLM_FUNC_DECL genType perp(genType const& x, genType const& Normal); 37 | 38 | /// @} 39 | }//namespace glm 40 | 41 | #include "perpendicular.inl" 42 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType perp(genType const& x, genType const& Normal) 8 | { 9 | return x - proj(x, Normal); 10 | } 11 | }//namespace glm 12 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/polar_coordinates.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | /// @file glm/gtx/polar_coordinates.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_polar_coordinates GLM_GTX_polar_coordinates 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Conversion from Euclidean space to polar space and revert. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_polar_coordinates is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_polar_coordinates extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_polar_coordinates 29 | /// @{ 30 | 31 | /// Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude. 32 | /// 33 | /// @see gtx_polar_coordinates 34 | template 35 | GLM_FUNC_DECL vec<3, T, Q> polar( 36 | vec<3, T, Q> const& euclidean); 37 | 38 | /// Convert Polar to Euclidean coordinates. 39 | /// 40 | /// @see gtx_polar_coordinates 41 | template 42 | GLM_FUNC_DECL vec<3, T, Q> euclidean( 43 | vec<2, T, Q> const& polar); 44 | 45 | /// @} 46 | }//namespace glm 47 | 48 | #include "polar_coordinates.inl" 49 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | /// @file glm/gtx/polar_coordinates.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec<3, T, Q> polar 8 | ( 9 | vec<3, T, Q> const& euclidean 10 | ) 11 | { 12 | T const Length(length(euclidean)); 13 | vec<3, T, Q> const tmp(euclidean / Length); 14 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 15 | 16 | return vec<3, T, Q>( 17 | asin(tmp.y), // latitude 18 | atan(tmp.x, tmp.z), // longitude 19 | xz_dist); // xz distance 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER vec<3, T, Q> euclidean 24 | ( 25 | vec<2, T, Q> const& polar 26 | ) 27 | { 28 | T const latitude(polar.x); 29 | T const longitude(polar.y); 30 | 31 | return vec<3, T, Q>( 32 | cos(latitude) * sin(longitude), 33 | sin(latitude), 34 | cos(latitude) * cos(longitude)); 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/projection.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_projection GLM_GTX_projection 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Projection of a vector to other one 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../geometric.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_projection is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_projection extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_projection 29 | /// @{ 30 | 31 | /// Projects x on Normal. 32 | /// 33 | /// @see gtx_projection 34 | template 35 | GLM_FUNC_DECL genType proj(genType const& x, genType const& Normal); 36 | 37 | /// @} 38 | }//namespace glm 39 | 40 | #include "projection.inl" 41 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType proj(genType const& x, genType const& Normal) 8 | { 9 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 10 | } 11 | }//namespace glm 12 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/raw_data.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_raw_data GLM_GTX_raw_data 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Projection of a vector to other one 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../detail/setup.hpp" 17 | #include "../detail/type_int.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_raw_data is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_raw_data extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_raw_data 30 | /// @{ 31 | 32 | //! Type for byte numbers. 33 | //! From GLM_GTX_raw_data extension. 34 | typedef detail::uint8 byte; 35 | 36 | //! Type for word numbers. 37 | //! From GLM_GTX_raw_data extension. 38 | typedef detail::uint16 word; 39 | 40 | //! Type for dword numbers. 41 | //! From GLM_GTX_raw_data extension. 42 | typedef detail::uint32 dword; 43 | 44 | //! Type for qword numbers. 45 | //! From GLM_GTX_raw_data extension. 46 | typedef detail::uint64 qword; 47 | 48 | /// @} 49 | }// namespace glm 50 | 51 | #include "raw_data.inl" 52 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.inl 3 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/rotate_normalized_axis.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_rotate_normalized_axis 2 | /// @file glm/gtx/rotate_normalized_axis.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotateNormalizedAxis 8 | ( 9 | mat<4, 4, T, Q> const& m, 10 | T const& angle, 11 | vec<3, T, Q> const& v 12 | ) 13 | { 14 | T const a = angle; 15 | T const c = cos(a); 16 | T const s = sin(a); 17 | 18 | vec<3, T, Q> const axis(v); 19 | 20 | vec<3, T, Q> const temp((static_cast(1) - c) * axis); 21 | 22 | mat<4, 4, T, Q> Rotate; 23 | Rotate[0][0] = c + temp[0] * axis[0]; 24 | Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2]; 25 | Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1]; 26 | 27 | Rotate[1][0] = 0 + temp[1] * axis[0] - s * axis[2]; 28 | Rotate[1][1] = c + temp[1] * axis[1]; 29 | Rotate[1][2] = 0 + temp[1] * axis[2] + s * axis[0]; 30 | 31 | Rotate[2][0] = 0 + temp[2] * axis[0] + s * axis[1]; 32 | Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0]; 33 | Rotate[2][2] = c + temp[2] * axis[2]; 34 | 35 | mat<4, 4, T, Q> Result; 36 | Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2]; 37 | Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2]; 38 | Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2]; 39 | Result[3] = m[3]; 40 | return Result; 41 | } 42 | 43 | template 44 | GLM_FUNC_QUALIFIER tquat rotateNormalizedAxis 45 | ( 46 | tquat const& q, 47 | T const& angle, 48 | vec<3, T, Q> const& v 49 | ) 50 | { 51 | vec<3, T, Q> const Tmp(v); 52 | 53 | T const AngleRad(angle); 54 | T const Sin = sin(AngleRad * T(0.5)); 55 | 56 | return q * tquat(cos(AngleRad * static_cast(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin); 57 | //return gtc::quaternion::cross(q, tquat(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin)); 58 | } 59 | }//namespace glm 60 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/scalar_relational.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Extend a position from a source to a position at a defined length. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 20 | #endif 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTX_extend extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_scalar_relational 29 | /// @{ 30 | 31 | 32 | 33 | /// @} 34 | }//namespace glm 35 | 36 | #include "scalar_relational.inl" 37 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/scalar_relational.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER bool lessThan 8 | ( 9 | T const& x, 10 | T const& y 11 | ) 12 | { 13 | return x < y; 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER bool lessThanEqual 18 | ( 19 | T const& x, 20 | T const& y 21 | ) 22 | { 23 | return x <= y; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER bool greaterThan 28 | ( 29 | T const& x, 30 | T const& y 31 | ) 32 | { 33 | return x > y; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER bool greaterThanEqual 38 | ( 39 | T const& x, 40 | T const& y 41 | ) 42 | { 43 | return x >= y; 44 | } 45 | 46 | template 47 | GLM_FUNC_QUALIFIER bool equal 48 | ( 49 | T const& x, 50 | T const& y 51 | ) 52 | { 53 | return detail::compute_equal::call(x, y); 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER bool notEqual 58 | ( 59 | T const& x, 60 | T const& y 61 | ) 62 | { 63 | return !detail::compute_equal::call(x, y); 64 | } 65 | 66 | GLM_FUNC_QUALIFIER bool any 67 | ( 68 | bool const& x 69 | ) 70 | { 71 | return x; 72 | } 73 | 74 | GLM_FUNC_QUALIFIER bool all 75 | ( 76 | bool const& x 77 | ) 78 | { 79 | return x; 80 | } 81 | 82 | GLM_FUNC_QUALIFIER bool not_ 83 | ( 84 | bool const& x 85 | ) 86 | { 87 | return !x; 88 | } 89 | }//namespace glm 90 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/spline.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_spline 2 | /// @file glm/gtx/spline.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_spline GLM_GTX_spline 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Spline functions 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtx/optimum_pow.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_spline is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_spline extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_spline 30 | /// @{ 31 | 32 | /// Return a point from a catmull rom curve. 33 | /// @see gtx_spline extension. 34 | template 35 | GLM_FUNC_DECL genType catmullRom( 36 | genType const& v1, 37 | genType const& v2, 38 | genType const& v3, 39 | genType const& v4, 40 | typename genType::value_type const& s); 41 | 42 | /// Return a point from a hermite curve. 43 | /// @see gtx_spline extension. 44 | template 45 | GLM_FUNC_DECL genType hermite( 46 | genType const& v1, 47 | genType const& t1, 48 | genType const& v2, 49 | genType const& t2, 50 | typename genType::value_type const& s); 51 | 52 | /// Return a point from a cubic curve. 53 | /// @see gtx_spline extension. 54 | template 55 | GLM_FUNC_DECL genType cubic( 56 | genType const& v1, 57 | genType const& v2, 58 | genType const& v3, 59 | genType const& v4, 60 | typename genType::value_type const& s); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "spline.inl" 66 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | /// @file glm/gtx/std_based_type.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/string_cast.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_string_cast 2 | /// @file glm/gtx/string_cast.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_integer (dependence) 6 | /// @see gtx_quaternion (dependence) 7 | /// 8 | /// @defgroup gtx_string_cast GLM_GTX_string_cast 9 | /// @ingroup gtx 10 | /// 11 | /// Include to use the features of this extension. 12 | /// 13 | /// Setup strings for GLM type values 14 | /// 15 | /// This extension is not supported with CUDA 16 | 17 | #pragma once 18 | 19 | // Dependency: 20 | #include "../glm.hpp" 21 | #include "../gtc/type_precision.hpp" 22 | #include "../gtc/quaternion.hpp" 23 | #include "../gtx/dual_quaternion.hpp" 24 | #include 25 | #include 26 | 27 | #ifndef GLM_ENABLE_EXPERIMENTAL 28 | # error "GLM: GLM_GTX_string_cast is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 29 | #endif 30 | 31 | #if(GLM_COMPILER & GLM_COMPILER_CUDA) 32 | # error "GLM_GTX_string_cast is not supported on CUDA compiler" 33 | #endif 34 | 35 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 36 | # pragma message("GLM: GLM_GTX_string_cast extension included") 37 | #endif 38 | 39 | namespace glm 40 | { 41 | /// @addtogroup gtx_string_cast 42 | /// @{ 43 | 44 | /// Create a string from a GLM vector or matrix typed variable. 45 | /// @see gtx_string_cast extension. 46 | template 47 | GLM_FUNC_DECL std::string to_string(genType const& x); 48 | 49 | /// @} 50 | }//namespace glm 51 | 52 | #include "string_cast.inl" 53 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/texture.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_texture 2 | /// @file glm/gtx/texture.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_texture GLM_GTX_texture 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Wrapping mode of texture coordinates. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtc/integer.hpp" 18 | #include "../gtx/component_wise.hpp" 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_texture is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 22 | #endif 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_texture extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_texture 31 | /// @{ 32 | 33 | /// Compute the number of mipmaps levels necessary to create a mipmap complete texture 34 | /// 35 | /// @param Extent Extent of the texture base level mipmap 36 | /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector 37 | /// @tparam T Floating-point or signed integer scalar types 38 | /// @tparam Q Value from qualifier enum 39 | template 40 | T levels(vec const& Extent); 41 | 42 | /// @} 43 | }// namespace glm 44 | 45 | #include "texture.inl" 46 | 47 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/texture.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_texture 2 | /// @file glm/gtx/texture.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | inline T levels(vec const& Extent) 8 | { 9 | return glm::log2(compMax(Extent)) + static_cast(1); 10 | } 11 | 12 | template 13 | inline T levels(T Extent) 14 | { 15 | return vec<1, T, defaultp>(Extent).x; 16 | } 17 | }//namespace glm 18 | 19 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/transform.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_transform 2 | /// @file glm/gtx/transform.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_matrix_transform (dependence) 6 | /// @see gtx_transform 7 | /// @see gtx_transform2 8 | /// 9 | /// @defgroup gtx_transform GLM_GTX_transform 10 | /// @ingroup gtx 11 | /// 12 | /// Include to use the features of this extension. 13 | /// 14 | /// Add transformation matrices 15 | 16 | #pragma once 17 | 18 | // Dependency: 19 | #include "../glm.hpp" 20 | #include "../gtc/matrix_transform.hpp" 21 | 22 | #ifndef GLM_ENABLE_EXPERIMENTAL 23 | # error "GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 24 | #endif 25 | 26 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 27 | # pragma message("GLM: GLM_GTX_transform extension included") 28 | #endif 29 | 30 | namespace glm 31 | { 32 | /// @addtogroup gtx_transform 33 | /// @{ 34 | 35 | /// Transforms a matrix with a translation 4 * 4 matrix created from 3 scalars. 36 | /// @see gtc_matrix_transform 37 | /// @see gtx_transform 38 | template 39 | GLM_FUNC_DECL mat<4, 4, T, Q> translate( 40 | vec<3, T, Q> const& v); 41 | 42 | /// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians. 43 | /// @see gtc_matrix_transform 44 | /// @see gtx_transform 45 | template 46 | GLM_FUNC_DECL mat<4, 4, T, Q> rotate( 47 | T angle, 48 | vec<3, T, Q> const& v); 49 | 50 | /// Transforms a matrix with a scale 4 * 4 matrix created from a vector of 3 components. 51 | /// @see gtc_matrix_transform 52 | /// @see gtx_transform 53 | template 54 | GLM_FUNC_DECL mat<4, 4, T, Q> scale( 55 | vec<3, T, Q> const& v); 56 | 57 | /// @} 58 | }// namespace glm 59 | 60 | #include "transform.inl" 61 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_transform 2 | /// @file glm/gtx/transform.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(vec<3, T, Q> const& v) 8 | { 9 | return translate(mat<4, 4, T, Q>(static_cast(1)), v); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate(T angle, vec<3, T, Q> const& v) 14 | { 15 | return rotate(mat<4, 4, T, Q>(static_cast(1)), angle, v); 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale(vec<3, T, Q> const& v) 20 | { 21 | return scale(mat<4, 4, T, Q>(static_cast(1)), v); 22 | } 23 | 24 | }//namespace glm 25 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/type_aligned.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_type_aligned 2 | /// @file glm/gtc/type_aligned.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/vector_angle.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_vector_angle 2 | /// @file glm/gtx/vector_angle.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType angle 8 | ( 9 | genType const& x, 10 | genType const& y 11 | ) 12 | { 13 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); 14 | return acos(clamp(dot(x, y), genType(-1), genType(1))); 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER T angle(vec const& x, vec const& y) 19 | { 20 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'angle' only accept floating-point inputs"); 21 | return acos(clamp(dot(x, y), T(-1), T(1))); 22 | } 23 | 24 | //! \todo epsilon is hard coded to 0.01 25 | template 26 | GLM_FUNC_QUALIFIER T orientedAngle(vec<2, T, Q> const& x, vec<2, T, Q> const& y) 27 | { 28 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); 29 | T const Angle(acos(clamp(dot(x, y), T(-1), T(1)))); 30 | 31 | if(all(epsilonEqual(y, glm::rotate(x, Angle), T(0.0001)))) 32 | return Angle; 33 | else 34 | return -Angle; 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER T orientedAngle(vec<3, T, Q> const& x, vec<3, T, Q> const& y, vec<3, T, Q> const& ref) 39 | { 40 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'orientedAngle' only accept floating-point inputs"); 41 | 42 | T const Angle(acos(clamp(dot(x, y), T(-1), T(1)))); 43 | return mix(Angle, -Angle, dot(ref, cross(x, y)) < T(0)); 44 | } 45 | }//namespace glm 46 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/wrap.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_wrap 2 | /// @file glm/gtx/wrap.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_wrap GLM_GTX_wrap 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Wrapping mode of texture coordinates. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtc/vec1.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_wrap is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." 21 | #endif 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_wrap extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_wrap 30 | /// @{ 31 | 32 | /// Simulate GL_CLAMP OpenGL wrap mode 33 | /// @see gtx_wrap extension. 34 | template 35 | GLM_FUNC_DECL genType clamp(genType const& Texcoord); 36 | 37 | /// Simulate GL_REPEAT OpenGL wrap mode 38 | /// @see gtx_wrap extension. 39 | template 40 | GLM_FUNC_DECL genType repeat(genType const& Texcoord); 41 | 42 | /// Simulate GL_MIRRORED_REPEAT OpenGL wrap mode 43 | /// @see gtx_wrap extension. 44 | template 45 | GLM_FUNC_DECL genType mirrorClamp(genType const& Texcoord); 46 | 47 | /// Simulate GL_MIRROR_REPEAT OpenGL wrap mode 48 | /// @see gtx_wrap extension. 49 | template 50 | GLM_FUNC_DECL genType mirrorRepeat(genType const& Texcoord); 51 | 52 | /// @} 53 | }// namespace glm 54 | 55 | #include "wrap.inl" 56 | -------------------------------------------------------------------------------- /Valag/include/glm/gtx/wrap.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_wrap 2 | /// @file glm/gtx/wrap.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vec clamp(vec const& Texcoord) 8 | { 9 | return glm::clamp(Texcoord, vec(0), vec(1)); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType clamp(genType const& Texcoord) 14 | { 15 | return clamp(vec<1, genType, defaultp>(Texcoord)).x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER vec repeat(vec const& Texcoord) 20 | { 21 | return glm::fract(Texcoord); 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER genType repeat(genType const& Texcoord) 26 | { 27 | return repeat(vec<1, genType, defaultp>(Texcoord)).x; 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER vec mirrorClamp(vec const& Texcoord) 32 | { 33 | return glm::fract(glm::abs(Texcoord)); 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER genType mirrorClamp(genType const& Texcoord) 38 | { 39 | return mirrorClamp(vec<1, genType, defaultp>(Texcoord)).x; 40 | } 41 | 42 | template 43 | GLM_FUNC_QUALIFIER vec mirrorRepeat(vec const& Texcoord) 44 | { 45 | vec const Abs = glm::abs(Texcoord); 46 | vec const Clamp = glm::mod(glm::floor(Abs), vec(2)); 47 | vec const Floor = glm::floor(Abs); 48 | vec const Rest = Abs - Floor; 49 | vec const Mirror = Clamp + Rest; 50 | return mix(Rest, vec(1) - Rest, glm::greaterThanEqual(Mirror, vec(1))); 51 | } 52 | 53 | template 54 | GLM_FUNC_QUALIFIER genType mirrorRepeat(genType const& Texcoord) 55 | { 56 | return mirrorRepeat(vec<1, genType, defaultp>(Texcoord)).x; 57 | } 58 | }//namespace glm 59 | -------------------------------------------------------------------------------- /Valag/include/glm/mat2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x3.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat2x3.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 2 columns of 3 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<2, 3, float, lowp> lowp_mat2x3; 18 | 19 | /// 2 columns of 3 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<2, 3, float, mediump> mediump_mat2x3; 25 | 26 | /// 2 columns of 3 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<2, 3, float, highp> highp_mat2x3; 32 | 33 | }//namespace glm 34 | 35 | -------------------------------------------------------------------------------- /Valag/include/glm/mat2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x4.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat2x4.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 2 columns of 4 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<2, 4, float, lowp> lowp_mat2x4; 18 | 19 | /// 2 columns of 4 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<2, 4, float, mediump> mediump_mat2x4; 25 | 26 | /// 2 columns of 4 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<2, 4, float, highp> highp_mat2x4; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /Valag/include/glm/mat3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x2.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat3x2.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 3 columns of 2 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<3, 2, float, lowp> lowp_mat3x2; 18 | 19 | /// 3 columns of 2 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<3, 2, float, mediump> mediump_mat3x2; 25 | 26 | /// 3 columns of 2 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<3, 2, float, highp> highp_mat3x2; 32 | 33 | }//namespace 34 | -------------------------------------------------------------------------------- /Valag/include/glm/mat3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x4.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat3x4.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 3 columns of 4 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<3, 4, float, lowp> lowp_mat3x4; 18 | 19 | /// 3 columns of 4 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<3, 4, float, mediump> mediump_mat3x4; 25 | 26 | /// 3 columns of 4 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<3, 4, float, highp> highp_mat3x4; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /Valag/include/glm/mat4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x2.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat4x2.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 4 columns of 2 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<4, 2, float, lowp> lowp_mat4x2; 18 | 19 | /// 4 columns of 2 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<4, 2, float, mediump> mediump_mat4x2; 25 | 26 | /// 4 columns of 2 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<4, 2, float, highp> highp_mat4x2; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /Valag/include/glm/mat4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x3.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_mat4x3.hpp" 9 | 10 | namespace glm 11 | { 12 | /// 4 columns of 3 components matrix of low qualifier floating-point numbers. 13 | /// There is no guarantee on the actual qualifier. 14 | /// 15 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 16 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 17 | typedef mat<4, 3, float, lowp> lowp_mat4x3; 18 | 19 | /// 4 columns of 3 components matrix of medium qualifier floating-point numbers. 20 | /// There is no guarantee on the actual qualifier. 21 | /// 22 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 23 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 24 | typedef mat<4, 3, float, mediump> mediump_mat4x3; 25 | 26 | /// 4 columns of 3 components matrix of high qualifier floating-point numbers. 27 | /// There is no guarantee on the actual qualifier. 28 | /// 29 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 30 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 31 | typedef mat<4, 3, float, highp> highp_mat4x3; 32 | 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /Valag/include/glm/simd/exponential.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/experimental.h 3 | 4 | #pragma once 5 | 6 | #include "platform.h" 7 | 8 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | GLM_FUNC_QUALIFIER glm_vec4 glm_vec1_sqrt_lowp(glm_vec4 x) 11 | { 12 | return _mm_mul_ss(_mm_rsqrt_ss(x), x); 13 | } 14 | 15 | GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_sqrt_lowp(glm_vec4 x) 16 | { 17 | return _mm_mul_ps(_mm_rsqrt_ps(x), x); 18 | } 19 | 20 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 21 | -------------------------------------------------------------------------------- /Valag/include/glm/simd/packing.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/packing.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /Valag/include/glm/simd/trigonometric.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/trigonometric.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | 10 | -------------------------------------------------------------------------------- /Valag/include/glm/simd/vector_relational.h: -------------------------------------------------------------------------------- 1 | /// @ref simd 2 | /// @file glm/simd/vector_relational.h 3 | 4 | #pragma once 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 9 | -------------------------------------------------------------------------------- /Valag/include/glm/vec2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec2.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_vec2.hpp" 9 | -------------------------------------------------------------------------------- /Valag/include/glm/vec3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec3.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_vec3.hpp" 9 | -------------------------------------------------------------------------------- /Valag/include/glm/vec4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec4.hpp 3 | 4 | #include "detail/setup.hpp" 5 | 6 | #pragma once 7 | 8 | #include "detail/type_vec4.hpp" 9 | -------------------------------------------------------------------------------- /Valag/include/vulkan/vulkan.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_H_ 2 | #define VULKAN_H_ 1 3 | 4 | /* 5 | ** Copyright (c) 2015-2018 The Khronos Group Inc. 6 | ** 7 | ** Licensed under the Apache License, Version 2.0 (the "License"); 8 | ** you may not use this file except in compliance with the License. 9 | ** You may obtain a copy of the License at 10 | ** 11 | ** http://www.apache.org/licenses/LICENSE-2.0 12 | ** 13 | ** Unless required by applicable law or agreed to in writing, software 14 | ** distributed under the License is distributed on an "AS IS" BASIS, 15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | ** See the License for the specific language governing permissions and 17 | ** limitations under the License. 18 | */ 19 | 20 | #include "vk_platform.h" 21 | #include "vulkan_core.h" 22 | 23 | #ifdef VK_USE_PLATFORM_ANDROID_KHR 24 | #include "vulkan_android.h" 25 | #endif 26 | 27 | 28 | #ifdef VK_USE_PLATFORM_IOS_MVK 29 | #include "vulkan_ios.h" 30 | #endif 31 | 32 | 33 | #ifdef VK_USE_PLATFORM_MACOS_MVK 34 | #include "vulkan_macos.h" 35 | #endif 36 | 37 | 38 | #ifdef VK_USE_PLATFORM_MIR_KHR 39 | #include 40 | #include "vulkan_mir.h" 41 | #endif 42 | 43 | 44 | #ifdef VK_USE_PLATFORM_VI_NN 45 | #include "vulkan_vi.h" 46 | #endif 47 | 48 | 49 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR 50 | #include 51 | #include "vulkan_wayland.h" 52 | #endif 53 | 54 | 55 | #ifdef VK_USE_PLATFORM_WIN32_KHR 56 | #include 57 | #include "vulkan_win32.h" 58 | #endif 59 | 60 | 61 | #ifdef VK_USE_PLATFORM_XCB_KHR 62 | #include 63 | #include "vulkan_xcb.h" 64 | #endif 65 | 66 | 67 | #ifdef VK_USE_PLATFORM_XLIB_KHR 68 | #include 69 | #include "vulkan_xlib.h" 70 | #endif 71 | 72 | 73 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT 74 | #include 75 | #include 76 | #include "vulkan_xlib_xrandr.h" 77 | #endif 78 | 79 | #endif // VULKAN_H_ 80 | -------------------------------------------------------------------------------- /Valag/include/vulkan/vulkan_vi.h: -------------------------------------------------------------------------------- 1 | #ifndef VULKAN_VI_H_ 2 | #define VULKAN_VI_H_ 1 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* 9 | ** Copyright (c) 2015-2018 The Khronos Group Inc. 10 | ** 11 | ** Licensed under the Apache License, Version 2.0 (the "License"); 12 | ** you may not use this file except in compliance with the License. 13 | ** You may obtain a copy of the License at 14 | ** 15 | ** http://www.apache.org/licenses/LICENSE-2.0 16 | ** 17 | ** Unless required by applicable law or agreed to in writing, software 18 | ** distributed under the License is distributed on an "AS IS" BASIS, 19 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | ** See the License for the specific language governing permissions and 21 | ** limitations under the License. 22 | */ 23 | 24 | /* 25 | ** This header is generated from the Khronos Vulkan XML API Registry. 26 | ** 27 | */ 28 | 29 | 30 | #define VK_NN_vi_surface 1 31 | #define VK_NN_VI_SURFACE_SPEC_VERSION 1 32 | #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" 33 | 34 | typedef VkFlags VkViSurfaceCreateFlagsNN; 35 | 36 | typedef struct VkViSurfaceCreateInfoNN { 37 | VkStructureType sType; 38 | const void* pNext; 39 | VkViSurfaceCreateFlagsNN flags; 40 | void* window; 41 | } VkViSurfaceCreateInfoNN; 42 | 43 | 44 | typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); 45 | 46 | #ifndef VK_NO_PROTOTYPES 47 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( 48 | VkInstance instance, 49 | const VkViSurfaceCreateInfoNN* pCreateInfo, 50 | const VkAllocationCallbacks* pAllocator, 51 | VkSurfaceKHR* pSurface); 52 | #endif 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /Valag/libs/VkLayer_api_dump.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/VkLayer_api_dump.lib -------------------------------------------------------------------------------- /Valag/libs/VkLayer_core_validation.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/VkLayer_core_validation.lib -------------------------------------------------------------------------------- /Valag/libs/VkLayer_device_simulation.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/VkLayer_device_simulation.lib -------------------------------------------------------------------------------- /Valag/libs/VkLayer_monitor.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/VkLayer_monitor.lib -------------------------------------------------------------------------------- /Valag/libs/VkLayer_object_tracker.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/VkLayer_object_tracker.lib -------------------------------------------------------------------------------- /Valag/libs/VkLayer_parameter_validation.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/VkLayer_parameter_validation.lib -------------------------------------------------------------------------------- /Valag/libs/VkLayer_screenshot.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/VkLayer_screenshot.lib -------------------------------------------------------------------------------- /Valag/libs/VkLayer_threading.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/VkLayer_threading.lib -------------------------------------------------------------------------------- /Valag/libs/VkLayer_unique_objects.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/VkLayer_unique_objects.lib -------------------------------------------------------------------------------- /Valag/libs/VkLayer_utils.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/VkLayer_utils.lib -------------------------------------------------------------------------------- /Valag/libs/libglfw3.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/libglfw3.a -------------------------------------------------------------------------------- /Valag/libs/libglfw3dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/libglfw3dll.a -------------------------------------------------------------------------------- /Valag/libs/shaderc_combined.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/shaderc_combined.lib -------------------------------------------------------------------------------- /Valag/libs/tinyxml/tinystr.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/tinyxml/tinystr.cpp -------------------------------------------------------------------------------- /Valag/libs/tinyxml/xmltest.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/tinyxml/xmltest.cpp -------------------------------------------------------------------------------- /Valag/libs/vulkan-1.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/vulkan-1.lib -------------------------------------------------------------------------------- /Valag/libs/vulkan-1.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/libs/vulkan-1.pdb -------------------------------------------------------------------------------- /Valag/shaders/blur.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout (constant_id = 0) const float radius = 0; 5 | layout (constant_id = 1) const bool vertical = false; 6 | 7 | layout (binding = 0) uniform sampler2D srcSampler; 8 | 9 | layout (location = 0) in vec2 inUV; 10 | 11 | layout (location = 0) out vec4 outColor; 12 | 13 | 14 | void main() 15 | { 16 | vec2 offset = vec2(1-int(vertical), int(vertical)) * radius; 17 | 18 | outColor = (texture(srcSampler, inUV/*gl_FragCoord.xy*/ + offset * 1.0) * 0.06 + 19 | texture(srcSampler, inUV/*gl_FragCoord.xy*/ + offset * 0.75) * 0.09 + 20 | texture(srcSampler, inUV/*gl_FragCoord.xy*/ + offset * 0.5) * 0.12 + 21 | texture(srcSampler, inUV/*gl_FragCoord.xy*/ + offset * 0.25) * 0.15 + 22 | texture(srcSampler, inUV/*gl_FragCoord.xy*/) * 0.16 + 23 | texture(srcSampler, inUV/*gl_FragCoord.xy*/ - offset * 1.0) * 0.06 + 24 | texture(srcSampler, inUV/*gl_FragCoord.xy*/ - offset * 0.75) * 0.09 + 25 | texture(srcSampler, inUV/*gl_FragCoord.xy*/ - offset * 0.5) * 0.12 + 26 | texture(srcSampler, inUV/*gl_FragCoord.xy*/ - offset * 0.25) * 0.15 ); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Valag/shaders/blur.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/blur.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/blur.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout (location = 0) out vec2 outUV; 5 | 6 | out gl_PerVertex 7 | { 8 | vec4 gl_Position; 9 | }; 10 | 11 | void main() 12 | { 13 | outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); 14 | gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Valag/shaders/blur.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/blur.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/compileAllShaders.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | for /r %%i in (*.frag) do %VULKAN_SDK%/Bin/glslangValidator.exe -V -o %%i.spv %%i 3 | for /r %%i in (*.vert) do %VULKAN_SDK%/Bin/glslangValidator.exe -V -o %%i.spv %%i 4 | Echo Finished ! 5 | PAUSE >nul -------------------------------------------------------------------------------- /Valag/shaders/defaultShader.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(location = 0) in vec2 fragTexCoord; 5 | 6 | layout(binding = 0, set = 2) uniform ModelUBO { 7 | mat4 model; 8 | vec4 color; 9 | vec2 texPos; 10 | vec2 texExt; 11 | } modelUbo; 12 | 13 | layout(binding = 0, set = 1) uniform sampler samp; 14 | layout(binding = 1, set = 1) uniform texture2DArray textures[128]; 15 | 16 | layout(push_constant) uniform PER_OBJECT 17 | { 18 | int texId; 19 | int texLayer; 20 | }pc; 21 | 22 | layout(location = 0) out vec4 outColor; 23 | 24 | void main() 25 | { 26 | outColor = texture(sampler2DArray(textures[pc.texId], samp), vec3(fragTexCoord,pc.texLayer)) * modelUbo.color; 27 | if(outColor.a == 0) 28 | discard; 29 | } 30 | 31 | 32 | /**#version 450 33 | #extension GL_ARB_separate_shader_objects : enable 34 | 35 | layout(binding = 0, set = 2) uniform ModelUBO { 36 | mat4 model; 37 | vec4 color; 38 | } modelUbo; 39 | 40 | //layout(location = 0) in vec4 fragColor; 41 | layout(location = 0) in vec2 fragTexCoord; 42 | 43 | layout(binding = 0, set = 1) uniform sampler samp; 44 | layout(binding = 1, set = 1) uniform texture2DArray textures[128]; 45 | 46 | layout(push_constant) uniform PER_OBJECT 47 | { 48 | int texId; 49 | int texLayer; 50 | }pc; 51 | 52 | layout(location = 0) out vec4 outColor; 53 | 54 | void main() 55 | { 56 | outColor = texture(sampler2DArray(textures[pc.texId], samp), vec3(fragTexCoord,pc.texLayer)) * modelUbo.color; 57 | //vec4(fragColor, 1.0); 58 | }**/ 59 | 60 | -------------------------------------------------------------------------------- /Valag/shaders/defaultShader.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/defaultShader.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/defaultShader.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(binding = 0, set = 0) uniform ViewUBO { 5 | mat4 view; 6 | mat4 viewInv; 7 | vec2 screenOffset; 8 | vec2 screenSizeFactor; 9 | vec2 depthOffsetAndFactor; 10 | } viewUbo; 11 | 12 | layout(binding = 0, set = 2) uniform ModelUBO { 13 | mat4 model; 14 | vec4 color; 15 | vec2 texPos; 16 | vec2 texExt; 17 | } modelUbo; 18 | 19 | layout(location = 0) out vec2 fragTexCoord; 20 | 21 | vec2 vertPos[4] = vec2[]( 22 | vec2(0.0, 1.0), 23 | vec2(0.0, 0.0), 24 | vec2(1.0, 1.0), 25 | vec2(1.0, 0.0) 26 | ); 27 | 28 | out gl_PerVertex { 29 | vec4 gl_Position; 30 | }; 31 | 32 | void main() { 33 | gl_Position = viewUbo.view * modelUbo.model * vec4(vertPos[gl_VertexIndex], 0.0, 1.0); 34 | gl_Position.xyz = gl_Position.xyz * vec3(viewUbo.screenSizeFactor, viewUbo.depthOffsetAndFactor.y) 35 | + vec3(viewUbo.screenOffset, viewUbo.depthOffsetAndFactor.x); 36 | fragTexCoord = modelUbo.texExt * vertPos[gl_VertexIndex] + modelUbo.texPos; 37 | } 38 | 39 | 40 | 41 | /**#version 450 42 | #extension GL_ARB_separate_shader_objects : enable 43 | 44 | layout(binding = 0, set = 0) uniform ViewUBO { 45 | mat4 view; 46 | } viewUbo; 47 | 48 | layout(binding = 0, set = 2) uniform ModelUBO { 49 | mat4 model; 50 | vec4 color; 51 | } modelUbo; 52 | 53 | layout(location = 0) in vec2 inPosition; 54 | //layout(location = 1) in vec4 inColor; 55 | layout(location = 1) in vec2 inTexCoord; 56 | 57 | //layout(location = 0) out vec4 fragColor; 58 | layout(location = 0) out vec2 fragTexCoord; 59 | 60 | out gl_PerVertex { 61 | vec4 gl_Position; 62 | }; 63 | 64 | void main() { 65 | gl_Position = viewUbo.view * modelUbo.model * vec4(inPosition, 0.0, 1.0); 66 | //fragColor = inColor; 67 | fragTexCoord = inTexCoord; 68 | }**/ 69 | -------------------------------------------------------------------------------- /Valag/shaders/defaultShader.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/defaultShader.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/compileAllShaders.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | for /r %%i in (*.frag) do %VULKAN_SDK%/Bin/glslangValidator.exe -V -o %%i.spv %%i 3 | for /r %%i in (*.vert) do %VULKAN_SDK%/Bin/glslangValidator.exe -V -o %%i.spv %%i 4 | Echo Finished ! 5 | PAUSE >nul -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteAlphaDetection.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(binding = 0, set = 1) uniform sampler samp; 5 | layout(binding = 1, set = 1) uniform texture2DArray textures[128]; 6 | 7 | layout(location = 0) flat in float fragColorA; 8 | layout(location = 1) in vec2 fragTexCoord; 9 | layout(location = 2) flat in uvec2 fragAlbedoTexId; 10 | layout(location = 3) flat in uvec2 fragHeightTexId; 11 | layout(location = 4) flat in float depthFactor; 12 | 13 | layout(location = 0) out vec4 outAlpha; 14 | 15 | void main() 16 | { 17 | float albedoA = fragColorA * texture(sampler2DArray(textures[fragAlbedoTexId.x], samp), vec3(fragTexCoord,fragAlbedoTexId.y)).a; 18 | 19 | if(albedoA < .05 || albedoA >= .99f) 20 | discard; 21 | 22 | vec4 heightPixel = texture(sampler2DArray(textures[fragHeightTexId.x], samp), vec3(fragTexCoord,fragHeightTexId.y)); 23 | 24 | //if(fragColorA < .99f) 25 | // heightPixel.a = 1.0f; 26 | 27 | if(fragColorA > .99f && heightPixel.a < 1.0f ) 28 | discard; 29 | 30 | heightPixel.a = 1.0; 31 | 32 | /// float height = (heightPixel.r + heightPixel.g + heightPixel.b) * 0.33333333; 33 | 34 | /// gl_FragDepth = gl_FragCoord.z + height * depthFactor; 35 | 36 | ///I would need to use a different depthBuffer to do that properly 37 | //outAlpha = heightPixel.a; 38 | outAlpha.a = heightPixel.a; 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteAlphaDetection.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteAlphaDetection.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteAlphaDetection.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteAlphaDetection.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteAlphaShader.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteAlphaShader.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteShader.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteShader.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteShader.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteShader.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteShadow.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteShadow.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteShadow.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(binding = 0, set = 0) uniform ViewUBO { 5 | mat4 view; 6 | mat4 viewInv; 7 | vec2 screenOffset; 8 | vec2 screenSizeFactor; 9 | vec2 depthOffsetAndFactor; 10 | } viewUbo; 11 | 12 | layout(push_constant) uniform PER_OBJECT 13 | { 14 | vec4 camPosAndZoom; 15 | vec2 shadowShift; 16 | }pc; 17 | 18 | layout(location = 0) in vec3 inPos; 19 | layout(location = 1) in vec3 inSize; 20 | layout(location = 2) in vec2 inCenter; 21 | layout(location = 3) in vec2 inTexCoord; 22 | layout(location = 4) in vec2 inTexExtent; 23 | layout(location = 5) in uvec2 inTexId; 24 | 25 | layout(location = 0) out vec2 fragTexCoord; 26 | layout(location = 1) flat out uvec2 fragTexId; 27 | layout(location = 2) out vec4 screenPosAndHeight; 28 | 29 | 30 | vec2 vertPos[4] = vec2[]( 31 | vec2(0.0, 1.0), 32 | vec2(0.0, 0.0), 33 | vec2(1.0, 1.0), 34 | vec2(1.0, 0.0) 35 | ); 36 | 37 | out gl_PerVertex 38 | { 39 | vec4 gl_Position; 40 | }; 41 | 42 | void main() 43 | { 44 | vec4 spriteViewCenter = viewUbo.view*vec4(vec3(inPos.xy,0.0)-pc.camPosAndZoom.xyz,1.0); 45 | //spriteViewCenter.xy -= min(pc.shadowShift, 0.0); 46 | spriteViewCenter.xy -= pc.shadowShift * 0.5; 47 | spriteViewCenter.z = inPos.z; 48 | 49 | gl_Position = vec4(spriteViewCenter.xyz + vec3((vertPos[gl_VertexIndex] * inSize.xy - inCenter), 0.0), 1.0); 50 | 51 | screenPosAndHeight = vec4(gl_Position.xyz, inSize.z); 52 | 53 | vec2 shadowSizeFactor = 2.0/(2.0/viewUbo.screenSizeFactor+abs(pc.shadowShift)); 54 | 55 | gl_Position.xyz = gl_Position.xyz * vec3(shadowSizeFactor, viewUbo.depthOffsetAndFactor.y) 56 | + vec3(viewUbo.screenOffset, viewUbo.depthOffsetAndFactor.x); 57 | 58 | fragTexCoord = inTexExtent * vertPos[gl_VertexIndex] + inTexCoord; 59 | fragTexId = inTexId; 60 | } 61 | 62 | 63 | -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteShadow.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteShadow.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteShadowFilt.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteShadowFilt.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteShadowFilt.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | 5 | layout(location = 0) in vec3 inDirection; 6 | layout(location = 1) in vec3 inSize; 7 | layout(location = 2) in vec2 inTexCoord; 8 | layout(location = 3) in vec2 inTexExtent; 9 | layout(location = 4) in uvec2 inAlbedoTexId; 10 | layout(location = 5) in uvec2 inHeightTexId; 11 | 12 | layout(location = 0) out vec2 outUV; 13 | layout(location = 1) flat out vec2 spriteSize; 14 | layout(location = 2) flat out uvec2 spriteAlbedoTexId; 15 | 16 | 17 | out gl_PerVertex 18 | { 19 | vec4 gl_Position; 20 | }; 21 | 22 | void main() 23 | { 24 | outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); 25 | gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); 26 | 27 | spriteSize = inSize.xy; 28 | spriteAlbedoTexId = inAlbedoTexId; 29 | 30 | /*spriteTexCoord = inTexCoord; 31 | spriteTexExtent = inTexExtent; 32 | spriteAlbedoTexId = inAlbedoTexId; 33 | spriteHeightTexId = inHeightTexId;*/ 34 | 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteShadowFilt.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteShadowFilt.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteShadowGen.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteShadowGen.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/isoSpriteShadowGen.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/isoSpriteShadowGen.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/meshDirectShadow.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(binding = 0, set = 0) uniform ViewUBO { 5 | mat4 view; 6 | mat4 viewInv; 7 | vec2 screenOffset; 8 | vec2 screenSizeFactor; 9 | vec2 depthOffsetAndFactor; 10 | } viewUbo; 11 | 12 | layout(binding = 0, set = 1) uniform sampler samp; 13 | layout(binding = 1, set = 1) uniform texture2DArray textures[128]; 14 | 15 | layout(location = 0) in vec2 fragUV; 16 | layout(location = 1) flat in uvec2 fragAlbedoTexId; 17 | 18 | void main() 19 | { 20 | float albedoA = texture(sampler2DArray(textures[fragAlbedoTexId.x], samp), 21 | vec3(fragUV,fragAlbedoTexId.y)).a; 22 | 23 | if(albedoA < .99f) 24 | discard; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Valag/shaders/deferred/meshDirectShadow.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/meshDirectShadow.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/meshDirectShadow.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/meshDirectShadow.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/meshShader.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/meshShader.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/deferred/meshShader.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/deferred/meshShader.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/instancingShader.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | 5 | layout(binding = 0, set = 1) uniform sampler samp; 6 | layout(binding = 1, set = 1) uniform texture2DArray textures[128]; 7 | 8 | layout(location = 0) in vec4 fragColor; 9 | layout(location = 1) in vec2 fragTexCoord; 10 | layout(location = 2) in vec2 fragTexId; 11 | 12 | layout(location = 0) out vec4 outColor; 13 | 14 | void main() 15 | { 16 | outColor = texture(sampler2DArray(textures[int(fragTexId.x)], samp), vec3(fragTexCoord,fragTexId.y)) * fragColor ; 17 | if(outColor.a == 0) 18 | discard; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Valag/shaders/instancingShader.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/instancingShader.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/instancingShader.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout(binding = 0, set = 0) uniform ViewUBO { 5 | mat4 view; 6 | mat4 viewInv; 7 | vec2 screenOffset; 8 | vec2 screenSizeFactor; 9 | vec2 depthOffsetAndFactor; 10 | } viewUbo; 11 | 12 | /*layout(location = 0) in vec2 inPosUpLeft; 13 | layout(location = 1) in vec2 inPosUpRight; 14 | layout(location = 2) in vec2 inPosDownLeft; 15 | layout(location = 3) in float inLayer;*/ 16 | layout(location = 0) in mat4 inModel; 17 | layout(location = 4) in vec4 inColor; 18 | layout(location = 5) in vec2 inTexCoord; 19 | layout(location = 6) in vec2 inTexExtent; 20 | layout(location = 7) in vec2 inTexId; 21 | 22 | layout(location = 0) out vec4 fragColor; 23 | layout(location = 1) out vec2 fragTexCoord; 24 | layout(location = 2) out vec2 fragTexId; 25 | 26 | 27 | vec2 vertPos[4] = vec2[]( 28 | vec2(0.0, 1.0), 29 | vec2(0.0, 0.0), 30 | vec2(1.0, 1.0), 31 | vec2(1.0, 0.0) 32 | ); 33 | 34 | void main() 35 | { 36 | gl_Position = /*viewUbo.view * */ inModel * vec4(vertPos[gl_VertexIndex], 0.0, 1.0); 37 | //gl_Position.xyz = gl_Position.xyz * viewUbo.screenSizeFactor + viewUbo.screenOffset; 38 | gl_Position.xyz = gl_Position.xyz * vec3(viewUbo.screenSizeFactor, viewUbo.depthOffsetAndFactor.y) 39 | + vec3(viewUbo.screenOffset, viewUbo.depthOffsetAndFactor.x); 40 | fragTexCoord = inTexExtent * vertPos[gl_VertexIndex] + inTexCoord; 41 | fragColor = inColor; 42 | fragTexId = inTexId; 43 | 44 | /*vec2 worldScreenCoord = inPosUpLeft + vertPos[gl_VertexIndex].x * inPosUpRight 45 | 46 | gl_Position = viewUbo.view * vec4(inPos, 1.0); 47 | fragColor = inColor; 48 | fragTexCoord = inTexCoord; 49 | fragTexId = inTexId;*/ 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /Valag/shaders/instancingShader.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/instancingShader.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/lighting/ambientLighting.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/lighting/ambientLighting.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/lighting/ambientLighting.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout (location = 0) out vec2 outUV; 5 | 6 | out gl_PerVertex 7 | { 8 | vec4 gl_Position; 9 | }; 10 | 11 | void main() 12 | { 13 | outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); 14 | gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Valag/shaders/lighting/ambientLighting.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/lighting/ambientLighting.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/lighting/brdflut.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/lighting/brdflut.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/lighting/brdflut.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout (location = 0) out vec2 outUV; 5 | 6 | out gl_PerVertex 7 | { 8 | vec4 gl_Position; 9 | }; 10 | 11 | void main() 12 | { 13 | outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); 14 | gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Valag/shaders/lighting/brdflut.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/lighting/brdflut.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/lighting/compileAllShaders.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | for /r %%i in (*.frag) do %VULKAN_SDK%/Bin/glslangValidator.exe -V -o %%i.spv %%i 3 | for /r %%i in (*.vert) do %VULKAN_SDK%/Bin/glslangValidator.exe -V -o %%i.spv %%i 4 | Echo Finished ! 5 | PAUSE >nul -------------------------------------------------------------------------------- /Valag/shaders/lighting/iblfiltering.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/lighting/iblfiltering.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/lighting/iblfiltering.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout (location = 0) out vec2 outUV; 5 | 6 | out gl_PerVertex 7 | { 8 | vec4 gl_Position; 9 | }; 10 | 11 | void main() 12 | { 13 | outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); 14 | gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Valag/shaders/lighting/iblfiltering.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/lighting/iblfiltering.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/lighting/lighting.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/lighting/lighting.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/lighting/lighting.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/lighting/lighting.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/lighting/ssgiBN.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/lighting/ssgiBN.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/lighting/ssgiBN.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout (location = 0) out vec2 outUV; 5 | 6 | out gl_PerVertex 7 | { 8 | vec4 gl_Position; 9 | }; 10 | 11 | void main() 12 | { 13 | outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); 14 | gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Valag/shaders/lighting/ssgiBN.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/lighting/ssgiBN.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/smartBlur.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/smartBlur.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/smartBlur.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout (location = 0) out vec2 outUV; 5 | 6 | out gl_PerVertex 7 | { 8 | vec4 gl_Position; 9 | }; 10 | 11 | void main() 12 | { 13 | outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); 14 | gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Valag/shaders/smartBlur.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/smartBlur.vert.spv -------------------------------------------------------------------------------- /Valag/shaders/toneMapping.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout (binding = 0) uniform sampler2D samplerHdr; 5 | layout (binding = 1) uniform sampler2D samplerAlphaHdr; 6 | 7 | layout (location = 0) in vec2 inUV; 8 | 9 | layout (location = 0) out vec4 outColor; 10 | 11 | 12 | void main() 13 | { 14 | float exposure = 0.8; 15 | 16 | vec3 opac = texture(samplerHdr,inUV).rgb; 17 | vec4 alpha = texture(samplerAlphaHdr,inUV); 18 | 19 | vec3 final = opac * (1.0f-alpha.a) + alpha.rgb * alpha.a; 20 | 21 | outColor = vec4(vec3(1.0) - exp(-final * exposure), 1.0); 22 | outColor.rgb = pow(outColor.rgb, vec3(1.0/2.2)); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Valag/shaders/toneMapping.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/toneMapping.frag.spv -------------------------------------------------------------------------------- /Valag/shaders/toneMapping.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | #extension GL_ARB_separate_shader_objects : enable 3 | 4 | layout (location = 0) out vec2 outUV; 5 | 6 | out gl_PerVertex 7 | { 8 | vec4 gl_Position; 9 | }; 10 | 11 | void main() 12 | { 13 | outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2); 14 | gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Valag/shaders/toneMapping.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gregouar/VALAG/a62bc5b0a59e1141434b71b793d7caca38b845e9/Valag/shaders/toneMapping.vert.spv -------------------------------------------------------------------------------- /Valag/src/core/Config.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/core/Config.h" 2 | 3 | #include 4 | #include 5 | #include "Valag/utils/Logger.h" 6 | #include "Valag/utils/Parser.h" 7 | 8 | namespace vlg{ 9 | 10 | Config::Config() 11 | { 12 | //ctor 13 | } 14 | 15 | Config::~Config() 16 | { 17 | //dtor 18 | } 19 | 20 | 21 | bool Config::load(const std::string& filePath) 22 | { 23 | std::ifstream file; 24 | file.open(filePath.c_str(),std::ifstream::in); 25 | 26 | if(!file.is_open()) 27 | { 28 | Logger::error("Can't open config file: "+filePath); 29 | return (false); 30 | } 31 | 32 | file.close(); 33 | return (true); 34 | } 35 | 36 | 37 | bool Config::getBool(const std::string& s, const std::string& n, const std::string& d) 38 | { 39 | return Parser::parseBool(Config::getString(s,n,d)); 40 | } 41 | 42 | int Config::getInt(const std::string& section, const std::string& name, const std::string& dflt) 43 | { 44 | const std::string &data = Config::getString(section,name,dflt); 45 | if(Parser::isInt(data)) 46 | return Parser::parseInt(data); 47 | else 48 | return Parser::parseInt(dflt); 49 | } 50 | 51 | float Config::getFloat(const std::string& s, const std::string& n, const std::string& d) 52 | { 53 | return Parser::parseFloat(Config::getString(s,n,d)); 54 | } 55 | 56 | const std::string &Config::getString(const std::string& s, const std::string& n, const std::string& d) 57 | { 58 | std::map::iterator section_it; 59 | section_it = Config::instance()->m_sections.find(s); 60 | 61 | if(section_it != Config::instance()->m_sections.end()) 62 | { 63 | ConfigSection::iterator option_it = section_it->second.find(n); 64 | 65 | if(option_it != section_it->second.end()) 66 | return option_it->second; 67 | } 68 | 69 | return d; 70 | } 71 | 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /Valag/src/core/GameState.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/core/GameState.h" 2 | 3 | namespace vlg 4 | { 5 | 6 | GameState::GameState() 7 | { 8 | //ctor 9 | } 10 | 11 | GameState::~GameState() 12 | { 13 | //dtor 14 | } 15 | 16 | void GameState::setManager(StatesManager *manager) 17 | { 18 | m_manager = manager; 19 | } 20 | 21 | void GameState::pause() 22 | { 23 | m_running = false; 24 | } 25 | 26 | void GameState::resume() 27 | { 28 | m_running = true; 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Valag/src/core/NotificationListener.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/core/NotificationListener.h" 2 | #include "Valag/core/NotificationSender.h" 3 | 4 | 5 | namespace vlg 6 | { 7 | 8 | NotificationListener::NotificationListener() 9 | { 10 | //ctor 11 | } 12 | 13 | NotificationListener::~NotificationListener() 14 | { 15 | for(auto sender : m_senders) 16 | sender->removeFromAllNotificationList(this); 17 | } 18 | 19 | void NotificationListener::addSender(NotificationSender* sender) 20 | { 21 | m_senders.insert(sender); 22 | } 23 | 24 | void NotificationListener::notifySenderDestruction(NotificationSender* sender) 25 | { 26 | m_senders.erase(sender); 27 | } 28 | 29 | void NotificationListener::stopListeningTo(NotificationSender* sender) 30 | { 31 | if(sender != nullptr) 32 | { 33 | m_senders.erase(sender); 34 | sender->removeFromAllNotificationList(this); 35 | } 36 | } 37 | 38 | void NotificationListener::startListeningTo(NotificationSender* sender) 39 | { 40 | this->stopListeningTo(sender); 41 | if(sender != nullptr) 42 | { 43 | m_senders.insert(sender); 44 | sender->addToAllNotificationList(this); 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Valag/src/scene/CameraObject.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/scene/CameraObject.h" 2 | 3 | namespace vlg 4 | { 5 | 6 | CameraObject::CameraObject() : 7 | m_zoom(1.0f), 8 | m_offset(0.0f, 0.0f), 9 | m_extent(1.0f, 1.0f) 10 | { 11 | //ctor 12 | } 13 | 14 | CameraObject::~CameraObject() 15 | { 16 | //dtor 17 | } 18 | 19 | 20 | void CameraObject::setViewport(glm::vec2 offset, glm::vec2 extent) 21 | { 22 | m_offset = offset; 23 | m_extent = extent; 24 | } 25 | 26 | void CameraObject::setZoom(float zoom) 27 | { 28 | if(zoom != 0) 29 | m_zoom = zoom; 30 | } 31 | 32 | void CameraObject::zoom(float zoom) 33 | { 34 | if(zoom != 0) 35 | m_zoom *= zoom; 36 | } 37 | 38 | float CameraObject::getZoom() 39 | { 40 | return m_zoom; 41 | } 42 | 43 | glm::vec2 CameraObject::getViewportOffset() 44 | { 45 | return m_offset; 46 | } 47 | 48 | glm::vec2 CameraObject::getViewportExtent() 49 | { 50 | return m_extent; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Valag/src/scene/SceneEntity.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/scene/SceneEntity.h" 2 | 3 | namespace vlg 4 | { 5 | 6 | SceneEntity::SceneEntity() : 7 | m_isVisible(true) 8 | { 9 | m_isAnEntity = true; 10 | } 11 | 12 | SceneEntity::~SceneEntity() 13 | { 14 | //dtor 15 | } 16 | 17 | bool SceneEntity::isVisible() 18 | { 19 | return m_isVisible; 20 | } 21 | 22 | void SceneEntity::setVisible(bool visible) 23 | { 24 | m_isVisible = visible; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Valag/src/scene/SceneObject.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/scene/SceneObject.h" 2 | 3 | #include "Valag/scene/SceneNode.h" 4 | 5 | namespace vlg 6 | { 7 | 8 | 9 | SceneObject::SceneObject() 10 | { 11 | m_parentNode = nullptr; 12 | m_isALight = false; 13 | m_isAnEntity = false; 14 | m_isAShadowCaster = false; 15 | } 16 | 17 | SceneObject::~SceneObject() 18 | { 19 | //dtor 20 | } 21 | 22 | 23 | SceneNode* SceneObject::setParentNode(SceneNode *newParent) 24 | { 25 | SceneNode* oldParent = getParentNode(); 26 | 27 | if(m_parentNode != newParent) 28 | { 29 | this->stopListeningTo(m_parentNode); 30 | m_parentNode = newParent; 31 | this->startListeningTo(m_parentNode); 32 | } 33 | return oldParent; 34 | } 35 | 36 | SceneNode* SceneObject::getParentNode() 37 | { 38 | return m_parentNode; 39 | } 40 | 41 | 42 | bool SceneObject::isALight() 43 | { 44 | return m_isALight; 45 | } 46 | 47 | bool SceneObject::isAnEntity() 48 | { 49 | return m_isAnEntity; 50 | } 51 | 52 | bool SceneObject::isAShadowCaster() 53 | { 54 | return m_isAShadowCaster; 55 | } 56 | 57 | 58 | void SceneObject::update(const Time &elapsedTime) 59 | { 60 | 61 | } 62 | 63 | void SceneObject::notify(NotificationSender* sender, NotificationType type, 64 | size_t dataSize, char* data) 65 | { 66 | if(sender == (NotificationSender*)m_parentNode) 67 | { 68 | if(type == Notification_SceneNodeDetroyed) 69 | m_parentNode = nullptr; 70 | } 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /Valag/src/scene/ShadowCaster.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/scene/ShadowCaster.h" 2 | 3 | namespace vlg 4 | { 5 | 6 | ShadowCaster::ShadowCaster() : SceneEntity(), 7 | m_shadowCastingType(ShadowCasting_None) 8 | { 9 | m_isAShadowCaster = true; 10 | } 11 | 12 | ShadowCaster::~ShadowCaster() 13 | { 14 | //dtor 15 | } 16 | 17 | void ShadowCaster::setShadowCasting(ShadowCastingType type) 18 | { 19 | m_shadowCastingType = type; 20 | } 21 | 22 | ShadowCastingType ShadowCaster::getShadowCastingType() 23 | { 24 | return m_shadowCastingType; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Valag/src/utils/Clock.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/utils/Clock.h" 2 | 3 | namespace vlg 4 | { 5 | 6 | Time TimeZero() 7 | { 8 | return std::chrono::duration::zero(); 9 | } 10 | 11 | Clock::Clock() 12 | { 13 | this->restart(); 14 | } 15 | 16 | Clock::~Clock() 17 | { 18 | //dtor 19 | } 20 | 21 | Time Clock::restart() 22 | { 23 | Time r = this->elapsedTime(); 24 | m_lastTime = std::chrono::high_resolution_clock::now(); 25 | return r; 26 | } 27 | 28 | Time Clock::elapsedTime() 29 | { 30 | return std::chrono::high_resolution_clock::now() - m_lastTime; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Valag/src/utils/Logger.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/utils/Logger.h" 2 | 3 | const char *Logger::DEFAULT_LOG_PATH = "log.txt"; 4 | 5 | Logger::Logger() 6 | { 7 | m_enableConsoleWriting = true; 8 | m_enableWarnings = true; 9 | m_fileStream = new std::ofstream(); 10 | m_fileStream->open(DEFAULT_LOG_PATH, std::ios::out | std::ios::trunc ); 11 | } 12 | 13 | Logger::~Logger() 14 | { 15 | m_fileStream->close(); 16 | delete m_fileStream; 17 | } 18 | 19 | void Logger::write(const std::ostringstream& s) 20 | { 21 | Logger::write(s.str()); 22 | } 23 | 24 | void Logger::warning(const std::ostringstream& s) 25 | { 26 | Logger::warning(s.str()); 27 | } 28 | 29 | void Logger::error(const std::ostringstream& s) 30 | { 31 | Logger::error(s.str()); 32 | } 33 | 34 | void Logger::fatalError(const std::ostringstream& s) 35 | { 36 | Logger::fatalError(s.str()); 37 | } 38 | 39 | void Logger::write(const std::string& s) 40 | { 41 | std::lock_guard lock(Logger::instance()->m_loggerMutex); 42 | 43 | if(Logger::instance()->m_enableConsoleWriting) 44 | std::cout<m_fileStream<m_enableWarnings) 52 | Logger::write("Warning : "+s); 53 | } 54 | 55 | void Logger::error(const std::string& s) 56 | { 57 | Logger::write("ERROR: "+s); 58 | } 59 | 60 | void Logger::fatalError(const std::string& s) 61 | { 62 | Logger::write("FATAL ERROR: "+s); 63 | } 64 | 65 | void Logger::enableConsoleWriting() 66 | { 67 | Logger::instance()->m_enableConsoleWriting = true; 68 | } 69 | 70 | void Logger::disableConsoleWriting() 71 | { 72 | Logger::instance()->m_enableConsoleWriting = false; 73 | } 74 | 75 | -------------------------------------------------------------------------------- /Valag/src/utils/Parser.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/utils/Parser.h" 2 | #include "Valag/utils/Logger.h" 3 | 4 | #include 5 | 6 | Parser::Parser() 7 | { 8 | //ctor 9 | } 10 | 11 | Parser::~Parser() 12 | { 13 | //dtor 14 | } 15 | 16 | bool Parser::isBool(const std::string &data) 17 | { 18 | bool value = false; 19 | std::istringstream ss(data); 20 | ss>>value; 21 | return ss.eof(); 22 | } 23 | 24 | bool Parser::isInt(const std::string &data) 25 | { 26 | int value = false; 27 | std::istringstream ss(data); 28 | ss>>value; 29 | return ss.eof(); 30 | } 31 | 32 | bool Parser::isFloat(const std::string &data) 33 | { 34 | float value = false; 35 | std::istringstream ss(data); 36 | ss>>value; 37 | return ss.eof(); 38 | } 39 | 40 | bool Parser::parseBool(const std::string& data) 41 | { 42 | bool value = false; 43 | std::istringstream ss(data); 44 | ss>>value; 45 | if(!ss.eof()) 46 | { 47 | if(data == "true" || data == "1") 48 | return (true); 49 | else 50 | return (false); 51 | } 52 | return value; 53 | } 54 | 55 | int Parser::parseInt(const std::string& data) 56 | { 57 | int value = 0; 58 | std::istringstream ss(data); 59 | ss>>value; 60 | return value; 61 | } 62 | 63 | float Parser::parseFloat(const std::string& data) 64 | { 65 | float value = 0; 66 | std::istringstream ss(data); 67 | ss>>value; 68 | return value; 69 | } 70 | 71 | std::string Parser::findFileDirectory(const std::string& filePath) 72 | { 73 | std::size_t p = filePath.find_last_of("/\\"); 74 | if(p != std::string::npos) 75 | return filePath.substr(0,p+1); 76 | 77 | Logger::error("Cannot find directory of "+filePath); 78 | return filePath; 79 | } 80 | -------------------------------------------------------------------------------- /Valag/src/utils/Profiler.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/utils/Profiler.h" 2 | 3 | #include 4 | 5 | namespace vlg 6 | { 7 | 8 | Profiler::Profiler() 9 | { 10 | //ctor 11 | } 12 | 13 | Profiler::~Profiler() 14 | { 15 | //dtor 16 | } 17 | 18 | 19 | void Profiler::resetLoop(bool print) 20 | { 21 | std::lock_guard lock(Profiler::instance()->m_profilerMutex); 22 | 23 | Time total_time = Profiler::instance()->m_loopClock.restart(); 24 | 25 | if(print) 26 | { 27 | std::ostringstream buf; 28 | 29 | std::list::iterator timesIt; 30 | for(timesIt = Profiler::instance()->m_times.begin() ; 31 | timesIt != Profiler::instance()->m_times.end() ; ++timesIt) 32 | { 33 | buf<text<<": " 34 | <time.count()/**.asMicroseconds()**/*100.0/total_time.count()/**.asMicroseconds()**/<<"%" 35 | <m_times.clear(); 43 | } 44 | 45 | void Profiler::pushClock(const std::string &text) 46 | { 47 | ProfilerClock clock; 48 | clock.text = text; 49 | clock.clock.restart(); 50 | Profiler::instance()->m_clocks.push(clock); 51 | } 52 | 53 | void Profiler::popClock() 54 | { 55 | if(!Profiler::instance()->m_clocks.empty()) 56 | { 57 | ProfilerTime time; 58 | time.time = Profiler::instance()->m_clocks.top().clock.elapsedTime(); 59 | time.text = Profiler::instance()->m_clocks.top().text; 60 | Profiler::instance()->m_clocks.pop(); 61 | Profiler::instance()->m_times.push_back(time); 62 | } 63 | } 64 | 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /Valag/src/utils/SingletonsCleaner.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/utils/SingletonsCleaner.h" 2 | 3 | 4 | SingletonsCleaner SingletonsCleaner::m_instance=SingletonsCleaner(); 5 | 6 | SingletonsCleaner* SingletonsCleaner::instance(void) 7 | { 8 | return &m_instance; 9 | } 10 | 11 | void SingletonsCleaner::addToList(KillableSingleton* singleton) 12 | { 13 | SingletonsCleaner::instance()->m_singletonsList.push_back(singleton); 14 | SingletonsCleaner::instance()->m_singletonsList.unique(); 15 | } 16 | 17 | void SingletonsCleaner::cleanAll() 18 | { 19 | while(!SingletonsCleaner::instance()->m_singletonsList.empty()) 20 | SingletonsCleaner::instance()->m_singletonsList.back()->kill(); 21 | } 22 | 23 | void SingletonsCleaner::removeFromList(KillableSingleton* singleton) 24 | { 25 | SingletonsCleaner *sc = SingletonsCleaner::instance(); 26 | 27 | std::list::iterator singletonIterator; 28 | singletonIterator = sc->m_singletonsList.begin(); 29 | while(singletonIterator != sc->m_singletonsList.end()) 30 | { 31 | if(*singletonIterator == singleton) 32 | { 33 | sc->m_singletonsList.erase(singletonIterator); 34 | singletonIterator = sc->m_singletonsList.end(); 35 | } else 36 | ++singletonIterator; 37 | } 38 | } 39 | 40 | 41 | -------------------------------------------------------------------------------- /Valag/src/vulkanImpl/VulkanExtProxies.cpp: -------------------------------------------------------------------------------- 1 | #include "Valag/vulkanImpl/VulkanExtProxies.h" 2 | 3 | VkResult CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, 4 | const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback) 5 | { 6 | auto func = (PFN_vkCreateDebugReportCallbackEXT) vkGetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT"); 7 | if (func != nullptr) { 8 | return func(instance, pCreateInfo, pAllocator, pCallback); 9 | } else { 10 | return VK_ERROR_EXTENSION_NOT_PRESENT; 11 | } 12 | } 13 | 14 | void DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator) 15 | { 16 | auto func = (PFN_vkDestroyDebugReportCallbackEXT) vkGetInstanceProcAddr(instance, "vkDestroyDebugReportCallbackEXT"); 17 | if (func != nullptr) { 18 | func(instance, callback, pAllocator); 19 | } 20 | } 21 | --------------------------------------------------------------------------------