forked from g-truc/glm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/g-truc/glm into matrix-int
- Loading branch information
Showing
11 changed files
with
400 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set(PACKAGE_VERSION 0.9.9) | ||
|
||
if(${PACKAGE_FIND_VERSION_MAJOR} EQUAL 0) | ||
if (${PACKAGE_FIND_VERSION} VERSION_LESS ${GLM_VERSION}) | ||
set(PACKAGE_VERSION_COMPATIBLE 1) | ||
endif() | ||
if(${PACKAGE_FIND_VERSION} VERSION_EQUAL ${GLM_VERSION}) | ||
set(PACKAGE_VERSION_EXACT 1) | ||
endif() | ||
else() | ||
set(PACKAGE_VERSION_UNSUITABLE 1) | ||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
cmake_minimum_required(VERSION 3.2 FATAL_ERROR) | ||
cmake_policy(VERSION 3.2) | ||
|
||
set(GLM_VERSION 0.9.9) | ||
|
||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) | ||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) | ||
if (_IMPORT_PREFIX STREQUAL "/") | ||
set(_IMPORT_PREFIX "") | ||
endif() | ||
|
||
# Set the old GLM_INCLUDE_DIRS variable for backwards compatibility | ||
set(GLM_INCLUDE_DIRS ${_IMPORT_PREFIX}) | ||
|
||
add_library(glm::glm INTERFACE IMPORTED) | ||
set_target_properties(glm::glm PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES ${GLM_INCLUDE_DIRS}) | ||
|
||
mark_as_advanced(glm_DIR) | ||
set(_IMPORT_PREFIX) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.2 FATAL_ERROR) | ||
project(test_find_glm) | ||
|
||
find_package(glm REQUIRED) | ||
|
||
add_executable(test_find_glm test_find_glm.cpp) | ||
target_link_libraries(test_find_glm glm::glm) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <iostream> | ||
#include <glm/glm.hpp> | ||
#include <glm/ext.hpp> | ||
|
||
glm::mat4 camera(float Translate, glm::vec2 const& Rotate) | ||
{ | ||
glm::mat4 Projection = glm::perspective(glm::pi<float>() * 0.25f, 4.0f / 3.0f, 0.1f, 100.f); | ||
glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate)); | ||
View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f)); | ||
View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f)); | ||
glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f)); | ||
return Projection * View * Model; | ||
} | ||
|
||
int main() | ||
{ | ||
const glm::mat4 m = camera(1.f, glm::vec2(1.f, 0.5f)); | ||
std::cout << "matrix diagonal: " << m[0][0] << ", " | ||
<< m[1][1] << ", " << m[2][2] << ", " << m[3][3] << "\n"; | ||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters