Ran script to remove trailing spaces and tabs
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
@@ -33,22 +33,22 @@ struct FindRangeOperator
|
||||
_bmax(-FLT_MAX),
|
||||
_amin(FLT_MAX),
|
||||
_amax(-FLT_MAX) {}
|
||||
|
||||
|
||||
float _rmin, _rmax, _gmin, _gmax, _bmin, _bmax, _amin, _amax;
|
||||
|
||||
inline void luminance(float l) { rgba(l,l,l,l); }
|
||||
inline void alpha(float a) { rgba(1.0f,1.0f,1.0f,a); }
|
||||
inline void luminance_alpha(float l,float a) { rgba(l,l,l,a); }
|
||||
inline void luminance(float l) { rgba(l,l,l,l); }
|
||||
inline void alpha(float a) { rgba(1.0f,1.0f,1.0f,a); }
|
||||
inline void luminance_alpha(float l,float a) { rgba(l,l,l,a); }
|
||||
inline void rgb(float r,float g,float b) { rgba(r,g,b,1.0f); }
|
||||
inline void rgba(float r,float g,float b,float a)
|
||||
{
|
||||
_rmin = osg::minimum(r,_rmin);
|
||||
_rmax = osg::maximum(r,_rmax);
|
||||
_gmin = osg::minimum(g,_gmin);
|
||||
_gmax = osg::maximum(g,_gmax);
|
||||
_bmin = osg::minimum(b,_bmin);
|
||||
_bmax = osg::maximum(b,_bmax);
|
||||
_amin = osg::minimum(a,_amin);
|
||||
_rmin = osg::minimum(r,_rmin);
|
||||
_rmax = osg::maximum(r,_rmax);
|
||||
_gmin = osg::minimum(g,_gmin);
|
||||
_gmax = osg::maximum(g,_gmax);
|
||||
_bmin = osg::minimum(b,_bmin);
|
||||
_bmax = osg::maximum(b,_bmax);
|
||||
_amin = osg::minimum(a,_amin);
|
||||
_amax = osg::maximum(a,_amax);
|
||||
}
|
||||
|
||||
@@ -59,29 +59,29 @@ struct FindRangeOperator
|
||||
struct OffsetAndScaleOperator
|
||||
{
|
||||
OffsetAndScaleOperator(const osg::Vec4& offset, const osg::Vec4& scale):
|
||||
_offset(offset),
|
||||
_offset(offset),
|
||||
_scale(scale) {}
|
||||
|
||||
osg::Vec4 _offset;
|
||||
osg::Vec4 _scale;
|
||||
|
||||
inline void luminance(float& l) const { l= _offset.r() + l*_scale.r(); }
|
||||
inline void alpha(float& a) const { a = _offset.a() + a*_scale.a(); }
|
||||
inline void luminance(float& l) const { l= _offset.r() + l*_scale.r(); }
|
||||
inline void alpha(float& a) const { a = _offset.a() + a*_scale.a(); }
|
||||
inline void luminance_alpha(float& l,float& a) const
|
||||
{
|
||||
l= _offset.r() + l*_scale.r();
|
||||
l= _offset.r() + l*_scale.r();
|
||||
a = _offset.a() + a*_scale.a();
|
||||
}
|
||||
}
|
||||
inline void rgb(float& r,float& g,float& b) const
|
||||
{
|
||||
r = _offset.r() + r*_scale.r();
|
||||
g = _offset.g() + g*_scale.g();
|
||||
r = _offset.r() + r*_scale.r();
|
||||
g = _offset.g() + g*_scale.g();
|
||||
b = _offset.b() + b*_scale.b();
|
||||
}
|
||||
inline void rgba(float& r,float& g,float& b,float& a) const
|
||||
{
|
||||
r = _offset.r() + r*_scale.r();
|
||||
g = _offset.g() + g*_scale.g();
|
||||
r = _offset.r() + r*_scale.r();
|
||||
g = _offset.g() + g*_scale.g();
|
||||
b = _offset.b() + b*_scale.b();
|
||||
a = _offset.a() + a*_scale.a();
|
||||
}
|
||||
@@ -91,7 +91,7 @@ bool computeMinMax(const osg::Image* image, osg::Vec4& minValue, osg::Vec4& maxV
|
||||
{
|
||||
if (!image) return false;
|
||||
|
||||
osg::FindRangeOperator rangeOp;
|
||||
osg::FindRangeOperator rangeOp;
|
||||
readImage(image, rangeOp);
|
||||
minValue.r() = rangeOp._rmin;
|
||||
minValue.g() = rangeOp._gmin;
|
||||
@@ -102,8 +102,8 @@ bool computeMinMax(const osg::Image* image, osg::Vec4& minValue, osg::Vec4& maxV
|
||||
maxValue.g() = rangeOp._gmax;
|
||||
maxValue.b() = rangeOp._bmax;
|
||||
maxValue.a() = rangeOp._amax;
|
||||
|
||||
return minValue.r()<=maxValue.r() &&
|
||||
|
||||
return minValue.r()<=maxValue.r() &&
|
||||
minValue.g()<=maxValue.g() &&
|
||||
minValue.b()<=maxValue.b() &&
|
||||
minValue.a()<=maxValue.a();
|
||||
@@ -114,7 +114,7 @@ bool offsetAndScaleImage(osg::Image* image, const osg::Vec4& offset, const osg::
|
||||
if (!image) return false;
|
||||
|
||||
modifyImage(image,OffsetAndScaleOperator(offset, scale));
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -174,10 +174,10 @@ struct RecordRowOperator
|
||||
|
||||
mutable std::vector<osg::Vec4> _colours;
|
||||
mutable unsigned int _pos;
|
||||
|
||||
inline void luminance(float l) const { rgba(l,l,l,1.0f); }
|
||||
inline void alpha(float a) const { rgba(1.0f,1.0f,1.0f,a); }
|
||||
inline void luminance_alpha(float l,float a) const { rgba(l,l,l,a); }
|
||||
|
||||
inline void luminance(float l) const { rgba(l,l,l,1.0f); }
|
||||
inline void alpha(float a) const { rgba(1.0f,1.0f,1.0f,a); }
|
||||
inline void luminance_alpha(float l,float a) const { rgba(l,l,l,a); }
|
||||
inline void rgb(float r,float g,float b) const { rgba(r,g,b,1.0f); }
|
||||
inline void rgba(float r,float g,float b,float a) const { _colours[_pos++].set(r,g,b,a); }
|
||||
};
|
||||
@@ -189,10 +189,10 @@ struct WriteRowOperator
|
||||
|
||||
std::vector<osg::Vec4> _colours;
|
||||
mutable unsigned int _pos;
|
||||
|
||||
inline void luminance(float& l) const { l = _colours[_pos++].r(); }
|
||||
inline void alpha(float& a) const { a = _colours[_pos++].a(); }
|
||||
inline void luminance_alpha(float& l,float& a) const { l = _colours[_pos].r(); a = _colours[_pos++].a(); }
|
||||
|
||||
inline void luminance(float& l) const { l = _colours[_pos++].r(); }
|
||||
inline void alpha(float& a) const { a = _colours[_pos++].a(); }
|
||||
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].r(); g = _colours[_pos].g(); b = _colours[_pos].b(); }
|
||||
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(); }
|
||||
};
|
||||
@@ -278,11 +278,11 @@ bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int
|
||||
const unsigned char* srcData = srcImage->data(src_s, src_t+row, src_r+slice);
|
||||
unsigned char* destData = destImage->data(dest_s, dest_t+row, dest_r+slice);
|
||||
unsigned int numComponents = osg::Image::computeNumComponents(destImage->getPixelFormat());
|
||||
|
||||
|
||||
_copyRowAndScale(srcData, srcImage->getDataType(), destData, destImage->getDataType(), (width*numComponents), scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -290,7 +290,7 @@ bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int
|
||||
{
|
||||
//OSG_NOTICE<<"copyImage("<<srcImage<<", "<<src_s<<", "<< src_t<<", "<<src_r<<", "<<width<<", "<<height<<", "<<depth<<std::endl;
|
||||
//OSG_NOTICE<<" "<<destImage<<", "<<dest_s<<", "<< dest_t<<", "<<dest_r<<", "<<doRescale<<")"<<std::endl;
|
||||
|
||||
|
||||
RecordRowOperator readOp(width);
|
||||
WriteRowOperator writeOp;
|
||||
|
||||
@@ -302,20 +302,20 @@ bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int
|
||||
// reset the indices to beginning
|
||||
readOp._pos = 0;
|
||||
writeOp._pos = 0;
|
||||
|
||||
|
||||
// read the pixels into readOp's _colour array
|
||||
readRow(width, srcImage->getPixelFormat(), srcImage->getDataType(), srcImage->data(src_s,src_t+row,src_r+slice), readOp);
|
||||
|
||||
|
||||
// pass readOp's _colour array contents over to writeOp (note this is just a pointer swap).
|
||||
writeOp._colours.swap(readOp._colours);
|
||||
|
||||
|
||||
modifyRow(width, destImage->getPixelFormat(), destImage->getDataType(), destImage->data(dest_s, dest_t+row,dest_r+slice), writeOp);
|
||||
|
||||
// return readOp's _colour array contents back to its rightful owner.
|
||||
writeOp._colours.swap(readOp._colours);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -327,8 +327,8 @@ struct SetToColourOperator
|
||||
SetToColourOperator(const osg::Vec4& colour):
|
||||
_colour(colour) {}
|
||||
|
||||
inline void luminance(float& l) const { l = (_colour.r()+_colour.g()+_colour.b())*0.333333; }
|
||||
inline void alpha(float& a) const { a = _colour.a(); }
|
||||
inline void luminance(float& l) const { l = (_colour.r()+_colour.g()+_colour.b())*0.333333; }
|
||||
inline void alpha(float& a) const { a = _colour.a(); }
|
||||
inline void luminance_alpha(float& l,float& a) const { l = (_colour.r()+_colour.g()+_colour.b())*0.333333; a = _colour.a(); }
|
||||
inline void rgb(float& r,float& g,float& b) const { r = _colour.r(); g = _colour.g(); b = _colour.b(); }
|
||||
inline void rgba(float& r,float& g,float& b,float& a) const { r = _colour.r(); g = _colour.g(); b = _colour.b(); a = _colour.a(); }
|
||||
@@ -341,7 +341,7 @@ bool clearImageToColor(osg::Image* image, const osg::Vec4& colour)
|
||||
if (!image) return false;
|
||||
|
||||
modifyImage(image, SetToColourOperator(colour));
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ osg::Image* createImage3D(const ImageList& imageList,
|
||||
pixelFormat==GL_BGR ||
|
||||
pixelFormat==GL_BGRA)
|
||||
{
|
||||
|
||||
|
||||
int num_s = minimum(image->s(), image_3d->s());
|
||||
int num_t = minimum(image->t(), image_3d->t());
|
||||
int num_r = minimum(image->r(), (image_3d->r() - curr_dest_r));
|
||||
@@ -492,7 +492,7 @@ osg::Image* createImage3D(const ImageList& imageList,
|
||||
curr_dest_r += num_r;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return image_3d.release();
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ struct ModulateAlphaByLuminanceOperator
|
||||
inline void rgb(float&,float&,float&) const {}
|
||||
inline void rgba(float& r,float& g,float& b,float& a) const { float l = (r+g+b)*0.3333333; a *= l;}
|
||||
};
|
||||
|
||||
|
||||
osg::Image* createImage3DWithAlpha(const ImageList& imageList,
|
||||
int s_maximumImageSize,
|
||||
int t_maximumImageSize,
|
||||
@@ -522,7 +522,7 @@ osg::Image* createImage3DWithAlpha(const ImageList& imageList,
|
||||
desiredPixelFormat = GL_RGBA;
|
||||
modulateAlphaByLuminance = true;
|
||||
}
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Image> image = createImage3D(imageList,
|
||||
desiredPixelFormat,
|
||||
s_maximumImageSize,
|
||||
|
||||
Reference in New Issue
Block a user