RigsofRods
Soft-body Physics Simulation
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 
12 namespace Ogre {
14 
15 ShaderParticleRenderer::CmdVertexFormatColour ShaderParticleRenderer::msVertexFmtColour;
16 ShaderParticleRenderer::CmdVertexFormatTexture ShaderParticleRenderer::msVertexFmtTexture;
17 ShaderParticleRenderer::CmdVertexFormatSize ShaderParticleRenderer::msVertexFmtSize;
18 ShaderParticleRenderer::CmdVertexFormatRotation ShaderParticleRenderer::msVertexFmtRotation;
19 ShaderParticleRenderer::CmdVertexFormatRotationSpeed ShaderParticleRenderer::msVertexFmtRotationSpeed;
20 ShaderParticleRenderer::CmdVertexFormatDirection ShaderParticleRenderer::msVertexFmtDirection;
21 ShaderParticleRenderer::CmdVertexFormatTTL ShaderParticleRenderer::msVertexFmtTTL;
22 ShaderParticleRenderer::CmdVertexFormatTotalTTL ShaderParticleRenderer::msVertexFmtTotalTTL;
23 ShaderParticleRenderer::CmdVertexFormatTimeFrag ShaderParticleRenderer::msVertexFmtTimeFrag;
24 ShaderParticleRenderer::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 
126 const String& ShaderParticleRenderer::getType(void) const
127 {
128  return rendererTypeName;
129 }
130 
132 void 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 
166 void ShaderParticleRenderer::visitRenderables(Renderable::Visitor* visitor, bool debugRenderables)
167 {
168  visitor->visit(this, 0, debugRenderables);
169 }
170 
173 {
174  mMaterial = mat;
175 }
176 
179 {
180 }
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 
201 void 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 
221 void ShaderParticleRenderer::_destroyVisualData(ParticleVisualData* vis)
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 
245 const 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 
288 Real ShaderParticleRenderer::getSquaredViewDepth(const Camera* cam) const
289 {
290  if (mParentNode != NULL) {
291  return cam->getRealPosition().squaredDistance(mParentNode->getPosition());
292  } else {
293  return 0.0f;
294  }
295 }
296 
298 const LightList& ShaderParticleRenderer::getLights(void) const
299 {
300  if (mParentNode != NULL) {
301  // Query from parent entity if exists
302  if (mParentIsTagPoint)
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 
334 bool ShaderParticleRenderer::allocateBuffers(size_t iNumParticles)
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 
349  if (mVertexFormatSize)
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.isNull() || 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.isNull())
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.isNull() || 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.isNull())
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 
433 void 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
447  if (mVertexFormatColour) {
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
459  if (mVertexFormatTexture) {
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
486  if (mVertexFormatRotation) {
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 
577 ParticleSystemRenderer* ShaderParticleRendererFactory::createInstance( const String& name )
578 {
579  return OGRE_NEW ShaderParticleRenderer();
580 }
581 
583 void 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 }
596 void 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 }
611 void 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 }
623 void 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 }
635 void ShaderParticleRenderer::CmdVertexFormatRotation::doSet(void* target, const String& val)
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 }
659 void ShaderParticleRenderer::CmdVertexFormatDirection::doSet(void* target, const String& val)
660 {
661  static_cast<ShaderParticleRenderer*>(target)->setVertexFormatDirection(
662  StringConverter::parseBool(val));
663 }
664 
667 {
668  return StringConverter::toString(
669  static_cast<const ShaderParticleRenderer*>(target)->getVertexFormatTTL() );
670 }
671 void 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 }
683 void ShaderParticleRenderer::CmdVertexFormatTotalTTL::doSet(void* target, const String& val)
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 }
695 void ShaderParticleRenderer::CmdVertexFormatTimeFrag::doSet(void* target, const String& val)
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 }
Ogre::ShaderParticleRenderer::getLights
virtual const LightList & getLights(void) const override
Definition: OgreShaderParticleRenderer.cpp:298
Ogre::ShaderParticleRenderer::mVertexSize
size_t mVertexSize
Definition: OgreShaderParticleRenderer.h:50
Ogre::ShaderParticleRenderer::mRadius
Real mRadius
maximum distance between particles and parent node
Definition: OgreShaderParticleRenderer.h:59
Ogre::ShaderParticleRenderer::setVertexFormatTotalTTL
void setVertexFormatTotalTTL(bool bUse)
Definition: OgreShaderParticleRenderer.h:172
Ogre::ShaderParticleRenderer::CmdVertexFormatTimeFragInv::doGet
String doGet(const void *target) const
Definition: OgreShaderParticleRenderer.cpp:702
Ogre::ShaderParticleRenderer::msVertexFmtTimeFrag
static CmdVertexFormatTimeFrag msVertexFmtTimeFrag
Definition: OgreShaderParticleRenderer.h:229
Ogre::ShaderParticleRenderer::mVertexFormatSize
bool mVertexFormatSize
particle size (width and height - float2)
Definition: OgreShaderParticleRenderer.h:42
Ogre::ShaderParticleRenderer::CmdVertexFormatTotalTTL::doSet
void doSet(void *target, const String &val)
Definition: OgreShaderParticleRenderer.cpp:683
Ogre::ShaderParticleRenderer::mParentNode
Node * mParentNode
parent node for particle system - used for world transformation
Definition: OgreShaderParticleRenderer.h:55
Ogre::ShaderParticleRenderer::_notifyAttached
virtual void _notifyAttached(Node *parent, bool isTagPoint=false) override
Definition: OgreShaderParticleRenderer.cpp:201
Ogre::ShaderParticleRenderer::getVertexFormatTotalTTL
bool getVertexFormatTotalTTL() const
Definition: OgreShaderParticleRenderer.h:173
Ogre::ShaderParticleRenderer::mDefaultParticleSize
Vector2 mDefaultParticleSize
other informations
Definition: OgreShaderParticleRenderer.h:54
Ogre::ShaderParticleRenderer::CmdVertexFormatRotation::doGet
String doGet(const void *target) const
Definition: OgreShaderParticleRenderer.cpp:630
Ogre::ShaderParticleRenderer::mTexCoordTable
Vector2 mTexCoordTable[4]
default texture coordinates
Definition: OgreShaderParticleRenderer.h:51
Ogre::ShaderParticleRenderer::CmdVertexFormatSize::doGet
String doGet(const void *target) const
Definition: OgreShaderParticleRenderer.cpp:618
Ogre::ShaderParticleRenderer::msVertexFmtTotalTTL
static CmdVertexFormatTotalTTL msVertexFmtTotalTTL
Definition: OgreShaderParticleRenderer.h:228
Ogre::ShaderParticleRenderer::_notifyParticleResized
virtual void _notifyParticleResized(void) override
Definition: OgreShaderParticleRenderer.cpp:189
Ogre::ShaderParticleRenderer::setVertexFormatTimeFragment
void setVertexFormatTimeFragment(bool bUse)
Definition: OgreShaderParticleRenderer.h:175
Ogre::ShaderParticleRenderer::mKeepInLocalSpace
bool mKeepInLocalSpace
control transformation matrix for particles
Definition: OgreShaderParticleRenderer.h:61
Ogre::ShaderParticleRenderer::_notifyCurrentCamera
virtual void _notifyCurrentCamera(Camera *cam) override
Definition: OgreShaderParticleRenderer.cpp:178
Ogre::ShaderParticleRendererFactory::destroyInstance
void destroyInstance(ParticleSystemRenderer *inst) override
Definition: OgreShaderParticleRenderer.cpp:583
Ogre::ShaderParticleRenderer::setVertexFormatTimeFragmentInv
void setVertexFormatTimeFragmentInv(bool bUse)
Definition: OgreShaderParticleRenderer.h:178
Ogre::ShaderParticleRenderer::msVertexFmtRotation
static CmdVertexFormatRotation msVertexFmtRotation
Definition: OgreShaderParticleRenderer.h:224
Ogre::ShaderParticleRenderer::CmdVertexFormatRotationSpeed::doGet
String doGet(const void *target) const
Definition: OgreShaderParticleRenderer.cpp:642
Ogre::ShaderParticleRenderer::mMaterial
MaterialPtr mMaterial
rendering data
Definition: OgreShaderParticleRenderer.h:28
Ogre::ShaderParticleRenderer::_notifyParticleQuota
virtual void _notifyParticleQuota(size_t quota) override
Definition: OgreShaderParticleRenderer.cpp:195
Ogre::ShaderParticleRenderer::getWorldTransforms
virtual void getWorldTransforms(Matrix4 *xform) const override
Definition: OgreShaderParticleRenderer.cpp:275
Ogre::ShaderParticleRenderer::CmdVertexFormatColour::doSet
void doSet(void *target, const String &val)
Definition: OgreShaderParticleRenderer.cpp:596
Ogre::ShaderParticleRenderer::getVertexFormatSize
bool getVertexFormatSize() const
Definition: OgreShaderParticleRenderer.h:158
Ogre::ShaderParticleRenderer::getSquaredViewDepth
virtual Real getSquaredViewDepth(const Camera *cam) const override
Definition: OgreShaderParticleRenderer.cpp:288
Ogre::ShaderParticleRenderer::CmdVertexFormatColour::doGet
String doGet(const void *target) const
Definition: OgreShaderParticleRenderer.cpp:591
Ogre::ShaderParticleRenderer::msVertexFmtColour
static CmdVertexFormatColour msVertexFmtColour
Definition: OgreShaderParticleRenderer.h:221
w
float w
Definition: (ValueTypes) quaternion.h:4
Ogre::ShaderParticleRenderer::CmdVertexFormatTTL::doGet
String doGet(const void *target) const
Definition: OgreShaderParticleRenderer.cpp:666
OgreShaderParticleRenderer.h
Ogre::ShaderParticleRenderer::mVertexFormatRotationSpeed
bool mVertexFormatRotationSpeed
particle rotation speed (radians/s - float1)
Definition: OgreShaderParticleRenderer.h:44
Ogre::ShaderParticleRenderer::CmdVertexFormatTexture::doGet
String doGet(const void *target) const
Definition: OgreShaderParticleRenderer.cpp:606
Ogre::ShaderParticleRenderer::_getSortMode
virtual SortMode _getSortMode(void) const override
Definition: OgreShaderParticleRenderer.cpp:239
Ogre::ShaderParticleRenderer::_updateRenderQueue
virtual void _updateRenderQueue(RenderQueue *queue, Ogre::list< Particle * >::type &currentParticles, bool cullIndividually) override
Definition: OgreShaderParticleRenderer.cpp:132
OgreParticleCustomParam.h
Ogre::ShaderParticleRenderer::getVertexFormatTexture
bool getVertexFormatTexture() const
Definition: OgreShaderParticleRenderer.h:155
Ogre::ParticleCustomParam
custom visual data for shader renderer
Definition: OgreParticleCustomParam.h:16
Ogre::ShaderParticleRenderer::~ShaderParticleRenderer
virtual ~ShaderParticleRenderer()
Definition: OgreShaderParticleRenderer.cpp:119
Ogre::ShaderParticleRenderer::getRenderOperation
virtual void getRenderOperation(RenderOperation &op) override
Definition: OgreShaderParticleRenderer.cpp:251
Ogre::ShaderParticleRenderer::setVertexFormatRotationSpeed
void setVertexFormatRotationSpeed(bool bUse)
Definition: OgreShaderParticleRenderer.h:163
Ogre::ShaderParticleRenderer::_createVisualData
virtual ParticleVisualData * _createVisualData(void) override
Definition: OgreShaderParticleRenderer.cpp:215
Ogre::ShaderParticleRenderer::mParentIsTagPoint
bool mParentIsTagPoint
true if parent node is tag point
Definition: OgreShaderParticleRenderer.h:60
Ogre::ParticleCustomParam::paramValue
Vector4 paramValue
Definition: OgreParticleCustomParam.h:27
Ogre::ShaderParticleRenderer::CmdVertexFormatTotalTTL::doGet
String doGet(const void *target) const
Definition: OgreShaderParticleRenderer.cpp:678
Ogre::ShaderParticleRenderer::getMaterial
virtual const MaterialPtr & getMaterial(void) const override
Definition: OgreShaderParticleRenderer.cpp:245
Ogre::ShaderParticleRenderer::mVertexData
VertexData * mVertexData
Definition: OgreShaderParticleRenderer.h:29
Ogre::ShaderParticleRenderer::mLightList
LightList mLightList
light list for renderable
Definition: OgreShaderParticleRenderer.h:57
Ogre::ShaderParticleRenderer::ShaderParticleRenderer
ShaderParticleRenderer()
Definition: OgreShaderParticleRenderer.cpp:27
Ogre::ShaderParticleRenderer::CmdVertexFormatTexture::doSet
void doSet(void *target, const String &val)
Definition: OgreShaderParticleRenderer.cpp:611
Ogre::ShaderParticleRenderer::setRenderQueueGroup
virtual void setRenderQueueGroup(uint8 queueID) override
Definition: OgreShaderParticleRenderer.cpp:227
Ogre::ShaderParticleRenderer::getVertexFormatTimeFragmentInv
bool getVertexFormatTimeFragmentInv() const
Definition: OgreShaderParticleRenderer.h:179
Ogre::ShaderParticleRenderer::msVertexFmtDirection
static CmdVertexFormatDirection msVertexFmtDirection
Definition: OgreShaderParticleRenderer.h:226
Ogre::ShaderParticleRenderer::setVertexFormatTTL
void setVertexFormatTTL(bool bUse)
Definition: OgreShaderParticleRenderer.h:169
Ogre::ShaderParticleRenderer::CmdVertexFormatSize::doSet
void doSet(void *target, const String &val)
Definition: OgreShaderParticleRenderer.cpp:623
Ogre::ShaderParticleRenderer::allocateBuffers
bool allocateBuffers(size_t iNumParticles)
allocate hardware buffers and prepare them for filling particles
Definition: OgreShaderParticleRenderer.cpp:334
Ogre::ShaderParticleRenderer::CmdVertexFormatRotationSpeed::doSet
void doSet(void *target, const String &val)
Definition: OgreShaderParticleRenderer.cpp:647
Ogre::ShaderParticleRenderer
Specialisation of ParticleSystemRenderer to render particles using a custom shaders.
Definition: OgreShaderParticleRenderer.h:24
Ogre::ShaderParticleRenderer::mVertexFormatTotalTTL
bool mVertexFormatTotalTTL
particle total ttl (float1)
Definition: OgreShaderParticleRenderer.h:47
Ogre::ShaderParticleRenderer::CmdVertexFormatTTL::doSet
void doSet(void *target, const String &val)
Definition: OgreShaderParticleRenderer.cpp:671
Ogre::ShaderParticleRenderer::getVertexFormatTimeFragment
bool getVertexFormatTimeFragment() const
Definition: OgreShaderParticleRenderer.h:176
Ogre::ShaderParticleRenderer::getVertexFormatDirection
bool getVertexFormatDirection() const
Definition: OgreShaderParticleRenderer.h:167
Ogre::ShaderParticleRenderer::CmdVertexFormatRotation::doSet
void doSet(void *target, const String &val)
Definition: OgreShaderParticleRenderer.cpp:635
Ogre::ShaderParticleRenderer::getVertexFormatRotationSpeed
bool getVertexFormatRotationSpeed() const
Definition: OgreShaderParticleRenderer.h:164
Ogre::ShaderParticleRenderer::_notifyParticleRotated
virtual void _notifyParticleRotated(void) override
Definition: OgreShaderParticleRenderer.cpp:183
Ogre::ShaderParticleRenderer::mVertexFormatRotation
bool mVertexFormatRotation
particle rotation (radians - float1)
Definition: OgreShaderParticleRenderer.h:43
Ogre::ShaderParticleRenderer::getType
virtual const String & getType(void) const override
Definition: OgreShaderParticleRenderer.cpp:126
Ogre::ShaderParticleRenderer::CmdVertexFormatTimeFragInv::doSet
void doSet(void *target, const String &val)
Definition: OgreShaderParticleRenderer.cpp:707
Ogre::ShaderParticleRenderer::mVertexFormatTexture
bool mVertexFormatTexture
true if particles use texture (float2)
Definition: OgreShaderParticleRenderer.h:41
Ogre::ShaderParticleRenderer::msVertexFmtTimeFragInv
static CmdVertexFormatTimeFragInv msVertexFmtTimeFragInv
Definition: OgreShaderParticleRenderer.h:230
Ogre::ShaderParticleRenderer::setRenderQueueGroupAndPriority
void setRenderQueueGroupAndPriority(Ogre::uint8, Ogre::ushort)
Definition: OgreShaderParticleRenderer.cpp:601
Ogre::ShaderParticleRendererFactory::createInstance
ParticleSystemRenderer * createInstance(const String &name) override
Definition: OgreShaderParticleRenderer.cpp:577
Ogre::ShaderParticleRenderer::mVertexFormatTTL
bool mVertexFormatTTL
particle ttl (float1)
Definition: OgreShaderParticleRenderer.h:46
Ogre::ShaderParticleRenderer::setVertexFormatTexture
void setVertexFormatTexture(bool bUse)
Definition: OgreShaderParticleRenderer.h:154
Ogre::ShaderParticleRenderer::getVertexFormatRotation
bool getVertexFormatRotation() const
Definition: OgreShaderParticleRenderer.h:161
Ogre::ShaderParticleRenderer::_destroyVisualData
virtual void _destroyVisualData(ParticleVisualData *vis) override
Definition: OgreShaderParticleRenderer.cpp:221
Ogre::ShaderParticleRenderer::setVertexFormatSize
void setVertexFormatSize(bool bUse)
Definition: OgreShaderParticleRenderer.h:157
Ogre::ShaderParticleRenderer::CmdVertexFormatDirection::doGet
String doGet(const void *target) const
Definition: OgreShaderParticleRenderer.cpp:654
Ogre::ShaderParticleRenderer::getVertexFormatTTL
bool getVertexFormatTTL() const
Definition: OgreShaderParticleRenderer.h:170
Ogre::ShaderParticleRenderer::mSortMode
SortMode mSortMode
particle sorting
Definition: OgreShaderParticleRenderer.h:56
Ogre::ShaderParticleRenderer::addParticle
void addParticle(uint8 *pDataVB, const Particle &particle) const
add particle to vertex buffer
Definition: OgreShaderParticleRenderer.cpp:433
Ogre::ShaderParticleRenderer::setVertexFormatDirection
void setVertexFormatDirection(bool bUse)
Definition: OgreShaderParticleRenderer.h:166
Ogre::ShaderParticleRenderer::setVertexFormatColour
void setVertexFormatColour(bool bUse)
Definition: OgreShaderParticleRenderer.h:151
Ogre::ShaderParticleRenderer::_notifyDefaultDimensions
virtual void _notifyDefaultDimensions(Real width, Real height) override
Definition: OgreShaderParticleRenderer.cpp:208
Ogre::ShaderParticleRenderer::mVertexFormatDirection
bool mVertexFormatDirection
particle direction (float3)
Definition: OgreShaderParticleRenderer.h:45
Ogre::ShaderParticleRenderer::msVertexFmtSize
static CmdVertexFormatSize msVertexFmtSize
Definition: OgreShaderParticleRenderer.h:223
Ogre::ShaderParticleRenderer::mRenderQueueID
uint8 mRenderQueueID
Definition: OgreShaderParticleRenderer.h:31
Ogre::ShaderParticleRendererFactory::rendererTypeName
const String rendererTypeName
Definition: OgreShaderParticleRenderer.h:241
Ogre::ShaderParticleRenderer::CmdVertexFormatTimeFrag::doSet
void doSet(void *target, const String &val)
Definition: OgreShaderParticleRenderer.cpp:695
Ogre::ShaderParticleRenderer::msVertexFmtTexture
static CmdVertexFormatTexture msVertexFmtTexture
Definition: OgreShaderParticleRenderer.h:222
Ogre::ShaderParticleRenderer::msVertexFmtTTL
static CmdVertexFormatTTL msVertexFmtTTL
Definition: OgreShaderParticleRenderer.h:227
Ogre
Definition: ExtinguishableFireAffector.cpp:35
Ogre::ShaderParticleRenderer::CmdVertexFormatTimeFrag::doGet
String doGet(const void *target) const
Definition: OgreShaderParticleRenderer.cpp:690
Ogre::ShaderParticleRenderer::mVertexFormatTimeFragmentInv
bool mVertexFormatTimeFragmentInv
particle inverse time fragment (1.0f - ttl / total ttl) (float1) (value 0.0f - 1.0f)
Definition: OgreShaderParticleRenderer.h:49
Ogre::ShaderParticleRenderer::rendererTypeName
const String rendererTypeName
Definition: OgreShaderParticleRenderer.h:212
Ogre::ShaderParticleRenderer::mIndexData
IndexData * mIndexData
Definition: OgreShaderParticleRenderer.h:30
Ogre::ShaderParticleRenderer::visitRenderables
virtual void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables=false) override
Definition: OgreShaderParticleRenderer.cpp:166
Ogre::ShaderParticleRendererFactory::getType
const String & getType() const override
Definition: OgreShaderParticleRenderer.cpp:571
Ogre::ShaderParticleRenderer::setVertexFormatRotation
void setVertexFormatRotation(bool bUse)
Definition: OgreShaderParticleRenderer.h:160
Ogre::ShaderParticleRenderer::_setMaterial
virtual void _setMaterial(MaterialPtr &mat) override
Definition: OgreShaderParticleRenderer.cpp:172
Ogre::ShaderParticleRenderer::mLightListUpdated
ulong mLightListUpdated
indicator if we need update light list
Definition: OgreShaderParticleRenderer.h:58
Ogre::ShaderParticleRenderer::msVertexFmtRotationSpeed
static CmdVertexFormatRotationSpeed msVertexFmtRotationSpeed
Definition: OgreShaderParticleRenderer.h:225
Ogre::ShaderParticleRenderer::mVertexFormatTimeFragment
bool mVertexFormatTimeFragment
particle time fragment (ttl / total ttl) (float1) (value 0.0f - 1.0f)
Definition: OgreShaderParticleRenderer.h:48
Ogre::ShaderParticleRenderer::getVertexFormatColour
bool getVertexFormatColour() const
Definition: OgreShaderParticleRenderer.h:152
Ogre::ShaderParticleRenderer::setKeepParticlesInLocalSpace
virtual void setKeepParticlesInLocalSpace(bool keepLocal) override
Definition: OgreShaderParticleRenderer.cpp:233
Ogre::ShaderParticleRenderer::mVertexFormatColour
bool mVertexFormatColour
vertex format for particles
Definition: OgreShaderParticleRenderer.h:40
Ogre::ShaderParticleRenderer::CmdVertexFormatDirection::doSet
void doSet(void *target, const String &val)
Definition: OgreShaderParticleRenderer.cpp:659