1 #ifndef FluidDrawable_h
2 #define FluidDrawable_h
5 #include <osg/Drawable>
10 #include <fluids/NxParticleData.h>
13 using namespace vrecko;
23 NxParticleData _Particles;
35 this->setSupportsDisplayList(
false);
41 _Particles = _pFluid->getParticlesWriteData();
42 this->setSupportsDisplayList(
false);
50 Drawable(drawable,copyop)
55 virtual osg::Object*
clone(
const osg::CopyOp& copyop)
const {
return new FluidDrawable(*
this,copyop); }
60 virtual void drawImplementation(osg::RenderInfo& renderInfo)
const
62 glDisable(GL_LIGHTING);
65 glEnableClientState(GL_VERTEX_ARRAY);
67 glVertexPointer(3, GL_FLOAT, _Particles.bufferPosByteStride, _Particles.bufferPos);
68 glDrawArrays(GL_POINTS, 0, *_Particles.numParticlesPtr);
70 glDisableClientState(GL_VERTEX_ARRAY);
71 glEnable(GL_LIGHTING);
76 assert(_pFluid->getParticlesWriteData().numParticlesPtr);
77 assert(*_pFluid->getParticlesWriteData().numParticlesPtr!=0);
88 virtual const char*
className()
const {
return "FluidDrawable";}
92 virtual osg::BoundingBox computeBound()
const
95 _pFluid->getWorldBounds(Nxbbox);
97 osg::BoundingBox bbox;