Moved to standard OSG coding style.

This commit is contained in:
Robert Osfield
2005-04-29 06:32:13 +00:00
parent 178a0b5c7e
commit 98126f1706
19 changed files with 528 additions and 527 deletions

View File

@@ -41,7 +41,7 @@ namespace osgFX
class OSGFX_EXPORT AnisotropicLighting: public Effect {
public:
AnisotropicLighting();
AnisotropicLighting(const AnisotropicLighting &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY);
AnisotropicLighting(const AnisotropicLighting& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Effect(osgFX, AnisotropicLighting,
@@ -64,13 +64,13 @@ namespace osgFX
/** get the lighting map */
inline osg::Image *getLightingMap();
inline osg::Image* getLightingMap();
/** get the const lighting map */
inline const osg::Image *getLightingMap() const;
inline const osg::Image* getLightingMap() const;
/** set the lighting map */
inline void setLightingMap(osg::Image *image);
inline void setLightingMap(osg::Image* image);
/** get the OpenGL light number */
inline int getLightNumber() const;
@@ -80,40 +80,40 @@ namespace osgFX
protected:
virtual ~AnisotropicLighting() {}
AnisotropicLighting &operator=(const AnisotropicLighting &) { return *this; }
AnisotropicLighting& operator=(const AnisotropicLighting&) { return *this; }
bool define_techniques();
private:
int lightnum_;
osg::ref_ptr<osg::Texture2D> texture_;
int _lightnum;
osg::ref_ptr<osg::Texture2D> _texture;
};
// INLINE METHODS
inline osg::Image *AnisotropicLighting::getLightingMap()
inline osg::Image* AnisotropicLighting::getLightingMap()
{
return texture_->getImage();
return _texture->getImage();
}
inline const osg::Image *AnisotropicLighting::getLightingMap() const
inline const osg::Image* AnisotropicLighting::getLightingMap() const
{
return texture_->getImage();
return _texture->getImage();
}
inline void AnisotropicLighting::setLightingMap(osg::Image *image)
inline void AnisotropicLighting::setLightingMap(osg::Image* image)
{
texture_->setImage(image);
_texture->setImage(image);
}
inline int AnisotropicLighting::getLightNumber() const
{
return lightnum_;
return _lightnum;
}
inline void AnisotropicLighting::setLightNumber(int n)
{
lightnum_ = n;
_lightnum = n;
dirtyTechniques();
}

View File

@@ -40,7 +40,7 @@ namespace osgFX
class OSGFX_EXPORT BumpMapping: public Effect {
public:
BumpMapping();
BumpMapping(const BumpMapping &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY);
BumpMapping(const BumpMapping& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Effect(osgFX, BumpMapping,
@@ -80,31 +80,31 @@ namespace osgFX
inline void setNormalMapTextureUnit(int n);
/** get the diffuse color texture that overrides children's texture */
inline osg::Texture2D *getOverrideDiffuseTexture();
inline osg::Texture2D* getOverrideDiffuseTexture();
/** get the const diffuse color texture that overrides children's texture */
inline const osg::Texture2D *getOverrideDiffuseTexture() const;
inline const osg::Texture2D* getOverrideDiffuseTexture() const;
/** set the diffuse color texture that overrides children's texture */
inline void setOverrideDiffuseTexture(osg::Texture2D *texture);
inline void setOverrideDiffuseTexture(osg::Texture2D* texture);
/** get the normal map texture that overrides children's texture */
inline osg::Texture2D *getOverrideNormalMapTexture();
inline osg::Texture2D* getOverrideNormalMapTexture();
/** get the const normal map texture that overrides children's texture */
inline const osg::Texture2D *getOverrideNormalMapTexture() const;
inline const osg::Texture2D* getOverrideNormalMapTexture() const;
/** set the normal map texture that overrides children's texture */
inline void setOverrideNormalMapTexture(osg::Texture2D *texture);
inline void setOverrideNormalMapTexture(osg::Texture2D* texture);
/**
prepare a Geometry for bump lighting. Tangent-space basis vectors are
generated and attached to the geometry as vertex attribute arrays.
*/
void prepareGeometry(osg::Geometry *geo);
void prepareGeometry(osg::Geometry* geo);
/** prepare a Node for bump lighting, calling prepareGeometry() for each Geometry */
void prepareNode(osg::Node *node);
void prepareNode(osg::Node* node);
/** prepare children for bump lighting. Actually calls prepareNode() for each child */
void prepareChildren();
@@ -119,77 +119,77 @@ namespace osgFX
bool define_techniques();
private:
int lightnum_;
int diffuseunit_;
int normalunit_;
osg::ref_ptr<osg::Texture2D> diffuse_tex_;
osg::ref_ptr<osg::Texture2D> normal_tex_;
int _lightnum;
int _diffuse_unit;
int _normal_unit;
osg::ref_ptr<osg::Texture2D> _diffuse_tex;
osg::ref_ptr<osg::Texture2D> _normal_tex;
};
// INLINE METHODS
inline int BumpMapping::getLightNumber() const
{
return lightnum_;
return _lightnum;
}
inline void BumpMapping::setLightNumber(int n)
{
lightnum_ = n;
_lightnum = n;
dirtyTechniques();
}
inline int BumpMapping::getDiffuseTextureUnit() const
{
return diffuseunit_;
return _diffuse_unit;
}
inline void BumpMapping::setDiffuseTextureUnit(int n)
{
diffuseunit_ = n;
_diffuse_unit = n;
dirtyTechniques();
}
inline int BumpMapping::getNormalMapTextureUnit() const
{
return normalunit_;
return _normal_unit;
}
inline void BumpMapping::setNormalMapTextureUnit(int n)
{
normalunit_ = n;
_normal_unit = n;
dirtyTechniques();
}
inline osg::Texture2D *BumpMapping::getOverrideDiffuseTexture()
inline osg::Texture2D* BumpMapping::getOverrideDiffuseTexture()
{
return diffuse_tex_.get();
return _diffuse_tex.get();
}
inline const osg::Texture2D *BumpMapping::getOverrideDiffuseTexture() const
inline const osg::Texture2D* BumpMapping::getOverrideDiffuseTexture() const
{
return diffuse_tex_.get();
return _diffuse_tex.get();
}
inline void BumpMapping::setOverrideDiffuseTexture(osg::Texture2D *texture)
inline void BumpMapping::setOverrideDiffuseTexture(osg::Texture2D* texture)
{
diffuse_tex_ = texture;
_diffuse_tex = texture;
dirtyTechniques();
}
inline osg::Texture2D *BumpMapping::getOverrideNormalMapTexture()
inline osg::Texture2D* BumpMapping::getOverrideNormalMapTexture()
{
return normal_tex_.get();
return _normal_tex.get();
}
inline const osg::Texture2D *BumpMapping::getOverrideNormalMapTexture() const
inline const osg::Texture2D* BumpMapping::getOverrideNormalMapTexture() const
{
return normal_tex_.get();
return _normal_tex.get();
}
inline void BumpMapping::setOverrideNormalMapTexture(osg::Texture2D *texture)
inline void BumpMapping::setOverrideNormalMapTexture(osg::Texture2D* texture)
{
normal_tex_ = texture;
_normal_tex = texture;
dirtyTechniques();
}

View File

@@ -35,7 +35,7 @@ namespace osgFX
class OSGFX_EXPORT Cartoon: public Effect {
public:
Cartoon();
Cartoon(const Cartoon &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY);
Cartoon(const Cartoon& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
// effect class informations
META_Effect(
@@ -55,10 +55,10 @@ namespace osgFX
"Marco Jez; OGLSL port by Mike Weiblen");
/** get the outline color */
inline const osg::Vec4 &getOutlineColor() const;
inline const osg::Vec4& getOutlineColor() const;
/** set the outline color */
inline void setOutlineColor(const osg::Vec4 &color);
inline void setOutlineColor(const osg::Vec4& color);
/** get the outline line width */
inline float getOutlineLineWidth() const;
@@ -74,46 +74,46 @@ namespace osgFX
protected:
virtual ~Cartoon() {}
Cartoon &operator=(const Cartoon &) { return *this; }
Cartoon& operator=(const Cartoon&) { return *this; }
bool define_techniques();
private:
osg::ref_ptr<osg::Material> wf_mat_;
osg::ref_ptr<osg::LineWidth> wf_lw_;
int lightnum_;
osg::ref_ptr<osg::Material> _wf_mat;
osg::ref_ptr<osg::LineWidth> _wf_lw;
int _lightnum;
};
// INLINE METHODS
inline const osg::Vec4 &Cartoon::getOutlineColor() const
inline const osg::Vec4& Cartoon::getOutlineColor() const
{
return wf_mat_->getEmission(osg::Material::FRONT_AND_BACK);
return _wf_mat->getEmission(osg::Material::FRONT_AND_BACK);
}
inline void Cartoon::setOutlineColor(const osg::Vec4 &color)
inline void Cartoon::setOutlineColor(const osg::Vec4& color)
{
wf_mat_->setEmission(osg::Material::FRONT_AND_BACK, color);
_wf_mat->setEmission(osg::Material::FRONT_AND_BACK, color);
}
inline float Cartoon::getOutlineLineWidth() const
{
return wf_lw_->getWidth();
return _wf_lw->getWidth();
}
inline void Cartoon::setOutlineLineWidth(float w)
{
wf_lw_->setWidth(w);
_wf_lw->setWidth(w);
}
inline int Cartoon::getLightNumber() const
{
return lightnum_;
return _lightnum;
}
inline void Cartoon::setLightNumber(int n)
{
lightnum_ = n;
_lightnum = n;
dirtyTechniques();
}

View File

@@ -12,8 +12,8 @@
*/
//osgFX - Copyright (C) 2003 Marco Jez
#ifndef OSGFX_EFFECT_
#define OSGFX_EFFECT_
#ifndef OSGFX__effect
#define OSGFX__effect
#include <osgFX/Export>
#include <osgFX/Technique>
@@ -66,16 +66,16 @@ namespace osgFX
class OSGFX_EXPORT Effect: public osg::Group {
public:
Effect();
Effect(const Effect &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY);
Effect(const Effect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
virtual inline bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast<const Effect *>(obj) != NULL; }
virtual inline const char *libraryName() const { return "osgFX"; }
virtual inline const char *className() const { return "Effect"; }
virtual inline bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Effect*>(obj) != NULL; }
virtual inline const char* libraryName() const { return "osgFX"; }
virtual inline const char* className() const { return "Effect"; }
/** get the name of this effect */
/** get the name of this Effect */
virtual const char *effectName() const = 0;
/** get a brief description of this effect */
/** get a brief description of this Effect*/
virtual const char *effectDescription() const = 0;
/** get the effect author's name */
@@ -94,16 +94,16 @@ namespace osgFX
*/
inline virtual void setUpDemo() {}
/** get the number of techniques defined for this effect */
/** get the number of techniques defined for this Effect */
inline int getNumTechniques() const;
/** get the i-th technique */
inline Technique *getTechnique(int i);
/** get the i-th Technique */
inline Technique* getTechnique(int i);
/** get the i-th const technique */
inline const Technique *getTechnique(int i) const;
/** get the i-th const Technique */
inline const Technique* getTechnique(int i) const;
/** get the index of the currently selected technique */
/** get the index of the currently selected Technique */
inline int getSelectedTechnique() const;
enum TechniqueSelection {
@@ -114,10 +114,10 @@ namespace osgFX
inline void selectTechnique(int i = AUTO_DETECT);
/** custom traversal */
virtual void traverse(osg::NodeVisitor &nv);
virtual void traverse(osg::NodeVisitor& nv);
/** default traversal */
inline void inherited_traverse(osg::NodeVisitor &nv);
inline void inherited_traverse(osg::NodeVisitor& nv);
protected:
virtual ~Effect();
@@ -126,8 +126,8 @@ namespace osgFX
/** force rebuilding of techniques on next traversal */
inline void dirtyTechniques();
/** add a technique to the effect */
inline void addTechnique(Technique *tech);
/** add a technique to the Effect */
inline void addTechnique(Technique* tech);
/**
abstract method to be implemented in derived classes; its purpose
@@ -140,21 +140,21 @@ namespace osgFX
private:
friend class Validator;
bool enabled_;
bool _enabled;
typedef std::vector<osg::ref_ptr<Technique> > Technique_list;
Technique_list techs_;
Technique_list _techs;
mutable osg::buffered_value<int> sel_tech_;
mutable osg::buffered_value<int> _sel_tech;
// use int instead of bool to avoid errors
mutable osg::buffered_value<int> tech_selected_;
mutable osg::buffered_value<int> _tech_selected;
int global_sel_tech_;
int _global_sel_tech;
bool techs_defined_;
bool _techs_defined;
osg::ref_ptr<osg::Geode> dummy_for_validation_;
osg::ref_ptr<osg::Geode> _dummy_for_validation;
void build_dummy_node();
};
@@ -163,50 +163,50 @@ namespace osgFX
inline bool Effect::getEnabled() const
{
return enabled_;
return _enabled;
}
inline void Effect::setEnabled(bool v)
{
enabled_ = v;
_enabled = v;
}
inline int Effect::getNumTechniques() const
{
return static_cast<int>(techs_.size());
return static_cast<int>(_techs.size());
}
inline Technique *Effect::getTechnique(int i)
inline Technique* Effect::getTechnique(int i)
{
return techs_[i].get();
return _techs[i].get();
}
inline const Technique *Effect::getTechnique(int i) const
inline const Technique* Effect::getTechnique(int i) const
{
return techs_[i].get();
return _techs[i].get();
}
inline int Effect::getSelectedTechnique() const
{
return global_sel_tech_;
return _global_sel_tech;
}
inline void Effect::selectTechnique(int i)
{
global_sel_tech_ = i;
_global_sel_tech = i;
}
inline void Effect::addTechnique(Technique *tech)
inline void Effect::addTechnique(Technique* tech)
{
techs_.push_back(tech);
_techs.push_back(tech);
}
inline void Effect::dirtyTechniques()
{
techs_defined_ = false;
_techs_defined = false;
}
inline void Effect::inherited_traverse(osg::NodeVisitor &nv)
inline void Effect::inherited_traverse(osg::NodeVisitor& nv)
{
typedef osg::Group inherited;
inherited::traverse(nv);

View File

@@ -26,23 +26,24 @@
namespace osgFX
{
class OSGFX_EXPORT Registry : public osg::Referenced{
class OSGFX_EXPORT Registry : public osg::Referenced
{
public:
struct Proxy {
Proxy(const Effect *effect)
Proxy(const Effect* effect)
{
Registry::instance()->registerEffect(effect);
}
};
typedef std::map<std::string, osg::ref_ptr<const Effect> > Effect_map;
typedef std::map<std::string, osg::ref_ptr<const Effect> > EffectMap;
static Registry *instance();
static Registry* instance();
inline void registerEffect(const Effect *effect);
inline void registerEffect(const Effect* effect);
inline const Effect_map &getEffectMap() const;
inline const EffectMap& getEffectMap() const;
protected:
@@ -51,21 +52,21 @@ namespace osgFX
~Registry() {}
private:
Effect_map effects_;
EffectMap _effects;
};
// INLINE METHODS
inline const Registry::Effect_map &Registry::getEffectMap() const
inline const Registry::EffectMap& Registry::getEffectMap() const
{
return effects_;
return _effects;
}
inline void Registry::registerEffect(const Effect *effect)
inline void Registry::registerEffect(const Effect* effect)
{
effects_[effect->effectName()] = effect;
_effects[effect->effectName()] = effect;
}
}

View File

@@ -34,7 +34,7 @@ namespace osgFX
class OSGFX_EXPORT Scribe: public Effect {
public:
Scribe();
Scribe(const Scribe &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY);
Scribe(const Scribe& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
// effect class informations
META_Effect(
@@ -52,10 +52,10 @@ namespace osgFX
"Marco Jez");
/** get the wireframe color */
inline const osg::Vec4 &getWireframeColor() const;
inline const osg::Vec4& getWireframeColor() const;
/** set the wireframe color */
inline void setWireframeColor(const osg::Vec4 &color);
inline void setWireframeColor(const osg::Vec4& color);
/** get the wireframe line width */
inline float getWireframeLineWidth() const;
@@ -65,35 +65,35 @@ namespace osgFX
protected:
virtual ~Scribe() {}
Scribe &operator=(const Scribe &) { return *this; }
Scribe& operator=(const Scribe&) { return *this; }
bool define_techniques();
private:
osg::ref_ptr<osg::Material> wf_mat_;
osg::ref_ptr<osg::LineWidth> wf_lw_;
osg::ref_ptr<osg::Material> _wf_mat;
osg::ref_ptr<osg::LineWidth> _wf_lw;
};
// INLINE METHODS
inline const osg::Vec4 &Scribe::getWireframeColor() const
inline const osg::Vec4& Scribe::getWireframeColor() const
{
return wf_mat_->getEmission(osg::Material::FRONT_AND_BACK);
return _wf_mat->getEmission(osg::Material::FRONT_AND_BACK);
}
inline void Scribe::setWireframeColor(const osg::Vec4 &color)
inline void Scribe::setWireframeColor(const osg::Vec4& color)
{
wf_mat_->setEmission(osg::Material::FRONT_AND_BACK, color);
_wf_mat->setEmission(osg::Material::FRONT_AND_BACK, color);
}
inline float Scribe::getWireframeLineWidth() const
{
return wf_lw_->getWidth();
return _wf_lw->getWidth();
}
inline void Scribe::setWireframeLineWidth(float w)
{
wf_lw_->setWidth(w);
_wf_lw->setWidth(w);
}
}

View File

@@ -33,7 +33,7 @@ namespace osgFX
class OSGFX_EXPORT SpecularHighlights: public Effect {
public:
SpecularHighlights();
SpecularHighlights(const SpecularHighlights &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY);
SpecularHighlights(const SpecularHighlights& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Effect(osgFX, SpecularHighlights,
@@ -63,10 +63,10 @@ namespace osgFX
inline void setTextureUnit(int n);
/** get the specular color */
inline const osg::Vec4 &getSpecularColor() const;
inline const osg::Vec4& getSpecularColor() const;
/** set the specular color */
inline void setSpecularColor(const osg::Vec4 &color);
inline void setSpecularColor(const osg::Vec4& color);
/** get the specular exponent */
inline float getSpecularExponent() const;
@@ -76,60 +76,60 @@ namespace osgFX
protected:
virtual ~SpecularHighlights() {}
SpecularHighlights &operator=(const SpecularHighlights &) { return *this; }
SpecularHighlights& operator=(const SpecularHighlights&) { return *this; }
bool define_techniques();
private:
int lightnum_;
int unit_;
osg::Vec4 color_;
float sexp_;
int _lightnum;
int _unit;
osg::Vec4 _color;
float _sexp;
};
// INLINE METHODS
inline int SpecularHighlights::getLightNumber() const
{
return lightnum_;
return _lightnum;
}
inline void SpecularHighlights::setLightNumber(int n)
{
lightnum_ = n;
_lightnum = n;
dirtyTechniques();
}
inline int SpecularHighlights::getTextureUnit() const
{
return unit_;
return _unit;
}
inline void SpecularHighlights::setTextureUnit(int n)
{
unit_ = n;
_unit = n;
dirtyTechniques();
}
inline const osg::Vec4 &SpecularHighlights::getSpecularColor() const
inline const osg::Vec4& SpecularHighlights::getSpecularColor() const
{
return color_;
return _color;
}
inline void SpecularHighlights::setSpecularColor(const osg::Vec4 &color)
inline void SpecularHighlights::setSpecularColor(const osg::Vec4& color)
{
color_ = color;
_color = color;
dirtyTechniques();
}
inline float SpecularHighlights::getSpecularExponent() const
{
return sexp_;
return _sexp;
}
inline void SpecularHighlights::setSpecularExponent(float e)
{
sexp_ = e;
_sexp = e;
dirtyTechniques();
}

View File

@@ -123,29 +123,29 @@ namespace osgFX
private:
typedef std::vector<osg::ref_ptr<osg::StateSet> > Pass_list;
Pass_list passes_;
Pass_list _passes;
};
// INLINE METHODS
inline int Technique::getNumPasses() const
{
return static_cast<int>(passes_.size());
return static_cast<int>(_passes.size());
}
inline osg::StateSet *Technique::getPassStateSet(int i)
{
return passes_[i].get();
return _passes[i].get();
}
inline const osg::StateSet *Technique::getPassStateSet(int i) const
{
return passes_[i].get();
return _passes[i].get();
}
inline void Technique::dirtyPasses()
{
passes_.clear();
_passes.clear();
}
inline void Technique::traverse(osg::NodeVisitor &nv, Effect *fx)

View File

@@ -36,36 +36,36 @@ namespace osgFX
public:
Validator();
Validator(Effect *effect);
Validator(const Validator &copy, const osg::CopyOp &copyop = osg::CopyOp::SHALLOW_COPY);
Validator(Effect* effect);
Validator(const Validator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_StateAttribute(osgFX, Validator, VALIDATOR);
void apply(osg::State &state) const;
void compileGLObjects(osg::State &state) const;
void apply(osg::State& state) const;
void compileGLObjects(osg::State& state) const;
inline int compare(const osg::StateAttribute &sa) const;
inline int compare(const osg::StateAttribute& sa) const;
inline void disable() { effect_ = 0; }
inline void disable() { _effect = 0; }
protected:
virtual ~Validator() {}
Validator &operator=(const Validator &) { return *this; }
Validator& operator=(const Validator&) { return *this; }
private:
mutable Effect *effect_;
mutable Effect* _effect;
};
// INLINE METHODS
inline int Validator::compare(const osg::StateAttribute &sa) const
inline int Validator::compare(const osg::StateAttribute& sa) const
{
// check the types are equal and then create the rhs variable
//used by the COMPARE_StateAttribute_Paramter macro's below.
COMPARE_StateAttribute_Types(Validator,sa)
// compare parameters
COMPARE_StateAttribute_Parameter(effect_)
COMPARE_StateAttribute_Parameter(_effect)
return 0;
}