|
BlankMat 0.1.0
Free open-source 3D texture creation application
|
Node used to group together other nodes and meshes in a scene. More...


Public Member Functions | |
| void | Read (const std::string &scope, std::ifstream &file, bool clear) override |
| Reads child nodes for this node from the file. | |
| void | Write (std::ofstream &file) override |
| Writes this node to the file. | |
| void | Clear () override |
| Recursively deletes this node's children. | |
| unsigned int | WriteCount () |
| Returns the number of elements that can be written. | |
| unsigned int | ChildCount () |
| Returns the number of child nodes. | |
| unsigned int | MeshCount () |
| Returns the number of child meshes. | |
| void | Draw (Shader *shader, State *state, Material *defaultMat, const glm::mat4 &viewProj, bool drawMats=false) override |
| Recursively draws the node and its children and child meshes. | |
| void | DrawShadows (Shader *shader, State *state) |
| Recursively draws the node's and children's shadows. | |
| void | RecalcMatrices () override |
| Recalculates all matrices of the node. | |
| bool | HasMesh (Mesh *mesh) |
| Returns whether the node has the given mesh. | |
| bool | HasNode (const std::string &child) |
| Returns whether the node has the given child. | |
| bool | IsRootNode () |
| Returns whether this node is the root node. | |
| int | GetNodeIndex (const std::string &child) |
| Returns the index of the given node or -1 if not found. | |
| int | GetMeshIndex (Mesh *mesh) |
| Returns the index of the given mesh or -1 if not found. | |
| Node * | GetChild (unsigned int index) |
| Returns the child node with the given index, or none if out of bounds. | |
| Mesh * | GetMesh (unsigned int index) |
| Returns the mesh with the given index, or none if out of bounds. | |
| void | UpdateEnabledStatus () override |
| Updates the enabled status of the object and its children. | |
| Node * | FindNode (const std::string &name) |
| Recursively searches for the node with the given name. | |
| Mesh * | FindMesh (const std::string &name) |
| Recursively searches for the mesh with the given name. | |
| void | LoadMeshes (MeshContainer *meshes) |
| Recursively loads the unloaded child meshes of this and child nodes. | |
| void | AddMeshName (const std::string &name) |
| Adds the name of the mesh to the node, so that the mesh can later be obtained from a mesh container. | |
| void | AddMesh (Mesh *mesh) |
| Adds a mesh for the node. | |
| void | AddChild (Node *child) |
| Adds a child to the node. | |
| bool | MoveMesh (Mesh *mesh, Node *other) |
| Moves the given mesh from this node to the given node. | |
| bool | MoveChild (const std::string &child, Node *other) |
| Moves the given child node from this node to the given node. | |
| bool | TryDelete (Node *node) |
| Attempts to delete the given node. Does nothing if the node is root or is null. | |
| bool | DeleteNode (const std::string &name) |
| Removes the node with the given name along with its children. | |
| bool | DeleteMesh (const std::string &name) |
| Removes the given mesh from the node that holds it. | |
| bool | DeleteChild (Node *node) |
| Deletes the given child node if it is a direct child of this node. | |
| Node (Node *parent) | |
| Creates a default node under the given parent. | |
| Node (Node *parent, const std::string &name, const std::string &scope, const glm::vec3 &pos=glm::vec3(0.0f), const glm::vec3 &rot=glm::vec3(0.0f), const glm::vec3 &scale=glm::vec3(1.0f)) | |
| Creates a scene node with the given parent and name. | |
Public Member Functions inherited from IEntity | |
| virtual const glm::vec3 | GetPos () |
| virtual const glm::vec3 | GetRot () |
| virtual const glm::vec3 | GetScale () |
| virtual Material * | GetMaterial () |
| const glm::vec3 | GetUp () |
| const glm::vec3 | GetRight () |
| const glm::vec3 | GetFront () |
| void | Translate (const glm::vec3 &delta) |
| void | Rotate (const glm::vec3 &delta) |
| void | Scale (const glm::vec3 &delta) |
| const glm::vec3 | GetWorldPos () |
| virtual void | SetPos (const glm::vec3 &pos) |
| virtual void | SetRot (const glm::vec3 &rot) |
| virtual void | SetScale (const glm::vec3 &scale) |
| void | CalcBasis () |
| void | LoadMaterial (MaterialContainer *materials) |
| virtual void | SetMaterial (Material *material) |
| bool | IsEnabled () |
| bool | IsEnabledInHierarchy () |
| void | Enable (bool shouldEnable=true) |
| void | EnableParent (bool shouldEnable) |
| bool | ToggleEnabled () |
| virtual void | SetParentModelMatrix (const glm::mat4 &parentModelMatrix) |
| const glm::mat4 & | GetModelMatrix () |
| const glm::mat4 & | GetParentModelMatrix () |
| const glm::mat4 & | GetSelfModelMatrix () |
| const glm::mat3 & | GetNormalModelMatrix () |
| IEntity (const std::string &name="", const std::string &scope="", Material *material=nullptr, bool drawOver=false, const glm::vec3 &pos=glm::vec3(0.0f), const glm::vec3 &rot=glm::vec3(0.0f), const glm::vec3 &scale=glm::vec3(1.0f)) | |
| IEntity (const std::string &name, const std::string &scope, const std::string &material, bool drawOver=false, const glm::vec3 &pos=glm::vec3(0.0f), const glm::vec3 &rot=glm::vec3(0.0f), const glm::vec3 &scale=glm::vec3(1.0f)) | |
| virtual void | Cleanup () |
Public Member Functions inherited from ISelectable | |
| virtual SelectableType | GetSelectableType () |
| Returns the type of the selectable. | |
| ISelectable (SelectableType type=SelectableType::NONE) | |
| Sets the type of the selectable. | |
Public Member Functions inherited from INameable | |
| virtual void | Rename (const std::string &newName, bool includeScope=true) |
| Renames the object, setting the scope to be the scoped part of the name. | |
| virtual void | SetName (const std::string &name) |
| Sets the name of the object. Note: Does not set the scope variable. If renaming based on raw input, use Rename() instead to set the scope. | |
| virtual void | SetScope (const std::string &scope) |
| Sets the scope of the object. | |
| std::string | GetUnscopedName () |
| Returns the unscoped name of the object. | |
| std::string | GetScope () |
| Returns the scope of the object. | |
| std::string | GetScopedName () |
| Returns the scoped name of the object. | |
| void | InitName (const std::string &name, const std::string &scope="") |
| Initializes the nameable object with the given name and scope. | |
| INameable () | |
| Creates a default nameable object without name or scope. | |
Protected Member Functions | |
| void | GenBuffers () override |
| Generates buffers. Nodes have no buffers. | |
| Node * | ReadRecurse (const std::string &scope, std::ifstream &file, Node *parent) |
| Recursively reads all nodes from the given file. | |
| void | WriteRecurse (std::ofstream &file, Node *node, unsigned int depth=0) |
| Recursively writes all nodes into the given file. | |
Protected Attributes | |
| Node * | mParent |
| Parent node of this node. Nullptr if this is the root node. | |
| std::vector< Node * > | mChildren |
| List of child nodes. | |
| std::vector< Mesh * > | mMeshes |
| List of contained meshes. | |
| std::unordered_set< std::string > | mUnloadedMeshes |
| List of mesh names to load eventually. | |
Protected Attributes inherited from IEntity | |
| unsigned int | mVAO = 0 |
| unsigned int | mVBO = 0 |
| unsigned int | mEBO = 0 |
| bool | mDrawOver = false |
| glm::vec3 | mFront = glm::vec3(0.0f) |
| glm::vec3 | mRight = glm::vec3(0.0f) |
| glm::vec3 | mUp = glm::vec3(0.0f) |
| glm::vec3 | mPos = glm::vec3(0.0f) |
| glm::vec3 | mRot = glm::vec3(0.0f) |
| glm::vec3 | mScale = glm::vec3(1.0f) |
| bool | mIsEnabled = true |
| bool | mIsEnabledSelf = true |
| bool | mIsEnabledParent = true |
| Material * | mMaterial = nullptr |
| std::string | mMaterialName = "" |
| bool | mRecalcMatrices = true |
| glm::mat4 | mParentModelMatrix = glm::mat4(1.0f) |
| glm::mat4 | mSelfModelMatrix = glm::mat4(1.0f) |
| glm::mat4 | mModelMatrix = glm::mat4(1.0f) |
| glm::mat3 | mNormalModelMatrix = glm::mat3(1.0f) |
Protected Attributes inherited from ISelectable | |
| SelectableType | mSelectableType = SelectableType::NONE |
| Type of the selectable. | |
Protected Attributes inherited from INameable | |
| std::string | mName = "" |
| Name of the object. | |
| std::string | mScope = "" |
| Scope of the object. | |
Additional Inherited Members | |
Static Public Member Functions inherited from IEntity | |
| static const std::string | GetNameNullSafe (IEntity *entity) |
Node used to group together other nodes and meshes in a scene.
| Node::Node | ( | Node * | parent | ) |
Creates a default node under the given parent.
| parent | Parent node or nulltpr |
| Node::Node | ( | Node * | parent, |
| const std::string & | name, | ||
| const std::string & | scope, | ||
| const glm::vec3 & | pos = glm::vec3(0.0f), |
||
| const glm::vec3 & | rot = glm::vec3(0.0f), |
||
| const glm::vec3 & | scale = glm::vec3(1.0f) |
||
| ) |
Creates a scene node with the given parent and name.
| parent | Parent node or nullptr |
| name | Name of this node |
| scope | Scope of this node |
| pos | Position of the node |
| rot | Rotation of the node |
| scale | Scale of the node |
| void Node::AddChild | ( | Node * | child | ) |
Adds a child to the node.
| child | Child node to add |
| void Node::AddMeshName | ( | const std::string & | name | ) |
Adds the name of the mesh to the node, so that the mesh can later be obtained from a mesh container.
| name | Name of the mesh |
| unsigned int Node::ChildCount | ( | ) |
Returns the number of child nodes.
|
overridevirtual |
Recursively deletes this node's children.
Implements IWritable.
| bool Node::DeleteChild | ( | Node * | node | ) |
Deletes the given child node if it is a direct child of this node.
| node | Node to delete |
| bool Node::DeleteMesh | ( | const std::string & | name | ) |
Removes the given mesh from the node that holds it.
| name | Name of the mesh |
| bool Node::DeleteNode | ( | const std::string & | name | ) |
Removes the node with the given name along with its children.
| name | Name of child node to delete |
Recursively draws the node's and children's shadows.
| shader | Shadow shader |
| state | Global state of the application |
| model | Model matrix |
Implements IEntity.
| Mesh * Node::FindMesh | ( | const std::string & | name | ) |
Recursively searches for the mesh with the given name.
| name | Name of the mesh |
| Node * Node::FindNode | ( | const std::string & | name | ) |
|
inlineoverrideprotectedvirtual |
Generates buffers. Nodes have no buffers.
Implements IEntity.
| Node * Node::GetChild | ( | unsigned int | index | ) |
Returns the child node with the given index, or none if out of bounds.
| index | Index of the child node to find |
| Mesh * Node::GetMesh | ( | unsigned int | index | ) |
Returns the mesh with the given index, or none if out of bounds.
| index | Index of the mesh to find |
| int Node::GetMeshIndex | ( | Mesh * | mesh | ) |
Returns the index of the given mesh or -1 if not found.
| mesh | Mesh to search for |
| int Node::GetNodeIndex | ( | const std::string & | child | ) |
Returns the index of the given node or -1 if not found.
| child | Child node to search for |
| bool Node::HasMesh | ( | Mesh * | mesh | ) |
Returns whether the node has the given mesh.
| mesh | Mesh to search for |
| bool Node::HasNode | ( | const std::string & | child | ) |
Returns whether the node has the given child.
| child | Child node to search for |
| bool Node::IsRootNode | ( | ) |
Returns whether this node is the root node.
| void Node::LoadMeshes | ( | MeshContainer * | meshes | ) |
Recursively loads the unloaded child meshes of this and child nodes.
| meshes | Scene mesh list |
| unsigned int Node::MeshCount | ( | ) |
Returns the number of child meshes.
| bool Node::MoveChild | ( | const std::string & | child, |
| Node * | other | ||
| ) |
Moves the given child node from this node to the given node.
| child | Name of the child node to move |
| other | Node to move child node to |
|
overridevirtual |
Reads child nodes for this node from the file.
| scope | Scope to read in |
| file | File to read from |
| clear | Whether to overwrite the contents of the item |
Implements IWritable.
|
protected |
Recursively reads all nodes from the given file.
| scope | Scope to read in |
| file | File to read |
| parent | Parent node |
|
overridevirtual |
Recalculates all matrices of the node.
Reimplemented from IEntity.
| bool Node::TryDelete | ( | Node * | node | ) |
Attempts to delete the given node. Does nothing if the node is root or is null.
| node | Node to delete |
|
overridevirtual |
Updates the enabled status of the object and its children.
Reimplemented from IEntity.
|
overridevirtual |
|
virtual |
Returns the number of elements that can be written.
Implements IWritable.
|
protected |
Recursively writes all nodes into the given file.
| file | File to write to |
| node | Node to write |
| depth | Depth of the node to write |
|
protected |
List of child nodes.
|
protected |
List of contained meshes.
|
protected |
Parent node of this node. Nullptr if this is the root node.
|
protected |
List of mesh names to load eventually.