Updates to osgParticle form Macro.
This commit is contained in:
@@ -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_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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> 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
|
||||
{
|
||||
|
||||
@@ -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<const VectorFont *>(obj)!=NULL; }
|
||||
|
||||
Reference in New Issue
Block a user