Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::SceneGraphNode Class Referencefinal

#include <SceneGraphNode.h>

+ Inheritance diagram for Divide::SceneGraphNode:

Classes

struct  ChildContainer
 
struct  events
 
struct  hacks
 

Public Types

enum class  Flags : U16 {
  LOADING = toBit( 1 ) , HOVERED = toBit( 2 ) , SELECTED = toBit( 3 ) , ACTIVE = toBit( 4 ) ,
  VISIBILITY_LOCKED = toBit( 5 ) , PARENT_POST_RENDERED = toBit( 6 ) , SELECTION_LOCKED = toBit( 7 ) , IS_CONTAINER = toBit( 8 ) ,
  COUNT = 9
}
 

Public Member Functions

 SceneGraphNode (PlatformContext &context, SceneGraph *sceneGraph, const SceneGraphNodeDescriptor &descriptor)
 Avoid creating SGNs directly. Use the "addChildNode" on an existing node (even root) or "addNode" on the existing SceneGraph.
 
 ~SceneGraphNode () override
 If we are destroying the current graph node.
 
SceneGraphsceneGraph () noexcept
 Return a reference to the parent graph. Operator= should be disabled.
 
SceneGraphNodeaddChildNode (const SceneGraphNodeDescriptor &descriptor)
 Add child node increments the node's ref counter if the node was already added to the scene graph.
 
bool removeChildNode (const SceneGraphNode *node, bool recursive=true, bool deleteNode=true)
 
SceneGraphNodefindChild (U64 nameHash, bool sceneNodeName=false, bool recursive=false) const
 Find a child Node using the given name (either SGN name or SceneNode name)
 
SceneGraphNodefindChild (I64 GUID, bool sceneNodeGuid=false, bool recursive=false) const
 Find a child using the given SGN or SceneNode GUID.
 
bool removeNodesByType (SceneNodeType nodeType)
 If this function returns true, at least one node of the specified type was removed.
 
void setParent (SceneGraphNode *parent, bool defer=false)
 Changing a node's parent means removing this node from the current parent's child list and appending it to the new parent's list (happens after a full frame)
 
bool isChildOfType (U16 typeMask) const
 Checks if we have a parent matching the typeMask. We check recursively until we hit the top node (if ignoreRoot is false, top node is Root)
 
bool isRelated (const SceneGraphNode *target) const
 Returns true if the current node is related somehow to the specified target node (see RelationshipType enum for more details)
 
bool isRelated (const SceneGraphNode *target, SGNRelationshipCache::RelationshipType relationship) const
 Returns true if the current node is related to the specified target node in the specified way (see RelationshipType enum for more details)
 
bool isChild (const SceneGraphNode *target, bool recursive) const
 Returns true if the specified target node is a parent or grandparent(if recursive == true) of the current node.
 
ChildContainergetChildren () noexcept
 
const ChildContainergetChildren () const noexcept
 
void sceneUpdate (U64 deltaTimeUS, SceneState &sceneState)
 Called from parent SceneGraph.
 
void postLoad ()
 Invoked by the contained SceneNode when it finishes all of its internal loading and is ready for processing.
 
bool intersect (const Ray &intersectionRay, vec2< F32 > range, vector< SGNRayResult > &intersections) const
 Find the graph nodes whom's bounding boxes intersects the given ray.
 
void changeUsageContext (const NodeUsageContext &newContext)
 
void setFlag (Flags flag, bool recursive=true)
 General purpose flag management. Certain flags propagate to children (e.g. selection)!
 
void clearFlag (Flags flag, bool recursive=true)
 Clearing a flag might propagate to child nodes (e.g. selection).
 
bool hasFlag (const Flags flag) const noexcept
 Returns true only if the current node has the specified flag. Does not check children!
 
template<typename T = SceneNode>
requires std::is_base_of_v<SceneNode, T>
T & getNode () noexcept
 
FORCE_INLINE SceneNodeHandle handle () const noexcept
 
template<typename T = SceneNode>
requires std::is_base_of_v<SceneNode, T>
const T & getNode () const noexcept
 
template<typename T >
FORCE_INLINE T * get () const
 Returns a pointer to a specific component. Returns null if the SGN does not have the component requested.
 
FORCE_INLINE U32 dataFlag () const noexcept
 
void SendEvent (ECS::CustomEvent &&event)
 
template<class E , class... ARGS>
void SendEvent (ARGS &&... eventArgs) const
 Sends a global event but dispatched is handled between update steps.
 
template<class E , class... ARGS>
void SendAndDispatchEvent (ARGS &&... eventArgs) const
 Sends a global event with dispatched happening immediately. Avoid using often. Bad for performance.
 
template<class T , class ... P>
requires std::is_base_of_v<SGNComponent, T>
T * AddSGNComponent (P &&... param)
 
template<class T >
requires std::is_base_of_v<SGNComponent, T>
void RemoveSGNComponent ()
 Remove a component by type (if any). Because we have a limit of one component type per node, this works as expected.
 
void AddComponents (U32 componentMask, bool allowDuplicates)
 
void RemoveComponents (U32 componentMask)
 
bool HasComponents (ComponentType componentType) const
 
bool HasComponents (U32 componentMask) const
 
void saveToXML (const ResourcePath &sceneLocation, DELEGATE< void, std::string_view > msgCallback={}) const
 Serialization: save to XML file.
 
void loadFromXML (const ResourcePath &sceneLocation)
 
void loadFromXML (const boost::property_tree::ptree &pt)
 Serialization: load from XML file (expressed as a boost property_tree)
 
template<>
TransformComponentget () const
 
template<>
BoundsComponentget () const
 
template<>
RenderingComponentget () const
 
- Public Member Functions inherited from ECS::Entity< SceneGraphNode >
EntityTypeId GetStaticEntityTypeID () const override
 
 Entity ()
 
virtual ~Entity ()
 
- Public Member Functions inherited from ECS::IEntity
 IEntity ()
 
virtual ~IEntity ()
 
template<class T >
T * GetComponent () const
 
template<class T , class ... P>
T * AddComponent (P &&... param)
 
template<class T >
void RemoveComponent ()
 
void RemoveAllComponents ()
 
void PassDataToAllComponents (const ECS::CustomEvent &evt)
 
bool operator== (const IEntity &rhs) const
 
bool operator!= (const IEntity &rhs) const
 
bool operator== (const IEntity *rhs) const
 
bool operator!= (const IEntity *rhs) const
 
virtual EntityTypeId GetStaticEntityTypeID () const =0
 
EntityId GetEntityID () const
 
void SetActive (bool active)
 
bool IsActive () const
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 
- Public Member Functions inherited from Divide::GUIDWrapper
 GUIDWrapper () noexcept
 
 GUIDWrapper (const GUIDWrapper &old) noexcept
 
 GUIDWrapper (GUIDWrapper &&old) noexcept
 
virtual ~GUIDWrapper ()=default
 
FORCE_INLINE I64 getGUID () const noexcept
 
GUIDWrapperoperator= (const GUIDWrapper &old)=delete
 
GUIDWrapperoperator= (GUIDWrapper &&other)=delete
 
- Public Member Functions inherited from Divide::PlatformContextComponent
 PlatformContextComponent (PlatformContext &context) noexcept
 
virtual ~PlatformContextComponent ()=default
 
PlatformContextcontext () noexcept
 
const PlatformContextcontext () const noexcept
 
- Public Member Functions inherited from Divide::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (NonCopyable &&)=default
 

Protected Member Functions

void updateCollisions (const SceneGraphNode &parentNode, IntersectionContainer &intersections, Mutex &intersectionsLock) const
 
- Protected Member Functions inherited from Divide::NonCopyable
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Private Member Functions

void processEvents ()
 Process any events that might of queued up during the ECS Update stages.
 
SceneGraphNodeaddChildNode (SceneGraphNode *sgn)
 Add a new SceneGraphNode to the current node's child list based on a SceneNode.
 
FrustumCollision stateCullNode (const NodeCullParams &params, U16 cullFlags, U32 filterMask, const F32 distanceToClosestPointSQ) const
 Returns a collision result that determines if the node SHOULD be culled (is not visible for the current stage).
 
FrustumCollision clippingCullNode (const NodeCullParams &params) const
 
FrustumCollision frustumCullNode (const NodeCullParams &params, U16 cullFlags, F32 &distanceToClosestPointSQ) const
 
void prepareRender (RenderingComponent &rComp, RenderPackage &pkg, GFX::MemoryBarrierCommand &postDrawMemCmd, const RenderStagePass &renderStagePass, const CameraSnapshot &cameraSnapshot, bool refreshData)
 Called after preRender and after we rebuild our command buffers. Useful for modifying the command buffer that's going to be used for this RenderStagePass.
 
void onNetworkSend (U32 frameCount) const
 Called whenever we send a networking packet from our NetworkingComponent (if any). FrameCount is the frame ID sent with the packet.
 
void getAllNodes (vector< SceneGraphNode * > &nodeList)
 Returns a bottom-up list(leafs -> root) of all of the nodes parented under the current one.
 
void processDeleteQueue (vector< size_t > &childList)
 Destructs all of the nodes specified in the list and removes them from the _children container.
 
bool saveCache (ByteBuffer &outputBuffer) const
 Similar to the saveToXML call but is geared towards temporary state (e.g. save game)
 
bool loadCache (ByteBuffer &inputBuffer)
 Similar to the loadFromXML call but is geared towards temporary state (e.g. save game)
 
void setTransformDirty (U32 transformMask)
 Called by the TransformComponent whenever the transform changed.
 
ECS::ECSEngineGetECSEngine () const noexcept
 This indirect is used to avoid including ECS headers in this file, but we still need the ECS engine for templated methods.
 
void invalidateRelationshipCache (SceneGraphNode *source=nullptr)
 Only called from withing "setParent()" (which is also called from "addChildNode()"). Used to mark the existing relationship cache as invalid.
 
void setParentInternal ()
 Changes this node's parent.
 
bool canDraw (const RenderStagePass &stagePass) const
 
void AddSGNComponentInternal (SGNComponent *comp)
 
void RemoveSGNComponentInternal (SGNComponent *comp)
 
template<bool checkInternalNode = false>
SceneGraphNodefindChildInternal (U64 nameHash, bool recursive=false) const
 
template<bool checkInternalNode = false>
SceneGraphNodefindChildInternal (I64 GUID, bool recursive=false) const
 
 POINTER_R (SceneGraph, sceneGraph, nullptr)
 
 POINTER_R (SceneNode, node, nullptr)
 
 POINTER_R (ECS::ComponentManager, compManager, nullptr)
 
 POINTER_R (SceneGraphNode, parent, nullptr)
 
 PROPERTY_R (Str< 64 >, name, "")
 
 PROPERTY_R (U64, nameHash, 0u)
 
 PROPERTY_R (I64, queuedNewParent, -1)
 
 PROPERTY_R (U32, componentMask, 0u)
 
 PROPERTY_R (U32, nodeFlags, 0u)
 
 PROPERTY_R (U32, instanceCount, 1u)
 
 PROPERTY_R (bool, serialize, true)
 
 PROPERTY_R (NodeUsageContext, usageContext, NodeUsageContext::NODE_STATIC)
 

Static Private Member Functions

static void PostLoad (SceneNode *sceneNode, SceneGraphNode *sgn)
 As opposed to "postLoad()" that's called when the SceneNode is ready for processing, this call is used as a callback for when the SceneNode finishes loading as a Resource. postLoad() is called after this always.
 

Private Attributes

SGNRelationshipCache _relationshipCache
 
ChildContainer _children
 
struct Divide::SceneGraphNode::hacks Hacks
 
struct Divide::SceneGraphNode::events Events
 
I8 _frustPlaneCache = -1
 
const SceneGraphNodeDescriptor _descriptor
 

Friends

class Attorney::SceneGraphNodeEditor
 
class Attorney::SceneGraphNodeComponent
 
class Attorney::SceneGraphNodeSystem
 
class Attorney::SceneGraphNodeSceneGraph
 
class Attorney::SceneGraphNodeRenderPassCuller
 
class Attorney::SceneGraphNodeRenderPassManager
 
class Attorney::SceneGraphNodeRelationshipCache
 

Additional Inherited Members

- Static Public Member Functions inherited from Divide::GUIDWrapper
static I64 generateGUID () noexcept
 
- Static Public Attributes inherited from ECS::Entity< SceneGraphNode >
static const EntityTypeId STATIC_ENTITY_TYPE_ID
 
- Protected Attributes inherited from ECS::IEntity
DECLARE_STATIC_LOGGER EntityId m_EntityID
 
bool m_Active
 
- Protected Attributes inherited from Divide::GUIDWrapper
const I64 _guid
 
- Protected Attributes inherited from Divide::PlatformContextComponent
PlatformContext_context
 
- Static Protected Attributes inherited from ECS::IEntity
static std::shared_mutex s_ComponentManagerLock
 

Detailed Description

Definition at line 107 of file SceneGraphNode.h.

Member Enumeration Documentation

◆ Flags

enum class Divide::SceneGraphNode::Flags : U16
strong
Enumerator
LOADING 
HOVERED 
SELECTED 
ACTIVE 
VISIBILITY_LOCKED 
PARENT_POST_RENDERED 
SELECTION_LOCKED 
IS_CONTAINER 
COUNT 

Definition at line 121 of file SceneGraphNode.h.

Constructor & Destructor Documentation

◆ SceneGraphNode()

Divide::SceneGraphNode::SceneGraphNode ( PlatformContext context,
SceneGraph sceneGraph,
const SceneGraphNodeDescriptor descriptor 
)
explicit

Avoid creating SGNs directly. Use the "addChildNode" on an existing node (even root) or "addNode" on the existing SceneGraph.

Definition at line 152 of file SceneGraphNode.cpp.

◆ ~SceneGraphNode()

Divide::SceneGraphNode::~SceneGraphNode ( )
override

If we are destroying the current graph node.

Definition at line 206 of file SceneGraphNode.cpp.

Member Function Documentation

◆ addChildNode() [1/2]

SceneGraphNode * Divide::SceneGraphNode::addChildNode ( const SceneGraphNodeDescriptor descriptor)

Add child node increments the node's ref counter if the node was already added to the scene graph.

Add a new SceneGraphNode to the current node's child list based on a SceneNode.

Definition at line 819 of file SceneGraphNode.cpp.

◆ addChildNode() [2/2]

SceneGraphNode * Divide::SceneGraphNode::addChildNode ( SceneGraphNode sgn)
private

Add a new SceneGraphNode to the current node's child list based on a SceneNode.

Definition at line 336 of file SceneGraphNode.cpp.

◆ AddComponents()

void Divide::SceneGraphNode::AddComponents ( U32  componentMask,
bool  allowDuplicates 
)

Definition at line 48 of file SceneGraphNode.cpp.

◆ AddSGNComponent()

template<class T , class ... P>
requires std::is_base_of_v<SGNComponent, T>
T * Divide::SceneGraphNode::AddSGNComponent ( P &&...  param)
inline

Emplacement call for an ECS component. Pass in the component's constructor parameters. Can only add one component of a single type. This may be bad for scripts, but there are workarounds

Definition at line 266 of file SceneGraphNode.h.

◆ AddSGNComponentInternal()

void Divide::SceneGraphNode::AddSGNComponentInternal ( SGNComponent comp)
private

Definition at line 63 of file SceneGraphNode.cpp.

◆ canDraw()

bool Divide::SceneGraphNode::canDraw ( const RenderStagePass stagePass) const
private

Definition at line 719 of file SceneGraphNode.cpp.

◆ changeUsageContext()

void Divide::SceneGraphNode::changeUsageContext ( const NodeUsageContext newContext)

Definition at line 235 of file SceneGraphNode.cpp.

◆ clearFlag()

void Divide::SceneGraphNode::clearFlag ( Flags  flag,
bool  recursive = true 
)

Clearing a flag might propagate to child nodes (e.g. selection).

Definition at line 1174 of file SceneGraphNode.cpp.

◆ clippingCullNode()

FrustumCollision Divide::SceneGraphNode::clippingCullNode ( const NodeCullParams params) const
private

Definition at line 913 of file SceneGraphNode.cpp.

◆ dataFlag()

FORCE_INLINE U32 Divide::SceneGraphNode::dataFlag ( ) const
inlinenoexcept

Definition at line 246 of file SceneGraphNode.h.

◆ findChild() [1/2]

SceneGraphNode * Divide::SceneGraphNode::findChild ( I64  GUID,
bool  sceneNodeGuid = false,
bool  recursive = false 
) const

Find a child using the given SGN or SceneNode GUID.

Definition at line 504 of file SceneGraphNode.cpp.

◆ findChild() [2/2]

SceneGraphNode * Divide::SceneGraphNode::findChild ( U64  nameHash,
bool  sceneNodeName = false,
bool  recursive = false 
) const

Find a child Node using the given name (either SGN name or SceneNode name)

Definition at line 498 of file SceneGraphNode.cpp.

◆ findChildInternal() [1/2]

template<bool checkInternalNode>
SceneGraphNode * Divide::SceneGraphNode::findChildInternal ( I64  GUID,
bool  recursive = false 
) const
inlineprivate

Definition at line 138 of file SceneGraphNode.inl.

◆ findChildInternal() [2/2]

template<bool checkInternalNode>
SceneGraphNode * Divide::SceneGraphNode::findChildInternal ( U64  nameHash,
bool  recursive = false 
) const
inlineprivate

Definition at line 98 of file SceneGraphNode.inl.

◆ frustumCullNode()

FrustumCollision Divide::SceneGraphNode::frustumCullNode ( const NodeCullParams params,
U16  cullFlags,
F32 distanceToClosestPointSQ 
) const
private

Definition at line 941 of file SceneGraphNode.cpp.

◆ get() [1/4]

template<typename T >
FORCE_INLINE T * Divide::SceneGraphNode::get ( ) const
inline

Returns a pointer to a specific component. Returns null if the SGN does not have the component requested.

Definition at line 241 of file SceneGraphNode.h.

◆ get() [2/4]

template<>
TransformComponent * Divide::SceneGraphNode::get ( ) const
inline

Definition at line 59 of file SceneGraphNode.inl.

◆ get() [3/4]

template<>
BoundsComponent * Divide::SceneGraphNode::get ( ) const
inline

Definition at line 65 of file SceneGraphNode.inl.

◆ get() [4/4]

template<>
RenderingComponent * Divide::SceneGraphNode::get ( ) const
inline

Definition at line 71 of file SceneGraphNode.inl.

◆ getAllNodes()

void Divide::SceneGraphNode::getAllNodes ( vector< SceneGraphNode * > &  nodeList)
private

Returns a bottom-up list(leafs -> root) of all of the nodes parented under the current one.

Definition at line 547 of file SceneGraphNode.cpp.

◆ getChildren() [1/2]

const ChildContainer & Divide::SceneGraphNode::getChildren ( ) const
inlinenoexcept

Definition at line 195 of file SceneGraphNode.h.

◆ getChildren() [2/2]

ChildContainer & Divide::SceneGraphNode::getChildren ( )
inlinenoexcept

Definition at line 191 of file SceneGraphNode.h.

◆ GetECSEngine()

ECS::ECSEngine & Divide::SceneGraphNode::GetECSEngine ( ) const
privatenoexcept

This indirect is used to avoid including ECS headers in this file, but we still need the ECS engine for templated methods.

Definition at line 43 of file SceneGraphNode.cpp.

◆ getNode() [1/2]

template<typename T = SceneNode>
requires std::is_base_of_v<SceneNode, T>
const T & Divide::SceneGraphNode::getNode ( ) const
inlinenoexcept

Always use the level of redirection needed to reduce virtual function overhead. Use getNode<SceneNode> if you need material properties for ex. or getNode<SkinnedSubMesh> for animation transforms

Definition at line 234 of file SceneGraphNode.h.

◆ getNode() [2/2]

template<typename T = SceneNode>
requires std::is_base_of_v<SceneNode, T>
T & Divide::SceneGraphNode::getNode ( )
inlinenoexcept

Always use the level of redirection needed to reduce virtual function overhead. Use getNode<SceneNode> if you need material properties for ex. or getNode<SkinnedSubMesh> for animation transforms

Definition at line 221 of file SceneGraphNode.h.

◆ handle()

FORCE_INLINE SceneNodeHandle Divide::SceneGraphNode::handle ( ) const
inlinenoexcept

Definition at line 226 of file SceneGraphNode.h.

◆ HasComponents() [1/2]

bool Divide::SceneGraphNode::HasComponents ( ComponentType  componentType) const

Definition at line 128 of file SceneGraphNode.cpp.

◆ HasComponents() [2/2]

bool Divide::SceneGraphNode::HasComponents ( U32  componentMask) const

Definition at line 133 of file SceneGraphNode.cpp.

◆ hasFlag()

FORCE_INLINE bool Divide::SceneGraphNode::hasFlag ( const Flags  flag) const
noexcept

Returns true only if the current node has the specified flag. Does not check children!

Definition at line 53 of file SceneGraphNode.inl.

◆ intersect()

bool Divide::SceneGraphNode::intersect ( const Ray intersectionRay,
vec2< F32 range,
vector< SGNRayResult > &  intersections 
) const

Find the graph nodes whom's bounding boxes intersects the given ray.

Definition at line 510 of file SceneGraphNode.cpp.

◆ invalidateRelationshipCache()

void Divide::SceneGraphNode::invalidateRelationshipCache ( SceneGraphNode source = nullptr)
private

Only called from withing "setParent()" (which is also called from "addChildNode()"). Used to mark the existing relationship cache as invalid.

Definition at line 1020 of file SceneGraphNode.cpp.

◆ isChild()

bool Divide::SceneGraphNode::isChild ( const SceneGraphNode target,
bool  recursive 
) const

Returns true if the specified target node is a parent or grandparent(if recursive == true) of the current node.

Definition at line 483 of file SceneGraphNode.cpp.

◆ isChildOfType()

bool Divide::SceneGraphNode::isChildOfType ( U16  typeMask) const

Checks if we have a parent matching the typeMask. We check recursively until we hit the top node (if ignoreRoot is false, top node is Root)

Definition at line 446 of file SceneGraphNode.cpp.

◆ isRelated() [1/2]

bool Divide::SceneGraphNode::isRelated ( const SceneGraphNode target) const

Returns true if the current node is related somehow to the specified target node (see RelationshipType enum for more details)

Definition at line 461 of file SceneGraphNode.cpp.

◆ isRelated() [2/2]

bool Divide::SceneGraphNode::isRelated ( const SceneGraphNode target,
SGNRelationshipCache::RelationshipType  relationship 
) const

Returns true if the current node is related to the specified target node in the specified way (see RelationshipType enum for more details)

Definition at line 472 of file SceneGraphNode.cpp.

◆ loadCache()

bool Divide::SceneGraphNode::loadCache ( ByteBuffer inputBuffer)
private

Similar to the loadFromXML call but is geared towards temporary state (e.g. save game)

Definition at line 1058 of file SceneGraphNode.cpp.

◆ loadFromXML() [1/2]

void Divide::SceneGraphNode::loadFromXML ( const boost::property_tree::ptree &  pt)

Serialization: load from XML file (expressed as a boost property_tree)

Definition at line 1115 of file SceneGraphNode.cpp.

◆ loadFromXML() [2/2]

void Divide::SceneGraphNode::loadFromXML ( const ResourcePath sceneLocation)

Definition at line 1103 of file SceneGraphNode.cpp.

◆ onNetworkSend()

void Divide::SceneGraphNode::onNetworkSend ( U32  frameCount) const
private

Called whenever we send a networking packet from our NetworkingComponent (if any). FrameCount is the frame ID sent with the packet.

Definition at line 702 of file SceneGraphNode.cpp.

◆ POINTER_R() [1/4]

Divide::SceneGraphNode::POINTER_R ( ECS::ComponentManager  ,
compManager  ,
nullptr   
)
private

◆ POINTER_R() [2/4]

Divide::SceneGraphNode::POINTER_R ( SceneGraph  ,
sceneGraph  ,
nullptr   
)
private

◆ POINTER_R() [3/4]

Divide::SceneGraphNode::POINTER_R ( SceneGraphNode  ,
parent  ,
nullptr   
)
private

◆ POINTER_R() [4/4]

Divide::SceneGraphNode::POINTER_R ( SceneNode  ,
node  ,
nullptr   
)
private

◆ postLoad()

void Divide::SceneGraphNode::postLoad ( )

Invoked by the contained SceneNode when it finishes all of its internal loading and is ready for processing.

Definition at line 438 of file SceneGraphNode.cpp.

◆ PostLoad()

void Divide::SceneGraphNode::PostLoad ( SceneNode sceneNode,
SceneGraphNode sgn 
)
staticprivate

As opposed to "postLoad()" that's called when the SceneNode is ready for processing, this call is used as a callback for when the SceneNode finishes loading as a Resource. postLoad() is called after this always.

Definition at line 354 of file SceneGraphNode.cpp.

◆ prepareRender()

void Divide::SceneGraphNode::prepareRender ( RenderingComponent rComp,
RenderPackage pkg,
GFX::MemoryBarrierCommand postDrawMemCmd,
const RenderStagePass renderStagePass,
const CameraSnapshot cameraSnapshot,
bool  refreshData 
)
private

Called after preRender and after we rebuild our command buffers. Useful for modifying the command buffer that's going to be used for this RenderStagePass.

Definition at line 661 of file SceneGraphNode.cpp.

◆ processDeleteQueue()

void Divide::SceneGraphNode::processDeleteQueue ( vector< size_t > &  childList)
private

Destructs all of the nodes specified in the list and removes them from the _children container.

Definition at line 562 of file SceneGraphNode.cpp.

◆ processEvents()

void Divide::SceneGraphNode::processEvents ( )
private

Process any events that might of queued up during the ECS Update stages.

Definition at line 598 of file SceneGraphNode.cpp.

◆ PROPERTY_R() [1/8]

Divide::SceneGraphNode::PROPERTY_R ( bool  ,
serialize  ,
true   
)
private

◆ PROPERTY_R() [2/8]

Divide::SceneGraphNode::PROPERTY_R ( I64  ,
queuedNewParent  ,
1 
)
private

◆ PROPERTY_R() [3/8]

Divide::SceneGraphNode::PROPERTY_R ( NodeUsageContext  ,
usageContext  ,
NodeUsageContext::NODE_STATIC   
)
private

◆ PROPERTY_R() [4/8]

Divide::SceneGraphNode::PROPERTY_R ( Str< 64 >  ,
name  ,
""   
)
private

◆ PROPERTY_R() [5/8]

Divide::SceneGraphNode::PROPERTY_R ( U32  ,
componentMask  ,
0u   
)
private

◆ PROPERTY_R() [6/8]

Divide::SceneGraphNode::PROPERTY_R ( U32  ,
instanceCount  ,
1u   
)
private

◆ PROPERTY_R() [7/8]

Divide::SceneGraphNode::PROPERTY_R ( U32  ,
nodeFlags  ,
0u   
)
private

◆ PROPERTY_R() [8/8]

Divide::SceneGraphNode::PROPERTY_R ( U64  ,
nameHash  ,
0u   
)
private

◆ removeChildNode()

bool Divide::SceneGraphNode::removeChildNode ( const SceneGraphNode node,
bool  recursive = true,
bool  deleteNode = true 
)

If this function returns true, the node will no longer be part of the scene hierarchy. If the node is not a child of the calling node, we will recursively look in all of its children for a match

Definition at line 396 of file SceneGraphNode.cpp.

◆ RemoveComponents()

void Divide::SceneGraphNode::RemoveComponents ( U32  componentMask)

Definition at line 116 of file SceneGraphNode.cpp.

◆ removeNodesByType()

bool Divide::SceneGraphNode::removeNodesByType ( SceneNodeType  nodeType)

If this function returns true, at least one node of the specified type was removed.

Definition at line 364 of file SceneGraphNode.cpp.

◆ RemoveSGNComponent()

template<class T >
requires std::is_base_of_v<SGNComponent, T>
void Divide::SceneGraphNode::RemoveSGNComponent ( )
inline

Remove a component by type (if any). Because we have a limit of one component type per node, this works as expected.

Definition at line 275 of file SceneGraphNode.h.

◆ RemoveSGNComponentInternal()

void Divide::SceneGraphNode::RemoveSGNComponentInternal ( SGNComponent comp)
private

Definition at line 83 of file SceneGraphNode.cpp.

◆ saveCache()

bool Divide::SceneGraphNode::saveCache ( ByteBuffer outputBuffer) const
private

Similar to the saveToXML call but is geared towards temporary state (e.g. save game)

Definition at line 1050 of file SceneGraphNode.cpp.

◆ saveToXML()

void Divide::SceneGraphNode::saveToXML ( const ResourcePath sceneLocation,
DELEGATE< void, std::string_view >  msgCallback = {} 
) const

Serialization: save to XML file.

Definition at line 1068 of file SceneGraphNode.cpp.

◆ sceneGraph()

SceneGraph * Divide::SceneGraphNode::sceneGraph ( )
inlinenoexcept

Return a reference to the parent graph. Operator= should be disabled.

Definition at line 156 of file SceneGraphNode.h.

◆ sceneUpdate()

void Divide::SceneGraphNode::sceneUpdate ( U64  deltaTimeUS,
SceneState sceneState 
)

Called from parent SceneGraph.

Definition at line 578 of file SceneGraphNode.cpp.

◆ SendAndDispatchEvent()

template<class E , class... ARGS>
void Divide::SceneGraphNode::SendAndDispatchEvent ( ARGS &&...  eventArgs) const
inline

Sends a global event with dispatched happening immediately. Avoid using often. Bad for performance.

Definition at line 258 of file SceneGraphNode.h.

◆ SendEvent() [1/2]

template<class E , class... ARGS>
void Divide::SceneGraphNode::SendEvent ( ARGS &&...  eventArgs) const
inline

Sends a global event but dispatched is handled between update steps.

Definition at line 252 of file SceneGraphNode.h.

◆ SendEvent() [2/2]

void Divide::SceneGraphNode::SendEvent ( ECS::CustomEvent &&  event)

Definition at line 1202 of file SceneGraphNode.cpp.

◆ setFlag()

void Divide::SceneGraphNode::setFlag ( Flags  flag,
bool  recursive = true 
)

General purpose flag management. Certain flags propagate to children (e.g. selection)!

Definition at line 1146 of file SceneGraphNode.cpp.

◆ setParent()

void Divide::SceneGraphNode::setParent ( SceneGraphNode parent,
bool  defer = false 
)

Changing a node's parent means removing this node from the current parent's child list and appending it to the new parent's list (happens after a full frame)

Change current SceneGraphNode's parent.

Definition at line 253 of file SceneGraphNode.cpp.

◆ setParentInternal()

void Divide::SceneGraphNode::setParentInternal ( )
private

Changes this node's parent.

Definition at line 266 of file SceneGraphNode.cpp.

◆ setTransformDirty()

void Divide::SceneGraphNode::setTransformDirty ( U32  transformMask)
private

Called by the TransformComponent whenever the transform changed.

Definition at line 138 of file SceneGraphNode.cpp.

◆ stateCullNode()

FrustumCollision Divide::SceneGraphNode::stateCullNode ( const NodeCullParams params,
U16  cullFlags,
U32  filterMask,
const F32  distanceToClosestPointSQ 
) const
private

Returns a collision result that determines if the node SHOULD be culled (is not visible for the current stage).

Definition at line 831 of file SceneGraphNode.cpp.

◆ updateCollisions()

void Divide::SceneGraphNode::updateCollisions ( const SceneGraphNode parentNode,
IntersectionContainer intersections,
Mutex intersectionsLock 
) const
protected

Definition at line 1230 of file SceneGraphNode.cpp.

Friends And Related Function Documentation

◆ Attorney::SceneGraphNodeComponent

friend class Attorney::SceneGraphNodeComponent
friend

Definition at line 112 of file SceneGraphNode.h.

◆ Attorney::SceneGraphNodeEditor

friend class Attorney::SceneGraphNodeEditor
friend

Definition at line 111 of file SceneGraphNode.h.

◆ Attorney::SceneGraphNodeRelationshipCache

Definition at line 117 of file SceneGraphNode.h.

◆ Attorney::SceneGraphNodeRenderPassCuller

Definition at line 115 of file SceneGraphNode.h.

◆ Attorney::SceneGraphNodeRenderPassManager

Definition at line 116 of file SceneGraphNode.h.

◆ Attorney::SceneGraphNodeSceneGraph

Definition at line 114 of file SceneGraphNode.h.

◆ Attorney::SceneGraphNodeSystem

friend class Attorney::SceneGraphNodeSystem
friend

Definition at line 113 of file SceneGraphNode.h.

Member Data Documentation

◆ _children

ChildContainer Divide::SceneGraphNode::_children
private

Definition at line 343 of file SceneGraphNode.h.

◆ _descriptor

const SceneGraphNodeDescriptor Divide::SceneGraphNode::_descriptor
private

Definition at line 378 of file SceneGraphNode.h.

◆ _frustPlaneCache

I8 Divide::SceneGraphNode::_frustPlaneCache = -1
mutableprivate

Definition at line 375 of file SceneGraphNode.h.

◆ _relationshipCache

SGNRelationshipCache Divide::SceneGraphNode::_relationshipCache
private

Definition at line 342 of file SceneGraphNode.h.

◆ Events

struct Divide::SceneGraphNode::events Divide::SceneGraphNode::Events
private

◆ Hacks

struct Divide::SceneGraphNode::hacks Divide::SceneGraphNode::Hacks
private

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