Kigs Framework  Doc version 0.8
Open source multi purpose Rapid Application Development framework
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Node3D Class Reference

#include <Node3D.h>

Inheritance diagram for Node3D:
SceneNode CoreModifiable GenericRefCountedBaseClass Camera Light MultiMesh Node3DDelayed Node3DLodDecorator Octree OctreeSubNode Scene3D UINode3DLayer

Public Member Functions

 DECLARE_DECORABLE_2_PARAMS (bool, Cull, Node3D, TravState *, unsigned int)
 
virtual void TravDraw (TravState *state)
 
virtual void TravCull (TravState *state)
 
bool addItem (const CMSP &item, ItemPosition pos=Last DECLARE_DEFAULT_LINK_NAME) override
 add item at first or last position
 
bool removeItem (const CMSP &item DECLARE_DEFAULT_LINK_NAME) override
 
void localMove (const v3f &move)
 move local node position ( pos = move + pos )
 
void globalMove (const v3f &move)
 move global node position ( gpos = gmove + gpos )
 
- Public Member Functions inherited from SceneNode
bool addItem (const CMSP &item, ItemPosition pos=Last DECLARE_DEFAULT_LINK_NAME) override
 add item at first or last position
 
- Public Member Functions inherited from CoreModifiable
void Init ()
 Modifiable managmenent.
 
void EmptyItemList ()
 remove all items (sons)
 
CMSP GetInstanceByPath (const std::string &path)
 return the instance corresponding to the given path in sons tree
 
std::string GetRuntimeID () const
 ID.
 
CoreModifiableAttributegetAttribute (KigsID labelid) const
 Attribute management.
 
u32 getNbArrayElements (KigsID attributeLabel) const
 return element count for an array type attribute
 
template<typename attribute_type , typename value_type >
attribute_type * AddDynamicAttribute (KigsID ID, const value_type &value)
 Dynamic attribute management.
 
const kigs::unordered_map< KigsID, ModifiableMethodStruct > * GetMethods ()
 Method management.
 
bool aggregateWith (CMSP &item, ItemPosition pos=Last)
 Aggregate management.
 
void flagAsNotificationCenterRegistered ()
 Flags.
 
void InitParametersFromList (const std::vector< CoreModifiableAttribute * > *params)
 Utility. More...
 
virtual void UninitModifiable ()
 called when InitModifiable has failled : reset read/write flag on all init params More...
 
virtual void ProtectedDestroy ()
 Destroy method decrement refcounter and delete instance if no more used. More...
 
virtual bool removeItem (const CMSP &item)
 remove item (son)
 

Protected Member Functions

void removeUser (CoreModifiable *user) override
 remove user (parent)
 
void addUser (CoreModifiable *user) override
 add the given parent to list
 
void InitModifiable () override
 default modifiable init : set all initparams to readonly and set initflag to true More...
 
void PreDrawDrawable (TravState *state)
 call predraw for drawable sons of this node return true if at least one drawable son was found More...
 
void DrawDrawable (TravState *state)
 call draw for drawable sons of this node More...
 
void PostDrawDrawable (TravState *state)
 call postdraw for drawable sons of this node More...
 
void RecomputeGlobalToLocal ()
 
void RecomputeGlobalBoundingBox ()
 
virtual void RecomputeBoundingBox ()
 
- Protected Member Functions inherited from CoreModifiable
void UpdateAggregates (const Timer &timer, void *addParam)
 Internals.
 
void Export (std::vector< CoreModifiable * > &savedList, XMLNode *currentNode, bool recursive, ExportSettings *settings)
 Export. More...
 
CoreModifiableAttributeGenericCreateDynamicAttribute (CoreModifiable::ATTRIBUTE_TYPE type, KigsID ID)
 create and add dynamic attribute except arrays
 

Protected Attributes

unsigned int mIsVisible
 valid after scene TravCull : mIsVisible store current frame index if object is visible
 
unsigned short mFirstVisibleNodeIndex
 first visible Node in ModuleSceneGraph::mVisiblesNodeList
 
unsigned short mVisibleNodeCount
 number of visible node
 
Matrix3x4 mTransform
 Local transformation matrix (father => this local coordinate system)
 
Matrix3x4 mLocalToGlobal
 Local to global transformation matrix (Local coordinate system => global "world" coordinate system)
 
Matrix3x4 mGlobalToLocal
 Global to local transformation matrix (Global "world" coordinate system => local coordinate system)
 
BBox mLocalBBox
 AABounding box in local coordinate system.
 
BBox mBBox
 AABounding box in father coordinate system.
 
BBox mGlobalBBox
 AABounding box in global "world" coordinate system.
 

Additional Inherited Members

- Static Public Member Functions inherited from CoreModifiable
static std::vector< CMSP > GetRootInstances (const KigsID &cid, bool exactTypeOnly=false)
 static method : return the set of all root instances of the given type
 
static void Append (std::string &XMLString, const std::list< CoreModifiable * > &toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the several CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static void Export (const std::string &filename, CoreModifiable *toexport, bool recursive=false, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static XMLNodeExportToXMLNode (CoreModifiable *toexport, XML *owner_xml_file, bool recursive, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML Node. if recursive flag is set to true, export also all sons tree More...
 
static std::string ExportToXMLString (CoreModifiable *toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static void Export (std::string &XMLString, const std::list< CoreModifiable * > &toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the several CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static CMSP Import (const std::string &filename, bool noInit=false, bool keepImportFileName=false, ImportState *state=nullptr, const std::string &override_name="")
 return an new CoreModifiable instance using the description found in XML file given by name
 
static CMSP GetInstanceByGlobalPath (const std::string &path)
 static method : return the instance corresponding to the given path, and given search start
 
static void debugPrintfFullTree (int maxindent=3)
 Editor. More...
 
- Static Protected Member Functions inherited from CoreModifiable
template<typename StringType >
static CMSP Import (XMLNodeTemplate< StringType > *currentNode, CoreModifiable *currentModifiable, ImportState &importState)
 recusrive method to add sons and attributes found in the XML file
 

Detailed Description

Base class for 3D node in the scene graph ( with a 3x4 matrix ).

A Node3D must be unique ( can not be attached to several Node3D ).

Attributes

Key : IgnoreBBox

Key : Show

Methods

Key : GetDataInTouchSupport

Key : ManagePinchTouchEvent

Key : ManageScrollTouchEvent

Member Function Documentation

◆ DECLARE_DECORABLE_2_PARAMS()

Node3D::DECLARE_DECORABLE_2_PARAMS ( bool  ,
Cull  ,
Node3D  ,
TravState ,
unsigned int   
)

set node up to date, and compute visibility. Return FALSE when node is totally outside of the culling volume. TRUE if this node is visible or we are in a "all visible" branch of the scenegraph

◆ DrawDrawable()

void Node3D::DrawDrawable ( TravState state)
protected

call draw for drawable sons of this node

when in "path" mode, just get drawable in path, call DoDraw and update needed pass count

else when not in "path" mode and no drawable sorter is available, call DoDraw and update needed pass count on all drawable

last case when not in "path" mode and drawable sorter is available, call DoDraw and update needed pass count on not transparent drawable, or add transparent drawable to the path

◆ InitModifiable()

void Node3D::InitModifiable ( )
overrideprotectedvirtual

default modifiable init : set all initparams to readonly and set initflag to true

already done ? then return

Reimplemented from CoreModifiable.

Reimplemented in Octree, Scene3D, and Node3DDelayed.

◆ PostDrawDrawable()

void Node3D::PostDrawDrawable ( TravState state)
protected

call postdraw for drawable sons of this node

when in "path" mode or when no drawablesorter is available, then no question, postdraw all drawable

else postdraw only not transparent drawable

◆ PreDrawDrawable()

void Node3D::PreDrawDrawable ( TravState state)
protected

call predraw for drawable sons of this node return true if at least one drawable son was found

when in "path" mode or when no drawablesorter is available, then no question, predraw all drawable

else predraw only not transparent drawable

◆ RecomputeBoundingBox()

void Node3D::RecomputeBoundingBox ( )
protectedvirtual

init local and "local in father coordinate system" bounding box to "invalid"

first check drawable sons bounding box

if object has a valid BBox update return true

check if the box is ok

then recurse to sons

this is the son bounding box in the coordinate system of this node

check if the son Bbox is ok

if inherited class overload GetBoundingBox method, then use the result bbox to update local bounding box

check if the box is ok

ok still not init but has drawable ... Init bbox at our position

if Node3D has a valid local BBox, then we can compute BBox in father coordinate system

compute center of the bbox so we can move it around origin

transform diagonal to compute diagonal in father coordinate system

and translate computed bbox at its final position in father coordinate system

◆ RecomputeGlobalBoundingBox()

void Node3D::RecomputeGlobalBoundingBox ( )
protected

use abs(3x3 local to global matrix) to transform bbox

compute origin to bbox center so we can "move" the bbox at the origin

move the BBox max at origin (so that BBox min is -(BBox max))

transform BBox diagonal vector by BBoxTransformMatrix

transform local translation in global coordinates

and add local to global translation

min is -max in local coordinates

move the global BBox at its final destination

◆ RecomputeGlobalToLocal()

void Node3D::RecomputeGlobalToLocal ( )
protected

use 3x3 transpose matrix * invscale

then compute inverse translation

then set global to local translation

◆ removeItem()

bool Node3D::removeItem ( const CMSP &item  DECLARE_DEFAULT_LINK_NAME)
override

if item is a SceneNode, then scenegraph will need update after node removing

◆ TravCull()

void Node3D::TravCull ( TravState state)
virtual

TravCull method is called on all sons wich are visible as some processings can be done inside overloaded TravCull mMethods

Reimplemented in Base2DLayer, and Scene3D.

◆ TravDraw()

void Node3D::TravDraw ( TravState state)
virtual

if in "path" mode, then check what to do (continue or pop this node)

init state current matrix with this node matrix

prepare drawing (save states)

recurse to sons

doItAgain flag is used when "path" mode ask for another draw at same "level" in path

if "path" mode, just retreive needed son

recurse to sons

if in "path" mode don't loop for other sons drawing

if "path" mode, just retreive needed son

recurse to sons

if in "path" mode don't loop for other sons drawing

if next son in path is at same level in graph tree, then just loop

pop state to previous values

pop state matrices

pop path if needed in path mode

Reimplemented in Base2DLayer, BaseUI2DLayer, and UINode3DLayer.


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