![]() |
VR-Forces Developer's Guide
|
This class simulates and renders a lightning area. The area will randomly create lightning within a specified bounds. A generic mesh is used by a shader to draw lightning bolts. An intensity value can be set to increase or decrease the visibility of the effect.

Classes | |
| struct | DrawData |
| struct | LightningBolt |
| struct | LightningFinger |
| struct | MeshGroup |
| struct | SortDistanceComparator |
| struct | SortJobData |
Public Member Functions | |
| virtual | ~DtWeatherLightning () |
| DtWeatherLightning ()=delete | |
| DtWeatherLightning (const DtWeatherLightning &other)=delete | |
| DtWeatherLightning & | operator= (const DtWeatherLightning &other)=delete |
| virtual void | init () |
| virtual void | releaseGLObjects (osg::State *state) const |
| virtual void | simulationUpdate (float timeStep, double currentTime, DtJobSplitter *jobSplitter) |
| virtual bool | cullUpdate (const osg::Vec3d &camPos, const osg::Matrixd &viewMatrixI, const Frustum_64 &frustum, DtJobSplitter *jobSplitter) |
| virtual void | draw (DtWeatherLightning::DrawData &drawData) |
| virtual void | setBounds (const DtVector &bounds, float cornerRadius) |
| virtual void | setTransform (const osg::Vec3d &position, const osg::Matrixd &rotation) |
| virtual void | setIntensity (const float intensity) |
| virtual void | setBaseColor (const DtVector &color) |
| virtual void | runSort (const osg::Vec3 &localCamPos) |
| virtual void | setEnabled (bool enabled) |
| virtual bool | enabled () const |
| virtual bool | culled () const |
| virtual void | computeBounds (osg::Vec4 &bounds, osg::Vec3d &position, osg::Matrixd &rotation) const |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| virtual | ~DtVirtualBaseClass () |
Public Attributes | |
| friend | DtWeatherLightningCreator |
Protected Member Functions | |
| DtWeatherLightning (makVrv::DtDe &de) | |
| virtual void | initBoltMeshGroup (LightningBolt *bolt) |
| virtual void | createBolt (const osg::Vec3 &start, const osg::Vec3 &end) |
| virtual void | createFingerSegments (LightningBolt *bolt, LightningFinger *finger) |
| virtual bool | positionInBounds2D (const float x, const float y, const osg::Vec3 &bounds) |
| virtual float | computeRandomMinMax (float fMin, float fMax) |
| virtual void | computeSortDepth (const osg::Vec3 &reference) |
| void | fillMeshGroupFlashPoint (LightningBolt *bolt) |
| virtual void | fillMeshGroup (LightningBolt *bolt, LightningFinger *finger) |
| virtual bool | bindMeshGroupData (MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const |
| virtual bool | bindDynamicMeshGroupData (MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const |
| virtual bool | bindVaoToMeshGroup (GLuint vao, MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const |
| const osg::Vec3 | crossProduct (const osg::Vec3 &v0, const osg::Vec3 &v1) const |
Static Protected Member Functions | |
| static void | theSortJob (void *data) |
Protected Attributes | |
| DtDe & | myDe |
| bool | myEnabled |
| bool | myCulled |
| osg::Vec3d | myPosition |
| osg::Matrixd | myRotation |
| float | myBoundsX |
| float | myBoundsY |
| float | myBoundsZ |
| float | myBoundsCornerRadius |
| float | myBoltWidth |
| float | myIntensity |
| osg::Vec3 | myBaseColor |
| std::vector< LightningBolt * > | myMutableLightningBoltsPool |
| std::vector< LightningBolt * > | myMutableLightningBoltsActive |
| SortJobData | mySortJobData |
| DtJobSplitterJob | mySortJob |
| DtRandomNumberGenerator | myRandomNumberGen |
| unsigned int | myRandomSeed |
| float | myStrikeTimeMin |
| float | myStrikeTimeMax |
| float | myStrikeTimer |
| DtLight * | myLight |
Friends | |
| class | DtWeatherLightningFactory |
| struct | SortDistanceComparator |
|
virtual |
DTOR.
|
delete |
Default Constructor not implemented.
|
delete |
Copy Constructor not implemented - Copy not allowed.
|
protected |
CTOR.
|
delete |
Assignment Operator not implemented - Assignment not allowed.
|
virtual |
Called after creation to initialize effects.
|
virtual |
Release all gl objects used by items in this layer.
|
virtual |
Run a simulation update for lightning.
| timeStep | The time step to simulate. |
| currentTime | The current simulation time. |
| jobSplitter | A job splitter to add simulation jobs to. |
|
virtual |
Culls the area based on the current camera.
| cam | The current camera being drawn. |
| frustum | The frustum used for culling. |
| jobSplitter | A job splitter to add predraw jobs to. Returns true if visible. |
|
virtual |
Draw active lightning.
|
virtual |
Sets the bounds of the object.
| bounds | The (x,y,z) of the bounds. |
| cornerRadius | The radius at each corner of the bounds. |
|
virtual |
Sets the object transform.
| position | The transform position in world space. |
| orientation | The yaw orientation in degrees (0 = north). |
|
virtual |
Sets the intensity.
| intensity | The intensity (affects visibility). |
|
virtual |
Sets a base color for the lightning bolts.
| color | The rgb color values (0.0 - 1.0 scale). |
|
virtual |
Sorts particles for the current view. Fills indice buffer.
| localCamPos | The local camera position. |
|
virtual |
Enables or disables the lightning.
| enabled | Set to true to enable the lightning. |
|
virtual |
Returns the enabled state.
|
virtual |
Returns the culled state. This will indicate if the lightning was culled during the last scenegraph culling pass.
|
virtual |
Computes the bounds of the area.
| bounds | The output (width, length, height, corner radius). |
| position | The output world postition. |
| rotation | The output world rotation. |
|
protectedvirtual |
Initializes a mesh group for the given lightning bolt.
| bolt | The lightning bolt object to initialize the mesh group for. |
|
protectedvirtual |
Creates a lightning bolt between the given start and end points.
| start | The local starting position. |
| end | The local ending position. |
|
protectedvirtual |
Creates a lightning bolt finger segments between the given start and end points.
bolt The lightning bolt that the finger belongs to. finger The lightning bolt finger to process.
|
protectedvirtual |
Checks to see if the local 2D position is within the bounds. Uses the current bound corner radius.
| x | The local x position |
| y | The local y position. |
| bounds | The (x, y, corner radius) bounds. |
|
protectedvirtual |
Computes a random floating point value in the min max range.
| min | The minimum value. |
| max | The maximum value. |
|
protectedvirtual |
Computes the sort depth for all cells.
| reference | The reference position to compute sort depth from. |
|
protected |
Fills the gpu buffer with 4 vertices for the flash point. The flash point is the lightning point of origin.
| bolt | The lightning bolt data to use. |
|
protectedvirtual |
Fills the gpu buffer with sorted lightning bolt data. Recursively calls for child bolt fingers.
| bolt | The lightning bolt data to use. |
| finger | The lightning finger data to use. |
|
protectedvirtual |
Binds the mesh group data to the vbo's.
| meshGroup | The mesh group object to bind. |
| renderInfo | The current rendering info. |
|
protectedvirtual |
Binds the dynamic mesh group data to the vbo's.
| meshGroup | The mesh group object to bind. |
| renderInfo | The current rendering info. |
|
protectedvirtual |
Binds the given voa to vbo's for a mesh group.
| vao | The GL VAO handle. |
| meshGroup | The mesh group to bind. |
| renderInfo | The current rendering info. |
|
protected |
Returns the cross product of the given 2 vectors.
| v0 | The first vector. |
| v1 | The second vector. |
|
staticprotected |
sort job function used as a callback for job splitting
|
friend |
|
friend |
| friend makVrv::DtWeatherLightning::DtWeatherLightningCreator |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |