Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.Element Class Reference

Game world element. More...

Inheritance diagram for Dragengine.Scenery.Element:
Dragengine.Gui.MainMenus.Interactive.IMMCameraSpot Dragengine.Scenery.BehaviorElement Dragengine.Gui.MainMenus.Interactive.IMMEnvironmentMap Dragengine.Gui.MainMenus.Interactive.IMMLight Dragengine.Gui.MainMenus.Interactive.IMMParticleEmitter Dragengine.Gui.MainMenus.Interactive.IMMProp Dragengine.Gui.MainMenus.Interactive.IMMSpeaker Dragengine.Scenery.AttachSlot Dragengine.Scenery.AttachableBaseBillboard Dragengine.Scenery.AttachableBaseForceField Dragengine.Scenery.AttachableBaseLight Dragengine.Scenery.AttachableBaseParticleEmitter Dragengine.Scenery.AttachableBaseSpeaker Dragengine.Scenery.BaseActor Dragengine.Scenery.BaseBillboard Dragengine.Scenery.BaseForceField Dragengine.Scenery.BaseLight Dragengine.Scenery.BaseParticleEmitter Dragengine.Scenery.BaseSky Dragengine.Scenery.BaseSpeaker Dragengine.Scenery.EnvironmentMap Dragengine.Scenery.GhostElement Dragengine.Scenery.InfoConvoCoordSystem Dragengine.Scenery.PhysicsElement Dragengine.Scenery.SimpleElement Dragengine.Scenery.TriggerConversation Dragengine.Scenery.TriggerEvaluate Dragengine.Scenery.TriggerShout Dragengine.Scenery.TriggerTimer Dragengine.Scenery.TriggerToggle Dragengine.Scenery.TriggerTouch

Public Member Functions

void addToGameWorld ()
 
Dictionary debugInformation ()
 Debug information as Dictionary. More...
 
void dispose ()
 Dispose of element. More...
 
void enterFrame ()
 Frame update started. More...
 
ElementClass getClass ()
 
DMatrix getElementMatrix ()
 Matrix to transform from element space into world space. More...
 
GameWorld getGameWorld ()
 
UniqueID getID ()
 
DMatrix getInverseElementMatrix ()
 Matrix to transform from world space into element space. More...
 
bool getIsScaled ()
 Is scaled. More...
 
Quaternion getOrientation ()
 Orientation. More...
 
Element getParent ()
 
DVector getPosition ()
 Position. More...
 
Vector getScaling ()
 Scaling. More...
 
StubElement getStub ()
 Element stub used to create the element. More...
 
bool getTouchable ()
 
bool getVisible ()
 
void init (StubElement stub)
 Initialize element from stub. More...
 
bool isChildOf (Element parent)
 
bool isDisposed ()
 Element has been disposed of. More...
 
bool isMyselfOrChildOf (Element parent)
 
bool isNotDisposed ()
 Element has not been disposed of. More...
 
void log (String message)
 Log using BaseGameApp Console if present. More...
 
Element new (ElementClass elementClass)
 
void onSetGameWorld ()
 
void onSetGeometry ()
 Position, orientation or scaling changed. More...
 
void onSetOrientation ()
 Orientation changed. More...
 
void onSetParent ()
 
void onSetPosition ()
 Position changed. More...
 
void onSetScaling ()
 Scaling changed. More...
 
void onSetTouchable ()
 
void onSetVisible ()
 
void postThink (float elapsed)
 
void readFromFile (PersistencyEnvironment env, FileReader reader)
 Read element from file reader. More...
 
void removeFromGameWorld ()
 
void removeFromGameWorldIfPresent ()
 Remove element from game world if present. More...
 
void safeDispose ()
 Remove element from game world if present and dispose of element. More...
 
void setGameWorld (GameWorld gameWorld)
 
void setGeometry (DVector position, Quaternion orientation)
 Set position and orientation. More...
 
void setGeometry (DVector position, Quaternion orientation, Vector scaling)
 Set position, orientation and scaling of element. More...
 
void setID (UniqueID id)
 
void setOrientation (Quaternion orientation)
 Set orientation. More...
 
void setParent (Element parent)
 
void setPosition (DVector position)
 Set position. More...
 
void setScaling (Vector scaling)
 Set scaling. More...
 
void setStub (StubElement stub)
 Set element stub used to create the element. More...
 
void setTouchable (bool touchable)
 
void setVisible (bool visible)
 
void think (float elapsed)
 
String toString ()
 
void updateStubGeometryFromElement ()
 Update stub position, rotation and scaling from element. More...
 
void visit (ElementVisitor visitor)
 
void writeToFile (PersistencyEnvironment env, FileWriter writer)
 Write element to file writer. More...
 
void writeToFileWithStub (PersistencyEnvironment env, FileWriter writer)
 Write element to file writer with stub. More...
 

Static Public Member Functions

static Element readElementFromFileWithStub (PersistencyEnvironment env, FileReader reader, ElementClassList ElementClassList)
 Load element from file reader with stub supporting null element. More...
 
static void writeElementToFileWithStub (PersistencyEnvironment env, FileWriter writer, Element element)
 Write element to file writer with stub supporting null element. More...
 

Public Attributes

ElementClass pClass
 
GameWorld pGameWorld
 
UniqueID pID
 
bool pIsScaled
 
DMatrix pMatrix
 
DMatrix pMatrixInverse
 
Quaternion pOrientation
 
Element pParent
 
DVector pPosition
 
Vector pScaling
 
StubElement pStub
 
bool pTouchable
 
bool pVisible
 

Detailed Description

Game world element.

Member Function Documentation

◆ addToGameWorld()

void Dragengine.Scenery.Element.addToGameWorld ( )

Adds the element content to the game world if required.

Reimplemented in Dragengine.Scenery.BaseActor.

◆ debugInformation()

Dictionary Dragengine.Scenery.Element.debugInformation ( )

Debug information as Dictionary.

◆ dispose()

void Dragengine.Scenery.Element.dispose ( )

Dispose of element.

Breaks reference loops and cleans up.

Reimplemented in Dragengine.Scenery.SimpleElementOnRail.

◆ enterFrame()

void Dragengine.Scenery.Element.enterFrame ( )

Frame update started.

To receive this event call GameWorld.addEnterFrameOnce() from inside addToGameWorld(). This event is called at the beginning of the next frame update before think() of any element is called.

Use this method as a one-time call to carry out tasks required to be done once before any elements start thinking. Typically this is done after adding a new element to a game world to finish connections to other elements in the game world which can not be established before all required elements are added too.

Warning
Do not call GameWorld.addEnterFrameOnce() or GameWorld.removeEnterFrameOnce() from inside enterFrame(). Do this from addToGameWorld(), removeFromGameWorld(), think() or postThink().

◆ getClass()

ElementClass Dragengine.Scenery.Element.getClass ( )

Retrieves the element class.

◆ getElementMatrix()

DMatrix Dragengine.Scenery.Element.getElementMatrix ( )

Matrix to transform from element space into world space.

◆ getGameWorld()

GameWorld Dragengine.Scenery.Element.getGameWorld ( )

Retrieves the game world or null if not attached.

◆ getID()

UniqueID Dragengine.Scenery.Element.getID ( )

Retrieves the unique id or null if not set.

◆ getInverseElementMatrix()

DMatrix Dragengine.Scenery.Element.getInverseElementMatrix ( )

Matrix to transform from world space into element space.

◆ getIsScaled()

bool Dragengine.Scenery.Element.getIsScaled ( )

Is scaled.

◆ getOrientation()

Quaternion Dragengine.Scenery.Element.getOrientation ( )

Orientation.

◆ getParent()

Element Dragengine.Scenery.Element.getParent ( )

Retrieves the parent or null if not attached.

◆ getPosition()

DVector Dragengine.Scenery.Element.getPosition ( )

Position.

◆ getScaling()

Vector Dragengine.Scenery.Element.getScaling ( )

Scaling.

◆ getStub()

StubElement Dragengine.Scenery.Element.getStub ( )

Element stub used to create the element.

◆ getTouchable()

bool Dragengine.Scenery.Element.getTouchable ( )

Determines if the element is touchable.

◆ getVisible()

bool Dragengine.Scenery.Element.getVisible ( )

Determines if the element is visible.

◆ init()

void Dragengine.Scenery.Element.init ( StubElement  stub)

Initialize element from stub.

Stub is stored in element for saving. Stub can be changed in certain situations. In general though the stub should be kept unchanged.

Reimplemented in Dragengine.Scenery.SimpleElementOnRail, Dragengine.Scenery.BaseActor, and Dragengine.Gui.MainMenus.Interactive.IMMCameraSpot.

◆ isChildOf()

bool Dragengine.Scenery.Element.isChildOf ( Element  parent)

Determines if a this element is parented directly or indirectly to the given element. If the element is the same as the given element false is returned.

◆ isDisposed()

bool Dragengine.Scenery.Element.isDisposed ( )

Element has been disposed of.

◆ isMyselfOrChildOf()

bool Dragengine.Scenery.Element.isMyselfOrChildOf ( Element  parent)

Determines if a this element is parented directly or indirectly to the given element. If the element is the same as the given element true is returned.

◆ isNotDisposed()

bool Dragengine.Scenery.Element.isNotDisposed ( )

Element has not been disposed of.

◆ log()

void Dragengine.Scenery.Element.log ( String  message)

Log using BaseGameApp Console if present.

◆ new()

Element Dragengine.Scenery.Element.new ( ElementClass  elementClass)

Creates a new element object.

◆ onSetGameWorld()

void Dragengine.Scenery.Element.onSetGameWorld ( )

Game world changed.

◆ onSetGeometry()

void Dragengine.Scenery.Element.onSetGeometry ( )

Position, orientation or scaling changed.

◆ onSetOrientation()

void Dragengine.Scenery.Element.onSetOrientation ( )

Orientation changed.

◆ onSetParent()

void Dragengine.Scenery.Element.onSetParent ( )

Parent changed.

◆ onSetPosition()

void Dragengine.Scenery.Element.onSetPosition ( )

Position changed.

Reimplemented in Dragengine.Scenery.BehaviorElement.

◆ onSetScaling()

void Dragengine.Scenery.Element.onSetScaling ( )

Scaling changed.

◆ onSetTouchable()

void Dragengine.Scenery.Element.onSetTouchable ( )

Touchable state changed.

◆ onSetVisible()

void Dragengine.Scenery.Element.onSetVisible ( )

Visible state changed.

◆ postThink()

void Dragengine.Scenery.Element.postThink ( float  elapsed)

Called after the physics system has carried out collision detection and physics simulations. The element has to update its states like position or rotation from its registered physics objects like Colliders or Components. Complex animated elements also update here the skeletal animations.

Parameters
elapsedTime elapsed since last frame update in seconds

◆ readElementFromFileWithStub()

static Element Dragengine.Scenery.Element.readElementFromFileWithStub ( PersistencyEnvironment  env,
FileReader  reader,
ElementClassList  ElementClassList 
)
static

Load element from file reader with stub supporting null element.

Reads element class name from reader. If element class name is empty null element is returned. Otherwise stub and element is read from file reader. Uses ElementClass.loadElement() if supported.

◆ readFromFile()

void Dragengine.Scenery.Element.readFromFile ( PersistencyEnvironment  env,
FileReader  reader 
)

Read element from file reader.

The default implementation reads a single byte expecting value 0 indicating version 0. This allows subclasses to add persistency support by overwriting this method without super calling it.

Reimplemented in Dragengine.Scenery.BaseActor.

◆ removeFromGameWorld()

void Dragengine.Scenery.Element.removeFromGameWorld ( )

Removes the element content from the game world if placed there before.

◆ removeFromGameWorldIfPresent()

void Dragengine.Scenery.Element.removeFromGameWorldIfPresent ( )

Remove element from game world if present.

◆ safeDispose()

void Dragengine.Scenery.Element.safeDispose ( )

Remove element from game world if present and dispose of element.

This is the prefered way to dispose of an element no matter if it is part of a game world or not. Do not use dispose() directly otherwise clean up logic done by removeFromGameWorld() is skipped.

◆ setGameWorld()

void Dragengine.Scenery.Element.setGameWorld ( GameWorld  gameWorld)

Sets the game world or null if not attached.

◆ setGeometry() [1/2]

void Dragengine.Scenery.Element.setGeometry ( DVector  position,
Quaternion  orientation 
)

Set position and orientation.

◆ setGeometry() [2/2]

void Dragengine.Scenery.Element.setGeometry ( DVector  position,
Quaternion  orientation,
Vector  scaling 
)

Set position, orientation and scaling of element.

◆ setID()

void Dragengine.Scenery.Element.setID ( UniqueID  id)

Sets the unique id or null to unset it.

◆ setOrientation()

void Dragengine.Scenery.Element.setOrientation ( Quaternion  orientation)

Set orientation.

◆ setParent()

void Dragengine.Scenery.Element.setParent ( Element  parent)

Sets the parent or null if not attached.

◆ setPosition()

void Dragengine.Scenery.Element.setPosition ( DVector  position)

Set position.

◆ setScaling()

void Dragengine.Scenery.Element.setScaling ( Vector  scaling)

Set scaling.

◆ setStub()

void Dragengine.Scenery.Element.setStub ( StubElement  stub)

Set element stub used to create the element.

◆ setTouchable()

void Dragengine.Scenery.Element.setTouchable ( bool  touchable)

Sets if the element is touchable.

◆ setVisible()

void Dragengine.Scenery.Element.setVisible ( bool  visible)

Sets if the element is visible.

◆ think()

void Dragengine.Scenery.Element.think ( float  elapsed)

Thinks about what the element is going to do in this frame. This is the place to use AI functions to determine the next motions beeing it displacement, rotation or other shape changes. The game world will use this information to carry out changes to the elements. An element does not change its state by itself rather waits for the game world to apply the required changes. Execute here als updates to dynamic skins that are independant, hence not requiring the game world to be uptodate for rendering.

Parameters
elapsedTime elapsed since last frame update in seconds

◆ toString()

String Dragengine.Scenery.Element.toString ( )

Return string representation of this Element.

◆ updateStubGeometryFromElement()

void Dragengine.Scenery.Element.updateStubGeometryFromElement ( )

Update stub position, rotation and scaling from element.

Version
1.23

◆ visit()

void Dragengine.Scenery.Element.visit ( ElementVisitor  visitor)

◆ writeElementToFileWithStub()

static void Dragengine.Scenery.Element.writeElementToFileWithStub ( PersistencyEnvironment  env,
FileWriter  writer,
Element  element 
)
static

Write element to file writer with stub supporting null element.

Writes element class name, then the stub parameters and then the element parameters. If no stub exists an empty one is used for writing stub parameters. If element is null empty element class name is written. Empty element class name is used during loading to indicate a null element.

◆ writeToFile()

void Dragengine.Scenery.Element.writeToFile ( PersistencyEnvironment  env,
FileWriter  writer 
)

Write element to file writer.

The default implementation writes a single byte of value 0 indicating version 0. This allows subclasses to add persistency support by overwriting this method without super calling it.

Reimplemented in Dragengine.Scenery.BaseActor.

◆ writeToFileWithStub()

void Dragengine.Scenery.Element.writeToFileWithStub ( PersistencyEnvironment  env,
FileWriter  writer 
)

Write element to file writer with stub.

Writes element class name, then the stub parameters and then the element parameters. If no stub exists an empty one is used for writing stub parameters.

Member Data Documentation

◆ pClass

ElementClass Dragengine.Scenery.Element.pClass

◆ pGameWorld

GameWorld Dragengine.Scenery.Element.pGameWorld

◆ pID

UniqueID Dragengine.Scenery.Element.pID

◆ pIsScaled

bool Dragengine.Scenery.Element.pIsScaled

◆ pMatrix

DMatrix Dragengine.Scenery.Element.pMatrix

◆ pMatrixInverse

DMatrix Dragengine.Scenery.Element.pMatrixInverse

◆ pOrientation

Quaternion Dragengine.Scenery.Element.pOrientation

◆ pParent

Element Dragengine.Scenery.Element.pParent

◆ pPosition

DVector Dragengine.Scenery.Element.pPosition

◆ pScaling

Vector Dragengine.Scenery.Element.pScaling

◆ pStub

StubElement Dragengine.Scenery.Element.pStub

◆ pTouchable

bool Dragengine.Scenery.Element.pTouchable

◆ pVisible

bool Dragengine.Scenery.Element.pVisible

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