2019-03-17 15:30:21 +01:00
|
|
|
#include "sceneGraph.hpp"
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
SceneNode* createSceneNode() {
|
|
|
|
return new SceneNode();
|
|
|
|
}
|
|
|
|
SceneNode* createSceneNode(SceneNodeType type) {
|
|
|
|
return new SceneNode(type);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add a child node to its parent's list of children
|
|
|
|
void addChild(SceneNode* parent, SceneNode* child) {
|
|
|
|
parent->children.push_back(child);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Pretty prints the current values of a SceneNode instance to stdout
|
|
|
|
void printNode(SceneNode* node) {
|
|
|
|
printf(
|
|
|
|
"SceneNode {\n"
|
|
|
|
" Child count: %i\n"
|
|
|
|
" Rotation: (%f, %f, %f)\n"
|
|
|
|
" Location: (%f, %f, %f)\n"
|
|
|
|
" Reference point: (%f, %f, %f)\n"
|
|
|
|
" VAO ID: %i\n"
|
|
|
|
"}\n",
|
|
|
|
int(node->children.size()),
|
|
|
|
node->rotation.x, node->rotation.y, node->rotation.z,
|
|
|
|
node->position.x, node->position.y, node->position.z,
|
|
|
|
node->referencePoint.x, node->referencePoint.y, node->referencePoint.z,
|
|
|
|
node->vertexArrayObjectID);
|
|
|
|
}
|