Rasterfarm-SDK
Loading...
Searching...
No Matches
Physical Class Reference

#include <physical.h>

Inheritance diagram for Physical:
Display Scene DynamicType

Classes

class  Attribute
 
class  Boundary
 
class  BoundaryPrimitive
 
class  GeometricAttribute
 
class  IntersectionData
 
class  SurfaceAttributes
 
struct  Velocity
 

Public Types

typedef Function< void(Node *pContext, GeometricBase *pObject, IntersectionData &data) > IntersectionFunction
 
typedef UnorderedMap< Node *, IntersectionFunctionObjectCallbackMap
 
typedef UnorderedMap< Handle, IntersectionFunctionPlaneCallbackMap
 
using BoundaryPlane = BoundaryPrimitive< Vector4f >
 
using BoundaryPolygon = BoundaryPrimitive< Primitive3D::Polygon >
 
typedef UnorderedMap< GeometricBase *, Primitive3D::CapsuleGeometricCapsuleMap
 
typedef UnorderedMap< GeometricBase *, Primitive3D::Segment > GeometricSegmentMap
 
typedef UnorderedMap< GeometricBase *, Primitive3D::SegmentArray > GeometricSegmentArrayMap
 
typedef UnorderedMap< GeometricBase *, Vector4fGeometricPlaneMap
 
typedef UnorderedMap< GeometricBase *, Primitive3D::Disk > GeometricDiskMap
 
typedef UnorderedMap< GeometricBase *, Primitive3D::Polygon > GeometricPolygonMap
 
typedef UnorderedMap< GeometricBase *, Vertex3fArrayGeometricContourMap
 
- Public Types inherited from Scene
typedef List< GeometricBase * > GeometricBaseList
 

Public Member Functions

 Physical (const Attribute &attribute, const Matrix4f &matrix, float nearZClip, float farZClip)
 
virtual ~Physical ()
 
virtual void createModel ()
 
virtual void renderMaterialLists ()
 
void evaluate ()
 
virtual void addGeometricObject (GeometricBase *pObject)
 
virtual void removeGeometricObject (GeometricBase *pObject)
 
void setAttribute (const Attribute &attribute)
 
const AttributegetAttribute ()
 
const VelocitygetVelocity (GeometricBase *pObject)
 
void setVelocity (GeometricBase *pObject, const Velocity &velocity)
 
GeometricAttributegetGeometricAttribute (GeometricBase *pObject)
 
void setGeometricAttributes (GeometricBase *pObject, const GeometricAttribute &attributes)
 
void applyTranslationalForce (GeometricBase *pObject, const Vector3f &force)
 
void applyRotationalForce (GeometricBase *pObject, const Vector3f &force)
 
bool boundingRadiusIntersect (GeometricBase *pObjectA, GeometricBase *pObjectB)
 
bool sphereObjectIntersect (const Primitive3D::Sphere &sphere, GeometricBase *pObjectB)
 
bool capsuleObjectIntersect (const Primitive3D::Capsule &capsule, GeometricBase *pObjectB)
 
IntersectionData getIntersection (GeometricBase *pObjectA, GeometricBase *pObjectB)
 
IntersectionData getIntersection (Primitive3D::Sphere sphere, GeometricBase *pObject)
 
IntersectionData getIntersection (Primitive3D::Capsule capsule, GeometricBase *pObject)
 
void setSegment (GeometricBase *pObject, const Primitive3D::Segment &segment)
 
void setSegmentArray (GeometricBase *pObject, const Primitive3D::SegmentArray &array)
 
void setContour (GeometricBase *pObject, const Vertex3fArray &contour)
 
void setCapsule (GeometricBase *pObject, const Primitive3D::Capsule &capsule)
 
void setPolygon (GeometricBase *pObject, const Primitive3D::Polygon &polygon)
 
void setPlane (GeometricBase *pObject, const Vector4f &plane)
 
void setDisk (GeometricBase *pObject, const Primitive3D::Disk &disk)
 
void addCollisionCallback (Node *pContext, IntersectionFunction function)
 
void addBoundary (Boundary *pBoundary)
 
Vertex3f boundPosition (GeometricBase *pObject, Vertex3f newPosition)
 
- Public Member Functions inherited from Display
 Display (const Matrix4f &projectionMatrix, float nearZClip, float farZClip)
 
virtual void addMaterialList (const Surface::MaterialList &pMaterial)
 
virtual void clearMaterialLists ()
 
void addPreprocessor (Scene *pScene)
 
void removePreprocessor (Scene *pScene)
 
- Public Member Functions inherited from Scene
 Scene (const Matrix4f &projectionMatrix, float nearZClip, float farZClip)
 
virtual ~Scene ()
 
virtual void removeGeometricObject (Node *pObject)
 
virtual void addMaterials ()
 
void queueGeometricObject (GeometricBase *pObject)
 
void queueGeometricObject (Node *pObject)
 
bool hasFrameBuffer (FrameBuffer *pFrameBuffer)
 
void addFrameBuffer (FrameBuffer *pFrameBuffer)
 
void removeFrameBuffer (FrameBuffer *pFrameBuffer)
 
bool inDisplayArea (GeometricBase *pObject)
 
bool inDisplayArea ()
 
const Matrix4fgetModel (GeometricBase *pObject)
 
const UnorderedMap< Node *, Matrix4f > & getNodeModel () const
 
Primitive3D::AABoundingBox getAABoundingBox ()
 
Primitive3D::AABoundingBox getAABoundingBox (GeometricBase *pObject)
 
Primitive3D::AABoundingBox getNDCAABoundingBox ()
 
Primitive3D::AABoundingBox getNDCAABoundingBox (GeometricBase *pObject)
 
uint getGeometricObjectSize ()
 
const GeometricBaseListgetGeometricObject ()
 
void updateCamera ()
 
void renderMaterialList (Surface::MaterialList &pList, Surface::MaterialSortFunction sortFunction, float clipFactor=1.0f)
 
void renderMaterial (Surface::Material *pMaterial)
 
void setCamera (Camera *pCamera)
 
Camera * getCamera ()
 
const Matrix4fgetProjectionMatrix ()
 
const Matrix4fgetViewMatrix ()
 
float getNearZClip ()
 
float getFarZClip ()
 
bool hasGeometricObject (GeometricBase *pObject)
 
Vertex4f project (const Vertex3f &vertex)
 
Vertex3f unProject (const Vertex4f &vertex)
 
Vertex3f localToNdc (Vertex3f point)
 
Vertex3f ndcToLocal (Vertex3f point, float w)
 
- Public Member Functions inherited from DynamicType
 DynamicType ()
 
template<class C >
void addType ()
 
TypeID getDerivedTypeId () const
 
template<class C >
const bool isType () const
 
template<class C >
const C * cast () const
 
template<class C >
C * cast ()
 
template<class FROM , class TO >
TO * cast ()
 
template<class FROM , class TO >
const TO * cast () const
 

Public Attributes

UnorderedMap< GeometricBase *, GeometricAttributegeometricAttribute
 
- Public Attributes inherited from Display
Surface::MaterialList pOpaqueMaterialList
 
Surface::MaterialList pTransparentMaterialList
 
Application::SceneList pPreprocessor
 

Protected Types

typedef UnorderedMap< GeometricBase *, VelocityGeometricVelocityMap
 

Protected Attributes

Attribute attribute
 
ObjectCallbackMap callbackObject
 
GeometricCapsuleMap capsule
 
GeometricSegmentMap segment
 
GeometricSegmentArrayMap segmentArray
 
GeometricContourMap contour
 
GeometricPlaneMap plane
 
GeometricDiskMap disk
 
GeometricPolygonMap polygon
 
HeapArray< Boundary * > pBoundary
 
Mutex evaluateMutex
 
GeometricVelocityMap velocity
 
- Protected Attributes inherited from Scene
float nearZClip
 
float farZClip
 
Matrix4f view
 
Matrix4f projectionMatrix
 
Camera * pCamera
 
GeometricBaseList pGeometricObject
 
UnorderedMap< Node *, Matrix4fnodeModel
 
List< FrameBuffer * > pFrameBuffer
 

Additional Inherited Members

Detailed Description

A Scene that applies laws of newtonian/classical physics to objects.

Member Typedef Documentation

◆ BoundaryPlane

◆ BoundaryPolygon

using Physical::BoundaryPolygon = BoundaryPrimitive< Primitive3D::Polygon >

◆ GeometricCapsuleMap

◆ GeometricContourMap

◆ GeometricDiskMap

typedef UnorderedMap< GeometricBase *, Primitive3D::Disk > Physical::GeometricDiskMap

◆ GeometricPlaneMap

◆ GeometricPolygonMap

typedef UnorderedMap< GeometricBase *, Primitive3D::Polygon > Physical::GeometricPolygonMap

◆ GeometricSegmentArrayMap

typedef UnorderedMap< GeometricBase *, Primitive3D::SegmentArray > Physical::GeometricSegmentArrayMap

◆ GeometricSegmentMap

typedef UnorderedMap< GeometricBase *, Primitive3D::Segment > Physical::GeometricSegmentMap

◆ GeometricVelocityMap

typedef UnorderedMap< GeometricBase *, Velocity > Physical::GeometricVelocityMap
protected

◆ IntersectionFunction

typedef Function< void( Node *pContext, GeometricBase *pObject, IntersectionData &data ) > Physical::IntersectionFunction

◆ ObjectCallbackMap

◆ PlaneCallbackMap

typedef UnorderedMap< Handle, IntersectionFunction > Physical::PlaneCallbackMap

Constructor & Destructor Documentation

◆ Physical()

Physical::Physical ( const Attribute & attribute,
const Matrix4f & matrix,
float nearZClip,
float farZClip )
Parameters
Theprojection matrix for the display.
Thepositional z-value to clip objects closest to the viewer. For a Perpsective matrix, this would most-likely be the same as used to create the matrix and > 0.0. For an Orthographic matrix, any value < 0.0.
Thepositional z-value to clip objects furthest from the viewer. For a Perpsective matrix, this would most-likely be the same as used to create the matrix and > nearZClip. For an Orthographic matrix, any value >= 0.0.

◆ ~Physical()

virtual Physical::~Physical ( )
virtual

Member Function Documentation

◆ addBoundary()

void Physical::addBoundary ( Boundary * pBoundary)

Add the bounding plane for this Scene.

◆ addCollisionCallback()

void Physical::addCollisionCallback ( Node * pContext,
IntersectionFunction function )

Get a callback if the object collides with another.

◆ addGeometricObject()

virtual void Physical::addGeometricObject ( GeometricBase * pObject)
virtual

Raster & Render the GeometricObject in this Scene.

Parameters
TheGeometricBase object containing at least 1 Material.

Reimplemented from Scene.

◆ applyRotationalForce()

void Physical::applyRotationalForce ( GeometricBase * pObject,
const Vector3f & force )
Parameters
Testto determine if a pair of object's GeometricAttributes intersect.

◆ applyTranslationalForce()

void Physical::applyTranslationalForce ( GeometricBase * pObject,
const Vector3f & force )

For a given GeometricObject, apply a translational-contact force for a single moment in time. Note that this Scene does not create animations. And if an Animation is created for this object outside the context of this Scene, unexpected results will occur. In general callbacks generated by this Scene would be used for that purpose (eg. explosions, special-effects..).

An example usage of this method would be a user-driven event such as move in a direction, turns, and jumps. In the case of a jump, the vector would have a non-zero y-component to the force.

Parameters
Pointerto the object within Physical::Node family.
Thevector representation of force to be applied to the object.

◆ boundingRadiusIntersect()

bool Physical::boundingRadiusIntersect ( GeometricBase * pObjectA,
GeometricBase * pObjectB )

◆ boundPosition()

Vertex3f Physical::boundPosition ( GeometricBase * pObject,
Vertex3f newPosition )

◆ capsuleObjectIntersect()

bool Physical::capsuleObjectIntersect ( const Primitive3D::Capsule & capsule,
GeometricBase * pObjectB )

◆ createModel()

virtual void Physical::createModel ( )
virtual

The model can only be created once physical evaluation is complete. Physical evaluation will commence once the model is rendered.

Reimplemented from Scene.

◆ evaluate()

void Physical::evaluate ( )

For each frame collisions and resulting forces will be evaluated.

◆ getAttribute()

const Attribute & Physical::getAttribute ( )
inline

◆ getGeometricAttribute()

GeometricAttribute & Physical::getGeometricAttribute ( GeometricBase * pObject)

◆ getIntersection() [1/3]

IntersectionData Physical::getIntersection ( GeometricBase * pObjectA,
GeometricBase * pObjectB )

◆ getIntersection() [2/3]

IntersectionData Physical::getIntersection ( Primitive3D::Capsule capsule,
GeometricBase * pObject )

◆ getIntersection() [3/3]

IntersectionData Physical::getIntersection ( Primitive3D::Sphere sphere,
GeometricBase * pObject )

◆ getVelocity()

const Velocity & Physical::getVelocity ( GeometricBase * pObject)

◆ removeGeometricObject()

virtual void Physical::removeGeometricObject ( GeometricBase * pObject)
virtual
Parameters
TheGeometricBase object containing at least 1 Material.

Reimplemented from Scene.

◆ renderMaterialLists()

virtual void Physical::renderMaterialLists ( )
virtual

The model can only be rendered once physical evaluation is complete. Physical evaluation will commence once the model is rendered.

Reimplemented from Display.

◆ setAttribute()

void Physical::setAttribute ( const Attribute & attribute)

◆ setCapsule()

void Physical::setCapsule ( GeometricBase * pObject,
const Primitive3D::Capsule & capsule )

Set the Capsule for this object.

◆ setContour()

void Physical::setContour ( GeometricBase * pObject,
const Vertex3fArray & contour )

Set the segments forming a contour for this object.

◆ setDisk()

void Physical::setDisk ( GeometricBase * pObject,
const Primitive3D::Disk & disk )

Set the Disk for this object.

◆ setGeometricAttributes()

void Physical::setGeometricAttributes ( GeometricBase * pObject,
const GeometricAttribute & attributes )
Parameters
Pointerto the object within Physical::Node family.
Thegiven object's physical attributes.

◆ setPlane()

void Physical::setPlane ( GeometricBase * pObject,
const Vector4f & plane )

Set the Disk for this object.

◆ setPolygon()

void Physical::setPolygon ( GeometricBase * pObject,
const Primitive3D::Polygon & polygon )

Set the Polygon for this object.

◆ setSegment()

void Physical::setSegment ( GeometricBase * pObject,
const Primitive3D::Segment & segment )

Set the segment-array for this object.

◆ setSegmentArray()

void Physical::setSegmentArray ( GeometricBase * pObject,
const Primitive3D::SegmentArray & array )

Set the Segment array for this object.

◆ setVelocity()

void Physical::setVelocity ( GeometricBase * pObject,
const Velocity & velocity )

◆ sphereObjectIntersect()

bool Physical::sphereObjectIntersect ( const Primitive3D::Sphere & sphere,
GeometricBase * pObjectB )

Member Data Documentation

◆ attribute

Attribute Physical::attribute
protected

◆ callbackObject

ObjectCallbackMap Physical::callbackObject
protected

User-defined callbacks that map-to geometric-objects within this scene.

◆ capsule

GeometricCapsuleMap Physical::capsule
protected

Geometries that map-to geometric-primitives for fast collision-detection. These are 'barriers' in that any intersection is a collision.

◆ contour

GeometricContourMap Physical::contour
protected

◆ disk

GeometricDiskMap Physical::disk
protected

◆ evaluateMutex

Mutex Physical::evaluateMutex
protected

◆ geometricAttribute

UnorderedMap< GeometricBase *, GeometricAttribute > Physical::geometricAttribute

Provides for fast runtime access.

◆ pBoundary

HeapArray< Boundary * > Physical::pBoundary
protected

Boundaries mapped-to this Scene for fast collision-detection

◆ plane

GeometricPlaneMap Physical::plane
protected

◆ polygon

GeometricPolygonMap Physical::polygon
protected

◆ segment

GeometricSegmentMap Physical::segment
protected

◆ segmentArray

GeometricSegmentArrayMap Physical::segmentArray
protected

◆ velocity

GeometricVelocityMap Physical::velocity
protected

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