10 #ifndef SLParticleSystem_H
11 #define SLParticleSystem_H
48 const SLVec3f& velocityRandomStart,
49 const SLVec3f& velocityRandomEnd,
SLShapeType
Particle system shape type.
SLBillboardType
Billboard type for its orientation used in SLParticleSystem.
Declares a color look up table functionality.
SLVec2< SLfloat > SLVec2f
SLVec3< SLfloat > SLVec3f
SLVec4< SLfloat > SLVec4f
SLVec4< SLfloat > SLCol4f
Defines an axis aligned bounding box.
Toplevel holder of the assets meshes, materials, textures and shaders.
Texture object for OpenGL texturing.
SLGLVertexArray encapsulates the core OpenGL drawing.
An SLMesh object is a triangulated mesh, drawn with one draw call.
SLVVec3f N
Vector for vertex normals (opt.) layout (location = 1)
SLNode represents a node in a hierarchical scene graph.
const SLstring & name() const
SLParticleSystem creates a particle meshes from a point primitive buffer.
void doAlphaOverLTCurve(SLbool b)
void generateBernsteinPSize()
void bezierControlPointSize(float arrayPoint[4])
SLbool doShapeSpawnBase()
SLbool _isPaused
Boolean to stop updating.
void bezierStartEndPointAlpha(float arrayPoint[4])
SLfloat _shapeAngle
Angle of cone and pyramid shapes.
SLbool _doWorldSpace
Boolean for world space position.
void speedRange(SLfloat vX, SLfloat vY)
SLint _velocityType
Velocity type.
SLbool _doAcceleration
Boolean for acceleration.
SLVec2f _speedRange
Speed random between two value.
void generate()
Function which will generate the particles and attributes them to the VAO.
void emitterPos(SLVec3f p)
void calcNormals()
SLMesh::calcNormals recalculates vertex normals for triangle meshes.
SLVec3f getDirectionCone(SLVec3f position)
Function which return a direction following the cone shape.
void buildAABB(SLAABBox &aabb, const SLMat4f &wmNode)
SLVec3f _emitterPos
Position of the particle emitter.
SLGLTexture * _texFlipbook
Flipbook texture with e.g. multiple flames at subsequent frames.
int _flipbookFPS
Number of update of flipbook by second.
SLbool _isGenerated
Boolean to generate particle system and load it on the GPU.
void timeToLive(SLfloat f)
void acceleration(SLfloat vX, SLfloat vY, SLfloat vZ)
AvgFloat _drawTime
Averaged time for drawing in MS.
SLfloat _lastTimeBeforePauseS
Time since the particle system is paused.
SLGLTexture * texFlipbook()
float * bezierControlPointSize()
SLfloat _notVisibleTimeS
Time since start when node not visible in S.
SLbool _doShapeSurface
Boolean for shape surface (particle will be spawned on surface)
void shapeScale(SLVec3f v)
SLVec2f _angularVelocityRange
Rotation rate range (change in angular rotation divide by change in time)
SLfloat _timeToLive
Time to live of a particle.
SLbool _doSpeedRange
Boolean for speed range.
SLbool _doInstancedDrawing
Boolean for instanced rendering.
void doAccDiffDir(SLbool b)
SLVec3f getDirectionBox(SLVec3f position)
Function which return the direction towards the exterior of a box.
void doRotation(SLbool b)
void doSpeedRange(SLbool b)
void doSizeOverLTCurve(SLbool b)
SLbool _doGravity
Boolean for gravity.
SLfloat _scale
Scale of a particle (Scale the radius)
SLVec3f getPointInSphere(float radius, SLVec3f randomX)
Function which return a position in a sphere.
void velocityRndMax(SLfloat vX, SLfloat vY, SLfloat vZ)
SLint _amount
Amount of a particle.
SLGLVertexArray _instanceVao2
void direction(SLVec3f v)
float _bezierStartEndPointSize[4]
Floats for bezier curve end start points (Start: 01 ; End: 23)
void doRotRange(SLbool b)
SLfloat _deltaTimeUpdateS
Delta time in between two frames S.
void doShapeSpawnBase(SLbool b)
void doSizeOverLT(SLbool b)
float * bezierControlPointAlpha()
SLVec3f getPointOnCone()
Function which return a position on the cone define in the particle system.
void doInstancedDrawing(bool instanced)
void isGenerated(SLbool b)
SLTexColorLUT * texGradient()
SLbool doFlipBookTexture()
SLbool doDirectionSpeed()
SLVec3f emitterPos() const
SLfloat _radiusW
width radius of a particle
SLVec4f _bernsteinPYAlpha
Vector for bezier curve (default linear function)
SLbool _doRotation
Boolean for rotation.
void bezierControlPointAlpha(float arrayPoint[4])
SLBillboardType _billboardType
Billboard type (BT_Camera, BT_Vertical, BT_Horizontal.
void billboardType(SLBillboardType bt)
SLfloat angularVelocityConst()
void doShapeSurface(SLbool b)
void shapeHeight(SLfloat f)
SLbool _doDirectionSpeed
Boolean for direction and speed (override velocity)
SLbool _doSizeOverLT
Boolean for size over life time.
SLfloat _angularVelocityConst
Rotation rate const (change in angular rotation divide by change in time)
void bezierStartEndPointSize(float arrayPoint[4])
void acceleration(SLVec3f v)
SLGLVertexArray _instanceVao1
void gravity(SLfloat vX, SLfloat vY, SLfloat vZ)
void shapeRadius(SLfloat r)
SLbool _doRotRange
Boolean for rotation range (random value between range)
SLbool _isVisibleInFrustum
Boolean to set time since node not visible.
SLfloat _shapeRadius
Radius of sphere and cone shape.
void texParticle(SLGLTexture *tp)
float * bezierStartEndPointSize()
int _drawBuf
Boolean to switch buffer.
SLfloat _accelerationConst
Acceleration constant (same direction as the velocity)
SLBillboardType billboardType()
void velocityRndMin(SLfloat vX, SLfloat vY, SLfloat vZ)
float _bezierStartEndPointAlpha[4]
Floats for bezier curve end start points (Start: 01 ; End: 23)
void doFlipBookTexture(SLbool b)
void doBlendBrightness(SLbool b)
void angularVelocityRange(SLVec2f v)
void doColorOverLT(SLbool b)
SLVec3f getDirectionSphere(SLVec3f position)
Function which return the direction towards the exterior of a sphere.
SLVec3f getPointOnSphere(float radius, SLVec3f randomX)
Function which return a position on a sphere.
SLbool _doColorOverLT
Boolean for color over life time.
SLfloat _shapeWidth
Width of pyramid shape.
void doShapeOverride(SLbool b)
void setNotVisibleInFrustum()
SLVec3f getPointInCone()
Function which return a position in the cone define in the particle system.
void velocityConst(SLfloat vX, SLfloat vY, SLfloat vZ)
float _bezierControlPointSize[4]
Floats for bezier curve control points (P1: 01 ; P2: 23)
float * bezierStartEndPointAlpha()
SLfloat _startUpdateTimeS
Time since start for updating in S.
SLbool doAlphaOverLTCurve()
void velocityType(SLint i)
void velocityRndMin(SLVec3f v)
SLbool _doAlphaOverLT
Boolean for alpha over life time.
SLfloat _startUpdateTimeMS
Time since start for updating in MS.
SLbool _doFlipBookTexture
Boolean for flipbook texture.
void doWorldSpace(SLbool b)
SLVec4f _bernsteinPYSize
Vector for bezier curve (default linear function)
void angularVelocityConst(SLfloat f)
void flipbookColumns(SLint i)
SLVec3f _direction
Direction of particle.
SLbool _doCounterGap
Boolean for counter lag/gap, can create flickering with few particle (explained in documentation) whe...
SLCol4f _color
Color for particle.
SLbool _doShapeOverride
Boolean for override direction for shape direction.
SLVec3f _velocityConst
Velocity constant (go in xyz direction)
SLGLTexture * texParticle()
AvgFloat _updateTime
Averaged time for updating in MS.
SLParticleSystem(SLAssetManager *assetMgr, const SLint amount, const SLVec3f &velocityRandomStart, const SLVec3f &velocityRandomEnd, const SLfloat &timeToLive, SLGLTexture *texC, const SLstring &name="Particle System", SLGLTexture *texFlipbook=nullptr, SLTexColorLUT *texGradient=nullptr, const bool doInstancedDrawing=false)
SLParticleSystem ctor with some initial values. The number of particles.
SLGLTexture * _texParticle
Main texture of PS (non flipbook)
SLbool _doAccDiffDir
Boolean for acceleration (different direction)
void shapeScale(SLfloat vX, SLfloat vY, SLfloat vZ)
SLVec3f getPointInPyramid()
Function which returns a position in the pyramid that define the PS.
SLint _flipbookColumns
Number of flipbook sub-textures by column.
SLbool _doAlphaOverLTCurve
Boolean for alpha over life time curve.
SLfloat _startDrawTimeMS
Time since start of draw in MS.
void texGradient(SLTexColorLUT *tg)
void direction(SLfloat vX, SLfloat vY, SLfloat vZ)
float _flipboookLastUpdate
Last time flipbook was updated.
void doDirectionSpeed(SLbool b)
SLbool doBlendBrightness()
void doCounterGap(SLbool b)
SLint _flipbookRows
Number of flipbook sub-textures by row.
SLbool _doShape
Boolean for shape feature.
void doAcceleration(SLbool b)
SLbool doSizeOverLTCurve()
SLbool _doBlendBrightness
Boolean for glow/brightness on pixel with many particle.
float _bezierControlPointAlpha[4]
Floats for bezier curve control points (P1: 01 ; P2: 23)
SLfloat _shapeHeight
Height of cone and pyramid shapes.
SLVec3f _gravity
Vector for gravity (2nd. acceleration vector)
SLfloat _radiusH
height radius of a particle
SLbool _doShapeSpawnBase
Boolean for spawn at base of shape (for cone and pyramid)
SLVec2f angularVelocityRange()
SLVec3f _shapeScale
Scale of box shape.
SLfloat accelerationConst()
SLVec3f getDirectionPyramid(SLVec3f position)
Function which return a direction following the pyramid shape.
void angularVelocityRange(SLfloat vX, SLfloat vY)
void velocityConst(SLVec3f v)
void flipbookRows(SLint i)
SLVec3f getPointOnBox(SLVec3f boxScale)
Function which return a position on a box.
SLVec3f _velocityRndMax
Max. random velocity.
void shapeType(SLShapeType st)
SLTexColorLUT * _texGradient
Color gradient texture.
void draw(SLSceneView *sv, SLNode *node, SLuint instances=1)
SLbool _doSizeOverLTCurve
Boolean for size over life time curve.
void velocityRndMax(SLVec3f v)
void speedRange(SLVec2f v)
void generateBernsteinPAlpha()
SLVec3f _acceleration
Vector for acceleration (different direction as the velocity)
void shapeAngle(SLfloat f)
void shapeWidth(SLfloat f)
SLbool doInstancedDrawing()
SLVec3f getPointInBox(SLVec3f boxScale)
Function which return a position in a box.
void doAlphaOverLT(SLbool b)
void texFlipbook(SLGLTexture *tf)
SLShapeType _shapeType
Shape type (ST_)
SLAssetManager * _assetManager
pointer to the asset manager (the owner) if available
SLbool _doColor
Boolean for color.
SLVec3f getPointOnPyramid()
Function which return a position on the pyramid that defines the PS.
SLfloat _speed
Speed of particle.
SLVec3f _velocityRndMin
Min. random velocity.
SceneView class represents a dynamic real time 3D view onto the scene.
SLTexColorLUT defines a lookup table as an 1D texture of (256) RGBA values.