33 lines
884 B
C++
33 lines
884 B
C++
#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;
|
|
}
|
|
|