Adding / organizing the workspace into multple seperate projects
This commit is contained in:
32
SandboxApp/src/Util.cpp
Normal file
32
SandboxApp/src/Util.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "Util.h"
|
||||
|
||||
void PrintSceneTree(Node& node, int depth) {
|
||||
// Indent name based on depth
|
||||
std::cout << " ";
|
||||
for (int i = 0; i < depth; i++) {
|
||||
std::cout << "-";
|
||||
}
|
||||
|
||||
std::cout << " " << node.name << std::endl;
|
||||
|
||||
depth++;
|
||||
for (auto child : node.children) {
|
||||
PrintSceneTree(*child, depth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
glm::mat4 CalculateModelMat(Transform& transform) {
|
||||
|
||||
glm::mat4 tran = glm::translate(glm::mat4(), transform.Position);
|
||||
glm::mat4 scale = glm::scale(glm::mat4(), transform.Scale);
|
||||
glm::mat4 rot =
|
||||
glm::rotate(glm::mat4(), glm::radians(transform.Rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)) *
|
||||
glm::rotate(glm::mat4(), glm::radians(transform.Rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)) *
|
||||
glm::rotate(glm::mat4(), glm::radians(transform.Rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
|
||||
return tran * rot * scale;
|
||||
}
|
||||
|
Reference in New Issue
Block a user