Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
OgreShaderParticleRenderer.cpp
Go to the documentation of this file.
3
4#include <OgreParticle.h>
5#include <OgreStringConverter.h>
6#include <OgreTagPoint.h>
7#include <OgreCamera.h>
8#include <OgreEntity.h>
9#include <OgreSceneNode.h>
10#include <OgreSceneManager.h>
11
12namespace Ogre {
14
15ShaderParticleRenderer::CmdVertexFormatColour ShaderParticleRenderer::msVertexFmtColour;
16ShaderParticleRenderer::CmdVertexFormatTexture ShaderParticleRenderer::msVertexFmtTexture;
17ShaderParticleRenderer::CmdVertexFormatSize ShaderParticleRenderer::msVertexFmtSize;
18ShaderParticleRenderer::CmdVertexFormatRotation ShaderParticleRenderer::msVertexFmtRotation;
19ShaderParticleRenderer::CmdVertexFormatRotationSpeed ShaderParticleRenderer::msVertexFmtRotationSpeed;
20ShaderParticleRenderer::CmdVertexFormatDirection ShaderParticleRenderer::msVertexFmtDirection;
21ShaderParticleRenderer::CmdVertexFormatTTL ShaderParticleRenderer::msVertexFmtTTL;
22ShaderParticleRenderer::CmdVertexFormatTotalTTL ShaderParticleRenderer::msVertexFmtTotalTTL;
23ShaderParticleRenderer::CmdVertexFormatTimeFrag ShaderParticleRenderer::msVertexFmtTimeFrag;
24ShaderParticleRenderer::CmdVertexFormatTimeFragInv ShaderParticleRenderer::msVertexFmtTimeFragInv;
25
28 : mDefaultParticleSize(1, 1)
29 , mKeepInLocalSpace(false)
30 , mParentNode(NULL)
31 , mParentIsTagPoint(false)
32 , mSortMode(SM_DISTANCE)
33 , mLightListUpdated(0)
34 , mRadius(0.0f)
35 , mRenderQueueID(RENDER_QUEUE_MAIN)
36 , mVertexFormatTexture(false)
37 , mVertexFormatSize(false)
38 , mVertexFormatRotation(false)
39 , mVertexFormatRotationSpeed(false)
40 , mVertexFormatDirection(false)
41 , mVertexFormatColour(false )
42 , mVertexFormatTTL(false)
43 , mVertexFormatTotalTTL(false)
44 , mVertexFormatTimeFragment(false)
45 , mVertexFormatTimeFragmentInv(false)
46 , mVertexSize(0)
47{
48 if (createParamDictionary("ShaderParticleRenderer"))
49 {
50 ParamDictionary* dict = getParamDictionary();
51 dict->addParameter(ParameterDef("diffuse_colour",
52 "Adds diffuse colour to vertex format (type = float4)",
53 PT_BOOL),
55
56 dict->addParameter(ParameterDef("texture_coord",
57 "Adds general texture coordinate to vertex format (type = float2)",
58 PT_BOOL),
60
61 dict->addParameter(ParameterDef("particle_size",
62 "Adds particle size to vertex format (type = float2)",
63 PT_BOOL),
65
66 dict->addParameter(ParameterDef("particle_rotation",
67 "Adds particle rotation (in radians) to vertex format (type = float1)"
68 "note: if particle_rotation_speed present in script, they are packed together as float2",
69 PT_BOOL),
71
72 dict->addParameter(ParameterDef("particle_rotation_speed",
73 "Adds particle rotation speed (in radians/s) to vertex format (type = float1)"
74 "note: if particle_rotation present in script, they are packed together as float2",
75 PT_BOOL),
77
78 dict->addParameter(ParameterDef("particle_direction",
79 "Adds particle direction to vertex format (type = float3)"
80 "note: it represent particle speed",
81 PT_BOOL),
83
84 dict->addParameter(ParameterDef("time_to_live",
85 "Adds particle current time to live to vertex format (type = float1)"
86 "note: this parameter can be packed with total_time_to_live, time_frag and time_frag_inv",
87 PT_BOOL),
89
90 dict->addParameter(ParameterDef("total_time_to_live",
91 "Adds particle total time to live to vertex format (type = float1)"
92 "note: this parameter can be packed with time_to_live, time_frag and time_frag_inv",
93 PT_BOOL),
95
96 dict->addParameter(ParameterDef("time_frag",
97 "Adds particle time fragment to vertex format (type = float1), which is ratio between ttl and total ttl"
98 "note: this parameter can be packed with time_to_live, total_time_to_live and time_frag_inv",
99 PT_BOOL),
101
102 dict->addParameter(ParameterDef("time_frag_inv",
103 "Adds particle inverse time fragment to vertex format (type = float1), which is 1.0f - time_frag"
104 "note: this parameter can be packed with time_to_live, total_time_to_live and time_frag",
105 PT_BOOL),
107 }
108
109 mVertexData = OGRE_NEW VertexData;
110 mIndexData = OGRE_NEW IndexData;
111
112 mTexCoordTable[0] = Vector2(0, 0);
113 mTexCoordTable[1] = Vector2(1, 0);
114 mTexCoordTable[2] = Vector2(1, 1);
115 mTexCoordTable[3] = Vector2(0, 1);
116}
117
120{
121 OGRE_DELETE mVertexData;
122 OGRE_DELETE mIndexData;
123}
124
126const String& ShaderParticleRenderer::getType(void) const
127{
128 return rendererTypeName;
129}
130
132void ShaderParticleRenderer::_updateRenderQueue(RenderQueue* queue, Ogre::list<Particle*>::type& currentParticles, bool cullIndividually)
133{
134 // be sure that we have enough space in buffers
135 if (!allocateBuffers(currentParticles.size())) {
136 assert(0 && "Cannot allocate buffers");
137 return;
138 }
139
140 // update vertex data
141 mRadius = 0.0f;
142 if (!currentParticles.empty()) {
143 HardwareVertexBufferSharedPtr pVB = mVertexData->vertexBufferBinding->getBuffer(0);
144 uchar* pDataVB = reinterpret_cast<uchar*>(pVB->lock(HardwareBuffer::HBL_DISCARD));
145 for (Ogre::list<Particle*>::type::iterator it=currentParticles.begin(); it!=currentParticles.end(); ++it) {
146 Particle* pParticle = *it;
147 addParticle(pDataVB, *pParticle);
148 pDataVB += 4 * mVertexSize;
149
150 float fDist = (mParentNode != NULL) ? mParentNode->getPosition().distance(pParticle->mPosition) : pParticle->mPosition.length();
151 if (fDist > mRadius)
152 mRadius = fDist;
153 }
154 pVB->unlock();
155 }
156
157 // setup counts
158 mVertexData->vertexCount = currentParticles.size() * 4;
159 mIndexData->indexCount = currentParticles.size() * 6;
160
161 // update render queue
162 queue->addRenderable(this, mRenderQueueID);
163}
164
166void ShaderParticleRenderer::visitRenderables(Renderable::Visitor* visitor, bool debugRenderables)
167{
168 visitor->visit(this, 0, debugRenderables);
169}
170
173{
174 mMaterial = mat;
175}
176
181
184{
185 // nothing to do
186}
187
190{
191 // nothing to do
192}
193
196{
197 // nothing to do - hardware buffers will be altered run-time
198}
199
201void ShaderParticleRenderer::_notifyAttached(Node* parent, bool isTagPoint)
202{
203 mParentNode = parent;
204 mParentIsTagPoint = isTagPoint;
205}
206
209{
210 mDefaultParticleSize.x = width;
211 mDefaultParticleSize.y = height;
212}
213
216{
217 return OGRE_NEW ParticleCustomParam();
218}
219
222{
223 OGRE_DELETE vis;
224}
225
228{
229 mRenderQueueID = queueID;
230}
231
234{
235 mKeepInLocalSpace = keepLocal;
236}
237
240{
241 return mSortMode;
242}
243
245const MaterialPtr& ShaderParticleRenderer::getMaterial(void) const
246{
247 return mMaterial;
248}
249
252{
253 assert(mVertexData != NULL);
254 assert(mIndexData != NULL);
255 op.vertexData = mVertexData;
256 op.indexData = mIndexData;
257 op.operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST;
258 op.useIndexes = true;
259 op.srcRenderable = this;
260}
261
263//unsigned short ShaderParticleRenderer::getNumWorldTransforms(void) const
264//{
265// if (mKeepInLocalSpace && mParentNode != NULL)
266// {
267// return mParentNode->getNumWorldTransforms();
268// } else
269// {
270// return 1;
271// }
272//}
273
276{
277 if (mKeepInLocalSpace && mParentNode != NULL)
278 {
279 *xform = mParentNode->_getFullTransform();
280 //mParentNode->getWorldTransforms(xform);
281 } else
282 {
283 *xform = Matrix4::IDENTITY;
284 }
285}
286
289{
290 if (mParentNode != NULL) {
291 return cam->getRealPosition().squaredDistance(mParentNode->getPosition());
292 } else {
293 return 0.0f;
294 }
295}
296
298const LightList& ShaderParticleRenderer::getLights(void) const
299{
300 if (mParentNode != NULL) {
301 // Query from parent entity if exists
303 {
304 TagPoint* tp = static_cast<TagPoint*>(mParentNode);
305 return tp->getParentEntity()->queryLights();
306 }
307
308 if (mParentNode)
309 {
310 SceneNode* sn = static_cast<SceneNode*>(mParentNode);
311
312 // Make sure we only update this only if need.
313 ulong frame = sn->getCreator()->_getLightsDirtyCounter();
314 if (mLightListUpdated != frame)
315 {
316 mLightListUpdated = frame;
317 sn->findLights(mLightList, mRadius);
318 }
319 }
320 else
321 {
322 mLightList.clear();
323 }
324 }
325 else
326 {
327 mLightList.clear();
328 }
329
330 return mLightList;
331}
332
335{
336 // prepare vertex declaration
337 if (mVertexData->vertexDeclaration->getElementCount() == 0) {
338 VertexDeclaration* pDecl = mVertexData->vertexDeclaration;
339 size_t ofs = 0;
340 ofs += pDecl->addElement(0, ofs, VET_FLOAT4, VES_POSITION).getSize(); // position
342 ofs += pDecl->addElement(0, ofs, VET_FLOAT4, VES_DIFFUSE).getSize(); // diffuse colour
343
344 // other data are stored in vertex as texture coordinates
345 ushort ix = 0;
347 ofs += pDecl->addElement(0, ofs, VET_FLOAT2, VES_TEXTURE_COORDINATES, ix++).getSize(); // general texture coord
348
350 ofs += pDecl->addElement(0, ofs, VET_FLOAT2, VES_TEXTURE_COORDINATES, ix++).getSize(); // particle size
351
354 ofs += pDecl->addElement(0, ofs, VET_FLOAT2, VES_TEXTURE_COORDINATES, ix++).getSize(); // current rotation and rotation speed
355 else
356 ofs += pDecl->addElement(0, ofs, VET_FLOAT1, VES_TEXTURE_COORDINATES, ix++).getSize(); // current rotation or rotation speed
357 }
358
360 ofs += pDecl->addElement(0, ofs, VET_FLOAT3, VES_TEXTURE_COORDINATES, ix++).getSize(); // particle direction (as speed)
361
362 // add packed times
363 size_t iNumTimes = 0;
364 if (mVertexFormatTTL) iNumTimes++;
365 if (mVertexFormatTotalTTL) iNumTimes++;
366 if (mVertexFormatTimeFragment) iNumTimes++;
367 if (mVertexFormatTimeFragmentInv) iNumTimes++;
368 switch(iNumTimes) {
369 case 1:
370 ofs += pDecl->addElement(0, ofs, VET_FLOAT1, VES_TEXTURE_COORDINATES, ix++).getSize();
371 break;
372 case 2:
373 ofs += pDecl->addElement(0, ofs, VET_FLOAT2, VES_TEXTURE_COORDINATES, ix++).getSize();
374 break;
375 case 3:
376 ofs += pDecl->addElement(0, ofs, VET_FLOAT3, VES_TEXTURE_COORDINATES, ix++).getSize();
377 break;
378 case 4:
379 ofs += pDecl->addElement(0, ofs, VET_FLOAT4, VES_TEXTURE_COORDINATES, ix++).getSize();
380 break;
381 }
382
383 // add custom parameters
384 ofs += pDecl->addElement(0, ofs, VET_FLOAT4, VES_TEXTURE_COORDINATES, ix++).getSize();
385 assert(ix <= 8);
386
387 // cache vertex size
388 mVertexSize = pDecl->getVertexSize(0);
389 }
390
391 Ogre::HardwareVertexBufferSharedPtr pVB;
392 if (mVertexData->vertexBufferBinding->isBufferBound(0))
393 pVB = mVertexData->vertexBufferBinding->getBuffer(0);
394
395 // prepare vertex buffer
396 if (!pVB || pVB->getNumVertices() < iNumParticles * 4) {
397 assert(iNumParticles * 4 < 65536); // we are using 16bit index buffer
398 pVB = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(mVertexSize, 4 * iNumParticles, Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
399 if (!pVB)
400 return false;
401
402 mVertexData->vertexBufferBinding->setBinding(0, pVB);
403 }
404
405 // prepare index buffer
406 Ogre::HardwareIndexBufferSharedPtr pIB = mIndexData->indexBuffer;
407 if (!pIB || pIB->getNumIndexes() < iNumParticles * 6) {
408 pIB = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(Ogre::HardwareIndexBuffer::IT_16BIT, iNumParticles * 6, Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY);
409 if (!pIB)
410 return false;
411
412 mIndexData->indexBuffer = pIB;
413
414 // fill
415 Ogre::uint16* pDataIB = reinterpret_cast<Ogre::uint16*>(pIB->lock(Ogre::HardwareBuffer::HBL_NORMAL));
416 for (Ogre::uint16 k=0; k<static_cast<Ogre::uint16>(iNumParticles); ++k) {
417 pDataIB[0] = k*4 + 0;
418 pDataIB[1] = k*4 + 1;
419 pDataIB[2] = k*4 + 2;
420
421 pDataIB[3] = k*4 + 0;
422 pDataIB[4] = k*4 + 2;
423 pDataIB[5] = k*4 + 3;
424 pDataIB += 6;
425 }
426 pIB->unlock();
427 }
428
429 return true;
430}
431
433void ShaderParticleRenderer::addParticle(uint8* pDataVB, const Particle& particle) const
434{
435 // position
436 size_t ofs = 0;
437 for (int k=0; k<4; ++k) {
438 float* pPosition = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
439 pPosition[0] = particle.mPosition.x;
440 pPosition[1] = particle.mPosition.y;
441 pPosition[2] = particle.mPosition.z;
442 pPosition[3] = k;
443 }
444 ofs += sizeof(float) * 4;
445
446 // diffuse colour
448 for (int k=0; k<4; ++k) {
449 float* pColour = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
450 pColour[0] = particle.mColour.r;
451 pColour[1] = particle.mColour.g;
452 pColour[2] = particle.mColour.b;
453 pColour[3] = particle.mColour.a;
454 }
455 ofs += sizeof(float) * 4;
456 }
457
458 // general texture coordinates
460 for (int k=0; k<4; ++k) {
461 float* pTexCoord = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
462 pTexCoord[0] = mTexCoordTable[k].x;
463 pTexCoord[1] = mTexCoordTable[k].y;
464 }
465 ofs += sizeof(float) * 2;
466 }
467
468 // particle size
469 if (mVertexFormatSize) {
470 float w = mDefaultParticleSize.x;
471 float h = mDefaultParticleSize.y;
472 if (particle.hasOwnDimensions()) {
473 w = particle.getOwnWidth();
474 h = particle.getOwnHeight();
475 }
476
477 for (int k=0; k<4; ++k) {
478 float* pSize = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
479 pSize[0] = w;
480 pSize[1] = h;
481 }
482 ofs += sizeof(float) * 2;
483 }
484
485 // particle rotation
487 for (int k=0; k<4; ++k) {
488 float* pRotation = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
489 *pRotation = particle.mRotation.valueRadians();
490 }
491 ofs += sizeof(float);
492 }
493
494 // particle rotation speed
496 for (int k=0; k<4; ++k) {
497 float* pRotation = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
498 *pRotation = particle.mRotationSpeed.valueRadians();
499 }
500 ofs += sizeof(float);
501 }
502
503 // direction
505 for (int k=0; k<4; ++k) {
506 float* pDirection = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
507 pDirection[0] = particle.mDirection.x;
508 pDirection[1] = particle.mDirection.y;
509 pDirection[2] = particle.mDirection.z;
510 }
511 ofs += sizeof(float) * 3;
512 }
513
514 // time to live
515 if (mVertexFormatTTL) {
516 for (int k=0; k<4; ++k) {
517 float* pTime = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
518 *pTime = particle.mTimeToLive;
519 }
520 ofs += sizeof(float);
521 }
522
523 // total time to live
524 if (mVertexFormatTTL) {
525 for (int k=0; k<4; ++k) {
526 float* pTime = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
527 *pTime = particle.mTotalTimeToLive;
528 }
529 ofs += sizeof(float);
530 }
531
532 // time fragment
534 float fFrag = particle.mTimeToLive / particle.mTotalTimeToLive;
535 for (int k=0; k<4; ++k) {
536 float* pTime = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
537 *pTime = fFrag;
538 }
539 ofs += sizeof(float);
540 }
541
542 // inverse time fragment
544 float fFrag = 1.0f - particle.mTimeToLive / particle.mTotalTimeToLive;
545 for (int k=0; k<4; ++k) {
546 float* pTime = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
547 *pTime = fFrag;
548 }
549 ofs += sizeof(float);
550 }
551
552 // custom parameter
553 ParticleCustomParam* pCustom = static_cast<ParticleCustomParam*>(particle.getVisualData());
554 const Vector4& customData = pCustom != NULL ? pCustom->paramValue : Vector4::ZERO;
555 for (int k=0; k<4; ++k) {
556 float* pParams = reinterpret_cast<float*>(pDataVB + k*mVertexSize + ofs);
557 pParams[0] = customData.x;
558 pParams[1] = customData.y;
559 pParams[2] = customData.z;
560 pParams[3] = customData.w;
561 }
562 ofs += sizeof(float) * 4;
563
564 // if you see this assert some informations were not added into vertex buffer !!!
565 assert(ofs == mVertexSize);
566}
567
568/************************************************************************/
569/* ShaderParticleRendererFactory implementation */
570/************************************************************************/
572{
573 return rendererTypeName;
574}
575
577ParticleSystemRenderer* ShaderParticleRendererFactory::createInstance( const String& name )
578{
579 return OGRE_NEW ShaderParticleRenderer();
580}
581
583void ShaderParticleRendererFactory::destroyInstance( ParticleSystemRenderer* inst)
584{
585 OGRE_DELETE inst;
586}
587
588/************************************************************************/
589/* ParamCommand implementations */
590/************************************************************************/
592{
593 return StringConverter::toString(
594 static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatColour() );
595}
596void ShaderParticleRenderer::CmdVertexFormatColour::doSet(void* target, const String& val)
597{
598 static_cast<ShaderParticleRenderer*>(target)->setVertexFormatColour(
599 StringConverter::parseBool(val));
600}
602{
603}
604
607{
608 return StringConverter::toString(
609 static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatTexture() );
610}
611void ShaderParticleRenderer::CmdVertexFormatTexture::doSet(void* target, const String& val)
612{
613 static_cast<ShaderParticleRenderer*>(target)->setVertexFormatTexture(
614 StringConverter::parseBool(val));
615}
616
619{
620 return StringConverter::toString(
621 static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatSize() );
622}
623void ShaderParticleRenderer::CmdVertexFormatSize::doSet(void* target, const String& val)
624{
625 static_cast<ShaderParticleRenderer*>(target)->setVertexFormatSize(
626 StringConverter::parseBool(val));
627}
628
631{
632 return StringConverter::toString(
633 static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatRotation() );
634}
636{
637 static_cast<ShaderParticleRenderer*>(target)->setVertexFormatRotation(
638 StringConverter::parseBool(val));
639}
640
643{
644 return StringConverter::toString(
645 static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatRotationSpeed() );
646}
648{
650 StringConverter::parseBool(val));
651}
652
655{
656 return StringConverter::toString(
657 static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatDirection() );
658}
660{
662 StringConverter::parseBool(val));
663}
664
667{
668 return StringConverter::toString(
669 static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatTTL() );
670}
671void ShaderParticleRenderer::CmdVertexFormatTTL::doSet(void* target, const String& val)
672{
673 static_cast<ShaderParticleRenderer*>(target)->setVertexFormatTTL(
674 StringConverter::parseBool(val));
675}
676
679{
680 return StringConverter::toString(
681 static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatTotalTTL() );
682}
684{
685 static_cast<ShaderParticleRenderer*>(target)->setVertexFormatTotalTTL(
686 StringConverter::parseBool(val));
687}
688
691{
692 return StringConverter::toString(
693 static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatTimeFragment() );
694}
696{
698 StringConverter::parseBool(val));
699}
700
703{
704 return StringConverter::toString(
705 static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatTimeFragmentInv() );
706}
708{
710 StringConverter::parseBool(val));
711}
712}
custom visual data for shader renderer
ParticleSystemRenderer * createInstance(const String &name) override
void destroyInstance(ParticleSystemRenderer *inst) override
Specialisation of ParticleSystemRenderer to render particles using a custom shaders.
bool mVertexFormatColour
vertex format for particles
virtual void _destroyVisualData(ParticleVisualData *vis) override
virtual void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables=false) override
static CmdVertexFormatTimeFrag msVertexFmtTimeFrag
bool mVertexFormatTTL
particle ttl (float1)
static CmdVertexFormatRotation msVertexFmtRotation
bool mVertexFormatSize
particle size (width and height - float2)
virtual void setKeepParticlesInLocalSpace(bool keepLocal) override
Real mRadius
maximum distance between particles and parent node
static CmdVertexFormatTexture msVertexFmtTexture
static CmdVertexFormatSize msVertexFmtSize
static CmdVertexFormatTotalTTL msVertexFmtTotalTTL
bool mParentIsTagPoint
true if parent node is tag point
bool mVertexFormatRotationSpeed
particle rotation speed (radians/s - float1)
virtual const LightList & getLights(void) const override
bool mKeepInLocalSpace
control transformation matrix for particles
virtual const String & getType(void) const override
bool mVertexFormatDirection
particle direction (float3)
virtual void _notifyParticleRotated(void) override
bool mVertexFormatTotalTTL
particle total ttl (float1)
virtual void _notifyCurrentCamera(Camera *cam) override
virtual void getWorldTransforms(Matrix4 *xform) const override
static CmdVertexFormatRotationSpeed msVertexFmtRotationSpeed
bool mVertexFormatRotation
particle rotation (radians - float1)
bool mVertexFormatTimeFragmentInv
particle inverse time fragment (1.0f - ttl / total ttl) (float1) (value 0.0f - 1.0f)
virtual void _notifyAttached(Node *parent, bool isTagPoint=false) override
static CmdVertexFormatTimeFragInv msVertexFmtTimeFragInv
static CmdVertexFormatDirection msVertexFmtDirection
void addParticle(uint8 *pDataVB, const Particle &particle) const
add particle to vertex buffer
virtual void _notifyDefaultDimensions(Real width, Real height) override
virtual void _notifyParticleQuota(size_t quota) override
static CmdVertexFormatTTL msVertexFmtTTL
Vector2 mTexCoordTable[4]
default texture coordinates
virtual ParticleVisualData * _createVisualData(void) override
virtual Real getSquaredViewDepth(const Camera *cam) const override
virtual void _notifyParticleResized(void) override
virtual void _updateRenderQueue(RenderQueue *queue, Ogre::list< Particle * >::type &currentParticles, bool cullIndividually) override
static CmdVertexFormatColour msVertexFmtColour
virtual void setRenderQueueGroup(uint8 queueID) override
Node * mParentNode
parent node for particle system - used for world transformation
virtual const MaterialPtr & getMaterial(void) const override
bool mVertexFormatTimeFragment
particle time fragment (ttl / total ttl) (float1) (value 0.0f - 1.0f)
bool mVertexFormatTexture
true if particles use texture (float2)
virtual void getRenderOperation(RenderOperation &op) override
bool allocateBuffers(size_t iNumParticles)
allocate hardware buffers and prepare them for filling particles
virtual void _setMaterial(MaterialPtr &mat) override
LightList mLightList
light list for renderable
ulong mLightListUpdated
indicator if we need update light list
virtual SortMode _getSortMode(void) const override
void setRenderQueueGroupAndPriority(Ogre::uint8, Ogre::ushort)
Vector2 mDefaultParticleSize
other informations