├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── example └── android │ ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── kenneycode │ │ │ └── triangle │ │ │ └── example │ │ │ └── ExampleInstrumentedTest.kt │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── cpp │ │ │ ├── CMakeLists.txt │ │ │ └── example.cpp │ │ ├── java │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── kenneycode │ │ │ │ └── triangle │ │ │ │ └── example │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ └── activity_main.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── io │ │ └── github │ │ └── kenneycode │ │ └── triangle │ │ └── example │ │ └── ExampleUnitTest.kt │ ├── build.gradle │ ├── gradle │ └── wrapper │ │ └── gradle-wrapper.jar │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── snapshots ├── 0.gif ├── 1.gif └── 2.gif ├── src ├── Camera.cpp ├── Camera.h ├── Common.h ├── Engine.cpp ├── Engine.h ├── Material.cpp ├── Material.h ├── Mesh.cpp ├── Mesh.h ├── Node.cpp ├── Node.h ├── Primitive.cpp ├── Primitive.h ├── Program.cpp ├── Program.h ├── Scene.cpp └── Scene.h └── third_party ├── glm ├── CMakeLists.txt ├── CTestConfig.cmake ├── copying.txt ├── glm │ ├── CMakeLists.txt │ ├── core │ │ ├── _detail.hpp │ │ ├── _fixes.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 │ │ ├── hint.hpp │ │ ├── intrinsic_common.hpp │ │ ├── intrinsic_common.inl │ │ ├── intrinsic_exponential.hpp │ │ ├── intrinsic_exponential.inl │ │ ├── intrinsic_geometric.hpp │ │ ├── intrinsic_geometric.inl │ │ ├── intrinsic_matrix.hpp │ │ ├── intrinsic_matrix.inl │ │ ├── intrinsic_trigonometric.hpp │ │ ├── intrinsic_trigonometric.inl │ │ ├── intrinsic_vector_relational.hpp │ │ ├── intrinsic_vector_relational.inl │ │ ├── setup.hpp │ │ ├── type.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_size.hpp │ │ ├── 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 │ ├── ext.hpp │ ├── glm.hpp │ ├── gtc │ │ ├── half_float.hpp │ │ ├── half_float.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 │ │ ├── quaternion.hpp │ │ ├── quaternion.inl │ │ ├── random.hpp │ │ ├── random.inl │ │ ├── swizzle.hpp │ │ ├── swizzle.inl │ │ ├── type_precision.hpp │ │ ├── type_precision.inl │ │ ├── type_ptr.hpp │ │ └── type_ptr.inl │ ├── gtx │ │ ├── associated_min_max.hpp │ │ ├── associated_min_max.inl │ │ ├── bit.hpp │ │ ├── bit.inl │ │ ├── closest_point.hpp │ │ ├── closest_point.inl │ │ ├── color_cast.hpp │ │ ├── color_cast.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 │ │ ├── constants.inl │ │ ├── epsilon.hpp │ │ ├── epsilon.inl │ │ ├── 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 │ │ ├── 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 │ │ ├── mixed_product.hpp │ │ ├── mixed_product.inl │ │ ├── multiple.hpp │ │ ├── multiple.inl │ │ ├── noise.hpp │ │ ├── noise.inl │ │ ├── norm.hpp │ │ ├── norm.inl │ │ ├── normal.hpp │ │ ├── normal.inl │ │ ├── normalize_dot.hpp │ │ ├── normalize_dot.inl │ │ ├── number_precision.hpp │ │ ├── number_precision.inl │ │ ├── ocl_type.hpp │ │ ├── ocl_type.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 │ │ ├── random.inl │ │ ├── raw_data.hpp │ │ ├── raw_data.inl │ │ ├── reciprocal.hpp │ │ ├── reciprocal.inl │ │ ├── rotate_vector.hpp │ │ ├── rotate_vector.inl │ │ ├── simd_mat4.hpp │ │ ├── simd_mat4.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 │ │ ├── ulp.inl │ │ ├── unsigned_int.hpp │ │ ├── unsigned_int.inl │ │ ├── vec1.hpp │ │ ├── vec1.inl │ │ ├── vector_access.hpp │ │ ├── vector_access.inl │ │ ├── vector_angle.hpp │ │ ├── vector_angle.inl │ │ ├── vector_query.hpp │ │ ├── vector_query.inl │ │ ├── verbose_operator.hpp │ │ ├── verbose_operator.inl │ │ ├── wrap.hpp │ │ └── wrap.inl │ └── virtrev │ │ └── xstream.hpp ├── readme.txt └── util │ ├── FindGLM.cmake │ ├── autoexp.txt │ ├── autoexp.vc2010.dat │ ├── gen_external_templates.py │ ├── glm_core.cpp │ └── usertype.dat └── tinygltf └── include ├── json.hpp ├── stb_image.h ├── stb_image_write.h └── tiny_gltf.h /.gitignore: -------------------------------------------------------------------------------- 1 | cmake-build-debug 2 | .gradle 3 | .idea 4 | .android/.gradle 5 | .android/.idea 6 | samples/android/app/.cxx 7 | *.properties 8 | *.iml 9 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | 3 | project(triangle CXX) 4 | 5 | add_definitions(-std=c++14) 6 | add_definitions(-DTINYGLTF_IMPLEMENTATION) 7 | add_definitions(-DSTB_IMAGE_IMPLEMENTATION) 8 | add_definitions(-DSTB_IMAGE_WRITE_IMPLEMENTATION) 9 | 10 | include_directories(src) 11 | 12 | file(GLOB_RECURSE SRCS src/*.cpp) 13 | 14 | add_library(triangle SHARED ${SRCS}) 15 | 16 | find_library(log-lib 17 | log ) 18 | 19 | target_link_libraries(triangle log GLESv3) 20 | 21 | target_include_directories( 22 | triangle 23 | PUBLIC 24 | third_party/glm 25 | third_party/tinygltf/include 26 | ) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2021 kenney 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### triangle 2 | triangle is a tiny 3D render engine for learning 3D render technologies. 3 | 4 | ![](snapshots/0.gif)![](snapshots/1.gif)![](snapshots/2.gif) -------------------------------------------------------------------------------- /example/android/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | android { 8 | compileSdkVersion 29 9 | buildToolsVersion "29.0.2" 10 | defaultConfig { 11 | applicationId "io.github.kenneycode.triangle.demo" 12 | minSdkVersion 18 13 | targetSdkVersion 27 14 | versionCode 1 15 | versionName "1.0" 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | ndk { 18 | abiFilters "armeabi-v7a" 19 | } 20 | } 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 25 | } 26 | } 27 | externalNativeBuild { 28 | cmake { 29 | path "src/main/cpp/CMakeLists.txt" 30 | } 31 | } 32 | 33 | } 34 | 35 | dependencies { 36 | implementation fileTree(dir: 'libs', include: ['*.jar']) 37 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 38 | implementation 'androidx.appcompat:appcompat:1.0.2' 39 | implementation 'androidx.core:core-ktx:1.0.2' 40 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 41 | testImplementation 'junit:junit:4.12' 42 | androidTestImplementation 'androidx.test.ext:junit:1.1.0' 43 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 44 | } 45 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /example/android/app/src/androidTest/java/io/github/kenneycode/triangle/example/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.kenneycode.triangle.example 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("io.github.kenneycode.triangle.demo", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /example/android/app/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | 3 | project(example CXX) 4 | 5 | add_definitions(-std=c++14) 6 | 7 | add_subdirectory(../../../../../../ triangle) 8 | 9 | include_directories(../../../../../../src) 10 | 11 | add_library(example SHARED example.cpp) 12 | 13 | target_include_directories(example PUBLIC ../../../../../../src) 14 | target_link_libraries(example triangle) -------------------------------------------------------------------------------- /example/android/app/src/main/cpp/example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define R 5 6 | 7 | std::shared_ptr engine; 8 | std::shared_ptr camera; 9 | float x = 0.0f, z = 0.0f; 10 | 11 | extern "C" 12 | { 13 | 14 | extern "C" JNIEXPORT void 15 | JNICALL Java_io_github_kenneycode_triangle_example_MainActivity_drawFrame(JNIEnv *env, jobject /* this */, jint width, jint height, jlong timestamp) { 16 | if (engine == nullptr) { 17 | engine = std::make_shared(width, height); 18 | camera = std::make_shared(glm::vec3(0.0f, 0.0f, R), glm::vec3(0.0f, 0.0f, 0.0f), 19 | glm::vec3(0.0f, 1.0f, 0.0f), 70.0f, float(width) / height, 1.0f, 10.0f); 20 | engine->setDefaultCamera(camera); 21 | engine->loadGLTF("/sdcard/DamagedHelmet/glTF/DamagedHelmet.gltf"); 22 | } 23 | auto theta = -timestamp % 100000 / 1000.0f; 24 | x = R * cos(theta); 25 | z = R * sin(theta); 26 | camera->setPosition(glm::vec3(x, 0.0f, z)); 27 | engine->drawFrame(); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /example/android/app/src/main/java/io/github/kenneycode/triangle/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.github.kenneycode.triangle.example 2 | 3 | import android.Manifest 4 | import android.opengl.GLSurfaceView 5 | import android.os.Bundle 6 | import androidx.appcompat.app.AppCompatActivity 7 | import androidx.core.app.ActivityCompat 8 | import javax.microedition.khronos.egl.EGLConfig 9 | import javax.microedition.khronos.opengles.GL10 10 | 11 | class MainActivity : AppCompatActivity() { 12 | 13 | init { 14 | System.loadLibrary("example") 15 | System.loadLibrary("triangle") 16 | } 17 | 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | super.onCreate(savedInstanceState) 20 | setContentView(R.layout.activity_main) 21 | ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 1) 22 | val glSurfaceView = findViewById(R.id.glSurfaceView) 23 | glSurfaceView.setEGLContextClientVersion(3) 24 | glSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 8, 0) 25 | glSurfaceView.setRenderer(object : GLSurfaceView.Renderer { 26 | 27 | private var width = 0 28 | private var height = 0 29 | 30 | override fun onDrawFrame(gl: GL10?) { 31 | drawFrame(width, height, System.currentTimeMillis()) 32 | } 33 | 34 | override fun onSurfaceChanged(gl: GL10?, width: Int, height: Int) { 35 | this.width = width 36 | this.height = height 37 | } 38 | 39 | override fun onSurfaceCreated(gl: GL10?, config: EGLConfig?) { 40 | 41 | } 42 | 43 | }) 44 | glSurfaceView.renderMode = GLSurfaceView.RENDERMODE_CONTINUOUSLY 45 | } 46 | 47 | private external fun drawFrame(width: Int, height: Int, timestamp: Long) 48 | 49 | } 50 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | triangle 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /example/android/app/src/test/java/io/github/kenneycode/triangle/example/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.kenneycode.triangle.example 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.3.50' 5 | repositories { 6 | google() 7 | jcenter() 8 | 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.5.3' 12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | 23 | } 24 | } 25 | 26 | task clean(type: Delete) { 27 | delete rootProject.buildDir 28 | } 29 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name='triangle' 3 | -------------------------------------------------------------------------------- /snapshots/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/snapshots/0.gif -------------------------------------------------------------------------------- /snapshots/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/snapshots/1.gif -------------------------------------------------------------------------------- /snapshots/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/snapshots/2.gif -------------------------------------------------------------------------------- /src/Camera.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "Camera.h" 18 | #include 19 | 20 | namespace triangle { 21 | Camera::Camera(glm::vec3 position, glm::vec3 lookAt, glm::vec3 up, float fov, 22 | float aspectRatio, float nearPlane, float farPlane) 23 | : position_(position), lookAt_(lookAt), up_(up), fov_(fov), 24 | aspectRatio_(aspectRatio), nearPlane_(nearPlane), farPlane_(farPlane) {} 25 | 26 | const glm::mat4 &Camera::getViewMatrix() { 27 | viewMatrix_ = glm::lookAt(position_, lookAt_, up_); 28 | return viewMatrix_; 29 | } 30 | 31 | const glm::mat4 &Camera::getProjectMatrix() { 32 | projectMatrix_ = glm::perspective(fov_, aspectRatio_, nearPlane_, farPlane_); 33 | return projectMatrix_; 34 | } 35 | 36 | void Camera::setPosition(glm::vec3 position) { position_ = position; } 37 | 38 | } // namespace triangle -------------------------------------------------------------------------------- /src/Camera.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace triangle { 23 | 24 | class Camera { 25 | 26 | public: 27 | Camera(glm::vec3 position, glm::vec3 lookAt, glm::vec3 up, float fov, 28 | float aspectRatio, float nearPlane, float farPlane); 29 | const glm::mat4 &getViewMatrix(); 30 | const glm::mat4 &getProjectMatrix(); 31 | void setPosition(glm::vec3 position); 32 | 33 | private: 34 | glm::vec3 position_; 35 | glm::vec3 lookAt_; 36 | glm::vec3 up_; 37 | float fov_; 38 | float aspectRatio_; 39 | float nearPlane_; 40 | float farPlane_; 41 | glm::mat4 viewMatrix_{}; 42 | glm::mat4 projectMatrix_{}; 43 | }; 44 | 45 | } // namespace triangle -------------------------------------------------------------------------------- /src/Common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace triangle { 23 | #define GL_CHECK(f) \ 24 | f; \ 25 | { \ 26 | auto error = glGetError(); \ 27 | if (error != 0) { \ 28 | std::cout << "GL error = " << error << std::endl; \ 29 | } \ 30 | assert(error == 0); \ 31 | } 32 | 33 | const std::string VERTEX_SHADER = 34 | "#version 300 es\n" 35 | "precision mediump float;\n" 36 | "layout(location = 0) in vec4 a_position;\n" 37 | "layout(location = 1) in vec2 a_normal;\n" 38 | "layout(location = 2) in vec2 a_texCoord0;\n" 39 | "out vec2 v_texCoord0;\n" 40 | "uniform mat4 u_modelViewProjectMatrix;\n" 41 | "void main() {\n" 42 | " gl_Position = u_modelViewProjectMatrix * a_position;\n" 43 | " v_texCoord0 = a_texCoord0;\n" 44 | "}"; 45 | 46 | const std::string FRAGMENT_SHADER = 47 | "#version 300 es\n" 48 | "precision mediump float;\n" 49 | "in vec2 v_texCoord0;\n" 50 | "out vec4 outColor;\n" 51 | "uniform sampler2D u_baseColorTexture;\n" 52 | "void main() {\n" 53 | " outColor = texture(u_baseColorTexture, v_texCoord0);\n" 54 | "}"; 55 | 56 | #define UNIFORM_BASE_COLOR_TEXTURE "u_baseColorTexture" 57 | #define UNIFORM_MODEL_VIEW_PROJECT_MATRIX "u_modelViewProjectMatrix" 58 | 59 | } // namespace triangle -------------------------------------------------------------------------------- /src/Engine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "Material.h" 20 | #include "Program.h" 21 | #include "Scene.h" 22 | #include 23 | #include 24 | #include 25 | 26 | class Scene; 27 | 28 | namespace triangle { 29 | 30 | class Engine { 31 | 32 | public: 33 | Engine(unsigned int width, unsigned int height); 34 | void loadGLTF(const std::string &path); 35 | void setDefaultCamera(std::shared_ptr defaultCamera); 36 | void drawFrame(); 37 | 38 | private: 39 | void init(); 40 | void buildDefaultCamera(); 41 | void buildProgram(); 42 | void buildScenes(); 43 | std::shared_ptr 44 | buildScene(const tinygltf::Model &model, unsigned int sceneIndex, 45 | const std::shared_ptr> &buffers, 46 | const std::shared_ptr> &textures); 47 | std::shared_ptr> 48 | buildBuffers(const tinygltf::Model &model); 49 | std::shared_ptr> 50 | buildTextures(const tinygltf::Model &model); 51 | std::shared_ptr 52 | buildNode(const tinygltf::Model &model, unsigned int nodeIndex, 53 | const std::shared_ptr> &buffers, 54 | const std::shared_ptr> &textures, 55 | std::shared_ptr parent = nullptr); 56 | std::shared_ptr 57 | buildMesh(const tinygltf::Model &model, unsigned int meshIndex, 58 | const std::shared_ptr> &buffers, 59 | const std::shared_ptr> &textures); 60 | std::shared_ptr 61 | buildMaterial(const tinygltf::Model &model, unsigned int materialIndex, 62 | const std::shared_ptr> &textures); 63 | std::shared_ptr 64 | buildPrimitive(const tinygltf::Model &model, unsigned int meshIndex, 65 | unsigned int primitiveIndex, 66 | const std::shared_ptr> &vaos, 67 | const std::shared_ptr> &buffers, 68 | const std::shared_ptr> &textures); 69 | GLuint buildDefaultBaseColorTexture(const tinygltf::Model &model); 70 | std::vector> scenes_; 71 | std::shared_ptr camera_; 72 | std::shared_ptr program_; 73 | bool initialized_ = false; 74 | unsigned int width = 0; 75 | unsigned int height = 0; 76 | std::vector> preDefinedAttributes; 77 | tinygltf::Model model_; 78 | }; 79 | 80 | } // namespace triangle -------------------------------------------------------------------------------- /src/Material.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "Material.h" 18 | #include "Common.h" 19 | 20 | namespace triangle { 21 | 22 | Material::Material(GLuint baseColorTexture, int baseColorTextureLocation) 23 | : baseColorTexture_(baseColorTexture), 24 | baseColorTextureLocation_(baseColorTextureLocation) {} 25 | void Material::bind() { 26 | GL_CHECK(glActiveTexture(GL_TEXTURE0)); 27 | GL_CHECK(glBindTexture(GL_TEXTURE_2D, baseColorTexture_)); 28 | GL_CHECK(glUniform1i(baseColorTextureLocation_, 0)); 29 | } 30 | 31 | } // namespace triangle 32 | -------------------------------------------------------------------------------- /src/Material.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace triangle { 22 | 23 | class Material { 24 | public: 25 | Material(GLuint baseColorTexture, int baseColorTextureLocation); 26 | void bind(); 27 | 28 | private: 29 | GLuint baseColorTexture_; 30 | int baseColorTextureLocation_; 31 | }; 32 | 33 | } // namespace triangle 34 | -------------------------------------------------------------------------------- /src/Mesh.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "Mesh.h" 18 | #include 19 | 20 | namespace triangle { 21 | 22 | Mesh::Mesh(std::shared_ptr>> primitives) 23 | : primitives_(std::move(primitives)) {} 24 | 25 | void Mesh::draw() { 26 | for (auto &primitive : *primitives_) { 27 | primitive->draw(); 28 | } 29 | } 30 | 31 | } // namespace triangle -------------------------------------------------------------------------------- /src/Mesh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "Primitive.h" 20 | #include 21 | #include 22 | #include 23 | 24 | namespace triangle { 25 | 26 | class Mesh { 27 | 28 | public: 29 | Mesh(std::shared_ptr>> primitives); 30 | void draw(); 31 | 32 | private: 33 | std::shared_ptr>> primitives_; 34 | }; 35 | 36 | } // namespace triangle 37 | -------------------------------------------------------------------------------- /src/Node.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "Node.h" 18 | #include "Scene.h" 19 | #include 20 | #include 21 | 22 | namespace triangle { 23 | 24 | Node::Node(std::shared_ptr parent) 25 | : parent_(std::move(parent)), matrix_(glm::mat4(1.0f)) {} 26 | 27 | void Node::draw() { 28 | if (mesh_ != nullptr) { 29 | mesh_->draw(); 30 | } 31 | } 32 | 33 | void Node::setMatrix(const glm::mat4 &mat) { this->matrix_ = mat; } 34 | 35 | const glm::mat4 &Node::getMatrix() { return matrix_; } 36 | 37 | glm::mat4 Node::getWorldMatrix() { 38 | return parent_ != nullptr ? parent_->getWorldMatrix() * matrix_ : matrix_; 39 | } 40 | 41 | void Node::addChild(const std::shared_ptr &node) { 42 | children_.push_back(node); 43 | } 44 | 45 | void Node::setMesh(std::shared_ptr mesh) { 46 | this->mesh_ = std::move(mesh); 47 | } 48 | 49 | const std::vector> &Node::getChildren() { 50 | return children_; 51 | } 52 | 53 | } // namespace triangle 54 | -------------------------------------------------------------------------------- /src/Node.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "Camera.h" 20 | #include "Mesh.h" 21 | #include 22 | #include 23 | #include 24 | 25 | namespace triangle { 26 | 27 | class Scene; 28 | 29 | class Node { 30 | 31 | public: 32 | Node(std::shared_ptr parent = nullptr); 33 | void setMatrix(const glm::mat4 &mat); 34 | const glm::mat4 &getMatrix(); 35 | glm::mat4 getWorldMatrix(); 36 | void addChild(const std::shared_ptr &node); 37 | void setMesh(std::shared_ptr mesh); 38 | const std::vector> &getChildren(); 39 | void draw(); 40 | 41 | private: 42 | std::vector> children_; 43 | std::shared_ptr parent_; 44 | glm::mat4 matrix_; 45 | std::shared_ptr mesh_; 46 | }; 47 | 48 | } // namespace triangle -------------------------------------------------------------------------------- /src/Primitive.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "Primitive.h" 18 | #include "Common.h" 19 | #include 20 | 21 | namespace triangle { 22 | Primitive::Primitive(GLuint vao, int mode, int count, int componentType, 23 | int offset) 24 | : vao_(vao), mode_(mode), count_(count), componentType_(componentType), 25 | offset_(offset) {} 26 | 27 | void Primitive::setMaterial(std::shared_ptr material) { 28 | material_ = std::move(material); 29 | } 30 | 31 | void Primitive::draw() { 32 | material_->bind(); 33 | GL_CHECK(glBindVertexArray(vao_)); 34 | if (offset_ >= 0) { 35 | GL_CHECK(glDrawElements(mode_, count_, componentType_, (void *)offset_)); 36 | } else { 37 | GL_CHECK(glDrawArrays(mode_, 0, count_)); 38 | } 39 | GL_CHECK(glBindVertexArray(0)); 40 | } 41 | 42 | } // namespace triangle 43 | -------------------------------------------------------------------------------- /src/Primitive.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "Material.h" 20 | #include 21 | #include 22 | 23 | namespace triangle { 24 | 25 | class Primitive { 26 | 27 | public: 28 | Primitive(GLuint vao, int type, int count, int componentType, 29 | int offset = -1); 30 | void setMaterial(std::shared_ptr material); 31 | void draw(); 32 | 33 | private: 34 | GLuint vao_; 35 | int mode_; 36 | int count_; 37 | int componentType_; 38 | int offset_; 39 | std::shared_ptr material_; 40 | }; 41 | 42 | } // namespace triangle 43 | -------------------------------------------------------------------------------- /src/Program.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "Program.h" 18 | #include "Common.h" 19 | 20 | Program::Program(const std::string &vertexShaderCode, 21 | const std::string &fragmentShaderCode) { 22 | 23 | program_ = GL_CHECK(glCreateProgram()); 24 | 25 | auto vertexShader = GL_CHECK(glCreateShader(GL_VERTEX_SHADER)); 26 | auto fragmentShader = GL_CHECK(glCreateShader(GL_FRAGMENT_SHADER)); 27 | 28 | auto pVertexShader = vertexShaderCode.c_str(); 29 | GL_CHECK(glShaderSource(vertexShader, 1, &pVertexShader, nullptr)); 30 | auto pFragmentShader = fragmentShaderCode.c_str(); 31 | GL_CHECK(glShaderSource(fragmentShader, 1, &pFragmentShader, nullptr)); 32 | 33 | GL_CHECK(glCompileShader(vertexShader)); 34 | GL_CHECK(glCompileShader(fragmentShader)); 35 | 36 | GL_CHECK(glAttachShader(program_, vertexShader)); 37 | GL_CHECK(glAttachShader(program_, fragmentShader)); 38 | 39 | GL_CHECK(glLinkProgram(program_)); 40 | } 41 | 42 | void Program::bind() { GL_CHECK(glUseProgram(program_)); } 43 | 44 | GLuint Program::getProgram() { return program_; } 45 | -------------------------------------------------------------------------------- /src/Program.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | class Program { 23 | 24 | public: 25 | Program(const std::string &vertexShaderCode, 26 | const std::string &fragmentShaderCode); 27 | void bind(); 28 | GLuint getProgram(); 29 | 30 | private: 31 | GLuint program_; 32 | }; -------------------------------------------------------------------------------- /src/Scene.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "Scene.h" 18 | 19 | #include 20 | 21 | namespace triangle { 22 | 23 | void Scene::addNode(const std::shared_ptr &node) { 24 | nodes_.push_back(node); 25 | } 26 | 27 | void Scene::traverse( 28 | const std::function node)> &callback) { 29 | for (auto &node : nodes_) { 30 | traverseInternal(node, callback); 31 | } 32 | } 33 | 34 | void Scene::traverseInternal( 35 | const std::shared_ptr &node, 36 | const std::function)> &nodeProcessor) { 37 | nodeProcessor(node); 38 | auto &children = node->getChildren(); 39 | for (auto &child : children) { 40 | traverseInternal(child, nodeProcessor); 41 | } 42 | } 43 | 44 | } // namespace triangle -------------------------------------------------------------------------------- /src/Scene.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 kenney 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include "Camera.h" 20 | #include "Node.h" 21 | 22 | namespace triangle { 23 | 24 | class Scene { 25 | 26 | public: 27 | void addNode(const std::shared_ptr &node); 28 | void traverse( 29 | const std::function node)> &nodeProcessor); 30 | 31 | private: 32 | void traverseInternal( 33 | const std::shared_ptr &node, 34 | const std::function node)> &nodeProcessor); 35 | std::vector> nodes_; 36 | }; 37 | 38 | } // namespace triangle -------------------------------------------------------------------------------- /third_party/glm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6 FATAL_ERROR) 2 | cmake_policy(VERSION 2.6) 3 | 4 | project(glm) 5 | enable_testing() 6 | 7 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) 8 | 9 | option(GLM_TEST_ENABLE "GLM test" OFF) 10 | if(NOT GLM_TEST_ENABLE) 11 | message(FATAL_ERROR "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench") 12 | endif() 13 | 14 | option(GLM_TEST_ENABLE_CXX_11 "Enable C++ 11" OFF) 15 | if(GLM_TEST_ENABLE_CXX_11) 16 | if(CMAKE_COMPILER_IS_GNUCXX) 17 | add_definitions(-std=c++0x) 18 | endif() 19 | elseif(NOT GLM_TEST_ENABLE_CXX_11) 20 | if(CMAKE_COMPILER_IS_GNUCXX) 21 | add_definitions(-std=c++98) 22 | endif() 23 | endif() 24 | 25 | option(GLM_TEST_ENABLE_MS_EXTENSIONS "Enable MS extensions" OFF) 26 | if(GLM_TEST_ENABLE_MS_EXTENSIONS) 27 | if(CMAKE_COMPILER_IS_GNUCXX) 28 | #Doesn't seem to work... 29 | #add_definitions(-fms-extensions) 30 | #add_definitions(-D_MSC_EXTENSIONS) 31 | endif() 32 | elseif(NOT GLM_TEST_ENABLE_MS_EXTENSIONS) 33 | if(CMAKE_COMPILER_IS_GNUCXX) 34 | add_definitions(-std=c++98) 35 | add_definitions(-pedantic) 36 | endif() 37 | 38 | if(MSVC) 39 | add_definitions(/Za) 40 | endif() 41 | endif() 42 | 43 | option(GLM_TEST_ENABLE_SIMD "Enable SIMD optimizations" OFF) 44 | if(GLM_TEST_ENABLE_SIMD) 45 | if(CMAKE_COMPILER_IS_GNUCXX) 46 | add_definitions(-msse2) 47 | endif() 48 | 49 | if(MSVC) 50 | add_definitions(/arch:SSE2) 51 | endif() 52 | elseif(NOT GLM_TEST_ENABLE_SIMD) 53 | 54 | add_definitions(-DGLM_FORCE_PURE) 55 | 56 | if(CMAKE_COMPILER_IS_GNUCXX) 57 | add_definitions(-mfpmath=387) 58 | endif() 59 | endif() 60 | 61 | option(GLM_TEST_ENABLE_FAST_MATH "Enable fast math optimizations" OFF) 62 | if(GLM_TEST_ENABLE_FAST_MATH) 63 | if(CMAKE_COMPILER_IS_GNUCXX) 64 | add_definitions(-ffast-math) 65 | endif() 66 | 67 | if(MSVC) 68 | add_definitions(/fp:fast) 69 | endif() 70 | elseif(NOT GLM_TEST_ENABLE_FAST_MATH) 71 | if(MSVC) 72 | add_definitions(/fp:precise) 73 | endif() 74 | endif() 75 | 76 | if(CMAKE_COMPILER_IS_GNUCXX) 77 | #add_definitions(-S) 78 | #add_definitions(-s) 79 | #add_definitions(-m32) 80 | #add_definitions(-O3) 81 | 82 | #add_definitions(-fprofile-arcs -ftest-coverage) gcov 83 | #ctest_enable_coverage() 84 | endif() 85 | 86 | include_directories(".") 87 | include_directories("./test/external") 88 | 89 | add_subdirectory(glm) 90 | add_subdirectory(test) 91 | add_subdirectory(bench) 92 | add_subdirectory(doc) 93 | 94 | install(DIRECTORY glm DESTINATION include) 95 | -------------------------------------------------------------------------------- /third_party/glm/CTestConfig.cmake: -------------------------------------------------------------------------------- 1 | ## This file should be placed in the root directory of your project. 2 | ## Then modify the CMakeLists.txt file in the root directory of your 3 | ## project to incorporate the testing dashboard. 4 | ## # The following are required to uses Dart and the Cdash dashboard 5 | ## ENABLE_TESTING() 6 | ## INCLUDE(CTest) 7 | set(CTEST_PROJECT_NAME "GLM") 8 | set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") 9 | 10 | set(CTEST_DROP_METHOD "http") 11 | set(CTEST_DROP_SITE "my.cdash.org") 12 | set(CTEST_DROP_LOCATION "/submit.php?project=GLM") 13 | set(CTEST_DROP_SITE_CDASH TRUE) 14 | -------------------------------------------------------------------------------- /third_party/glm/copying.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(NAME glm) 2 | 3 | file(GLOB ROOT_SOURCE *.cpp) 4 | file(GLOB ROOT_INLINE *.inl) 5 | file(GLOB ROOT_HEADER *.hpp) 6 | 7 | file(GLOB_RECURSE CORE_SOURCE ./core/*.cpp) 8 | file(GLOB_RECURSE CORE_INLINE ./core/*.inl) 9 | file(GLOB_RECURSE CORE_HEADER ./core/*.hpp) 10 | 11 | file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) 12 | file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) 13 | file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) 14 | 15 | file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) 16 | file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) 17 | file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) 18 | 19 | file(GLOB_RECURSE VIRTREV_SOURCE ./virtrev/*.cpp) 20 | file(GLOB_RECURSE VIRTREV_INLINE ./virtrev/*.inl) 21 | file(GLOB_RECURSE VIRTREV_HEADER ./virtrev/*.hpp) 22 | 23 | source_group("Core Files" FILES ${CORE_SOURCE}) 24 | source_group("Core Files" FILES ${CORE_INLINE}) 25 | source_group("Core Files" FILES ${CORE_HEADER}) 26 | source_group("GTC Files" FILES ${GTC_SOURCE}) 27 | source_group("GTC Files" FILES ${GTC_INLINE}) 28 | source_group("GTC Files" FILES ${GTC_HEADER}) 29 | source_group("GTX Files" FILES ${GTX_SOURCE}) 30 | source_group("GTX Files" FILES ${GTX_INLINE}) 31 | source_group("GTX Files" FILES ${GTX_HEADER}) 32 | source_group("VIRTREV Files" FILES ${VIRTREV_SOURCE}) 33 | source_group("VIRTREV Files" FILES ${VIRTREV_INLINE}) 34 | source_group("VIRTREV Files" FILES ${VIRTREV_HEADER}) 35 | 36 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) 37 | 38 | add_executable(${NAME} 39 | ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} 40 | ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} 41 | ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} 42 | ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} 43 | ${VIRTREV_SOURCE} ${VIRTREV_INLINE} ${VIRTREV_HEADER}) 44 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/_fixes.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/_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 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/dummy.cpp: -------------------------------------------------------------------------------- 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/dummy.cpp 25 | /// @date 2011-01-19 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /// 28 | /// GLM is a header only library. There is nothing to compile. 29 | /// dummy.cpp exist only a wordaround for CMake file. 30 | /////////////////////////////////////////////////////////////////////////////////// 31 | 32 | #define GLM_MESSAGES 33 | #include "../glm.hpp" 34 | #include "../ext.hpp" 35 | 36 | //#error "GLM is a header only library" 37 | 38 | int main() 39 | { 40 | 41 | } 42 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/func_common.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/third_party/glm/glm/core/func_common.hpp -------------------------------------------------------------------------------- /third_party/glm/glm/core/func_common.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/third_party/glm/glm/core/func_common.inl -------------------------------------------------------------------------------- /third_party/glm/glm/core/func_integer.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/third_party/glm/glm/core/func_integer.hpp -------------------------------------------------------------------------------- /third_party/glm/glm/core/hint.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/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 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/intrinsic_common.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_common.hpp 25 | /// @date 2009-05-11 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_common 30 | #define glm_detail_intrinsic_common 31 | 32 | #include "setup.hpp" 33 | 34 | #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | __m128 sse_abs_ps(__m128 x); 42 | 43 | __m128 sse_sgn_ps(__m128 x); 44 | 45 | //floor 46 | __m128 sse_flr_ps(__m128 v); 47 | 48 | //trunc 49 | __m128 sse_trc_ps(__m128 v); 50 | 51 | //round 52 | __m128 sse_nd_ps(__m128 v); 53 | 54 | //roundEven 55 | __m128 sse_rde_ps(__m128 v); 56 | 57 | __m128 sse_rnd_ps(__m128 x); 58 | 59 | __m128 sse_ceil_ps(__m128 v); 60 | 61 | __m128 sse_frc_ps(__m128 x); 62 | 63 | __m128 sse_mod_ps(__m128 x, __m128 y); 64 | 65 | __m128 sse_modf_ps(__m128 x, __m128i & i); 66 | 67 | //GLM_FUNC_QUALIFIER __m128 sse_min_ps(__m128 x, __m128 y) 68 | 69 | //GLM_FUNC_QUALIFIER __m128 sse_max_ps(__m128 x, __m128 y) 70 | 71 | __m128 sse_clp_ps(__m128 v, __m128 minVal, __m128 maxVal); 72 | 73 | __m128 sse_mix_ps(__m128 v1, __m128 v2, __m128 a); 74 | 75 | __m128 sse_stp_ps(__m128 edge, __m128 x); 76 | 77 | __m128 sse_ssp_ps(__m128 edge0, __m128 edge1, __m128 x); 78 | 79 | __m128 sse_nan_ps(__m128 x); 80 | 81 | __m128 sse_inf_ps(__m128 x); 82 | 83 | }//namespace detail 84 | }//namespace glm 85 | 86 | #include "intrinsic_common.inl" 87 | 88 | #endif//GLM_ARCH 89 | #endif//glm_detail_intrinsic_common 90 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/intrinsic_exponential.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_exponential.hpp 25 | /// @date 2009-05-11 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_exponential 30 | #define glm_detail_intrinsic_exponential 31 | 32 | #include "setup.hpp" 33 | 34 | #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | /* 42 | GLM_FUNC_QUALIFIER __m128 sse_rsqrt_nr_ss(__m128 const x) 43 | { 44 | __m128 recip = _mm_rsqrt_ss( x ); // "estimate" opcode 45 | const static __m128 three = { 3, 3, 3, 3 }; // aligned consts for fast load 46 | const static __m128 half = { 0.5,0.5,0.5,0.5 }; 47 | __m128 halfrecip = _mm_mul_ss( half, recip ); 48 | __m128 threeminus_xrr = _mm_sub_ss( three, _mm_mul_ss( x, _mm_mul_ss ( recip, recip ) ) ); 49 | return _mm_mul_ss( halfrecip, threeminus_xrr ); 50 | } 51 | 52 | GLM_FUNC_QUALIFIER __m128 sse_normalize_fast_ps( float * RESTRICT vOut, float * RESTRICT vIn ) 53 | { 54 | __m128 x = _mm_load_ss(&vIn[0]); 55 | __m128 y = _mm_load_ss(&vIn[1]); 56 | __m128 z = _mm_load_ss(&vIn[2]); 57 | 58 | const __m128 l = // compute x*x + y*y + z*z 59 | _mm_add_ss( 60 | _mm_add_ss( _mm_mul_ss(x,x), 61 | _mm_mul_ss(y,y) 62 | ), 63 | _mm_mul_ss( z, z ) 64 | ); 65 | 66 | 67 | const __m128 rsqt = _mm_rsqrt_nr_ss( l ); 68 | _mm_store_ss( &vOut[0] , _mm_mul_ss( rsqt, x ) ); 69 | _mm_store_ss( &vOut[1] , _mm_mul_ss( rsqt, y ) ); 70 | _mm_store_ss( &vOut[2] , _mm_mul_ss( rsqt, z ) ); 71 | 72 | return _mm_mul_ss( l , rsqt ); 73 | } 74 | */ 75 | }//namespace detail 76 | }//namespace glm 77 | 78 | #endif//GLM_ARCH 79 | #endif//glm_detail_intrinsic_exponential 80 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/intrinsic_exponential.inl: -------------------------------------------------------------------------------- 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_exponential.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/intrinsic_geometric.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_geometric.hpp 25 | /// @date 2009-05-08 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_intrinsic_geometric 30 | #define glm_core_intrinsic_geometric 31 | 32 | #include "setup.hpp" 33 | 34 | #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | #include "intrinsic_common.hpp" 39 | 40 | namespace glm{ 41 | namespace detail 42 | { 43 | //length 44 | __m128 sse_len_ps(__m128 x); 45 | 46 | //distance 47 | __m128 sse_dst_ps(__m128 p0, __m128 p1); 48 | 49 | //dot 50 | __m128 sse_dot_ps(__m128 v1, __m128 v2); 51 | 52 | // SSE1 53 | __m128 sse_dot_ss(__m128 v1, __m128 v2); 54 | 55 | //cross 56 | __m128 sse_xpd_ps(__m128 v1, __m128 v2); 57 | 58 | //normalize 59 | __m128 sse_nrm_ps(__m128 v); 60 | 61 | //faceforward 62 | __m128 sse_ffd_ps(__m128 N, __m128 I, __m128 Nref); 63 | 64 | //reflect 65 | __m128 sse_rfe_ps(__m128 I, __m128 N); 66 | 67 | //refract 68 | __m128 sse_rfa_ps(__m128 I, __m128 N, __m128 eta); 69 | 70 | }//namespace detail 71 | }//namespace glm 72 | 73 | #include "intrinsic_geometric.inl" 74 | 75 | #endif//GLM_ARCH 76 | #endif//glm_core_intrinsic_geometric 77 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/intrinsic_matrix.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_common.hpp 25 | /// @date 2009-06-05 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_matrix 30 | #define glm_detail_intrinsic_matrix 31 | 32 | #include "setup.hpp" 33 | 34 | #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | #include "intrinsic_geometric.hpp" 39 | 40 | namespace glm{ 41 | namespace detail 42 | { 43 | void sse_add_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]); 44 | 45 | void sse_sub_ps(__m128 in1[4], __m128 in2[4], __m128 out[4]); 46 | 47 | __m128 sse_mul_ps(__m128 m[4], __m128 v); 48 | 49 | __m128 sse_mul_ps(__m128 v, __m128 m[4]); 50 | 51 | void sse_mul_ps(__m128 const in1[4], __m128 const in2[4], __m128 out[4]); 52 | 53 | void sse_transpose_ps(__m128 const in[4], __m128 out[4]); 54 | 55 | void sse_inverse_ps(__m128 const in[4], __m128 out[4]); 56 | 57 | void sse_rotate_ps(__m128 const in[4], float Angle, float const v[3], __m128 out[4]); 58 | 59 | __m128 sse_det_ps(__m128 const m[4]); 60 | 61 | __m128 sse_slow_det_ps(__m128 const m[4]); 62 | 63 | }//namespace detail 64 | }//namespace glm 65 | 66 | #include "intrinsic_matrix.inl" 67 | 68 | #endif//GLM_ARCH 69 | #endif//glm_detail_intrinsic_matrix 70 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/intrinsic_trigonometric.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_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) != 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/intrinsic_trigonometric.inl: -------------------------------------------------------------------------------- 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_trigonometric.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/intrinsic_vector_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 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) != 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/type_half.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/third_party/glm/glm/core/type_half.inl -------------------------------------------------------------------------------- /third_party/glm/glm/core/type_mat.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/type_mat.hpp 25 | /// @date 2010-01-26 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_mat 30 | #define glm_core_type_mat 31 | 32 | #include "type_gentype.hpp" 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | //template 38 | //< 39 | // typename T, 40 | // template class C, 41 | // template class R 42 | //> 43 | //struct matType 44 | //{ 45 | // enum ctor{null}; 46 | // typedef T value_type; 47 | // typedef std::size_t size_type; 48 | // typedef C col_type; 49 | // typedef R row_type; 50 | // static size_type const col_size; 51 | // static size_type const row_size; 52 | //}; 53 | 54 | //template 55 | //< 56 | // typename T, 57 | // template class C, 58 | // template class R 59 | //> 60 | //typename matType::size_type const 61 | //matType::col_size = matType::col_type::value_size; 62 | 63 | //template 64 | //< 65 | // typename T, 66 | // template class C, 67 | // template class R 68 | //> 69 | //typename matType::size_type const 70 | //matType::row_size = matType::row_type::value_size; 71 | 72 | }//namespace detail 73 | }//namespace glm 74 | 75 | #endif//glm_core_type_mat 76 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/type_mat.inl: -------------------------------------------------------------------------------- 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/type_mat.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/type_size.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/type_size.hpp 25 | /// @date 2008-10-05 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_size 30 | #define glm_core_type_size 31 | 32 | #include 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | //typedef std::size_t size_t; 38 | typedef int sizeType; 39 | 40 | }//namespace detail 41 | }//namespace glm 42 | 43 | #endif//glm_core_type_size 44 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/type_vec.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/type_vec.hpp 25 | /// @date 2010-01-26 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_vec 30 | #define glm_core_type_vec 31 | 32 | #include "type_gentype.hpp" 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | 38 | }//namespace detail 39 | }//namespace glm 40 | 41 | #endif//glm_core_type_vec 42 | -------------------------------------------------------------------------------- /third_party/glm/glm/core/type_vec.inl: -------------------------------------------------------------------------------- 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/type_vec.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtc/matrix_access.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 gtc_matrix_access 24 | /// @file glm/gtc/matrix_access.hpp 25 | /// @date 2005-12-27 / 2011-05-16 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtc_matrix_access GLM_GTC_matrix_access: Access matrix rows and columns 31 | /// @ingroup gtc 32 | /// 33 | /// Defines functions to access rows or columns of a matrix easily. 34 | /// need to be included to use these functionalities. 35 | /////////////////////////////////////////////////////////////////////////////////// 36 | 37 | #ifndef GLM_GTC_matrix_access 38 | #define GLM_GTC_matrix_access GLM_VERSION 39 | 40 | // Dependency: 41 | #include "../glm.hpp" 42 | 43 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 44 | # pragma message("GLM: GLM_GTC_matrix_access extension included") 45 | #endif 46 | 47 | namespace glm 48 | { 49 | /// @addtogroup gtc_matrix_access 50 | /// @{ 51 | 52 | /// Get a specific row of a matrix. 53 | /// @see gtc_matrix_access 54 | template 55 | typename genType::row_type row( 56 | genType const & m, 57 | int index); 58 | 59 | /// Set a specific row to a matrix. 60 | /// @see gtc_matrix_access 61 | template 62 | genType row( 63 | genType const & m, 64 | int index, 65 | typename genType::row_type const & x); 66 | 67 | /// Get a specific column of a matrix. 68 | /// @see gtc_matrix_access 69 | template 70 | typename genType::col_type column( 71 | genType const & m, 72 | int index); 73 | 74 | /// Set a specific column to a matrix. 75 | /// @see gtc_matrix_access 76 | template 77 | genType column( 78 | genType const & m, 79 | int index, 80 | typename genType::col_type const & x); 81 | 82 | /// @} 83 | }//namespace glm 84 | 85 | #include "matrix_access.inl" 86 | 87 | #endif//GLM_GTC_matrix_access 88 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtc/matrix_access.inl: -------------------------------------------------------------------------------- 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 gtc_matrix_access 24 | /// @file glm/gtc/matrix_access.inl 25 | /// @date 2005-12-27 / 2011-06-05 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | namespace glm 30 | { 31 | template 32 | GLM_FUNC_QUALIFIER genType row 33 | ( 34 | genType const & m, 35 | int index, 36 | typename genType::row_type const & x 37 | ) 38 | { 39 | genType Result = m; 40 | for(typename genType::size_type i = 0; i < genType::row_size(); ++i) 41 | Result[i][index] = x[i]; 42 | return Result; 43 | } 44 | 45 | template 46 | GLM_FUNC_QUALIFIER typename genType::row_type row 47 | ( 48 | genType const & m, 49 | int index 50 | ) 51 | { 52 | typename genType::row_type Result; 53 | for(typename genType::size_type i = 0; i < genType::row_size(); ++i) 54 | Result[i] = m[i][index]; 55 | return Result; 56 | } 57 | 58 | template 59 | GLM_FUNC_QUALIFIER genType column 60 | ( 61 | genType const & m, 62 | int index, 63 | typename genType::col_type const & x 64 | ) 65 | { 66 | genType Result = m; 67 | Result[index] = x; 68 | return Result; 69 | } 70 | 71 | template 72 | GLM_FUNC_QUALIFIER typename genType::col_type column 73 | ( 74 | genType const & m, 75 | int index 76 | ) 77 | { 78 | return m[index]; 79 | } 80 | }//namespace glm 81 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtc/matrix_inverse.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 gtc_matrix_inverse 24 | /// @file glm/gtc/matrix_inverse.hpp 25 | /// @date 2005-12-21 / 2011-06-05 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse: Additional matrix inverse function 31 | /// @ingroup gtc 32 | /// 33 | /// Defines additional matrix inverting functions. 34 | /// need to be included to use these functionalities. 35 | /////////////////////////////////////////////////////////////////////////////////// 36 | 37 | #ifndef GLM_GTC_matrix_inverse 38 | #define GLM_GTC_matrix_inverse GLM_VERSION 39 | 40 | // Dependency: 41 | #include "../glm.hpp" 42 | 43 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 44 | # pragma message("GLM: GLM_GTC_matrix_inverse extension included") 45 | #endif 46 | 47 | namespace glm 48 | { 49 | /// @addtogroup gtc_matrix_inverse 50 | /// @{ 51 | 52 | /// Fast matrix inverse for affine matrix. 53 | /// 54 | /// @param m Input matrix to invert. 55 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. 56 | /// @see gtc_matrix_inverse 57 | template 58 | genType affineInverse(genType const & m); 59 | 60 | /// Compute the inverse transpose of a matrix. 61 | /// 62 | /// @param m Input matrix to invert transpose. 63 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. 64 | /// @see gtc_matrix_inverse 65 | template 66 | GLM_FUNC_QUALIFIER typename genType::value_type inverseTranspose( 67 | genType const & m); 68 | 69 | /// @} 70 | }//namespace glm 71 | 72 | #include "matrix_inverse.inl" 73 | 74 | #endif//GLM_GTC_matrix_inverse 75 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtc/noise.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 gtc_noise 24 | /// @file glm/gtc/noise.hpp 25 | /// @date 2011-04-21 / 2011-09-27 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtc_noise GLM_GTC_noise: Procedural noise functions 31 | /// @ingroup gtc 32 | /// 33 | /// Defines 2D, 3D and 4D procedural noise functions 34 | /// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise": 35 | /// https://github.com/ashima/webgl-noise 36 | /// Following Stefan Gustavson's paper "Simplex noise demystified": 37 | /// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf 38 | /// need to be included to use these functionalities. 39 | /////////////////////////////////////////////////////////////////////////////////// 40 | 41 | #ifndef GLM_GTC_noise 42 | #define GLM_GTC_noise GLM_VERSION 43 | 44 | // Dependency: 45 | #include "../glm.hpp" 46 | 47 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 48 | # pragma message("GLM: GLM_GTC_noise extension included") 49 | #endif 50 | 51 | namespace glm 52 | { 53 | /// @addtogroup gtc_noise 54 | /// @{ 55 | 56 | /// Classic perlin noise. 57 | /// @see gtc_noise 58 | template class vecType> 59 | T perlin( 60 | vecType const & p); 61 | 62 | /// Periodic perlin noise. 63 | /// @see gtc_noise 64 | template class vecType> 65 | T perlin( 66 | vecType const & p, 67 | vecType const & rep); 68 | 69 | /// Simplex noise. 70 | /// @see gtc_noise 71 | template class vecType> 72 | T simplex( 73 | vecType const & p); 74 | 75 | /// @} 76 | }//namespace glm 77 | 78 | #include "noise.inl" 79 | 80 | #endif//GLM_GTC_noise 81 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 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 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/closest_point.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_bit 24 | /// @file glm/gtx/bit.hpp 25 | /// @date 2005-12-30 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_closest_point GLM_GTX_closest_point: Find closest point 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Find the point on a straight line which is the closet of a point. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_closest_point 39 | #define GLM_GTX_closest_point GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_closest_point extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_closest_point 51 | /// @{ 52 | 53 | /// Find the point on a straight line which is the closet of a point. 54 | /// @see gtx_closest_point 55 | template 56 | detail::tvec3 closestPointOnLine( 57 | detail::tvec3 const & point, 58 | detail::tvec3 const & a, 59 | detail::tvec3 const & b); 60 | 61 | /// @} 62 | }// namespace glm 63 | 64 | #include "closest_point.inl" 65 | 66 | #endif//GLM_GTX_closest_point 67 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | valType 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 | valType Distance = dot(Vector, LineDirection); 29 | 30 | if(Distance <= valType(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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/color_space_YCoCg.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 / valType(4) + rgbColor.g / valType(2) + rgbColor.b / valType(4); 20 | result.y/*Co*/ = rgbColor.r / valType(2) + rgbColor.g * valType(0) - rgbColor.b / valType(2); 21 | result.z/*Cg*/ = - rgbColor.r / valType(4) + rgbColor.g / valType(2) - rgbColor.b / valType(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 / valType(2) + (rgbColor.r + rgbColor.b) / valType(4); 33 | result.y/*Co*/ = rgbColor.r - rgbColor.b; 34 | result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / valType(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 | valType tmp = YCoCgRColor.x - (YCoCgRColor.z / valType(2)); 59 | result.g = YCoCgRColor.z + tmp; 60 | result.b = tmp - (YCoCgRColor.y / valType(2)); 61 | result.r = result.b + YCoCgRColor.y; 62 | return result; 63 | } 64 | }//namespace glm 65 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/compatibility.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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_COMPILER & GLM_COMPILER_VC) 18 | return _finite(x); 19 | # elif(GLM_COMPILER & GLM_COMPILER_GCC) 20 | # if(GLM_PLATFORM & GLM_PLATFORM_ANDROID) 21 | return _isfinite(x) != 0; 22 | # else 23 | return std::isfinite(x) != 0; 24 | # endif 25 | # else 26 | return std::isfinite(x) != 0; 27 | # endif 28 | 29 | } 30 | 31 | template 32 | GLM_FUNC_QUALIFIER detail::tvec2 isfinite( 33 | detail::tvec2 const & x) 34 | { 35 | return detail::tvec2( 36 | isfinite(x.x), 37 | isfinite(x.y)); 38 | } 39 | 40 | template 41 | GLM_FUNC_QUALIFIER detail::tvec3 isfinite( 42 | detail::tvec3 const & x) 43 | { 44 | return detail::tvec3( 45 | isfinite(x.x), 46 | isfinite(x.y), 47 | isfinite(x.z)); 48 | } 49 | 50 | template 51 | GLM_FUNC_QUALIFIER detail::tvec4 isfinite( 52 | detail::tvec4 const & x) 53 | { 54 | return detail::tvec4( 55 | isfinite(x.x), 56 | isfinite(x.y), 57 | isfinite(x.z), 58 | isfinite(x.w)); 59 | } 60 | 61 | }//namespace glm 62 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/component_wise.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_component_wise 24 | /// @file glm/gtx/component_wise.hpp 25 | /// @date 2007-05-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_component_wise GLM_GTX_component_wise: Component wise 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Operations between components of a type 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_component_wise 39 | #define GLM_GTX_component_wise GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_component_wise extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_component_wise 51 | /// @{ 52 | 53 | /// Add all vector components together. 54 | /// @see gtx_component_wise 55 | template 56 | typename genType::value_type compAdd( 57 | genType const & v); 58 | 59 | /// Multiply all vector components together. 60 | /// @see gtx_component_wise 61 | template 62 | typename genType::value_type compMul( 63 | genType const & v); 64 | 65 | /// Find the minimum value between single vector components. 66 | /// @see gtx_component_wise 67 | template 68 | typename genType::value_type compMin( 69 | genType const & v); 70 | 71 | /// Find the maximum value between single vector components. 72 | /// @see gtx_component_wise 73 | template 74 | typename genType::value_type compMax( 75 | genType const & v); 76 | 77 | /// @} 78 | }//namespace glm 79 | 80 | #include "component_wise.inl" 81 | 82 | #endif//GLM_GTX_component_wise 83 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/component_wise.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 13 | GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v) 14 | { 15 | typename genType::size_type result = typename genType::value_type(0); 16 | for(typename genType::size_type i = 0; i < v.length(); ++i) 17 | result += v[i]; 18 | return result; 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER typename genType::value_type compMul(genType const & v) 23 | { 24 | typename genType::value_type result = typename genType::value_type(1); 25 | for(typename genType::size_type i = 0; i < v.length(); ++i) 26 | result *= v[i]; 27 | return result; 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER typename genType::value_type compMin(genType const & v) 32 | { 33 | typename genType::value_type result = typename genType::value_type(v[0]); 34 | for(typename genType::size_type i = 1; i < v.length(); ++i) 35 | result = min(result, v[i]); 36 | return result; 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v) 41 | { 42 | typename genType::value_type result = typename genType::value_type(v[0]); 43 | for(typename genType::size_type i = 1; i < v.length(); ++i) 44 | result = max(result, v[i]); 45 | return result; 46 | } 47 | }//namespace glm 48 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/epsilon.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_epsilon 24 | /// @file glm/gtx/epsilon.hpp 25 | /// @date 2007-05-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtc_half_float (dependence) 30 | /// @see gtc_quaternion (dependence) 31 | /// 32 | /// @defgroup gtx_epsilon GLM_GTX_epsilon: Epsilon comparison 33 | /// @ingroup gtx 34 | /// 35 | /// @brief Comparison functions for a user defined epsilon values. 36 | /// 37 | /// need to be included to use these functionalities. 38 | /////////////////////////////////////////////////////////////////////////////////// 39 | 40 | #ifndef GLM_GTX_epsilon 41 | #define GLM_GTX_epsilon GLM_VERSION 42 | 43 | // Dependency: 44 | #include "../glm.hpp" 45 | #include "../gtc/half_float.hpp" 46 | #include "../gtc/quaternion.hpp" 47 | 48 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 49 | # pragma message("GLM: GLM_GTX_epsilon extension included") 50 | #endif 51 | 52 | namespace glm 53 | { 54 | /// @addtogroup gtx_epsilon 55 | /// @{ 56 | 57 | /// Returns the component-wise compare of |x - y| < epsilon. 58 | /// @see gtx_epsilon 59 | template 60 | bool equalEpsilon( 61 | genTypeT const & x, 62 | genTypeT const & y, 63 | genTypeU const & epsilon); 64 | 65 | /// Returns the component-wise compare of |x - y| >= epsilon. 66 | /// @see gtx_epsilon 67 | template 68 | bool notEqualEpsilon( 69 | genTypeT const & x, 70 | genTypeT const & y, 71 | genTypeU const & epsilon); 72 | 73 | /// @} 74 | }//namespace glm 75 | 76 | #include "epsilon.inl" 77 | 78 | #endif//GLM_GTX_epsilon 79 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/extend.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_extend 24 | /// @file glm/gtx/extend.hpp 25 | /// @date 2006-01-07 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_extend GLM_GTX_extend: Position extending 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_extend 39 | #define GLM_GTX_extend GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_extend extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_extend 51 | /// @{ 52 | 53 | /// Extends of Length the Origin position using the (Source - Origin) direction. 54 | /// @see gtx_extend 55 | template 56 | genType extend( 57 | genType const & Origin, 58 | genType const & Source, 59 | typename genType::value_type const Length); 60 | 61 | /// @} 62 | }//namespace glm 63 | 64 | #include "extend.inl" 65 | 66 | #endif//GLM_GTX_extend 67 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | 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 | detail::tvec2 extend 25 | ( 26 | detail::tvec2 const & Origin, 27 | detail::tvec2 const & Source, 28 | valType const & Distance 29 | ) 30 | { 31 | return Origin + (Source - Origin) * Distance; 32 | } 33 | 34 | template 35 | detail::tvec3 extend 36 | ( 37 | detail::tvec3 const & Origin, 38 | detail::tvec3 const & Source, 39 | valType const & Distance 40 | ) 41 | { 42 | return Origin + (Source - Origin) * Distance; 43 | } 44 | 45 | template 46 | detail::tvec4 extend 47 | ( 48 | detail::tvec4 const & Origin, 49 | detail::tvec4 const & Source, 50 | valType const & Distance 51 | ) 52 | { 53 | return Origin + (Source - Origin) * Distance; 54 | } 55 | }//namespace glm 56 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/fast_trigonometry.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-08 5 | // Updated : 2011-10-14 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/fast_trigonometry.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | #include "../core/_vectorize.hpp" 11 | 12 | namespace glm 13 | { 14 | // sin 15 | template 16 | GLM_FUNC_QUALIFIER T fastSin(T const & x) 17 | { 18 | return x - ((x * x * x) / T(6)) + ((x * x * x * x * x) / T(120)) - ((x * x * x * x * x * x * x) / T(5040)); 19 | } 20 | 21 | VECTORIZE_VEC(fastSin) 22 | 23 | // cos 24 | template 25 | GLM_FUNC_QUALIFIER T fastCos(T const & x) 26 | { 27 | return T(1) - (x * x * T(0.5)) + (x * x * x * x * T(0.041666666666)) - (x * x * x * x * x * x * T(0.00138888888888)); 28 | } 29 | 30 | VECTORIZE_VEC(fastCos) 31 | 32 | // tan 33 | template 34 | GLM_FUNC_QUALIFIER T fastTan(T const & x) 35 | { 36 | return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539)); 37 | } 38 | 39 | VECTORIZE_VEC(fastTan) 40 | 41 | // asin 42 | template 43 | GLM_FUNC_QUALIFIER T fastAsin(T const & x) 44 | { 45 | return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159)); 46 | } 47 | 48 | VECTORIZE_VEC(fastAsin) 49 | 50 | // acos 51 | template 52 | GLM_FUNC_QUALIFIER T fastAcos(T const & x) 53 | { 54 | return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2) 55 | } 56 | 57 | VECTORIZE_VEC(fastAcos) 58 | 59 | // atan 60 | template 61 | GLM_FUNC_QUALIFIER T fastAtan(T const & y, T const & x) 62 | { 63 | T sgn = sign(y) * sign(x); 64 | return abs(fastAtan(y / x)) * sgn; 65 | } 66 | 67 | VECTORIZE_VEC_VEC(fastAtan) 68 | 69 | template 70 | GLM_FUNC_QUALIFIER T fastAtan(T const & x) 71 | { 72 | return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909)); 73 | } 74 | 75 | VECTORIZE_VEC(fastAtan) 76 | 77 | }//namespace glm 78 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/gradient_paint.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_gradient_paint 24 | /// @file glm/gtx/gradient_paint.hpp 25 | /// @date 2009-03-06 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_optimum_pow (dependence) 30 | /// 31 | /// @defgroup gtx_gradient_paint GLM_GTX_gradient_paint: Procedural gradient color 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Functions that return the color of procedural gradient for specific coordinates. 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_gradient_paint 39 | #define GLM_GTX_gradient_paint GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | #include "../gtx/optimum_pow.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_gradient_paint extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_gradient_paint 52 | /// @{ 53 | 54 | /// Return a color from a radial gradient. 55 | /// @see - gtx_gradient_paint 56 | template 57 | valType radialGradient( 58 | detail::tvec2 const & Center, 59 | valType const & Radius, 60 | detail::tvec2 const & Focal, 61 | detail::tvec2 const & Position); 62 | 63 | /// Return a color from a linear gradient. 64 | /// @see - gtx_gradient_paint 65 | template 66 | valType linearGradient( 67 | detail::tvec2 const & Point0, 68 | detail::tvec2 const & Point1, 69 | detail::tvec2 const & Position); 70 | 71 | /// @} 72 | }// namespace glm 73 | 74 | #include "gradient_paint.inl" 75 | 76 | #endif//GLM_GTX_gradient_paint 77 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2009-03-06 5 | // Updated : 2009-03-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 | valType radialGradient 14 | ( 15 | detail::tvec2 const & Center, 16 | valType 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 | valType Radius2 = pow2(Radius); 24 | valType Fx2 = pow2(F.x); 25 | valType Fy2 = pow2(F.y); 26 | 27 | valType 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 | valType Denominator = Radius2 - (Fx2 + Fy2); 29 | return Numerator / Denominator; 30 | } 31 | 32 | template 33 | valType 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/handed_coordinate_space.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_handed_coordinate_space 24 | /// @file glm/gtx/handed_coordinate_space.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_handed_coordinate_space GLM_GTX_handed_coordinate_space: Space Handedness 31 | /// @ingroup gtx 32 | /// 33 | /// @brief To know if a set of three basis vectors defines a right or left-handed coordinate system. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_handed_coordinate_space 39 | #define GLM_GTX_handed_coordinate_space GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_handed_coordinate_space 51 | /// @{ 52 | 53 | //! Return if a trihedron right handed or not. 54 | //! From GLM_GTX_handed_coordinate_space extension. 55 | template 56 | bool rightHanded( 57 | detail::tvec3 const & tangent, 58 | detail::tvec3 const & binormal, 59 | detail::tvec3 const & normal); 60 | 61 | //! Return if a trihedron left handed or not. 62 | //! From GLM_GTX_handed_coordinate_space extension. 63 | template 64 | bool leftHanded( 65 | detail::tvec3 const & tangent, 66 | detail::tvec3 const & binormal, 67 | detail::tvec3 const & normal); 68 | 69 | /// @} 70 | }// namespace glm 71 | 72 | #include "handed_coordinate_space.inl" 73 | 74 | #endif//GLM_GTX_handed_coordinate_space 75 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/int_10_10_10_2.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_int_10_10_10_2 24 | /// @file glm/gtx/int_10_10_10_2.hpp 25 | /// @date 2010-07-07 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_raw_data (dependence) 30 | /// 31 | /// @defgroup gtx_int_10_10_10_2 GLM_GTX_int_10_10_10_2: Packed integer 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Pack vector to 1010102 integers. Storage only. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_int_10_10_10_2 40 | #define GLM_GTX_int_10_10_10_2 GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | #include "../gtx/raw_data.hpp" 45 | 46 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 47 | # pragma message("GLM: GLM_GTX_int_10_10_10_2 extension included") 48 | #endif 49 | 50 | namespace glm 51 | { 52 | /// @addtogroup gtx_int_10_10_10_2 53 | /// @{ 54 | 55 | //! From GLM_GTX_int_10_10_10_2 extension. 56 | //! Cast a vec4 to an u_10_10_10_2. 57 | dword uint10_10_10_2_cast(glm::vec4 const & v); 58 | 59 | /// @} 60 | }//namespace glm 61 | 62 | #include "int_10_10_10_2.inl" 63 | 64 | #endif//GLM_GTX_int_10_10_10_2 65 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/int_10_10_10_2.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2010-07-07 5 | // Updated : 2010-07-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/int_10_10_10_2.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast 13 | ( 14 | glm::vec4 const & v 15 | ) 16 | { 17 | 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); 18 | } 19 | }//namespace glm 20 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/log_base.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_log_base 24 | /// @file glm/gtx/log_base.hpp 25 | /// @date 2008-10-24 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_log_base GLM_GTX_log_base: Log with base 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Logarithm for any base. base can be a vector or a scalar. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_log_base 39 | #define GLM_GTX_log_base GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_log_base extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_log_base 51 | /// @{ 52 | 53 | //! Logarithm for any base. 54 | //! From GLM_GTX_log_base. 55 | template 56 | genType log( 57 | genType const & x, 58 | genType const & base); 59 | 60 | /// @} 61 | }//namespace glm 62 | 63 | #include "log_base.inl" 64 | 65 | #endif//GLM_GTX_log_base 66 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | #include "../core/_vectorize.hpp" 11 | 12 | namespace glm 13 | { 14 | template 15 | GLM_FUNC_QUALIFIER genType log( 16 | genType const & x, 17 | genType const & base) 18 | { 19 | assert(x != genType(0)); 20 | 21 | return glm::log(x) / glm::log(base); 22 | } 23 | 24 | VECTORIZE_VEC_SCA(log) 25 | VECTORIZE_VEC_VEC(log) 26 | }//namespace glm 27 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/matrix_cross_product.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_matrix_cross_product 24 | /// @file glm/gtx/matrix_cross_product.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_extented_min_max (dependence) 30 | /// 31 | /// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product: Cross product matrix form 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Build cross product matrices 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_matrix_cross_product 40 | #define GLM_GTX_matrix_cross_product GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_matrix_cross_product extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_matrix_cross_product 52 | /// @{ 53 | 54 | //! Build a cross product matrix. 55 | //! From GLM_GTX_matrix_cross_product extension. 56 | template 57 | detail::tmat3x3 matrixCross3( 58 | detail::tvec3 const & x); 59 | 60 | //! Build a cross product matrix. 61 | //! From GLM_GTX_matrix_cross_product extension. 62 | template 63 | detail::tmat4x4 matrixCross4( 64 | detail::tvec3 const & x); 65 | 66 | /// @} 67 | }//namespace glm 68 | 69 | #include "matrix_cross_product.inl" 70 | 71 | #endif//GLM_GTX_matrix_cross_product 72 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/mixed_product.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_mixed_product 24 | /// @file glm/gtx/mixed_product.hpp 25 | /// @date 2007-04-03 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte: Mixed product 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Mixed product of 3 vectors. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_mixed_product 39 | #define GLM_GTX_mixed_product GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_mixed_product 51 | /// @{ 52 | 53 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 54 | template 55 | valType mixedProduct( 56 | detail::tvec3 const & v1, 57 | detail::tvec3 const & v2, 58 | detail::tvec3 const & v3); 59 | 60 | /// @} 61 | }// namespace glm 62 | 63 | #include "mixed_product.inl" 64 | 65 | #endif//GLM_GTX_mixed_product 66 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 valType 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/multiple.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_multiple 24 | /// @file glm/gtx/multiple.hpp 25 | /// @date 2009-10-26 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_extented_min_max (dependence) 30 | /// 31 | /// @defgroup gtx_multiple GLM_GTX_multiple: Multiples 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Find the closest number of a number multiple of other number. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_multiple 40 | #define GLM_GTX_multiple GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_multiple extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_multiple 52 | /// @{ 53 | 54 | //! Higher Multiple number of Source. 55 | //! From GLM_GTX_multiple extension. 56 | template 57 | genType higherMultiple( 58 | genType const & Source, 59 | genType const & Multiple); 60 | 61 | //! Lower Multiple number of Source. 62 | //! From GLM_GTX_multiple extension. 63 | template 64 | genType lowerMultiple( 65 | genType const & Source, 66 | genType const & Multiple); 67 | 68 | /// @} 69 | }//namespace glm 70 | 71 | #include "multiple.inl" 72 | 73 | #endif//GLM_GTX_multiple 74 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/noise.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_noise 24 | /// @file glm/gtx/noise.hpp 25 | /// @date 2011-04-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_noise GLM_GTX_noise: Procedural noise functions 31 | /// @ingroup gtx 32 | /// 33 | /// Defines 2D, 3D and 4D procedural noise functions 34 | /// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise": 35 | /// https://github.com/ashima/webgl-noise 36 | /// Following Stefan Gustavson's paper "Simplex noise demystified": 37 | /// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf 38 | /// Defines the half-precision floating-point type, along with various typedefs for vectors and matrices. 39 | /// need to be included to use these functionalities. 40 | /////////////////////////////////////////////////////////////////////////////////// 41 | 42 | #ifndef GLM_GTX_noise 43 | #define GLM_GTX_noise GLM_VERSION 44 | 45 | // Dependency: 46 | #include "../glm.hpp" 47 | #include "../gtc/noise.hpp" 48 | 49 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 50 | # pragma message("GLM: GLM_GTX_noise extension included") 51 | #endif 52 | 53 | namespace glm 54 | { 55 | /// @addtogroup gtx_noise 56 | /// @{ 57 | 58 | /// @} 59 | }//namespace glm 60 | 61 | #include "noise.inl" 62 | 63 | #endif//glm_gtx_noise 64 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/noise.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise": 5 | // https://github.com/ashima/webgl-noise 6 | // Following Stefan Gustavson's paper "Simplex noise demystified": 7 | // http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | // Created : 2011-04-21 10 | // Updated : 2011-04-21 11 | // Licence : This source is under MIT License 12 | // File : glm/gtx/noise.inl 13 | /////////////////////////////////////////////////////////////////////////////////////////////////// 14 | // Dependency: 15 | // - GLM core 16 | /////////////////////////////////////////////////////////////////////////////////////////////////// 17 | 18 | namespace glm{ 19 | 20 | }//namespace glm 21 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/normal.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_normal 24 | /// @file glm/gtx/normal.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_extented_min_max (dependence) 30 | /// 31 | /// @defgroup gtx_normal GLM_GTX_normal: Compute normals 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Compute the normal of a triangle. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_normal 40 | #define GLM_GTX_normal GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_normal extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_normal 52 | /// @{ 53 | 54 | //! Computes triangle normal from triangle points. 55 | //! From GLM_GTX_normal extension. 56 | template 57 | detail::tvec3 triangleNormal( 58 | detail::tvec3 const & p1, 59 | detail::tvec3 const & p2, 60 | detail::tvec3 const & p3); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "normal.inl" 66 | 67 | #endif//GLM_GTX_normal 68 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/normalize_dot.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_normalize_dot 24 | /// @file glm/gtx/normalize_dot.hpp 25 | /// @date 2007-09-28 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_fast_square_root (dependence) 30 | /// 31 | /// @defgroup gtx_normalize_dot GLM_GTX_normalize_dot: Normalize dot product 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Dot product of vectors that need to be normalize with a single square root. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_normalize_dot 40 | #define GLM_GTX_normalize_dot GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | #include "../gtx/fast_square_root.hpp" 45 | 46 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 47 | # pragma message("GLM: GLM_GTX_normalize_dot extension included") 48 | #endif 49 | 50 | namespace glm 51 | { 52 | /// @addtogroup gtx_normalize_dot 53 | /// @{ 54 | 55 | //! Normalize parameters and returns the dot product of x and y. 56 | //! It's faster that dot(normalize(x), normalize(y)). 57 | //! From GLM_GTX_normalize_dot extension. 58 | template 59 | typename genType::value_type normalizeDot( 60 | genType const & x, 61 | genType const & y); 62 | 63 | //! Normalize parameters and returns the dot product of x and y. 64 | //! Faster that dot(fastNormalize(x), fastNormalize(y)). 65 | //! From GLM_GTX_normalize_dot extension. 66 | template 67 | typename genType::value_type fastNormalizeDot( 68 | genType const & x, 69 | genType const & y); 70 | 71 | /// @} 72 | }//namespace glm 73 | 74 | #include "normalize_dot.inl" 75 | 76 | #endif//GLM_GTX_normalize_dot 77 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/normalize_dot.inl: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | ////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-09-28 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/normalize_dot.inl 8 | ////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType normalizeDot 14 | ( 15 | genType const & x, 16 | genType const & y 17 | ) 18 | { 19 | return 20 | glm::dot(x, y) * 21 | glm::inversesqrt(glm::dot(x, x) * 22 | glm::dot(y, y)); 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER valType normalizeDot 27 | ( 28 | detail::tvec2 const & x, 29 | detail::tvec2 const & y 30 | ) 31 | { 32 | return 33 | glm::dot(x, y) * 34 | glm::inversesqrt(glm::dot(x, x) * 35 | glm::dot(y, y)); 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER valType normalizeDot 40 | ( 41 | detail::tvec3 const & x, 42 | detail::tvec3 const & y 43 | ) 44 | { 45 | return 46 | glm::dot(x, y) * 47 | glm::inversesqrt(glm::dot(x, x) * 48 | glm::dot(y, y)); 49 | } 50 | 51 | template 52 | GLM_FUNC_QUALIFIER valType normalizeDot 53 | ( 54 | detail::tvec4 const & x, 55 | detail::tvec4 const & y 56 | ) 57 | { 58 | return 59 | glm::dot(x, y) * 60 | glm::inversesqrt(glm::dot(x, x) * 61 | glm::dot(y, y)); 62 | } 63 | 64 | template 65 | GLM_FUNC_QUALIFIER genType fastNormalizeDot 66 | ( 67 | genType const & x, 68 | genType const & y 69 | ) 70 | { 71 | return 72 | glm::dot(x, y) * 73 | fastInverseSqrt(glm::dot(x, x) * 74 | glm::dot(y, y)); 75 | } 76 | 77 | template 78 | GLM_FUNC_QUALIFIER valType fastNormalizeDot 79 | ( 80 | detail::tvec2 const & x, 81 | detail::tvec2 const & y 82 | ) 83 | { 84 | return 85 | glm::dot(x, y) * 86 | fastInverseSqrt(glm::dot(x, x) * 87 | glm::dot(y, y)); 88 | } 89 | 90 | template 91 | GLM_FUNC_QUALIFIER valType fastNormalizeDot 92 | ( 93 | detail::tvec3 const & x, 94 | detail::tvec3 const & y 95 | ) 96 | { 97 | return 98 | glm::dot(x, y) * 99 | fastInverseSqrt(glm::dot(x, x) * 100 | glm::dot(y, y)); 101 | } 102 | 103 | template 104 | GLM_FUNC_QUALIFIER valType fastNormalizeDot 105 | ( 106 | detail::tvec4 const & x, 107 | detail::tvec4 const & y 108 | ) 109 | { 110 | return 111 | glm::dot(x, y) * 112 | fastInverseSqrt(glm::dot(x, x) * 113 | glm::dot(y, y)); 114 | } 115 | }//namespace glm 116 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/ocl_type.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/third_party/glm/glm/gtx/ocl_type.inl -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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(const genType& x) 14 | { 15 | return x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow3(const genType& x) 20 | { 21 | return x * x * x; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER genType pow4(const genType& 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 | GLM_FUNC_QUALIFIER detail::tvec2 powOfTwo(const detail::tvec2& x) 36 | { 37 | return detail::tvec2( 38 | powOfTwo(x.x), 39 | powOfTwo(x.y)); 40 | } 41 | 42 | GLM_FUNC_QUALIFIER detail::tvec3 powOfTwo(const detail::tvec3& x) 43 | { 44 | return detail::tvec3( 45 | powOfTwo(x.x), 46 | powOfTwo(x.y), 47 | powOfTwo(x.z)); 48 | } 49 | 50 | GLM_FUNC_QUALIFIER detail::tvec4 powOfTwo(const detail::tvec4& x) 51 | { 52 | return detail::tvec4( 53 | powOfTwo(x.x), 54 | powOfTwo(x.y), 55 | powOfTwo(x.z), 56 | powOfTwo(x.w)); 57 | } 58 | }//namespace glm 59 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/orthonormalize.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_orthonormalize 24 | /// @file glm/gtx/orthonormalize.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_extented_min_max (dependence) 30 | /// 31 | /// @defgroup gtx_orthonormalize GLM_GTX_orthonormalize: Orthonormalize 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Orthonormalize matrices. 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_orthonormalize 40 | #define GLM_GTX_orthonormalize GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_orthonormalize extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_orthonormalize 52 | /// @{ 53 | 54 | //! Returns the orthonormalized matrix of m. 55 | //! From GLM_GTX_orthonormalize extension. 56 | template 57 | detail::tmat3x3 orthonormalize( 58 | const detail::tmat3x3& m); 59 | 60 | //! Orthonormalizes x according y. 61 | //! From GLM_GTX_orthonormalize extension. 62 | template 63 | detail::tvec3 orthonormalize( 64 | const detail::tvec3& x, 65 | const detail::tvec3& y); 66 | 67 | /// @} 68 | }//namespace glm 69 | 70 | #include "orthonormalize.inl" 71 | 72 | #endif//GLM_GTX_orthonormalize 73 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/perpendicular.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_perpendicular 24 | /// @file glm/gtx/perpendicular.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtx_projection (dependence) 30 | /// 31 | /// @defgroup gtx_perpendicular GLM_GTX_perpendicular: Perpendicular 32 | /// @ingroup gtx 33 | /// 34 | /// @brief Perpendicular of a vector from other one 35 | /// 36 | /// need to be included to use these functionalities. 37 | /////////////////////////////////////////////////////////////////////////////////// 38 | 39 | #ifndef GLM_GTX_perpendicular 40 | #define GLM_GTX_perpendicular GLM_VERSION 41 | 42 | // Dependency: 43 | #include "../glm.hpp" 44 | #include "../gtx/projection.hpp" 45 | 46 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 47 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 48 | #endif 49 | 50 | namespace glm 51 | { 52 | /// @addtogroup gtx_perpendicular 53 | /// @{ 54 | 55 | //! Projects x a perpendicular axis of Normal. 56 | //! From GLM_GTX_perpendicular extension. 57 | template 58 | vecType perp( 59 | vecType const & x, 60 | vecType const & Normal); 61 | 62 | /// @} 63 | }//namespace glm 64 | 65 | #include "perpendicular.inl" 66 | 67 | #endif//GLM_GTX_perpendicular 68 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/polar_coordinates.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_polar_coordinates 24 | /// @file glm/gtx/polar_coordinates.hpp 25 | /// @date 2007-03-06 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_polar_coordinates GLM_GTX_polar_coordinates: Polar coordinates 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Conversion from Euclidean space to polar space and revert. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_polar_coordinates 39 | #define GLM_GTX_polar_coordinates GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_polar_coordinates extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_polar_coordinates 51 | /// @{ 52 | 53 | //! Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude. 54 | //! From GLM_GTX_polar_coordinates extension. 55 | template 56 | detail::tvec3 polar( 57 | detail::tvec3 const & euclidean); 58 | 59 | //! Convert Polar to Euclidean coordinates. 60 | //! From GLM_GTX_polar_coordinates extension. 61 | template 62 | detail::tvec3 euclidean( 63 | detail::tvec3 const & polar); 64 | 65 | /// @} 66 | }//namespace glm 67 | 68 | #include "polar_coordinates.inl" 69 | 70 | #endif//GLM_GTX_polar_coordinates 71 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 length = length(euclidean); 19 | detail::tvec3 tmp = euclidean / length; 20 | T xz_dist = sqrt(tmp.x * tmp.x + tmp.z * tmp.z); 21 | 22 | return detail::tvec3( 23 | degrees(atan(xz_dist, tmp.y)), // latitude 24 | degrees(atan(tmp.x, tmp.z)), // longitude 25 | xz_dist); // xz distance 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER detail::tvec3 euclidean 30 | ( 31 | detail::tvec3 const & polar 32 | ) 33 | { 34 | T latitude = radians(polar.x); 35 | T longitude = radians(polar.y); 36 | return detail::tvec3( 37 | cos(latitude) * sin(longitude), 38 | sin(latitude), 39 | cos(latitude) * cos(longitude)); 40 | } 41 | 42 | }//namespace glm 43 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/projection.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_projection 24 | /// @file glm/gtx/projection.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_projection GLM_GTX_projection: Projection 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Projection of a vector to other one 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_projection 39 | #define GLM_GTX_projection GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_projection extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_projection 51 | /// @{ 52 | 53 | //! Projects x on Normal. 54 | //! From GLM_GTX_projection extension. 55 | template 56 | vecType proj( 57 | vecType const & x, 58 | vecType const & Normal); 59 | 60 | /// @} 61 | }//namespace glm 62 | 63 | #include "projection.inl" 64 | 65 | #endif//GLM_GTX_projection 66 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/raw_data.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_raw_data 24 | /// @file glm/gtx/raw_data.hpp 25 | /// @date 2008-11-19 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_raw_data GLM_GTX_raw_data: Raw data 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Projection of a vector to other one 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_raw_data 39 | #define GLM_GTX_raw_data GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | #include "../gtc/type_precision.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_raw_data extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_raw_data 52 | /// @{ 53 | 54 | //! Type for byte numbers. 55 | //! From GLM_GTX_raw_data extension. 56 | typedef uint8 byte; 57 | 58 | //! Type for word numbers. 59 | //! From GLM_GTX_raw_data extension. 60 | typedef uint16 word; 61 | 62 | //! Type for dword numbers. 63 | //! From GLM_GTX_raw_data extension. 64 | typedef uint32 dword; 65 | 66 | //! Type for qword numbers. 67 | //! From GLM_GTX_raw_data extension. 68 | typedef uint64 qword; 69 | 70 | /// @} 71 | }// namespace glm 72 | 73 | #include "raw_data.inl" 74 | 75 | #endif//GLM_GTX_raw_data 76 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/simd_vec4.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/third_party/glm/glm/gtx/simd_vec4.hpp -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/spline.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_spline 24 | /// @file glm/gtx/spline.hpp 25 | /// @date 2007-01-25 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_spline GLM_GTX_spline: Spline 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Spline functions 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_spline 39 | #define GLM_GTX_spline GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | #include "../gtx/optimum_pow.hpp" 44 | 45 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 46 | # pragma message("GLM: GLM_GTX_spline extension included") 47 | #endif 48 | 49 | namespace glm 50 | { 51 | /// @addtogroup gtx_spline 52 | /// @{ 53 | 54 | //! Return a point from a catmull rom curve. 55 | //! From GLM_GTX_spline extension. 56 | template 57 | genType catmullRom( 58 | genType const & v1, 59 | genType const & v2, 60 | genType const & v3, 61 | genType const & v4, 62 | typename genType::value_type const & s); 63 | 64 | //! Return a point from a hermite curve. 65 | //! From GLM_GTX_spline extension. 66 | template 67 | genType hermite( 68 | genType const & v1, 69 | genType const & t1, 70 | genType const & v2, 71 | genType const & t2, 72 | typename genType::value_type const & s); 73 | 74 | //! Return a point from a cubic curve. 75 | //! From GLM_GTX_spline extension. 76 | template 77 | genType cubic( 78 | genType const & v1, 79 | genType const & v2, 80 | genType const & v3, 81 | genType const & v4, 82 | typename genType::value_type const & s); 83 | 84 | /// @} 85 | }//namespace glm 86 | 87 | #include "spline.inl" 88 | 89 | #endif//GLM_GTX_spline 90 | 91 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/spline.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-01-25 5 | // Updated : 2009-02-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/spline.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm{ 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType catmullRom 14 | ( 15 | genType const & v1, 16 | genType const & v2, 17 | genType const & v3, 18 | genType const & v4, 19 | typename genType::value_type const & s 20 | ) 21 | { 22 | typename genType::value_type s1 = s; 23 | typename genType::value_type s2 = pow2(s); 24 | typename genType::value_type s3 = pow3(s); 25 | 26 | typename genType::value_type f1 = -s3 + typename genType::value_type(2) * s2 - s; 27 | typename genType::value_type f2 = typename genType::value_type(3) * s3 - typename genType::value_type(5) * s2 + typename genType::value_type(2); 28 | typename genType::value_type f3 = typename genType::value_type(-3) * s3 + typename genType::value_type(4) * s2 + s; 29 | typename genType::value_type f4 = s3 - s2; 30 | 31 | return (f1 * v1 + f2 * v2 + f3 * v3 + f4 * v4) / typename genType::value_type(2); 32 | 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER genType hermite 37 | ( 38 | genType const & v1, 39 | genType const & t1, 40 | genType const & v2, 41 | genType const & t2, 42 | typename genType::value_type const & s 43 | ) 44 | { 45 | typename genType::value_type s1 = s; 46 | typename genType::value_type s2 = pow2(s); 47 | typename genType::value_type s3 = pow3(s); 48 | 49 | typename genType::value_type f1 = typename genType::value_type(2) * s3 - typename genType::value_type(3) * s2 + typename genType::value_type(1); 50 | typename genType::value_type f2 = typename genType::value_type(-2) * s3 + typename genType::value_type(3) * s2; 51 | typename genType::value_type f3 = s3 - typename genType::value_type(2) * s2 + s; 52 | typename genType::value_type f4 = s3 - s2; 53 | 54 | return f1 * v1 + f2 * v2 + f3 * t1 + f4 * t2; 55 | } 56 | 57 | template 58 | GLM_FUNC_QUALIFIER genType cubic 59 | ( 60 | genType const & v1, 61 | genType const & v2, 62 | genType const & v3, 63 | genType const & v4, 64 | typename genType::value_type const & s 65 | ) 66 | { 67 | return ((v1 * s + v2) * s + v3) * s + v4; 68 | } 69 | 70 | }//namespace glm 71 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/string_cast.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_string_cast 24 | /// @file glm/gtx/string_cast.hpp 25 | /// @date 2008-04-26 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// @see gtc_half_float (dependence) 30 | /// @see gtx_integer (dependence) 31 | /// @see gtx_quaternion (dependence) 32 | /// 33 | /// @defgroup gtx_string_cast GLM_GTX_string_cast: String cast 34 | /// @ingroup gtx 35 | /// 36 | /// @brief Setup strings for GLM type values 37 | /// 38 | /// need to be included to use these functionalities. 39 | /////////////////////////////////////////////////////////////////////////////////// 40 | 41 | #ifndef GLM_GTX_string_cast 42 | #define GLM_GTX_string_cast GLM_VERSION 43 | 44 | // Dependency: 45 | #include "../glm.hpp" 46 | #include "../gtc/half_float.hpp" 47 | #include "../gtx/integer.hpp" 48 | #include "../gtx/quaternion.hpp" 49 | #include 50 | 51 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 52 | # pragma message("GLM: GLM_GTX_string_cast extension included") 53 | #endif 54 | 55 | namespace glm 56 | { 57 | /// @addtogroup gtx_string_cast 58 | /// @{ 59 | 60 | /// Create a string from a GLM type value. 61 | /// From GLM_GTX_string_cast extension. 62 | template 63 | std::string to_string(genType const & x); 64 | 65 | /// @} 66 | }//namespace glm 67 | 68 | #include "string_cast.inl" 69 | 70 | #endif//GLM_GTX_string_cast 71 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | T x, T y, T z) 15 | { 16 | return translate( 17 | detail::tmat4x4(1.0f), 18 | detail::tvec3(x, y , z)); 19 | } 20 | 21 | template 22 | GLM_FUNC_QUALIFIER detail::tmat4x4 translate( 23 | detail::tmat4x4 const & m, 24 | T x, T y, T z) 25 | { 26 | return translate( 27 | m, detail::tvec3(x, y , z)); 28 | } 29 | 30 | template 31 | GLM_FUNC_QUALIFIER detail::tmat4x4 translate( 32 | detail::tvec3 const & v) 33 | { 34 | return translate( 35 | detail::tmat4x4(1.0f), v); 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 40 | T angle, 41 | T x, T y, T z) 42 | { 43 | return rotate( 44 | detail::tmat4x4(1), angle, detail::tvec3(x, y, z)); 45 | } 46 | 47 | template 48 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 49 | T angle, 50 | detail::tvec3 const & v) 51 | { 52 | return rotate( 53 | detail::tmat4x4(1), angle, v); 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 58 | detail::tmat4x4 const & m, 59 | T angle, 60 | T x, T y, T z) 61 | { 62 | return rotate( 63 | m, angle, detail::tvec3(x, y, z)); 64 | } 65 | 66 | template 67 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale(T x, T y, T z) 68 | { 69 | return scale( 70 | detail::tmat4x4(1), detail::tvec3(x, y, z)); 71 | } 72 | 73 | template 74 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale( 75 | detail::tmat4x4 const & m, 76 | T x, T y, T z) 77 | { 78 | return scale( 79 | m, detail::tvec3(x, y, z)); 80 | } 81 | 82 | template 83 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale( 84 | detail::tvec3 const & v) 85 | { 86 | return scale( 87 | detail::tmat4x4(1.0f), v); 88 | } 89 | 90 | }//namespace glm 91 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/unsigned_int.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 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_unsigned_int extension is deprecated, include GLM_GTX_integer instead") 26 | #endif 27 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/unsigned_int.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 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 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/vec1.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kenneycode/triangle/839cb7a0c67261b720302eed53e5eea85fe0c380/third_party/glm/glm/gtx/vec1.inl -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/vector_access.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_vector_access 24 | /// @file glm/gtx/vector_access.hpp 25 | /// @date 2006-01-16 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_vector_access GLM_GTX_vector_access: Vector access 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Function to set values to vectors 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_vector_access 39 | #define GLM_GTX_vector_access GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_vector_access extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_vector_access 51 | /// @{ 52 | 53 | //! Set values to a 2 components vector. 54 | //! From GLM_GTX_vector_access extension. 55 | template 56 | void set( 57 | detail::tvec2 & v, 58 | valType const & x, 59 | valType const & y); 60 | 61 | //! Set values to a 3 components vector. 62 | //! From GLM_GTX_vector_access extension. 63 | template 64 | void set( 65 | detail::tvec3 & v, 66 | valType const & x, 67 | valType const & y, 68 | valType const & z); 69 | 70 | //! Set values to a 4 components vector. 71 | //! From GLM_GTX_vector_access extension. 72 | template 73 | void set( 74 | detail::tvec4 & v, 75 | valType const & x, 76 | valType const & y, 77 | valType const & z, 78 | valType const & w); 79 | 80 | /// @} 81 | }//namespace glm 82 | 83 | #include "vector_access.inl" 84 | 85 | #endif//GLM_GTX_vector_access 86 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/vector_access.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-16 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/vector_access.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER void set 14 | ( 15 | detail::tvec2& v, 16 | valType const & x, 17 | valType const & y 18 | ) 19 | { 20 | v.x = x; 21 | v.y = y; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER void set 26 | ( 27 | detail::tvec3& v, 28 | valType const & x, 29 | valType const & y, 30 | valType const & z 31 | ) 32 | { 33 | v.x = x; 34 | v.y = y; 35 | v.z = z; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER void set 40 | ( 41 | detail::tvec4& v, 42 | valType const & x, 43 | valType const & y, 44 | valType const & z, 45 | valType const & w 46 | ) 47 | { 48 | v.x = x; 49 | v.y = y; 50 | v.z = z; 51 | v.w = w; 52 | } 53 | }//namespace glm 54 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/vector_angle.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-30 5 | // Updated : 2008-09-29 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/vector_angle.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER typename genType::value_type angle 14 | ( 15 | genType const & x, 16 | genType const & y 17 | ) 18 | { 19 | return degrees(acos(dot(x, y))); 20 | } 21 | 22 | //! \todo epsilon is hard coded to 0.01 23 | template 24 | GLM_FUNC_QUALIFIER valType orientedAngle 25 | ( 26 | detail::tvec2 const & x, 27 | detail::tvec2 const & y 28 | ) 29 | { 30 | valType Angle = glm::degrees(acos(dot(x, y))); 31 | detail::tvec2 TransformedVector = glm::rotate(x, Angle); 32 | if(all(equalEpsilon(y, TransformedVector, valType(0.01)))) 33 | return Angle; 34 | else 35 | return -Angle; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER valType orientedAngle 40 | ( 41 | detail::tvec3 const & x, 42 | detail::tvec3 const & y, 43 | detail::tvec3 const & ref 44 | ) 45 | { 46 | valType Angle = glm::degrees(glm::acos(glm::dot(x, y))); 47 | 48 | if(glm::dot(ref, glm::cross(x, y)) < valType(0)) 49 | return -Angle; 50 | else 51 | return Angle; 52 | } 53 | }//namespace glm 54 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/verbose_operator.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-04-20 5 | // Updated : 2008-09-29 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/verbose_operator.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType add(genType const & a, genType const & b) 14 | { 15 | return a + b; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType sub(genType const & a, genType const & b) 20 | { 21 | return a - b; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER detail::tmat2x2 mul 26 | ( 27 | detail::tmat2x2 const & a, 28 | detail::tmat2x2 const & b 29 | ) 30 | { 31 | return a * b; 32 | } 33 | 34 | template 35 | GLM_FUNC_QUALIFIER detail::tmat3x3 mul 36 | ( 37 | detail::tmat3x3 const & a, 38 | detail::tmat3x3 const & b 39 | ) 40 | { 41 | return a * b; 42 | } 43 | 44 | template 45 | GLM_FUNC_QUALIFIER detail::tmat4x4 mul 46 | ( 47 | detail::tmat4x4 const & a, 48 | detail::tmat4x4 const & b 49 | ) 50 | { 51 | return a * b; 52 | } 53 | 54 | template 55 | GLM_FUNC_QUALIFIER detail::tvec2 mul 56 | ( 57 | detail::tmat2x2 const & m, 58 | detail::tvec2 const & v 59 | ) 60 | { 61 | return m * v; 62 | } 63 | 64 | template 65 | GLM_FUNC_QUALIFIER detail::tvec3 mul 66 | ( 67 | detail::tmat3x3 const & m, 68 | detail::tvec3 const & v) 69 | { 70 | return m * v; 71 | } 72 | 73 | template 74 | GLM_FUNC_QUALIFIER detail::tvec4 mul 75 | ( 76 | detail::tmat4x4 const & m, 77 | detail::tvec4 const & v 78 | ) 79 | { 80 | return m * v; 81 | } 82 | 83 | template 84 | GLM_FUNC_QUALIFIER detail::tvec2 mul 85 | ( 86 | detail::tvec2 const & v, 87 | detail::tmat2x2 const & m 88 | ) 89 | { 90 | return v * m; 91 | } 92 | 93 | template 94 | GLM_FUNC_QUALIFIER detail::tvec3 mul 95 | ( 96 | detail::tvec3 const & v, 97 | detail::tmat3x3 const & m 98 | ) 99 | { 100 | return v * m; 101 | } 102 | 103 | template 104 | GLM_FUNC_QUALIFIER detail::tvec4 mul 105 | ( 106 | detail::tvec4 const & v, 107 | detail::tmat4x4 const & m 108 | ) 109 | { 110 | return v * m; 111 | } 112 | 113 | template 114 | GLM_FUNC_QUALIFIER genType div(genType const & a, genType const & b) 115 | { 116 | return a / b; 117 | } 118 | 119 | template 120 | GLM_FUNC_QUALIFIER genTypeT mad(genTypeT const & a, genTypeU const & b, genTypeV const & c) 121 | { 122 | return a * b + c; 123 | } 124 | }//namespace glm 125 | -------------------------------------------------------------------------------- /third_party/glm/glm/gtx/wrap.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_wrap 24 | /// @file glm/gtx/wrap.hpp 25 | /// @date 2009-11-25 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_wrap GLM_GTX_wrap: Texture coordinate wrap modes 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Wrapping mode of texture coordinates. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_wrap 39 | #define GLM_GTX_wrap GLM_VERSION 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(glm_ext)) 45 | # pragma message("GLM: GLM_GTX_wrap extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_wrap 51 | /// @{ 52 | 53 | //! Simulate GL_CLAMP OpenGL wrap mode 54 | //! From GLM_GTX_wrap extension. 55 | template 56 | genType clamp(genType const & Texcoord); 57 | 58 | //! Simulate GL_REPEAT OpenGL wrap mode 59 | //! From GLM_GTX_wrap extension. 60 | template 61 | genType repeat(genType const & Texcoord); 62 | 63 | //! Simulate GL_MIRROR_REPEAT OpenGL wrap mode 64 | //! From GLM_GTX_wrap extension. 65 | template 66 | genType mirrorRepeat(genType const & Texcoord); 67 | 68 | /// @} 69 | }// namespace glm 70 | 71 | #include "wrap.inl" 72 | 73 | #endif//GLM_GTX_wrap 74 | -------------------------------------------------------------------------------- /third_party/glm/util/FindGLM.cmake: -------------------------------------------------------------------------------- 1 | # FindGLM - attempts to locate the glm matrix/vector library. 2 | # 3 | # This module defines the following variables (on success): 4 | # GLM_INCLUDE_DIRS - where to find glm/glm.hpp 5 | # GLM_FOUND - if the library was successfully located 6 | # 7 | # It is trying a few standard installation locations, but can be customized 8 | # with the following variables: 9 | # GLM_ROOT_DIR - root directory of a glm installation 10 | # Headers are expected to be found in either: 11 | # /glm/glm.hpp OR 12 | # /include/glm/glm.hpp 13 | # This variable can either be a cmake or environment 14 | # variable. Note however that changing the value 15 | # of the environment varible will NOT result in 16 | # re-running the header search and therefore NOT 17 | # adjust the variables set by this module. 18 | 19 | #============================================================================= 20 | # Copyright 2012 Carsten Neumann 21 | # 22 | # Distributed under the OSI-approved BSD License (the "License"); 23 | # see accompanying file Copyright.txt for details. 24 | # 25 | # This software is distributed WITHOUT ANY WARRANTY; without even the 26 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 27 | # See the License for more information. 28 | #============================================================================= 29 | # (To distribute this file outside of CMake, substitute the full 30 | # License text for the above reference.) 31 | 32 | # default search dirs 33 | SET(_glm_HEADER_SEARCH_DIRS 34 | "/usr/include" 35 | "/usr/local/include") 36 | 37 | # check environment variable 38 | SET(_glm_ENV_ROOT_DIR "$ENV{GLM_ROOT_DIR}") 39 | 40 | IF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR) 41 | SET(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}") 42 | ENDIF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR) 43 | 44 | # put user specified location at beginning of search 45 | IF(GLM_ROOT_DIR) 46 | SET(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}" 47 | "${GLM_ROOT_DIR}/include" 48 | ${_glm_HEADER_SEARCH_DIRS}) 49 | ENDIF(GLM_ROOT_DIR) 50 | 51 | # locate header 52 | FIND_PATH(GLM_INCLUDE_DIR "glm/glm.hpp" 53 | PATHS ${_glm_HEADER_SEARCH_DIRS}) 54 | 55 | INCLUDE(FindPackageHandleStandardArgs) 56 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLM DEFAULT_MSG 57 | GLM_INCLUDE_DIR) 58 | 59 | IF(GLM_FOUND) 60 | SET(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}") 61 | 62 | MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}") 63 | ENDIF(GLM_FOUND) 64 | -------------------------------------------------------------------------------- /third_party/glm/util/autoexp.txt: -------------------------------------------------------------------------------- 1 | [Visualizer] 2 | 3 | glm::detail::tvec2<*>{ 4 | preview ( 5 | #(#($c.x,$c.y)) 6 | ) 7 | children ( 8 | #([x]: $c.x,[y]: $c.y) 9 | ) 10 | } 11 | 12 | glm::detail::tvec3<*>{ 13 | preview ( 14 | #($e.x,$e.y,$e.z) 15 | ) 16 | children ( 17 | #([x]: $e.x,[y]: $e.y,[z]: $e.z) 18 | ) 19 | } 20 | 21 | glm::detail::tvec4<*>{ 22 | preview ( 23 | #($c.x,$c.y,$c.z,$c.w) 24 | ) 25 | children ( 26 | #([x]: $e.x,[y]: $e.y,[z]: $e.z, #([w]: $e.w)) 27 | ) 28 | } 29 | --------------------------------------------------------------------------------