Add GLM as submodule

This commit is contained in:
brunoherbelin
2020-04-13 21:53:19 +02:00
parent da7cd9afd9
commit fa0f4c8fc4
8 changed files with 19 additions and 18 deletions

3
.gitmodules vendored
View File

@@ -16,3 +16,6 @@
[submodule "ext/tfd"] [submodule "ext/tfd"]
path = ext/tfd path = ext/tfd
url = https://github.com/native-toolkit/tinyfiledialogs.git url = https://github.com/native-toolkit/tinyfiledialogs.git
[submodule "ext/glm"]
path = ext/glm
url = https://github.com/g-truc/glm.git

View File

@@ -82,7 +82,6 @@ set(THREAD_LIBRARY Threads::Threads)
find_package(PNG REQUIRED) find_package(PNG REQUIRED)
set(PNG_LIBRARY PNG::PNG) set(PNG_LIBRARY PNG::PNG)
# #
# GLFW3 # GLFW3
# #
@@ -95,9 +94,9 @@ find_package(OpenGL REQUIRED)
# #
# GLM # GLM
# #
find_package(glm REQUIRED) set(BUILD_STATIC_LIBS ON)
macro_log_feature(glm_FOUND "GLM" "OpenGL Mathematics" "https://glm.g-truc.net" TRUE) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/glm)
set(GLM_LIBRARY glm) message(STATUS "Compiling 'GLM' OpenGL Mathematics https://glm.g-truc.net.")
# #
# GLAD # GLAD
@@ -131,7 +130,6 @@ set(IMGUITEXTEDIT_SRC
) )
message(STATUS "Including 'ImGuiColorTextEdit' from https://github.com/BalazsJako/ImGuiColorTextEdit -- ${IMGUITEXTEDIT_INCLUDE_DIR}.") message(STATUS "Including 'ImGuiColorTextEdit' from https://github.com/BalazsJako/ImGuiColorTextEdit -- ${IMGUITEXTEDIT_INCLUDE_DIR}.")
# #
# TINY XML 2 # TINY XML 2
# #
@@ -265,7 +263,6 @@ message(STATUS "Using 'CMakeRC ' from https://github.com/vector-of-bool/cmrc.git
target_link_libraries(${VMIX_BINARY} LINK_PRIVATE target_link_libraries(${VMIX_BINARY} LINK_PRIVATE
${GLFW_LIBRARY} ${GLFW_LIBRARY}
${OPENGL_LIBRARY} ${OPENGL_LIBRARY}
${GLM_LIBRARY}
GLAD GLAD
${CMAKE_DL_LIBS} ${CMAKE_DL_LIBS}
${GOBJECT_LIBRARIES} ${GOBJECT_LIBRARIES}
@@ -282,6 +279,7 @@ target_link_libraries(${VMIX_BINARY} LINK_PRIVATE
TINYXML2 TINYXML2
TINYFD TINYFD
IMGUI IMGUI
glm::glm
vmix::rc vmix::rc
) )

View File

@@ -138,7 +138,7 @@ void MediaSurface::update( float dt )
mediaplayer_->update(); mediaplayer_->update();
// if (parent_ != nullptr) { // if (parent_ != nullptr) {
// parent_->transform_ = parent_->transform_ * glm::scale(glm::mat4(1.f), glm::vec3(mediaplayer_->aspectRatio(), 1.f, 1.f)); // parent_->transform_ = parent_->transform_ * glm::scale(glm::identity<glm::mat4>(), glm::vec3(mediaplayer_->aspectRatio(), 1.f, 1.f));
// scale_.x = 1.0; // scale_.x = 1.0;
// } // }
// else // else

View File

@@ -19,11 +19,11 @@
glm::mat4 transform(glm::vec3 translation, glm::vec3 rotation, glm::vec3 scale) glm::mat4 transform(glm::vec3 translation, glm::vec3 rotation, glm::vec3 scale)
{ {
glm::mat4 View = glm::translate(glm::mat4(1.f), translation); glm::mat4 View = glm::translate(glm::identity<glm::mat4>(), translation);
View = glm::rotate(View, rotation.x, glm::vec3(1.f, 0.f, 0.f)); View = glm::rotate(View, rotation.x, glm::vec3(1.f, 0.f, 0.f));
View = glm::rotate(View, rotation.y, glm::vec3(0.f, 1.f, 0.f)); View = glm::rotate(View, rotation.y, glm::vec3(0.f, 1.f, 0.f));
View = glm::rotate(View, rotation.z, glm::vec3(0.f, 0.f, 1.f)); View = glm::rotate(View, rotation.z, glm::vec3(0.f, 0.f, 1.f));
glm::mat4 Model = glm::scale(glm::mat4(1.f), scale); glm::mat4 Model = glm::scale(glm::identity<glm::mat4>(), scale);
return View * Model; return View * Model;
} }
@@ -34,7 +34,7 @@ Node::Node() : initialized_(false), parent_(nullptr), visible_(true)
auto duration = std::chrono::system_clock::now().time_since_epoch(); auto duration = std::chrono::system_clock::now().time_since_epoch();
id_ = std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count() % 100000000; id_ = std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count() % 100000000;
transform_ = glm::mat4(1.f); transform_ = glm::identity<glm::mat4>();
scale_ = glm::vec3(1.f); scale_ = glm::vec3(1.f);
rotation_ = glm::vec3(0.f); rotation_ = glm::vec3(0.f);
translation_ = glm::vec3(0.f); translation_ = glm::vec3(0.f);
@@ -321,8 +321,8 @@ void Animation::init()
{ {
Group::init(); Group::init();
animation_ = glm::mat4(1.f); animation_ = glm::identity<glm::mat4>();
// animation_ = glm::translate(glm::mat4(1.f), glm::vec3(2.f, 0.f, 0.f)); // animation_ = glm::translate(glm::identity<glm::mat4>(), glm::vec3(2.f, 0.f, 0.f));
} }
void Animation::update( float dt ) void Animation::update( float dt )
@@ -338,7 +338,7 @@ void Animation::update( float dt )
glm::vec4 delta = glm::vec4(pos, 0.f) * animation_; glm::vec4 delta = glm::vec4(pos, 0.f) * animation_;
// apply this translation to the Group transform // apply this translation to the Group transform
transform_ *= glm::translate(glm::mat4(1.f), glm::vec3(delta.x, delta.y, 0.f)); transform_ *= glm::translate(glm::identity<glm::mat4>(), glm::vec3(delta.x, delta.y, 0.f));
} }

View File

@@ -210,8 +210,8 @@ void Shader::use()
void Shader::reset() void Shader::reset()
{ {
projection = glm::mat4(1.f); projection = glm::identity<glm::mat4>();
modelview = glm::mat4(1.f); modelview = glm::identity<glm::mat4>();
resolution = glm::vec3(1280.f, 720.f, 0.f); resolution = glm::vec3(1280.f, 720.f, 0.f);
color = glm::vec4(1.f, 1.f, 1.f, 1.f); color = glm::vec4(1.f, 1.f, 1.f, 1.f);
} }

View File

@@ -170,7 +170,7 @@ void UserInterface::handleMouse()
Log::Info("Mouse press (%.1f,%.1f)", io.MousePos.x, io.MousePos.y); Log::Info("Mouse press (%.1f,%.1f)", io.MousePos.x, io.MousePos.y);
glm::mat4 mv = glm::mat4(1.f); glm::mat4 mv = glm::identity<glm::mat4>();
glm::vec3 point = Rendering::manager().unProject(glm::vec2(io.MousePos.x, io.MousePos.y), mv); glm::vec3 point = Rendering::manager().unProject(glm::vec2(io.MousePos.x, io.MousePos.y), mv);
Log::Info(" (%.1f,%.1f)", point.x, point.y); Log::Info(" (%.1f,%.1f)", point.x, point.y);

1
ext/glm Submodule

Submodule ext/glm added at bf71a83494

View File

@@ -180,7 +180,7 @@ void drawScene()
scene.root_.update( static_cast<float>( GST_TIME_AS_MSECONDS(dt)) * 0.001f ); scene.root_.update( static_cast<float>( GST_TIME_AS_MSECONDS(dt)) * 0.001f );
// draw in output frame buffer // draw in output frame buffer
glm::mat4 MV = glm::mat4(1.f); glm::mat4 MV = glm::identity<glm::mat4>();
glm::mat4 P = glm::scale( glm::ortho(-5.f, 5.f, -5.f, 5.f), glm::vec3(1.f, output->aspectRatio(), 1.f)); glm::mat4 P = glm::scale( glm::ortho(-5.f, 5.f, -5.f, 5.f), glm::vec3(1.f, output->aspectRatio(), 1.f));
output->begin(); output->begin();
scene.root_.draw(MV, P); scene.root_.draw(MV, P);
@@ -212,7 +212,6 @@ void drawPreview()
ImGui::End(); ImGui::End();
} }
} }