Support Forum       G3D Web Page     
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
G3D::ParticleSystem Class Reference

An Entity composed of multiple translucent particles. More...

Inherits G3D::VisibleEntity.

Classes

class  Block
 Memory management element for the ParticleBuffer. More...
 
class  Particle
 
class  ParticleBuffer
 Not threadsafe. More...
 
class  PhysicsEnvironment
 Particle-specific forces that can be shared between ParticleSystem instances. More...
 
class  SortProxy
 

Public Types

typedef Vector4 NormalDataType
 
enum  VisualizationMode {
  SKELETON,
  BOUNDS,
  SKELETON_AND_BOUNDS
}
 

Public Member Functions

void addParticle (const Particle &p)
 
ArticulatedModel::PosearticulatedModelPose ()
 
bool canCauseCollisions () const
 
bool canChange () const
 True if this Entity can change (when not Scene::editing(); all objects can change when in editing mode). More...
 
bool castsShadows () const
 
const Surface::ExpressiveLightScatteringPropertiesexpressiveLightScatteringProperties () const
 
void fastRemoveParticle (int index)
 Uses Array::fastRemove. More...
 
const CoordinateFrameframe () const
 Current position, i.e., as of last onSimulation call. More...
 
virtual void getLastBounds (class AABox &box) const
 Return a world-space axis-aligned bounding box as of the last call to onPose(). More...
 
virtual void getLastBounds (class Sphere &sphere) const
 Return a world-space bounding sphere as of the last call to onPose(). More...
 
virtual void getLastBounds (class Box &box) const
 Return a world-space bounding box as of the last call to onPose(). More...
 
virtual bool intersect (const Ray &R, float &maxDistance, Model::HitInfo &info=Model::HitInfo::ignore) const override
 
virtual bool intersectBounds (const Ray &R, float &maxDistance, Model::HitInfo &info) const override
 Returns true if there is conservatively some intersection with the object's bounds closer than maxDistance to the ray origin. More...
 
virtual const Array< Box > & lastBoxBoundArray () const
 Return a world-space bounding box array for all surfaces produced by this Entity as of the last call to onPose(). More...
 
bool lastBoxBoundArraysOverlap (const shared_ptr< Entity > &other) const
 Returns true if the world space bounds of these two entities overlap. More...
 
RealTime lastChangeTime () const
 Wall-clock time at which this entity changed in some way, e.g., that might require recomputing a spatial data structure. More...
 
virtual void makeGUI (class GuiPane *pane, class GApp *app) override
 Create a user interface for controlling the properties of this Entity. More...
 
float mass () const
 
const shared_ptr< Model > & model () const
 
const Stringname () const
 
virtual void onPose (Array< shared_ptr< Surface > > &surfaceArray) override
 
Invokes poseModel to compute the actual surfaces and then computes bounds on them when needed. More...
 
virtual void onSimulation (SimTime absoluteTime, SimTime deltaTime) override
 If canMove(), then computes forces from physicsEnvironment() and applies basic Euler integration of velocity. More...
 
const Particleparticle (int index) const
 
bool particlesAreInWorldSpace () const
 Particles stored in world space are more efficient to simulate, but cannot be easily moved as a group in the scene editor or due to animation. More...
 
bool physicalSimulation () const
 
const shared_ptr< PhysicsEnvironment > & physicsEnvironment () const
 If nullptr, no physics forces are introduced by the default implementtion of onSimulation. More...
 
virtual shared_ptr< SoundEntityplaySound (const shared_ptr< Sound > &sound, const CFrame &childFrame=CFrame(), bool attach=true)
 Creates a new G3D::SoundEntity attached to this Entity at childFrame by an Entity::EntityTrack and returns it. More...
 
virtual const shared_ptr< Model::Pose > & pose () const
 
const CoordinateFramepreviousFrame () const
 
void removeParticle (int index)
 
virtual void setCanCauseCollisions (bool c)
 If true, causes collisions for other objects during physical simulation. More...
 
void setCastsShadows (bool b)
 
virtual void setFrame (const CFrame &f, bool updatePreviousFrame=true)
 This sets the position of the Entity for the current simulation step. More...
 
virtual void setFrameSpline (const PhysicsFrameSpline &spline)
 If there is a controller on this object and it is a SplineTrack, mutate it to store this value. More...
 
virtual void setMass (float m)
 Set to a negative number to tell the physics system to use the absolute value as a density and infer the mass from the mesh on load. More...
 
virtual void setModel (const shared_ptr< Model > &model)
 Not all VisibleEntity subclasses will accept all models. More...
 
void setParticle (int index, const Particle &p)
 Subclassing ParticleSystem to override onSimulation is usually easier and more efficient than explicitly replacing particles from outside of the class. More...
 
virtual void setPhysicalSimulation (bool s)
 If true, this object should receive physical simulation for its motion. More...
 
void setPhysicsEnvironment (const shared_ptr< PhysicsEnvironment > &p)
 
virtual void setPose (const shared_ptr< Model::Pose > &pose)
 
virtual void setPreviousFrame (const CFrame &f)
 Explicitly override the previous frame value used for computing motion vectors. More...
 
void setShouldBeSaved (bool b)
 
virtual void setTrack (const shared_ptr< Track > &c)
 
virtual void setVisible (bool b)
 
bool shouldBeSaved () const
 True if this Entity should be saved when the scene is converted to Any for saving/serialization. More...
 
int size () const
 Number of particles. More...
 
virtual Any toAny (const bool forceAll=false) const override
 Converts the current VisibleEntity to an Any. More...
 
virtual shared_ptr< Tracktrack () const
 
bool visible () const
 
virtual void visualize (RenderDevice *rd, bool isSelected, const class SceneVisualizationSettings &s, const shared_ptr< GFont > &font, const shared_ptr< Camera > &camera)
 Called by Scene::visualize every frame. More...
 

Static Public Member Functions

static shared_ptr< VisibleEntitycreate (const String &name, Scene *scene, const shared_ptr< Model > &model, const CFrame &frame=CFrame(), const shared_ptr< Track > &track=shared_ptr< Entity::Track >(), bool canChange=true, bool shouldBeSaved=true, bool visible=true, const Surface::ExpressiveLightScatteringProperties &expressiveLightScatteringProperties=Surface::ExpressiveLightScatteringProperties(), const ArticulatedModel::PoseSpline &artPoseSpline=ArticulatedModel::PoseSpline(), const shared_ptr< Model::Pose > &pose=nullptr)
 
static shared_ptr< Entitycreate (const String &name, Scene *scene, AnyTableReader &propertyTable, const ModelTable &modelTable, const Scene::LoadOptions &options)
 For deserialization from Any / loading from file. More...
 
static shared_ptr< ParticleSystemcreate (const String &name, Scene *scene, const CFrame &position, const shared_ptr< Model > &model)
 For programmatic construction at runtime. More...
 
static bool preferLowResolutionTransparency ()
 Defaults to true, only affects OIT. More...
 
static void setPreferLowResolutionTransparency (bool b)
 

Protected Member Functions

 ParticleSystem ()
 
virtual void applyPhysics (float t, float dt)
 Computes net forces from the brownian, wind, and gravity values and then applies euler integration to the particles. More...
 
void init (AnyTableReader &propertyTable, const ModelTable &modelTable)
 
void init (const shared_ptr< Model > &model, bool visible, const Surface::ExpressiveLightScatteringProperties &expressiveLightScatteringProperties, const ArticulatedModel::PoseSpline &artPoseSpline, const MD3Model::PoseSequence &md3PoseSequence=MD3Model::PoseSequence(), const shared_ptr< Model::Pose > &pose=nullptr)
 
void init (const String &name, Scene *scene, AnyTableReader &propertyTable)
 The initialization sequence for Entity and its subclasses is different than for typical C++ classes. More...
 
void init (const String &name, Scene *scene, const CFrame &frame, const shared_ptr< Track > &controller, bool canChange, bool shouldBeSaved)
 
void init (AnyTableReader &propertyTable)
 
void init ()
 
void markChanged ()
 
void onModelDropDownAction ()
 GUI callback. More...
 
shared_ptr< ParticleSystemModelparticleSystemModel () const
 
virtual void poseModel (Array< shared_ptr< Surface > > &surfaceArray) const
 Called from VisibleEntity::onPose to extract surfaces from the model. More...
 
virtual void simulatePose (SimTime absoluteTime, SimTime deltaTime)
 Animates the appropriate pose type for the model selected. More...
 
void spawnParticles (SimTime absoluteTime, SimTime deltaTime)
 Called from onSimulation. More...
 
virtual void updateBounds ()
 Called by onPose. More...
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

ArticulatedModel::PoseSpline m_artPoseSpline
 Pose over time. More...
 
shared_ptr< ParticleSystem::Blockm_block
 For re-use if nothing has changed. More...
 
bool m_canCauseCollisions = false
 
bool m_canChange
 If true, the canChange() method returns true. More...
 
Surface::ExpressiveLightScatteringProperties m_expressiveLightScatteringProperties
 
CoordinateFrame m_frame
 Current position. More...
 
SimTime m_initTime
 Time at which this particle system was created, used for sampling the rate curve in ParticleSystemModel. More...
 
AABox m_lastAABoxBounds
 Bounds at the last pose() call, in world space. More...
 
RealTime m_lastBoundsTime
 Time at which the bounds were computed. More...
 
Array< Boxm_lastBoxBoundArray
 Bounds on all of the surfaces from the last pose() call, in world space. More...
 
Box m_lastBoxBounds
 Bounds at the last pose() call, in world space. More...
 
RealTime m_lastChangeTime
 
AABox m_lastObjectSpaceAABoxBounds
 Bounds at the last pose() call, in object space. More...
 
Sphere m_lastSphereBounds
 Bounds at the last pose() call, in world space. More...
 
float m_mass = 1
 
MD3Model::PoseSequence m_md3PoseSequence
 
shared_ptr< Modelm_model
 
class GuiDropDownListm_modelDropDownList
 
bool m_movedSinceLoad
 True if the frame has changed since load. More...
 
bool m_movedSinceSimulation = false
 Has this Entity been explicitly moved by setFrame() since it was last simulated? If so, onSimulation will not update the m_previousFrame because it assumes some external logic is moving the Entity. More...
 
String m_name
 
Array< Particlem_particle
 
bool m_particlesAreInWorldSpace
 Should not be changed once the entity is initialized. More...
 
bool m_particlesChangedSinceBounds
 
bool m_particlesChangedSincePose
 
bool m_physicalSimulation = false
 
shared_ptr< PhysicsEnvironmentm_physicsEnvironment
 
shared_ptr< Model::Posem_pose
 
CoordinateFrame m_previousFrame
 Frame before onSimulation(). More...
 
shared_ptr< Model::Posem_previousPose
 
Random m_rng
 Used for all randomness in the particle system. More...
 
Scenem_scene
 
bool m_shouldBeSaved
 True if this Entity should be saved when the scene is converted to Any for saving/serialization.
More...
 
Any m_sourceAny
 The Any from which this was originally constructed. More...
 
shared_ptr< Trackm_track
 Basic simulation behavior for the Entity. More...
 
bool m_visible
 Should this Entity currently be allowed to affect any part of the rendering pipeline (e.g., shadows, primary rays, indirect light)? If false, the Entity never returns any surfaces from onPose(). More...
 

Static Protected Attributes

static ParticleBuffer s_particleBuffer
 Particle data across all ParticleSystem instances. More...
 
static bool s_preferLowResolutionTransparency
 Used to set the preferLowResolutionTransparency hint on the surfaces created from every particle system. More...
 
static Array< SortProxys_sortArray
 Used when sorting values to compute s_particleBuffer.indexStream for sorted transparency. More...
 

Friends

class ParticleSurface
 
class ParticleSystemModel::Emitter
 

Detailed Description

An Entity composed of multiple translucent particles.

Particles always face the camera's z-axis. This causes them to produce inconsistent results for algorithms that use multiple views.

Assumes that particles are transparent and thus do not write to depth (except for shadow maps) or motion buffers.

Performs "soft particle" fade out near surfaces to hide the intersection with solid geometry.

Renders substantially faster when order-independent transparency is enabled on the Renderer. In that case, static (canMove == false) ParticleSystems perform no CPU work per frame.

In sorted transparency mode, whole ParticleSystem surfaces are sorted (against all other transparent surfaces) and then particles are sorted within each ParticleSystem surface. This is necessary so that particles interact reasonably with glass and other transparent surfaces. However, this means that two ParticleSystems that overlap each other will not have their particles sorted together correctly.

See also
ParticleMaterial

Memory diagram (: = weak_ptr, | = shared_ptr )

           .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .
           :                                                     : particleSystem
           v                  m_block                            :                     blockArray
    [ ParticleSystem ] -----------------------------> [ ParticleSystem::Block ] <-------------------- [ ParticleBuffer ]
           ^                                              ^      :
           | m_entity                                     |      : surface
           |                  m_block                     |      : 
    [ParticleSurface ] -----------------------------------'      :
           ^                                                     :
           :. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. :

Member Typedef Documentation

◆ NormalDataType

Member Enumeration Documentation

◆ VisualizationMode

Enumerator
SKELETON 
BOUNDS 
SKELETON_AND_BOUNDS 

Constructor & Destructor Documentation

◆ ParticleSystem()

G3D::ParticleSystem::ParticleSystem ( )
protected

Member Function Documentation

◆ addParticle()

void G3D::ParticleSystem::addParticle ( const Particle p)
inline

◆ applyPhysics()

virtual void G3D::ParticleSystem::applyPhysics ( float  t,
float  dt 
)
protectedvirtual

Computes net forces from the brownian, wind, and gravity values and then applies euler integration to the particles.

◆ articulatedModelPose()

ArticulatedModel::Pose& G3D::VisibleEntity::articulatedModelPose ( )
inlineinherited

◆ canCauseCollisions()

bool G3D::Entity::canCauseCollisions ( ) const
inlineinherited

◆ canChange()

bool G3D::Entity::canChange ( ) const
inlineinherited

True if this Entity can change (when not Scene::editing(); all objects can change when in editing mode).

It is safe to build static data structures over Entitys that cannot change.

◆ castsShadows()

bool G3D::VisibleEntity::castsShadows ( ) const
inlineinherited

◆ create() [1/3]

static shared_ptr<VisibleEntity> G3D::VisibleEntity::create ( const String name,
Scene scene,
const shared_ptr< Model > &  model,
const CFrame frame = CFrame(),
const shared_ptr< Track > &  track = shared_ptr< Entity::Track >(),
bool  canChange = true,
bool  shouldBeSaved = true,
bool  visible = true,
const Surface::ExpressiveLightScatteringProperties expressiveLightScatteringProperties = Surface::ExpressiveLightScatteringProperties(),
const ArticulatedModel::PoseSpline artPoseSpline = ArticulatedModel::PoseSpline(),
const shared_ptr< Model::Pose > &  pose = nullptr 
)
staticinherited

◆ create() [2/3]

static shared_ptr<Entity> G3D::ParticleSystem::create ( const String name,
Scene scene,
AnyTableReader propertyTable,
const ModelTable modelTable,
const Scene::LoadOptions options 
)
static

For deserialization from Any / loading from file.

◆ create() [3/3]

static shared_ptr<ParticleSystem> G3D::ParticleSystem::create ( const String name,
Scene scene,
const CFrame position,
const shared_ptr< Model > &  model 
)
static

For programmatic construction at runtime.

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ expressiveLightScatteringProperties()

const Surface::ExpressiveLightScatteringProperties& G3D::VisibleEntity::expressiveLightScatteringProperties ( ) const
inlineinherited

◆ fastRemoveParticle()

void G3D::ParticleSystem::fastRemoveParticle ( int  index)
inline

Uses Array::fastRemove.

See also
remove

◆ frame()

const CoordinateFrame& G3D::Entity::frame ( ) const
inlineinherited

Current position, i.e., as of last onSimulation call.

◆ getLastBounds() [1/3]

virtual void G3D::Entity::getLastBounds ( class AABox box) const
virtualinherited

Return a world-space axis-aligned bounding box as of the last call to onPose().

◆ getLastBounds() [2/3]

virtual void G3D::Entity::getLastBounds ( class Sphere sphere) const
virtualinherited

Return a world-space bounding sphere as of the last call to onPose().

◆ getLastBounds() [3/3]

virtual void G3D::Entity::getLastBounds ( class Box box) const
virtualinherited

Return a world-space bounding box as of the last call to onPose().

This is always at least as tight as the AABox bounds and often tighter.

◆ init() [1/6]

void G3D::VisibleEntity::init ( AnyTableReader propertyTable,
const ModelTable modelTable 
)
protectedinherited
See also
create

◆ init() [2/6]

void G3D::VisibleEntity::init ( const shared_ptr< Model > &  model,
bool  visible,
const Surface::ExpressiveLightScatteringProperties expressiveLightScatteringProperties,
const ArticulatedModel::PoseSpline artPoseSpline,
const MD3Model::PoseSequence md3PoseSequence = MD3Model::PoseSequence(),
const shared_ptr< Model::Pose > &  pose = nullptr 
)
protectedinherited
See also
create

◆ init() [3/6]

void G3D::Entity::init ( const String name,
Scene scene,
AnyTableReader propertyTable 
)
protectedinherited

The initialization sequence for Entity and its subclasses is different than for typical C++ classes.

That is because they must avoid throwing exceptions from a constructor when parsing, need to support both AnyTableReader and direct parameter versions, and have to verify that all fields from an AnyTableReader are actually consumed. See samples/entity and G3D::VisibleEntity for examples of how to initialize an Entity subclass.

Parameters
nameThe name of this Entity, e.g., "Player 1"
propertyTableThe form is given below. It is intended that subclasses replace the table name and add new fields.
<some base class name> {
    model     = <modelname>;
    frame     = <initial CFrame or equivalent; overriden if a controller is present>
    track     = <see Entity::Track>;
    canChange = <boolean>
}
  • The pose field is optional. The Entity base class reads this field. Other subclasses read their own fields.
  • The original caller (typically, a Scene subclass createEntity or Entity subclass create method) should invoke AnyTableReader::verifyDone to ensure that all of the fields specified were read by some subclass along the inheritance chain.
  • See VisibleEntity::init for an example of using this method. This method is separate from the constructor solely because it will throw an exception on a parse error, which is dangerous to do during a constructor because the destructor will not run.
sceneMay be nullptr so long as no entity() controller is used

◆ init() [4/6]

void G3D::Entity::init ( const String name,
Scene scene,
const CFrame frame,
const shared_ptr< Track > &  controller,
bool  canChange,
bool  shouldBeSaved 
)
protectedinherited

◆ init() [5/6]

void G3D::ParticleSystem::init ( AnyTableReader propertyTable)
protected

◆ init() [6/6]

void G3D::ParticleSystem::init ( )
protected

◆ intersect()

virtual bool G3D::VisibleEntity::intersect ( const Ray R,
float &  maxDistance,
Model::HitInfo info = Model::HitInfo::ignore 
) const
overridevirtualinherited

Reimplemented from G3D::Entity.

◆ intersectBounds()

virtual bool G3D::VisibleEntity::intersectBounds ( const Ray R,
float &  maxDistance,
Model::HitInfo info 
) const
overridevirtualinherited

Returns true if there is conservatively some intersection with the object's bounds closer than maxDistance to the ray origin.

If so, updates maxDistance with the intersection distance.

The bounds used may be more accurate than any of the given getLastBounds() results because the method may recurse into individual parts of the scene graph within the Entity.

Reimplemented from G3D::Entity.

◆ lastBoxBoundArray()

virtual const Array<Box>& G3D::Entity::lastBoxBoundArray ( ) const
inlinevirtualinherited

Return a world-space bounding box array for all surfaces produced by this Entity as of the last call to onPose().

◆ lastBoxBoundArraysOverlap()

bool G3D::Entity::lastBoxBoundArraysOverlap ( const shared_ptr< Entity > &  other) const
inherited

Returns true if the world space bounds of these two entities overlap.

See also
lastBoxBoundArray

◆ lastChangeTime()

RealTime G3D::Entity::lastChangeTime ( ) const
inlineinherited

Wall-clock time at which this entity changed in some way, e.g., that might require recomputing a spatial data structure.

◆ makeGUI()

virtual void G3D::VisibleEntity::makeGUI ( class GuiPane pane,
class GApp app 
)
overridevirtualinherited

Create a user interface for controlling the properties of this Entity.

Called by SceneEditorWindow on selection.

Parameters
appMay be nullptr.

Reimplemented from G3D::Entity.

Reimplemented in G3D::Light.

◆ markChanged()

void G3D::ParticleSystem::markChanged ( )
protected

◆ mass()

float G3D::Entity::mass ( ) const
inlineinherited

◆ model()

const shared_ptr<Model>& G3D::VisibleEntity::model ( ) const
inlineinherited

◆ name()

const String& G3D::Entity::name ( ) const
inlineinherited

Referenced by G3D::Light::spotTarget().

◆ onModelDropDownAction()

void G3D::VisibleEntity::onModelDropDownAction ( )
protectedinherited

GUI callback.

◆ onPose()

virtual void G3D::ParticleSystem::onPose ( Array< shared_ptr< Surface > > &  surfaceArray)
overridevirtual


Invokes poseModel to compute the actual surfaces and then computes bounds on them when needed.

See also
Entity::onPose

Reimplemented from G3D::VisibleEntity.

◆ onSimulation()

virtual void G3D::ParticleSystem::onSimulation ( SimTime  absoluteTime,
SimTime  deltaTime 
)
overridevirtual

If canMove(), then computes forces from physicsEnvironment() and applies basic Euler integration of velocity.

If the physicsEnvironment is nullptr, then there are no forces.

Reimplemented from G3D::VisibleEntity.

◆ particle()

const Particle& G3D::ParticleSystem::particle ( int  index) const
inline

◆ particlesAreInWorldSpace()

bool G3D::ParticleSystem::particlesAreInWorldSpace ( ) const
inline

Particles stored in world space are more efficient to simulate, but cannot be easily moved as a group in the scene editor or due to animation.

Use world-space particles for smoke and other transient particle effects. The emitter is still in object space.

Object- (Entity-) space particles are relative to the ParticleSystem Entity and can be moved as a group by animation and in the scene editor. Use these for long-lived particles such as clouds and particles bolted to other Entitys.

◆ particleSystemModel()

shared_ptr<ParticleSystemModel> G3D::ParticleSystem::particleSystemModel ( ) const
protected

◆ physicalSimulation()

bool G3D::Entity::physicalSimulation ( ) const
inlineinherited

◆ physicsEnvironment()

const shared_ptr<PhysicsEnvironment>& G3D::ParticleSystem::physicsEnvironment ( ) const
inline

If nullptr, no physics forces are introduced by the default implementtion of onSimulation.

◆ playSound()

virtual shared_ptr<SoundEntity> G3D::Entity::playSound ( const shared_ptr< Sound > &  sound,
const CFrame childFrame = CFrame(),
bool  attach = true 
)
virtualinherited

Creates a new G3D::SoundEntity attached to this Entity at childFrame by an Entity::EntityTrack and returns it.

The new SoundEntity is automatically added to the Scene and will remain rigidly attached to the Entity.

You do not need to retain the pointer to the created sound for it to remain playing and in the scene. The SoundEntity will automatically remove itself from the Scene when it stops playing.

If attach == false, then the EntityTrack is not created and the sound will remain fixed in space.

◆ pose()

virtual const shared_ptr<Model::Pose>& G3D::VisibleEntity::pose ( ) const
inlinevirtualinherited

◆ poseModel()

virtual void G3D::VisibleEntity::poseModel ( Array< shared_ptr< Surface > > &  surfaceArray) const
protectedvirtualinherited

Called from VisibleEntity::onPose to extract surfaces from the model.

If you subclass VisibleEntity to support a new model type, override this method. onPose will then still compute bounds correctly for your model.

Returns
True if the surfaces returned have different bounds than in the previous frame, e.g., due to animation.

◆ preferLowResolutionTransparency()

static bool G3D::ParticleSystem::preferLowResolutionTransparency ( )
inlinestatic

Defaults to true, only affects OIT.

◆ previousFrame()

const CoordinateFrame& G3D::Entity::previousFrame ( ) const
inlineinherited

◆ removeParticle()

void G3D::ParticleSystem::removeParticle ( int  index)
inline

◆ setCanCauseCollisions()

virtual void G3D::Entity::setCanCauseCollisions ( bool  c)
inlinevirtualinherited

If true, causes collisions for other objects during physical simulation.

It may not react to those collisions if physicalSimulation is false. Default is true for VisibleEntity and false for other subclasses.

◆ setCastsShadows()

void G3D::VisibleEntity::setCastsShadows ( bool  b)
inlineinherited

◆ setFrame()

virtual void G3D::Entity::setFrame ( const CFrame f,
bool  updatePreviousFrame = true 
)
virtualinherited

This sets the position of the Entity for the current simulation step.

If there is a controller set and the base class Entity::onSimulation is invoked, it will override the value assigned here.

◆ setFrameSpline()

virtual void G3D::Entity::setFrameSpline ( const PhysicsFrameSpline spline)
virtualinherited

If there is a controller on this object and it is a SplineTrack, mutate it to store this value.

Otherwise, create a new SplineTrack to overwrite the current controller.

See also
setTrack

Used by SceneEditorWindow

◆ setMass()

virtual void G3D::Entity::setMass ( float  m)
inlinevirtualinherited

Set to a negative number to tell the physics system to use the absolute value as a density and infer the mass from the mesh on load.

Default is -10 (kg/m^3).

◆ setModel()

virtual void G3D::VisibleEntity::setModel ( const shared_ptr< Model > &  model)
virtualinherited

Not all VisibleEntity subclasses will accept all models.

If this model is not appropriate for this subclass, then the model() will not change.

◆ setParticle()

void G3D::ParticleSystem::setParticle ( int  index,
const Particle p 
)
inline

Subclassing ParticleSystem to override onSimulation is usually easier and more efficient than explicitly replacing particles from outside of the class.

◆ setPhysicalSimulation()

virtual void G3D::Entity::setPhysicalSimulation ( bool  s)
inlinevirtualinherited

If true, this object should receive physical simulation for its motion.

If true, canMove must also be true and there must be no Track on this Entity.

◆ setPhysicsEnvironment()

void G3D::ParticleSystem::setPhysicsEnvironment ( const shared_ptr< PhysicsEnvironment > &  p)
inline

◆ setPose()

virtual void G3D::VisibleEntity::setPose ( const shared_ptr< Model::Pose > &  pose)
virtualinherited

◆ setPreferLowResolutionTransparency()

static void G3D::ParticleSystem::setPreferLowResolutionTransparency ( bool  b)
inlinestatic

◆ setPreviousFrame()

virtual void G3D::Entity::setPreviousFrame ( const CFrame f)
inlinevirtualinherited

Explicitly override the previous frame value used for computing motion vectors.

This is very rarely needed because simulation automatically updates this value.

◆ setShouldBeSaved()

void G3D::Entity::setShouldBeSaved ( bool  b)
inlineinherited

◆ setTrack()

virtual void G3D::Entity::setTrack ( const shared_ptr< Track > &  c)
inlinevirtualinherited
See also
Entity::Track

◆ setVisible()

virtual void G3D::VisibleEntity::setVisible ( bool  b)
inlinevirtualinherited

◆ shouldBeSaved()

bool G3D::Entity::shouldBeSaved ( ) const
inlineinherited

True if this Entity should be saved when the scene is converted to Any for saving/serialization.

Defaults to true. Set to false for transient objects. For example, a character's spawn point Entity might have shouldBeSaved() = true, while the character itself might have shouldBeSaved() = false. This would allow editing of the scene while the simulation loop is running without having the scene at the end of the editing session reflecting the result of the character moving about.

◆ simulatePose()

virtual void G3D::VisibleEntity::simulatePose ( SimTime  absoluteTime,
SimTime  deltaTime 
)
protectedvirtualinherited

Animates the appropriate pose type for the model selected.

Called from onSimulation. Subclasses will frequently replace onSimulation but retain this helper method.

◆ size()

int G3D::ParticleSystem::size ( ) const
inline

Number of particles.

◆ spawnParticles()

void G3D::ParticleSystem::spawnParticles ( SimTime  absoluteTime,
SimTime  deltaTime 
)
protected

Called from onSimulation.

◆ toAny()

virtual Any G3D::ParticleSystem::toAny ( const bool  forceAll = false) const
overridevirtual

Converts the current VisibleEntity to an Any.

Subclasses should modify at least the name of the Table returned by the base class, which will be "Entity" if not changed.

Reimplemented from G3D::VisibleEntity.

◆ track()

virtual shared_ptr<Track> G3D::Entity::track ( ) const
inlinevirtualinherited
See also
Entity::Track

◆ updateBounds()

virtual void G3D::ParticleSystem::updateBounds ( )
protectedvirtual

Called by onPose.

◆ visible()

bool G3D::VisibleEntity::visible ( ) const
inlineinherited

◆ visualize()

virtual void G3D::Entity::visualize ( RenderDevice rd,
bool  isSelected,
const class SceneVisualizationSettings s,
const shared_ptr< GFont > &  font,
const shared_ptr< Camera > &  camera 
)
virtualinherited

Called by Scene::visualize every frame.

During this, Entitys may make rendering calls according to the SceneVisualizationSettings to display control points and other features.

Parameters
isSelectedTrue if this entity is selected by a sceneEditorWindow, which may trigger additional visualization for it.

Reimplemented in G3D::MarkerEntity, and G3D::SoundEntity.

Friends And Related Function Documentation

◆ ParticleSurface

friend class ParticleSurface
friend

◆ ParticleSystemModel::Emitter

friend class ParticleSystemModel::Emitter
friend

Member Data Documentation

◆ m_artPoseSpline

ArticulatedModel::PoseSpline G3D::VisibleEntity::m_artPoseSpline
protectedinherited

Pose over time.

◆ m_block

shared_ptr<ParticleSystem::Block> G3D::ParticleSystem::m_block
protected

For re-use if nothing has changed.

◆ m_canCauseCollisions

bool G3D::Entity::m_canCauseCollisions = false
protectedinherited

◆ m_canChange

bool G3D::Entity::m_canChange
protectedinherited

If true, the canChange() method returns true.

Defaults to true.

It is illegal to set m_canChange to false if m_frameSpline has more than one control point because a spline implies animation.

Subclasses should set this to false during initialization if the object will never move so that other classes can precompute data structures that are affected by the Entity.

Referenced by G3D::Entity::canChange().

◆ m_expressiveLightScatteringProperties

Surface::ExpressiveLightScatteringProperties G3D::VisibleEntity::m_expressiveLightScatteringProperties
protectedinherited

◆ m_frame

CoordinateFrame G3D::Entity::m_frame
protectedinherited

Current position.

Do not directly mutate–invoke setFrame() to ensure that times are modified correctly.

Referenced by G3D::Light::distance(), G3D::Entity::frame(), G3D::Light::frame(), and G3D::Light::position().

◆ m_initTime

SimTime G3D::ParticleSystem::m_initTime
protected

Time at which this particle system was created, used for sampling the rate curve in ParticleSystemModel.

◆ m_lastAABoxBounds

AABox G3D::Entity::m_lastAABoxBounds
protectedinherited

Bounds at the last pose() call, in world space.

◆ m_lastBoundsTime

RealTime G3D::Entity::m_lastBoundsTime
protectedinherited

Time at which the bounds were computed.

◆ m_lastBoxBoundArray

Array<Box> G3D::Entity::m_lastBoxBoundArray
protectedinherited

Bounds on all of the surfaces from the last pose() call, in world space.

Referenced by G3D::Entity::lastBoxBoundArray().

◆ m_lastBoxBounds

Box G3D::Entity::m_lastBoxBounds
protectedinherited

Bounds at the last pose() call, in world space.

◆ m_lastChangeTime

RealTime G3D::Entity::m_lastChangeTime
protectedinherited

◆ m_lastObjectSpaceAABoxBounds

AABox G3D::Entity::m_lastObjectSpaceAABoxBounds
protectedinherited

Bounds at the last pose() call, in object space.

◆ m_lastSphereBounds

Sphere G3D::Entity::m_lastSphereBounds
protectedinherited

Bounds at the last pose() call, in world space.

◆ m_mass

float G3D::Entity::m_mass = 1
protectedinherited

◆ m_md3PoseSequence

MD3Model::PoseSequence G3D::VisibleEntity::m_md3PoseSequence
protectedinherited

◆ m_model

shared_ptr<Model> G3D::VisibleEntity::m_model
protectedinherited

◆ m_modelDropDownList

class GuiDropDownList* G3D::VisibleEntity::m_modelDropDownList
protectedinherited

◆ m_movedSinceLoad

bool G3D::Entity::m_movedSinceLoad
protectedinherited

True if the frame has changed since load.

Used by toAny() to decide if m_sourceAny is out of date.

◆ m_movedSinceSimulation

bool G3D::Entity::m_movedSinceSimulation = false
protectedinherited

Has this Entity been explicitly moved by setFrame() since it was last simulated? If so, onSimulation will not update the m_previousFrame because it assumes some external logic is moving the Entity.

◆ m_name

String G3D::Entity::m_name
protectedinherited

Referenced by G3D::Entity::name().

◆ m_particle

Array<Particle> G3D::ParticleSystem::m_particle
protected

◆ m_particlesAreInWorldSpace

bool G3D::ParticleSystem::m_particlesAreInWorldSpace
protected

Should not be changed once the entity is initialized.

Referenced by particlesAreInWorldSpace().

◆ m_particlesChangedSinceBounds

bool G3D::ParticleSystem::m_particlesChangedSinceBounds
protected

◆ m_particlesChangedSincePose

bool G3D::ParticleSystem::m_particlesChangedSincePose
protected

◆ m_physicalSimulation

bool G3D::Entity::m_physicalSimulation = false
protectedinherited

◆ m_physicsEnvironment

shared_ptr<PhysicsEnvironment> G3D::ParticleSystem::m_physicsEnvironment
protected

◆ m_pose

shared_ptr<Model::Pose> G3D::VisibleEntity::m_pose
protectedinherited

◆ m_previousFrame

CoordinateFrame G3D::Entity::m_previousFrame
protectedinherited

Frame before onSimulation().

Used for tracking poses and for velocity estimation.

Referenced by G3D::Entity::previousFrame(), and G3D::Entity::setPreviousFrame().

◆ m_previousPose

shared_ptr<Model::Pose> G3D::VisibleEntity::m_previousPose
protectedinherited

◆ m_rng

Random G3D::ParticleSystem::m_rng
protected

Used for all randomness in the particle system.

Not threadsafe.

◆ m_scene

Scene* G3D::Entity::m_scene
protectedinherited

◆ m_shouldBeSaved

bool G3D::Entity::m_shouldBeSaved
protectedinherited

True if this Entity should be saved when the scene is converted to Any for saving/serialization.

Defaults to true. Set to false for transient objects. For example, a character's spawn point Entity might have shouldBeSaved() = true, while the character itself might have shouldBeSaved() = false. This would allow editing of the scene while the simulation loop is running without having the scene at the end of the editing session reflecting the result of the character moving about.

Referenced by G3D::Entity::setShouldBeSaved(), and G3D::Entity::shouldBeSaved().

◆ m_sourceAny

Any G3D::Entity::m_sourceAny
protectedinherited

The Any from which this was originally constructed.

◆ m_track

shared_ptr<Track> G3D::Entity::m_track
protectedinherited

Basic simulation behavior for the Entity.

If nullptr, the Entity is never moved by the base class' onSimulation method. You can subclass Track, but it is usually easier to subclass Entity and override onSimulation directly when creating behaviors more complex than those supported by the default Track language.

Referenced by G3D::Entity::setTrack(), and G3D::Entity::track().

◆ m_visible

bool G3D::VisibleEntity::m_visible
protectedinherited

Should this Entity currently be allowed to affect any part of the rendering pipeline (e.g., shadows, primary rays, indirect light)? If false, the Entity never returns any surfaces from onPose().

Does not necessarily mean that the underlying model is visible to primary rays.

Referenced by G3D::VisibleEntity::setVisible(), and G3D::VisibleEntity::visible().

◆ s_particleBuffer

ParticleBuffer G3D::ParticleSystem::s_particleBuffer
staticprotected

Particle data across all ParticleSystem instances.

canMove = true, written every frame.

[ Block1: (particle system 1) (space for PS1 to grow) | Block2: (PS2) (PS2 reserve space) | .... ]

◆ s_preferLowResolutionTransparency

bool G3D::ParticleSystem::s_preferLowResolutionTransparency
staticprotected

Used to set the preferLowResolutionTransparency hint on the surfaces created from every particle system.

Referenced by preferLowResolutionTransparency(), and setPreferLowResolutionTransparency().

◆ s_sortArray

Array<SortProxy> G3D::ParticleSystem::s_sortArray
staticprotected

Used when sorting values to compute s_particleBuffer.indexStream for sorted transparency.


documentation generated on Wed Nov 24 2021 08:01:58 using doxygen 1.8.15