Move default values from constructor in SceneNode

This commit is contained in:
Peder Bergebakken Sundt 2019-03-16 16:33:20 +01:00
parent 5f705ff11c
commit 019bc2919e
1 changed files with 9 additions and 21 deletions

View File

@ -27,19 +27,7 @@ enum SceneNodeType {
struct SceneNode { struct SceneNode {
SceneNode(SceneNodeType type = GEOMETRY) { SceneNode(SceneNodeType type = GEOMETRY) {
position = vec3(0, 0, 0);
rotation = vec3(0, 0, 0);
scale = vec3(1, 1, 1);
referencePoint = vec3(0, 0, 0);
vertexArrayObjectID = -1;
VAOIndexCount = 0;
nodeType = type; nodeType = type;
targeted_by = nullptr;
isIlluminated = true;
isInverted = false;
} }
void setMesh(Mesh* mesh) { void setMesh(Mesh* mesh) {
@ -65,9 +53,9 @@ struct SceneNode {
vector<SceneNode*> children; vector<SceneNode*> children;
// The node's position and rotation relative to its parent // The node's position and rotation relative to its parent
vec3 position; vec3 position = vec3(0, 0, 0);
vec3 rotation; vec3 rotation = vec3(0, 0, 0);
vec3 scale; vec3 scale = vec3(1, 1, 1);
// set this if the shape uses a custom shader other than the default one // set this if the shape uses a custom shader other than the default one
Gloom::Shader* shader = nullptr; Gloom::Shader* shader = nullptr;
@ -78,26 +66,26 @@ struct SceneNode {
mat4 MVnormal; // transpose(inverse(MV)) mat4 MVnormal; // transpose(inverse(MV))
// The location of the node's reference point (center of rotation) // The location of the node's reference point (center of rotation)
vec3 referencePoint; vec3 referencePoint = vec3(0, 0, 0);
// VAO IDs refering to a loaded Mesh and its length // VAO IDs refering to a loaded Mesh and its length
int vertexArrayObjectID; int vertexArrayObjectID = -1;
uint VAOIndexCount; uint VAOIndexCount = 0;
// textures // textures
uint diffuseTextureID; uint diffuseTextureID;
uint normalTextureID; uint normalTextureID;
// shader flags // shader flags
bool isIlluminated; bool isIlluminated = true;
bool isInverted; bool isInverted = false;
// Node type is used to determine how to handle the contents of a node // Node type is used to determine how to handle the contents of a node
SceneNodeType nodeType; SceneNodeType nodeType;
// for lights: // for lights:
uint lightID; uint lightID;
SceneNode* targeted_by; // spot SceneNode* targeted_by = nullptr; // spot
}; };
// Struct for keeping track of 2D coordinates // Struct for keeping track of 2D coordinates