|
| ~SimObject () override |
| Detaches all SimObjectAspects from this SimObject before allowing destruction to proceed.
|
|
void | addAspect (const nlohmann::json &jsonAspectProperties) |
| Constructs and attaches a new SimObjectAspect to this node based on the aspect's description in JSON.
|
|
void | addAspect (const BaseSimObjectAspect &simObjectAspect) |
| Constructs and attaches a new SimObjectAspect to this node which is a copy of the aspect passed as argument.
|
|
template<typename TSimObjectAspect> |
bool | hasAspect () const |
| Tests whether an aspect of a particular type is attached to this node.
|
|
bool | hasAspect (const std::string &aspectType) const |
| Tests whether an aspect of a particular type is attached to this node.
|
|
template<typename TInterface> |
bool | hasAspectWithInterface () const |
| Tests whether any aspects implementing some base class are present on this node.
|
|
void | addOrReplaceAspect (const BaseSimObjectAspect &simObjectAspect) |
| Adds or replaces an aspect for this node.
|
|
void | addOrReplaceAspect (const nlohmann::json &jsonAspectProperties) |
| Adds or replaces an aspect for this node.
|
|
template<typename TSimObjectAspect> |
TSimObjectAspect & | getAspect () |
| Gets a reference to a specific aspect present on this node.
|
|
BaseSimObjectAspect & | getAspect (const std::string &aspectType) |
| Gets (a base class reference to) an aspect present on this node.
|
|
template<typename TInterface> |
std::vector< std::reference_wrapper< TInterface > > | getAspectsWithInterface () |
| Gets a list of aspects which subclass some base class.
|
|
template<typename TSimObjectAspect> |
void | removeAspect () |
| Removes an aspect of a certain type from this SimObject.
|
|
void | removeAspect (const std::string &aspectType) |
| Removes an aspect of a certain type from this SimObject.
|
|
template<typename ... TComponents> |
| SimObject (const Placement &placement, const std::string &name, TComponents ... components) |
|
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< ECSWorld > | getWorld () 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< ViewportNode > | getLocalViewport () |
| 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 ViewportNode > | getLocalViewport () 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< SceneNodeCore > | getNode (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< SceneNodeCore > | getParentNode () |
| Gets the parent node of this node, if one is present.
|
|
std::shared_ptr< const SceneNodeCore > | getParentNode () const |
| Gets (a constant reference to) the parent node of this node, if one is present.
|
|
std::shared_ptr< SceneNodeCore > | removeNode (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 () |
|
std::string | getResourceTypeName_ () const override |
| Get the resource type string for this resource.
|
|
virtual | ~IResource ()=default |
| Destroy the IResource object.
|
|
|
template<typename ... TComponents> |
| SimObject (const Placement &placement, const std::string &name, TComponents...components) |
|
| SimObject (const nlohmann::json &jsonSimObject) |
|
| SimObject (const SimObject &other) |
|
| 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.
|
|
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 | onDestroyed () |
| Scene node lifecycle hook for when a node (and possibly its descendants) are about to be destroyed.
|
|
| Resource (int explicitlyInitializeMe) |
| Construct a new resource object.
|
|
| IResource ()=default |
| Construct a new IResource object.
|
|
A wrapper on entity that allows objects in the Scene to be scriptable.
This node will track (in addition to components owned by SceneNodeCore) any SimObjectAspects attached to it. It will also ensure that such aspects receive scene object lifecycle and engine related events, which it itself receives from the SimSystem.
The purpose of this is to facilitate the same sort of object-oriented, component-oriented interfaces game developers may be accustomed to in other engines (like Monobehaviours in Unity, GDScript in Godot).
Usage:
An example JSON description of a SimObject, as would be seen in a scene file:
{
"aspects": [
{ "type": "QueryClick" },
{ "type": "UrLookAtBoard", "offset": [0.0, 1.0, 7.0] }
],
"components": [
{
"fov": 55.5,
"aspect": 1.77778,
"orthographic_dimensions": {"horizontal": 0, "vertical": 0},
"near_far_planes": {"near": 0.5, "far": 100},
"projection_mode": "frustum",
"type": "CameraProperties"
},
{
"orientation": [
0.310491145,
-0.0720598251,
-0.923300385,
-0.214287385
],
"position": [
-6.0,
8.4,
6.0,
1.0
],
"scale": [
1.0,
1.0,
1.0
],
"type": "Placement"
}
],
"name": "camera",
"parent": "/viewport_3D/",
"type": "SimObject"
}
- See also
- SimObjectAspect
-
SimSystem