From 609a9ebf210c9123a7d0fdf5e35563f686a3650f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 22 Jul 2002 16:01:00 +0000 Subject: [PATCH] Updates to osgParticle form Macro. --- include/osgParticle/Particle | 6 +-- include/osgParticle/ParticleSystem | 68 +++++++++++++++++++++++++++++- include/osgText/Font | 7 ++- 3 files changed, 75 insertions(+), 6 deletions(-) diff --git a/include/osgParticle/Particle b/include/osgParticle/Particle index 14675e649..82584a520 100644 --- a/include/osgParticle/Particle +++ b/include/osgParticle/Particle @@ -42,7 +42,7 @@ namespace osgParticle QUAD_TRIANGLESTRIP, // uses GL_TRIANGLE_STRIP as primitive, but each particle needs a glBegin/glEnd pair HEXAGON // may save some filling time, but uses more triangles }; - + Particle(); /// Get the shape of the particle. @@ -167,7 +167,7 @@ namespace osgParticle inline void beginRender(); /// Render the particle. Called automatically by particle systems. - void render(const osg::Matrix &modelview, float scale = 1.0f) const; + void render(const osg::Vec3 &xpos, const osg::Vec3 &px, const osg::Vec3 &py, float scale = 1.0f) const; /// Perform some post-rendering tasks. Called automatically by particle systems. inline void endRender(); @@ -397,7 +397,7 @@ namespace osgParticle inline float Particle::getCurrentSize() const { - return current_size_; + return current_size_; } diff --git a/include/osgParticle/ParticleSystem b/include/osgParticle/ParticleSystem index 20428ba63..74a4cbce3 100644 --- a/include/osgParticle/ParticleSystem +++ b/include/osgParticle/ParticleSystem @@ -32,11 +32,37 @@ namespace osgParticle */ class OSGPARTICLE_EXPORT ParticleSystem: public osg::Drawable { public: + + enum Alignment { + BILLBOARD, + FIXED + }; ParticleSystem(); ParticleSystem(const ParticleSystem ©, const osg::CopyOp ©op = osg::CopyOp::SHALLOW_COPY); META_Object(osgParticle, ParticleSystem); + + /// Get the alignment type of particles. + inline Alignment getParticleAlignment() const; + + /// Set the alignment type of particles. + inline void setParticleAlignment(Alignment a); + + /// Get the X-axis alignment vector. + inline const osg::Vec3 &getAlignVectorX() const; + + /// Set the X-axis alignment vector. + inline void setAlignVectorX(const osg::Vec3 &v); + + /// Get the Y-axis alignment vector. + inline const osg::Vec3 &getAlignVectorY() const; + + /// Set the Y-axis alignment vector. + inline void setAlignVectorY(const osg::Vec3 &v); + + /// Set the alignment vectors. + inline void setAlignVectors(const osg::Vec3 &X, const osg::Vec3 &Y); /// Get the default bounding box inline const osg::BoundingBox &getDefaultBoundingBox() const; @@ -125,7 +151,7 @@ namespace osgParticle inline virtual const bool computeBound() const; virtual void drawImmediateMode(osg::State &state); inline void update_bounds(const osg::Vec3 &p, float r); - void single_pass_render(const osg::Matrix &modelview); + void single_pass_render(osg::State &state, const osg::Matrix &modelview); private: typedef std::vector Particle_vector; @@ -135,6 +161,10 @@ namespace osgParticle Death_stack deadparts_; osg::BoundingBox def_bbox_; + + Alignment alignment_; + osg::Vec3 align_X_axis_; + osg::Vec3 align_Y_axis_; bool doublepass_; bool frozen_; @@ -156,6 +186,42 @@ namespace osgParticle }; // INLINE FUNCTIONS + + inline ParticleSystem::Alignment ParticleSystem::getParticleAlignment() const + { + return alignment_; + } + + inline void ParticleSystem::setParticleAlignment(Alignment a) + { + alignment_ = a; + } + + inline const osg::Vec3 &ParticleSystem::getAlignVectorX() const + { + return align_X_axis_; + } + + inline void ParticleSystem::setAlignVectorX(const osg::Vec3 &v) + { + align_X_axis_ = v; + } + + inline const osg::Vec3 &ParticleSystem::getAlignVectorY() const + { + return align_Y_axis_; + } + + inline void ParticleSystem::setAlignVectorY(const osg::Vec3 &v) + { + align_Y_axis_ = v; + } + + inline void ParticleSystem::setAlignVectors(const osg::Vec3 &X, const osg::Vec3 &Y) + { + align_X_axis_ = X; + align_Y_axis_ = Y; + } inline bool ParticleSystem::isFrozen() const { diff --git a/include/osgText/Font b/include/osgText/Font index 573b6fee1..7b9903f7d 100644 --- a/include/osgText/Font +++ b/include/osgText/Font @@ -136,9 +136,12 @@ class OSGTEXT_EXPORT RasterFont:public Font class OSGTEXT_EXPORT VectorFont:public Font { public: - VectorFont():Font(){} + VectorFont():Font(),_precision(0.0) {} + VectorFont(const VectorFont& font,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY): - Font(font,copyop) {} + Font(font,copyop), + _precision(font._precision) {} + VectorFont(const std::string& /*font*/):Font(){} virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast(obj)!=NULL; }