Commit 32173f1f authored by Jan Möbius's avatar Jan Möbius
Browse files

Get rid of underscores

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9042 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 6de3d00f
......@@ -82,41 +82,41 @@ void MaterialNode::enter(GLState& _state, DrawModes::DrawMode _drawmode )
{
if (applyProperties_ & BaseColor)
{
materialBackup_.base_color_ = _state.base_color();
_state.set_base_color(material_.base_color_);
materialBackup_.baseColor_ = _state.base_color();
_state.set_base_color(material_.baseColor_);
}
if (applyProperties_ & Material)
{
materialBackup_.ambient_color_ = _state.ambient_color();
materialBackup_.diffuse_color_ = _state.diffuse_color();
materialBackup_.specular_color_ = _state.specular_color();
materialBackup_.ambientColor_ = _state.ambient_color();
materialBackup_.diffuseColor_ = _state.diffuse_color();
materialBackup_.specularColor_ = _state.specular_color();
materialBackup_.shininess_ = _state.shininess();
_state.set_ambient_color(material_.ambient_color_);
_state.set_diffuse_color(material_.diffuse_color_);
_state.set_specular_color(material_.specular_color_);
_state.set_ambient_color(material_.ambientColor_);
_state.set_diffuse_color(material_.diffuseColor_);
_state.set_specular_color(material_.specularColor_);
_state.set_shininess(material_.shininess_);
}
if (applyProperties_ & PointSize)
{
materialBackup_.point_size_ = _state.point_size();
_state.set_point_size(material_.point_size_);
materialBackup_.pointSize_ = _state.point_size();
_state.set_point_size(material_.pointSize_);
}
if (applyProperties_ & LineWidth)
{
materialBackup_.line_width_ = _state.line_width();
_state.set_line_width(material_.line_width_);
materialBackup_.lineWidth_ = _state.line_width();
_state.set_line_width(material_.lineWidth_);
}
if (applyProperties_ & RoundPoints)
{
materialBackup_.round_points_ = glIsEnabled(GL_POINT_SMOOTH) &&
materialBackup_.roundPoints_ = glIsEnabled(GL_POINT_SMOOTH) &&
glIsEnabled(GL_ALPHA_TEST);
if( material_.round_points_ ) {
if( material_.roundPoints_ ) {
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable(GL_POINT_SMOOTH);
} else
......@@ -125,10 +125,10 @@ void MaterialNode::enter(GLState& _state, DrawModes::DrawMode _drawmode )
if (applyProperties_ & LineSmooth)
{
materialBackup_.lines_smooth_ = glIsEnabled(GL_LINE_SMOOTH) &&
materialBackup_.linesSmooth_ = glIsEnabled(GL_LINE_SMOOTH) &&
glIsEnabled(GL_ALPHA_TEST);
if( material_.lines_smooth_ ) {
if( material_.linesSmooth_ ) {
glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
glEnable(GL_LINE_SMOOTH);
} else
......@@ -137,18 +137,18 @@ void MaterialNode::enter(GLState& _state, DrawModes::DrawMode _drawmode )
if (applyProperties_ & MultiSampling)
{
materialBackup_.multi_sampling_ = _state.multisampling();
_state.set_multisampling( material_.multi_sampling_ );
materialBackup_.multiSampling_ = _state.multisampling();
_state.set_multisampling( material_.multiSampling_ );
}
if (applyProperties_ & AlphaTest)
{
materialBackup_.alpha_test_ = glIsEnabled(GL_ALPHA_TEST);
glGetFloatv(GL_ALPHA_TEST_REF, &materialBackup_.alpha_clip_);
materialBackup_.alphaTest_ = glIsEnabled(GL_ALPHA_TEST);
glGetFloatv(GL_ALPHA_TEST_REF, &materialBackup_.alphaClip_);
if(material_.alpha_test_)
if(material_.alphaTest_)
{
glAlphaFunc(GL_GREATER, material_.alpha_clip_ );
glAlphaFunc(GL_GREATER, material_.alphaClip_ );
glEnable(GL_ALPHA_TEST);
}
else
......@@ -161,15 +161,15 @@ void MaterialNode::enter(GLState& _state, DrawModes::DrawMode _drawmode )
if (applyProperties_ & Blending)
{
materialBackup_.blending_ = _state.blending();
glGetIntegerv( GL_BLEND_SRC, (GLint*) &materialBackup_.blend_param1_);
glGetIntegerv( GL_BLEND_DST, (GLint*) &materialBackup_.blend_param2_);
glGetIntegerv( GL_BLEND_SRC, (GLint*) &materialBackup_.blendParam1_);
glGetIntegerv( GL_BLEND_DST, (GLint*) &materialBackup_.blendParam2_);
_state.set_blending(material_.blending_);
if (material_.blending_)
{
glDepthFunc(GL_LEQUAL);
glBlendFunc(material_.blend_param1_, material_.blend_param2_);
glBlendFunc(material_.blendParam1_, material_.blendParam2_);
glEnable(GL_BLEND);
}
else
......@@ -182,9 +182,9 @@ void MaterialNode::enter(GLState& _state, DrawModes::DrawMode _drawmode )
if (applyProperties_ & BackFaceCulling)
{
materialBackup_.backface_culling_ = glIsEnabled(GL_CULL_FACE);
materialBackup_.backfaceCulling_ = glIsEnabled(GL_CULL_FACE);
if ( material_.backface_culling_ )
if ( material_.backfaceCulling_ )
glEnable( GL_CULL_FACE );
else
glDisable( GL_CULL_FACE );
......@@ -194,9 +194,9 @@ void MaterialNode::enter(GLState& _state, DrawModes::DrawMode _drawmode )
if ( ( applyProperties_ & ColorMaterial ) && ( (_drawmode & DrawModes::SOLID_FACES_COLORED_FLAT_SHADED) ||
(_drawmode & DrawModes::SOLID_2DTEXTURED_FACE_SHADED) ) )
{
materialBackup_.color_material_ = glIsEnabled(GL_COLOR_MATERIAL);
materialBackup_.colorMaterial_ = glIsEnabled(GL_COLOR_MATERIAL);
if (material_.color_material_ ) {
if (material_.colorMaterial_ ) {
glDisable( GL_COLOR_MATERIAL );
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
glEnable( GL_COLOR_MATERIAL );
......@@ -227,34 +227,34 @@ void MaterialNode::leave(GLState& _state, DrawModes::DrawMode _drawmode )
{
if (applyProperties_ & BaseColor)
{
_state.set_base_color(materialBackup_.base_color_);
_state.set_base_color(materialBackup_.baseColor_);
}
if (applyProperties_ & Material)
{
_state.set_ambient_color(materialBackup_.ambient_color_);
_state.set_diffuse_color(materialBackup_.diffuse_color_);
_state.set_specular_color(materialBackup_.specular_color_);
_state.set_ambient_color(materialBackup_.ambientColor_);
_state.set_diffuse_color(materialBackup_.diffuseColor_);
_state.set_specular_color(materialBackup_.specularColor_);
_state.set_shininess(materialBackup_.shininess_);
}
if (applyProperties_ & PointSize)
{
_state.set_point_size(materialBackup_.point_size_);
_state.set_point_size(materialBackup_.pointSize_);
}
if (applyProperties_ & LineWidth)
{
_state.set_line_width(materialBackup_.line_width_);
_state.set_line_width(materialBackup_.lineWidth_);
}
if (applyProperties_ & RoundPoints)
{
if( materialBackup_.round_points_)
if( materialBackup_.roundPoints_)
glEnable(GL_POINT_SMOOTH);
else
glDisable(GL_POINT_SMOOTH);
......@@ -262,20 +262,20 @@ void MaterialNode::leave(GLState& _state, DrawModes::DrawMode _drawmode )
if (applyProperties_ & LineSmooth)
{
if( materialBackup_.lines_smooth_)
if( materialBackup_.linesSmooth_)
glEnable(GL_LINE_SMOOTH);
else
glDisable(GL_LINE_SMOOTH);
}
if (applyProperties_ & MultiSampling)
_state.set_multisampling( materialBackup_.multi_sampling_ );
_state.set_multisampling( materialBackup_.multiSampling_ );
if (applyProperties_ & AlphaTest)
{
if (materialBackup_.alpha_test_)
if (materialBackup_.alphaTest_)
{
glAlphaFunc(GL_GREATER, materialBackup_.alpha_clip_);
glAlphaFunc(GL_GREATER, materialBackup_.alphaClip_);
glEnable(GL_ALPHA_TEST);
}
else
......@@ -292,7 +292,7 @@ void MaterialNode::leave(GLState& _state, DrawModes::DrawMode _drawmode )
if (materialBackup_.blending_)
{
glDepthFunc(GL_LEQUAL);
glBlendFunc(materialBackup_.blend_param1_, materialBackup_.blend_param2_);
glBlendFunc(materialBackup_.blendParam1_, materialBackup_.blendParam2_);
glEnable(GL_BLEND);
}
else
......@@ -305,7 +305,7 @@ void MaterialNode::leave(GLState& _state, DrawModes::DrawMode _drawmode )
if (applyProperties_ & BackFaceCulling)
{
if (materialBackup_.backface_culling_)
if (materialBackup_.backfaceCulling_)
glEnable( GL_CULL_FACE );
else
glDisable( GL_CULL_FACE );
......@@ -314,7 +314,7 @@ void MaterialNode::leave(GLState& _state, DrawModes::DrawMode _drawmode )
if ( ( applyProperties_ & ColorMaterial ) && ( (_drawmode & DrawModes::SOLID_FACES_COLORED_FLAT_SHADED) ||
(_drawmode & DrawModes::SOLID_2DTEXTURED_FACE_SHADED) ) )
{
if (materialBackup_.color_material_ ) {
if (materialBackup_.colorMaterial_ ) {
glEnable( GL_COLOR_MATERIAL );
} else
glDisable( GL_COLOR_MATERIAL );
......@@ -345,7 +345,7 @@ MaterialNode::read(std::istream& _is)
{
if (sscanf(s, "BaseColor %f %f %f %f", &x, &y, &z, &u))
{
material_.set_base_color(Vec4f(x,y,z,u));
material_.baseColor(Vec4f(x,y,z,u));
}
}
// AmbientColor
......@@ -353,7 +353,7 @@ MaterialNode::read(std::istream& _is)
{
if (sscanf(s, "AmbientColor %f %f %f %f", &x, &y, &z, &u))
{
material_.set_ambient_color(Vec4f(x,y,z,u));
material_.ambientColor(Vec4f(x,y,z,u));
}
}
// DiffuseColor
......@@ -361,7 +361,7 @@ MaterialNode::read(std::istream& _is)
{
if (sscanf(s, "DiffuseColor %f %f %f %f", &x, &y, &z, &u))
{
material_.set_diffuse_color(Vec4f(x,y,z,u));
material_.diffuseColor(Vec4f(x,y,z,u));
}
}
// SpecularColor
......@@ -369,7 +369,7 @@ MaterialNode::read(std::istream& _is)
{
if (sscanf(s, "SpecularColor %f %f %f %f", &x, &y, &z, &u))
{
material_.set_specular_color(Vec4f(x,y,z,u));
material_.specularColor(Vec4f(x,y,z,u));
}
}
// Shininess
......@@ -377,7 +377,7 @@ MaterialNode::read(std::istream& _is)
{
if (sscanf(s, "Shininess %f", &x))
{
material_.set_shininess(x);
material_.shininess(x);
}
}
// PointSize
......@@ -385,7 +385,7 @@ MaterialNode::read(std::istream& _is)
{
if (sscanf(s, "PointSize %f", &x))
{
material_.set_point_size(x);
material_.pointSize(x);
}
}
// LineWidth
......@@ -393,7 +393,7 @@ MaterialNode::read(std::istream& _is)
{
if (sscanf(s, "LineWidth %f", &x))
{
material_.set_line_width(x);
material_.lineWidth(x);
}
}
......
......@@ -74,200 +74,201 @@ namespace SceneGraph {
class ACGDLLEXPORT Material {
friend class MaterialNode;
friend class MaterialNode;
public:
/// Default constructor
Material() :
base_color_(GLState::default_base_color),
ambient_color_(GLState::default_ambient_color),
diffuse_color_(GLState::default_diffuse_color),
specular_color_(GLState::default_specular_color),
baseColor_(GLState::default_base_color),
ambientColor_(GLState::default_ambient_color),
diffuseColor_(GLState::default_diffuse_color),
specularColor_(GLState::default_specular_color),
shininess_(GLState::default_shininess),
point_size_(1.0),
line_width_(1.0),
round_points_(false),
lines_smooth_(false),
alpha_test_(false),
alpha_clip_(0),
reflectance_(0.0),
pointSize_(1.0),
lineWidth_(1.0),
roundPoints_(false),
linesSmooth_(false),
alphaTest_(false),
alphaClip_(0),
blending_(false),
blend_param1_(GL_ONE),
blend_param2_(GL_ZERO),
color_material_(true),
backface_culling_(false),
multi_sampling_(true) {};
blendParam1_(GL_ONE),
blendParam2_(GL_ZERO),
colorMaterial_(true),
backfaceCulling_(false),
multiSampling_(true) {};
/// Deconstructor
virtual ~Material() {};
/// Copy constructor
Material(const Material& _m) :
base_color_(_m.base_color_),
ambient_color_(_m.ambient_color_),
diffuse_color_(_m.diffuse_color_),
specular_color_(_m.specular_color_),
baseColor_(_m.baseColor_),
ambientColor_(_m.ambientColor_),
diffuseColor_(_m.diffuseColor_),
specularColor_(_m.specularColor_),
shininess_(_m.shininess_),
mirror_(_m.mirror_),
point_size_(_m.point_size_),
line_width_(_m.line_width_),
round_points_(_m.round_points_),
lines_smooth_(_m.lines_smooth_),
alpha_test_(_m.alpha_test_),
alpha_clip_(_m.alpha_clip_),
reflectance_(_m.reflectance_),
pointSize_(_m.pointSize_),
lineWidth_(_m.lineWidth_),
roundPoints_(_m.roundPoints_),
linesSmooth_(_m.linesSmooth_),
alphaTest_(_m.alphaTest_),
alphaClip_(_m.alphaClip_),
blending_(_m.blending_),
blend_param1_(_m.blend_param1_),
blend_param2_(_m.blend_param2_),
color_material_(_m.color_material_),
backface_culling_(_m.backface_culling_),
multi_sampling_(_m.multi_sampling_) {};
blendParam1_(_m.blendParam1_),
blendParam2_(_m.blendParam2_),
colorMaterial_(_m.colorMaterial_),
backfaceCulling_(_m.backfaceCulling_),
multiSampling_(_m.multiSampling_) {};
/// set color (base, ambient, diffuse, specular) based on _c
void set_color(const Vec4f& _c) {
void color(const Vec4f& _c) {
Vec4f c;
set_base_color(_c);
c = _c * 0.2f; c[3]=_c[3]; set_ambient_color(c);
c = _c * 0.6f; c[3]=_c[3]; set_diffuse_color(c);
c = _c * 0.8f; c[3]=_c[3]; set_specular_color(c);
baseColor(_c);
c = _c * 0.2f; c[3]=_c[3]; ambientColor(c);
c = _c * 0.6f; c[3]=_c[3]; diffuseColor(c);
c = _c * 0.8f; c[3]=_c[3]; specularColor(c);
}
/// set the base color
void set_base_color(const Vec4f& _c) { base_color_ = _c;}
void baseColor(const Vec4f& _c) { baseColor_ = _c;}
/// get the base color
const Vec4f& base_color() const { return base_color_; }
const Vec4f& baseColor() const { return baseColor_; }
/// set the ambient color.
void set_ambient_color(const Vec4f& _a) { ambient_color_ = _a; }
void ambientColor(const Vec4f& _a) { ambientColor_ = _a; }
/// get the ambient color.
const Vec4f& ambient_color() const { return ambient_color_; }
const Vec4f& ambientColor() const { return ambientColor_; }
/// set the diffuse color.
void set_diffuse_color(const Vec4f& _d) { diffuse_color_ = _d; }
void diffuseColor(const Vec4f& _d) { diffuseColor_ = _d; }
/// get the diffuse color.
const Vec4f& diffuse_color() const { return diffuse_color_; }
const Vec4f& diffuseColor() const { return diffuseColor_; }
/// set the specular color
void set_specular_color(const Vec4f& _s) { specular_color_ = _s; }
void specularColor(const Vec4f& _s) { specularColor_ = _s; }
/// get the specular color
const Vec4f& specular_color() const { return specular_color_; }
const Vec4f& specularColor() const { return specularColor_; }
/// Set colorMaterial
void color_material( const bool _cm) { color_material_ = _cm; }
void colorMaterial( const bool _cm) { colorMaterial_ = _cm; }
/// Enable Color Material
void enable_color_material() { color_material_ = true; }
void enableColorMaterial() { colorMaterial_ = true; }
/// Disable Color Material
void disable_color_material() { color_material_ = false; }
void disableColorMaterial() { colorMaterial_ = false; }
/// get colorMaterial state
bool color_material() { return color_material_; }
bool colorMaterial() { return colorMaterial_; }
/// set shininess
void set_shininess(float _s) { shininess_ = _s; }
void shininess(float _s) { shininess_ = _s; }
/// get shininess
float shininess() const { return shininess_; }
/// set mirror
void set_mirror(double _m) { mirror_ = _m; }
/// get mirror
double mirror() const { return mirror_; }
/// set reflectance ( not used in OpenGL Rendering)
void reflectance(double _m) { reflectance_ = _m; }
/// get reflectance ( not used in OpenGL Rendering)
double reflectance() const { return reflectance_; }
/// set point size (default: 1.0)
void set_point_size(float _sz) { point_size_ = _sz; }
void pointSize(float _sz) { pointSize_ = _sz; }
/// get point size
float point_size() const { return point_size_; }
float pointSize() const { return pointSize_; }
/// set line width (default: 1.0)
void set_line_width(float _sz) { line_width_ = _sz; }
void lineWidth(float _sz) { lineWidth_ = _sz; }
/// get line width
float line_width() const { return line_width_; }
float lineWidth() const { return lineWidth_; }
/// set: round points enabled
void set_round_points(bool _b) { round_points_ = _b; }
void roundPoints(bool _b) { roundPoints_ = _b; }
/// get: round points enabled
bool round_points() const { return round_points_; }
bool roundPoints() const { return roundPoints_; }
/// set: smooth lines enabled
void set_line_smooth(bool _b) { lines_smooth_ = _b; }
void lineSmooth(bool _b) { linesSmooth_ = _b; }
/// get: rsmooth lines enabled
bool line_smooth() const { return lines_smooth_; }
bool lineSmooth() const { return linesSmooth_; }
/// enable alpha test (draw pixels if alpha >= _clip)
void enable_alpha_test(float _clip) {
alpha_test_ = true; alpha_clip_ = _clip;
void enableAlphaTest(float _clip) {
alphaTest_ = true; alphaClip_ = _clip;
}
/// disable alpha test
void disable_alpha_test() { alpha_test_ = false; }
void disableAlphaTest() { alphaTest_ = false; }
/// Return state of Alpha test
bool alpha_test() { return alpha_test_; };
bool alphaTest() { return alphaTest_; };
/// Enable Multisampling
void enable_multisampling() {
multi_sampling_ = true;
void enableMultisampling() {
multiSampling_ = true;
}
/// enable alpha test (draw pixels if alpha >= _clip)
void disable_multisampling() {
multi_sampling_ = false;
void disableMultisampling() {
multiSampling_ = false;
}
/// Get state of multisampling
bool multi_sampling() {
return multi_sampling_;
bool multiSampling() {
return multiSampling_;
}
/// Set state of multisampling
void set_multisampling( bool _state ) {
multi_sampling_ = _state;
void multisampling( bool _state ) {
multiSampling_ = _state;
}
///get current alpha value for alpha_test
float alpha_value(){ return alpha_clip_; };
float alphaValue(){ return alphaClip_; };
bool blending() { return blending_; };
GLenum blending_param1() { return blend_param1_; };
GLenum blending_param2() { return blend_param2_; };
GLenum blendingParam1() { return blendParam1_; };
GLenum blendingParam2() { return blendParam2_; };
/// enable blending with Parameters (_p1, _p2)
void enable_blending(GLenum _p1 = GL_SRC_ALPHA,
void enableBlending(GLenum _p1 = GL_SRC_ALPHA,
GLenum _p2 = GL_ONE_MINUS_SRC_ALPHA)
{ blending_ = true; blend_param1_ = _p1; blend_param2_ = _p2; }
{ blending_ = true; blendParam1_ = _p1; blendParam2_ = _p2; }
/// disable blending
void disable_blending() { blending_ = false; }
void disableBlending() { blending_ = false; }
bool backface_culling() { return backface_culling_; };
bool backfaceCulling() { return backfaceCulling_; };
/// enable backface culling (not active by default, see applyProperties)
void enable_backface_culling() { backface_culling_ = true; }
void enableBackfaceCulling() { backfaceCulling_ = true; }
/// disable backface culling (not active by default, see applyProperties)
void disable_backface_culling() { backface_culling_ = false; }
void disableBackfaceCulling() { backfaceCulling_ = false; }
protected:
Vec4f base_color_;
Vec4f ambient_color_;
Vec4f diffuse_color_;
Vec4f specular_color_;
Vec4f baseColor_;
Vec4f ambientColor_;
Vec4f diffuseColor_;
Vec4f specularColor_;
float shininess_;
double mirror_;
float point_size_;
float line_width_;
double reflectance_;
float pointSize_;
float lineWidth_;
bool round_points_;
bool lines_smooth_;
bool roundPoints_;
bool linesSmooth_;
bool alpha_test_;
float alpha_clip_;
bool alphaTest_;
float alphaClip_;
bool blending_;
GLenum blend_param1_;
GLenum blend_param2_;
GLenum blendParam1_;
GLenum blendParam2_;
bool color_material_;
bool backface_culling_;
bool colorMaterial_;
bool backfaceCulling_;
bool multi_sampling_;
bool multiSampling_;
};
......@@ -353,47 +354,47 @@ public:
/// set color (base, ambient, diffuse, specular) based on _c
void set_color(const Vec4f& _c) {
material_.set_color(_c);
material_.color(_c);
}
/// set the base color
void set_base_color(const Vec4f& _c) { material_.set_base_color(_c); }
void set_base_color(const Vec4f& _c) { material_.baseColor(_c); }
/// get the base color
const Vec4f& base_color() const { return material_.base_color(); }
const Vec4f& base_color() const { return material_.baseColor(); }
/// set the ambient color.