├── .gitattributes ├── .gitignore ├── README.md ├── ScreenShots ├── BVH.png ├── Default_Light.png ├── Diffuse_Self_Transfer.png ├── Diffuse_Self_Transfer_2.png ├── Glossy.png ├── Glossy_2.png ├── Glossy_Interreflection.png ├── HDR_Light_Probe.png ├── SH_Lighting_Glitch.png └── SH_Lighting_Glitch_2.png ├── SphericalHarmonicsLighting.sln └── SphericalHarmonicsLighting ├── AssetLoader.cpp ├── AssetLoader.h ├── BVH.cpp ├── BVH.h ├── BVHDebugger.cpp ├── ChunkBuffer.h ├── Data ├── Light Probes │ └── grace_probe.float ├── Models │ ├── Bunny.obj │ ├── HelloWorld.obj │ ├── Monkey.obj │ ├── MonkeySubdivided1.obj │ ├── MonkeySubdivided2.obj │ ├── Plane.obj │ ├── PlaneLow.obj │ ├── SphereSubdivided1.obj │ ├── Test.obj │ ├── Triangle.obj │ └── box.obj └── Shaders │ ├── debug_fragment.glsl │ ├── debug_vertex.glsl │ ├── fragment.glsl │ ├── sh.h │ ├── vertex_diffuse.glsl │ └── vertex_glossy.glsl ├── DiffuseShader.cpp ├── DirectionalLight.cpp ├── Display.cpp ├── Display.h ├── GlossyShader.cpp ├── HDRProbeLight.cpp ├── Light.cpp ├── Light.h ├── Main.cpp ├── Mesh.cpp ├── MeshShaders.h ├── Ray.cpp ├── Ray.h ├── SHRotation.cpp ├── SHRotation.h ├── Scene.cpp ├── Scene.h ├── ScopedTimer.h ├── Shader.cpp ├── Shader.h ├── SphericalHarmonics.cpp ├── SphericalHarmonics.h ├── SphericalHarmonicsLighting.vcxproj ├── SphericalHarmonicsLighting.vcxproj.filters ├── StringHelper.cpp ├── StringHelper.h ├── Types.h ├── Util.h ├── VectorMath.cpp ├── VectorMath.h ├── dll ├── x64 │ ├── SDL2.dll │ ├── assimp-vc140-mt.dll │ └── glew32.dll └── x86 │ ├── Assimp32.dll │ ├── SDL2.dll │ └── glew32.dll ├── include ├── GL │ ├── eglew.h │ ├── glew.h │ ├── glxew.h │ └── wglew.h ├── SDL2 │ ├── SDL.h │ ├── SDL_assert.h │ ├── SDL_atomic.h │ ├── SDL_audio.h │ ├── SDL_bits.h │ ├── SDL_blendmode.h │ ├── SDL_clipboard.h │ ├── SDL_config.h │ ├── SDL_config.h.cmake │ ├── SDL_config.h.in │ ├── SDL_config_android.h │ ├── SDL_config_iphoneos.h │ ├── SDL_config_macosx.h │ ├── SDL_config_macosx.h.orig │ ├── SDL_config_minimal.h │ ├── SDL_config_pandora.h │ ├── SDL_config_psp.h │ ├── SDL_config_windows.h │ ├── SDL_config_winrt.h │ ├── SDL_config_wiz.h │ ├── SDL_copying.h │ ├── SDL_cpuinfo.h │ ├── SDL_egl.h │ ├── SDL_endian.h │ ├── SDL_error.h │ ├── SDL_events.h │ ├── SDL_filesystem.h │ ├── SDL_gamecontroller.h │ ├── SDL_gesture.h │ ├── SDL_haptic.h │ ├── SDL_hints.h │ ├── SDL_joystick.h │ ├── SDL_keyboard.h │ ├── SDL_keycode.h │ ├── SDL_loadso.h │ ├── SDL_log.h │ ├── SDL_main.h │ ├── SDL_messagebox.h │ ├── SDL_mouse.h │ ├── SDL_mutex.h │ ├── SDL_name.h │ ├── SDL_opengl.h │ ├── SDL_opengl_glext.h │ ├── SDL_opengles.h │ ├── SDL_opengles2.h │ ├── SDL_opengles2_gl2.h │ ├── SDL_opengles2_gl2ext.h │ ├── SDL_opengles2_gl2platform.h │ ├── SDL_opengles2_khrplatform.h │ ├── SDL_pixels.h │ ├── SDL_platform.h │ ├── SDL_power.h │ ├── SDL_quit.h │ ├── SDL_rect.h │ ├── SDL_render.h │ ├── SDL_revision.h │ ├── SDL_rwops.h │ ├── SDL_scancode.h │ ├── SDL_shape.h │ ├── SDL_stdinc.h │ ├── SDL_surface.h │ ├── SDL_system.h │ ├── SDL_syswm.h │ ├── SDL_test.h │ ├── SDL_test_assert.h │ ├── SDL_test_common.h │ ├── SDL_test_compare.h │ ├── SDL_test_crc32.h │ ├── SDL_test_font.h │ ├── SDL_test_fuzzer.h │ ├── SDL_test_harness.h │ ├── SDL_test_images.h │ ├── SDL_test_log.h │ ├── SDL_test_md5.h │ ├── SDL_test_memory.h │ ├── SDL_test_random.h │ ├── SDL_thread.h │ ├── SDL_timer.h │ ├── SDL_touch.h │ ├── SDL_types.h │ ├── SDL_version.h │ ├── SDL_video.h │ ├── SDL_vulkan.h │ ├── begin_code.h │ └── close_code.h ├── assimp │ ├── .editorconfig │ ├── BaseImporter.h │ ├── Bitmap.h │ ├── BlobIOSystem.h │ ├── ByteSwapper.h │ ├── Compiler │ │ ├── poppack1.h │ │ ├── pstdint.h │ │ └── pushpack1.h │ ├── CreateAnimMesh.h │ ├── DefaultIOStream.h │ ├── DefaultIOSystem.h │ ├── DefaultLogger.hpp │ ├── Defines.h │ ├── Exceptional.h │ ├── Exporter.hpp │ ├── GenericProperty.h │ ├── Hash.h │ ├── IOStream.hpp │ ├── IOStreamBuffer.h │ ├── IOSystem.hpp │ ├── Importer.hpp │ ├── LineSplitter.h │ ├── LogAux.h │ ├── LogStream.hpp │ ├── Logger.hpp │ ├── Macros.h │ ├── MathFunctions.h │ ├── MemoryIOWrapper.h │ ├── NullLogger.hpp │ ├── ParsingUtils.h │ ├── Profiler.h │ ├── ProgressHandler.hpp │ ├── RemoveComments.h │ ├── SGSpatialSort.h │ ├── SceneCombiner.h │ ├── SkeletonMeshBuilder.h │ ├── SmoothingGroups.h │ ├── SmoothingGroups.inl │ ├── SpatialSort.h │ ├── StandardShapes.h │ ├── StreamReader.h │ ├── StreamWriter.h │ ├── StringComparison.h │ ├── StringUtils.h │ ├── Subdivision.h │ ├── TinyFormatter.h │ ├── Vertex.h │ ├── XMLTools.h │ ├── ai_assert.h │ ├── anim.h │ ├── camera.h │ ├── cexport.h │ ├── cfileio.h │ ├── cimport.h │ ├── color4.h │ ├── color4.inl │ ├── config.h │ ├── config.h.in │ ├── defs.h │ ├── fast_atof.h │ ├── importerdesc.h │ ├── irrXMLWrapper.h │ ├── light.h │ ├── material.h │ ├── material.inl │ ├── matrix3x3.h │ ├── matrix3x3.inl │ ├── matrix4x4.h │ ├── matrix4x4.inl │ ├── mesh.h │ ├── metadata.h │ ├── pbrmaterial.h │ ├── port │ │ └── AndroidJNI │ │ │ └── AndroidJNIIOSystem.h │ ├── postprocess.h │ ├── qnan.h │ ├── quaternion.h │ ├── quaternion.inl │ ├── scene.h │ ├── texture.h │ ├── types.h │ ├── vector2.h │ ├── vector2.inl │ ├── vector3.h │ ├── vector3.inl │ └── version.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 └── lib ├── x64 ├── SDL2.lib ├── SDL2main.lib ├── SDL2test.lib ├── SOIL.lib ├── assimp.lib ├── glew32.lib └── glew32s.lib └── x86 ├── SDL2.lib ├── SDL2main.lib ├── SDL2test.lib ├── SOIL.lib ├── assimp.lib ├── glew32.lib └── glew32s.lib /ScreenShots/BVH.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/ScreenShots/BVH.png -------------------------------------------------------------------------------- /ScreenShots/Default_Light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/ScreenShots/Default_Light.png -------------------------------------------------------------------------------- /ScreenShots/Diffuse_Self_Transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/ScreenShots/Diffuse_Self_Transfer.png -------------------------------------------------------------------------------- /ScreenShots/Diffuse_Self_Transfer_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/ScreenShots/Diffuse_Self_Transfer_2.png -------------------------------------------------------------------------------- /ScreenShots/Glossy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/ScreenShots/Glossy.png -------------------------------------------------------------------------------- /ScreenShots/Glossy_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/ScreenShots/Glossy_2.png -------------------------------------------------------------------------------- /ScreenShots/Glossy_Interreflection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/ScreenShots/Glossy_Interreflection.png -------------------------------------------------------------------------------- /ScreenShots/HDR_Light_Probe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/ScreenShots/HDR_Light_Probe.png -------------------------------------------------------------------------------- /ScreenShots/SH_Lighting_Glitch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/ScreenShots/SH_Lighting_Glitch.png -------------------------------------------------------------------------------- /ScreenShots/SH_Lighting_Glitch_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/ScreenShots/SH_Lighting_Glitch_2.png -------------------------------------------------------------------------------- /SphericalHarmonicsLighting.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2046 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SphericalHarmonicsLighting", "SphericalHarmonicsLighting\SphericalHarmonicsLighting.vcxproj", "{060AE0EB-7912-4361-987F-CACBF9516C6E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {060AE0EB-7912-4361-987F-CACBF9516C6E}.Debug|x64.ActiveCfg = Debug|x64 17 | {060AE0EB-7912-4361-987F-CACBF9516C6E}.Debug|x64.Build.0 = Debug|x64 18 | {060AE0EB-7912-4361-987F-CACBF9516C6E}.Debug|x86.ActiveCfg = Debug|Win32 19 | {060AE0EB-7912-4361-987F-CACBF9516C6E}.Debug|x86.Build.0 = Debug|Win32 20 | {060AE0EB-7912-4361-987F-CACBF9516C6E}.Release|x64.ActiveCfg = Release|x64 21 | {060AE0EB-7912-4361-987F-CACBF9516C6E}.Release|x64.Build.0 = Release|x64 22 | {060AE0EB-7912-4361-987F-CACBF9516C6E}.Release|x86.ActiveCfg = Release|Win32 23 | {060AE0EB-7912-4361-987F-CACBF9516C6E}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {059DACDA-465C-4000-9E35-2D2A780B850A} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/AssetLoader.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "AssetLoader.h" 9 | 10 | namespace AssetLoader { 11 | std::unordered_map mesh_cache; 12 | 13 | const MeshData* init_mesh_data(const aiMesh* mesh) { 14 | MeshData* mesh_data = new MeshData(); 15 | mesh_data->vertex_count = mesh->mNumVertices; 16 | mesh_data->index_count = mesh->mNumFaces * 3; 17 | 18 | mesh_data->vertices = new Vertex[mesh_data->vertex_count]; 19 | mesh_data->indices = new u32 [mesh_data->index_count]; 20 | 21 | assert(mesh->HasTextureCoords(0)); 22 | 23 | for (u32 i = 0; i < mesh->mNumVertices; i++) { 24 | const aiVector3D& pos = mesh->mVertices[i]; 25 | const aiVector3D& nor = mesh->mNormals[i]; 26 | const aiVector3D& tex = mesh->mTextureCoords[0][i]; 27 | 28 | mesh_data->vertices[i].position = glm::vec3(pos.x, pos.y, pos.z); 29 | mesh_data->vertices[i].tex_coord = glm::vec2(tex.x, tex.y); 30 | mesh_data->vertices[i].normal = glm::vec3(nor.x, nor.y, nor.z); 31 | } 32 | 33 | for (u32 i = 0; i < mesh->mNumFaces; i++) { 34 | const aiFace& face = mesh->mFaces[i]; 35 | 36 | assert(face.mNumIndices == 3); 37 | 38 | mesh_data->indices[i*3 ] = face.mIndices[0]; 39 | mesh_data->indices[i*3 + 1] = face.mIndices[1]; 40 | mesh_data->indices[i*3 + 2] = face.mIndices[2]; 41 | } 42 | 43 | return mesh_data; 44 | } 45 | 46 | const MeshData* load_new_mesh(const char* filename) { 47 | Assimp::Importer Importer; 48 | const aiScene* scene = Importer.ReadFile(filename, aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_FlipUVs | aiProcess_JoinIdenticalVertices); 49 | 50 | if (scene) { 51 | if (scene->mNumMeshes > 1) { 52 | printf("Warning! multiple meshes are not supported! File: %s", filename); 53 | } 54 | 55 | return init_mesh_data(scene->mMeshes[0]); 56 | } else { 57 | printf("Error parsing '%s': '%s'\n", filename, Importer.GetErrorString()); 58 | 59 | abort(); 60 | } 61 | } 62 | 63 | const MeshData* load_mesh(const char* filename) { 64 | const MeshData*& mesh_data = mesh_cache[filename]; 65 | 66 | if (mesh_data) { 67 | return mesh_data; 68 | } 69 | 70 | mesh_data = load_new_mesh(filename); 71 | return mesh_data; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/AssetLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "Types.h" 5 | 6 | namespace AssetLoader { 7 | struct Vertex { 8 | glm::vec3 position; 9 | glm::vec2 tex_coord; 10 | glm::vec3 normal; 11 | }; 12 | 13 | struct MeshData { 14 | u32 vertex_count; 15 | Vertex * vertices; 16 | 17 | u32 index_count; 18 | u32 * indices; 19 | }; 20 | 21 | const MeshData* load_mesh(const char* filename); 22 | } 23 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/BVH.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "Ray.h" 5 | 6 | #include "Types.h" 7 | 8 | struct BVHNode { 9 | public: 10 | AABB aabb; 11 | 12 | BVHNode const * left; 13 | BVHNode const * right; 14 | 15 | int triangle_count; 16 | Triangle const ** triangles; 17 | 18 | BVHNode(); 19 | ~BVHNode(); 20 | 21 | bool intersects(const Ray& ray) const; 22 | float trace (const Ray& ray, int indices[3], float& u, float& v) const; 23 | 24 | static BVHNode const * build(int triangle_count, Triangle const * const triangles[]); 25 | }; 26 | 27 | struct BVHDebugger { 28 | private: 29 | Array positions; 30 | Array indices; 31 | 32 | GLuint vbo; 33 | GLuint ibo; 34 | u32 index_count; 35 | 36 | void init_tree(const BVHNode * bvh_node); 37 | 38 | public: 39 | void init(const BVHNode * root); 40 | 41 | void draw() const; 42 | }; 43 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Data/Light Probes/grace_probe.float: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/Data/Light Probes/grace_probe.float -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Data/Models/Test.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.80 (sub 44) OBJ File: '' 2 | # www.blender.org 3 | o Cube 4 | v 2.018782 1.979577 -0.502004 5 | v 2.026963 0.950849 -0.488794 6 | v 1.954799 2.017237 0.527484 7 | v 1.975013 1.055248 0.482728 8 | v 1.000000 2.000000 -0.500000 9 | v 1.000000 1.000000 -0.500000 10 | v 1.000000 2.000000 0.500000 11 | v 1.000000 1.000000 0.500000 12 | vt 0.625000 0.000000 13 | vt 0.375000 0.250000 14 | vt 0.375000 0.000000 15 | vt 0.375000 0.250000 16 | vt 0.625000 0.500000 17 | vt 0.375000 0.500000 18 | vt 0.375000 0.750000 19 | vt 0.625000 1.000000 20 | vt 0.375000 1.000000 21 | vt 0.375000 0.500000 22 | vt 0.125000 0.750000 23 | vt 0.125000 0.500000 24 | vt 0.625000 0.500000 25 | vt 0.875000 0.750000 26 | vt 0.625000 0.750000 27 | vt 0.625000 0.250000 28 | vt 0.625000 0.250000 29 | vt 0.625000 0.750000 30 | vt 0.375000 0.750000 31 | vt 0.875000 0.500000 32 | vn 0.0000 1.0000 -0.0000 33 | vn 0.0000 0.0000 1.0000 34 | vn -1.0000 0.0000 0.0000 35 | vn 0.0000 -1.0000 0.0000 36 | vn 1.0000 0.0000 0.0000 37 | vn 0.0000 -0.0000 -1.0000 38 | vn -0.0000 1.0000 0.0000 39 | vn -0.0000 -0.0000 1.0000 40 | vn -0.0000 -1.0000 0.0000 41 | vn 1.0000 0.0000 0.0000 42 | vn -0.0000 0.0000 -1.0000 43 | s off 44 | f 5/1/1 3/2/1 1/3/1 45 | f 4/4/2 7/5/2 8/6/2 46 | f 7/5/3 6/7/3 8/6/3 47 | f 6/7/4 4/8/4 8/9/4 48 | f 1/10/5 4/11/5 2/12/5 49 | f 6/13/6 1/14/6 2/15/6 50 | f 5/1/7 7/16/7 3/2/7 51 | f 4/4/8 3/17/8 7/5/8 52 | f 7/5/3 5/18/3 6/7/3 53 | f 6/7/9 2/15/9 4/8/9 54 | f 1/10/10 3/19/10 4/11/10 55 | f 6/13/11 5/20/11 1/14/11 56 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Data/Models/Triangle.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.80 (sub 44) OBJ File: '' 2 | # www.blender.org 3 | o Plane 4 | v -1.000000 -1.000000 -0.000000 5 | v 1.000000 -1.000000 -0.000000 6 | v 0.000000 1.000000 0.000000 7 | vt 0.799946 0.999911 8 | vt 0.000089 0.599982 9 | vt 0.799946 0.000089 10 | vn 0.0000 -0.0000 1.0000 11 | s off 12 | f 1/1/1 2/2/1 3/3/1 13 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Data/Models/box.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.73 (sub 0) OBJ File: '' 2 | # www.blender.org 3 | o Plane 4 | v 1.000000 -1.000000 -1.000000 5 | v -1.000000 -1.000000 -1.000000 6 | v -1.000000 -1.000000 1.000000 7 | v 1.000000 -1.000000 1.000000 8 | v -1.000000 1.000000 1.000000 9 | v -1.000000 1.000000 -1.000000 10 | v 1.000000 1.000000 -1.000000 11 | v 1.000000 1.000000 1.000000 12 | vt 1.000000 0.000000 13 | vt 1.000000 1.000000 14 | vt 0.000000 1.000000 15 | vt 0.000000 0.000000 16 | vn -1.000000 0.000000 0.000000 17 | vn 0.000000 0.000000 -1.000000 18 | vn 1.000000 0.000000 0.000000 19 | vn 0.000000 0.000000 1.000000 20 | vn 0.000000 -1.000000 0.000000 21 | vn 0.000000 1.000000 0.000000 22 | s off 23 | f 6/1/1 2/2/1 3/3/1 24 | f 7/1/2 1/2/2 2/3/2 25 | f 8/1/3 4/2/3 1/3/3 26 | f 5/1/4 3/2/4 4/3/4 27 | f 2/1/5 1/2/5 4/3/5 28 | f 7/1/6 6/2/6 5/3/6 29 | f 5/4/1 6/1/1 3/3/1 30 | f 6/4/2 7/1/2 2/3/2 31 | f 7/4/3 8/1/3 1/3/3 32 | f 8/4/4 5/1/4 4/3/4 33 | f 3/4/5 2/1/5 4/3/5 34 | f 8/4/6 7/1/6 5/3/6 35 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Data/Shaders/debug_fragment.glsl: -------------------------------------------------------------------------------- 1 | #version 410 2 | 3 | layout (location = 0) out vec3 colour_out; 4 | 5 | void main() { 6 | colour_out = vec3(0.0f, 1.0f, 0.0f); 7 | } -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Data/Shaders/debug_vertex.glsl: -------------------------------------------------------------------------------- 1 | #version 410 2 | 3 | layout (location = 0) in vec3 position_in; 4 | 5 | uniform mat4 view_projection; 6 | 7 | void main() { 8 | gl_Position = view_projection * vec4(position_in, 1.0f); 9 | } -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Data/Shaders/fragment.glsl: -------------------------------------------------------------------------------- 1 | #version 410 2 | 3 | // Varyings 4 | layout (location = 0) in vec3 colour_in; 5 | 6 | // Output 7 | layout (location = 0) out vec4 colour_out; 8 | 9 | void main() { 10 | colour_out = vec4(colour_in, 1.0f); 11 | } 12 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Data/Shaders/vertex_diffuse.glsl: -------------------------------------------------------------------------------- 1 | #version 410 2 | 3 | // Attributes 4 | layout (location = 0) in vec3 position_in; 5 | 6 | // Varyings 7 | layout (location = 0) out vec3 colour_out; 8 | 9 | uniform samplerBuffer tbo_texture; 10 | 11 | uniform vec3 light_coeffs[SH_COEFFICIENT_COUNT]; 12 | 13 | uniform mat4 view_projection; 14 | 15 | //uniform vec3 diffuse_colour; 16 | 17 | void main() { 18 | vec3 colour = vec3(0.0f, 0.0f, 0.0f); 19 | 20 | // Compute the spherical integral between the lighting function and the transfer function. 21 | // Using Spherical Harmonics this means a simple dot product between two SH coefficient vectors. 22 | for (int i = 0; i < SH_COEFFICIENT_COUNT; i++) { 23 | colour += light_coeffs[i] * texelFetch(tbo_texture, gl_VertexID * SH_COEFFICIENT_COUNT + i).rgb; 24 | } 25 | 26 | colour_out = colour; 27 | 28 | gl_Position = view_projection * vec4(position_in, 1.0f); 29 | } 30 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Data/Shaders/vertex_glossy.glsl: -------------------------------------------------------------------------------- 1 | #version 410 2 | #include "sh.h" 3 | 4 | // Attributes 5 | layout (location = 0) in vec3 position_in; 6 | layout (location = 1) in vec3 normal_in; 7 | 8 | // Varyings 9 | layout (location = 0) out vec3 colour_out; 10 | 11 | uniform samplerBuffer tbo_texture; 12 | 13 | uniform vec3 light_coeffs[SH_COEFFICIENT_COUNT]; 14 | uniform vec3 brdf_coeffs [SH_NUM_BANDS]; 15 | 16 | uniform vec3 camera_position; 17 | uniform mat4 view_projection; 18 | 19 | //uniform vec3 diffuse_colour; 20 | 21 | void main() { 22 | vec3 transfer_coeffs[SH_COEFFICIENT_COUNT]; 23 | // Initialize transfer coefficients to zero 24 | for (int i = 0; i < SH_COEFFICIENT_COUNT; i++) { 25 | transfer_coeffs[i] = vec3(0.0f, 0.0f, 0.0f); 26 | } 27 | 28 | // Find the starting offset in the TBO 29 | // Each vertex has a SH_COEFFICIENT_COUNT x SH_COEFFICIENT_COUNT matrix 30 | int vertex_offset = gl_VertexID * SH_COEFFICIENT_COUNT * SH_COEFFICIENT_COUNT; 31 | 32 | // Matrix multiplication, multiply transfer matrix with light coefficients 33 | for (int j = 0; j < SH_COEFFICIENT_COUNT; j++) { 34 | for (int i = 0; i < SH_COEFFICIENT_COUNT; i++) { 35 | transfer_coeffs[j] += texelFetch(tbo_texture, vertex_offset + j * SH_COEFFICIENT_COUNT + i).rgb * light_coeffs[i]; 36 | } 37 | } 38 | 39 | // Obtain reflection direction R using the camera position, using the vertex position/normal 40 | vec3 to_camera = camera_position - position_in; 41 | vec3 R = -normalize(reflect(to_camera, normal_in)); 42 | 43 | // Convert reflection direction R into spherical coordinates (R_theta, R_phi) 44 | float R_theta = acos(R.z); 45 | float inv_sin_theta = 1.0f / sin(R_theta); 46 | float R_phi = acos(clamp(R.x * inv_sin_theta, -1.0f, 1.0f)); 47 | 48 | // Keep phi in the range [0, 2 pi] 49 | if (R.y * inv_sin_theta < 0.0f) { 50 | R_phi = 2.0f * pi - R_phi; 51 | } 52 | 53 | vec3 colour = vec3(0.0f, 0.0f, 0.0f); 54 | 55 | int index = 0; 56 | for (int l = 0; l < SH_NUM_BANDS; l++) { 57 | for (int m = -l; m <= l; m++) { 58 | colour += brdf_coeffs[l] * transfer_coeffs[index] * evaluate(l, m, R_theta, R_phi); 59 | 60 | index++; 61 | } 62 | } 63 | 64 | colour_out = colour; 65 | 66 | gl_Position = view_projection * vec4(position_in, 1.0f); 67 | } 68 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/DiffuseShader.cpp: -------------------------------------------------------------------------------- 1 | #include "MeshShaders.h" 2 | 3 | const int diffuse_define_count = 1; 4 | const char * diffuse_define_names[diffuse_define_count] = { 5 | "SH_COEFFICIENT_COUNT" 6 | }; 7 | const char * diffuse_define_definitions[diffuse_define_count] = { 8 | TO_STRING(SH_COEFFICIENT_COUNT) 9 | }; 10 | const Shader::Defines diffuse_defines(diffuse_define_count, diffuse_define_names, diffuse_define_definitions); 11 | 12 | DiffuseShader::DiffuseShader() : 13 | MeshShader(Type::DIFFUSE, DATA_PATH("Shaders/vertex_diffuse.glsl"), DATA_PATH("Shaders/fragment.glsl"), nullptr, diffuse_defines) 14 | { }; 15 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/DirectionalLight.cpp: -------------------------------------------------------------------------------- 1 | #include "Light.h" 2 | 3 | #include "Util.h" 4 | 5 | glm::vec3 DirectionalLight::get_light(float theta, float phi) const { 6 | return (theta < PI / 6.0f) 7 | ? glm::vec3(1.0f, 1.0f, 1.0f) 8 | : glm::vec3(0.0f, 0.0f, 0.0f); 9 | } 10 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Display.cpp: -------------------------------------------------------------------------------- 1 | #include "Display.h" 2 | 3 | #include 4 | #include 5 | 6 | Display::Display(u32 width, u32 height, const char* title) : width(width), height(height) { 7 | SDL_Init(SDL_INIT_EVERYTHING); 8 | 9 | SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); 10 | SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); 11 | SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); 12 | SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); 13 | SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32); 14 | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 15 | 16 | // MSAA 17 | SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); 18 | SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); 19 | 20 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); 21 | 22 | window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL); 23 | context = SDL_GL_CreateContext(window); 24 | 25 | SDL_GL_SetSwapInterval(0); 26 | 27 | GLenum status = glewInit(); 28 | if (status != GLEW_OK) { 29 | std::cerr << "Glew failed to initialize!" << std::endl; 30 | } 31 | } 32 | 33 | Display::~Display() { 34 | SDL_GL_DeleteContext(context); 35 | SDL_DestroyWindow(window); 36 | SDL_Quit(); 37 | } 38 | 39 | void Display::update() { 40 | SDL_GL_SwapWindow(window); 41 | } 42 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Display.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "Types.h" 5 | 6 | struct Display { 7 | private: 8 | SDL_Window * window; 9 | SDL_GLContext context; 10 | 11 | public: 12 | const u32 width; 13 | const u32 height; 14 | 15 | Display(u32 width, u32 height, const char* title); 16 | ~Display(); 17 | 18 | void update(); 19 | 20 | inline void set_title(const char* title) { 21 | SDL_SetWindowTitle(window, title); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/GlossyShader.cpp: -------------------------------------------------------------------------------- 1 | #include "MeshShaders.h" 2 | 3 | const int glossy_define_count = 2; 4 | const char * glossy_define_names[glossy_define_count] = { 5 | "SH_NUM_BANDS", 6 | "SH_COEFFICIENT_COUNT" 7 | }; 8 | const char * glossy_define_definitions[glossy_define_count] = { 9 | TO_STRING(SH_NUM_BANDS), 10 | TO_STRING(SH_COEFFICIENT_COUNT) 11 | }; 12 | const Shader::Defines glossy_defines(glossy_define_count, glossy_define_names, glossy_define_definitions); 13 | 14 | GlossyShader::GlossyShader() : 15 | MeshShader(Type::GLOSSY, DATA_PATH("Shaders/vertex_glossy.glsl"), DATA_PATH("Shaders/fragment.glsl"), nullptr, glossy_defines), 16 | 17 | uni_brdf_coeffs (get_uniform("brdf_coeffs")), 18 | uni_camera_position(get_uniform("camera_position")) 19 | { }; 20 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/HDRProbeLight.cpp: -------------------------------------------------------------------------------- 1 | #include "Light.h" 2 | 3 | #include 4 | 5 | #include "Util.h" 6 | 7 | HDRProbeLight::HDRProbeLight(const char* filename, int size) : size(size), data(new glm::vec3[size * size]) { 8 | std::ifstream file(filename, std::ios::in | std::ios::binary); 9 | if (!file.is_open()) { 10 | abort(); 11 | } 12 | 13 | file.read(reinterpret_cast(data), size * size * sizeof(glm::vec3)); 14 | file.close(); 15 | } 16 | 17 | HDRProbeLight::~HDRProbeLight() { 18 | assert(data); 19 | delete[] data; 20 | } 21 | 22 | glm::vec3 HDRProbeLight::get_light(float theta, float phi) const { 23 | const glm::vec3 direction(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta)); 24 | 25 | const float r = ONE_OVER_PI * acos(direction.z) / sqrt(direction.x*direction.x + direction.y*direction.y); 26 | 27 | const float u = direction.x * r; 28 | const float v = direction.y * r; 29 | 30 | const int x = (u * 0.5f + 0.5f) * size; 31 | const int y = (v * 0.5f + 0.5f) * size; 32 | 33 | assert(data); 34 | return data[x * size + y] * ONE_OVER_PI; 35 | } 36 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Light.cpp: -------------------------------------------------------------------------------- 1 | #include "Light.h" 2 | 3 | #include "Util.h" 4 | 5 | void Light::init(const SH::Sample samples[SAMPLE_COUNT]) { 6 | // Weighed by the area of a 3D unit sphere 7 | const float weight = 4.0f * PI; 8 | 9 | // For each sample 10 | for (int i = 0; i < SAMPLE_COUNT; i++) { 11 | float theta = samples[i].theta; 12 | float phi = samples[i].phi; 13 | 14 | // For each SH coefficient 15 | for (int n = 0; n < SH_COEFFICIENT_COUNT; n++) { 16 | coefficients[n] += get_light(theta, phi) * samples[i].coeffs[n]; 17 | } 18 | } 19 | 20 | // Divide the result by weight and number of samples 21 | const float factor = weight / SAMPLE_COUNT; 22 | for (int i = 0; i < SH_COEFFICIENT_COUNT; i++) { 23 | coefficients[i] *= factor; 24 | } 25 | } -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Light.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "SphericalHarmonics.h" 5 | 6 | class Light { 7 | public: 8 | glm::vec3 coefficients[SH_COEFFICIENT_COUNT]; 9 | 10 | void init(const SH::Sample samples[SAMPLE_COUNT]); 11 | 12 | virtual glm::vec3 get_light(float theta, float phi) const = 0; 13 | }; 14 | 15 | class DirectionalLight : public Light { 16 | public: 17 | glm::vec3 get_light(float theta, float phi) const; 18 | }; 19 | 20 | class HDRProbeLight : public Light { 21 | private: 22 | int size; 23 | glm::vec3 * data; 24 | 25 | public: 26 | HDRProbeLight(const char* filename, int size); 27 | ~HDRProbeLight(); 28 | 29 | glm::vec3 get_light(float theta, float phi) const; 30 | }; 31 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/Main.cpp -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/MeshShaders.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "Shader.h" 5 | #include "SphericalHarmonics.h" 6 | 7 | // Base class that provides the abstraction to differentiate between Diffuse and Glossy materials 8 | class MeshShader : public Shader { 9 | public: 10 | const enum Type { DIFFUSE, GLOSSY } type; 11 | 12 | inline MeshShader( 13 | Type type, 14 | const char* vertex_filename, 15 | const char* fragment_filename, 16 | const char* geometry_filename = nullptr, 17 | const Defines& defines = Defines(0, nullptr, nullptr)) : 18 | Shader(vertex_filename, fragment_filename, geometry_filename, defines), 19 | 20 | type(type), 21 | 22 | uni_tbo_texture (get_uniform("tbo_texture")), 23 | uni_light_coeffs (get_uniform("light_coeffs")), 24 | uni_view_projection(get_uniform("view_projection")) 25 | { 26 | bind(); 27 | { 28 | glUniform1i(uni_tbo_texture, 0); 29 | } 30 | unbind(); 31 | }; 32 | 33 | inline void set_light_coeffs(const glm::vec3 light_coeffs[]) const { 34 | glUniform3fv(uni_light_coeffs, SH_COEFFICIENT_COUNT, reinterpret_cast(light_coeffs)); 35 | } 36 | 37 | inline void set_view_projection(const glm::mat4& view_projection) const { 38 | glUniformMatrix4fv(uni_view_projection, 1, GL_FALSE, glm::value_ptr(view_projection)); 39 | } 40 | 41 | protected: 42 | const GLuint uni_tbo_texture; 43 | const GLuint uni_light_coeffs; 44 | const GLuint uni_view_projection; 45 | }; 46 | 47 | class DiffuseShader : public MeshShader { 48 | public: 49 | DiffuseShader(); 50 | }; 51 | 52 | class GlossyShader : public MeshShader { 53 | public: 54 | GlossyShader(); 55 | 56 | inline void set_brdf_coeffs(const glm::vec3 coeffs[SH_NUM_BANDS]) const { 57 | glUniform3fv(uni_brdf_coeffs, SH_NUM_BANDS, reinterpret_cast(coeffs)); 58 | } 59 | 60 | inline void set_camera_position(const glm::vec3& camera_position) const { 61 | glUniform3f(uni_camera_position, camera_position.x, camera_position.y, camera_position.z); 62 | } 63 | 64 | private: 65 | const GLuint uni_brdf_coeffs; 66 | const GLuint uni_camera_position; 67 | }; 68 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Ray.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #define EPSILON 0.001f 5 | 6 | // Axis Aligned Bounding Box 7 | struct AABB { 8 | glm::vec3 min; 9 | glm::vec3 max; 10 | 11 | void expand(const AABB& other); 12 | }; 13 | 14 | struct Plane { 15 | glm::vec3 normal; 16 | float distance; 17 | }; 18 | 19 | struct Triangle { 20 | Plane plane; 21 | glm::vec3 vertices[3]; 22 | 23 | int indices[3]; 24 | 25 | AABB calc_aabb() const; 26 | }; 27 | 28 | struct Ray { 29 | glm::vec3 origin; 30 | glm::vec3 direction; 31 | 32 | bool intersects(const Triangle& triangle) const; 33 | float trace (const Triangle& triangle, int indices[3], float& u, float& v) const; 34 | 35 | bool intersects(const AABB& aabb) const; 36 | }; 37 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/SHRotation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace SH { 5 | void init_rotation(); 6 | 7 | void rotate(const glm::quat& rotation, const glm::vec3 coeffs_in[], glm::vec3 coeffs_out[]); 8 | } 9 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/ScopedTimer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "Types.h" 5 | 6 | struct ScopedTimer { 7 | private: 8 | const char* name; 9 | std::chrono::high_resolution_clock::time_point start_time; 10 | 11 | public: 12 | inline ScopedTimer(const char* name) : name(name) { 13 | start_time = std::chrono::high_resolution_clock::now(); 14 | } 15 | 16 | inline ~ScopedTimer() { 17 | auto stop_time = std::chrono::high_resolution_clock::now(); 18 | u128 duration = std::chrono::duration_cast(stop_time - start_time).count(); 19 | 20 | if (duration >= 1000000) { 21 | printf("%s took: %llu us (%llu s)\n", name, duration, duration / 1000000); 22 | } else if (duration >= 1000) { 23 | printf("%s took: %llu us (%llu ms)\n", name, duration, duration / 1000); 24 | } else { 25 | printf("%s took: %llu us\n", name, duration); 26 | } 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Shader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "Util.h" 5 | 6 | class Shader { 7 | public: 8 | struct Defines { 9 | const int count; 10 | const char ** names; 11 | const char ** definitions; 12 | 13 | inline Defines(int count, const char ** names, const char ** definitions) : 14 | count(count), 15 | names(names), 16 | definitions(definitions) 17 | { } 18 | }; 19 | 20 | Shader(const char* vertex_filename, const char* fragment_filename, const char* geometry_filename = nullptr, const Defines& defines = Defines(0, nullptr, nullptr)); 21 | ~Shader(); 22 | 23 | inline void bind() const { 24 | glUseProgram(program_id); 25 | } 26 | 27 | inline GLuint get_uniform(const char* name) const { 28 | return glGetUniformLocation(program_id, name); 29 | } 30 | 31 | inline void unbind() const { 32 | glUseProgram(0); 33 | } 34 | 35 | private: 36 | GLuint load_shader(const char* filename, GLuint shader_type, const Defines& defines) const; 37 | 38 | GLuint program_id; 39 | GLuint vertex_id; 40 | GLuint fragment_id; 41 | GLuint geometry_id; 42 | }; 43 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/SphericalHarmonics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include "Util.h" 5 | 6 | // Number of Spherical Harmonic bands, commonly referred to with the letter l 7 | #define SH_NUM_BANDS 5 8 | #define SH_COEFFICIENT_COUNT (SH_NUM_BANDS * SH_NUM_BANDS) 9 | 10 | // Amount of samples used for Monte Carlo integration 11 | #define SQRT_SAMPLE_COUNT 50 12 | #define SAMPLE_COUNT (SQRT_SAMPLE_COUNT * SQRT_SAMPLE_COUNT) 13 | 14 | namespace SH { 15 | // Spherical Harmonics Sample 16 | struct Sample { 17 | // Sample direction, in sperical coordinates as well as cartesian coordinates 18 | float theta; 19 | float phi; 20 | glm::vec3 direction; 21 | 22 | // SH coefficients that make up the sample 23 | float coeffs[SH_COEFFICIENT_COUNT]; 24 | }; 25 | 26 | // Returns a point sample of a Spherical Harmonic basis function 27 | // l is the band, range [0..N] 28 | // m in the range [-l..l] 29 | // theta in the range [0..Pi] 30 | // phi in the range [0..2*Pi] 31 | float evaluate(int l, int m, float theta, float phi); 32 | 33 | // Fills the sample array with uniformly distributed SH samples across the unit sphere, using jittered stratification 34 | void init_samples(Sample samples[SAMPLE_COUNT]); 35 | 36 | // Projects a given polar function into Spherical Harmonic coefficients. 37 | // This is done using Monte Carlo integration, using the samples provided in the samples array 38 | template 39 | void project_polar_function(PolarFunction& polar_function, const Sample samples[SAMPLE_COUNT], glm::vec3 result[]) { 40 | // For each sample 41 | for (int s = 0; s < SAMPLE_COUNT; s++) { 42 | float theta = samples[s].theta; 43 | float phi = samples[s].phi; 44 | 45 | // For each SH coefficient 46 | for (int c = 0; c < SH_COEFFICIENT_COUNT; c++) { 47 | result[c] += polar_function(theta, phi) * samples[s].coeffs[c]; 48 | } 49 | } 50 | 51 | // Weighted by the surface area of a 3D unit sphere, divided by the number of samples 52 | const float factor = 4.0f * PI / SAMPLE_COUNT; 53 | for (int c = 0; c < SH_COEFFICIENT_COUNT; c++) { 54 | result[c] *= factor; 55 | } 56 | } 57 | 58 | // Calulates phong lobe SH coefficients using an analytical approxiamation 59 | // Formula from the paper "An Efficient Representation for Irradiance Environment Maps" by Ramamoorthi and Hanrahan 60 | void calc_phong_lobe_coeffs(float result[SH_NUM_BANDS]); 61 | } 62 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/StringHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ChunkBuffer.h" 3 | 4 | namespace StringHelper { 5 | bool starts_with(const char * str, const char * start_str); 6 | 7 | bool contains(const char * needle, const char * haystack); 8 | 9 | // Finds the index of the first occurence of needle in haystack 10 | // Searching begins at the given start index and moves forward through the string 11 | // Returns -1 when no match is found 12 | int first_index_of(const char * needle, const char * haystack, int start = 0); 13 | 14 | // Finds the index of the last occurence of needle in haystack 15 | // Searching begins at the given start index and moves backward through the string 16 | // Default start index = -1, which makes the search start at strlen(haystack) - strlen(needle) 17 | // Returns -1 when no match is found 18 | int last_index_of(const char * needle, const char * haystack, int start = -1); 19 | 20 | // Memcopies length chars from src + start to dst, then null terminates the dst string 21 | void substr(char * dst, const char * src, int start, int length); 22 | 23 | // Splits the given input string str on the given split char 24 | // The result is stored in a ChunkBuffer of chars, where every substring is null-terminated. 25 | // The returned integer is the amount of splitted substrings 26 | int split(const char * str, char split_char, ChunkBuffer& result); 27 | 28 | // Converts ASCII characters in str to lower case 29 | void to_lower(char * str); 30 | 31 | // Converts ASCII characters in str to upper case 32 | void to_upper(char * str); 33 | } 34 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #define Array std::vector 8 | #define Map std::unordered_map 9 | 10 | typedef long long s128; 11 | typedef long s64; 12 | typedef int s32; 13 | typedef short s16; 14 | typedef char s8; 15 | 16 | typedef unsigned long long u128; 17 | typedef unsigned long u64; 18 | typedef unsigned int u32; 19 | typedef unsigned short u16; 20 | typedef unsigned char u8; 21 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/Util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define INVALID -1 4 | 5 | #define DATA_PATH(filename) "../SphericalHarmonicsLighting/Data/" filename 6 | 7 | #define PI 3.14159265359f 8 | #define ONE_OVER_PI 0.31830988618f 9 | 10 | #define DEG_TO_RAD(angle) ((angle) * PI / 180.0f) 11 | #define RAD_TO_DEG(angle) ((angle) / PI * 180.0f) 12 | 13 | #define TRAP __debugbreak() 14 | 15 | #define KILO_BYTE(value) (value) * 1024 16 | #define MEGA_BYTE(value) (value) * 1024 * 1024 17 | #define GIGA_BYTE(value) (value) * 1024 * 1024 * 1024 18 | 19 | // Macro indirection to allow #defines to be converted into strings 20 | #define _TO_STRING(value) #value 21 | #define TO_STRING(value) _TO_STRING(value) 22 | 23 | #define ALLOC_ARRAY(T, count) reinterpret_cast(malloc(count * sizeof(T))) -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/VectorMath.cpp: -------------------------------------------------------------------------------- 1 | #include "VectorMath.h" 2 | 3 | #include 4 | 5 | glm::mat4 create_view_matrix(const glm::vec3& camera_position, const glm::quat& camera_rotation) { 6 | const glm::vec3 u(camera_rotation.x, camera_rotation.y, camera_rotation.z); 7 | const float s = camera_rotation.w; 8 | 9 | const float dot = (s * s - glm::dot(u, u)); 10 | 11 | const glm::vec3 right( 12 | 2.0f * u.x * u.x + dot, 13 | 2.0f * u.x * u.y + 2.0f * s * u.z, 14 | 2.0f * u.x * u.z - 2.0f * s * u.y 15 | ); // camera_rotation * glm::vec3(1.0f, 0.0f, 0.0f); 16 | const glm::vec3 up( 17 | 2.0f * u.y * u.x - 2.0f * s * u.z, 18 | 2.0f * u.y * u.y + dot, 19 | 2.0f * u.y * u.z + 2.0f * s * u.x 20 | ); // camera_rotation * glm::vec3(0.0f, 1.0f, 0.0f); 21 | const glm::vec3 forward( 22 | -2.0f * u.z * u.x - 2.0f * s * u.y, 23 | -2.0f * u.z * u.y + 2.0f * s * u.x, 24 | -2.0f * u.z * u.z - dot 25 | ); // camera_rotation * glm::vec3(0.0f, 0.0f, -1.0f); 26 | 27 | glm::mat4 result; 28 | { 29 | result[0][0] = right.x; result[1][0] = right.y; result[2][0] = right.z; result[3][0] = -glm::dot(camera_position, right); 30 | result[0][1] = up.x; result[1][1] = up.y; result[2][1] = up.z; result[3][1] = -glm::dot(camera_position, up); 31 | result[0][2] = -forward.x; result[1][2] = -forward.y; result[2][2] = -forward.z; result[3][2] = glm::dot(camera_position, forward); 32 | result[0][3] = 0.0f; result[1][3] = 0.0f; result[2][3] = 0.0f; result[3][3] = 1.0f; 33 | } 34 | return result; 35 | } 36 | 37 | glm::vec3 min_componentwise(const glm::vec3& a, const glm::vec3& b) { 38 | glm::vec3 result; 39 | 40 | result.x = std::min(a.x, b.x); 41 | result.y = std::min(a.y, b.y); 42 | result.z = std::min(a.z, b.z); 43 | 44 | return result; 45 | } 46 | 47 | glm::vec3 max_componentwise(const glm::vec3& a, const glm::vec3& b) { 48 | glm::vec3 result; 49 | 50 | result.x = std::max(a.x, b.x); 51 | result.y = std::max(a.y, b.y); 52 | result.z = std::max(a.z, b.z); 53 | 54 | return result; 55 | } 56 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/VectorMath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | glm::mat4 create_view_matrix(const glm::vec3& camera_position, const glm::quat& camera_rotation); 6 | 7 | glm::vec3 min_componentwise(const glm::vec3& a, const glm::vec3& b); 8 | glm::vec3 max_componentwise(const glm::vec3& a, const glm::vec3& b); 9 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/dll/x64/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/dll/x64/SDL2.dll -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/dll/x64/assimp-vc140-mt.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/dll/x64/assimp-vc140-mt.dll -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/dll/x64/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/dll/x64/glew32.dll -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/dll/x86/Assimp32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/dll/x86/Assimp32.dll -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/dll/x86/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/dll/x86/SDL2.dll -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/dll/x86/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/dll/x86/glew32.dll -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_clipboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_clipboard.h 24 | * 25 | * Include file for SDL clipboard handling 26 | */ 27 | 28 | #ifndef SDL_clipboard_h_ 29 | #define SDL_clipboard_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Function prototypes */ 40 | 41 | /** 42 | * \brief Put UTF-8 text into the clipboard 43 | * 44 | * \sa SDL_GetClipboardText() 45 | */ 46 | extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); 47 | 48 | /** 49 | * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() 50 | * 51 | * \sa SDL_SetClipboardText() 52 | */ 53 | extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); 54 | 55 | /** 56 | * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty 57 | * 58 | * \sa SDL_GetClipboardText() 59 | */ 60 | extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); 61 | 62 | 63 | /* Ends C function definitions when using C++ */ 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | #include "close_code.h" 68 | 69 | #endif /* SDL_clipboard_h_ */ 70 | 71 | /* vi: set ts=4 sw=4 expandtab: */ 72 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_copying.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2017 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_gesture.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_gesture.h 24 | * 25 | * Include file for SDL gesture event handling. 26 | */ 27 | 28 | #ifndef SDL_gesture_h_ 29 | #define SDL_gesture_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | #include "SDL_video.h" 34 | 35 | #include "SDL_touch.h" 36 | 37 | 38 | #include "begin_code.h" 39 | /* Set up for C function definitions, even when using C++ */ 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | typedef Sint64 SDL_GestureID; 45 | 46 | /* Function prototypes */ 47 | 48 | /** 49 | * \brief Begin Recording a gesture on the specified touch, or all touches (-1) 50 | * 51 | * 52 | */ 53 | extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); 54 | 55 | 56 | /** 57 | * \brief Save all currently loaded Dollar Gesture templates 58 | * 59 | * 60 | */ 61 | extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); 62 | 63 | /** 64 | * \brief Save a currently loaded Dollar Gesture template 65 | * 66 | * 67 | */ 68 | extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); 69 | 70 | 71 | /** 72 | * \brief Load Dollar Gesture templates from a file 73 | * 74 | * 75 | */ 76 | extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); 77 | 78 | 79 | /* Ends C function definitions when using C++ */ 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #include "close_code.h" 84 | 85 | #endif /* SDL_gesture_h_ */ 86 | 87 | /* vi: set ts=4 sw=4 expandtab: */ 88 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDLname_h_ 23 | #define SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifndef _MSC_VER 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_quit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_quit.h 24 | * 25 | * Include file for SDL quit event handling. 26 | */ 27 | 28 | #ifndef SDL_quit_h_ 29 | #define SDL_quit_h_ 30 | 31 | #include "SDL_stdinc.h" 32 | #include "SDL_error.h" 33 | 34 | /** 35 | * \file SDL_quit.h 36 | * 37 | * An ::SDL_QUIT event is generated when the user tries to close the application 38 | * window. If it is ignored or filtered out, the window will remain open. 39 | * If it is not ignored or filtered, it is queued normally and the window 40 | * is allowed to close. When the window is closed, screen updates will 41 | * complete, but have no effect. 42 | * 43 | * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) 44 | * and SIGTERM (system termination request), if handlers do not already 45 | * exist, that generate ::SDL_QUIT events as well. There is no way 46 | * to determine the cause of an ::SDL_QUIT event, but setting a signal 47 | * handler in your application will override the default generation of 48 | * quit events for that signal. 49 | * 50 | * \sa SDL_Quit() 51 | */ 52 | 53 | /* There are no functions directly affecting the quit event */ 54 | 55 | #define SDL_QuitRequested() \ 56 | (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) 57 | 58 | #endif /* SDL_quit_h_ */ 59 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "hg-11914:f1084c419f33" 2 | #define SDL_REVISION_NUMBER 11914 3 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_h_ 31 | #define SDL_test_h_ 32 | 33 | #include "SDL.h" 34 | #include "SDL_test_assert.h" 35 | #include "SDL_test_common.h" 36 | #include "SDL_test_compare.h" 37 | #include "SDL_test_crc32.h" 38 | #include "SDL_test_font.h" 39 | #include "SDL_test_fuzzer.h" 40 | #include "SDL_test_harness.h" 41 | #include "SDL_test_images.h" 42 | #include "SDL_test_log.h" 43 | #include "SDL_test_md5.h" 44 | #include "SDL_test_memory.h" 45 | #include "SDL_test_random.h" 46 | 47 | #include "begin_code.h" 48 | /* Set up for C function definitions, even when using C++ */ 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | /* Global definitions */ 54 | 55 | /* 56 | * Note: Maximum size of SDLTest log message is less than SDL's limit 57 | * to ensure we can fit additional information such as the timestamp. 58 | */ 59 | #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_test_compare.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_compare.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines comparison functions (i.e. for surfaces). 33 | 34 | */ 35 | 36 | #ifndef SDL_test_compare_h_ 37 | #define SDL_test_compare_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "SDL_test_images.h" 42 | 43 | #include "begin_code.h" 44 | /* Set up for C function definitions, even when using C++ */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** 50 | * \brief Compares a surface and with reference image data for equality 51 | * 52 | * \param surface Surface used in comparison 53 | * \param referenceSurface Test Surface used in comparison 54 | * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. 55 | * 56 | * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. 57 | */ 58 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); 59 | 60 | 61 | /* Ends C function definitions when using C++ */ 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #include "close_code.h" 66 | 67 | #endif /* SDL_test_compare_h_ */ 68 | 69 | /* vi: set ts=4 sw=4 expandtab: */ 70 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_test_images.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_images.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | 32 | Defines some images for tests. 33 | 34 | */ 35 | 36 | #ifndef SDL_test_images_h_ 37 | #define SDL_test_images_h_ 38 | 39 | #include "SDL.h" 40 | 41 | #include "begin_code.h" 42 | /* Set up for C function definitions, even when using C++ */ 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** 48 | *Type for test images. 49 | */ 50 | typedef struct SDLTest_SurfaceImage_s { 51 | int width; 52 | int height; 53 | unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ 54 | const char *pixel_data; 55 | } SDLTest_SurfaceImage_t; 56 | 57 | /* Test images */ 58 | SDL_Surface *SDLTest_ImageBlit(void); 59 | SDL_Surface *SDLTest_ImageBlitColor(void); 60 | SDL_Surface *SDLTest_ImageBlitAlpha(void); 61 | SDL_Surface *SDLTest_ImageBlitBlendAdd(void); 62 | SDL_Surface *SDLTest_ImageBlitBlend(void); 63 | SDL_Surface *SDLTest_ImageBlitBlendMod(void); 64 | SDL_Surface *SDLTest_ImageBlitBlendNone(void); 65 | SDL_Surface *SDLTest_ImageBlitBlendAll(void); 66 | SDL_Surface *SDLTest_ImageFace(void); 67 | SDL_Surface *SDLTest_ImagePrimitives(void); 68 | SDL_Surface *SDLTest_ImagePrimitivesBlend(void); 69 | 70 | /* Ends C function definitions when using C++ */ 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | #include "close_code.h" 75 | 76 | #endif /* SDL_test_images_h_ */ 77 | 78 | /* vi: set ts=4 sw=4 expandtab: */ 79 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_test_log.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_log.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | /* 31 | * 32 | * Wrapper to log in the TEST category 33 | * 34 | */ 35 | 36 | #ifndef SDL_test_log_h_ 37 | #define SDL_test_log_h_ 38 | 39 | #include "begin_code.h" 40 | /* Set up for C function definitions, even when using C++ */ 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | /** 46 | * \brief Prints given message with a timestamp in the TEST category and INFO priority. 47 | * 48 | * \param fmt Message to be logged 49 | */ 50 | void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 51 | 52 | /** 53 | * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. 54 | * 55 | * \param fmt Message to be logged 56 | */ 57 | void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); 58 | 59 | /* Ends C function definitions when using C++ */ 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #include "close_code.h" 64 | 65 | #endif /* SDL_test_log_h_ */ 66 | 67 | /* vi: set ts=4 sw=4 expandtab: */ 68 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_memory.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_memory_h_ 31 | #define SDL_test_memory_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Start tracking SDL memory allocations 42 | * 43 | * \note This should be called before any other SDL functions for complete tracking coverage 44 | */ 45 | int SDLTest_TrackAllocations(); 46 | 47 | /** 48 | * \brief Print a log of any outstanding allocations 49 | * 50 | * \note This can be called after SDL_Quit() 51 | */ 52 | void SDLTest_LogAllocations(); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* SDL_test_memory_h_ */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/SDL2/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2018 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #undef _begin_code_h 30 | 31 | /* Reset structure packing at previous byte alignment */ 32 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 33 | #ifdef __BORLANDC__ 34 | #pragma nopackwarning 35 | #endif 36 | #pragma pack(pop) 37 | #endif /* Compiler needs structure packing set */ 38 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/assimp/.editorconfig: -------------------------------------------------------------------------------- 1 | # See for details 2 | 3 | [*.{h,hpp,inl}] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | indent_size = 4 8 | indent_style = space 9 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/assimp/Compiler/poppack1.h: -------------------------------------------------------------------------------- 1 | 2 | // =============================================================================== 3 | // May be included multiple times - resets structure packing to the defaults 4 | // for all supported compilers. Reverts the changes made by #include 5 | // 6 | // Currently this works on the following compilers: 7 | // MSVC 7,8,9 8 | // GCC 9 | // BORLAND (complains about 'pack state changed but not reverted', but works) 10 | // =============================================================================== 11 | 12 | #ifndef AI_PUSHPACK_IS_DEFINED 13 | # error pushpack1.h must be included after poppack1.h 14 | #endif 15 | 16 | // reset packing to the original value 17 | #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) 18 | # pragma pack( pop ) 19 | #endif 20 | #undef PACK_STRUCT 21 | 22 | #undef AI_PUSHPACK_IS_DEFINED 23 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/assimp/Compiler/pushpack1.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | // =============================================================================== 4 | // May be included multiple times - sets structure packing to 1 5 | // for all supported compilers. #include reverts the changes. 6 | // 7 | // Currently this works on the following compilers: 8 | // MSVC 7,8,9 9 | // GCC 10 | // BORLAND (complains about 'pack state changed but not reverted', but works) 11 | // Clang 12 | // 13 | // 14 | // USAGE: 15 | // 16 | // struct StructToBePacked { 17 | // } PACK_STRUCT; 18 | // 19 | // =============================================================================== 20 | 21 | #ifdef AI_PUSHPACK_IS_DEFINED 22 | # error poppack1.h must be included after pushpack1.h 23 | #endif 24 | 25 | #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) 26 | # pragma pack(push,1) 27 | # define PACK_STRUCT 28 | #elif defined( __GNUC__ ) 29 | # if !defined(HOST_MINGW) 30 | # define PACK_STRUCT __attribute__((__packed__)) 31 | # else 32 | # define PACK_STRUCT __attribute__((gcc_struct, __packed__)) 33 | # endif 34 | #else 35 | # error Compiler not supported 36 | #endif 37 | 38 | #if defined(_MSC_VER) 39 | // C4103: Packing was changed after the inclusion of the header, probably missing #pragma pop 40 | # pragma warning (disable : 4103) 41 | #endif 42 | 43 | #define AI_PUSHPACK_IS_DEFINED 44 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/assimp/CreateAnimMesh.h: -------------------------------------------------------------------------------- 1 | /* 2 | Open Asset Import Library (assimp) 3 | ---------------------------------------------------------------------- 4 | 5 | Copyright (c) 2006-2018, assimp team 6 | 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the 12 | following conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | 40 | ---------------------------------------------------------------------- 41 | */ 42 | 43 | /** @file CreateAnimMesh.h 44 | * Create AnimMesh from Mesh 45 | */ 46 | #ifndef INCLUDED_AI_CREATE_ANIM_MESH_H 47 | #define INCLUDED_AI_CREATE_ANIM_MESH_H 48 | 49 | #include 50 | 51 | namespace Assimp { 52 | 53 | /** Create aiAnimMesh from aiMesh. */ 54 | ASSIMP_API aiAnimMesh *aiCreateAnimMesh(const aiMesh *mesh); 55 | 56 | } // end of namespace Assimp 57 | #endif // INCLUDED_AI_CREATE_ANIM_MESH_H 58 | 59 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/assimp/Defines.h: -------------------------------------------------------------------------------- 1 | /* 2 | Open Asset Import Library (assimp) 3 | ---------------------------------------------------------------------- 4 | 5 | Copyright (c) 2006-2012, assimp team 6 | All rights reserved. 7 | 8 | Redistribution and use of this software in source and binary forms, 9 | with or without modification, are permitted provided that the 10 | following conditions are met: 11 | 12 | * Redistributions of source code must retain the above 13 | copyright notice, this list of conditions and the 14 | following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above 17 | copyright notice, this list of conditions and the 18 | following disclaimer in the documentation and/or other 19 | materials provided with the distribution. 20 | 21 | * Neither the name of the assimp team, nor the names of its 22 | contributors may be used to endorse or promote products 23 | derived from this software without specific prior 24 | written permission of the assimp team. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | 38 | ---------------------------------------------------------------------- 39 | */ 40 | 41 | // We need those constants, workaround for any platforms where nobody defined them yet 42 | #if (!defined SIZE_MAX) 43 | # define SIZE_MAX (~((size_t)0)) 44 | #endif 45 | 46 | #if (!defined UINT_MAX) 47 | # define UINT_MAX (~((unsigned int)0)) 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/assimp/Macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2012, assimp team 7 | 8 | All rights reserved. 9 | 10 | Redistribution and use of this software in source and binary forms, 11 | with or without modification, are permitted provided that the following 12 | conditions are met: 13 | 14 | * Redistributions of source code must retain the above 15 | copyright notice, this list of conditions and the 16 | following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above 19 | copyright notice, this list of conditions and the 20 | following disclaimer in the documentation and/or other 21 | materials provided with the distribution. 22 | 23 | * Neither the name of the assimp team, nor the names of its 24 | contributors may be used to endorse or promote products 25 | derived from this software without specific prior 26 | written permission of the assimp team. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | --------------------------------------------------------------------------- 40 | */ 41 | 42 | /* Helper macro to set a pointer to NULL in debug builds 43 | */ 44 | #if (defined ASSIMP_BUILD_DEBUG) 45 | # define AI_DEBUG_INVALIDATE_PTR(x) x = NULL; 46 | #else 47 | # define AI_DEBUG_INVALIDATE_PTR(x) 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/assimp/ai_assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Open Asset Import Library (assimp) 4 | --------------------------------------------------------------------------- 5 | 6 | Copyright (c) 2006-2018, assimp team 7 | 8 | 9 | 10 | All rights reserved. 11 | 12 | Redistribution and use of this software in source and binary forms, 13 | with or without modification, are permitted provided that the following 14 | conditions are met: 15 | 16 | * Redistributions of source code must retain the above 17 | copyright notice, this list of conditions and the 18 | following disclaimer. 19 | 20 | * Redistributions in binary form must reproduce the above 21 | copyright notice, this list of conditions and the 22 | following disclaimer in the documentation and/or other 23 | materials provided with the distribution. 24 | 25 | * Neither the name of the assimp team, nor the names of its 26 | contributors may be used to endorse or promote products 27 | derived from this software without specific prior 28 | written permission of the assimp team. 29 | 30 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 31 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 32 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 33 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 34 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 35 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 36 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 37 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 38 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 40 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | --------------------------------------------------------------------------- 42 | */ 43 | #pragma once 44 | #ifndef AI_ASSERT_H_INC 45 | #define AI_ASSERT_H_INC 46 | 47 | #ifdef ASSIMP_BUILD_DEBUG 48 | # include 49 | # define ai_assert(expression) assert(expression) 50 | #else 51 | # define ai_assert(expression) 52 | #endif // 53 | 54 | #endif // AI_ASSERT_H_INC 55 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/detail/_noise.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/_noise.hpp 3 | 4 | #pragma once 5 | 6 | #include "../vec2.hpp" 7 | #include "../vec3.hpp" 8 | #include "../vec4.hpp" 9 | #include "../common.hpp" 10 | 11 | namespace glm{ 12 | namespace detail 13 | { 14 | template 15 | GLM_FUNC_QUALIFIER T mod289(T const& x) 16 | { 17 | return x - floor(x * (static_cast(1.0) / static_cast(289.0))) * static_cast(289.0); 18 | } 19 | 20 | template 21 | GLM_FUNC_QUALIFIER T permute(T const& x) 22 | { 23 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER vec<2, T, Q> permute(vec<2, T, Q> const& x) 28 | { 29 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 30 | } 31 | 32 | template 33 | GLM_FUNC_QUALIFIER vec<3, T, Q> permute(vec<3, T, Q> const& x) 34 | { 35 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER vec<4, T, Q> permute(vec<4, T, Q> const& x) 40 | { 41 | return mod289(((x * static_cast(34)) + static_cast(1)) * x); 42 | } 43 | 44 | template 45 | GLM_FUNC_QUALIFIER T taylorInvSqrt(T const& r) 46 | { 47 | return T(1.79284291400159) - T(0.85373472095314) * r; 48 | } 49 | 50 | template 51 | GLM_FUNC_QUALIFIER vec<2, T, Q> taylorInvSqrt(vec<2, T, Q> const& r) 52 | { 53 | return T(1.79284291400159) - T(0.85373472095314) * r; 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER vec<3, T, Q> taylorInvSqrt(vec<3, T, Q> const& r) 58 | { 59 | return T(1.79284291400159) - T(0.85373472095314) * r; 60 | } 61 | 62 | template 63 | GLM_FUNC_QUALIFIER vec<4, T, Q> taylorInvSqrt(vec<4, T, Q> const& r) 64 | { 65 | return T(1.79284291400159) - T(0.85373472095314) * r; 66 | } 67 | 68 | template 69 | GLM_FUNC_QUALIFIER vec<2, T, Q> fade(vec<2, T, Q> const& t) 70 | { 71 | return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); 72 | } 73 | 74 | template 75 | GLM_FUNC_QUALIFIER vec<3, T, Q> fade(vec<3, T, Q> const& t) 76 | { 77 | return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); 78 | } 79 | 80 | template 81 | GLM_FUNC_QUALIFIER vec<4, T, Q> fade(vec<4, T, Q> const& t) 82 | { 83 | return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); 84 | } 85 | }//namespace detail 86 | }//namespace glm 87 | 88 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/detail/func_integer_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_integer_simd.inl 3 | 4 | #include "../simd/integer.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_bitfieldReverseStep<4, uint32, Q, true, true> 13 | { 14 | GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift) 15 | { 16 | __m128i const set0 = v.data; 17 | 18 | __m128i const set1 = _mm_set1_epi32(static_cast(Mask)); 19 | __m128i const and1 = _mm_and_si128(set0, set1); 20 | __m128i const sft1 = _mm_slli_epi32(and1, Shift); 21 | 22 | __m128i const set2 = _mm_andnot_si128(set0, _mm_set1_epi32(-1)); 23 | __m128i const and2 = _mm_and_si128(set0, set2); 24 | __m128i const sft2 = _mm_srai_epi32(and2, Shift); 25 | 26 | __m128i const or0 = _mm_or_si128(sft1, sft2); 27 | 28 | return or0; 29 | } 30 | }; 31 | 32 | template 33 | struct compute_bitfieldBitCountStep<4, uint32, Q, true, true> 34 | { 35 | GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift) 36 | { 37 | __m128i const set0 = v.data; 38 | 39 | __m128i const set1 = _mm_set1_epi32(static_cast(Mask)); 40 | __m128i const and0 = _mm_and_si128(set0, set1); 41 | __m128i const sft0 = _mm_slli_epi32(set0, Shift); 42 | __m128i const and1 = _mm_and_si128(sft0, set1); 43 | __m128i const add0 = _mm_add_epi32(and0, and1); 44 | 45 | return add0; 46 | } 47 | }; 48 | }//namespace detail 49 | 50 | # if GLM_ARCH & GLM_ARCH_AVX_BIT 51 | template<> 52 | GLM_FUNC_QUALIFIER int bitCount(uint32 x) 53 | { 54 | return _mm_popcnt_u32(x); 55 | } 56 | 57 | # if(GLM_MODEL == GLM_MODEL_64) 58 | template<> 59 | GLM_FUNC_QUALIFIER int bitCount(uint64 x) 60 | { 61 | return static_cast(_mm_popcnt_u64(x)); 62 | } 63 | # endif//GLM_MODEL 64 | # endif//GLM_ARCH 65 | 66 | }//namespace glm 67 | 68 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 69 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/include/glm/detail/func_trigonometric_simd.inl -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/detail/type_mat.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat.inl 3 | 4 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/detail/type_vec.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_vec.inl 3 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/detail/type_vec1.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/include/glm/detail/type_vec1.hpp -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/ext/vec1.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/include/glm/ext/vec1.inl -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtc/color_space.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_color_space 2 | /// @file glm/gtc/color_space.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_color_space (dependence) 6 | /// 7 | /// @defgroup gtc_color_space GLM_GTC_color_space 8 | /// @ingroup gtc 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// 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 "../exponential.hpp" 20 | #include "../vec3.hpp" 21 | #include "../vec4.hpp" 22 | #include 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTC_color_space extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtc_color_space 31 | /// @{ 32 | 33 | /// Convert a linear color to sRGB color using a standard gamma correction. 34 | /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb 35 | template 36 | GLM_FUNC_DECL vec convertLinearToSRGB(vec const& ColorLinear); 37 | 38 | /// Convert a linear color to sRGB color using a custom gamma correction. 39 | /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb 40 | template 41 | GLM_FUNC_DECL vec convertLinearToSRGB(vec const& ColorLinear, T Gamma); 42 | 43 | /// Convert a sRGB color to linear color using a standard gamma correction. 44 | /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb 45 | template 46 | GLM_FUNC_DECL vec convertSRGBToLinear(vec const& ColorSRGB); 47 | 48 | /// Convert a sRGB color to linear color using a custom gamma correction. 49 | // IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb 50 | template 51 | GLM_FUNC_DECL vec convertSRGBToLinear(vec const& ColorSRGB, T Gamma); 52 | 53 | /// @} 54 | } //namespace glm 55 | 56 | #include "color_space.inl" 57 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtc/epsilon.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_epsilon 2 | /// @file glm/gtc/epsilon.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_quaternion (dependence) 6 | /// 7 | /// @defgroup gtc_epsilon GLM_GTC_epsilon 8 | /// @ingroup gtc 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Comparison functions for a user defined epsilon 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_GTC_epsilon extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtc_epsilon 27 | /// @{ 28 | 29 | /// Returns the component-wise comparison of |x - y| < epsilon. 30 | /// True if this expression is satisfied. 31 | /// 32 | /// @see gtc_epsilon 33 | template 34 | GLM_FUNC_DECL vec epsilonEqual(vec const& x, vec const& y, T const& epsilon); 35 | 36 | /// Returns the component-wise comparison of |x - y| < epsilon. 37 | /// True if this expression is satisfied. 38 | /// 39 | /// @see gtc_epsilon 40 | template 41 | GLM_FUNC_DECL bool epsilonEqual(genType const& x, genType const& y, genType const& epsilon); 42 | 43 | /// Returns the component-wise comparison of |x - y| < epsilon. 44 | /// True if this expression is not satisfied. 45 | /// 46 | /// @see gtc_epsilon 47 | template 48 | GLM_FUNC_DECL vec epsilonNotEqual(vec const& x, vec const& y, T const& epsilon); 49 | 50 | /// Returns the component-wise comparison of |x - y| >= epsilon. 51 | /// True if this expression is not satisfied. 52 | /// 53 | /// @see gtc_epsilon 54 | template 55 | GLM_FUNC_DECL bool epsilonNotEqual(genType const& x, genType const& y, genType const& epsilon); 56 | 57 | /// @} 58 | }//namespace glm 59 | 60 | #include "epsilon.inl" 61 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtc/integer.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_integer 2 | /// @file glm/gtc/integer.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_integer (dependence) 6 | /// 7 | /// @defgroup gtc_integer GLM_GTC_integer 8 | /// @ingroup gtc 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 "../common.hpp" 20 | #include "../integer.hpp" 21 | #include "../exponential.hpp" 22 | #include 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTC_integer extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtc_integer 31 | /// @{ 32 | 33 | /// Returns the log2 of x for integer values. Can be reliably using to compute mipmap count from the texture size. 34 | /// @see gtc_integer 35 | template 36 | GLM_FUNC_DECL genIUType log2(genIUType x); 37 | 38 | /// Returns a value equal to the nearest integer to x. 39 | /// The fraction 0.5 will round in a direction chosen by the 40 | /// implementation, presumably the direction that is fastest. 41 | /// 42 | /// @param x The values of the argument must be greater or equal to zero. 43 | /// @tparam T floating point scalar types. 44 | /// 45 | /// @see GLSL round man page 46 | /// @see gtc_integer 47 | template 48 | GLM_FUNC_DECL vec iround(vec const& x); 49 | 50 | /// Returns a value equal to the nearest integer to x. 51 | /// The fraction 0.5 will round in a direction chosen by the 52 | /// implementation, presumably the direction that is fastest. 53 | /// 54 | /// @param x The values of the argument must be greater or equal to zero. 55 | /// @tparam T floating point scalar types. 56 | /// 57 | /// @see GLSL round man page 58 | /// @see gtc_integer 59 | template 60 | GLM_FUNC_DECL vec uround(vec const& x); 61 | 62 | /// @} 63 | } //namespace glm 64 | 65 | #include "integer.inl" 66 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_swizzle 2 | /// @file glm/gtc/swizzle.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtc/ulp.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_ulp 2 | /// @file glm/gtc/ulp.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_ulp GLM_GTC_ulp 7 | /// @ingroup gtc 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Allow the measurement of the accuracy of a function against a reference 12 | /// implementation. This extension works on floating-point data and provide results 13 | /// in ULP. 14 | 15 | #pragma once 16 | 17 | // Dependencies 18 | #include "../detail/setup.hpp" 19 | #include "../detail/qualifier.hpp" 20 | #include "../detail/type_int.hpp" 21 | #include "../detail/compute_vector_relational.hpp" 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTC_ulp extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtc_ulp 30 | /// @{ 31 | 32 | /// Return the next ULP value(s) after the input value(s). 33 | /// @see gtc_ulp 34 | template 35 | GLM_FUNC_DECL genType next_float(genType const& x); 36 | 37 | /// Return the previous ULP value(s) before the input value(s). 38 | /// @see gtc_ulp 39 | template 40 | GLM_FUNC_DECL genType prev_float(genType const& x); 41 | 42 | /// Return the value(s) ULP distance after the input value(s). 43 | /// @see gtc_ulp 44 | template 45 | GLM_FUNC_DECL genType next_float(genType const& x, uint const& Distance); 46 | 47 | /// Return the value(s) ULP distance before the input value(s). 48 | /// @see gtc_ulp 49 | template 50 | GLM_FUNC_DECL genType prev_float(genType const& x, uint const& Distance); 51 | 52 | /// Return the distance in the number of ULP between 2 scalars. 53 | /// @see gtc_ulp 54 | template 55 | GLM_FUNC_DECL uint float_distance(T const& x, T const& y); 56 | 57 | /// Return the distance in the number of ULP between 2 vectors. 58 | /// @see gtc_ulp 59 | template 60 | GLM_FUNC_DECL vec<2, uint, Q> float_distance(vec<2, T, Q> const& x, vec<2, T, Q> const& y); 61 | 62 | /// @} 63 | }// namespace glm 64 | 65 | #include "ulp.inl" 66 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtc/vec1.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.inl 3 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/color_space.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_space 2 | /// @file glm/gtx/color_space.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_color_space GLM_GTX_color_space 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Related to RGB to HSV conversions and operations. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_color_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_color_space extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_color_space 29 | /// @{ 30 | 31 | /// Converts a color from HSV color space to its color in RGB color space. 32 | /// @see gtx_color_space 33 | template 34 | GLM_FUNC_DECL vec<3, T, Q> rgbColor( 35 | vec<3, T, Q> const& hsvValue); 36 | 37 | /// Converts a color from RGB color space to its color in HSV color space. 38 | /// @see gtx_color_space 39 | template 40 | GLM_FUNC_DECL vec<3, T, Q> hsvColor( 41 | vec<3, T, Q> const& rgbValue); 42 | 43 | /// Build a saturation matrix. 44 | /// @see gtx_color_space 45 | template 46 | GLM_FUNC_DECL mat<4, 4, T, defaultp> saturation( 47 | T const s); 48 | 49 | /// Modify the saturation of a color. 50 | /// @see gtx_color_space 51 | template 52 | GLM_FUNC_DECL vec<3, T, Q> saturation( 53 | T const s, 54 | vec<3, T, Q> const& color); 55 | 56 | /// Modify the saturation of a color. 57 | /// @see gtx_color_space 58 | template 59 | GLM_FUNC_DECL vec<4, T, Q> saturation( 60 | T const s, 61 | vec<4, T, Q> const& color); 62 | 63 | /// Compute color luminosity associating ratios (0.33, 0.59, 0.11) to RGB canals. 64 | /// @see gtx_color_space 65 | template 66 | GLM_FUNC_DECL T luminosity( 67 | vec<3, T, Q> const& color); 68 | 69 | /// @} 70 | }//namespace glm 71 | 72 | #include "color_space.inl" 73 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/color_space_YCoCg.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_color_space_YCoCg 2 | /// @file glm/gtx/color_space_YCoCg.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_color_space_YCoCg GLM_GTX_color_space_YCoCg 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// RGB to YCoCg conversions and operations 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #ifndef GLM_ENABLE_EXPERIMENTAL 19 | # error "GLM: GLM_GTX_color_space_YCoCg 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_color_space_YCoCg extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtx_color_space_YCoCg 29 | /// @{ 30 | 31 | /// Convert a color from RGB color space to YCoCg color space. 32 | /// @see gtx_color_space_YCoCg 33 | template 34 | GLM_FUNC_DECL vec<3, T, Q> rgb2YCoCg( 35 | vec<3, T, Q> const& rgbColor); 36 | 37 | /// Convert a color from YCoCg color space to RGB color space. 38 | /// @see gtx_color_space_YCoCg 39 | template 40 | GLM_FUNC_DECL vec<3, T, Q> YCoCg2rgb( 41 | vec<3, T, Q> const& YCoCgColor); 42 | 43 | /// Convert a color from RGB color space to YCoCgR color space. 44 | /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" 45 | /// @see gtx_color_space_YCoCg 46 | template 47 | GLM_FUNC_DECL vec<3, T, Q> rgb2YCoCgR( 48 | vec<3, T, Q> const& rgbColor); 49 | 50 | /// Convert a color from YCoCgR color space to RGB color space. 51 | /// @see "YCoCg-R: A Color Space with RGB Reversibility and Low Dynamic Range" 52 | /// @see gtx_color_space_YCoCg 53 | template 54 | GLM_FUNC_DECL vec<3, T, Q> YCoCgR2rgb( 55 | vec<3, T, Q> const& YCoCgColor); 56 | 57 | /// @} 58 | }//namespace glm 59 | 60 | #include "color_space_YCoCg.inl" 61 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/integer.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_integer 2 | /// @file glm/gtx/integer.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_integer GLM_GTX_integer 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Add support for integer for core functions 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtc/integer.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_integer 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_integer extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_integer 30 | /// @{ 31 | 32 | //! Returns x raised to the y power. 33 | //! From GLM_GTX_integer extension. 34 | GLM_FUNC_DECL int pow(int x, uint y); 35 | 36 | //! Returns the positive square root of x. 37 | //! From GLM_GTX_integer extension. 38 | GLM_FUNC_DECL int sqrt(int x); 39 | 40 | //! Returns the floor log2 of x. 41 | //! From GLM_GTX_integer extension. 42 | GLM_FUNC_DECL unsigned int floor_log2(unsigned int x); 43 | 44 | //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. 45 | //! From GLM_GTX_integer extension. 46 | GLM_FUNC_DECL int mod(int x, int y); 47 | 48 | //! Return the factorial value of a number (!12 max, integer only) 49 | //! From GLM_GTX_integer extension. 50 | template 51 | GLM_FUNC_DECL genType factorial(genType const& x); 52 | 53 | //! 32bit signed integer. 54 | //! From GLM_GTX_integer extension. 55 | typedef signed int sint; 56 | 57 | //! Returns x raised to the y power. 58 | //! From GLM_GTX_integer extension. 59 | GLM_FUNC_DECL uint pow(uint x, uint y); 60 | 61 | //! Returns the positive square root of x. 62 | //! From GLM_GTX_integer extension. 63 | GLM_FUNC_DECL uint sqrt(uint x); 64 | 65 | //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. 66 | //! From GLM_GTX_integer extension. 67 | GLM_FUNC_DECL uint mod(uint x, uint y); 68 | 69 | //! Returns the number of leading zeros. 70 | //! From GLM_GTX_integer extension. 71 | GLM_FUNC_DECL uint nlz(uint x); 72 | 73 | /// @} 74 | }//namespace glm 75 | 76 | #include "integer.inl" 77 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/matrix_factorisation.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/include/glm/gtx/matrix_factorisation.inl -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/matrix_interpolation.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_interpolation 2 | /// @file glm/gtx/matrix_interpolation.hpp 3 | /// @author Ghenadii Ursachi (the.asteroth@gmail.com) 4 | /// 5 | /// @see core (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_interpolation GLM_GTX_matrix_interpolation 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Allows to directly interpolate two matrices. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #ifndef GLM_ENABLE_EXPERIMENTAL 20 | # error "GLM: GLM_GTX_matrix_interpolation 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_interpolation extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_matrix_interpolation 30 | /// @{ 31 | 32 | /// Get the axis and angle of the rotation from a matrix. 33 | /// From GLM_GTX_matrix_interpolation extension. 34 | template 35 | GLM_FUNC_DECL void axisAngle( 36 | mat<4, 4, T, Q> const& mat, 37 | vec<3, T, Q> & axis, 38 | T & angle); 39 | 40 | /// Build a matrix from axis and angle. 41 | /// From GLM_GTX_matrix_interpolation extension. 42 | template 43 | GLM_FUNC_DECL mat<4, 4, T, Q> axisAngleMatrix( 44 | vec<3, T, Q> const& axis, 45 | T const angle); 46 | 47 | /// Extracts the rotation part of a matrix. 48 | /// From GLM_GTX_matrix_interpolation extension. 49 | template 50 | GLM_FUNC_DECL mat<4, 4, T, Q> extractMatrixRotation( 51 | mat<4, 4, T, Q> const& mat); 52 | 53 | /// Build a interpolation of 4 * 4 matrixes. 54 | /// From GLM_GTX_matrix_interpolation extension. 55 | /// Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results. 56 | template 57 | GLM_FUNC_DECL mat<4, 4, T, Q> interpolate( 58 | mat<4, 4, T, Q> const& m1, 59 | mat<4, 4, T, Q> const& m2, 60 | T const delta); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "matrix_interpolation.inl" 66 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.inl 3 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/rotate_normalized_axis.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_rotate_normalized_axis 2 | /// @file glm/gtx/rotate_normalized_axis.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_matrix_transform 6 | /// @see gtc_quaternion 7 | /// 8 | /// @defgroup gtx_rotate_normalized_axis GLM_GTX_rotate_normalized_axis 9 | /// @ingroup gtx 10 | /// 11 | /// Include to use the features of this extension. 12 | /// 13 | /// Quaternions and matrices rotations around normalized axis. 14 | 15 | #pragma once 16 | 17 | // Dependency: 18 | #include "../glm.hpp" 19 | #include "../gtc/epsilon.hpp" 20 | #include "../gtc/quaternion.hpp" 21 | 22 | #ifndef GLM_ENABLE_EXPERIMENTAL 23 | # error "GLM: GLM_GTX_rotate_normalized_axis 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_rotate_normalized_axis extension included") 28 | #endif 29 | 30 | namespace glm 31 | { 32 | /// @addtogroup gtx_rotate_normalized_axis 33 | /// @{ 34 | 35 | /// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle. 36 | /// 37 | /// @param m Input matrix multiplied by this rotation matrix. 38 | /// @param angle Rotation angle expressed in radians. 39 | /// @param axis Rotation axis, must be normalized. 40 | /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double. 41 | /// 42 | /// @see gtx_rotate_normalized_axis 43 | /// @see - rotate(T angle, T x, T y, T z) 44 | /// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z) 45 | /// @see - rotate(T angle, vec<3, T, Q> const& v) 46 | template 47 | GLM_FUNC_DECL mat<4, 4, T, Q> rotateNormalizedAxis( 48 | mat<4, 4, T, Q> const& m, 49 | T const& angle, 50 | vec<3, T, Q> const& axis); 51 | 52 | /// Rotates a quaternion from a vector of 3 components normalized axis and an angle. 53 | /// 54 | /// @param q Source orientation 55 | /// @param angle Angle expressed in radians. 56 | /// @param axis Normalized axis of the rotation, must be normalized. 57 | /// 58 | /// @see gtx_rotate_normalized_axis 59 | template 60 | GLM_FUNC_DECL tquat rotateNormalizedAxis( 61 | tquat const& q, 62 | T const& angle, 63 | vec<3, T, Q> const& axis); 64 | 65 | /// @} 66 | }//namespace glm 67 | 68 | #include "rotate_normalized_axis.inl" 69 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/spline.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_spline 2 | /// @file glm/gtx/spline.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType catmullRom 8 | ( 9 | genType const& v1, 10 | genType const& v2, 11 | genType const& v3, 12 | genType const& v4, 13 | typename genType::value_type const& s 14 | ) 15 | { 16 | typename genType::value_type s2 = pow2(s); 17 | typename genType::value_type s3 = pow3(s); 18 | 19 | typename genType::value_type f1 = -s3 + typename genType::value_type(2) * s2 - s; 20 | typename genType::value_type f2 = typename genType::value_type(3) * s3 - typename genType::value_type(5) * s2 + typename genType::value_type(2); 21 | typename genType::value_type f3 = typename genType::value_type(-3) * s3 + typename genType::value_type(4) * s2 + s; 22 | typename genType::value_type f4 = s3 - s2; 23 | 24 | return (f1 * v1 + f2 * v2 + f3 * v3 + f4 * v4) / typename genType::value_type(2); 25 | 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER genType hermite 30 | ( 31 | genType const& v1, 32 | genType const& t1, 33 | genType const& v2, 34 | genType const& t2, 35 | typename genType::value_type const& s 36 | ) 37 | { 38 | typename genType::value_type s2 = pow2(s); 39 | typename genType::value_type s3 = pow3(s); 40 | 41 | typename genType::value_type f1 = typename genType::value_type(2) * s3 - typename genType::value_type(3) * s2 + typename genType::value_type(1); 42 | typename genType::value_type f2 = typename genType::value_type(-2) * s3 + typename genType::value_type(3) * s2; 43 | typename genType::value_type f3 = s3 - typename genType::value_type(2) * s2 + s; 44 | typename genType::value_type f4 = s3 - s2; 45 | 46 | return f1 * v1 + f2 * v2 + f3 * t1 + f4 * t2; 47 | } 48 | 49 | template 50 | GLM_FUNC_QUALIFIER genType cubic 51 | ( 52 | genType const& v1, 53 | genType const& v2, 54 | genType const& v3, 55 | genType const& v4, 56 | typename genType::value_type const& s 57 | ) 58 | { 59 | return ((v1 * s + v2) * s + v3) * s + v4; 60 | } 61 | }//namespace glm 62 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/std_based_type.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | /// @file glm/gtx/std_based_type.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_std_based_type GLM_GTX_std_based_type 8 | /// @ingroup gtx 9 | /// 10 | /// Include to use the features of this extension. 11 | /// 12 | /// Adds vector types based on STL value types. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_std_based_type 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_std_based_type extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_std_based_type 31 | /// @{ 32 | 33 | /// Vector type based of one std::size_t component. 34 | /// @see GLM_GTX_std_based_type 35 | typedef vec<1, std::size_t, defaultp> size1; 36 | 37 | /// Vector type based of two std::size_t components. 38 | /// @see GLM_GTX_std_based_type 39 | typedef vec<2, std::size_t, defaultp> size2; 40 | 41 | /// Vector type based of three std::size_t components. 42 | /// @see GLM_GTX_std_based_type 43 | typedef vec<3, std::size_t, defaultp> size3; 44 | 45 | /// Vector type based of four std::size_t components. 46 | /// @see GLM_GTX_std_based_type 47 | typedef vec<4, std::size_t, defaultp> size4; 48 | 49 | /// Vector type based of one std::size_t component. 50 | /// @see GLM_GTX_std_based_type 51 | typedef vec<1, std::size_t, defaultp> size1_t; 52 | 53 | /// Vector type based of two std::size_t components. 54 | /// @see GLM_GTX_std_based_type 55 | typedef vec<2, std::size_t, defaultp> size2_t; 56 | 57 | /// Vector type based of three std::size_t components. 58 | /// @see GLM_GTX_std_based_type 59 | typedef vec<3, std::size_t, defaultp> size3_t; 60 | 61 | /// Vector type based of four std::size_t components. 62 | /// @see GLM_GTX_std_based_type 63 | typedef vec<4, std::size_t, defaultp> size4_t; 64 | 65 | /// @} 66 | }//namespace glm 67 | 68 | #include "std_based_type.inl" 69 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/type_trait.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_type_trait 2 | /// @file glm/gtx/type_trait.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_type_trait GLM_GTX_type_trait 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Defines traits for each type. 12 | 13 | #pragma once 14 | 15 | #ifndef GLM_ENABLE_EXPERIMENTAL 16 | # error "GLM: GLM_GTX_type_trait 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." 17 | #endif 18 | 19 | // Dependency: 20 | #include "../detail/qualifier.hpp" 21 | #include "../gtc/quaternion.hpp" 22 | #include "../gtx/dual_quaternion.hpp" 23 | 24 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 25 | # pragma message("GLM: GLM_GTX_type_trait extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_type_trait 31 | /// @{ 32 | 33 | template 34 | struct type 35 | { 36 | static bool const is_vec = false; 37 | static bool const is_mat = false; 38 | static bool const is_quat = false; 39 | static length_t const components = 0; 40 | static length_t const cols = 0; 41 | static length_t const rows = 0; 42 | }; 43 | 44 | template 45 | struct type > 46 | { 47 | static bool const is_vec = true; 48 | static bool const is_mat = false; 49 | static bool const is_quat = false; 50 | static length_t const components = L; 51 | }; 52 | 53 | template 54 | struct type > 55 | { 56 | static bool const is_vec = false; 57 | static bool const is_mat = true; 58 | static bool const is_quat = false; 59 | static length_t const components = C; 60 | static length_t const cols = C; 61 | static length_t const rows = R; 62 | }; 63 | 64 | template 65 | struct type > 66 | { 67 | static bool const is_vec = false; 68 | static bool const is_mat = false; 69 | static bool const is_quat = true; 70 | static length_t const components = 4; 71 | }; 72 | 73 | template 74 | struct type > 75 | { 76 | static bool const is_vec = false; 77 | static bool const is_mat = false; 78 | static bool const is_quat = true; 79 | static length_t const components = 8; 80 | }; 81 | 82 | /// @} 83 | }//namespace glm 84 | 85 | #include "type_trait.inl" 86 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/type_trait.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_type_trait 2 | /// @file glm/gtx/type_trait.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | bool const type::is_vec; 8 | template 9 | bool const type::is_mat; 10 | template 11 | bool const type::is_quat; 12 | template 13 | length_t const type::components; 14 | template 15 | length_t const type::cols; 16 | template 17 | length_t const type::rows; 18 | 19 | // vec 20 | template 21 | bool const type >::is_vec; 22 | template 23 | bool const type >::is_mat; 24 | template 25 | bool const type >::is_quat; 26 | template 27 | length_t const type >::components; 28 | 29 | // mat 30 | template 31 | bool const type >::is_vec; 32 | template 33 | bool const type >::is_mat; 34 | template 35 | bool const type >::is_quat; 36 | template 37 | length_t const type >::components; 38 | template 39 | length_t const type >::cols; 40 | template 41 | length_t const type >::rows; 42 | 43 | // tquat 44 | template 45 | bool const type >::is_vec; 46 | template 47 | bool const type >::is_mat; 48 | template 49 | bool const type >::is_quat; 50 | template 51 | length_t const type >::components; 52 | 53 | // tdualquat 54 | template 55 | bool const type >::is_vec; 56 | template 57 | bool const type >::is_mat; 58 | template 59 | bool const type >::is_quat; 60 | template 61 | length_t const type >::components; 62 | }//namespace glm 63 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/vector_angle.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_vector_angle 2 | /// @file glm/gtx/vector_angle.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_quaternion (dependence) 6 | /// @see gtx_epsilon (dependence) 7 | /// 8 | /// @defgroup gtx_vector_angle GLM_GTX_vector_angle 9 | /// @ingroup gtx 10 | /// 11 | /// Include to use the features of this extension. 12 | /// 13 | /// Compute angle between vectors 14 | 15 | #pragma once 16 | 17 | // Dependency: 18 | #include "../glm.hpp" 19 | #include "../gtc/epsilon.hpp" 20 | #include "../gtx/quaternion.hpp" 21 | #include "../gtx/rotate_vector.hpp" 22 | 23 | #ifndef GLM_ENABLE_EXPERIMENTAL 24 | # error "GLM: GLM_GTX_vector_angle 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_vector_angle extension included") 29 | #endif 30 | 31 | namespace glm 32 | { 33 | /// @addtogroup gtx_vector_angle 34 | /// @{ 35 | 36 | //! Returns the absolute angle between two vectors. 37 | //! Parameters need to be normalized. 38 | /// @see gtx_vector_angle extension. 39 | template 40 | GLM_FUNC_DECL T angle(vec const& x, vec const& y); 41 | 42 | //! Returns the oriented angle between two 2d vectors. 43 | //! Parameters need to be normalized. 44 | /// @see gtx_vector_angle extension. 45 | template 46 | GLM_FUNC_DECL T orientedAngle(vec<2, T, Q> const& x, vec<2, T, Q> const& y); 47 | 48 | //! Returns the oriented angle between two 3d vectors based from a reference axis. 49 | //! Parameters need to be normalized. 50 | /// @see gtx_vector_angle extension. 51 | template 52 | GLM_FUNC_DECL T orientedAngle(vec<3, T, Q> const& x, vec<3, T, Q> const& y, vec<3, T, Q> const& ref); 53 | 54 | /// @} 55 | }// namespace glm 56 | 57 | #include "vector_angle.inl" 58 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/include/glm/gtx/vector_query.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_vector_query 2 | /// @file glm/gtx/vector_query.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_vector_query GLM_GTX_vector_query 7 | /// @ingroup gtx 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// Query informations of vector types 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include 18 | #include 19 | 20 | #ifndef GLM_ENABLE_EXPERIMENTAL 21 | # error "GLM: GLM_GTX_vector_query 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_vector_query extension included") 26 | #endif 27 | 28 | namespace glm 29 | { 30 | /// @addtogroup gtx_vector_query 31 | /// @{ 32 | 33 | //! Check whether two vectors are collinears. 34 | /// @see gtx_vector_query extensions. 35 | template 36 | GLM_FUNC_DECL bool areCollinear(vec const& v0, vec const& v1, T const& epsilon); 37 | 38 | //! Check whether two vectors are orthogonals. 39 | /// @see gtx_vector_query extensions. 40 | template 41 | GLM_FUNC_DECL bool areOrthogonal(vec const& v0, vec const& v1, T const& epsilon); 42 | 43 | //! Check whether a vector is normalized. 44 | /// @see gtx_vector_query extensions. 45 | template 46 | GLM_FUNC_DECL bool isNormalized(vec const& v, T const& epsilon); 47 | 48 | //! Check whether a vector is null. 49 | /// @see gtx_vector_query extensions. 50 | template 51 | GLM_FUNC_DECL bool isNull(vec const& v, T const& epsilon); 52 | 53 | //! Check whether a each component of a vector is null. 54 | /// @see gtx_vector_query extensions. 55 | template 56 | GLM_FUNC_DECL vec isCompNull(vec const& v, T const& epsilon); 57 | 58 | //! Check whether two vectors are orthonormal. 59 | /// @see gtx_vector_query extensions. 60 | template 61 | GLM_FUNC_DECL bool areOrthonormal(vec const& v0, vec const& v1, T const& epsilon); 62 | 63 | /// @} 64 | }// namespace glm 65 | 66 | #include "vector_query.inl" 67 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/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 | -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x64/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x64/SDL2.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x64/SDL2main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x64/SDL2main.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x64/SDL2test.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x64/SDL2test.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x64/SOIL.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x64/SOIL.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x64/assimp.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x64/assimp.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x64/glew32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x64/glew32.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x64/glew32s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x64/glew32s.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x86/SDL2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x86/SDL2.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x86/SDL2main.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x86/SDL2main.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x86/SDL2test.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x86/SDL2test.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x86/SOIL.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x86/SOIL.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x86/assimp.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x86/assimp.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x86/glew32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x86/glew32.lib -------------------------------------------------------------------------------- /SphericalHarmonicsLighting/lib/x86/glew32s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jan-van-bergen/SphericalHarmonicLighting/2b214b3451859ded07ea4e41fb2aa8d2a44ab579/SphericalHarmonicsLighting/lib/x86/glew32s.lib --------------------------------------------------------------------------------