Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
ToyMaker::SceneNode Class Reference

The most basic vanilla flavour of scene node comprised of no more than a name and some components. More...

#include <scene_system.hpp>

Inheritance diagram for ToyMaker::SceneNode:
ToyMaker::BaseSceneNode< SceneNode > ToyMaker::Resource< SceneNode > ToyMaker::SceneNodeCore ToyMaker::IResource

Static Public Member Functions

template<typename ... TComponents>
static std::shared_ptr< SceneNodecreate (const Placement &placement, const std::string &name, TComponents...components)
 
static std::shared_ptr< SceneNodecreate (const nlohmann::json &sceneNodeDescription)
 
static std::shared_ptr< SceneNodecopy (const std::shared_ptr< const SceneNode > other)
 
static std::string getResourceTypeName ()
 
- Static Public Member Functions inherited from ToyMaker::SceneNodeCore
static void SceneNodeCore_del_ (SceneNodeCore *sceneNode)
 Deleter for a managed pointer to a scene node which ensures its onDestroyed virtual function gets called.
 

Protected Member Functions

template<typename ... TComponents>
 SceneNode (const Placement &placement, const std::string &name, TComponents...components)
 
 SceneNode (const nlohmann::json &jsonSceneNode)
 
 SceneNode (const SceneNode &sceneObject)
 
- Protected Member Functions inherited from ToyMaker::BaseSceneNode< SceneNode >
 BaseSceneNode (const Key &key, const Placement &placement, const std::string &name, TComponents...components)
 Constructor for a single node of a subclass.
 
 BaseSceneNode (const Placement &placement, const std::string &name, TComponents...components)
 General constructor for a single node of a subclass.
 
 BaseSceneNode (const nlohmann::json &nodeDescription)
 Constructs a new node of a certain type based on its json description.
 
 BaseSceneNode (const SceneNodeCore &other)
 Constructs a new node of a certain type as a copy of another node.
 
- Protected Member Functions inherited from ToyMaker::SceneNodeCore
virtual void joinWorld (ECSWorld &world)
 Removes this node's entity from its current ECSWorld and adds it to a new ECSWorld.
 
template<typename ... TComponents>
 SceneNodeCore (const Placement &placement, const std::string &name, TComponents...components)
 Constructs a scene node object from essential and extra components.
 
 SceneNodeCore (const nlohmann::json &jsonSceneNode)
 Constructs a node based on its description of JSON, later verifying that essential components are present.
 
 SceneNodeCore (const SceneNodeCore &sceneObject)
 Constructs a new node as a copy of another node.
 
virtual void onCreated ()
 Copy assignment operator.
 
virtual void onActivated ()
 Scene node lifecycle hook for when a node is made an active part of the SceneSystem.
 
virtual void onDeactivated ()
 Scene node lifecycle hook for when a node is deactivated on the SceneSystem.
 
virtual void onDestroyed ()
 Scene node lifecycle hook for when a node (and possibly its descendants) are about to be destroyed.
 
- Protected Member Functions inherited from ToyMaker::Resource< SceneNode >
 Resource (int explicitlyInitializeMe)
 Construct a new resource object.
 
- Protected Member Functions inherited from ToyMaker::IResource
 IResource ()=default
 Construct a new IResource object.
 

Friends

class BaseSceneNode< SceneNode >
 

Additional Inherited Members

- Public Member Functions inherited from ToyMaker::SceneNodeCore
virtual ~SceneNodeCore ()=default
 Destroys SceneNodeCore.
 
template<typename TComponent>
void addComponent (const TComponent &component, const bool bypassSceneActivityCheck=false)
 Adds a component of type TComponent to the node.
 
void addComponent (const nlohmann::json &jsonComponent, const bool bypassSceneActivityCheck=false)
 Adds a component to the node.
 
template<typename TComponent>
TComponent getComponent (const float simulationProgress=1.f) const
 Retrieves a component belonging to this node.
 
template<typename TComponent>
bool hasComponent () const
 Tests whether this node has a component of a specific type.
 
bool hasComponent (const std::string &type) const
 Tests whether this node has a component of a specific type.
 
template<typename TComponent>
void updateComponent (const TComponent &component)
 Updates the value of a component of this node (to what it should be at the start of the next simulation step).
 
void updateComponent (const nlohmann::json &component)
 Updates the value of a component of this node (to what it should be at the start of the next simulation step).
 
template<typename TComponent>
void addOrUpdateComponent (const TComponent &component, const bool bypassSceneActivityCheck=false)
 A method for adding a component or updating a component if that component is already present on this node.
 
void addOrUpdateComponent (const nlohmann::json &component, const bool bypassSceneActivityCheck=false)
 A method for adding a component, or updating a component if the same type of component is already present on this node.
 
template<typename TComponent>
void removeComponent ()
 Removes a component present on this node.
 
template<typename TSystem>
void setEnabled (bool state)
 Sets whether or not a given system should be able to influence this scene object.
 
template<typename TSystem>
bool getEnabled () const
 Returns whether a particular system has been enabled for this node.
 
EntityID getEntityID () const
 Returns the entity id associated with these scene node.
 
WorldID getWorldID () const
 Returns the ID of the ECSWorld this node belongs to.
 
UniversalEntityID getUniversalEntityID () const
 Gets the UniversalEntityID aka the world-entity-id pair associated with this node.
 
std::weak_ptr< ECSWorldgetWorld () const
 Gets a reference to the ECSWorld this node belongs to.
 
bool inScene () const
 Returns whether this node is present as part of the SceneSystem's scene tree.
 
bool isActive () const
 Returns whether this node is present as part of the SceneSystem's scene tree, AND is active there as well.
 
bool isAncestorOf (std::shared_ptr< const SceneNodeCore > sceneNode) const
 Tests whether a particular scene node is the ancestor of this one.
 
bool hasNode (const std::string &pathToChild) const
 Tests whether a node specified by some path relative to this node is a real descendant of this node.
 
void addNode (std::shared_ptr< SceneNodeCore > node, const std::string &where)
 Adds a node (or a tree of them) as a child of the node specified by the path in the argument.
 
std::vector< std::shared_ptr< SceneNodeCore > > getChildren ()
 Returns a list of all of this node's immediate children scene nodes.
 
std::vector< std::shared_ptr< const SceneNodeCore > > getChildren () const
 Returns a list of all of this node's immediate children scene nodes.
 
std::vector< std::shared_ptr< SceneNodeCore > > getDescendants ()
 Gets all of the descendant nodes belonging to this scene node.
 
template<typename TObject = std::shared_ptr<SceneNode>>
TObject getByPath (const std::string &where)
 Gets a reference to a node or related object by its path.
 
template<typename TSceneNode = SceneNode>
std::shared_ptr< TSceneNode > getNodeByID (EntityID entityID)
 Gets a pointer to a node by its EntityID, assuming that node and this one belong to the same ECSWorld.
 
std::string getPathFromAncestor (std::shared_ptr< const SceneNodeCore > ancestor) const
 Gets the path from a node (assumed to be an ancestor) to this node.
 
virtual std::shared_ptr< ViewportNodegetLocalViewport ()
 Returns the viewport node which is in the same ECSWorld as and is the closest ancestor of (or the same as) this node.
 
virtual std::shared_ptr< const ViewportNodegetLocalViewport () const
 Returns (a constant reference to) the viewport node which is in the same ECSWorld as and is the closes ancestor of (or the same as) this node.
 
std::shared_ptr< SceneNodeCoregetNode (const std::string &where)
 Gets a reference to a scene node (of any valid type) based on its path relative to this node.
 
std::shared_ptr< SceneNodeCoregetParentNode ()
 Gets the parent node of this node, if one is present.
 
std::shared_ptr< const SceneNodeCoregetParentNode () const
 Gets (a constant reference to) the parent node of this node, if one is present.
 
std::shared_ptr< SceneNodeCoreremoveNode (const std::string &where)
 Removes a node from the tree present at the path specified.
 
std::vector< std::shared_ptr< SceneNodeCore > > removeChildren ()
 Disconnects and removes all the child nodes attached to this node.
 
std::string getName () const
 Returns the name string for this node.
 
void setName (const std::string &name)
 Sets the name of this node.
 
std::string getViewportLocalPath () const
 Gets the path of this node relative to its local viewport node.
 
void setPrototype_ (std::shared_ptr< SceneNodeCore > prototype)
 A reference to the node which was used in order to construct this one.
 
template<>
void setEnabled (bool state)
 
template<>
void removeComponent ()
 
template<>
void removeComponent ()
 
template<>
void removeComponent ()
 
template<>
void setEnabled (bool)
 
template<>
void updateComponent (const AxisAlignedBounds &axisAlignedBoxBounds)
 
template<>
void updateComponent (const ObjectBounds &objectBounds)
 
template<>
void removeComponent ()
 
template<>
void removeComponent ()
 
- Public Member Functions inherited from ToyMaker::Resource< SceneNode >
std::string getResourceTypeName_ () const override
 Get the resource type string for this resource.
 
- Public Member Functions inherited from ToyMaker::IResource
virtual ~IResource ()=default
 Destroy the IResource object.
 
- Static Protected Member Functions inherited from ToyMaker::BaseSceneNode< SceneNode >
static std::shared_ptr< SceneNodecreate (const Key &, const Placement &placement, const std::string &name, TComponents...components)
 A (private) method for the creation of a new scene node for a particular type.
 
static std::shared_ptr< SceneNodecreate (const Placement &placement, const std::string &name, TComponents...components)
 A method for creating a scene node of a specific type (TSceneNode)
 
static std::shared_ptr< SceneNodecreate (const nlohmann::json &sceneNodeDescription)
 Creates a scene node of a type based on its description in JSON.
 
static std::shared_ptr< SceneNodecopy (const std::shared_ptr< const SceneNode > sceneNode)
 Creates a scene node of a specific type based on another node of that type.
 
- Static Protected Member Functions inherited from ToyMaker::SceneNodeCore
static std::shared_ptr< SceneNodeCorecopy (const std::shared_ptr< const SceneNodeCore > other)
 Creates a new scene tree by copying another scene node and its descendants.
 
static void validateName (const std::string &nodeName)
 Tests whether a given name is actually valid, throwing an error when it is not.
 
- Static Protected Member Functions inherited from ToyMaker::IResource
template<typename TResource>
static void RegisterResource ()
 Registers this resource as a Resource type with the ResourceDatabase.
 

Detailed Description

The most basic vanilla flavour of scene node comprised of no more than a name and some components.

See also
SceneNodeFromDescription

The documentation for this class was generated from the following files: