├── .gitignore ├── LICENSE.txt ├── README.md ├── opengl-series.sln ├── opengl-series.xcodeproj └── project.pbxproj ├── platforms ├── ios │ ├── 01_project_skeleton │ │ ├── article-01-skeleton.xcodeproj │ │ │ └── project.pbxproj │ │ ├── source │ │ │ ├── Program.cpp │ │ │ ├── Program.h │ │ │ ├── Shader.cpp │ │ │ ├── Shader.h │ │ │ ├── WLAppDelegate.h │ │ │ ├── WLAppDelegate.mm │ │ │ ├── WLViewController.h │ │ │ ├── WLViewController.mm │ │ │ ├── fragment-shader.txt │ │ │ ├── iOS_main.h │ │ │ ├── iOS_main.mm │ │ │ ├── main.m │ │ │ └── vertex-shader.txt │ │ └── sys │ │ │ ├── 01_project_skeleton-Info.plist │ │ │ ├── 01_project_skeleton-Prefix.pch │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default.png │ │ │ └── Default@2x.png │ ├── 02_textures │ │ ├── article-02-textures.xcodeproj │ │ │ └── project.pbxproj │ │ ├── resources │ │ │ ├── fragment-shader.txt │ │ │ ├── hazard.png │ │ │ └── vertex-shader.txt │ │ ├── source │ │ │ ├── iOS_main.h │ │ │ ├── iOS_main.mm │ │ │ ├── ios_specific │ │ │ │ ├── WLAppDelegate.h │ │ │ │ ├── WLAppDelegate.mm │ │ │ │ ├── WLViewController.h │ │ │ │ ├── WLViewController.mm │ │ │ │ └── main.m │ │ │ └── tdogl │ │ │ │ ├── Bitmap.cpp │ │ │ │ ├── Bitmap.h │ │ │ │ ├── Program.cpp │ │ │ │ ├── Program.h │ │ │ │ ├── Shader.cpp │ │ │ │ ├── Shader.h │ │ │ │ ├── Texture.cpp │ │ │ │ └── Texture.h │ │ ├── sys │ │ │ ├── 01_project_skeleton-Info.plist │ │ │ ├── 01_project_skeleton-Prefix.pch │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default.png │ │ │ └── Default@2x.png │ │ └── thirdparty │ │ │ └── stb_image │ │ │ └── stb_image.c │ ├── 03_matrices │ │ ├── 03_matrices.xcodeproj │ │ │ └── project.pbxproj │ │ ├── resources │ │ │ ├── fragment-shader.txt │ │ │ ├── vertex-shader.txt │ │ │ └── wooden-crate.jpg │ │ ├── source │ │ │ ├── iOS_main.h │ │ │ ├── iOS_main.mm │ │ │ ├── ios_specific │ │ │ │ ├── WLAppDelegate.h │ │ │ │ ├── WLAppDelegate.mm │ │ │ │ ├── WLViewController.h │ │ │ │ ├── WLViewController.mm │ │ │ │ └── main.m │ │ │ └── tdogl │ │ │ │ ├── Bitmap.cpp │ │ │ │ ├── Bitmap.h │ │ │ │ ├── Program.cpp │ │ │ │ ├── Program.h │ │ │ │ ├── Shader.cpp │ │ │ │ ├── Shader.h │ │ │ │ ├── Texture.cpp │ │ │ │ └── Texture.h │ │ ├── sys │ │ │ ├── 01_project_skeleton-Info.plist │ │ │ ├── 01_project_skeleton-Prefix.pch │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default.png │ │ │ └── Default@2x.png │ │ └── thirdparty │ │ │ └── stb_image │ │ │ └── stb_image.c │ ├── 04_camera │ │ ├── 04_camera.xcodeproj │ │ │ └── project.pbxproj │ │ ├── resources │ │ │ ├── fragment-shader.txt │ │ │ ├── vertex-shader.txt │ │ │ └── wooden-crate.jpg │ │ ├── source │ │ │ ├── iOS_main.h │ │ │ ├── iOS_main.mm │ │ │ ├── ios_specific │ │ │ │ ├── WLAppDelegate.h │ │ │ │ ├── WLAppDelegate.mm │ │ │ │ ├── WLViewController.h │ │ │ │ ├── WLViewController.mm │ │ │ │ └── main.m │ │ │ └── tdogl │ │ │ │ ├── Bitmap.cpp │ │ │ │ ├── Bitmap.h │ │ │ │ ├── Camera.cpp │ │ │ │ ├── Camera.h │ │ │ │ ├── Program.cpp │ │ │ │ ├── Program.h │ │ │ │ ├── Shader.cpp │ │ │ │ ├── Shader.h │ │ │ │ ├── Texture.cpp │ │ │ │ └── Texture.h │ │ ├── sys │ │ │ ├── 01_project_skeleton-Info.plist │ │ │ ├── 01_project_skeleton-Prefix.pch │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default.png │ │ │ └── Default@2x.png │ │ └── thirdparty │ │ │ └── stb_image │ │ │ └── stb_image.c │ ├── 05_asset_instance │ │ ├── 05_asset_instance.xcodeproj │ │ │ └── project.pbxproj │ │ ├── resources │ │ │ ├── fragment-shader.txt │ │ │ ├── vertex-shader.txt │ │ │ └── wooden-crate.jpg │ │ ├── source │ │ │ ├── iOS_main.h │ │ │ ├── iOS_main.mm │ │ │ ├── ios_specific │ │ │ │ ├── WLAppDelegate.h │ │ │ │ ├── WLAppDelegate.mm │ │ │ │ ├── WLViewController.h │ │ │ │ ├── WLViewController.mm │ │ │ │ └── main.m │ │ │ └── tdogl │ │ │ │ ├── Bitmap.cpp │ │ │ │ ├── Bitmap.h │ │ │ │ ├── Camera.cpp │ │ │ │ ├── Camera.h │ │ │ │ ├── Program.cpp │ │ │ │ ├── Program.h │ │ │ │ ├── Shader.cpp │ │ │ │ ├── Shader.h │ │ │ │ ├── Texture.cpp │ │ │ │ └── Texture.h │ │ ├── sys │ │ │ ├── 01_project_skeleton-Info.plist │ │ │ ├── 01_project_skeleton-Prefix.pch │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default.png │ │ │ └── Default@2x.png │ │ └── thirdparty │ │ │ └── stb_image │ │ │ └── stb_image.c │ └── 06_diffuse_lighting │ │ ├── 06_diffuse_lighting.xcodeproj │ │ └── project.pbxproj │ │ ├── resources │ │ ├── fragment-shader.txt │ │ ├── vertex-shader.txt │ │ └── wooden-crate.jpg │ │ ├── source │ │ ├── iOS_main.h │ │ ├── iOS_main.mm │ │ ├── ios_specific │ │ │ ├── WLAppDelegate.h │ │ │ ├── WLAppDelegate.mm │ │ │ ├── WLViewController.h │ │ │ ├── WLViewController.mm │ │ │ └── main.m │ │ └── tdogl │ │ │ ├── Bitmap.cpp │ │ │ ├── Bitmap.h │ │ │ ├── Camera.cpp │ │ │ ├── Camera.h │ │ │ ├── Program.cpp │ │ │ ├── Program.h │ │ │ ├── Shader.cpp │ │ │ ├── Shader.h │ │ │ ├── Texture.cpp │ │ │ └── Texture.h │ │ ├── sys │ │ ├── 01_project_skeleton-Info.plist │ │ ├── 01_project_skeleton-Prefix.pch │ │ ├── Default-568h@2x.png │ │ ├── Default.png │ │ └── Default@2x.png │ │ └── thirdparty │ │ └── stb_image │ │ └── stb_image.c ├── linux │ ├── 01_project_skeleton-app.make │ ├── 02_textures-app.make │ ├── 03_matrices-app.make │ ├── 04_camera-app.make │ ├── 05_asset_instance-app.make │ ├── 06_diffuse_lighting-app.make │ ├── 07_more_lighting-app.make │ ├── 08_even_more_lighting-app.make │ ├── Makefile │ ├── platform_linux.cpp │ └── premake4.lua ├── osx │ ├── libglfw3.a │ └── platform_osx.mm └── windows │ ├── 01_project_skeleton.vcxproj │ ├── 01_project_skeleton.vcxproj.filters │ ├── 02_textures.vcxproj │ ├── 02_textures.vcxproj.filters │ ├── 03_matrices.vcxproj │ ├── 03_matrices.vcxproj.filters │ ├── 04_camera.vcxproj │ ├── 04_camera.vcxproj.filters │ ├── 05_asset_instance.vcxproj │ ├── 05_asset_instance.vcxproj.filters │ ├── 06_diffuse_lighting.vcxproj │ ├── 06_diffuse_lighting.vcxproj.filters │ ├── 07_more_lighting.vcxproj │ ├── 07_more_lighting.vcxproj.filters │ ├── 08_even_more_lighting.vcxproj │ ├── 08_even_more_lighting.vcxproj.filters │ ├── glfw3.lib │ ├── platform_windows.cpp │ └── shared_build_settings.props └── source ├── 01_project_skeleton ├── resources │ ├── fragment-shader.txt │ └── vertex-shader.txt └── source │ ├── Program.cpp │ ├── Program.h │ ├── Shader.cpp │ ├── Shader.h │ └── main.cpp ├── 02_textures ├── resources │ ├── fragment-shader.txt │ ├── hazard.png │ └── vertex-shader.txt └── source │ ├── main.cpp │ └── tdogl │ ├── Bitmap.cpp │ ├── Bitmap.h │ ├── Program.cpp │ ├── Program.h │ ├── Shader.cpp │ ├── Shader.h │ ├── Texture.cpp │ └── Texture.h ├── 03_matrices ├── resources │ ├── fragment-shader.txt │ ├── vertex-shader.txt │ └── wooden-crate.jpg └── source │ ├── main.cpp │ └── tdogl │ ├── Bitmap.cpp │ ├── Bitmap.h │ ├── Program.cpp │ ├── Program.h │ ├── Shader.cpp │ ├── Shader.h │ ├── Texture.cpp │ └── Texture.h ├── 04_camera ├── resources │ ├── fragment-shader.txt │ ├── vertex-shader.txt │ └── wooden-crate.jpg └── source │ ├── main.cpp │ └── tdogl │ ├── Bitmap.cpp │ ├── Bitmap.h │ ├── Camera.cpp │ ├── Camera.h │ ├── Program.cpp │ ├── Program.h │ ├── Shader.cpp │ ├── Shader.h │ ├── Texture.cpp │ └── Texture.h ├── 05_asset_instance ├── resources │ ├── fragment-shader.txt │ ├── vertex-shader.txt │ └── wooden-crate.jpg └── source │ ├── main.cpp │ └── tdogl │ ├── Bitmap.cpp │ ├── Bitmap.h │ ├── Camera.cpp │ ├── Camera.h │ ├── Program.cpp │ ├── Program.h │ ├── Shader.cpp │ ├── Shader.h │ ├── Texture.cpp │ └── Texture.h ├── 06_diffuse_lighting ├── resources │ ├── fragment-shader.txt │ ├── vertex-shader.txt │ └── wooden-crate.jpg └── source │ ├── main.cpp │ └── tdogl │ ├── Bitmap.cpp │ ├── Bitmap.h │ ├── Camera.cpp │ ├── Camera.h │ ├── Program.cpp │ ├── Program.h │ ├── Shader.cpp │ ├── Shader.h │ ├── Texture.cpp │ └── Texture.h ├── 07_more_lighting ├── resources │ ├── fragment-shader.txt │ ├── vertex-shader.txt │ └── wooden-crate.jpg └── source │ ├── main.cpp │ └── tdogl │ ├── Bitmap.cpp │ ├── Bitmap.h │ ├── Camera.cpp │ ├── Camera.h │ ├── Program.cpp │ ├── Program.h │ ├── Shader.cpp │ ├── Shader.h │ ├── Texture.cpp │ └── Texture.h ├── 08_even_more_lighting ├── resources │ ├── fragment-shader.txt │ ├── vertex-shader.txt │ └── wooden-crate.jpg └── source │ ├── main.cpp │ └── tdogl │ ├── Bitmap.cpp │ ├── Bitmap.h │ ├── Camera.cpp │ ├── Camera.h │ ├── Program.cpp │ ├── Program.h │ ├── Shader.cpp │ ├── Shader.h │ ├── Texture.cpp │ └── Texture.h └── common ├── platform.hpp └── thirdparty ├── glew ├── LICENSE.txt ├── include │ └── GL │ │ ├── glew.h │ │ ├── glxew.h │ │ └── wglew.h └── src │ ├── glew.c │ ├── glewinfo.c │ └── visualinfo.c ├── glfw ├── COPYING.txt └── include │ └── GLFW │ ├── glfw3.h │ └── glfw3native.h ├── glm ├── copying.txt ├── glm │ ├── common.hpp │ ├── detail │ │ ├── _features.hpp │ │ ├── _fixes.hpp │ │ ├── _literals.hpp │ │ ├── _noise.hpp │ │ ├── _swizzle.hpp │ │ ├── _swizzle_func.hpp │ │ ├── _vectorize.hpp │ │ ├── dummy.cpp │ │ ├── func_common.hpp │ │ ├── func_common.inl │ │ ├── func_exponential.hpp │ │ ├── func_exponential.inl │ │ ├── func_geometric.hpp │ │ ├── func_geometric.inl │ │ ├── func_integer.hpp │ │ ├── func_integer.inl │ │ ├── func_matrix.hpp │ │ ├── func_matrix.inl │ │ ├── func_noise.hpp │ │ ├── func_noise.inl │ │ ├── func_packing.hpp │ │ ├── func_packing.inl │ │ ├── func_trigonometric.hpp │ │ ├── func_trigonometric.inl │ │ ├── func_vector_relational.hpp │ │ ├── func_vector_relational.inl │ │ ├── glm.cpp │ │ ├── hint.hpp │ │ ├── intrinsic_common.hpp │ │ ├── intrinsic_common.inl │ │ ├── intrinsic_exponential.hpp │ │ ├── intrinsic_exponential.inl │ │ ├── intrinsic_geometric.hpp │ │ ├── intrinsic_geometric.inl │ │ ├── intrinsic_integer.hpp │ │ ├── intrinsic_integer.inl │ │ ├── intrinsic_matrix.hpp │ │ ├── intrinsic_matrix.inl │ │ ├── intrinsic_trigonometric.hpp │ │ ├── intrinsic_trigonometric.inl │ │ ├── intrinsic_vector_relational.hpp │ │ ├── intrinsic_vector_relational.inl │ │ ├── precision.hpp │ │ ├── precision.inl │ │ ├── setup.hpp │ │ ├── type_float.hpp │ │ ├── type_gentype.hpp │ │ ├── type_gentype.inl │ │ ├── type_half.hpp │ │ ├── type_half.inl │ │ ├── type_int.hpp │ │ ├── type_mat.hpp │ │ ├── type_mat.inl │ │ ├── type_mat2x2.hpp │ │ ├── type_mat2x2.inl │ │ ├── type_mat2x3.hpp │ │ ├── type_mat2x3.inl │ │ ├── type_mat2x4.hpp │ │ ├── type_mat2x4.inl │ │ ├── type_mat3x2.hpp │ │ ├── type_mat3x2.inl │ │ ├── type_mat3x3.hpp │ │ ├── type_mat3x3.inl │ │ ├── type_mat3x4.hpp │ │ ├── type_mat3x4.inl │ │ ├── type_mat4x2.hpp │ │ ├── type_mat4x2.inl │ │ ├── type_mat4x3.hpp │ │ ├── type_mat4x3.inl │ │ ├── type_mat4x4.hpp │ │ ├── type_mat4x4.inl │ │ ├── type_vec.hpp │ │ ├── type_vec.inl │ │ ├── type_vec1.hpp │ │ ├── type_vec1.inl │ │ ├── type_vec2.hpp │ │ ├── type_vec2.inl │ │ ├── type_vec3.hpp │ │ ├── type_vec3.inl │ │ ├── type_vec4.hpp │ │ └── type_vec4.inl │ ├── exponential.hpp │ ├── ext.hpp │ ├── fwd.hpp │ ├── geometric.hpp │ ├── glm.hpp │ ├── gtc │ │ ├── constants.hpp │ │ ├── constants.inl │ │ ├── epsilon.hpp │ │ ├── epsilon.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 │ │ ├── random.hpp │ │ ├── random.inl │ │ ├── reciprocal.hpp │ │ ├── reciprocal.inl │ │ ├── type_precision.hpp │ │ ├── type_precision.inl │ │ ├── type_ptr.hpp │ │ ├── type_ptr.inl │ │ ├── ulp.hpp │ │ └── ulp.inl │ ├── gtx │ │ ├── associated_min_max.hpp │ │ ├── associated_min_max.inl │ │ ├── bit.hpp │ │ ├── bit.inl │ │ ├── closest_point.hpp │ │ ├── closest_point.inl │ │ ├── color_space.hpp │ │ ├── color_space.inl │ │ ├── color_space_YCoCg.hpp │ │ ├── color_space_YCoCg.inl │ │ ├── compatibility.hpp │ │ ├── compatibility.inl │ │ ├── component_wise.hpp │ │ ├── component_wise.inl │ │ ├── constants.hpp │ │ ├── dual_quaternion.hpp │ │ ├── dual_quaternion.inl │ │ ├── epsilon.hpp │ │ ├── euler_angles.hpp │ │ ├── euler_angles.inl │ │ ├── extend.hpp │ │ ├── extend.inl │ │ ├── extented_min_max.hpp │ │ ├── extented_min_max.inl │ │ ├── fast_exponential.hpp │ │ ├── fast_exponential.inl │ │ ├── fast_square_root.hpp │ │ ├── fast_square_root.inl │ │ ├── fast_trigonometry.hpp │ │ ├── fast_trigonometry.inl │ │ ├── gradient_paint.hpp │ │ ├── gradient_paint.inl │ │ ├── handed_coordinate_space.hpp │ │ ├── handed_coordinate_space.inl │ │ ├── inertia.hpp │ │ ├── inertia.inl │ │ ├── int_10_10_10_2.hpp │ │ ├── int_10_10_10_2.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_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 │ │ ├── multiple.hpp │ │ ├── multiple.inl │ │ ├── noise.hpp │ │ ├── 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 │ │ ├── random.hpp │ │ ├── raw_data.hpp │ │ ├── raw_data.inl │ │ ├── reciprocal.hpp │ │ ├── rotate_normalized_axis.hpp │ │ ├── rotate_normalized_axis.inl │ │ ├── rotate_vector.hpp │ │ ├── rotate_vector.inl │ │ ├── scalar_relational.hpp │ │ ├── scalar_relational.inl │ │ ├── simd_mat4.hpp │ │ ├── simd_mat4.inl │ │ ├── simd_quat.hpp │ │ ├── simd_quat.inl │ │ ├── simd_vec4.hpp │ │ ├── simd_vec4.inl │ │ ├── spline.hpp │ │ ├── spline.inl │ │ ├── std_based_type.hpp │ │ ├── std_based_type.inl │ │ ├── string_cast.hpp │ │ ├── string_cast.inl │ │ ├── transform.hpp │ │ ├── transform.inl │ │ ├── transform2.hpp │ │ ├── transform2.inl │ │ ├── ulp.hpp │ │ ├── unsigned_int.hpp │ │ ├── unsigned_int.inl │ │ ├── vec1.hpp │ │ ├── vec1.inl │ │ ├── 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 │ ├── trigonometric.hpp │ ├── vec2.hpp │ ├── vec3.hpp │ ├── vec4.hpp │ └── vector_relational.hpp └── readme.txt └── stb_image └── stb_image.h /.gitignore: -------------------------------------------------------------------------------- 1 | # VC++ crap 2 | *.suo 3 | *.vcxproj.user 4 | *.sdf 5 | *.opensdf 6 | *.VC.db 7 | **/Debug/ 8 | 9 | # Xcode crap 10 | *.xcodeproj/* 11 | !*.xcodeproj/project.pbxproj 12 | build/ 13 | 14 | # linux build output 15 | platforms/linux/*/bin/ 16 | platforms/linux/*/obj/ 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | This is a repository of open-source code to accompany a series of OpenGL articles on 4 | http://tomdalling.com/ 5 | 6 | List of articles: 7 | 8 | 1. [Getting Started in Xcode, Visual C++, and Linux](http://tomdalling.com/blog/modern-opengl/01-getting-started-in-xcode-and-visual-cpp/) 9 | 2. [Textures](http://tomdalling.com/blog/modern-opengl/02-textures/) 10 | 3. [Matrices, Depth Buffering, Animation](http://tomdalling.com/blog/modern-opengl/03-matrices-depth-buffering-animation/) 11 | 4. [Cameras, Vectors & Input](http://tomdalling.com/blog/modern-opengl/04-cameras-vectors-and-input/) 12 | 5. [Model Assets & Instances](http://tomdalling.com/blog/modern-opengl/05-model-assets-and-instances/) 13 | 6. [Diffuse Point Lighting](http://tomdalling.com/blog/modern-opengl/06-diffuse-point-lighting/) 14 | 7. [More Lighting: Ambient, Specular, Attenuation, Gamma](http://tomdalling.com/blog/modern-opengl/07-more-lighting-ambient-specular-attenuation-gamma/) 15 | 8. [Even More Lighting: Directional Lights, Spotlights, & Multiple Lights](http://www.tomdalling.com/blog/modern-opengl/08-even-more-lighting-directional-lights-spotlights-multiple-lights/) 16 | 17 | # Ports & Related Resources 18 | 19 | - Migration notes for iOS with OpenGLES 2.0: http://whackylabs.com/rants/?p=769 20 | - A C# port of the articles: https://github.com/ZeronSix/opengl-series-csharp 21 | 22 | # Credits 23 | 24 | Thanks to Martin (SpartanJ) Golini for the Linux ports. 25 | 26 | Thanks to Sidharth Juyal of [Whacky Labs](http://whackylabs.com/) for 27 | the iOS ports. 28 | 29 | Thanks to Vyacheslav (ZeronSix) Zeronov for the C# port. 30 | 31 | # License 32 | 33 | Licensed under the Apache License, Version 2.0. See LICENSE.txt. 34 | -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/source/Program.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Program 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "Shader.h" 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL program made by linking shaders. 28 | */ 29 | class Program { 30 | public: 31 | /** 32 | Creates a program by linking a list of tdogl::Shader objects 33 | 34 | @param shaders The shaders to link together to make the program 35 | 36 | @throws std::exception if an error occurs. 37 | 38 | @see tdogl::Shader 39 | */ 40 | Program(const std::vector& shaders); 41 | ~Program(); 42 | 43 | 44 | /** 45 | @result The program's object id, as returned from glCreateProgram 46 | */ 47 | GLuint object() const; 48 | 49 | 50 | /** 51 | @result The attribute index for the given name, as returned from glGetAttribLocation. 52 | */ 53 | GLint attrib(const GLchar* attribName) const; 54 | 55 | 56 | /** 57 | @result The uniform index for the given name, as returned from glGetUniformLocation. 58 | */ 59 | GLint uniform(const GLchar* uniformName) const; 60 | 61 | 62 | private: 63 | GLuint _object; 64 | 65 | //copying disabled 66 | Program(const Program&); 67 | const Program& operator=(const Program&); 68 | }; 69 | 70 | } 71 | -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/source/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Shader 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents a compiled OpenGL shader. 28 | */ 29 | class Shader { 30 | public: 31 | 32 | /** 33 | Creates a shader from a text file. 34 | 35 | @param filePath The path to the text file containing the shader source. 36 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 37 | or GL_FRAGMENT_SHADER. 38 | 39 | @throws std::exception if an error occurs. 40 | */ 41 | static Shader shaderFromFile(const std::string& filePath, GLenum shaderType); 42 | 43 | 44 | /** 45 | Creates a shader from a string of shader source code. 46 | 47 | @param shaderCode The source code for the shader. 48 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 49 | or GL_FRAGMENT_SHADER. 50 | 51 | @throws std::exception if an error occurs. 52 | */ 53 | Shader(const std::string& shaderCode, GLenum shaderType); 54 | 55 | 56 | /** 57 | @result The shader's object ID, as returned from glCreateShader 58 | */ 59 | GLuint object() const; 60 | 61 | // tdogl::Shader objects can be copied and assigned because they are reference counted 62 | // like a shared pointer 63 | Shader(const Shader& other); 64 | Shader& operator =(const Shader& other); 65 | ~Shader(); 66 | 67 | private: 68 | GLuint _object; 69 | unsigned* _refCount; 70 | 71 | void _retain(); 72 | void _release(); 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/source/WLAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLAppDelegate.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class WLViewController; 12 | 13 | @interface WLAppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) WLViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/source/WLViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLViewController.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface WLViewController : GLKViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/source/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | void main() { 4 | //set every drawn pixel to white 5 | gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); 6 | } -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/source/iOS_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // iOS_main.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #ifndef _1_project_skeleton_iOS_main_h 10 | #define _1_project_skeleton_iOS_main_h 11 | 12 | // third-party libraries 13 | #include 14 | 15 | extern glm::vec2 SCREEN_SIZE; 16 | int iOS_main(); 17 | void Render(); 18 | #endif 19 | -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/source/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "WLAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([WLAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/source/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | attribute vec3 vert; 4 | 5 | void main() { 6 | // does not alter the verticies at all 7 | gl_Position = vec4(vert, 1); 8 | } -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/sys/01_project_skeleton-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.whackylabs.test.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/sys/01_project_skeleton-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the '01_project_skeleton' target in the '01_project_skeleton' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/sys/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/01_project_skeleton/sys/Default-568h@2x.png -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/sys/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/01_project_skeleton/sys/Default.png -------------------------------------------------------------------------------- /platforms/ios/01_project_skeleton/sys/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/01_project_skeleton/sys/Default@2x.png -------------------------------------------------------------------------------- /platforms/ios/02_textures/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | uniform sampler2D tex; 4 | 5 | varying highp vec2 fragTexCoord; 6 | 7 | void main() { 8 | gl_FragColor = texture2D(tex, fragTexCoord); 9 | } -------------------------------------------------------------------------------- /platforms/ios/02_textures/resources/hazard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/02_textures/resources/hazard.png -------------------------------------------------------------------------------- /platforms/ios/02_textures/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | attribute vec3 vert; 4 | attribute vec2 vertTexCoord; 5 | 6 | varying vec2 fragTexCoord; 7 | 8 | void main() { 9 | // Pass the tex coord straight through to the fragment shader 10 | fragTexCoord = vertTexCoord; 11 | 12 | gl_Position = vec4(vert, 1); 13 | } -------------------------------------------------------------------------------- /platforms/ios/02_textures/source/iOS_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // iOS_main.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #ifndef _1_project_skeleton_iOS_main_h 10 | #define _1_project_skeleton_iOS_main_h 11 | 12 | // third-party libraries 13 | #include 14 | 15 | extern glm::vec2 SCREEN_SIZE; 16 | int iOS_main(); 17 | void Render(); 18 | #endif 19 | -------------------------------------------------------------------------------- /platforms/ios/02_textures/source/ios_specific/WLAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLAppDelegate.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class WLViewController; 12 | 13 | @interface WLAppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) WLViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /platforms/ios/02_textures/source/ios_specific/WLViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLViewController.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface WLViewController : GLKViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /platforms/ios/02_textures/source/ios_specific/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "WLAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([WLAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /platforms/ios/02_textures/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /platforms/ios/02_textures/sys/01_project_skeleton-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.whackylabs.test.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /platforms/ios/02_textures/sys/01_project_skeleton-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the '01_project_skeleton' target in the '01_project_skeleton' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /platforms/ios/02_textures/sys/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/02_textures/sys/Default-568h@2x.png -------------------------------------------------------------------------------- /platforms/ios/02_textures/sys/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/02_textures/sys/Default.png -------------------------------------------------------------------------------- /platforms/ios/02_textures/sys/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/02_textures/sys/Default@2x.png -------------------------------------------------------------------------------- /platforms/ios/03_matrices/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | uniform sampler2D tex; 4 | 5 | varying highp vec2 fragTexCoord; 6 | 7 | void main() { 8 | //note: the texture function was called texture2D in older versions of GLSL 9 | gl_FragColor = texture2D(tex, fragTexCoord); 10 | } -------------------------------------------------------------------------------- /platforms/ios/03_matrices/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | uniform mat4 projection; 4 | uniform mat4 camera; 5 | uniform mat4 model; 6 | 7 | attribute vec3 vert; 8 | attribute vec2 vertTexCoord; 9 | 10 | varying vec2 fragTexCoord; 11 | 12 | void main() { 13 | // Pass the tex coord straight through to the fragment shader 14 | fragTexCoord = vertTexCoord; 15 | 16 | // Apply all matrix transformations to vert 17 | gl_Position = projection * camera * model * vec4(vert, 1); 18 | } -------------------------------------------------------------------------------- /platforms/ios/03_matrices/resources/wooden-crate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/03_matrices/resources/wooden-crate.jpg -------------------------------------------------------------------------------- /platforms/ios/03_matrices/source/iOS_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // iOS_main.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #ifndef _1_project_skeleton_iOS_main_h 10 | #define _1_project_skeleton_iOS_main_h 11 | 12 | // third-party libraries 13 | #include 14 | 15 | extern glm::vec2 SCREEN_SIZE; 16 | int iOS_main(); 17 | void Render(); 18 | void Update(float secondsElapsed); 19 | #endif 20 | -------------------------------------------------------------------------------- /platforms/ios/03_matrices/source/ios_specific/WLAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLAppDelegate.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class WLViewController; 12 | 13 | @interface WLAppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) WLViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /platforms/ios/03_matrices/source/ios_specific/WLViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLViewController.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface WLViewController : GLKViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /platforms/ios/03_matrices/source/ios_specific/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "WLAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([WLAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /platforms/ios/03_matrices/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /platforms/ios/03_matrices/sys/01_project_skeleton-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.whackylabs.test.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /platforms/ios/03_matrices/sys/01_project_skeleton-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the '01_project_skeleton' target in the '01_project_skeleton' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /platforms/ios/03_matrices/sys/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/03_matrices/sys/Default-568h@2x.png -------------------------------------------------------------------------------- /platforms/ios/03_matrices/sys/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/03_matrices/sys/Default.png -------------------------------------------------------------------------------- /platforms/ios/03_matrices/sys/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/03_matrices/sys/Default@2x.png -------------------------------------------------------------------------------- /platforms/ios/04_camera/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | uniform sampler2D tex; 4 | 5 | varying highp vec2 fragTexCoord; 6 | 7 | void main() { 8 | //note: the texture function was called texture2D in older versions of GLSL 9 | gl_FragColor = texture2D(tex, fragTexCoord); 10 | } -------------------------------------------------------------------------------- /platforms/ios/04_camera/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | uniform mat4 camera; 4 | uniform mat4 model; 5 | 6 | attribute vec3 vert; 7 | attribute vec2 vertTexCoord; 8 | 9 | varying vec2 fragTexCoord; 10 | 11 | void main() { 12 | // Pass the tex coord straight through to the fragment shader 13 | fragTexCoord = vertTexCoord; 14 | 15 | // Apply all matrix transformations to vert 16 | gl_Position = camera * model * vec4(vert, 1); 17 | } -------------------------------------------------------------------------------- /platforms/ios/04_camera/resources/wooden-crate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/04_camera/resources/wooden-crate.jpg -------------------------------------------------------------------------------- /platforms/ios/04_camera/source/iOS_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // iOS_main.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #ifndef _1_project_skeleton_iOS_main_h 10 | #define _1_project_skeleton_iOS_main_h 11 | 12 | // third-party libraries 13 | #include 14 | 15 | typedef enum{ 16 | eGesture_Move_Forward, //W 17 | eGesture_Move_Back, //S 18 | eGesture_Move_Left, //A 19 | eGesture_Move_Right, //D 20 | eGesture_Move_Up, //Z 21 | eGesture_Move_Down, //X 22 | eGesture_None 23 | }eGesture; 24 | 25 | extern glm::vec2 SCREEN_SIZE; 26 | int iOS_main(); 27 | void Render(); 28 | void Update(float secondsElapsed); 29 | void RegisterGesture(eGesture g); 30 | #endif 31 | -------------------------------------------------------------------------------- /platforms/ios/04_camera/source/ios_specific/WLAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLAppDelegate.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class WLViewController; 12 | 13 | @interface WLAppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) WLViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /platforms/ios/04_camera/source/ios_specific/WLViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLViewController.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface WLViewController : GLKViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /platforms/ios/04_camera/source/ios_specific/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "WLAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([WLAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /platforms/ios/04_camera/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /platforms/ios/04_camera/sys/01_project_skeleton-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.whackylabs.test.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /platforms/ios/04_camera/sys/01_project_skeleton-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the '01_project_skeleton' target in the '01_project_skeleton' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /platforms/ios/04_camera/sys/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/04_camera/sys/Default-568h@2x.png -------------------------------------------------------------------------------- /platforms/ios/04_camera/sys/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/04_camera/sys/Default.png -------------------------------------------------------------------------------- /platforms/ios/04_camera/sys/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/04_camera/sys/Default@2x.png -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | uniform sampler2D tex; 4 | 5 | varying highp vec2 fragTexCoord; 6 | 7 | void main() { 8 | //note: the texture function was called texture2D in older versions of GLSL 9 | gl_FragColor = texture2D(tex, fragTexCoord); 10 | } -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | uniform mat4 camera; 4 | uniform mat4 model; 5 | 6 | attribute vec3 vert; 7 | attribute vec2 vertTexCoord; 8 | 9 | varying vec2 fragTexCoord; 10 | 11 | void main() { 12 | // Pass the tex coord straight through to the fragment shader 13 | fragTexCoord = vertTexCoord; 14 | 15 | // Apply all matrix transformations to vert 16 | gl_Position = camera * model * vec4(vert, 1); 17 | } -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/resources/wooden-crate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/05_asset_instance/resources/wooden-crate.jpg -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/source/iOS_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // iOS_main.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #ifndef _1_project_skeleton_iOS_main_h 10 | #define _1_project_skeleton_iOS_main_h 11 | 12 | // third-party libraries 13 | #include 14 | 15 | typedef enum{ 16 | eGesture_Move_Forward, //W 17 | eGesture_Move_Back, //S 18 | eGesture_Move_Left, //A 19 | eGesture_Move_Right, //D 20 | eGesture_Move_Up, //Z 21 | eGesture_Move_Down, //X 22 | eGesture_None 23 | }eGesture; 24 | 25 | extern glm::vec2 SCREEN_SIZE; 26 | int iOS_main(); 27 | void Render(); 28 | void Update(float secondsElapsed); 29 | void RegisterGesture(eGesture g); 30 | #endif 31 | -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/source/ios_specific/WLAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLAppDelegate.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class WLViewController; 12 | 13 | @interface WLAppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) WLViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/source/ios_specific/WLViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLViewController.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface WLViewController : GLKViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/source/ios_specific/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "WLAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([WLAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/sys/01_project_skeleton-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.whackylabs.test.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/sys/01_project_skeleton-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the '01_project_skeleton' target in the '01_project_skeleton' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/sys/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/05_asset_instance/sys/Default-568h@2x.png -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/sys/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/05_asset_instance/sys/Default.png -------------------------------------------------------------------------------- /platforms/ios/05_asset_instance/sys/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/05_asset_instance/sys/Default@2x.png -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | precision highp float; 4 | 5 | uniform mat4 model; 6 | uniform sampler2D tex; 7 | uniform mat3 normalMatrix; 8 | 9 | uniform struct Light { 10 | vec3 position; 11 | vec3 intensities; //a.k.a the color of the light 12 | } light; 13 | 14 | varying vec2 fragTexCoord; 15 | varying vec3 fragNormal; 16 | varying vec3 fragVert; 17 | 18 | void main() { 19 | //calculate normal in world coordinates 20 | //mat3 normalMatrix = transpose(inverse(mat3(model))); 21 | vec3 normal = normalize(normalMatrix * fragNormal); 22 | 23 | //calculate the location of this fragment (pixel) in world coordinates 24 | vec3 fragPosition = vec3(model * vec4(fragVert, 1)); 25 | 26 | //calculate the vector from this pixels surface to the light source 27 | vec3 surfaceToLight = light.position - fragPosition; 28 | 29 | //calculate the cosine of the angle of incidence 30 | float brightness = dot(normal, surfaceToLight) / (length(surfaceToLight) * length(normal)); 31 | brightness = clamp(brightness, 0.0, 1.0); 32 | 33 | //calculate final color of the pixel, based on: 34 | // 1. The angle of incidence: brightness 35 | // 2. The color/intensities of the light: light.intensities 36 | // 3. The texture and texture coord: texture(tex, fragTexCoord) 37 | gl_FragColor = brightness * vec4(light.intensities, 1) * texture2D(tex, fragTexCoord); 38 | } -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 100 2 | 3 | uniform mat4 camera; 4 | uniform mat4 model; 5 | 6 | attribute vec3 vert; 7 | attribute vec2 vertTexCoord; 8 | attribute vec3 vertNormal; 9 | 10 | varying vec3 fragVert; 11 | varying vec2 fragTexCoord; 12 | varying vec3 fragNormal; 13 | 14 | void main() { 15 | // Pass some variables to the fragment shader 16 | fragTexCoord = vertTexCoord; 17 | fragNormal = vertNormal; 18 | fragVert = vert; 19 | 20 | // Apply all matrix transformations to vert 21 | gl_Position = camera * model * vec4(vert, 1); 22 | } -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/resources/wooden-crate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/06_diffuse_lighting/resources/wooden-crate.jpg -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/source/iOS_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // iOS_main.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #ifndef _1_project_skeleton_iOS_main_h 10 | #define _1_project_skeleton_iOS_main_h 11 | 12 | // third-party libraries 13 | #include 14 | 15 | const float DEFAULT_MOVE_SPEED = 2.0; //units per second 16 | 17 | typedef enum{ 18 | eW, //W 19 | eS, //S 20 | eA, //A 21 | eD, //D 22 | eZoomIn, 23 | eZoomOut, 24 | eDrag, 25 | eNone 26 | }eGestureAction; 27 | 28 | struct Gesture_{ 29 | int fingers; 30 | int taps; 31 | eGestureAction action; 32 | bool continious; 33 | }; 34 | typedef struct Gesture_ Gesture; 35 | 36 | extern Gesture gGesture; 37 | extern glm::vec2 SCREEN_SIZE; 38 | extern float gMoveSpeed; 39 | extern glm::vec2 gDragPoint; 40 | 41 | int iOS_main(); 42 | void Render(); 43 | void Update(float secondsElapsed); 44 | #endif 45 | -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/source/ios_specific/WLAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLAppDelegate.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class WLViewController; 12 | 13 | @interface WLAppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | 17 | @property (strong, nonatomic) WLViewController *viewController; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/source/ios_specific/WLViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // WLViewController.h 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface WLViewController : GLKViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/source/ios_specific/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 01_project_skeleton 4 | // 5 | // Created by Sid on 17/03/13. 6 | // Copyright (c) 2013 whackylabs. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "WLAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([WLAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/sys/01_project_skeleton-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.whackylabs.test.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/sys/01_project_skeleton-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the '01_project_skeleton' target in the '01_project_skeleton' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/sys/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/06_diffuse_lighting/sys/Default-568h@2x.png -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/sys/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/06_diffuse_lighting/sys/Default.png -------------------------------------------------------------------------------- /platforms/ios/06_diffuse_lighting/sys/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/ios/06_diffuse_lighting/sys/Default@2x.png -------------------------------------------------------------------------------- /platforms/linux/premake4.lua: -------------------------------------------------------------------------------- 1 | function create_project( name ) 2 | project( name .. "-app" ) 3 | kind "WindowedApp" 4 | language "C++" 5 | files { "../../source/" .. name .. "/source/**.cpp", "platform_linux.cpp" } 6 | targetdir("../../source/" .. name .. "/") 7 | includedirs( "../../source/common/" ) 8 | includedirs( "../../source/common/thirdparty/glm" ) 9 | includedirs( "../../source/common/thirdparty/stb_image" ) 10 | defines { "GLM_FORCE_RADIANS" } 11 | 12 | configuration "windows" 13 | links {"glu32", "opengl32", "gdi32", "winmm", "user32","GLEW"} 14 | 15 | configuration "linux" 16 | links {"GL","glfw","GLEW"} 17 | 18 | configuration "macosx" 19 | links {"GL","glfw","GLEW", "CoreFoundation.framework"} 20 | libdirs {"/opt/local/lib"} 21 | includedirs {"/opt/local/include"} 22 | 23 | configuration "haiku" 24 | links {"GL","glfw","GLEW"} 25 | 26 | configuration "freebsd" 27 | links {"GL","glfw","GLEW"} 28 | 29 | configuration "debug" 30 | defines { "DEBUG" } 31 | flags { "Symbols" } 32 | buildoptions{ "-Wall" } 33 | targetname ( name .. "-debug" ) 34 | 35 | configuration "release" 36 | defines { "NDEBUG" } 37 | flags { "Optimize" } 38 | buildoptions{ "-Wall" } 39 | targetname ( name .. "-release" ) 40 | end 41 | 42 | solution "opengl-series" 43 | location("./") 44 | targetdir("./bin") 45 | configurations { "debug", "release" } 46 | objdir("obj/" .. os.get() .. "/") 47 | 48 | create_project( "01_project_skeleton" ); 49 | create_project( "02_textures" ); 50 | create_project( "03_matrices" ); 51 | create_project( "04_camera" ); 52 | create_project( "05_asset_instance" ); 53 | create_project( "06_diffuse_lighting" ); 54 | create_project( "07_more_lighting" ); 55 | create_project( "08_even_more_lighting" ); 56 | -------------------------------------------------------------------------------- /platforms/osx/libglfw3.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/osx/libglfw3.a -------------------------------------------------------------------------------- /platforms/osx/platform_osx.mm: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the terms in LICENSE.txt 3 | // 4 | // Copyright 2014 Tom Dalling. All rights reserved. 5 | // 6 | 7 | #import "platform.hpp" 8 | #import 9 | 10 | // returns the full path to the file `fileName` in the resources directory of the app bundle 11 | std::string ResourcePath(std::string fileName) { 12 | NSString* fname = [NSString stringWithCString:fileName.c_str() encoding:NSUTF8StringEncoding]; 13 | NSString* path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:fname]; 14 | return std::string([path cStringUsingEncoding:NSUTF8StringEncoding]); 15 | } 16 | -------------------------------------------------------------------------------- /platforms/windows/01_project_skeleton.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {99b8bc00-eafd-4fc0-9f1c-e13f519249b5} 6 | 7 | 8 | {e5fcabed-d60f-40b4-b87f-aa83b624adf5} 9 | 10 | 11 | {1134d475-c4f8-45ca-9697-d447037cbb8a} 12 | 13 | 14 | 15 | 16 | common 17 | 18 | 19 | source 20 | 21 | 22 | source 23 | 24 | 25 | source 26 | 27 | 28 | common 29 | 30 | 31 | 32 | 33 | source 34 | 35 | 36 | source 37 | 38 | 39 | 40 | 41 | resources 42 | 43 | 44 | resources 45 | 46 | 47 | -------------------------------------------------------------------------------- /platforms/windows/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/platforms/windows/glfw3.lib -------------------------------------------------------------------------------- /platforms/windows/platform_windows.cpp: -------------------------------------------------------------------------------- 1 | #include "platform.hpp" 2 | #include 3 | 4 | std::string ResourcePath(std::string fileName) { 5 | char executablePath[1024] = {'\0'}; 6 | DWORD charsCopied = GetModuleFileName(NULL, executablePath, 1024); 7 | if(charsCopied > 0 && charsCopied < 1024) 8 | return std::string(executablePath) + "\\..\\" + fileName; 9 | else 10 | throw std::runtime_error("GetModuleFileName failed a bit"); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /platforms/windows/shared_build_settings.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | $(SolutionDir)source\common\thirdparty\glfw\include;$(SolutionDir)source\common\thirdparty\glew\include;$(SolutionDir)source\common\thirdparty\glm;$(SolutionDir)source\common\thirdparty\stb_image;$(SolutionDir)source\common;$(IncludePath) 7 | $(SolutionDir)platforms\windows;$(LibraryPath) 8 | $(SolutionDir)Build\$(ProjectName)\$(Configuration)\ 9 | $(SolutionDir)Build\$(ProjectName)\$(Configuration)\Intermediates\ 10 | 11 | 12 | 13 | glfw3.lib;opengl32.lib;legacy_stdio_definitions.lib;%(AdditionalDependencies) 14 | 15 | 16 | MultiThreadedDLL 17 | GLEW_STATIC;GLM_FORCE_RADIANS;%(PreprocessorDefinitions) 18 | 19 | 20 | copy "$(SolutionDir)source\$(ProjectName)\resources\*" "$(OutDir)\" 21 | 22 | 23 | Copies resources into same directory as built executable 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /source/01_project_skeleton/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | out vec4 finalColor; 4 | 5 | void main() { 6 | //set every drawn pixel to white 7 | finalColor = vec4(1.0, 1.0, 1.0, 1.0); 8 | } -------------------------------------------------------------------------------- /source/01_project_skeleton/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | in vec3 vert; 4 | 5 | void main() { 6 | // does not alter the verticies at all 7 | gl_Position = vec4(vert, 1); 8 | } -------------------------------------------------------------------------------- /source/01_project_skeleton/source/Program.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Program 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "Shader.h" 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL program made by linking shaders. 28 | */ 29 | class Program { 30 | public: 31 | /** 32 | Creates a program by linking a list of tdogl::Shader objects 33 | 34 | @param shaders The shaders to link together to make the program 35 | 36 | @throws std::exception if an error occurs. 37 | 38 | @see tdogl::Shader 39 | */ 40 | Program(const std::vector& shaders); 41 | ~Program(); 42 | 43 | 44 | /** 45 | @result The program's object id, as returned from glCreateProgram 46 | */ 47 | GLuint object() const; 48 | 49 | 50 | /** 51 | @result The attribute index for the given name, as returned from glGetAttribLocation. 52 | */ 53 | GLint attrib(const GLchar* attribName) const; 54 | 55 | 56 | /** 57 | @result The uniform index for the given name, as returned from glGetUniformLocation. 58 | */ 59 | GLint uniform(const GLchar* uniformName) const; 60 | 61 | 62 | private: 63 | GLuint _object; 64 | 65 | //copying disabled 66 | Program(const Program&); 67 | const Program& operator=(const Program&); 68 | }; 69 | 70 | } 71 | -------------------------------------------------------------------------------- /source/01_project_skeleton/source/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Shader 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents a compiled OpenGL shader. 28 | */ 29 | class Shader { 30 | public: 31 | 32 | /** 33 | Creates a shader from a text file. 34 | 35 | @param filePath The path to the text file containing the shader source. 36 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 37 | or GL_FRAGMENT_SHADER. 38 | 39 | @throws std::exception if an error occurs. 40 | */ 41 | static Shader shaderFromFile(const std::string& filePath, GLenum shaderType); 42 | 43 | 44 | /** 45 | Creates a shader from a string of shader source code. 46 | 47 | @param shaderCode The source code for the shader. 48 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 49 | or GL_FRAGMENT_SHADER. 50 | 51 | @throws std::exception if an error occurs. 52 | */ 53 | Shader(const std::string& shaderCode, GLenum shaderType); 54 | 55 | 56 | /** 57 | @result The shader's object ID, as returned from glCreateShader 58 | */ 59 | GLuint object() const; 60 | 61 | // tdogl::Shader objects can be copied and assigned because they are reference counted 62 | // like a shared pointer 63 | Shader(const Shader& other); 64 | Shader& operator =(const Shader& other); 65 | ~Shader(); 66 | 67 | private: 68 | GLuint _object; 69 | unsigned* _refCount; 70 | 71 | void _retain(); 72 | void _release(); 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /source/02_textures/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform sampler2D tex; 4 | 5 | in vec2 fragTexCoord; 6 | 7 | out vec4 finalColor; 8 | 9 | void main() { 10 | finalColor = texture(tex, fragTexCoord); 11 | } -------------------------------------------------------------------------------- /source/02_textures/resources/hazard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/source/02_textures/resources/hazard.png -------------------------------------------------------------------------------- /source/02_textures/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | in vec3 vert; 4 | in vec2 vertTexCoord; 5 | 6 | out vec2 fragTexCoord; 7 | 8 | void main() { 9 | // Pass the tex coord straight through to the fragment shader 10 | fragTexCoord = vertTexCoord; 11 | 12 | gl_Position = vec4(vert, 1); 13 | } -------------------------------------------------------------------------------- /source/02_textures/source/tdogl/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Shader 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents a compiled OpenGL shader. 28 | */ 29 | class Shader { 30 | public: 31 | 32 | /** 33 | Creates a shader from a text file. 34 | 35 | @param filePath The path to the text file containing the shader source. 36 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 37 | or GL_FRAGMENT_SHADER. 38 | 39 | @throws std::exception if an error occurs. 40 | */ 41 | static Shader shaderFromFile(const std::string& filePath, GLenum shaderType); 42 | 43 | 44 | /** 45 | Creates a shader from a string of shader source code. 46 | 47 | @param shaderCode The source code for the shader. 48 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 49 | or GL_FRAGMENT_SHADER. 50 | 51 | @throws std::exception if an error occurs. 52 | */ 53 | Shader(const std::string& shaderCode, GLenum shaderType); 54 | 55 | 56 | /** 57 | @result The shader's object ID, as returned from glCreateShader 58 | */ 59 | GLuint object() const; 60 | 61 | // tdogl::Shader objects can be copied and assigned because they are reference counted 62 | // like a shared pointer 63 | Shader(const Shader& other); 64 | Shader& operator =(const Shader& other); 65 | ~Shader(); 66 | 67 | private: 68 | GLuint _object; 69 | unsigned* _refCount; 70 | 71 | void _retain(); 72 | void _release(); 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /source/02_textures/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /source/03_matrices/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform sampler2D tex; 4 | 5 | in vec2 fragTexCoord; 6 | 7 | out vec4 finalColor; 8 | 9 | void main() { 10 | //note: the texture function was called texture2D in older versions of GLSL 11 | finalColor = texture(tex, fragTexCoord); 12 | } -------------------------------------------------------------------------------- /source/03_matrices/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform mat4 projection; 4 | uniform mat4 camera; 5 | uniform mat4 model; 6 | 7 | in vec3 vert; 8 | in vec2 vertTexCoord; 9 | 10 | out vec2 fragTexCoord; 11 | 12 | void main() { 13 | // Pass the tex coord straight through to the fragment shader 14 | fragTexCoord = vertTexCoord; 15 | 16 | // Apply all matrix transformations to vert 17 | gl_Position = projection * camera * model * vec4(vert, 1); 18 | } -------------------------------------------------------------------------------- /source/03_matrices/resources/wooden-crate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/source/03_matrices/resources/wooden-crate.jpg -------------------------------------------------------------------------------- /source/03_matrices/source/tdogl/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Shader 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents a compiled OpenGL shader. 28 | */ 29 | class Shader { 30 | public: 31 | 32 | /** 33 | Creates a shader from a text file. 34 | 35 | @param filePath The path to the text file containing the shader source. 36 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 37 | or GL_FRAGMENT_SHADER. 38 | 39 | @throws std::exception if an error occurs. 40 | */ 41 | static Shader shaderFromFile(const std::string& filePath, GLenum shaderType); 42 | 43 | 44 | /** 45 | Creates a shader from a string of shader source code. 46 | 47 | @param shaderCode The source code for the shader. 48 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 49 | or GL_FRAGMENT_SHADER. 50 | 51 | @throws std::exception if an error occurs. 52 | */ 53 | Shader(const std::string& shaderCode, GLenum shaderType); 54 | 55 | 56 | /** 57 | @result The shader's object ID, as returned from glCreateShader 58 | */ 59 | GLuint object() const; 60 | 61 | // tdogl::Shader objects can be copied and assigned because they are reference counted 62 | // like a shared pointer 63 | Shader(const Shader& other); 64 | Shader& operator =(const Shader& other); 65 | ~Shader(); 66 | 67 | private: 68 | GLuint _object; 69 | unsigned* _refCount; 70 | 71 | void _retain(); 72 | void _release(); 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /source/03_matrices/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /source/04_camera/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform sampler2D tex; 4 | 5 | in vec2 fragTexCoord; 6 | 7 | out vec4 finalColor; 8 | 9 | void main() { 10 | //note: the texture function was called texture2D in older versions of GLSL 11 | finalColor = texture(tex, fragTexCoord); 12 | } -------------------------------------------------------------------------------- /source/04_camera/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform mat4 camera; 4 | uniform mat4 model; 5 | 6 | in vec3 vert; 7 | in vec2 vertTexCoord; 8 | 9 | out vec2 fragTexCoord; 10 | 11 | void main() { 12 | // Pass the tex coord straight through to the fragment shader 13 | fragTexCoord = vertTexCoord; 14 | 15 | // Apply all matrix transformations to vert 16 | gl_Position = camera * model * vec4(vert, 1); 17 | } -------------------------------------------------------------------------------- /source/04_camera/resources/wooden-crate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/source/04_camera/resources/wooden-crate.jpg -------------------------------------------------------------------------------- /source/04_camera/source/tdogl/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Shader 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents a compiled OpenGL shader. 28 | */ 29 | class Shader { 30 | public: 31 | 32 | /** 33 | Creates a shader from a text file. 34 | 35 | @param filePath The path to the text file containing the shader source. 36 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 37 | or GL_FRAGMENT_SHADER. 38 | 39 | @throws std::exception if an error occurs. 40 | */ 41 | static Shader shaderFromFile(const std::string& filePath, GLenum shaderType); 42 | 43 | 44 | /** 45 | Creates a shader from a string of shader source code. 46 | 47 | @param shaderCode The source code for the shader. 48 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 49 | or GL_FRAGMENT_SHADER. 50 | 51 | @throws std::exception if an error occurs. 52 | */ 53 | Shader(const std::string& shaderCode, GLenum shaderType); 54 | 55 | 56 | /** 57 | @result The shader's object ID, as returned from glCreateShader 58 | */ 59 | GLuint object() const; 60 | 61 | // tdogl::Shader objects can be copied and assigned because they are reference counted 62 | // like a shared pointer 63 | Shader(const Shader& other); 64 | Shader& operator =(const Shader& other); 65 | ~Shader(); 66 | 67 | private: 68 | GLuint _object; 69 | unsigned* _refCount; 70 | 71 | void _retain(); 72 | void _release(); 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /source/04_camera/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /source/05_asset_instance/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform sampler2D tex; 4 | 5 | in vec2 fragTexCoord; 6 | 7 | out vec4 finalColor; 8 | 9 | void main() { 10 | //note: the texture function was called texture2D in older versions of GLSL 11 | finalColor = texture(tex, fragTexCoord); 12 | } -------------------------------------------------------------------------------- /source/05_asset_instance/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform mat4 camera; 4 | uniform mat4 model; 5 | 6 | in vec3 vert; 7 | in vec2 vertTexCoord; 8 | 9 | out vec2 fragTexCoord; 10 | 11 | void main() { 12 | // Pass the tex coord straight through to the fragment shader 13 | fragTexCoord = vertTexCoord; 14 | 15 | // Apply all matrix transformations to vert 16 | gl_Position = camera * model * vec4(vert, 1); 17 | } -------------------------------------------------------------------------------- /source/05_asset_instance/resources/wooden-crate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/source/05_asset_instance/resources/wooden-crate.jpg -------------------------------------------------------------------------------- /source/05_asset_instance/source/tdogl/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Shader 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents a compiled OpenGL shader. 28 | */ 29 | class Shader { 30 | public: 31 | 32 | /** 33 | Creates a shader from a text file. 34 | 35 | @param filePath The path to the text file containing the shader source. 36 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 37 | or GL_FRAGMENT_SHADER. 38 | 39 | @throws std::exception if an error occurs. 40 | */ 41 | static Shader shaderFromFile(const std::string& filePath, GLenum shaderType); 42 | 43 | 44 | /** 45 | Creates a shader from a string of shader source code. 46 | 47 | @param shaderCode The source code for the shader. 48 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 49 | or GL_FRAGMENT_SHADER. 50 | 51 | @throws std::exception if an error occurs. 52 | */ 53 | Shader(const std::string& shaderCode, GLenum shaderType); 54 | 55 | 56 | /** 57 | @result The shader's object ID, as returned from glCreateShader 58 | */ 59 | GLuint object() const; 60 | 61 | // tdogl::Shader objects can be copied and assigned because they are reference counted 62 | // like a shared pointer 63 | Shader(const Shader& other); 64 | Shader& operator =(const Shader& other); 65 | ~Shader(); 66 | 67 | private: 68 | GLuint _object; 69 | unsigned* _refCount; 70 | 71 | void _retain(); 72 | void _release(); 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /source/05_asset_instance/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /source/06_diffuse_lighting/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform mat4 model; 4 | uniform sampler2D tex; 5 | 6 | uniform struct Light { 7 | vec3 position; 8 | vec3 intensities; //a.k.a the color of the light 9 | } light; 10 | 11 | in vec2 fragTexCoord; 12 | in vec3 fragNormal; 13 | in vec3 fragVert; 14 | 15 | out vec4 finalColor; 16 | 17 | void main() { 18 | //calculate normal in world coordinates 19 | mat3 normalMatrix = transpose(inverse(mat3(model))); 20 | vec3 normal = normalize(normalMatrix * fragNormal); 21 | 22 | //calculate the location of this fragment (pixel) in world coordinates 23 | vec3 fragPosition = vec3(model * vec4(fragVert, 1)); 24 | 25 | //calculate the vector from this pixels surface to the light source 26 | vec3 surfaceToLight = light.position - fragPosition; 27 | 28 | //calculate the cosine of the angle of incidence 29 | float brightness = dot(normal, surfaceToLight) / (length(surfaceToLight) * length(normal)); 30 | brightness = clamp(brightness, 0, 1); 31 | 32 | //calculate final color of the pixel, based on: 33 | // 1. The angle of incidence: brightness 34 | // 2. The color/intensities of the light: light.intensities 35 | // 3. The texture and texture coord: texture(tex, fragTexCoord) 36 | vec4 surfaceColor = texture(tex, fragTexCoord); 37 | finalColor = vec4(brightness * light.intensities * surfaceColor.rgb, surfaceColor.a); 38 | } -------------------------------------------------------------------------------- /source/06_diffuse_lighting/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform mat4 camera; 4 | uniform mat4 model; 5 | 6 | in vec3 vert; 7 | in vec2 vertTexCoord; 8 | in vec3 vertNormal; 9 | 10 | out vec3 fragVert; 11 | out vec2 fragTexCoord; 12 | out vec3 fragNormal; 13 | 14 | void main() { 15 | // Pass some variables to the fragment shader 16 | fragTexCoord = vertTexCoord; 17 | fragNormal = vertNormal; 18 | fragVert = vert; 19 | 20 | // Apply all matrix transformations to vert 21 | gl_Position = camera * model * vec4(vert, 1); 22 | } -------------------------------------------------------------------------------- /source/06_diffuse_lighting/resources/wooden-crate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/source/06_diffuse_lighting/resources/wooden-crate.jpg -------------------------------------------------------------------------------- /source/06_diffuse_lighting/source/tdogl/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Shader 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents a compiled OpenGL shader. 28 | */ 29 | class Shader { 30 | public: 31 | 32 | /** 33 | Creates a shader from a text file. 34 | 35 | @param filePath The path to the text file containing the shader source. 36 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 37 | or GL_FRAGMENT_SHADER. 38 | 39 | @throws std::exception if an error occurs. 40 | */ 41 | static Shader shaderFromFile(const std::string& filePath, GLenum shaderType); 42 | 43 | 44 | /** 45 | Creates a shader from a string of shader source code. 46 | 47 | @param shaderCode The source code for the shader. 48 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 49 | or GL_FRAGMENT_SHADER. 50 | 51 | @throws std::exception if an error occurs. 52 | */ 53 | Shader(const std::string& shaderCode, GLenum shaderType); 54 | 55 | 56 | /** 57 | @result The shader's object ID, as returned from glCreateShader 58 | */ 59 | GLuint object() const; 60 | 61 | // tdogl::Shader objects can be copied and assigned because they are reference counted 62 | // like a shared pointer 63 | Shader(const Shader& other); 64 | Shader& operator =(const Shader& other); 65 | ~Shader(); 66 | 67 | private: 68 | GLuint _object; 69 | unsigned* _refCount; 70 | 71 | void _retain(); 72 | void _release(); 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /source/06_diffuse_lighting/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /source/07_more_lighting/resources/fragment-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform mat4 model; 4 | uniform vec3 cameraPosition; 5 | 6 | // material settings 7 | uniform sampler2D materialTex; 8 | uniform float materialShininess; 9 | uniform vec3 materialSpecularColor; 10 | 11 | uniform struct Light { 12 | vec3 position; 13 | vec3 intensities; //a.k.a the color of the light 14 | float attenuation; 15 | float ambientCoefficient; 16 | } light; 17 | 18 | in vec2 fragTexCoord; 19 | in vec3 fragNormal; 20 | in vec3 fragVert; 21 | 22 | out vec4 finalColor; 23 | 24 | void main() { 25 | vec3 normal = normalize(transpose(inverse(mat3(model))) * fragNormal); 26 | vec3 surfacePos = vec3(model * vec4(fragVert, 1)); 27 | vec4 surfaceColor = texture(materialTex, fragTexCoord); 28 | vec3 surfaceToLight = normalize(light.position - surfacePos); 29 | vec3 surfaceToCamera = normalize(cameraPosition - surfacePos); 30 | 31 | //ambient 32 | vec3 ambient = light.ambientCoefficient * surfaceColor.rgb * light.intensities; 33 | 34 | //diffuse 35 | float diffuseCoefficient = max(0.0, dot(normal, surfaceToLight)); 36 | vec3 diffuse = diffuseCoefficient * surfaceColor.rgb * light.intensities; 37 | 38 | //specular 39 | float specularCoefficient = 0.0; 40 | if(diffuseCoefficient > 0.0) 41 | specularCoefficient = pow(max(0.0, dot(surfaceToCamera, reflect(-surfaceToLight, normal))), materialShininess); 42 | vec3 specular = specularCoefficient * materialSpecularColor * light.intensities; 43 | 44 | //attenuation 45 | float distanceToLight = length(light.position - surfacePos); 46 | float attenuation = 1.0 / (1.0 + light.attenuation * pow(distanceToLight, 2)); 47 | 48 | //linear color (color before gamma correction) 49 | vec3 linearColor = ambient + attenuation*(diffuse + specular); 50 | 51 | //final color (after gamma correction) 52 | vec3 gamma = vec3(1.0/2.2); 53 | finalColor = vec4(pow(linearColor, gamma), surfaceColor.a); 54 | } -------------------------------------------------------------------------------- /source/07_more_lighting/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform mat4 camera; 4 | uniform mat4 model; 5 | 6 | in vec3 vert; 7 | in vec2 vertTexCoord; 8 | in vec3 vertNormal; 9 | 10 | out vec3 fragVert; 11 | out vec2 fragTexCoord; 12 | out vec3 fragNormal; 13 | 14 | void main() { 15 | // Pass some variables to the fragment shader 16 | fragTexCoord = vertTexCoord; 17 | fragNormal = vertNormal; 18 | fragVert = vert; 19 | 20 | // Apply all matrix transformations to vert 21 | gl_Position = camera * model * vec4(vert, 1); 22 | } -------------------------------------------------------------------------------- /source/07_more_lighting/resources/wooden-crate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/source/07_more_lighting/resources/wooden-crate.jpg -------------------------------------------------------------------------------- /source/07_more_lighting/source/tdogl/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Shader 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents a compiled OpenGL shader. 28 | */ 29 | class Shader { 30 | public: 31 | 32 | /** 33 | Creates a shader from a text file. 34 | 35 | @param filePath The path to the text file containing the shader source. 36 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 37 | or GL_FRAGMENT_SHADER. 38 | 39 | @throws std::exception if an error occurs. 40 | */ 41 | static Shader shaderFromFile(const std::string& filePath, GLenum shaderType); 42 | 43 | 44 | /** 45 | Creates a shader from a string of shader source code. 46 | 47 | @param shaderCode The source code for the shader. 48 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 49 | or GL_FRAGMENT_SHADER. 50 | 51 | @throws std::exception if an error occurs. 52 | */ 53 | Shader(const std::string& shaderCode, GLenum shaderType); 54 | 55 | 56 | /** 57 | @result The shader's object ID, as returned from glCreateShader 58 | */ 59 | GLuint object() const; 60 | 61 | // tdogl::Shader objects can be copied and assigned because they are reference counted 62 | // like a shared pointer 63 | Shader(const Shader& other); 64 | Shader& operator =(const Shader& other); 65 | ~Shader(); 66 | 67 | private: 68 | GLuint _object; 69 | unsigned* _refCount; 70 | 71 | void _retain(); 72 | void _release(); 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /source/07_more_lighting/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /source/08_even_more_lighting/resources/vertex-shader.txt: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform mat4 camera; 4 | uniform mat4 model; 5 | 6 | in vec3 vert; 7 | in vec2 vertTexCoord; 8 | in vec3 vertNormal; 9 | 10 | out vec3 fragVert; 11 | out vec2 fragTexCoord; 12 | out vec3 fragNormal; 13 | 14 | void main() { 15 | // Pass some variables to the fragment shader 16 | fragTexCoord = vertTexCoord; 17 | fragNormal = vertNormal; 18 | fragVert = vert; 19 | 20 | // Apply all matrix transformations to vert 21 | gl_Position = camera * model * vec4(vert, 1); 22 | } -------------------------------------------------------------------------------- /source/08_even_more_lighting/resources/wooden-crate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/source/08_even_more_lighting/resources/wooden-crate.jpg -------------------------------------------------------------------------------- /source/08_even_more_lighting/source/tdogl/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Shader 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents a compiled OpenGL shader. 28 | */ 29 | class Shader { 30 | public: 31 | 32 | /** 33 | Creates a shader from a text file. 34 | 35 | @param filePath The path to the text file containing the shader source. 36 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 37 | or GL_FRAGMENT_SHADER. 38 | 39 | @throws std::exception if an error occurs. 40 | */ 41 | static Shader shaderFromFile(const std::string& filePath, GLenum shaderType); 42 | 43 | 44 | /** 45 | Creates a shader from a string of shader source code. 46 | 47 | @param shaderCode The source code for the shader. 48 | @param shaderType Same as the argument to glCreateShader. For example GL_VERTEX_SHADER 49 | or GL_FRAGMENT_SHADER. 50 | 51 | @throws std::exception if an error occurs. 52 | */ 53 | Shader(const std::string& shaderCode, GLenum shaderType); 54 | 55 | 56 | /** 57 | @result The shader's object ID, as returned from glCreateShader 58 | */ 59 | GLuint object() const; 60 | 61 | // tdogl::Shader objects can be copied and assigned because they are reference counted 62 | // like a shared pointer 63 | Shader(const Shader& other); 64 | Shader& operator =(const Shader& other); 65 | ~Shader(); 66 | 67 | private: 68 | GLuint _object; 69 | unsigned* _refCount; 70 | 71 | void _retain(); 72 | void _release(); 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /source/08_even_more_lighting/source/tdogl/Texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | tdogl::Texture 3 | 4 | Copyright 2012 Thomas Dalling - http://tomdalling.com/ 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include "Bitmap.h" 23 | 24 | namespace tdogl { 25 | 26 | /** 27 | Represents an OpenGL texture 28 | */ 29 | class Texture { 30 | public: 31 | /** 32 | Creates a texture from a bitmap. 33 | 34 | The texture will be loaded upside down because tdogl::Bitmap pixel data 35 | is ordered from the top row down, but OpenGL expects the data to 36 | be from the bottom row up. 37 | 38 | @param bitmap The bitmap to load the texture from 39 | @param minMagFiler GL_NEAREST or GL_LINEAR 40 | @param wrapMode GL_REPEAT, GL_MIRRORED_REPEAT, GL_CLAMP_TO_EDGE, or GL_CLAMP_TO_BORDER 41 | */ 42 | Texture(const Bitmap& bitmap, 43 | GLint minMagFiler = GL_LINEAR, 44 | GLint wrapMode = GL_CLAMP_TO_EDGE); 45 | 46 | /** 47 | Deletes the texture object with glDeleteTextures 48 | */ 49 | ~Texture(); 50 | 51 | /** 52 | @result The texure object, as created by glGenTextures 53 | */ 54 | GLuint object() const; 55 | 56 | /** 57 | @result The original width (in pixels) of the bitmap this texture was made from 58 | */ 59 | GLfloat originalWidth() const; 60 | 61 | /** 62 | @result The original height (in pixels) of the bitmap this texture was made from 63 | */ 64 | GLfloat originalHeight() const; 65 | 66 | private: 67 | GLuint _object; 68 | GLfloat _originalWidth; 69 | GLfloat _originalHeight; 70 | 71 | //copying disabled 72 | Texture(const Texture&); 73 | const Texture& operator=(const Texture&); 74 | }; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /source/common/platform.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the terms in LICENSE.txt 3 | // 4 | // Copyright 2014 Tom Dalling. All rights reserved. 5 | // 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | std::string ResourcePath(std::string fileName); 12 | -------------------------------------------------------------------------------- /source/common/thirdparty/glfw/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2010 Camilla Berglund 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/copying.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2005 - 2013 G-Truc Creation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/common.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/common.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_COMMON_INCLUDED 30 | #define GLM_COMMON_INCLUDED 31 | 32 | #include "detail/func_common.hpp" 33 | 34 | #endif//GLM_COMMON_INCLUDED 35 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/_fixes.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/_fixes.hpp 25 | /// @date 2011-02-21 / 2011-11-22 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #include 30 | 31 | //! Workaround for compatibility with other libraries 32 | #ifdef max 33 | #undef max 34 | #endif 35 | 36 | //! Workaround for compatibility with other libraries 37 | #ifdef min 38 | #undef min 39 | #endif 40 | 41 | //! Workaround for Android 42 | #ifdef isnan 43 | #undef isnan 44 | #endif 45 | 46 | //! Workaround for Android 47 | #ifdef isinf 48 | #undef isinf 49 | #endif 50 | 51 | //! Workaround for Chrone Native Client 52 | #ifdef log2 53 | #undef log2 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/_literals.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/_literals.hpp 25 | /// @date 2013-05-06 / 2013-05-06 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_literals 30 | #define glm_core_literals 31 | 32 | namespace glm 33 | { 34 | #define GLM_CXX11_USER_LITERALS 35 | #ifdef GLM_CXX11_USER_LITERALS 36 | /* 37 | GLM_FUNC_QUALIFIER detail::half operator "" _h(long double const s) 38 | { 39 | return detail::half(s); 40 | } 41 | 42 | GLM_FUNC_QUALIFIER float operator "" _f(long double const s) 43 | { 44 | return static_cast(s); 45 | } 46 | */ 47 | #endif//GLM_CXX11_USER_LITERALS 48 | 49 | }//namespace glm 50 | 51 | #endif//glm_core_literals 52 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/hint.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/hint.hpp 25 | /// @date 2008-08-14 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type 30 | #define glm_core_type 31 | 32 | namespace glm 33 | { 34 | // Use dont_care, nicest and fastest to optimize implementations. 35 | class dont_care {}; 36 | class nicest {}; 37 | class fastest {}; 38 | }//namespace glm 39 | 40 | #endif//glm_core_type 41 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/intrinsic_exponential.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_exponential.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/intrinsic_integer.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_integer.hpp 25 | /// @date 2009-05-11 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_integer 30 | #define glm_detail_intrinsic_integer 31 | 32 | #include "glm/glm.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | __m128i _mm_bit_interleave_si128(__m128i x); 42 | __m128i _mm_bit_interleave_si128(__m128i x, __m128i y); 43 | 44 | }//namespace detail 45 | }//namespace glm 46 | 47 | #include "intrinsic_integer.inl" 48 | 49 | #endif//GLM_ARCH 50 | #endif//glm_detail_intrinsic_integer 51 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/intrinsic_trigonometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_trigonometric.hpp 25 | /// @date 2009-06-09 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_trigonometric 30 | #define glm_detail_intrinsic_trigonometric 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | 42 | }//namespace detail 43 | }//namespace glm 44 | 45 | #include "intrinsic_trigonometric.inl" 46 | 47 | #endif//GLM_ARCH 48 | #endif//glm_detail_intrinsic_trigonometric 49 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/intrinsic_trigonometric.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_trigonometric.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/intrinsic_vector_relational.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_vector_relational.hpp 25 | /// @date 2009-06-09 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_vector_relational 30 | #define glm_detail_intrinsic_vector_relational 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | 42 | }//namespace detail 43 | }//namespace glm 44 | 45 | #include "intrinsic_vector_relational.inl" 46 | 47 | #endif//GLM_ARCH 48 | #endif//glm_detail_intrinsic_vector_relational 49 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/precision.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/precision.hpp 25 | /// @date 2013-04-01 / 2013-04-01 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_CORE_PRECISION_INCLUDED 30 | #define GLM_CORE_PRECISION_INCLUDED 31 | 32 | namespace glm 33 | { 34 | enum precision 35 | { 36 | highp, 37 | mediump, 38 | lowp, 39 | defaultp = highp 40 | }; 41 | }//namespace glm 42 | 43 | #endif//GLM_CORE_PRECISION_INCLUDED 44 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/precision.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomdalling/opengl-series/2f1cb93a531f4f9bd5cbad5b2ac1ebe0cfcff7c7/source/common/thirdparty/glm/glm/detail/precision.inl -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/type_half.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_half.hpp 25 | /// @date 2008-08-17 / 2011-09-20 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_half 30 | #define glm_core_type_half 31 | 32 | #include "setup.hpp" 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | typedef short hdata; 38 | 39 | GLM_FUNC_DECL float toFloat32(hdata value); 40 | GLM_FUNC_DECL hdata toFloat16(float const & value); 41 | 42 | }//namespace detail 43 | 44 | /// half-precision floating-point numbers. 45 | //typedef detail::hdata half; 46 | 47 | }//namespace glm 48 | 49 | #include "type_half.inl" 50 | 51 | #endif//glm_core_type_half 52 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/type_mat.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_mat.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/detail/type_vec.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_vec.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/exponential.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/exponential.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_EXPONENTIAL_INCLUDED 30 | #define GLM_EXPONENTIAL_INCLUDED 31 | 32 | #include "detail/func_exponential.hpp" 33 | 34 | #endif//GLM_EXPONENTIAL_INCLUDED 35 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/geometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/geometric.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_GEOMETRIC_INCLUDED 30 | #define GLM_GEOMETRIC_INCLUDED 31 | 32 | #include "detail/func_geometric.hpp" 33 | 34 | #endif//GLM_GEOMETRIC_INCLUDED 35 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtc_swizzle 24 | /// @file glm/gtc/swizzle.inl 25 | /// @date 2009-06-14 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | namespace glm 30 | { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-30 5 | // Updated : 2008-10-05 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/closest_point.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | #ifndef glm_gtx_closest_point 11 | #define glm_gtx_closest_point 12 | 13 | namespace glm 14 | { 15 | template 16 | GLM_FUNC_QUALIFIER detail::tvec3 closestPointOnLine 17 | ( 18 | detail::tvec3 const & point, 19 | detail::tvec3 const & a, 20 | detail::tvec3 const & b 21 | ) 22 | { 23 | T LineLength = distance(a, b); 24 | detail::tvec3 Vector = point - a; 25 | detail::tvec3 LineDirection = (b - a) / LineLength; 26 | 27 | // Project Vector to LineDirection to get the distance of point from a 28 | T Distance = dot(Vector, LineDirection); 29 | 30 | if(Distance <= T(0)) return a; 31 | if(Distance >= LineLength) return b; 32 | return a + LineDirection * Distance; 33 | } 34 | }//namespace glm 35 | 36 | #endif//glm_gtx_closest_point 37 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/color_space_YCoCg.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-10-28 5 | // Updated : 2008-10-28 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/color_space_YCoCg.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 rgb2YCoCg 14 | ( 15 | detail::tvec3 const & rgbColor 16 | ) 17 | { 18 | detail::tvec3 result; 19 | result.x/*Y */ = rgbColor.r / T(4) + rgbColor.g / T(2) + rgbColor.b / T(4); 20 | result.y/*Co*/ = rgbColor.r / T(2) + rgbColor.g * T(0) - rgbColor.b / T(2); 21 | result.z/*Cg*/ = - rgbColor.r / T(4) + rgbColor.g / T(2) - rgbColor.b / T(4); 22 | return result; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER detail::tvec3 rgb2YCoCgR 27 | ( 28 | detail::tvec3 const & rgbColor 29 | ) 30 | { 31 | detail::tvec3 result; 32 | result.x/*Y */ = rgbColor.g / T(2) + (rgbColor.r + rgbColor.b) / T(4); 33 | result.y/*Co*/ = rgbColor.r - rgbColor.b; 34 | result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / T(2); 35 | return result; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER detail::tvec3 YCoCg2rgb 40 | ( 41 | detail::tvec3 const & YCoCgColor 42 | ) 43 | { 44 | detail::tvec3 result; 45 | result.r = YCoCgColor.x + YCoCgColor.y - YCoCgColor.z; 46 | result.g = YCoCgColor.x + YCoCgColor.z; 47 | result.b = YCoCgColor.x - YCoCgColor.y - YCoCgColor.z; 48 | return result; 49 | } 50 | 51 | template 52 | GLM_FUNC_QUALIFIER detail::tvec3 YCoCgR2rgb 53 | ( 54 | detail::tvec3 const & YCoCgRColor 55 | ) 56 | { 57 | detail::tvec3 result; 58 | T tmp = YCoCgRColor.x - (YCoCgRColor.z / T(2)); 59 | result.g = YCoCgRColor.z + tmp; 60 | result.b = tmp - (YCoCgRColor.y / T(2)); 61 | result.r = result.b + YCoCgRColor.y; 62 | return result; 63 | } 64 | }//namespace glm 65 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/compatibility.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-03-16 5 | // Updated : 2008-10-24 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/compatibility.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | // isfinite 13 | template 14 | GLM_FUNC_QUALIFIER bool isfinite( 15 | genType const & x) 16 | { 17 | # if(GLM_LANG & GLM_LANG_CXX11_FLAG) 18 | return std::isfinite(x) != 0; 19 | # elif(GLM_COMPILER & GLM_COMPILER_VC) 20 | return _finite(x); 21 | # elif(GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID) 22 | return _isfinite(x) != 0; 23 | # else 24 | return isfinite(x) != 0; 25 | # endif 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER detail::tvec2 isfinite( 30 | detail::tvec2 const & x) 31 | { 32 | return detail::tvec2( 33 | isfinite(x.x), 34 | isfinite(x.y)); 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER detail::tvec3 isfinite( 39 | detail::tvec3 const & x) 40 | { 41 | return detail::tvec3( 42 | isfinite(x.x), 43 | isfinite(x.y), 44 | isfinite(x.z)); 45 | } 46 | 47 | template 48 | GLM_FUNC_QUALIFIER detail::tvec4 isfinite( 49 | detail::tvec4 const & x) 50 | { 51 | return detail::tvec4( 52 | isfinite(x.x), 53 | isfinite(x.y), 54 | isfinite(x.z), 55 | isfinite(x.w)); 56 | } 57 | 58 | }//namespace glm 59 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/component_wise.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-05-21 5 | // Updated : 2010-02-12 6 | // Licence : This source is under MIT License 7 | // File : gtx_component_wise.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template class vecType> 13 | GLM_FUNC_QUALIFIER T compAdd(vecType const & v) 14 | { 15 | T result(0); 16 | for(length_t i = 0; i < v.length(); ++i) 17 | result += v[i]; 18 | return result; 19 | } 20 | 21 | template class vecType> 22 | GLM_FUNC_QUALIFIER T compMul(vecType const & v) 23 | { 24 | T result(1); 25 | for(length_t i = 0; i < v.length(); ++i) 26 | result *= v[i]; 27 | return result; 28 | } 29 | 30 | template class vecType> 31 | GLM_FUNC_QUALIFIER T compMin(vecType const & v) 32 | { 33 | T result(v[0]); 34 | for(length_t i = 1; i < v.length(); ++i) 35 | result = min(result, v[i]); 36 | return result; 37 | } 38 | 39 | template class vecType> 40 | GLM_FUNC_QUALIFIER T compMax(vecType const & v) 41 | { 42 | T result(v[0]); 43 | for(length_t i = 1; i < v.length(); ++i) 44 | result = max(result, v[i]); 45 | return result; 46 | } 47 | }//namespace glm 48 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/constants.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #ifndef GLM_GTX_constants 25 | #define GLM_GTX_constants 26 | 27 | #include "../gtc/constants.hpp" 28 | 29 | #if(defined(GLM_MESSAGES)) 30 | # pragma message("GLM: GLM_GTX_constants extension is deprecated, include GLM_GTC_constants (glm/gtc/constants.hpp) instead") 31 | #endif 32 | 33 | #endif//GLM_GTX_constants 34 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/epsilon.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_epsilon extension is deprecated, include GLM_GTC_epsilon (glm/gtc/epsilon) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/epsilon.hpp" 30 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-07 5 | // Updated : 2008-10-05 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/extend.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType extend 14 | ( 15 | genType const & Origin, 16 | genType const & Source, 17 | genType const & Distance 18 | ) 19 | { 20 | return Origin + (Source - Origin) * Distance; 21 | } 22 | 23 | template 24 | GLM_FUNC_QUALIFIER detail::tvec2 extend 25 | ( 26 | detail::tvec2 const & Origin, 27 | detail::tvec2 const & Source, 28 | T const & Distance 29 | ) 30 | { 31 | return Origin + (Source - Origin) * Distance; 32 | } 33 | 34 | template 35 | GLM_FUNC_QUALIFIER detail::tvec3 extend 36 | ( 37 | detail::tvec3 const & Origin, 38 | detail::tvec3 const & Source, 39 | T const & Distance 40 | ) 41 | { 42 | return Origin + (Source - Origin) * Distance; 43 | } 44 | 45 | template 46 | GLM_FUNC_QUALIFIER detail::tvec4 extend 47 | ( 48 | detail::tvec4 const & Origin, 49 | detail::tvec4 const & Source, 50 | T const & Distance 51 | ) 52 | { 53 | return Origin + (Source - Origin) * Distance; 54 | } 55 | }//namespace glm 56 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2009-03-06 5 | // Updated : 2013-04-09 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/gradient_paint.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER T radialGradient 14 | ( 15 | detail::tvec2 const & Center, 16 | T const & Radius, 17 | detail::tvec2 const & Focal, 18 | detail::tvec2 const & Position 19 | ) 20 | { 21 | detail::tvec2 F = Focal - Center; 22 | detail::tvec2 D = Position - Focal; 23 | T Radius2 = pow2(Radius); 24 | T Fx2 = pow2(F.x); 25 | T Fy2 = pow2(F.y); 26 | 27 | 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)); 28 | T Denominator = Radius2 - (Fx2 + Fy2); 29 | return Numerator / Denominator; 30 | } 31 | 32 | template 33 | GLM_FUNC_QUALIFIER T linearGradient 34 | ( 35 | detail::tvec2 const & Point0, 36 | detail::tvec2 const & Point1, 37 | detail::tvec2 const & Position 38 | ) 39 | { 40 | detail::tvec2 Dist = Point1 - Point0; 41 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-02-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/handed_coordinate_space.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER bool rightHanded 14 | ( 15 | detail::tvec3 const & tangent, 16 | detail::tvec3 const & binormal, 17 | detail::tvec3 const & normal 18 | ) 19 | { 20 | return dot(cross(normal, tangent), binormal) > T(0); 21 | } 22 | 23 | template 24 | GLM_FUNC_QUALIFIER bool leftHanded 25 | ( 26 | detail::tvec3 const & tangent, 27 | detail::tvec3 const & binormal, 28 | detail::tvec3 const & normal 29 | ) 30 | { 31 | return dot(cross(normal, tangent), binormal) < T(0); 32 | } 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/int_10_10_10_2.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #ifndef GLM_GTX_int_10_10_10_2 25 | #define GLM_GTX_int_10_10_10_2 26 | 27 | // Dependency: 28 | #include "../glm.hpp" 29 | #include "../gtx/raw_data.hpp" 30 | 31 | #if(defined(GLM_MESSAGES)) 32 | # pragma message("GLM: GLM_GTX_int_10_10_10_2 extension is deprecated, include GLM_GTC_packing (glm/gtc/packing.hpp) instead") 33 | #endif 34 | 35 | namespace glm 36 | { 37 | //! Deprecated, use packUnorm3x10_1x2 instead. 38 | GLM_DEPRECATED GLM_FUNC_DECL dword uint10_10_10_2_cast(glm::vec4 const & v); 39 | 40 | }//namespace glm 41 | 42 | #include "int_10_10_10_2.inl" 43 | 44 | #endif//GLM_GTX_int_10_10_10_2 45 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/int_10_10_10_2.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | namespace glm 25 | { 26 | GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast 27 | ( 28 | glm::vec4 const & v 29 | ) 30 | { 31 | return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30); 32 | } 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-10-24 5 | // Updated : 2008-10-24 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/log_base.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType log( 14 | genType const & x, 15 | genType const & base) 16 | { 17 | assert(x != genType(0)); 18 | 19 | return glm::log(x) / glm::log(base); 20 | } 21 | 22 | VECTORIZE_VEC_SCA(log) 23 | VECTORIZE_VEC_VEC(log) 24 | }//namespace glm 25 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-21 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/matrix_cross_product.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat3x3 matrixCross3 14 | ( 15 | detail::tvec3 const & x 16 | ) 17 | { 18 | detail::tmat3x3 Result(T(0)); 19 | Result[0][1] = x.z; 20 | Result[1][0] = -x.z; 21 | Result[0][2] = -x.y; 22 | Result[2][0] = x.y; 23 | Result[1][2] = x.x; 24 | Result[2][1] = -x.x; 25 | return Result; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER detail::tmat4x4 matrixCross4 30 | ( 31 | detail::tvec3 const & x 32 | ) 33 | { 34 | detail::tmat4x4 Result(T(0)); 35 | Result[0][1] = x.z; 36 | Result[1][0] = -x.z; 37 | Result[0][2] = -x.y; 38 | Result[2][0] = x.y; 39 | Result[1][2] = x.x; 40 | Result[2][1] = -x.x; 41 | return Result; 42 | } 43 | 44 | }//namespace glm 45 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-04-03 5 | // Updated : 2008-09-17 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/mixed_product.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER T mixedProduct 14 | ( 15 | detail::tvec3 const & v1, 16 | detail::tvec3 const & v2, 17 | detail::tvec3 const & v3 18 | ) 19 | { 20 | return dot(cross(v1, v2), v3); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/noise.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_random extension is deprecated, include GLM_GTC_random (glm/gtc/noise.hpp) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/noise.hpp" 30 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2011-06-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/normal.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 triangleNormal 14 | ( 15 | detail::tvec3 const & p1, 16 | detail::tvec3 const & p2, 17 | detail::tvec3 const & p3 18 | ) 19 | { 20 | return normalize(cross(p1 - p2, p1 - p3)); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-05-10 5 | // Updated : 2007-05-10 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/number_precision.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-27 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/optimum_pow.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType pow2(genType const & x) 14 | { 15 | return x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow3(genType const & x) 20 | { 21 | return x * x * x; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER genType pow4(genType const & x) 26 | { 27 | return (x * x) * (x * x); 28 | } 29 | 30 | GLM_FUNC_QUALIFIER bool powOfTwo(int x) 31 | { 32 | return !(x & (x - 1)); 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER detail::tvec2 powOfTwo(detail::tvec2 const & x) 37 | { 38 | return detail::tvec2( 39 | powOfTwo(x.x), 40 | powOfTwo(x.y)); 41 | } 42 | 43 | template 44 | GLM_FUNC_QUALIFIER detail::tvec3 powOfTwo(detail::tvec3 const & x) 45 | { 46 | return detail::tvec3( 47 | powOfTwo(x.x), 48 | powOfTwo(x.y), 49 | powOfTwo(x.z)); 50 | } 51 | 52 | template 53 | GLM_FUNC_QUALIFIER detail::tvec4 powOfTwo(detail::tvec4 const & x) 54 | { 55 | return detail::tvec4( 56 | powOfTwo(x.x), 57 | powOfTwo(x.y), 58 | powOfTwo(x.z), 59 | powOfTwo(x.w)); 60 | } 61 | }//namespace glm 62 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-21 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/orthonormalize.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat3x3 orthonormalize 14 | ( 15 | const detail::tmat3x3& m 16 | ) 17 | { 18 | detail::tmat3x3 r = m; 19 | 20 | r[0] = normalize(r[0]); 21 | 22 | float d0 = dot(r[0], r[1]); 23 | r[1] -= r[0] * d0; 24 | r[1] = normalize(r[1]); 25 | 26 | float d1 = dot(r[1], r[2]); 27 | d0 = dot(r[0], r[2]); 28 | r[2] -= r[0] * d0 + r[1] * d1; 29 | r[2] = normalize(r[2]); 30 | 31 | return r; 32 | } 33 | 34 | template 35 | GLM_FUNC_QUALIFIER detail::tvec3 orthonormalize 36 | ( 37 | const detail::tvec3& x, 38 | const detail::tvec3& y 39 | ) 40 | { 41 | return normalize(x - y * dot(y, x)); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-03-06 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/perpendicular.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER vecType perp 14 | ( 15 | vecType const & x, 16 | vecType const & Normal 17 | ) 18 | { 19 | return x - proj(x, Normal); 20 | } 21 | }//namespace glm 22 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-03-06 5 | // Updated : 2009-05-01 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/polar_coordinates.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 polar 14 | ( 15 | detail::tvec3 const & euclidean 16 | ) 17 | { 18 | T const Length(length(euclidean)); 19 | detail::tvec3 const tmp(euclidean / Length); 20 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 21 | 22 | #ifdef GLM_FORCE_RADIANS 23 | return detail::tvec3( 24 | atan(xz_dist, tmp.y), // latitude 25 | atan(tmp.x, tmp.z), // longitude 26 | xz_dist); // xz distance 27 | #else 28 | # pragma message("GLM: polar function returning degrees is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") 29 | return detail::tvec3( 30 | degrees(atan(xz_dist, tmp.y)), // latitude 31 | degrees(atan(tmp.x, tmp.z)), // longitude 32 | xz_dist); // xz distance 33 | #endif 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER detail::tvec3 euclidean 38 | ( 39 | detail::tvec2 const & polar 40 | ) 41 | { 42 | #ifdef GLM_FORCE_RADIANS 43 | T const latitude(polar.x); 44 | T const longitude(polar.y); 45 | #else 46 | # pragma message("GLM: euclidean function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") 47 | T const latitude(radians(polar.x)); 48 | T const longitude(radians(polar.y)); 49 | #endif 50 | 51 | return detail::tvec3( 52 | cos(latitude) * sin(longitude), 53 | sin(latitude), 54 | cos(latitude) * cos(longitude)); 55 | } 56 | 57 | }//namespace glm 58 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-03-06 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/projection.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER vecType proj 14 | ( 15 | vecType const & x, 16 | vecType const & Normal 17 | ) 18 | { 19 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 20 | } 21 | }//namespace glm 22 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/random.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_random extension is deprecated, include GLM_GTC_random instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/random.hpp" 30 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-11-19 5 | // Updated : 2008-11-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/raw_data.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | // Dependency: 10 | // - GLM core 11 | /////////////////////////////////////////////////////////////////////////////////////////////////// 12 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/reciprocal.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_reciprocal extension is deprecated, include GLM_GTC_reciprocal instead") 26 | #endif 27 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/scalar_relational.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_scalar_relational 24 | /// @file glm/gtx/scalar_relational.hpp 25 | /// @date 2013-02-04 / 2013-02-04 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_extend GLM_GTX_scalar_relational 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Extend a position from a source to a position at a defined length. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_scalar_relational 39 | #define GLM_GTX_scalar_relational 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) 45 | # pragma message("GLM: GLM_GTX_extend extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_scalar_relational 51 | /// @{ 52 | 53 | 54 | 55 | /// @} 56 | }//namespace glm 57 | 58 | #include "scalar_relational.inl" 59 | 60 | #endif//GLM_GTX_scalar_relational 61 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/scalar_relational.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2013-02-04 5 | // Updated : 2013-02-04 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/scalar_relational.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER bool lessThan 14 | ( 15 | T const & x, 16 | T const & y 17 | ) 18 | { 19 | return x < y; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER bool lessThanEqual 24 | ( 25 | T const & x, 26 | T const & y 27 | ) 28 | { 29 | return x <= y; 30 | } 31 | 32 | template 33 | GLM_FUNC_QUALIFIER bool greaterThan 34 | ( 35 | T const & x, 36 | T const & y 37 | ) 38 | { 39 | return x > y; 40 | } 41 | 42 | template 43 | GLM_FUNC_QUALIFIER bool greaterThanEqual 44 | ( 45 | T const & x, 46 | T const & y 47 | ) 48 | { 49 | return x >= y; 50 | } 51 | 52 | template 53 | GLM_FUNC_QUALIFIER bool equal 54 | ( 55 | T const & x, 56 | T const & y 57 | ) 58 | { 59 | return x == y; 60 | } 61 | 62 | template 63 | GLM_FUNC_QUALIFIER bool notEqual 64 | ( 65 | T const & x, 66 | T const & y 67 | ) 68 | { 69 | return x != y; 70 | } 71 | 72 | GLM_FUNC_QUALIFIER bool any 73 | ( 74 | bool const & x 75 | ) 76 | { 77 | return x; 78 | } 79 | 80 | GLM_FUNC_QUALIFIER bool all 81 | ( 82 | bool const & x 83 | ) 84 | { 85 | return x; 86 | } 87 | 88 | GLM_FUNC_QUALIFIER bool not_ 89 | ( 90 | bool const & x 91 | ) 92 | { 93 | return !x; 94 | } 95 | }//namespace glm 96 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-06-08 5 | // Updated : 2008-06-08 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/std_based_type.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-04-29 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/transform.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat4x4 translate( 14 | detail::tvec3 const & v) 15 | { 16 | return translate( 17 | detail::tmat4x4(1.0f), v); 18 | } 19 | 20 | template 21 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 22 | T angle, 23 | detail::tvec3 const & v) 24 | { 25 | return rotate( 26 | detail::tmat4x4(1), angle, v); 27 | } 28 | 29 | template 30 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale( 31 | detail::tvec3 const & v) 32 | { 33 | return scale( 34 | detail::tmat4x4(1.0f), v); 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/ulp.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_ulp extension is deprecated, include GLM_GTC_ulp (glm/gtc/ulp.hpp) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/ulp.hpp" 30 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/unsigned_int.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_unsigned_int extension is deprecated, include GLM_GTX_integer instead") 26 | #endif 27 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/unsigned_int.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-24 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/unsigned_int.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | }//namespace glm 14 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/gtx/vec1.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_vec1 24 | /// @file glm/gtx/vec1.inl 25 | /// @date 2013-03-16 / 2013-03-16 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/integer.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/integer.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_INTEGER_INCLUDED 30 | #define GLM_INTEGER_INCLUDED 31 | 32 | #include "detail/func_integer.hpp" 33 | 34 | #endif//GLM_INTEGER_INCLUDED 35 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/matrix.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/matrix.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_MATRIX_INCLUDED 30 | #define GLM_MATRIX_INCLUDED 31 | 32 | #include "detail/func_matrix.hpp" 33 | 34 | #endif//GLM_MATRIX_INCLUDED 35 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/packing.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/packing.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_PACKING_INCLUDED 30 | #define GLM_PACKING_INCLUDED 31 | 32 | #include "detail/func_packing.hpp" 33 | 34 | #endif//GLM_PACKING_INCLUDED 35 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/trigonometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/trigonometric.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_TRIGONOMETRIC_INCLUDED 30 | #define GLM_TRIGONOMETRIC_INCLUDED 31 | 32 | #include "detail/func_trigonometric.hpp" 33 | 34 | #endif//GLM_TRIGONOMETRIC_INCLUDED 35 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/vec2.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/vec2.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_VEC2_INCLUDED 30 | #define GLM_VEC2_INCLUDED 31 | 32 | #include "detail/type_vec2.hpp" 33 | 34 | #endif//GLM_VEC2_INCLUDED 35 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/vec3.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/vec3.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_VEC3_INCLUDED 30 | #define GLM_VEC3_INCLUDED 31 | 32 | #include "detail/type_vec3.hpp" 33 | 34 | #endif//GLM_VEC3_INCLUDED 35 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/vec4.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/vec4.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_VEC4_INCLUDED 30 | #define GLM_VEC4_INCLUDED 31 | 32 | #include "detail/type_vec4.hpp" 33 | 34 | #endif//GLM_VEC4_INCLUDED 35 | -------------------------------------------------------------------------------- /source/common/thirdparty/glm/glm/vector_relational.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/vector_relational.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_VECTOR_RELATIONAL_INCLUDED 30 | #define GLM_VECTOR_RELATIONAL_INCLUDED 31 | 32 | #include "detail/func_vector_relational.hpp" 33 | 34 | #endif//GLM_VECTOR_RELATIONAL_INCLUDED 35 | --------------------------------------------------------------------------------