├── .gitignore ├── Library ├── include │ ├── GLFW │ │ ├── glfw3.h │ │ └── glfw3native.h │ ├── KHR │ │ └── khrplatform.h │ ├── assimp │ │ ├── Compiler │ │ │ ├── poppack1.h │ │ │ ├── pstdint.h │ │ │ └── pushpack1.h │ │ ├── DefaultIOStream.h │ │ ├── DefaultIOSystem.h │ │ ├── DefaultLogger.hpp │ │ ├── Defines.h │ │ ├── Exporter.hpp │ │ ├── IOStream.hpp │ │ ├── IOSystem.hpp │ │ ├── Importer.hpp │ │ ├── LogStream.hpp │ │ ├── Logger.hpp │ │ ├── NullLogger.hpp │ │ ├── ProgressHandler.hpp │ │ ├── SceneCombiner.h │ │ ├── ai_assert.h │ │ ├── anim.h │ │ ├── camera.h │ │ ├── cexport.h │ │ ├── cfileio.h │ │ ├── cimport.h │ │ ├── color4.h │ │ ├── color4.inl │ │ ├── config.h │ │ ├── defs.h │ │ ├── importerdesc.h │ │ ├── light.h │ │ ├── material.h │ │ ├── material.inl │ │ ├── matrix3x3.h │ │ ├── matrix3x3.inl │ │ ├── matrix4x4.h │ │ ├── matrix4x4.inl │ │ ├── mesh.h │ │ ├── metadata.h │ │ ├── postprocess.h │ │ ├── quaternion.h │ │ ├── quaternion.inl │ │ ├── scene.h │ │ ├── texture.h │ │ ├── types.h │ │ ├── vector2.h │ │ ├── vector2.inl │ │ ├── vector3.h │ │ ├── vector3.inl │ │ └── version.h │ ├── glad.c │ ├── glad │ │ └── glad.h │ └── glm │ │ ├── CMakeLists.txt │ │ ├── common.hpp │ │ ├── detail │ │ ├── _features.hpp │ │ ├── _fixes.hpp │ │ ├── _noise.hpp │ │ ├── _swizzle.hpp │ │ ├── _swizzle_func.hpp │ │ ├── _vectorize.hpp │ │ ├── compute_common.hpp │ │ ├── compute_vector_relational.hpp │ │ ├── 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_half.hpp │ │ ├── type_half.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_quat.hpp │ │ ├── type_quat.inl │ │ ├── type_quat_simd.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 │ │ ├── matrix_clip_space.hpp │ │ ├── matrix_clip_space.inl │ │ ├── matrix_double2x2.hpp │ │ ├── matrix_double2x2_precision.hpp │ │ ├── matrix_double2x3.hpp │ │ ├── matrix_double2x3_precision.hpp │ │ ├── matrix_double2x4.hpp │ │ ├── matrix_double2x4_precision.hpp │ │ ├── matrix_double3x2.hpp │ │ ├── matrix_double3x2_precision.hpp │ │ ├── matrix_double3x3.hpp │ │ ├── matrix_double3x3_precision.hpp │ │ ├── matrix_double3x4.hpp │ │ ├── matrix_double3x4_precision.hpp │ │ ├── matrix_double4x2.hpp │ │ ├── matrix_double4x2_precision.hpp │ │ ├── matrix_double4x3.hpp │ │ ├── matrix_double4x3_precision.hpp │ │ ├── matrix_double4x4.hpp │ │ ├── matrix_double4x4_precision.hpp │ │ ├── matrix_float2x2.hpp │ │ ├── matrix_float2x2_precision.hpp │ │ ├── matrix_float2x3.hpp │ │ ├── matrix_float2x3_precision.hpp │ │ ├── matrix_float2x4.hpp │ │ ├── matrix_float2x4_precision.hpp │ │ ├── matrix_float3x2.hpp │ │ ├── matrix_float3x2_precision.hpp │ │ ├── matrix_float3x3.hpp │ │ ├── matrix_float3x3_precision.hpp │ │ ├── matrix_float3x4.hpp │ │ ├── matrix_float3x4_precision.hpp │ │ ├── matrix_float4x2.hpp │ │ ├── matrix_float4x2_precision.hpp │ │ ├── matrix_float4x3.hpp │ │ ├── matrix_float4x3_precision.hpp │ │ ├── matrix_float4x4.hpp │ │ ├── matrix_float4x4_precision.hpp │ │ ├── matrix_projection.hpp │ │ ├── matrix_projection.inl │ │ ├── matrix_relational.hpp │ │ ├── matrix_relational.inl │ │ ├── matrix_transform.hpp │ │ ├── matrix_transform.inl │ │ ├── quaternion_common.hpp │ │ ├── quaternion_common.inl │ │ ├── quaternion_common_simd.inl │ │ ├── quaternion_double.hpp │ │ ├── quaternion_double_precision.hpp │ │ ├── quaternion_exponential.hpp │ │ ├── quaternion_exponential.inl │ │ ├── quaternion_float.hpp │ │ ├── quaternion_float_precision.hpp │ │ ├── quaternion_geometric.hpp │ │ ├── quaternion_geometric.inl │ │ ├── quaternion_relational.hpp │ │ ├── quaternion_relational.inl │ │ ├── quaternion_transform.hpp │ │ ├── quaternion_transform.inl │ │ ├── quaternion_trigonometric.hpp │ │ ├── quaternion_trigonometric.inl │ │ ├── scalar_common.hpp │ │ ├── scalar_common.inl │ │ ├── scalar_constants.hpp │ │ ├── scalar_constants.inl │ │ ├── scalar_float_sized.hpp │ │ ├── scalar_int_sized.hpp │ │ ├── scalar_relational.hpp │ │ ├── scalar_relational.inl │ │ ├── scalar_uint_sized.hpp │ │ ├── vector_bool1.hpp │ │ ├── vector_bool1_precision.hpp │ │ ├── vector_bool2.hpp │ │ ├── vector_bool2_precision.hpp │ │ ├── vector_bool3.hpp │ │ ├── vector_bool3_precision.hpp │ │ ├── vector_bool4.hpp │ │ ├── vector_bool4_precision.hpp │ │ ├── vector_common.hpp │ │ ├── vector_common.inl │ │ ├── vector_double1.hpp │ │ ├── vector_double1_precision.hpp │ │ ├── vector_double2.hpp │ │ ├── vector_double2_precision.hpp │ │ ├── vector_double3.hpp │ │ ├── vector_double3_precision.hpp │ │ ├── vector_double4.hpp │ │ ├── vector_double4_precision.hpp │ │ ├── vector_float1.hpp │ │ ├── vector_float1_precision.hpp │ │ ├── vector_float2.hpp │ │ ├── vector_float2_precision.hpp │ │ ├── vector_float3.hpp │ │ ├── vector_float3_precision.hpp │ │ ├── vector_float4.hpp │ │ ├── vector_float4_precision.hpp │ │ ├── vector_int1.hpp │ │ ├── vector_int1_precision.hpp │ │ ├── vector_int2.hpp │ │ ├── vector_int2_precision.hpp │ │ ├── vector_int3.hpp │ │ ├── vector_int3_precision.hpp │ │ ├── vector_int4.hpp │ │ ├── vector_int4_precision.hpp │ │ ├── vector_relational.hpp │ │ ├── vector_relational.inl │ │ ├── vector_uint1.hpp │ │ ├── vector_uint1_precision.hpp │ │ ├── vector_uint2.hpp │ │ ├── vector_uint2_precision.hpp │ │ ├── vector_uint3.hpp │ │ ├── vector_uint3_precision.hpp │ │ ├── vector_uint4.hpp │ │ └── vector_uint4_precision.hpp │ │ ├── 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 │ │ ├── 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 │ ├── libIrrXML.a │ └── libglfw3.a ├── README.md ├── Work ├── LearnOpenGLES │ ├── LearnOpenGLES.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── wicky.xcuserdatad │ │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ └── LearnOpenGLES │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ ├── ViewController.h │ │ ├── ViewController.m │ │ ├── icon.png │ │ └── main.m └── OpenGL_Template │ ├── OpenGL_Template.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── wicky.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist │ └── OpenGL_Template │ ├── include │ ├── GLFW │ │ ├── glfw3.h │ │ └── glfw3native.h │ ├── KHR │ │ └── khrplatform.h │ ├── glad.c │ └── glad │ │ └── glad.h │ ├── lib │ └── libglfw3.a │ └── main.cpp ├── 光照 ├── 1.颜色.md ├── 2.基础光照.md ├── 3.材质.md ├── 4.光照贴图.md ├── 5.投光物.md ├── 6.多光源.md ├── 7.复习.md ├── Demos │ ├── 1.颜色 │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ │ ├── Camera.h │ │ │ ├── Fragment.h │ │ │ ├── LightFragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ ├── avatar.jpeg │ │ │ ├── container.jpg │ │ │ ├── main.cpp │ │ │ └── stb_image.h │ ├── 2.基础光照 │ │ ├── 2-1.环境光照 │ │ │ ├── OpenGL_Template.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ │ └── xcuserdata │ │ │ │ │ └── wicky.xcuserdatad │ │ │ │ │ └── xcschemes │ │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ └── OpenGL_Template │ │ │ │ ├── Camera.h │ │ │ │ ├── Fragment.h │ │ │ │ ├── Light.h │ │ │ │ ├── LightFragment.h │ │ │ │ ├── Shader.h │ │ │ │ ├── Vertex.h │ │ │ │ ├── avatar.jpeg │ │ │ │ ├── container.jpg │ │ │ │ ├── main.cpp │ │ │ │ └── stb_image.h │ │ ├── 2-2.漫反射光照 │ │ │ ├── OpenGL_Template.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ │ └── xcuserdata │ │ │ │ │ └── wicky.xcuserdatad │ │ │ │ │ └── xcschemes │ │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ └── OpenGL_Template │ │ │ │ ├── Camera.h │ │ │ │ ├── Fragment.h │ │ │ │ ├── Light.h │ │ │ │ ├── LightFragment.h │ │ │ │ ├── Shader.h │ │ │ │ ├── Vertex.h │ │ │ │ ├── avatar.jpeg │ │ │ │ ├── container.jpg │ │ │ │ ├── main.cpp │ │ │ │ └── stb_image.h │ │ └── 2-3.镜面反射光照 │ │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ │ └── OpenGL_Template │ │ │ ├── Camera.h │ │ │ ├── Fragment.h │ │ │ ├── Light.h │ │ │ ├── LightFragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ ├── avatar.jpeg │ │ │ ├── container.jpg │ │ │ ├── main.cpp │ │ │ └── stb_image.h │ ├── 3.材质 │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ │ ├── Camera.h │ │ │ ├── Fragment.h │ │ │ ├── Light.h │ │ │ ├── LightFragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ ├── avatar.jpeg │ │ │ ├── container.jpg │ │ │ ├── main.cpp │ │ │ └── stb_image.h │ ├── 4.光照贴图 │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ │ ├── Camera.h │ │ │ ├── Fragment.h │ │ │ ├── Light.h │ │ │ ├── LightFragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ ├── avatar.jpeg │ │ │ ├── container2.png │ │ │ ├── container2_specular.png │ │ │ ├── main.cpp │ │ │ └── stb_image.h │ ├── 5.投光物 │ │ ├── 5-1.定向光 │ │ │ ├── OpenGL_Template.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ │ └── xcuserdata │ │ │ │ │ └── wicky.xcuserdatad │ │ │ │ │ └── xcschemes │ │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ └── OpenGL_Template │ │ │ │ ├── Camera.h │ │ │ │ ├── Fragment.h │ │ │ │ ├── Light.h │ │ │ │ ├── LightFragment.h │ │ │ │ ├── Shader.h │ │ │ │ ├── Vertex.h │ │ │ │ ├── avatar.jpeg │ │ │ │ ├── container2.png │ │ │ │ ├── container2_specular.png │ │ │ │ ├── main.cpp │ │ │ │ └── stb_image.h │ │ ├── 5-2.点光源 │ │ │ ├── OpenGL_Template.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ │ └── xcuserdata │ │ │ │ │ └── wicky.xcuserdatad │ │ │ │ │ └── xcschemes │ │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ └── OpenGL_Template │ │ │ │ ├── Camera.h │ │ │ │ ├── Fragment.h │ │ │ │ ├── Light.h │ │ │ │ ├── LightFragment.h │ │ │ │ ├── Shader.h │ │ │ │ ├── Vertex.h │ │ │ │ ├── avatar.jpeg │ │ │ │ ├── container2.png │ │ │ │ ├── container2_specular.png │ │ │ │ ├── main.cpp │ │ │ │ └── stb_image.h │ │ └── 5-3.手电筒 │ │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ │ └── OpenGL_Template │ │ │ ├── Camera.h │ │ │ ├── Fragment.h │ │ │ ├── Light.h │ │ │ ├── LightFragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ ├── avatar.jpeg │ │ │ ├── container2.png │ │ │ ├── container2_specular.png │ │ │ ├── main.cpp │ │ │ └── stb_image.h │ └── 6.多光源 │ │ ├── OpenGL_Template.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── wicky.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── OpenGL_Template.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ ├── Camera.h │ │ ├── Fragment.h │ │ ├── Light.h │ │ ├── LightFragment.h │ │ ├── Shader.h │ │ ├── Vertex.h │ │ ├── avatar.jpeg │ │ ├── container2.png │ │ ├── container2_specular.png │ │ ├── main.cpp │ │ └── stb_image.h └── Pics │ ├── 手电筒.jpg │ ├── 漫反射贴图.png │ ├── 衰减公式.png │ └── 镜面光贴图.png ├── 入门 ├── 1.OpenGL.md ├── 10.复习.md ├── 2.配置环境.md ├── 3.绘制窗口.md ├── 4.绘制三角形.md ├── 5.着色器.md ├── 6.纹理.md ├── 7.变换.md ├── 8.坐标系统.md ├── 9.摄像机.md ├── Demos │ ├── 3.绘制窗口 │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ │ └── main.cpp │ ├── 4.绘制三角形 │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ │ └── main.cpp │ ├── 5.着色器 │ │ ├── 5-1.着色器(uniform) │ │ │ ├── OpenGL_Template.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ │ └── xcuserdata │ │ │ │ │ └── wicky.xcuserdatad │ │ │ │ │ └── xcschemes │ │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ └── OpenGL_Template │ │ │ │ └── main.cpp │ │ ├── 5-2.着色器(layout) │ │ │ ├── OpenGL_Template.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ │ └── xcuserdata │ │ │ │ │ └── wicky.xcuserdatad │ │ │ │ │ └── xcschemes │ │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ │ └── xcschememanagement.plist │ │ │ └── OpenGL_Template │ │ │ │ └── main.cpp │ │ └── 5-3.着色器(Shader Class) │ │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ │ └── OpenGL_Template │ │ │ ├── Fragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ └── main.cpp │ ├── 6.纹理 │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ │ ├── Fragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ ├── avatar.jpeg │ │ │ ├── container.jpg │ │ │ ├── container2.png │ │ │ ├── main.cpp │ │ │ └── stb_image.h │ ├── 7.变换 │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ │ ├── Fragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ ├── avatar.jpeg │ │ │ ├── container.jpg │ │ │ ├── main.cpp │ │ │ └── stb_image.h │ ├── 8.坐标系统 │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ │ ├── Fragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ ├── avatar.jpeg │ │ │ ├── container.jpg │ │ │ ├── main.cpp │ │ │ └── stb_image.h │ └── 9.摄像机 │ │ ├── 9-1.圆周运动 │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ │ ├── Fragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ ├── avatar.jpeg │ │ │ ├── container.jpg │ │ │ ├── main.cpp │ │ │ └── stb_image.h │ │ ├── 9-2.水平运动 │ │ ├── OpenGL_Template.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcuserdata │ │ │ │ └── wicky.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── OpenGL_Template.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ │ ├── Fragment.h │ │ │ ├── Shader.h │ │ │ ├── Vertex.h │ │ │ ├── avatar.jpeg │ │ │ ├── container.jpg │ │ │ ├── main.cpp │ │ │ └── stb_image.h │ │ └── 9-3.摄像机类 │ │ ├── OpenGL_Template.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── wicky.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── OpenGL_Template.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── OpenGL_Template │ │ ├── Camera.h │ │ ├── Fragment.h │ │ ├── Shader.h │ │ ├── Vertex.h │ │ ├── avatar.jpeg │ │ ├── container.jpg │ │ ├── main.cpp │ │ └── stb_image.h └── Pics │ ├── 8.坐标系统_Fov.png │ ├── 8.坐标系统_坐标转换_1.png │ ├── 9.计算公式.png │ ├── 仿射变换.png │ ├── 位移.png │ ├── 单位向量.png │ ├── 单位矩阵.png │ ├── 单位矩阵乘向量.png │ ├── 叉乘计算公式.png │ ├── 向量与标量运算.png │ ├── 向量加减.png │ ├── 向量的长度.png │ ├── 旋转.png │ ├── 求夹角公式.png │ ├── 点乘公式.png │ ├── 点乘计算方式.png │ ├── 环绕.png │ ├── 矩阵.png │ ├── 矩阵的加减法.png │ ├── 矩阵的数乘.png │ ├── 矩阵相乘.png │ ├── 矩阵组合.png │ └── 缩放变换.png └── 模型加载 ├── 1.Assimp.md ├── 2.网格.md └── Demos ├── 2.网格 ├── OpenGL_Template.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── wicky.xcuserdatad │ │ └── xcschemes │ │ ├── OpenGL_Template.xcscheme │ │ └── xcschememanagement.plist └── OpenGL_Template │ ├── Camera.h │ ├── Fragment.h │ ├── Light.h │ ├── LightFragment.h │ ├── Mesh.h │ ├── Shader.h │ ├── Vertex.h │ ├── avatar.jpeg │ ├── container2.png │ ├── container2_specular.png │ ├── main.cpp │ └── stb_image.h └── 3.模型 ├── OpenGL_Template.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── wicky.xcuserdatad │ └── xcschemes │ ├── OpenGL_Template.xcscheme │ └── xcschememanagement.plist └── OpenGL_Template ├── Camera.h ├── Fragment.h ├── Light.h ├── LightFragment.h ├── Mesh.h ├── Model.h ├── Shader.h ├── Vertex.h ├── avatar.jpeg ├── container2.png ├── container2_specular.png ├── main.cpp └── stb_image.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.xcuserstate -------------------------------------------------------------------------------- /Library/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 | -------------------------------------------------------------------------------- /Library/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 | -------------------------------------------------------------------------------- /Library/include/glm/detail/_fixes.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //! Workaround for compatibility with other libraries 4 | #ifdef max 5 | #undef max 6 | #endif 7 | 8 | //! Workaround for compatibility with other libraries 9 | #ifdef min 10 | #undef min 11 | #endif 12 | 13 | //! Workaround for Android 14 | #ifdef isnan 15 | #undef isnan 16 | #endif 17 | 18 | //! Workaround for Android 19 | #ifdef isinf 20 | #undef isinf 21 | #endif 22 | 23 | //! Workaround for Chrone Native Client 24 | #ifdef log2 25 | #undef log2 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /Library/include/glm/detail/compute_common.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "setup.hpp" 4 | #include 5 | 6 | namespace glm{ 7 | namespace detail 8 | { 9 | template 10 | struct compute_abs 11 | {}; 12 | 13 | template 14 | struct compute_abs 15 | { 16 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x) 17 | { 18 | GLM_STATIC_ASSERT( 19 | std::numeric_limits::is_iec559 || std::numeric_limits::is_signed, 20 | "'abs' only accept floating-point and integer scalar or vector inputs"); 21 | 22 | return x >= genFIType(0) ? x : -x; 23 | // TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff; 24 | } 25 | }; 26 | 27 | #if GLM_COMPILER & GLM_COMPILER_CUDA 28 | template<> 29 | struct compute_abs 30 | { 31 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static float call(float x) 32 | { 33 | return fabsf(x); 34 | } 35 | }; 36 | #endif 37 | 38 | template 39 | struct compute_abs 40 | { 41 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static genFIType call(genFIType x) 42 | { 43 | GLM_STATIC_ASSERT( 44 | (!std::numeric_limits::is_signed && std::numeric_limits::is_integer), 45 | "'abs' only accept floating-point and integer scalar or vector inputs"); 46 | return x; 47 | } 48 | }; 49 | }//namespace detail 50 | }//namespace glm 51 | -------------------------------------------------------------------------------- /Library/include/glm/detail/compute_vector_relational.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //#include "compute_common.hpp" 4 | #include "setup.hpp" 5 | #include 6 | 7 | namespace glm{ 8 | namespace detail 9 | { 10 | template 11 | struct compute_equal 12 | { 13 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR 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 GLM_CONSTEXPR static bool call(T a, T b) 23 | { 24 | return detail::compute_abs::is_signed>::call(b - a) <= static_cast(0); 25 | //return std::memcmp(&a, &b, sizeof(T)) == 0; 26 | } 27 | }; 28 | */ 29 | }//namespace detail 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /Library/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 | # if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE 23 | template<> 24 | struct compute_sqrt<4, float, aligned_lowp, true> 25 | { 26 | GLM_FUNC_QUALIFIER static vec<4, float, aligned_lowp> call(vec<4, float, aligned_lowp> const& v) 27 | { 28 | vec<4, float, aligned_lowp> Result; 29 | Result.data = glm_vec4_sqrt_lowp(v.data); 30 | return Result; 31 | } 32 | }; 33 | # endif 34 | }//namespace detail 35 | }//namespace glm 36 | 37 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 38 | -------------------------------------------------------------------------------- /Library/include/glm/detail/func_packing_simd.inl: -------------------------------------------------------------------------------- 1 | namespace glm{ 2 | namespace detail 3 | { 4 | 5 | }//namespace detail 6 | }//namespace glm 7 | -------------------------------------------------------------------------------- /Library/include/glm/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/Library/include/glm/detail/func_trigonometric_simd.inl -------------------------------------------------------------------------------- /Library/include/glm/detail/func_vector_relational_simd.inl: -------------------------------------------------------------------------------- 1 | namespace glm{ 2 | namespace detail 3 | { 4 | 5 | }//namespace detail 6 | }//namespace glm 7 | -------------------------------------------------------------------------------- /Library/include/glm/detail/type_half.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "setup.hpp" 4 | 5 | namespace glm{ 6 | namespace detail 7 | { 8 | typedef short hdata; 9 | 10 | GLM_FUNC_DECL float toFloat32(hdata value); 11 | GLM_FUNC_DECL hdata toFloat16(float const& value); 12 | 13 | }//namespace detail 14 | }//namespace glm 15 | 16 | #include "type_half.inl" 17 | -------------------------------------------------------------------------------- /Library/include/glm/detail/type_mat4x4_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | 3 | namespace glm 4 | { 5 | 6 | }//namespace glm 7 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_double2x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double2x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 2 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 2, double, defaultp> dmat2x2; 16 | 17 | /// 2 columns of 2 components matrix of double-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<2, 2, double, defaultp> dmat2; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_double2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double2x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 3 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 3, double, defaultp> dmat2x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_double2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double2x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 4 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 4, double, defaultp> dmat2x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_double3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double3x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 2 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 2, double, defaultp> dmat3x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_double3x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double3x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 3 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 3, double, defaultp> dmat3x3; 16 | 17 | /// 3 columns of 3 components matrix of double-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<3, 3, double, defaultp> dmat3; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_double3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double3x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 4 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 4, double, defaultp> dmat3x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_double4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double4x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 2 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 2, double, defaultp> dmat4x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_double4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double4x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 3 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 3, double, defaultp> dmat4x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_double4x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_double4x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 4 components matrix of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 4, double, defaultp> dmat4x4; 16 | 17 | /// 4 columns of 4 components matrix of double-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<4, 4, double, defaultp> dmat4; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_float2x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float2x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 2 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 2, float, defaultp> mat2x2; 16 | 17 | /// 2 columns of 2 components matrix of single-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<2, 2, float, defaultp> mat2; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_float2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float2x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 3 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 3, float, defaultp> mat2x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_float2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float2x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat2x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 2 columns of 4 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<2, 4, float, defaultp> mat2x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_float3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float3x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core 10 | /// @{ 11 | 12 | /// 3 columns of 2 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 2, float, defaultp> mat3x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_float3x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float3x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 3 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 3, float, defaultp> mat3x3; 16 | 17 | /// 3 columns of 3 components matrix of single-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<3, 3, float, defaultp> mat3; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_float3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float3x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat3x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 3 columns of 4 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<3, 4, float, defaultp> mat3x4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_float4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float4x2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 2 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 2, float, defaultp> mat4x2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_float4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float4x3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 3 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 3, float, defaultp> mat4x3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/matrix_float4x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/matrix_float4x4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_mat4x4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @ingroup core_matrix 10 | /// @{ 11 | 12 | /// 4 columns of 4 components matrix of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 15 | typedef mat<4, 4, float, defaultp> mat4x4; 16 | 17 | /// 4 columns of 4 components matrix of single-precision floating-point numbers. 18 | /// 19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices 20 | typedef mat<4, 4, float, defaultp> mat4; 21 | 22 | /// @} 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /Library/include/glm/ext/quaternion_common_simd.inl: -------------------------------------------------------------------------------- 1 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 2 | 3 | namespace glm{ 4 | namespace detail 5 | { 6 | template 7 | struct compute_dot, float, true> 8 | { 9 | static GLM_FUNC_QUALIFIER float call(qua const& x, qua const& y) 10 | { 11 | return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data)); 12 | } 13 | }; 14 | }//namespace detail 15 | }//namespace glm 16 | 17 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 18 | 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/quaternion_double.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_double 2 | /// @file glm/ext/quaternion_double.hpp 3 | /// 4 | /// @defgroup ext_quaternion_double GLM_EXT_quaternion_double 5 | /// @ingroup ext 6 | /// 7 | /// Exposes double-precision floating point quaternion type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_quaternion_float 12 | /// @see ext_quaternion_double_precision 13 | /// @see ext_quaternion_common 14 | /// @see ext_quaternion_exponential 15 | /// @see ext_quaternion_geometric 16 | /// @see ext_quaternion_relational 17 | /// @see ext_quaternion_transform 18 | /// @see ext_quaternion_trigonometric 19 | 20 | #pragma once 21 | 22 | // Dependency: 23 | #include "../detail/type_quat.hpp" 24 | 25 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_EXT_quaternion_double extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup ext_quaternion_double 32 | /// @{ 33 | 34 | /// Quaternion of double-precision floating-point numbers. 35 | typedef qua dquat; 36 | 37 | /// @} 38 | } //namespace glm 39 | 40 | -------------------------------------------------------------------------------- /Library/include/glm/ext/quaternion_double_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_double_precision 2 | /// @file glm/ext/quaternion_double_precision.hpp 3 | /// 4 | /// @defgroup ext_quaternion_double_precision GLM_EXT_quaternion_double_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes double-precision floating point quaternion type with various precision in term of ULPs. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | // Dependency: 14 | #include "../detail/type_quat.hpp" 15 | 16 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 17 | # pragma message("GLM: GLM_EXT_quaternion_double_precision extension included") 18 | #endif 19 | 20 | namespace glm 21 | { 22 | /// @addtogroup ext_quaternion_double_precision 23 | /// @{ 24 | 25 | /// Quaternion of double-precision floating-point numbers using high precision arithmetic in term of ULPs. 26 | /// 27 | /// @see ext_quaternion_double_precision 28 | typedef qua lowp_dquat; 29 | 30 | /// Quaternion of medium double-qualifier floating-point numbers using high precision arithmetic in term of ULPs. 31 | /// 32 | /// @see ext_quaternion_double_precision 33 | typedef qua mediump_dquat; 34 | 35 | /// Quaternion of high double-qualifier floating-point numbers using high precision arithmetic in term of ULPs. 36 | /// 37 | /// @see ext_quaternion_double_precision 38 | typedef qua highp_dquat; 39 | 40 | /// @} 41 | } //namespace glm 42 | 43 | -------------------------------------------------------------------------------- /Library/include/glm/ext/quaternion_float.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_float 2 | /// @file glm/ext/quaternion_float.hpp 3 | /// 4 | /// @defgroup ext_quaternion_float GLM_EXT_quaternion_float 5 | /// @ingroup ext 6 | /// 7 | /// Exposes single-precision floating point quaternion type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_quaternion_double 12 | /// @see ext_quaternion_float_precision 13 | /// @see ext_quaternion_common 14 | /// @see ext_quaternion_exponential 15 | /// @see ext_quaternion_geometric 16 | /// @see ext_quaternion_relational 17 | /// @see ext_quaternion_transform 18 | /// @see ext_quaternion_trigonometric 19 | 20 | #pragma once 21 | 22 | // Dependency: 23 | #include "../detail/type_quat.hpp" 24 | 25 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 26 | # pragma message("GLM: GLM_EXT_quaternion_float extension included") 27 | #endif 28 | 29 | namespace glm 30 | { 31 | /// @addtogroup ext_quaternion_float 32 | /// @{ 33 | 34 | /// Quaternion of single-precision floating-point numbers. 35 | typedef qua quat; 36 | 37 | /// @} 38 | } //namespace glm 39 | 40 | -------------------------------------------------------------------------------- /Library/include/glm/ext/quaternion_float_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_quaternion_float_precision 2 | /// @file glm/ext/quaternion_float_precision.hpp 3 | /// 4 | /// @defgroup ext_quaternion_float_precision GLM_EXT_quaternion_float_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes single-precision floating point quaternion type with various precision in term of ULPs. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | // Dependency: 14 | #include "../detail/type_quat.hpp" 15 | 16 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 17 | # pragma message("GLM: GLM_EXT_quaternion_float_precision extension included") 18 | #endif 19 | 20 | namespace glm 21 | { 22 | /// @addtogroup ext_quaternion_float_precision 23 | /// @{ 24 | 25 | /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 26 | typedef qua lowp_quat; 27 | 28 | /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 29 | typedef qua mediump_quat; 30 | 31 | /// Quaternion of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 32 | typedef qua highp_quat; 33 | 34 | /// @} 35 | } //namespace glm 36 | 37 | -------------------------------------------------------------------------------- /Library/include/glm/ext/quaternion_geometric.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER T dot(qua const& x, qua const& y) 5 | { 6 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'dot' accepts only floating-point inputs"); 7 | return detail::compute_dot, T, detail::is_aligned::value>::call(x, y); 8 | } 9 | 10 | template 11 | GLM_FUNC_QUALIFIER T length(qua const& q) 12 | { 13 | return glm::sqrt(dot(q, q)); 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER qua normalize(qua const& q) 18 | { 19 | T len = length(q); 20 | if(len <= static_cast(0)) // Problem 21 | return qua(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); 22 | T oneOverLen = static_cast(1) / len; 23 | return qua(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen); 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER qua cross(qua const& q1, qua const& q2) 28 | { 29 | return qua( 30 | q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z, 31 | q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y, 32 | q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z, 33 | q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x); 34 | } 35 | }//namespace glm 36 | 37 | -------------------------------------------------------------------------------- /Library/include/glm/ext/quaternion_relational.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(qua const& x, qua const& y) 5 | { 6 | vec<4, bool, Q> Result; 7 | for(length_t i = 0; i < x.length(); ++i) 8 | Result[i] = x[i] == y[i]; 9 | return Result; 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(qua const& x, qua const& y, T epsilon) 14 | { 15 | vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w); 16 | return lessThan(abs(v), vec<4, T, Q>(epsilon)); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(qua const& x, qua const& y) 21 | { 22 | vec<4, bool, Q> Result; 23 | for(length_t i = 0; i < x.length(); ++i) 24 | Result[i] = x[i] != y[i]; 25 | return Result; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(qua const& x, qua const& y, T epsilon) 30 | { 31 | vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w); 32 | return greaterThanEqual(abs(v), vec<4, T, Q>(epsilon)); 33 | } 34 | }//namespace glm 35 | 36 | -------------------------------------------------------------------------------- /Library/include/glm/ext/quaternion_transform.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER qua rotate(qua const& q, T const& angle, vec<3, T, Q> const& v) 5 | { 6 | vec<3, T, Q> Tmp = v; 7 | 8 | // Axis of rotation must be normalised 9 | T len = glm::length(Tmp); 10 | if(abs(len - static_cast(1)) > static_cast(0.001)) 11 | { 12 | T oneOverLen = static_cast(1) / len; 13 | Tmp.x *= oneOverLen; 14 | Tmp.y *= oneOverLen; 15 | Tmp.z *= oneOverLen; 16 | } 17 | 18 | T const AngleRad(angle); 19 | T const Sin = sin(AngleRad * static_cast(0.5)); 20 | 21 | return q * qua(cos(AngleRad * static_cast(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin); 22 | } 23 | }//namespace glm 24 | 25 | -------------------------------------------------------------------------------- /Library/include/glm/ext/quaternion_trigonometric.inl: -------------------------------------------------------------------------------- 1 | namespace glm 2 | { 3 | template 4 | GLM_FUNC_QUALIFIER T angle(qua const& x) 5 | { 6 | return acos(x.w) * static_cast(2); 7 | } 8 | 9 | template 10 | GLM_FUNC_QUALIFIER vec<3, T, Q> axis(qua const& x) 11 | { 12 | T const tmp1 = static_cast(1) - x.w * x.w; 13 | if(tmp1 <= static_cast(0)) 14 | return vec<3, T, Q>(0, 0, 1); 15 | T const tmp2 = static_cast(1) / sqrt(tmp1); 16 | return vec<3, T, Q>(x.x * tmp2, x.y * tmp2, x.z * tmp2); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER qua angleAxis(T const& angle, vec<3, T, Q> const& v) 21 | { 22 | T const a(angle); 23 | T const s = glm::sin(a * static_cast(0.5)); 24 | 25 | return qua(glm::cos(a * static_cast(0.5)), v * s); 26 | } 27 | }//namespace glm 28 | -------------------------------------------------------------------------------- /Library/include/glm/ext/scalar_constants.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_scalar_constants 2 | /// @file glm/ext/scalar_constants.hpp 3 | /// 4 | /// @defgroup ext_scalar_constants GLM_EXT_scalar_constants 5 | /// @ingroup ext 6 | /// 7 | /// Provides a list of constants and precomputed useful values. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | // Dependencies 14 | #include "../detail/setup.hpp" 15 | 16 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 17 | # pragma message("GLM: GLM_EXT_scalar_constants extension included") 18 | #endif 19 | 20 | namespace glm 21 | { 22 | /// @addtogroup ext_scalar_constants 23 | /// @{ 24 | 25 | /// Return the epsilon constant for floating point types. 26 | template 27 | GLM_FUNC_DECL GLM_CONSTEXPR genType epsilon(); 28 | 29 | /// Return the pi constant for floating point types. 30 | template 31 | GLM_FUNC_DECL GLM_CONSTEXPR genType pi(); 32 | 33 | /// @} 34 | } //namespace glm 35 | 36 | #include "scalar_constants.inl" 37 | -------------------------------------------------------------------------------- /Library/include/glm/ext/scalar_constants.inl: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon() 7 | { 8 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'epsilon' only accepts floating-point inputs"); 9 | return std::numeric_limits::epsilon(); 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi() 14 | { 15 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'epsilon' only accepts floating-point inputs"); 16 | return static_cast(3.14159265358979323846264338327950288); 17 | } 18 | } //namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/scalar_float_sized.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_scalar_float_sized 2 | /// @file glm/ext/scalar_float_sized.hpp 3 | /// 4 | /// @defgroup ext_scalar_float_sized GLM_EXT_scalar_float_sized 5 | /// @ingroup ext 6 | /// 7 | /// Exposes sized float scalar types. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_scalar_int_sized 12 | /// @see ext_scalar_uint_sized 13 | 14 | #pragma once 15 | 16 | #include "../detail/setup.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_scalar_float_sized extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_scalar_float_sized 25 | /// @{ 26 | 27 | /// Single precision floating-point numbers. 28 | typedef float float32; 29 | 30 | 31 | # ifndef GLM_FORCE_SINGLE_ONLY 32 | 33 | /// Double precision floating-point numbers. 34 | typedef double float64; 35 | 36 | # endif//GLM_FORCE_SINGLE_ONLY 37 | 38 | /// @} 39 | }//namespace glm 40 | -------------------------------------------------------------------------------- /Library/include/glm/ext/scalar_relational.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_scalar_relational 2 | /// @file glm/ext/scalar_relational.hpp 3 | /// 4 | /// @defgroup ext_scalar_relational GLM_EXT_scalar_relational 5 | /// @ingroup ext 6 | /// 7 | /// Exposes comparison functions for scalar types that take a user defined epsilon values. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see core_vector_relational 12 | /// @see ext_vector_relational 13 | /// @see ext_matrix_relational 14 | 15 | #pragma once 16 | 17 | // Dependencies 18 | #include "../detail/qualifier.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_EXT_scalar_relational extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// Returns the component-wise comparison of |x - y| < epsilon. 27 | /// True if this expression is satisfied. 28 | /// 29 | /// @tparam genType Floating-point or integer scalar types 30 | template 31 | GLM_FUNC_DECL GLM_CONSTEXPR bool equal(genType const& x, genType const& y, genType const& epsilon); 32 | 33 | /// Returns the component-wise comparison of |x - y| >= epsilon. 34 | /// True if this expression is not satisfied. 35 | /// 36 | /// @tparam genType Floating-point or integer scalar types 37 | template 38 | GLM_FUNC_DECL GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, genType const& epsilon); 39 | 40 | /// @} 41 | }//namespace glm 42 | 43 | #include "scalar_relational.inl" 44 | -------------------------------------------------------------------------------- /Library/include/glm/ext/scalar_relational.inl: -------------------------------------------------------------------------------- 1 | #include "../common.hpp" 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool equal(genType const& x, genType const& y, genType const& epsilon) 7 | { 8 | return abs(x - y) <= epsilon; 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR bool notEqual(genType const& x, genType const& y, genType const& epsilon) 13 | { 14 | return abs(x - y) > epsilon; 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_bool1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_bool1 2 | /// @file glm/ext/vector_bool1.hpp 3 | /// 4 | /// @defgroup ext_vector_bool1 GLM_EXT_vector_bool1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes bvec1 vector type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_bool1_precision extension. 12 | 13 | #pragma once 14 | 15 | #include "../detail/type_vec1.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_EXT_vector_bool1 extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup ext_vector_bool1 24 | /// @{ 25 | 26 | /// 1 components vector of boolean. 27 | typedef vec<1, bool, defaultp> bvec1; 28 | 29 | /// @} 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_bool1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_bool1_precision 2 | /// @file glm/ext/vector_bool1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_bool1_precision GLM_EXT_vector_bool1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_bvec1, mediump_bvec1 and lowp_bvec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | #include "../detail/type_vec1.hpp" 14 | 15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 16 | # pragma message("GLM: GLM_EXT_vector_bool1_precision extension included") 17 | #endif 18 | 19 | namespace glm 20 | { 21 | /// @addtogroup ext_vector_bool1_precision 22 | /// @{ 23 | 24 | /// 1 component vector of bool values. 25 | typedef vec<1, bool, highp> highp_bvec1; 26 | 27 | /// 1 component vector of bool values. 28 | typedef vec<1, bool, mediump> mediump_bvec1; 29 | 30 | /// 1 component vector of bool values. 31 | typedef vec<1, bool, lowp> lowp_bvec1; 32 | 33 | /// @} 34 | }//namespace glm 35 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_bool2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of boolean. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, bool, defaultp> bvec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_bool2_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool2_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 2 components vector of high qualifier bool numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<2, bool, highp> highp_bvec2; 17 | 18 | /// 2 components vector of medium qualifier bool numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<2, bool, mediump> mediump_bvec2; 23 | 24 | /// 2 components vector of low qualifier bool numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<2, bool, lowp> lowp_bvec2; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_bool3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of boolean. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, bool, defaultp> bvec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_bool3_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool3_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 3 components vector of high qualifier bool numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<3, bool, highp> highp_bvec3; 17 | 18 | /// 3 components vector of medium qualifier bool numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<3, bool, mediump> mediump_bvec3; 23 | 24 | /// 3 components vector of low qualifier bool numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<3, bool, lowp> lowp_bvec3; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_bool4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of boolean. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, bool, defaultp> bvec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_bool4_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_bool4_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 4 components vector of high qualifier bool numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<4, bool, highp> highp_bvec4; 17 | 18 | /// 4 components vector of medium qualifier bool numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<4, bool, mediump> mediump_bvec4; 23 | 24 | /// 4 components vector of low qualifier bool numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<4, bool, lowp> lowp_bvec4; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_double1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_double1 2 | /// @file glm/ext/vector_double1.hpp 3 | /// 4 | /// @defgroup ext_vector_double1 GLM_EXT_vector_double1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes double-precision floating point vector type with one component. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_double1_precision extension. 12 | /// @see ext_vector_float1 extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_dvec1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_double1 25 | /// @{ 26 | 27 | /// 1 components vector of double-precision floating-point numbers. 28 | typedef vec<1, double, defaultp> dvec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_double1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_double1_precision 2 | /// @file glm/ext/vector_double1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_double1_precision GLM_EXT_vector_double1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_dvec1, mediump_dvec1 and lowp_dvec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_double1 12 | 13 | #pragma once 14 | 15 | #include "../detail/type_vec1.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_EXT_vector_double1_precision extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup ext_vector_double1_precision 24 | /// @{ 25 | 26 | /// 1 component vector of double-precision floating-point numbers using high precision arithmetic in term of ULPs. 27 | typedef vec<1, double, highp> highp_dvec1; 28 | 29 | /// 1 component vector of double-precision floating-point numbers using medium precision arithmetic in term of ULPs. 30 | typedef vec<1, double, mediump> mediump_dvec1; 31 | 32 | /// 1 component vector of double-precision floating-point numbers using low precision arithmetic in term of ULPs. 33 | typedef vec<1, double, lowp> lowp_dvec1; 34 | 35 | /// @} 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_double2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_double2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, double, defaultp> dvec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_double3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_double3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, double, defaultp> dvec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_double4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_double4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of double-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, double, defaultp> dvec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_float1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_float1 2 | /// @file glm/ext/vector_float1.hpp 3 | /// 4 | /// @defgroup ext_vector_float1 GLM_EXT_vector_float1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes single-precision floating point vector type with one component. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_float1_precision extension. 12 | /// @see ext_vector_double1 extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_float1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_float1 25 | /// @{ 26 | 27 | /// 1 components vector of single-precision floating-point numbers. 28 | typedef vec<1, float, defaultp> vec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_float1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_float1_precision 2 | /// @file glm/ext/vector_float1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_float1_precision GLM_EXT_vector_float1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_vec1, mediump_vec1 and lowp_vec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_float1 extension. 12 | 13 | #pragma once 14 | 15 | #include "../detail/type_vec1.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_EXT_vector_float1_precision extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup ext_vector_float1_precision 24 | /// @{ 25 | 26 | /// 1 component vector of single-precision floating-point numbers using high precision arithmetic in term of ULPs. 27 | typedef vec<1, float, highp> highp_vec1; 28 | 29 | /// 1 component vector of single-precision floating-point numbers using medium precision arithmetic in term of ULPs. 30 | typedef vec<1, float, mediump> mediump_vec1; 31 | 32 | /// 1 component vector of single-precision floating-point numbers using low precision arithmetic in term of ULPs. 33 | typedef vec<1, float, lowp> lowp_vec1; 34 | 35 | /// @} 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_float2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, float, defaultp> vec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_float2_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float2_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 2 components vector of high single-qualifier floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<2, float, highp> highp_vec2; 17 | 18 | /// 2 components vector of medium single-qualifier floating-point numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<2, float, mediump> mediump_vec2; 23 | 24 | /// 2 components vector of low single-qualifier floating-point numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<2, float, lowp> lowp_vec2; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_float3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, float, defaultp> vec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_float3_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float3_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 3 components vector of high single-qualifier floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<3, float, highp> highp_vec3; 17 | 18 | /// 3 components vector of medium single-qualifier floating-point numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<3, float, mediump> mediump_vec3; 23 | 24 | /// 3 components vector of low single-qualifier floating-point numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<3, float, lowp> lowp_vec3; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_float4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of single-precision floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, float, defaultp> vec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_float4_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_float4_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 4 components vector of high single-qualifier floating-point numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<4, float, highp> highp_vec4; 17 | 18 | /// 4 components vector of medium single-qualifier floating-point numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<4, float, mediump> mediump_vec4; 23 | 24 | /// 4 components vector of low single-qualifier floating-point numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<4, float, lowp> lowp_vec4; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_int1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_int1 2 | /// @file glm/ext/vector_int1.hpp 3 | /// 4 | /// @defgroup ext_vector_int1 GLM_EXT_vector_int1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes ivec1 vector type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_uint1 extension. 12 | /// @see ext_vector_int1_precision extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_int1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_int1 25 | /// @{ 26 | 27 | /// 1 component vector of signed integer numbers. 28 | typedef vec<1, int, defaultp> ivec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | 33 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_int1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_int1_precision 2 | /// @file glm/ext/vector_int1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_int1_precision GLM_EXT_vector_int1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_ivec1, mediump_ivec1 and lowp_ivec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | #include "../detail/type_vec1.hpp" 14 | 15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 16 | # pragma message("GLM: GLM_EXT_vector_int1_precision extension included") 17 | #endif 18 | 19 | namespace glm 20 | { 21 | /// @addtogroup ext_vector_int1_precision 22 | /// @{ 23 | 24 | /// 1 component vector of signed integer values. 25 | typedef vec<1, int, highp> highp_ivec1; 26 | 27 | /// 1 component vector of signed integer values. 28 | typedef vec<1, int, mediump> mediump_ivec1; 29 | 30 | /// 1 component vector of signed integer values. 31 | typedef vec<1, int, lowp> lowp_ivec1; 32 | 33 | /// @} 34 | }//namespace glm 35 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_int2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, int, defaultp> ivec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_int2_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int2_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 2 components vector of high qualifier signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<2, int, highp> highp_ivec2; 17 | 18 | /// 2 components vector of medium qualifier signed integer numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<2, int, mediump> mediump_ivec2; 23 | 24 | /// 2 components vector of low qualifier signed integer numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<2, int, lowp> lowp_ivec2; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_int3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, int, defaultp> ivec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_int3_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int3_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 3 components vector of high qualifier signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<3, int, highp> highp_ivec3; 17 | 18 | /// 3 components vector of medium qualifier signed integer numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<3, int, mediump> mediump_ivec3; 23 | 24 | /// 3 components vector of low qualifier signed integer numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<3, int, lowp> lowp_ivec3; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_int4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, int, defaultp> ivec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_int4_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_int4_precision.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector_precision 10 | /// @{ 11 | 12 | /// 4 components vector of high qualifier signed integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 16 | typedef vec<4, int, highp> highp_ivec4; 17 | 18 | /// 4 components vector of medium qualifier signed integer numbers. 19 | /// 20 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 21 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 22 | typedef vec<4, int, mediump> mediump_ivec4; 23 | 24 | /// 4 components vector of low qualifier signed integer numbers. 25 | /// 26 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 27 | /// @see GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier 28 | typedef vec<4, int, lowp> lowp_ivec4; 29 | 30 | /// @} 31 | }//namespace glm 32 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_relational.inl: -------------------------------------------------------------------------------- 1 | #include "../vector_relational.hpp" 2 | #include "../common.hpp" 3 | #include "../detail/qualifier.hpp" 4 | 5 | namespace glm 6 | { 7 | template 8 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec equal(vec const& x, vec const& y, T Epsilon) 9 | { 10 | return equal(x, y, vec(Epsilon)); 11 | } 12 | 13 | template 14 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec equal(vec const& x, vec const& y, vec const& Epsilon) 15 | { 16 | return lessThanEqual(abs(x - y), Epsilon); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y, T Epsilon) 21 | { 22 | return notEqual(x, y, vec(Epsilon)); 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec notEqual(vec const& x, vec const& y, vec const& Epsilon) 27 | { 28 | return greaterThan(abs(x - y), Epsilon); 29 | } 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_uint1.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_uint1 2 | /// @file glm/ext/vector_uint1.hpp 3 | /// 4 | /// @defgroup ext_vector_uint1 GLM_EXT_vector_uint1 5 | /// @ingroup ext 6 | /// 7 | /// Exposes uvec1 vector type. 8 | /// 9 | /// Include to use the features of this extension. 10 | /// 11 | /// @see ext_vector_int1 extension. 12 | /// @see ext_vector_uint1_precision extension. 13 | 14 | #pragma once 15 | 16 | #include "../detail/type_vec1.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_EXT_vector_uint1 extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup ext_vector_uint1 25 | /// @{ 26 | 27 | /// 1 component vector of unsigned integer numbers. 28 | typedef vec<1, unsigned int, defaultp> uvec1; 29 | 30 | /// @} 31 | }//namespace glm 32 | 33 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_uint1_precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref ext_vector_uint1_precision 2 | /// @file glm/ext/vector_uint1_precision.hpp 3 | /// 4 | /// @defgroup ext_vector_uint1_precision GLM_EXT_vector_uint1_precision 5 | /// @ingroup ext 6 | /// 7 | /// Exposes highp_uvec1, mediump_uvec1 and lowp_uvec1 types. 8 | /// 9 | /// Include to use the features of this extension. 10 | 11 | #pragma once 12 | 13 | #include "../detail/type_vec1.hpp" 14 | 15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 16 | # pragma message("GLM: GLM_EXT_vector_uint1_precision extension included") 17 | #endif 18 | 19 | namespace glm 20 | { 21 | /// @addtogroup ext_vector_uint1_precision 22 | /// @{ 23 | 24 | /// 1 component vector of unsigned integer values. 25 | /// 26 | /// @see ext_vector_uint1_precision 27 | typedef vec<1, unsigned int, highp> highp_uvec1; 28 | 29 | /// 1 component vector of unsigned integer values. 30 | /// 31 | /// @see ext_vector_uint1_precision 32 | typedef vec<1, unsigned int, mediump> mediump_uvec1; 33 | 34 | /// 1 component vector of unsigned integer values. 35 | /// 36 | /// @see ext_vector_uint1_precision 37 | typedef vec<1, unsigned int, lowp> lowp_uvec1; 38 | 39 | /// @} 40 | }//namespace glm 41 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_uint2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint2.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec2.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 2 components vector of unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<2, unsigned int, defaultp> uvec2; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_uint3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint3.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec3.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 3 components vector of unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<3, unsigned int, defaultp> uvec3; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/ext/vector_uint4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/ext/vector_uint4.hpp 3 | 4 | #pragma once 5 | #include "../detail/type_vec4.hpp" 6 | 7 | namespace glm 8 | { 9 | /// @addtogroup core_vector 10 | /// @{ 11 | 12 | /// 4 components vector of unsigned integer numbers. 13 | /// 14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors 15 | typedef vec<4, unsigned int, defaultp> uvec4; 16 | 17 | /// @} 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /Library/include/glm/gtc/matrix_access.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType row 7 | ( 8 | genType const& m, 9 | length_t index, 10 | typename genType::row_type const& x 11 | ) 12 | { 13 | assert(index >= 0 && index < m[0].length()); 14 | 15 | genType Result = m; 16 | for(length_t i = 0; i < m.length(); ++i) 17 | Result[i][index] = x[i]; 18 | return Result; 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER typename genType::row_type row 23 | ( 24 | genType const& m, 25 | length_t index 26 | ) 27 | { 28 | assert(index >= 0 && index < m[0].length()); 29 | 30 | typename genType::row_type Result(0); 31 | for(length_t i = 0; i < m.length(); ++i) 32 | Result[i] = m[i][index]; 33 | return Result; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER genType column 38 | ( 39 | genType const& m, 40 | length_t index, 41 | typename genType::col_type const& x 42 | ) 43 | { 44 | assert(index >= 0 && index < m.length()); 45 | 46 | genType Result = m; 47 | Result[index] = x; 48 | return Result; 49 | } 50 | 51 | template 52 | GLM_FUNC_QUALIFIER typename genType::col_type column 53 | ( 54 | genType const& m, 55 | length_t index 56 | ) 57 | { 58 | assert(index >= 0 && index < m.length()); 59 | 60 | return m[index]; 61 | } 62 | }//namespace glm 63 | -------------------------------------------------------------------------------- /Library/include/glm/gtc/matrix_transform.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_transform 2 | /// @file glm/gtc/matrix_transform.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_transform 6 | /// @see gtx_transform2 7 | /// 8 | /// @defgroup gtc_matrix_transform GLM_GTC_matrix_transform 9 | /// @ingroup gtc 10 | /// 11 | /// Include to use the features of this extension. 12 | /// 13 | /// Defines functions that generate common transformation matrices. 14 | /// 15 | /// The matrices generated by this extension use standard OpenGL fixed-function 16 | /// conventions. For example, the lookAt function generates a transform from world 17 | /// space into the specific eye space that the projective matrix functions 18 | /// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility 19 | /// specifications defines the particular layout of this eye space. 20 | 21 | #pragma once 22 | 23 | // Dependencies 24 | #include "../mat4x4.hpp" 25 | #include "../vec2.hpp" 26 | #include "../vec3.hpp" 27 | #include "../vec4.hpp" 28 | #include "../ext/matrix_projection.hpp" 29 | #include "../ext/matrix_clip_space.hpp" 30 | #include "../ext/matrix_transform.hpp" 31 | 32 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 33 | # pragma message("GLM: GLM_GTC_matrix_transform extension included") 34 | #endif 35 | 36 | #include "matrix_transform.inl" 37 | -------------------------------------------------------------------------------- /Library/include/glm/gtc/matrix_transform.inl: -------------------------------------------------------------------------------- 1 | #include "../geometric.hpp" 2 | #include "../trigonometric.hpp" 3 | #include "../matrix.hpp" 4 | -------------------------------------------------------------------------------- /Library/include/glm/gtc/quaternion_simd.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/Library/include/glm/gtc/quaternion_simd.inl -------------------------------------------------------------------------------- /Library/include/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_precision 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Library/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/vector_bool1.hpp" 17 | #include "../ext/vector_bool1_precision.hpp" 18 | #include "../ext/vector_float1.hpp" 19 | #include "../ext/vector_float1_precision.hpp" 20 | #include "../ext/vector_double1.hpp" 21 | #include "../ext/vector_double1_precision.hpp" 22 | #include "../ext/vector_int1.hpp" 23 | #include "../ext/vector_int1_precision.hpp" 24 | #include "../ext/vector_uint1.hpp" 25 | #include "../ext/vector_uint1_precision.hpp" 26 | 27 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) 28 | # pragma message("GLM: GLM_GTC_vec1 extension included") 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER vec<3, T, Q> closestPointOnLine 7 | ( 8 | vec<3, T, Q> const& point, 9 | vec<3, T, Q> const& a, 10 | vec<3, T, Q> const& b 11 | ) 12 | { 13 | T LineLength = distance(a, b); 14 | vec<3, T, Q> Vector = point - a; 15 | vec<3, T, Q> LineDirection = (b - a) / LineLength; 16 | 17 | // Project Vector to LineDirection to get the distance of point from a 18 | T Distance = dot(Vector, LineDirection); 19 | 20 | if(Distance <= T(0)) return a; 21 | if(Distance >= LineLength) return b; 22 | return a + LineDirection * Distance; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER vec<2, T, Q> closestPointOnLine 27 | ( 28 | vec<2, T, Q> const& point, 29 | vec<2, T, Q> const& a, 30 | vec<2, T, Q> const& b 31 | ) 32 | { 33 | T LineLength = distance(a, b); 34 | vec<2, T, Q> Vector = point - a; 35 | vec<2, T, Q> LineDirection = (b - a) / LineLength; 36 | 37 | // Project Vector to LineDirection to get the distance of point from a 38 | T Distance = dot(Vector, LineDirection); 39 | 40 | if(Distance <= T(0)) return a; 41 | if(Distance >= LineLength) return b; 42 | return a + LineDirection * Distance; 43 | } 44 | 45 | }//namespace glm 46 | -------------------------------------------------------------------------------- /Library/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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType extend 7 | ( 8 | genType const& Origin, 9 | genType const& Source, 10 | genType const& Distance 11 | ) 12 | { 13 | return Origin + (Source - Origin) * Distance; 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER vec<2, T, Q> extend 18 | ( 19 | vec<2, T, Q> const& Origin, 20 | vec<2, T, Q> const& Source, 21 | T const& Distance 22 | ) 23 | { 24 | return Origin + (Source - Origin) * Distance; 25 | } 26 | 27 | template 28 | GLM_FUNC_QUALIFIER vec<3, T, Q> extend 29 | ( 30 | vec<3, T, Q> const& Origin, 31 | vec<3, T, Q> const& Source, 32 | T const& Distance 33 | ) 34 | { 35 | return Origin + (Source - Origin) * Distance; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER vec<4, T, Q> extend 40 | ( 41 | vec<4, T, Q> const& Origin, 42 | vec<4, T, Q> const& Source, 43 | T const& Distance 44 | ) 45 | { 46 | return Origin + (Source - Origin) * Distance; 47 | } 48 | }//namespace glm 49 | -------------------------------------------------------------------------------- /Library/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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/exterior_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_exterior_product 2 | 3 | #include 4 | 5 | namespace glm { 6 | namespace detail 7 | { 8 | template 9 | struct compute_cross_vec2 10 | { 11 | GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u) 12 | { 13 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' accepts only floating-point inputs"); 14 | 15 | return v.x * u.y - u.x * v.y; 16 | } 17 | }; 18 | }//namespace detail 19 | 20 | template 21 | GLM_FUNC_QUALIFIER T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y) 22 | { 23 | return detail::compute_cross_vec2::value>::call(x, y); 24 | } 25 | }//namespace glm 26 | 27 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/float_notmalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_float_normalize 2 | 3 | #include 4 | 5 | namespace glm 6 | { 7 | template 8 | GLM_FUNC_QUALIFIER vec floatNormalize(vec const& v) 9 | { 10 | return vec(v) / static_cast(std::numeric_limits::max()); 11 | } 12 | 13 | }//namespace glm 14 | -------------------------------------------------------------------------------- /Library/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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/functions.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_functions 2 | 3 | #include "../exponential.hpp" 4 | 5 | namespace glm 6 | { 7 | template 8 | GLM_FUNC_QUALIFIER T gauss 9 | ( 10 | T x, 11 | T ExpectedValue, 12 | T StandardDeviation 13 | ) 14 | { 15 | return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast(6.28318530717958647692528676655900576))); 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER T gauss 20 | ( 21 | vec<2, T, Q> const& Coord, 22 | vec<2, T, Q> const& ExpectedValue, 23 | vec<2, T, Q> const& StandardDeviation 24 | ) 25 | { 26 | vec<2, T, Q> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation); 27 | return exp(-(Squared.x + Squared.y)); 28 | } 29 | }//namespace glm 30 | 31 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER T radialGradient 7 | ( 8 | vec<2, T, Q> const& Center, 9 | T const& Radius, 10 | vec<2, T, Q> const& Focal, 11 | vec<2, T, Q> const& Position 12 | ) 13 | { 14 | vec<2, T, Q> F = Focal - Center; 15 | vec<2, T, Q> D = Position - Focal; 16 | T Radius2 = pow2(Radius); 17 | T Fx2 = pow2(F.x); 18 | T Fy2 = pow2(F.y); 19 | 20 | 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)); 21 | T Denominator = Radius2 - (Fx2 + Fy2); 22 | return Numerator / Denominator; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER T linearGradient 27 | ( 28 | vec<2, T, Q> const& Point0, 29 | vec<2, T, Q> const& Point1, 30 | vec<2, T, Q> const& Position 31 | ) 32 | { 33 | vec<2, T, Q> Dist = Point1 - Point0; 34 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 35 | } 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER bool rightHanded 7 | ( 8 | vec<3, T, Q> const& tangent, 9 | vec<3, T, Q> const& binormal, 10 | vec<3, T, Q> const& normal 11 | ) 12 | { 13 | return dot(cross(normal, tangent), binormal) > T(0); 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER bool leftHanded 18 | ( 19 | vec<3, T, Q> const& tangent, 20 | vec<3, T, Q> const& binormal, 21 | vec<3, T, Q> const& normal 22 | ) 23 | { 24 | return dot(cross(normal, tangent), binormal) < T(0); 25 | } 26 | }//namespace glm 27 | -------------------------------------------------------------------------------- /Library/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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType log(genType const& x, genType const& base) 7 | { 8 | return glm::log(x) / glm::log(base); 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER vec log(vec const& x, vec const& base) 13 | { 14 | return glm::log(x) / glm::log(base); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> matrixCross3 7 | ( 8 | vec<3, T, Q> const& x 9 | ) 10 | { 11 | mat<3, 3, T, Q> Result(T(0)); 12 | Result[0][1] = x.z; 13 | Result[1][0] = -x.z; 14 | Result[0][2] = -x.y; 15 | Result[2][0] = x.y; 16 | Result[1][2] = x.x; 17 | Result[2][1] = -x.x; 18 | return Result; 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> matrixCross4 23 | ( 24 | vec<3, T, Q> const& x 25 | ) 26 | { 27 | mat<4, 4, T, Q> Result(T(0)); 28 | Result[0][1] = x.z; 29 | Result[1][0] = -x.z; 30 | Result[0][2] = -x.y; 31 | Result[2][0] = x.y; 32 | Result[1][2] = x.x; 33 | Result[2][1] = -x.x; 34 | return Result; 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/matrix_factorisation.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/Library/include/glm/gtx/matrix_factorisation.inl -------------------------------------------------------------------------------- /Library/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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER T mixedProduct 7 | ( 8 | vec<3, T, Q> const& v1, 9 | vec<3, T, Q> const& v2, 10 | vec<3, T, Q> const& v3 11 | ) 12 | { 13 | return dot(cross(v1, v2), v3); 14 | } 15 | }//namespace glm 16 | -------------------------------------------------------------------------------- /Library/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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER vec<3, T, Q> triangleNormal 7 | ( 8 | vec<3, T, Q> const& p1, 9 | vec<3, T, Q> const& p2, 10 | vec<3, T, Q> const& p3 11 | ) 12 | { 13 | return normalize(cross(p1 - p2, p1 - p3)); 14 | } 15 | }//namespace glm 16 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/normalize_dot.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER T normalizeDot(vec const& x, vec const& y) 7 | { 8 | return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER T fastNormalizeDot(vec const& x, vec const& y) 13 | { 14 | return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y)); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_number_precision 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType pow2(genType const& x) 7 | { 8 | return x * x; 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER genType pow3(genType const& x) 13 | { 14 | return x * x * x; 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER genType pow4(genType const& x) 19 | { 20 | return (x * x) * (x * x); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m) 7 | { 8 | mat<3, 3, T, Q> r = m; 9 | 10 | r[0] = normalize(r[0]); 11 | 12 | T d0 = dot(r[0], r[1]); 13 | r[1] -= r[0] * d0; 14 | r[1] = normalize(r[1]); 15 | 16 | T d1 = dot(r[1], r[2]); 17 | d0 = dot(r[0], r[2]); 18 | r[2] -= r[0] * d0 + r[1] * d1; 19 | r[2] = normalize(r[2]); 20 | 21 | return r; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y) 26 | { 27 | return normalize(x - y * dot(y, x)); 28 | } 29 | }//namespace glm 30 | -------------------------------------------------------------------------------- /Library/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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType perp(genType const& x, genType const& Normal) 7 | { 8 | return x - proj(x, Normal); 9 | } 10 | }//namespace glm 11 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER vec<3, T, Q> polar 7 | ( 8 | vec<3, T, Q> const& euclidean 9 | ) 10 | { 11 | T const Length(length(euclidean)); 12 | vec<3, T, Q> const tmp(euclidean / Length); 13 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 14 | 15 | return vec<3, T, Q>( 16 | asin(tmp.y), // latitude 17 | atan(tmp.x, tmp.z), // longitude 18 | xz_dist); // xz distance 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER vec<3, T, Q> euclidean 23 | ( 24 | vec<2, T, Q> const& polar 25 | ) 26 | { 27 | T const latitude(polar.x); 28 | T const longitude(polar.y); 29 | 30 | return vec<3, T, Q>( 31 | cos(latitude) * sin(longitude), 32 | sin(latitude), 33 | cos(latitude) * cos(longitude)); 34 | } 35 | 36 | }//namespace glm 37 | -------------------------------------------------------------------------------- /Library/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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER genType proj(genType const& x, genType const& Normal) 7 | { 8 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 9 | } 10 | }//namespace glm 11 | -------------------------------------------------------------------------------- /Library/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 "../ext/scalar_uint_sized.hpp" 17 | #include "../detail/setup.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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | 3 | -------------------------------------------------------------------------------- /Library/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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Library/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_ENABLE && !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 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/texture.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_texture 2 | 3 | namespace glm 4 | { 5 | template 6 | inline T levels(vec const& Extent) 7 | { 8 | return glm::log2(compMax(Extent)) + static_cast(1); 9 | } 10 | 11 | template 12 | inline T levels(T Extent) 13 | { 14 | return vec<1, T, defaultp>(Extent).x; 15 | } 16 | }//namespace glm 17 | 18 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_transform 2 | 3 | namespace glm 4 | { 5 | template 6 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(vec<3, T, Q> const& v) 7 | { 8 | return translate(mat<4, 4, T, Q>(static_cast(1)), v); 9 | } 10 | 11 | template 12 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate(T angle, vec<3, T, Q> const& v) 13 | { 14 | return rotate(mat<4, 4, T, Q>(static_cast(1)), angle, v); 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale(vec<3, T, Q> const& v) 19 | { 20 | return scale(mat<4, 4, T, Q>(static_cast(1)), v); 21 | } 22 | 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /Library/include/glm/gtx/type_aligned.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_type_aligned 2 | 3 | namespace glm 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Library/include/glm/mat2x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x2.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double2x2.hpp" 6 | #include "./ext/matrix_double2x2_precision.hpp" 7 | #include "./ext/matrix_float2x2.hpp" 8 | #include "./ext/matrix_float2x2_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /Library/include/glm/mat2x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x3.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double2x3.hpp" 6 | #include "./ext/matrix_double2x3_precision.hpp" 7 | #include "./ext/matrix_float2x3.hpp" 8 | #include "./ext/matrix_float2x3_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /Library/include/glm/mat2x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat2x4.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double2x4.hpp" 6 | #include "./ext/matrix_double2x4_precision.hpp" 7 | #include "./ext/matrix_float2x4.hpp" 8 | #include "./ext/matrix_float2x4_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /Library/include/glm/mat3x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x2.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double3x2.hpp" 6 | #include "./ext/matrix_double3x2_precision.hpp" 7 | #include "./ext/matrix_float3x2.hpp" 8 | #include "./ext/matrix_float3x2_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /Library/include/glm/mat3x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x3.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double3x3.hpp" 6 | #include "./ext/matrix_double3x3_precision.hpp" 7 | #include "./ext/matrix_float3x3.hpp" 8 | #include "./ext/matrix_float3x3_precision.hpp" 9 | -------------------------------------------------------------------------------- /Library/include/glm/mat3x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat3x4.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double3x4.hpp" 6 | #include "./ext/matrix_double3x4_precision.hpp" 7 | #include "./ext/matrix_float3x4.hpp" 8 | #include "./ext/matrix_float3x4_precision.hpp" 9 | -------------------------------------------------------------------------------- /Library/include/glm/mat4x2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x2.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double4x2.hpp" 6 | #include "./ext/matrix_double4x2_precision.hpp" 7 | #include "./ext/matrix_float4x2.hpp" 8 | #include "./ext/matrix_float4x2_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /Library/include/glm/mat4x3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x3.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double4x3.hpp" 6 | #include "./ext/matrix_double4x3_precision.hpp" 7 | #include "./ext/matrix_float4x3.hpp" 8 | #include "./ext/matrix_float4x3_precision.hpp" 9 | -------------------------------------------------------------------------------- /Library/include/glm/mat4x4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/mat4x4.hpp 3 | 4 | #pragma once 5 | #include "./ext/matrix_double4x4.hpp" 6 | #include "./ext/matrix_double4x4_precision.hpp" 7 | #include "./ext/matrix_float4x4.hpp" 8 | #include "./ext/matrix_float4x4_precision.hpp" 9 | 10 | -------------------------------------------------------------------------------- /Library/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_f32vec4 glm_vec1_sqrt_lowp(glm_f32vec4 x) 11 | { 12 | return _mm_mul_ss(_mm_rsqrt_ss(x), x); 13 | } 14 | 15 | GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_sqrt_lowp(glm_f32vec4 x) 16 | { 17 | return _mm_mul_ps(_mm_rsqrt_ps(x), x); 18 | } 19 | 20 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 21 | -------------------------------------------------------------------------------- /Library/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 | -------------------------------------------------------------------------------- /Library/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 | -------------------------------------------------------------------------------- /Library/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 | -------------------------------------------------------------------------------- /Library/include/glm/vec2.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec2.hpp 3 | 4 | #pragma once 5 | #include "./ext/vector_bool2.hpp" 6 | #include "./ext/vector_bool2_precision.hpp" 7 | #include "./ext/vector_float2.hpp" 8 | #include "./ext/vector_float2_precision.hpp" 9 | #include "./ext/vector_double2.hpp" 10 | #include "./ext/vector_double2_precision.hpp" 11 | #include "./ext/vector_int2.hpp" 12 | #include "./ext/vector_int2_precision.hpp" 13 | #include "./ext/vector_uint2.hpp" 14 | #include "./ext/vector_uint2_precision.hpp" 15 | -------------------------------------------------------------------------------- /Library/include/glm/vec3.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec3.hpp 3 | 4 | #pragma once 5 | #include "./ext/vector_bool3.hpp" 6 | #include "./ext/vector_bool3_precision.hpp" 7 | #include "./ext/vector_float3.hpp" 8 | #include "./ext/vector_float3_precision.hpp" 9 | #include "./ext/vector_double3.hpp" 10 | #include "./ext/vector_double3_precision.hpp" 11 | #include "./ext/vector_int3.hpp" 12 | #include "./ext/vector_int3_precision.hpp" 13 | #include "./ext/vector_uint3.hpp" 14 | #include "./ext/vector_uint3_precision.hpp" 15 | -------------------------------------------------------------------------------- /Library/include/glm/vec4.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/vec4.hpp 3 | 4 | #pragma once 5 | #include "./ext/vector_bool4.hpp" 6 | #include "./ext/vector_bool4_precision.hpp" 7 | #include "./ext/vector_float4.hpp" 8 | #include "./ext/vector_float4_precision.hpp" 9 | #include "./ext/vector_double4.hpp" 10 | #include "./ext/vector_double4_precision.hpp" 11 | #include "./ext/vector_int4.hpp" 12 | #include "./ext/vector_int4_precision.hpp" 13 | #include "./ext/vector_uint4.hpp" 14 | #include "./ext/vector_uint4_precision.hpp" 15 | 16 | -------------------------------------------------------------------------------- /Library/lib/libIrrXML.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/Library/lib/libIrrXML.a -------------------------------------------------------------------------------- /Library/lib/libglfw3.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/Library/lib/libglfw3.a -------------------------------------------------------------------------------- /Work/LearnOpenGLES/LearnOpenGLES.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Work/LearnOpenGLES/LearnOpenGLES.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Work/LearnOpenGLES/LearnOpenGLES.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LearnOpenGLES.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Work/LearnOpenGLES/LearnOpenGLES/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LearnOpenGLES 4 | // 5 | // Created by Wicky on 2018/10/24. 6 | // Copyright © 2018 Wicky. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Work/LearnOpenGLES/LearnOpenGLES/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Work/LearnOpenGLES/LearnOpenGLES/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LearnOpenGLES 4 | // 5 | // Created by Wicky on 2018/10/24. 6 | // Copyright © 2018 Wicky. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Work/LearnOpenGLES/LearnOpenGLES/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LearnOpenGLES 4 | // 5 | // Created by Wicky on 2018/10/24. 6 | // Copyright © 2018 Wicky. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | 12 | 13 | @interface ViewController () 14 | @property (nonatomic ,strong) EAGLContext * mContext; 15 | 16 | @property (nonatomic ,strong) GLKView * view; 17 | 18 | @end 19 | 20 | @implementation ViewController 21 | 22 | -(void)loadView { 23 | [super loadView]; 24 | self.view = [[GLKView alloc] initWithFrame:[UIScreen mainScreen].bounds]; 25 | self.view.delegate = self; 26 | } 27 | 28 | - (void)viewDidLoad { 29 | [super viewDidLoad]; 30 | [self configGLContext]; 31 | } 32 | 33 | -(void)configGLContext { 34 | self.mContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; //2.0,还有1.0和3.0 35 | self.view.context = self.mContext; 36 | self.view.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888; //颜色缓冲区格式 37 | [EAGLContext setCurrentContext:self.mContext]; 38 | } 39 | 40 | -(void)doRenderTask { 41 | glClearColor(0.2f, 0.3f, 0.3f, 1.0f); 42 | glClear(GL_COLOR_BUFFER_BIT); 43 | } 44 | 45 | #pragma mark --- glkView Delegate --- 46 | -(void)glkView:(GLKView *)view drawInRect:(CGRect)rect { 47 | [self doRenderTask]; 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Work/LearnOpenGLES/LearnOpenGLES/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/Work/LearnOpenGLES/LearnOpenGLES/icon.png -------------------------------------------------------------------------------- /Work/LearnOpenGLES/LearnOpenGLES/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LearnOpenGLES 4 | // 5 | // Created by Wicky on 2018/10/24. 6 | // Copyright © 2018 Wicky. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Work/OpenGL_Template/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Work/OpenGL_Template/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Work/OpenGL_Template/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | OpenGL_Template.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Work/OpenGL_Template/OpenGL_Template/lib/libglfw3.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/Work/OpenGL_Template/OpenGL_Template/lib/libglfw3.a -------------------------------------------------------------------------------- /光照/1.颜色.md: -------------------------------------------------------------------------------- 1 | # 1.颜色 2 | 3 | 入门教程相信你已经看完了,那么接下来我们将进行另一个章节的学习,光照。之前的Demo中,我们定义了物体自己的颜色,他就可以完全展示出来。但是我们想要他随着环境光源的变化而改变我们看到的颜色。那么我们就要引入光照的概念。 4 | 5 | ### 颜色 6 | 7 | 首先我们先简单的介绍一下颜色的概念。我们知道我们眼睛看到的物体,是因为物体表面反射的光线在我们视网膜上的投影。而我们之所以能看到物体的颜色是红色,是因为物体表面将红色的光线反射回来,其余颜色的光线吸收掉,所以我们才能看到红色。 8 | 9 | 在OpenGL中,我们也是模仿这个过程。还记得我们的模型的颜色是在哪里确定的么?片段着色器中要输出对应点的颜色是吧。所以我们现在要在获取到的物体的颜色的基础上再乘以光源的颜色即可。 10 | 11 | 这里只给出片段着色器的代码: 12 | 13 | ``` 14 | #version 330 core 15 | out vec4 FragColor; 16 | in vec3 ourColor; 17 | uniform vec3 lightColor; 18 | void main() 19 | { 20 | FragColor = vec4(ourColor * lightColor , 1.0); 21 | } 22 | ``` 23 | 24 | ### 光源 25 | 26 | 为了更加真实,一般情况下我们还要表明我们的光源的位置。这里我们就不做详尽介绍了,只着重说一点,一般我们的光源的颜色是固定的,所以上面的片段着色器可能并不是一个最适合的形式,他应该有一个更简单的形式,正如刚接触GL时我们所写的片段着色器一样。好在我们写了着色器类,这样我们就不用再重复那些复杂的过程了,只要重写一个片段着色器即可。 27 | 28 | 这一部分只是简单的介绍了一下在GL中光源对物体颜色的影响,在下面的教程中我们将详细的介绍如何去构建一个光源。 29 | 30 | 这部分的代码如果你有疑问,可以参考中[Demos/1.颜色](https://github.com/CodeWicky/Learning-OpenGL/tree/master/%E5%85%89%E7%85%A7/Demos/1.%E9%A2%9C%E8%89%B2)的代码。 -------------------------------------------------------------------------------- /光照/7.复习.md: -------------------------------------------------------------------------------- 1 | # 7.复习 2 | 3 | - 颜色向量(Color Vector):一个通过红绿蓝(RGB)分量的组合描绘大部分真实颜色的向量。一个物体的颜色实际上是该物体所不能吸收的反射颜色分量。 4 | - 冯氏光照模型(Phong Lighting Model):一个通过计算环境光,漫反射,和镜面光分量的值来估计真实光照的模型。 5 | - 环境光照(Ambient Lighting):通过给每个没有被光照的物体很小的亮度,使其不是完全黑暗的,从而对全局光照进行估计。 6 | - 漫反射着色(Diffuse Shading):一个顶点/片段与光线方向越接近,光照会越强。使用了法向量来计算角度。 7 | - 法向量(Normal Vector):一个垂直于平面的单位向量。 8 | - 法线矩阵(Normal Matrix):一个3x3矩阵,或者说是没有平移的模型(或者模型-观察)矩阵。它也被以某种方式修改(逆转置),从而在应用非统一缩放时,保持法向量朝向正确的方向。否则法向量会在使用非统一缩放时被扭曲。 9 | - 镜面光照(Specular Lighting):当观察者视线靠近光源在表面的反射线时会显示的镜面高光。镜面光照是由观察者的方向,光源的方向和设定高光分散量的反光度值三个量共同决定的。 10 | - 冯氏着色(Phong Shading):冯氏光照模型应用在片段着色器。 11 | - Gouraud着色(Gouraud shading):冯氏光照模型应用在顶点着色器上。在使用很少数量的顶点时会产生明显的瑕疵。会得到效率提升但是损失了视觉质量。 12 | - GLSL结构体(GLSL struct):一个类似于C的结构体,用作着色器变量的容器。大部分时间用来管理输入/输出/uniform。 13 | - 材质(Material):一个物体反射的环境光,漫反射,镜面光颜色。这些东西设定了物体所拥有的颜色。 14 | - 光照属性(Light(properties)):一个光的环境光,漫反射,镜面光的强度。可以使用任何颜色值,对每一个冯氏分量(Phong Component)定义光源发出的颜色/强度。 15 | - 漫反射贴图(Diffuse Map):一个设定了每个片段中漫反射颜色的纹理图片。 16 | - 镜面光贴图(Specular Map):一个设定了每一个片段的镜面光强度/颜色的纹理贴图。仅在物体的特定区域显示镜面高光。 17 | - 定向光(Directional Light):只有一个方向的光源。它被建模为不管距离有多长所有光束都是平行而且其方向向量在整个场景中保持不变。 18 | - 点光源(Point Light):一个在场景中有位置的,光线逐渐衰减的光源。 19 | - 衰减(Attenuation):光随着距离减少强度的过程,通常使用在点光源和聚光下。 20 | - 聚光(Spotlight):一个被定义为在某一个方向上的锥形的光源。 21 | - 手电筒(Flashlight):一个摆放在观察者视角的聚光。 22 | - GLSL uniform数组(GLSL Uniform Array):一个uniform值数组。它的工作原理和C语言数组大致一样,只是不能动态分配内存。 -------------------------------------------------------------------------------- /光照/Demos/1.颜色/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /光照/Demos/1.颜色/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /光照/Demos/1.颜色/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /光照/Demos/1.颜色/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | uniform vec3 lightColor; 5 | void main() 6 | { 7 | FragColor = vec4(ourColor * lightColor , 1.0); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /光照/Demos/1.颜色/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | void main() 5 | { 6 | FragColor = vec4(1.0); 7 | } 8 | -------------------------------------------------------------------------------- /光照/Demos/1.颜色/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | out vec3 ourColor; 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | ourColor = aColor; 12 | } 13 | -------------------------------------------------------------------------------- /光照/Demos/1.颜色/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/1.颜色/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /光照/Demos/1.颜色/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/1.颜色/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | uniform vec3 ambientColor; 5 | uniform vec3 lightColor; 6 | void main() 7 | { 8 | FragColor = vec4(ourColor * ambientColor , 1.0); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template/Light.h: -------------------------------------------------------------------------------- 1 | // 2 | // Light.h 3 | // OpenGL_Template 4 | // 5 | // Created by Wicky on 2018/11/22. 6 | // Copyright © 2018 Wicky. All rights reserved. 7 | // 8 | 9 | #ifndef Light_h 10 | #define Light_h 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | const float AMBIENTSTRENGTH = 0.1f; 17 | 18 | class Light { 19 | 20 | public : 21 | 22 | glm::vec3 Color; 23 | glm::vec3 Position; 24 | 25 | float AmbientStrength; 26 | 27 | Light(glm::vec3 lightColor = glm::vec3(1.0f),glm::vec3 worldPosition = glm::vec3(0.0f)) : AmbientStrength(AMBIENTSTRENGTH) { 28 | Position = worldPosition; 29 | Color = lightColor; 30 | } 31 | 32 | glm::vec3 getAmbientColor() { 33 | return Color * AmbientStrength; 34 | } 35 | 36 | }; 37 | 38 | #endif /* Light_h */ 39 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | void main() 5 | { 6 | FragColor = vec4(1.0); 7 | } 8 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | out vec3 ourColor; 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | ourColor = aColor; 12 | } 13 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/2.基础光照/2-1.环境光照/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | in vec3 normal; 5 | in vec3 fragPosition; 6 | uniform vec3 ambientColor; 7 | uniform vec3 lightColor; 8 | uniform vec3 lightPosition; 9 | void main() 10 | { 11 | vec3 norm = normalize(normal); 12 | vec3 lightDir = normalize(lightPosition - fragPosition); 13 | float factor = max(dot(norm,lightDir),0.0); 14 | FragColor = vec4(ourColor * (ambientColor + lightColor * factor) , 1.0); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template/Light.h: -------------------------------------------------------------------------------- 1 | // 2 | // Light.h 3 | // OpenGL_Template 4 | // 5 | // Created by Wicky on 2018/11/22. 6 | // Copyright © 2018 Wicky. All rights reserved. 7 | // 8 | 9 | #ifndef Light_h 10 | #define Light_h 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | const float AMBIENTSTRENGTH = 0.1f; 17 | 18 | class Light { 19 | 20 | public : 21 | 22 | glm::vec3 Color; 23 | glm::vec3 Position; 24 | 25 | float AmbientStrength; 26 | 27 | Light(glm::vec3 lightColor = glm::vec3(1.0f),glm::vec3 worldPosition = glm::vec3(0.0f)) : AmbientStrength(AMBIENTSTRENGTH) { 28 | Position = worldPosition; 29 | Color = lightColor; 30 | } 31 | 32 | glm::vec3 getAmbientColor() { 33 | return Color * AmbientStrength; 34 | } 35 | 36 | }; 37 | 38 | #endif /* Light_h */ 39 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec3 lightColor; 4 | void main() 5 | { 6 | FragColor = vec4(lightColor,1.0); 7 | } 8 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | layout (location = 2) in vec3 aNormal; 5 | uniform mat4 model; 6 | uniform mat4 view; 7 | uniform mat4 projection; 8 | out vec3 ourColor; 9 | out vec3 normal; 10 | out vec3 fragPosition; 11 | void main() 12 | { 13 | gl_Position = projection * view * model * vec4(aPos, 1.0); 14 | ourColor = aColor; 15 | fragPosition = vec3(model * vec4(aPos,1.0)); 16 | normal = mat3(transpose(inverse(model))) * aNormal; 17 | } 18 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/2.基础光照/2-2.漫反射光照/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | ///输出颜色 3 | out vec4 FragColor; 4 | ///顶点颜色 5 | in vec3 ourColor; 6 | ///法向量 7 | in vec3 normal; 8 | ///顶点世界坐标 9 | in vec3 fragPosition; 10 | ///环境强度 11 | uniform float ambientStrength; 12 | ///镜面强度 13 | uniform float specularStrength; 14 | ///光照颜色 15 | uniform vec3 lightColor; 16 | ///光照点 17 | uniform vec3 lightPosition; 18 | ///观察点 19 | uniform vec3 viewPosition; 20 | void main() 21 | { 22 | ///环境光照 23 | vec3 ambientColor = lightColor * (max(ambientStrength,0.0)); 24 | 25 | ///漫反射光照 26 | vec3 norm = normalize(normal); 27 | vec3 lightDir = normalize(lightPosition - fragPosition); 28 | float factor = max(dot(norm,lightDir),0.0); 29 | vec3 diffuseColor = lightColor * factor; 30 | 31 | ///镜面反射光照 32 | vec3 reflectDir = reflect(-lightDir, norm); 33 | vec3 viewDir = normalize(viewPosition - fragPosition); 34 | float spec = pow(max(dot(viewDir, reflectDir), 0.0),32); 35 | vec3 specularColor = specularStrength * spec * lightColor; 36 | 37 | ///颜色合成 38 | FragColor = vec4(ourColor * (ambientColor + diffuseColor + specularColor) , 1.0); 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template/Light.h: -------------------------------------------------------------------------------- 1 | // 2 | // Light.h 3 | // OpenGL_Template 4 | // 5 | // Created by Wicky on 2018/11/22. 6 | // Copyright © 2018 Wicky. All rights reserved. 7 | // 8 | 9 | #ifndef Light_h 10 | #define Light_h 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | const float AMBIENTSTRENGTH = 0.1f; 17 | const float SPECULARSTRENGTH = 0.5f; 18 | 19 | class Light { 20 | 21 | public : 22 | 23 | glm::vec3 Color; 24 | glm::vec3 Position; 25 | 26 | float AmbientStrength; 27 | float SpecularStrength; 28 | 29 | Light(glm::vec3 lightColor = glm::vec3(1.0f),glm::vec3 worldPosition = glm::vec3(0.0f)) : AmbientStrength(AMBIENTSTRENGTH),SpecularStrength(SPECULARSTRENGTH) { 30 | Position = worldPosition; 31 | Color = lightColor; 32 | } 33 | 34 | }; 35 | 36 | #endif /* Light_h */ 37 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec3 lightColor; 4 | void main() 5 | { 6 | FragColor = vec4(lightColor,1.0); 7 | } 8 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | ///顶点坐标 3 | layout (location = 0) in vec3 aPos; 4 | ///顶点坐标颜色 5 | layout (location = 1) in vec3 aColor; 6 | ///顶点法向量 7 | layout (location = 2) in vec3 aNormal; 8 | ///模型矩阵 9 | uniform mat4 model; 10 | ///观察矩阵 11 | uniform mat4 view; 12 | ///裁剪矩阵 13 | uniform mat4 projection; 14 | out vec3 ourColor; 15 | out vec3 normal; 16 | out vec3 fragPosition; 17 | void main() 18 | { 19 | ///顶点裁剪坐标系坐标 20 | gl_Position = projection * view * model * vec4(aPos, 1.0); 21 | ///顶点世界坐标 22 | fragPosition = vec3(model * vec4(aPos,1.0)); 23 | ourColor = aColor; 24 | ///经矩阵运算的法向量(防止模型变换后导致法向量不垂直) 25 | normal = mat3(transpose(inverse(model))) * aNormal; 26 | } 27 | -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/2.基础光照/2-3.镜面反射光照/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /光照/Demos/3.材质/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /光照/Demos/3.材质/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /光照/Demos/3.材质/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /光照/Demos/3.材质/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | struct Material { 4 | vec3 ambient; 5 | vec3 diffuse; 6 | vec3 specular; 7 | float shininess; 8 | }; 9 | 10 | struct Light { 11 | vec3 position; 12 | vec3 ambient; 13 | vec3 diffuse; 14 | vec3 specular; 15 | }; 16 | 17 | ///输出颜色 18 | out vec4 FragColor; 19 | ///法向量 20 | in vec3 normal; 21 | ///顶点世界坐标 22 | in vec3 fragPosition; 23 | ///观察点 24 | uniform vec3 viewPosition; 25 | ///材质 26 | uniform Material material; 27 | ///光源 28 | uniform Light light; 29 | void main() 30 | { 31 | ///环境光照 32 | vec3 ambientColor = light.ambient * material.ambient; 33 | ///漫反射光照 34 | vec3 norm = normalize(normal); 35 | vec3 lightDir = normalize(light.position - fragPosition); 36 | float factor = max(dot(norm,lightDir),0.0); 37 | vec3 diffuseColor = light.diffuse * (factor * material.diffuse); 38 | 39 | ///镜面反射光照 40 | vec3 reflectDir = reflect(-lightDir, norm); 41 | vec3 viewDir = normalize(viewPosition - fragPosition); 42 | float spec = pow(max(dot(viewDir, reflectDir), 0.0),material.shininess); 43 | vec3 specularColor = light.specular * (spec * material.specular); 44 | 45 | ///颜色合成 46 | FragColor = vec4((ambientColor + diffuseColor + specularColor) , 1.0); 47 | } 48 | 49 | 50 | -------------------------------------------------------------------------------- /光照/Demos/3.材质/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec3 lightColor; 4 | void main() 5 | { 6 | FragColor = vec4(lightColor,1.0); 7 | } 8 | -------------------------------------------------------------------------------- /光照/Demos/3.材质/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | ///顶点坐标 3 | layout (location = 0) in vec3 aPos; 4 | ///顶点法向量 5 | layout (location = 1) in vec3 aNormal; 6 | ///模型矩阵 7 | uniform mat4 model; 8 | ///观察矩阵 9 | uniform mat4 view; 10 | ///裁剪矩阵 11 | uniform mat4 projection; 12 | out vec3 normal; 13 | out vec3 fragPosition; 14 | void main() 15 | { 16 | ///顶点裁剪坐标系坐标 17 | gl_Position = projection * view * model * vec4(aPos, 1.0); 18 | ///顶点世界坐标 19 | fragPosition = vec3(model * vec4(aPos,1.0)); 20 | ///经矩阵运算的法向量(防止模型变换后导致法向量不垂直) 21 | normal = mat3(transpose(inverse(model))) * aNormal; 22 | } 23 | -------------------------------------------------------------------------------- /光照/Demos/3.材质/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/3.材质/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /光照/Demos/3.材质/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/3.材质/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /光照/Demos/4.光照贴图/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /光照/Demos/4.光照贴图/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /光照/Demos/4.光照贴图/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /光照/Demos/4.光照贴图/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | struct Material { 4 | sampler2D diffuse; 5 | sampler2D specular; 6 | float shininess; 7 | }; 8 | 9 | struct Light { 10 | vec3 position; 11 | vec3 ambient; 12 | vec3 diffuse; 13 | vec3 specular; 14 | }; 15 | 16 | ///输出颜色 17 | out vec4 FragColor; 18 | ///纹理坐标 19 | in vec2 TexCoord; 20 | ///法向量 21 | in vec3 normal; 22 | ///顶点世界坐标 23 | in vec3 fragPosition; 24 | ///观察点 25 | uniform vec3 viewPosition; 26 | ///材质 27 | uniform Material material; 28 | ///光源 29 | uniform Light light; 30 | void main() 31 | { 32 | ///环境光照 33 | vec3 ambientColor = light.ambient * vec3(texture(material.diffuse, TexCoord)); 34 | 35 | ///漫反射光照 36 | vec3 norm = normalize(normal); 37 | vec3 lightDir = normalize(light.position - fragPosition); 38 | float factor = max(dot(norm,lightDir),0.0); 39 | vec3 diffuseColor = light.diffuse * factor * vec3(texture(material.diffuse, TexCoord)); 40 | 41 | ///镜面反射光照 42 | vec3 reflectDir = reflect(-lightDir, norm); 43 | vec3 viewDir = normalize(viewPosition - fragPosition); 44 | float spec = pow(max(dot(viewDir, reflectDir), 0.0),material.shininess); 45 | vec3 specularColor = light.specular * spec * vec3(texture(material.specular, TexCoord)); 46 | 47 | ///颜色合成 48 | FragColor = vec4((ambientColor + diffuseColor + specularColor) , 1.0); 49 | } 50 | 51 | 52 | -------------------------------------------------------------------------------- /光照/Demos/4.光照贴图/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec3 lightColor; 4 | void main() 5 | { 6 | FragColor = vec4(lightColor,1.0); 7 | } 8 | -------------------------------------------------------------------------------- /光照/Demos/4.光照贴图/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | ///顶点坐标 3 | layout (location = 0) in vec3 aPos; 4 | ///顶点法向量 5 | layout (location = 1) in vec3 aNormal; 6 | ///顶点纹理坐标 7 | layout (location = 2) in vec2 aTexCoord; 8 | ///模型矩阵 9 | uniform mat4 model; 10 | ///观察矩阵 11 | uniform mat4 view; 12 | ///裁剪矩阵 13 | uniform mat4 projection; 14 | out vec3 normal; 15 | out vec3 fragPosition; 16 | out vec2 TexCoord; 17 | void main() 18 | { 19 | ///顶点裁剪坐标系坐标 20 | gl_Position = projection * view * model * vec4(aPos, 1.0); 21 | ///顶点世界坐标 22 | fragPosition = vec3(model * vec4(aPos,1.0)); 23 | ///经矩阵运算的法向量(防止模型变换后导致法向量不垂直) 24 | normal = mat3(transpose(inverse(model))) * aNormal; 25 | TexCoord = aTexCoord; 26 | } 27 | -------------------------------------------------------------------------------- /光照/Demos/4.光照贴图/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/4.光照贴图/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /光照/Demos/4.光照贴图/OpenGL_Template/container2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/4.光照贴图/OpenGL_Template/container2.png -------------------------------------------------------------------------------- /光照/Demos/4.光照贴图/OpenGL_Template/container2_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/4.光照贴图/OpenGL_Template/container2_specular.png -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-1.定向光/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-1.定向光/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-1.定向光/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-1.定向光/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | struct Material { 4 | sampler2D diffuse; 5 | sampler2D specular; 6 | float shininess; 7 | }; 8 | 9 | struct Light { 10 | vec3 lightDirection; 11 | vec3 position; 12 | vec3 ambient; 13 | vec3 diffuse; 14 | vec3 specular; 15 | }; 16 | 17 | ///输出颜色 18 | out vec4 FragColor; 19 | ///纹理坐标 20 | in vec2 TexCoord; 21 | ///法向量 22 | in vec3 normal; 23 | ///顶点世界坐标 24 | in vec3 fragPosition; 25 | ///观察点 26 | uniform vec3 viewPosition; 27 | ///材质 28 | uniform Material material; 29 | ///光源 30 | uniform Light light; 31 | void main() 32 | { 33 | ///环境光照 34 | vec3 ambientColor = light.ambient * vec3(texture(material.diffuse, TexCoord)); 35 | 36 | ///漫反射光照 37 | vec3 norm = normalize(normal); 38 | vec3 lightDir = normalize(-light.lightDirection); 39 | float factor = max(dot(norm,lightDir),0.0); 40 | vec3 diffuseColor = light.diffuse * factor * vec3(texture(material.diffuse, TexCoord)); 41 | 42 | ///镜面反射光照 43 | vec3 reflectDir = reflect(-lightDir, norm); 44 | vec3 viewDir = normalize(viewPosition - fragPosition); 45 | float spec = pow(max(dot(viewDir, reflectDir), 0.0),material.shininess); 46 | vec3 specularColor = light.specular * spec * vec3(texture(material.specular, TexCoord)); 47 | 48 | ///颜色合成 49 | FragColor = vec4((ambientColor + diffuseColor + specularColor) , 1.0); 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-1.定向光/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec3 lightColor; 4 | void main() 5 | { 6 | FragColor = vec4(lightColor,1.0); 7 | } 8 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-1.定向光/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | ///顶点坐标 3 | layout (location = 0) in vec3 aPos; 4 | ///顶点法向量 5 | layout (location = 1) in vec3 aNormal; 6 | ///顶点纹理坐标 7 | layout (location = 2) in vec2 aTexCoord; 8 | ///模型矩阵 9 | uniform mat4 model; 10 | ///观察矩阵 11 | uniform mat4 view; 12 | ///裁剪矩阵 13 | uniform mat4 projection; 14 | out vec3 normal; 15 | out vec3 fragPosition; 16 | out vec2 TexCoord; 17 | void main() 18 | { 19 | ///顶点裁剪坐标系坐标 20 | gl_Position = projection * view * model * vec4(aPos, 1.0); 21 | ///顶点世界坐标 22 | fragPosition = vec3(model * vec4(aPos,1.0)); 23 | ///经矩阵运算的法向量(防止模型变换后导致法向量不垂直) 24 | normal = mat3(transpose(inverse(model))) * aNormal; 25 | TexCoord = aTexCoord; 26 | } 27 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-1.定向光/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/5.投光物/5-1.定向光/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-1.定向光/OpenGL_Template/container2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/5.投光物/5-1.定向光/OpenGL_Template/container2.png -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-1.定向光/OpenGL_Template/container2_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/5.投光物/5-1.定向光/OpenGL_Template/container2_specular.png -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-2.点光源/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-2.点光源/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-2.点光源/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-2.点光源/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec3 lightColor; 4 | void main() 5 | { 6 | FragColor = vec4(lightColor,1.0); 7 | } 8 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-2.点光源/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | ///顶点坐标 3 | layout (location = 0) in vec3 aPos; 4 | ///顶点法向量 5 | layout (location = 1) in vec3 aNormal; 6 | ///顶点纹理坐标 7 | layout (location = 2) in vec2 aTexCoord; 8 | ///模型矩阵 9 | uniform mat4 model; 10 | ///观察矩阵 11 | uniform mat4 view; 12 | ///裁剪矩阵 13 | uniform mat4 projection; 14 | out vec3 normal; 15 | out vec3 fragPosition; 16 | out vec2 TexCoord; 17 | void main() 18 | { 19 | ///顶点裁剪坐标系坐标 20 | gl_Position = projection * view * model * vec4(aPos, 1.0); 21 | ///顶点世界坐标 22 | fragPosition = vec3(model * vec4(aPos,1.0)); 23 | ///经矩阵运算的法向量(防止模型变换后导致法向量不垂直) 24 | normal = mat3(transpose(inverse(model))) * aNormal; 25 | TexCoord = aTexCoord; 26 | } 27 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-2.点光源/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/5.投光物/5-2.点光源/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-2.点光源/OpenGL_Template/container2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/5.投光物/5-2.点光源/OpenGL_Template/container2.png -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-2.点光源/OpenGL_Template/container2_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/5.投光物/5-2.点光源/OpenGL_Template/container2_specular.png -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec3 lightColor; 4 | void main() 5 | { 6 | FragColor = vec4(lightColor,1.0); 7 | } 8 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | ///顶点坐标 3 | layout (location = 0) in vec3 aPos; 4 | ///顶点法向量 5 | layout (location = 1) in vec3 aNormal; 6 | ///顶点纹理坐标 7 | layout (location = 2) in vec2 aTexCoord; 8 | ///模型矩阵 9 | uniform mat4 model; 10 | ///观察矩阵 11 | uniform mat4 view; 12 | ///裁剪矩阵 13 | uniform mat4 projection; 14 | out vec3 normal; 15 | out vec3 fragPosition; 16 | out vec2 TexCoord; 17 | void main() 18 | { 19 | ///顶点裁剪坐标系坐标 20 | gl_Position = projection * view * model * vec4(aPos, 1.0); 21 | ///顶点世界坐标 22 | fragPosition = vec3(model * vec4(aPos,1.0)); 23 | ///经矩阵运算的法向量(防止模型变换后导致法向量不垂直) 24 | normal = mat3(transpose(inverse(model))) * aNormal; 25 | TexCoord = aTexCoord; 26 | } 27 | -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template/container2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template/container2.png -------------------------------------------------------------------------------- /光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template/container2_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/5.投光物/5-3.手电筒/OpenGL_Template/container2_specular.png -------------------------------------------------------------------------------- /光照/Demos/6.多光源/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /光照/Demos/6.多光源/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /光照/Demos/6.多光源/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /光照/Demos/6.多光源/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec3 lightColor; 4 | void main() 5 | { 6 | FragColor = vec4(lightColor,1.0); 7 | } 8 | -------------------------------------------------------------------------------- /光照/Demos/6.多光源/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | ///顶点坐标 3 | layout (location = 0) in vec3 aPos; 4 | ///顶点法向量 5 | layout (location = 1) in vec3 aNormal; 6 | ///顶点纹理坐标 7 | layout (location = 2) in vec2 aTexCoord; 8 | ///模型矩阵 9 | uniform mat4 model; 10 | ///观察矩阵 11 | uniform mat4 view; 12 | ///裁剪矩阵 13 | uniform mat4 projection; 14 | out vec3 normal; 15 | out vec3 fragPosition; 16 | out vec2 TexCoord; 17 | void main() 18 | { 19 | ///顶点裁剪坐标系坐标 20 | gl_Position = projection * view * model * vec4(aPos, 1.0); 21 | ///顶点世界坐标 22 | fragPosition = vec3(model * vec4(aPos,1.0)); 23 | ///经矩阵运算的法向量(防止模型变换后导致法向量不垂直) 24 | normal = mat3(transpose(inverse(model))) * aNormal; 25 | TexCoord = aTexCoord; 26 | } 27 | -------------------------------------------------------------------------------- /光照/Demos/6.多光源/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/6.多光源/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /光照/Demos/6.多光源/OpenGL_Template/container2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/6.多光源/OpenGL_Template/container2.png -------------------------------------------------------------------------------- /光照/Demos/6.多光源/OpenGL_Template/container2_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Demos/6.多光源/OpenGL_Template/container2_specular.png -------------------------------------------------------------------------------- /光照/Pics/手电筒.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Pics/手电筒.jpg -------------------------------------------------------------------------------- /光照/Pics/漫反射贴图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Pics/漫反射贴图.png -------------------------------------------------------------------------------- /光照/Pics/衰减公式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Pics/衰减公式.png -------------------------------------------------------------------------------- /光照/Pics/镜面光贴图.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/光照/Pics/镜面光贴图.png -------------------------------------------------------------------------------- /入门/1.OpenGL.md: -------------------------------------------------------------------------------- 1 | # 1.OpenGL 2 | OpenGL是一套协议,规定相同的函数实现获取相同的结果,而具体实现方式OpenGL并不关心,应由显卡厂商自行实现。 3 | 4 | ### 扩展 5 | OpenGL支持扩展特性。当显卡公司提出新特性或者渲染方面的优化,往往会以扩展方式在驱动中进行实现。开发者只需在调用出判断是否支持某个扩展即可调用扩展API。 6 | 7 | ### 状态机 8 | OpenGL本身是一个状态机,而他的状态则被称为`上下文`(context)。通常我们通过设置不同的状态,来改变渲染结果。 9 | 10 | ### 对象 11 | 在OpenGL中,对象是一系列选项的集合,它代表context的一个子集。例如我们可以用一个对象来描述当前窗口的大小等。 12 | 13 | sample: 14 | 15 | ``` 16 | // 创建对象 17 | unsigned int objectId = 0; 18 | glGenObject(1, &objectId); 19 | // 绑定对象至上下文 20 | glBindObject(GL_WINDOW_TARGET, objectId); 21 | // 设置当前绑定到 GL_WINDOW_TARGET 的对象的一些选项 22 | glSetObjectOption(GL_WINDOW_TARGET, GL_OPTION_WINDOW_WIDTH, 800); 23 | glSetObjectOption(GL_WINDOW_TARGET, GL_OPTION_WINDOW_HEIGHT, 600); 24 | // 将上下文对象设回默认 25 | glBindObject(GL_WINDOW_TARGET, 0); 26 | ``` 27 | 28 | > 上述代码中,我们首先声明了一个ID,再由glGenObject()创建一个对象,并将对象ID赋给objectId。对象本身由OpenGL维护,我们只能操作对象对应的ID给OpenGL,让其在操作指定对象。 29 | 30 | > 我们看到将对象绑定至context之后我们便开始操作OpenGL来设置对象的一些参数。设置结束后我们解绑对象。这样在以后的每一次要使用这个对象时,我们就可以直接使用,无需每次设置状态。这也是OpenGL引入对象概念的原因。 -------------------------------------------------------------------------------- /入门/10.复习.md: -------------------------------------------------------------------------------- 1 | # 10.复习 2 | 3 | 这一章主要复习一下先前我们学到的一些概念。 4 | 5 | ### 词汇表 6 | 7 | - OpenGL: 一个定义了函数布局和输出的图形API的正式规范。 8 | - GLAD: 一个拓展加载库,用来为我们加载并设定所有OpenGL函数指针,从而让我们能够使用所有(现代)OpenGL函数。 9 | - 视口(Viewport): 我们需要渲染的窗口。 10 | - 图形管线(Graphics Pipeline): 一个顶点在呈现为像素之前经过的全部过程。 11 | - 着色器(Shader): 一个运行在显卡上的小型程序。很多阶段的图形管道都可以使用自定义的着色器来代替原有的功能。 12 | - 标准化设备坐标(Normalized Device Coordinates, NDC): 顶点在通过在剪裁坐标系中剪裁与透视除法后最终呈现在的坐标系。所有位置在NDC下-1.0到1.0的顶点将不会被丢弃并且可见。 13 | - 顶点缓冲对象(Vertex Buffer Object): 一个调用显存并存储所有顶点数据供显卡使用的缓冲对象。 14 | - 顶点数组对象(Vertex Array Object): 存储缓冲区和顶点属性状态。 15 | - 索引缓冲对象(Element Buffer Object): 一个存储索引供索引化绘制使用的缓冲对象。 16 | - Uniform: 一个特殊类型的GLSL变量。它是全局的(在一个着色器程序中每一个着色器都能够访问uniform变量),并且只需要被设定一次。 17 | - 纹理(Texture): 一种包裹着物体的特殊类型图像,给物体精细的视觉效果。 18 | - 纹理缠绕(Texture Wrapping): 定义了一种当纹理顶点超出范围(0, 1)时指定OpenGL如何采样纹理的模式。 19 | - 纹理过滤(Texture Filtering): 定义了一种当有多种纹素选择时指定OpenGL如何采样纹理的模式。这通常在纹理被放大情况下发生。 20 | - 多级渐远纹理(Mipmaps): 被存储的材质的一些缩小版本,根据距观察者的距离会使用材质的合适大小。 21 | - stb_image.h: 图像加载库。 22 | - 纹理单元(Texture Units): 通过绑定纹理到不同纹理单元从而允许多个纹理在同一对象上渲染。 23 | - 向量(Vector): 一个定义了在空间中方向和/或位置的数学实体。 24 | - 矩阵(Matrix): 一个矩形阵列的数学表达式。 25 | - GLM: 一个为OpenGL打造的数学库。 26 | - 局部空间(Local Space): 一个物体的初始空间。所有的坐标都是相对于物体的原点的。 27 | - 世界空间(World Space): 所有的坐标都相对于全局原点。 28 | - 观察空间(View Space): 所有的坐标都是从摄像机的视角观察的。 29 | - 裁剪空间(Clip Space): 所有的坐标都是从摄像机视角观察的,但是该空间应用了投影。这个空间应该是一个顶点坐标最终的空间,作为顶点着色器的输出。OpenGL负责处理剩下的事情(裁剪/透视除法)。 30 | - 屏幕空间(Screen Space): 所有的坐标都由屏幕视角来观察。坐标的范围是从0到屏幕的宽/高。 31 | - LookAt矩阵: 一种特殊类型的观察矩阵,它创建了一个坐标系,其中所有坐标都根据从一个位置正在观察目标的用户旋转或者平移。 32 | - 欧拉角(Euler Angles): 被定义为偏航角(Yaw),俯仰角(Pitch),和滚转角(Roll)从而允许我们通过这三个值构造任何3D方向。 -------------------------------------------------------------------------------- /入门/Demos/3.绘制窗口/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/3.绘制窗口/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/3.绘制窗口/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /入门/Demos/4.绘制三角形/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/4.绘制三角形/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/4.绘制三角形/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-1.着色器(uniform)/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-1.着色器(uniform)/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-1.着色器(uniform)/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-2.着色器(layout)/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-2.着色器(layout)/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-2.着色器(layout)/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-3.着色器(Shader Class)/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-3.着色器(Shader Class)/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-3.着色器(Shader Class)/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-3.着色器(Shader Class)/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec4 ourColor; 4 | void main() 5 | { 6 | FragColor = ourColor; 7 | } 8 | -------------------------------------------------------------------------------- /入门/Demos/5.着色器/5-3.着色器(Shader Class)/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | void main() 4 | { 5 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 6 | } 7 | -------------------------------------------------------------------------------- /入门/Demos/6.纹理/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/6.纹理/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/6.纹理/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /入门/Demos/6.纹理/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | in float Img; 5 | in vec2 TexCoord; 6 | uniform sampler2D ourTexture; 7 | uniform sampler2D avatarTexture; 8 | uniform float factor; 9 | void main() 10 | { 11 | if (Img == 1.0) { 12 | FragColor = mix(texture(ourTexture, TexCoord),texture(avatarTexture, TexCoord),factor) * vec4(ourColor, 1.0); 13 | } else { 14 | FragColor = vec4(ourColor, 1.0); 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /入门/Demos/6.纹理/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | layout (location = 2) in float show; 5 | layout (location = 3) in vec2 aTexCoord; 6 | out vec3 ourColor; 7 | out float Img; 8 | out vec2 TexCoord; 9 | void main() 10 | { 11 | gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); 12 | ourColor = aColor; 13 | Img = show; 14 | TexCoord = aTexCoord; 15 | } 16 | -------------------------------------------------------------------------------- /入门/Demos/6.纹理/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/6.纹理/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /入门/Demos/6.纹理/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/6.纹理/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /入门/Demos/6.纹理/OpenGL_Template/container2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/6.纹理/OpenGL_Template/container2.png -------------------------------------------------------------------------------- /入门/Demos/7.变换/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/7.变换/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/7.变换/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /入门/Demos/7.变换/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | in float Img; 5 | in vec2 TexCoord; 6 | uniform sampler2D ourTexture; 7 | uniform sampler2D avatarTexture; 8 | uniform float factor; 9 | void main() 10 | { 11 | if (Img == 1.0) { 12 | FragColor = mix(texture(ourTexture, TexCoord),texture(avatarTexture, TexCoord),factor) * vec4(ourColor, 1.0); 13 | } else { 14 | FragColor = vec4(ourColor, 1.0); 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /入门/Demos/7.变换/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec2 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | layout (location = 2) in float show; 5 | layout (location = 3) in vec2 aTexCoord; 6 | out vec3 ourColor; 7 | out float Img; 8 | out vec2 TexCoord; 9 | uniform mat4 transform; 10 | void main() 11 | { 12 | gl_Position = transform * vec4(aPos.x, aPos.y, 0.0, 1.0); 13 | ourColor = aColor; 14 | Img = show; 15 | TexCoord = aTexCoord; 16 | } 17 | -------------------------------------------------------------------------------- /入门/Demos/7.变换/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/7.变换/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /入门/Demos/7.变换/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/7.变换/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /入门/Demos/8.坐标系统/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/8.坐标系统/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/8.坐标系统/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /入门/Demos/8.坐标系统/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | void main() 5 | { 6 | FragColor = vec4(ourColor, 1.0); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/8.坐标系统/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | out vec3 ourColor; 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | ourColor = aColor; 12 | } 13 | -------------------------------------------------------------------------------- /入门/Demos/8.坐标系统/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/8.坐标系统/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /入门/Demos/8.坐标系统/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/8.坐标系统/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-1.圆周运动/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-1.圆周运动/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-1.圆周运动/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-1.圆周运动/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | void main() 5 | { 6 | FragColor = vec4(ourColor, 1.0); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-1.圆周运动/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | out vec3 ourColor; 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | ourColor = aColor; 12 | } 13 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-1.圆周运动/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/9.摄像机/9-1.圆周运动/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-1.圆周运动/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/9.摄像机/9-1.圆周运动/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-2.水平运动/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-2.水平运动/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-2.水平运动/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-2.水平运动/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | void main() 5 | { 6 | FragColor = vec4(ourColor, 1.0); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-2.水平运动/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | out vec3 ourColor; 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | ourColor = aColor; 12 | } 13 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-2.水平运动/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/9.摄像机/9-2.水平运动/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-2.水平运动/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/9.摄像机/9-2.水平运动/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-3.摄像机类/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-3.摄像机类/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-3.摄像机类/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-3.摄像机类/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | in vec3 ourColor; 4 | void main() 5 | { 6 | FragColor = vec4(ourColor, 1.0); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-3.摄像机类/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | layout (location = 0) in vec3 aPos; 3 | layout (location = 1) in vec3 aColor; 4 | uniform mat4 model; 5 | uniform mat4 view; 6 | uniform mat4 projection; 7 | out vec3 ourColor; 8 | void main() 9 | { 10 | gl_Position = projection * view * model * vec4(aPos, 1.0); 11 | ourColor = aColor; 12 | } 13 | -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-3.摄像机类/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/9.摄像机/9-3.摄像机类/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /入门/Demos/9.摄像机/9-3.摄像机类/OpenGL_Template/container.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Demos/9.摄像机/9-3.摄像机类/OpenGL_Template/container.jpg -------------------------------------------------------------------------------- /入门/Pics/8.坐标系统_Fov.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/8.坐标系统_Fov.png -------------------------------------------------------------------------------- /入门/Pics/8.坐标系统_坐标转换_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/8.坐标系统_坐标转换_1.png -------------------------------------------------------------------------------- /入门/Pics/9.计算公式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/9.计算公式.png -------------------------------------------------------------------------------- /入门/Pics/仿射变换.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/仿射变换.png -------------------------------------------------------------------------------- /入门/Pics/位移.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/位移.png -------------------------------------------------------------------------------- /入门/Pics/单位向量.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/单位向量.png -------------------------------------------------------------------------------- /入门/Pics/单位矩阵.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/单位矩阵.png -------------------------------------------------------------------------------- /入门/Pics/单位矩阵乘向量.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/单位矩阵乘向量.png -------------------------------------------------------------------------------- /入门/Pics/叉乘计算公式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/叉乘计算公式.png -------------------------------------------------------------------------------- /入门/Pics/向量与标量运算.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/向量与标量运算.png -------------------------------------------------------------------------------- /入门/Pics/向量加减.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/向量加减.png -------------------------------------------------------------------------------- /入门/Pics/向量的长度.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/向量的长度.png -------------------------------------------------------------------------------- /入门/Pics/旋转.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/旋转.png -------------------------------------------------------------------------------- /入门/Pics/求夹角公式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/求夹角公式.png -------------------------------------------------------------------------------- /入门/Pics/点乘公式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/点乘公式.png -------------------------------------------------------------------------------- /入门/Pics/点乘计算方式.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/点乘计算方式.png -------------------------------------------------------------------------------- /入门/Pics/环绕.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/环绕.png -------------------------------------------------------------------------------- /入门/Pics/矩阵.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/矩阵.png -------------------------------------------------------------------------------- /入门/Pics/矩阵的加减法.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/矩阵的加减法.png -------------------------------------------------------------------------------- /入门/Pics/矩阵的数乘.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/矩阵的数乘.png -------------------------------------------------------------------------------- /入门/Pics/矩阵相乘.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/矩阵相乘.png -------------------------------------------------------------------------------- /入门/Pics/矩阵组合.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/矩阵组合.png -------------------------------------------------------------------------------- /入门/Pics/缩放变换.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/入门/Pics/缩放变换.png -------------------------------------------------------------------------------- /模型加载/1.Assimp.md: -------------------------------------------------------------------------------- 1 | # 1.Assimp 2 | 3 | 目前为止,我们已经可以绘制一个物体,并添加不同的光照效果了。但是我们的顶点数据太过简单,只能绘制简单的立方体。但是房子汽车这种不规则的形状我们的顶点数据就很难定制了。索性,这部分并不需要我们苦逼的开发人员去考虑。成熟的3D建模工具可以将设计师设计的模型导出模型文件,借助模型加载库就可以将他们转化为顶点数据。 4 | 5 | ### 模型加载库 6 | 7 | > 一个非常流行的模型导入库是Assimp,它是Open Asset Import Library(开放的资产导入库)的缩写。Assimp能够导入很多种不同的模型文件格式(并也能够导出部分的格式),它会将所有的模型数据加载至Assimp的通用数据结构中。当Assimp加载完模型之后,我们就能够从Assimp的数据结构中提取我们所需的所有数据了。由于Assimp的数据结构保持不变,不论导入的是什么种类的文件格式,它都能够将我们从这些不同的文件格式中抽象出来,用同一种方式访问我们需要的数据。 8 | 9 | 当使用Assimp导入一个模型的时候,它通常会将整个模型加载进一个场景(Scene)对象,它会包含导入的模型/场景中的所有数据。Assimp会将场景载入为一系列的节点(Node),每个节点包含了场景对象中所储存数据的索引,每个节点都可以有任意数量的子节点。Assimp数据结构的(简化)模型如下: 10 | 11 | ![场景](https://learnopengl-cn.github.io/img/03/01/assimp_structure.png) 12 | 13 | 这个结构图是一个模型在assimp中的基础结构,如果看不懂也没关系,到后面我们会频繁的使用它。 14 | 15 | ### 构建Assimp 16 | 17 | 你可以在Assimp的[下载页面](http://assimp.org/main_downloads.html)中选择相应的版本。然后就是编译成我们需要的对应的版本。这里我们还是使用cmake,我就不在赘述了,在最开始配置环境的章节我们已经介绍过。不过配置Assimp的时候可能会有一些坑,这里建议读者百度吧,一一介绍也没有意义。 18 | 19 | -------------------------------------------------------------------------------- /模型加载/Demos/2.网格/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /模型加载/Demos/2.网格/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec3 lightColor; 4 | void main() 5 | { 6 | FragColor = vec4(lightColor,1.0); 7 | } 8 | -------------------------------------------------------------------------------- /模型加载/Demos/2.网格/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | ///顶点坐标 3 | layout (location = 0) in vec3 aPos; 4 | ///顶点法向量 5 | layout (location = 1) in vec3 aNormal; 6 | ///顶点纹理坐标 7 | layout (location = 2) in vec2 aTexCoord; 8 | ///模型矩阵 9 | uniform mat4 model; 10 | ///观察矩阵 11 | uniform mat4 view; 12 | ///裁剪矩阵 13 | uniform mat4 projection; 14 | out vec3 normal; 15 | out vec3 fragPosition; 16 | out vec2 TexCoord; 17 | void main() 18 | { 19 | ///顶点裁剪坐标系坐标 20 | gl_Position = projection * view * model * vec4(aPos, 1.0); 21 | ///顶点世界坐标 22 | fragPosition = vec3(model * vec4(aPos,1.0)); 23 | ///经矩阵运算的法向量(防止模型变换后导致法向量不垂直) 24 | normal = mat3(transpose(inverse(model))) * aNormal; 25 | TexCoord = aTexCoord; 26 | } 27 | -------------------------------------------------------------------------------- /模型加载/Demos/2.网格/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/模型加载/Demos/2.网格/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /模型加载/Demos/2.网格/OpenGL_Template/container2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/模型加载/Demos/2.网格/OpenGL_Template/container2.png -------------------------------------------------------------------------------- /模型加载/Demos/2.网格/OpenGL_Template/container2_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/模型加载/Demos/2.网格/OpenGL_Template/container2_specular.png -------------------------------------------------------------------------------- /模型加载/Demos/3.模型/OpenGL_Template.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /模型加载/Demos/3.模型/OpenGL_Template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /模型加载/Demos/3.模型/OpenGL_Template.xcodeproj/xcuserdata/wicky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | OpenGL_Template.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 9BFCC7B62181AE5B00B99AE3 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /模型加载/Demos/3.模型/OpenGL_Template/Fragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | 4 | in vec2 TexCoords; 5 | 6 | uniform sampler2D texture_diffuse1; 7 | 8 | void main() 9 | { 10 | FragColor = texture(texture_diffuse1, TexCoords); 11 | } 12 | -------------------------------------------------------------------------------- /模型加载/Demos/3.模型/OpenGL_Template/LightFragment.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | out vec4 FragColor; 3 | uniform vec3 lightColor; 4 | void main() 5 | { 6 | FragColor = vec4(lightColor,1.0); 7 | } 8 | -------------------------------------------------------------------------------- /模型加载/Demos/3.模型/OpenGL_Template/Vertex.h: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | ///顶点坐标 3 | layout (location = 0) in vec3 aPos; 4 | ///顶点法向量 5 | layout (location = 1) in vec3 aNormal; 6 | ///顶点纹理坐标 7 | layout (location = 2) in vec2 aTexCoord; 8 | ///模型矩阵 9 | uniform mat4 model; 10 | ///观察矩阵 11 | uniform mat4 view; 12 | ///裁剪矩阵 13 | uniform mat4 projection; 14 | out vec3 normal; 15 | out vec3 fragPosition; 16 | out vec2 TexCoord; 17 | void main() 18 | { 19 | ///顶点裁剪坐标系坐标 20 | gl_Position = projection * view * model * vec4(aPos, 1.0); 21 | ///顶点世界坐标 22 | fragPosition = vec3(model * vec4(aPos,1.0)); 23 | ///经矩阵运算的法向量(防止模型变换后导致法向量不垂直) 24 | normal = mat3(transpose(inverse(model))) * aNormal; 25 | TexCoord = aTexCoord; 26 | } 27 | -------------------------------------------------------------------------------- /模型加载/Demos/3.模型/OpenGL_Template/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/模型加载/Demos/3.模型/OpenGL_Template/avatar.jpeg -------------------------------------------------------------------------------- /模型加载/Demos/3.模型/OpenGL_Template/container2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/模型加载/Demos/3.模型/OpenGL_Template/container2.png -------------------------------------------------------------------------------- /模型加载/Demos/3.模型/OpenGL_Template/container2_specular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeWicky/Learning-OpenGL/f778225d53bf40fe8ef87b73b46a4201a318b39f/模型加载/Demos/3.模型/OpenGL_Template/container2_specular.png --------------------------------------------------------------------------------