Changed red()/green()/blue()/alpha() to r()/g()/b()/a() for greater consistency

across Vec* classes and with OpenGL Shander Lanaguage.
This commit is contained in:
Robert Osfield 2005-09-03 20:56:25 +00:00
parent 6391691be6
commit d58487c763
3 changed files with 28 additions and 28 deletions

View File

@ -928,11 +928,11 @@ struct WriteRowOperator
std::vector<osg::Vec4> _colours; std::vector<osg::Vec4> _colours;
mutable unsigned int _pos; mutable unsigned int _pos;
inline void luminance(float& l) const { l = _colours[_pos++].red(); } inline void luminance(float& l) const { l = _colours[_pos++].r(); }
inline void alpha(float& a) const { a = _colours[_pos++].alpha(); } inline void alpha(float& a) const { a = _colours[_pos++].a(); }
inline void luminance_alpha(float& l,float& a) const { l = _colours[_pos].red(); a = _colours[_pos++].alpha(); } inline void luminance_alpha(float& l,float& a) const { l = _colours[_pos].r(); a = _colours[_pos++].a(); }
inline void rgb(float& r,float& g,float& b) const { r = _colours[_pos].red(); g = _colours[_pos].green(); b = _colours[_pos].blue(); } inline void rgb(float& r,float& g,float& b) const { r = _colours[_pos].r(); g = _colours[_pos].g(); b = _colours[_pos].b(); }
inline void rgba(float& r,float& g,float& b,float& a) const { r = _colours[_pos].red(); g = _colours[_pos].green(); b = _colours[_pos].blue(); a = _colours[_pos++].alpha(); } inline void rgba(float& r,float& g,float& b,float& a) const { r = _colours[_pos].r(); g = _colours[_pos].g(); b = _colours[_pos].b(); a = _colours[_pos++].a(); }
}; };
osg::Image* readRaw(int sizeX, int sizeY, int sizeZ, int numberBytesPerComponent, int numberOfComponents, const std::string& endian, const std::string& raw_filename) osg::Image* readRaw(int sizeX, int sizeY, int sizeZ, int numberBytesPerComponent, int numberOfComponents, const std::string& endian, const std::string& raw_filename)
@ -1063,9 +1063,9 @@ enum ColourSpaceOperation
REPLACE_ALPHA_WITH_LUMINACE REPLACE_ALPHA_WITH_LUMINACE
}; };
struct ModulatAlphaByLuminanceOperator struct ModulateAlphaByLuminanceOperator
{ {
ModulatAlphaByLuminanceOperator() {} ModulateAlphaByLuminanceOperator() {}
inline void luminance(float&) const {} inline void luminance(float&) const {}
inline void alpha(float&) const {} inline void alpha(float&) const {}
@ -1074,9 +1074,9 @@ struct ModulatAlphaByLuminanceOperator
inline void rgba(float& r,float& g,float& b,float& a) const { float l = (r+g+b)*0.3333333; a *= l;} inline void rgba(float& r,float& g,float& b,float& a) const { float l = (r+g+b)*0.3333333; a *= l;}
}; };
struct ModulatAlphaByColourOperator struct ModulateAlphaByColourOperator
{ {
ModulatAlphaByColourOperator(const osg::Vec4& colour):_colour(colour) { _lum = _colour.length(); } ModulateAlphaByColourOperator(const osg::Vec4& colour):_colour(colour) { _lum = _colour.length(); }
osg::Vec4 _colour; osg::Vec4 _colour;
float _lum; float _lum;
@ -1085,7 +1085,7 @@ struct ModulatAlphaByColourOperator
inline void alpha(float&) const {} inline void alpha(float&) const {}
inline void luminance_alpha(float& l,float& a) const { a*= l*_lum; } inline void luminance_alpha(float& l,float& a) const { a*= l*_lum; }
inline void rgb(float&,float&,float&) const {} inline void rgb(float&,float&,float&) const {}
inline void rgba(float& r,float& g,float& b,float& a) const { a = (r*_colour.red()+g*_colour.green()+b*_colour.blue()+a*_colour.alpha()); } inline void rgba(float& r,float& g,float& b,float& a) const { a = (r*_colour.r()+g*_colour.g()+b*_colour.b()+a*_colour.a()); }
}; };
struct ReplaceAlphaWithLuminanceOperator struct ReplaceAlphaWithLuminanceOperator
@ -1105,11 +1105,11 @@ void doColourSpaceConversion(ColourSpaceOperation op, osg::Image* image, osg::Ve
{ {
case (MODULATE_ALPHA_BY_LUMINANCE): case (MODULATE_ALPHA_BY_LUMINANCE):
std::cout<<"doing conversion MODULATE_ALPHA_BY_LUMINANCE"<<std::endl; std::cout<<"doing conversion MODULATE_ALPHA_BY_LUMINANCE"<<std::endl;
modifyImage(image,ModulatAlphaByLuminanceOperator()); modifyImage(image,ModulateAlphaByLuminanceOperator());
break; break;
case (MODULATE_ALPHA_BY_COLOUR): case (MODULATE_ALPHA_BY_COLOUR):
std::cout<<"doing conversion MODULATE_ALPHA_BY_COLOUR"<<std::endl; std::cout<<"doing conversion MODULATE_ALPHA_BY_COLOUR"<<std::endl;
modifyImage(image,ModulatAlphaByColourOperator(colour)); modifyImage(image,ModulateAlphaByColourOperator(colour));
break; break;
case (REPLACE_ALPHA_WITH_LUMINACE): case (REPLACE_ALPHA_WITH_LUMINACE):
std::cout<<"doing conversion REPLACE_ALPHA_WITH_LUMINACE"<<std::endl; std::cout<<"doing conversion REPLACE_ALPHA_WITH_LUMINACE"<<std::endl;

View File

@ -94,15 +94,15 @@ class Vec4d
inline value_type z() const { return _v[2]; } inline value_type z() const { return _v[2]; }
inline value_type w() const { return _v[3]; } inline value_type w() const { return _v[3]; }
inline value_type& red() { return _v[0]; } inline value_type& r() { return _v[0]; }
inline value_type& green() { return _v[1]; } inline value_type& g() { return _v[1]; }
inline value_type& blue() { return _v[2]; } inline value_type& b() { return _v[2]; }
inline value_type& alpha() { return _v[3]; } inline value_type& a() { return _v[3]; }
inline value_type red() const { return _v[0]; } inline value_type r() const { return _v[0]; }
inline value_type green() const { return _v[1]; } inline value_type g() const { return _v[1]; }
inline value_type blue() const { return _v[2]; } inline value_type b() const { return _v[2]; }
inline value_type alpha() const { return _v[3]; } inline value_type a() const { return _v[3]; }
inline unsigned long asABGR() const inline unsigned long asABGR() const

View File

@ -88,15 +88,15 @@ class Vec4f
inline value_type z() const { return _v[2]; } inline value_type z() const { return _v[2]; }
inline value_type w() const { return _v[3]; } inline value_type w() const { return _v[3]; }
inline value_type& red() { return _v[0]; } inline value_type& r() { return _v[0]; }
inline value_type& green() { return _v[1]; } inline value_type& g() { return _v[1]; }
inline value_type& blue() { return _v[2]; } inline value_type& b() { return _v[2]; }
inline value_type& alpha() { return _v[3]; } inline value_type& a() { return _v[3]; }
inline value_type red() const { return _v[0]; } inline value_type r() const { return _v[0]; }
inline value_type green() const { return _v[1]; } inline value_type g() const { return _v[1]; }
inline value_type blue() const { return _v[2]; } inline value_type b() const { return _v[2]; }
inline value_type alpha() const { return _v[3]; } inline value_type a() const { return _v[3]; }
inline unsigned long asABGR() const inline unsigned long asABGR() const
{ {