Fixed indentation and spacing issues

This commit is contained in:
OpenSceneGraph git repository
2018-01-05 09:41:32 +00:00
committed by GitHub
parent 662bea239c
commit f5108459be

View File

@@ -42,9 +42,10 @@ Sampler::Sampler(): StateAttribute(),
_maxlod(-1.0f),
_lodbias(0.0f)
{
_PCdirtyflags.setAllElementsTo(true);
_PCsampler.setAllElementsTo(0);
_PCdirtyflags.setAllElementsTo(true);
_PCsampler.setAllElementsTo(0);
}
Sampler::Sampler(const Sampler& sampler,const CopyOp &copyop ):StateAttribute(sampler,copyop),
_wrap_s(sampler._wrap_s),
_wrap_t(sampler._wrap_t),
@@ -58,8 +59,8 @@ Sampler::Sampler(const Sampler& sampler,const CopyOp &copyop ):StateAttribute(sa
_maxlod(sampler._maxlod),
_lodbias(sampler._lodbias)
{
_PCdirtyflags.setAllElementsTo(true);
_PCsampler.setAllElementsTo(0);
_PCdirtyflags.setAllElementsTo(true);
_PCsampler.setAllElementsTo(0);
}
void Sampler::setWrap(Texture::WrapParameter which, Texture::WrapMode wrap)
@@ -71,7 +72,6 @@ void Sampler::setWrap(Texture::WrapParameter which, Texture::WrapMode wrap)
case Texture::WRAP_R : _wrap_r = wrap; _PCdirtyflags.setAllElementsTo(true); break;
default : OSG_WARN<<"Error: invalid 'which' passed Sampler::setWrap("<<(unsigned int)which<<","<<(unsigned int)wrap<<")"<<std::endl; break;
}
}
@@ -107,6 +107,7 @@ Texture::FilterMode Sampler::getFilter(Texture::FilterParameter which) const
default : OSG_WARN<<"Error: invalid 'which' passed Sampler::getFilter(which)"<< std::endl; return _min_filter;
}
}
void Sampler::setMaxAnisotropy(float anis)
{
if (_maxAnisotropy!=anis)
@@ -116,9 +117,9 @@ void Sampler::setMaxAnisotropy(float anis)
}
}
void Sampler::setMinLOD(float func) { _minlod = func; _PCdirtyflags.setAllElementsTo(true);}
void Sampler::setMaxLOD(float func) { _maxlod = func; _PCdirtyflags.setAllElementsTo(true);}
void Sampler::setLODBias(float func) { _lodbias = func; _PCdirtyflags.setAllElementsTo(true);}
void Sampler::setMinLOD(float func) { _minlod = func; _PCdirtyflags.setAllElementsTo(true); }
void Sampler::setMaxLOD(float func) { _maxlod = func; _PCdirtyflags.setAllElementsTo(true); }
void Sampler::setLODBias(float func) { _lodbias = func; _PCdirtyflags.setAllElementsTo(true); }
/** getOrCreate Sampler Object and setup embedded Texture Parameters */
void Sampler::setShadowCompareFunc(Texture::ShadowCompareFunc func) { _shadow_compare_func = func; _PCdirtyflags.setAllElementsTo(true);}
@@ -128,7 +129,8 @@ void Sampler::setShadowTextureMode(Texture::ShadowTextureMode mode) { _shadow_te
void Sampler::setBorderColor(const Vec4d& color) { _borderColor = color; _PCdirtyflags.setAllElementsTo(true); }
void Sampler::compileGLObjects(State& state) const{
void Sampler::compileGLObjects(State& state) const
{
unsigned int contextID = state.getContextID();
if(_PCdirtyflags[contextID])
{
@@ -190,27 +192,26 @@ void Sampler::compileGLObjects(State& state) const{
if (extensions->isTextureBorderClampSupported)
{
#ifndef GL_TEXTURE_BORDER_COLOR
#define GL_TEXTURE_BORDER_COLOR 0x1004
#endif
GLfloat color[4] = {(GLfloat)_borderColor.r(), (GLfloat)_borderColor.g(), (GLfloat)_borderColor.b(), (GLfloat)_borderColor.a()};
extensions->glSamplerParameterfv(samplerobject, GL_TEXTURE_BORDER_COLOR, color);
}
extensions->glSamplerParameteri(samplerobject, GL_TEXTURE_COMPARE_MODE, _shadow_texture_mode);
extensions->glSamplerParameteri(samplerobject, GL_TEXTURE_COMPARE_FUNC, _shadow_compare_func);
if (extensions->isTextureFilterAnisotropicSupported )
if (extensions->isTextureFilterAnisotropicSupported)
{
// note, GL_TEXTURE_MAX_ANISOTROPY_EXT will either be defined
// by gl.h (or via glext.h) or by include/osg/Texture.
extensions->glSamplerParameterf(samplerobject, GL_TEXTURE_MAX_ANISOTROPY_EXT, _maxAnisotropy);
}
if( _maxlod - _minlod > 0){ // if range is valid
if(_maxlod - _minlod > 0)
{ // if range is valid
extensions->glSamplerParameterf(samplerobject, GL_TEXTURE_MIN_LOD, _minlod);
extensions->glSamplerParameterf(samplerobject, GL_TEXTURE_MAX_LOD, _maxlod);
}
@@ -223,12 +224,11 @@ void Sampler::compileGLObjects(State& state) const{
/** bind SamplerObject **/
void Sampler::apply(State&state) const
{
unsigned int contextID = state.getContextID();
if( _PCdirtyflags[contextID] )
compileGLObjects(state);
state.get<GLExtensions>()->glBindSampler( state.getActiveTextureUnit(), _PCsampler[contextID] );
}
void Sampler::releaseGLObjects(State* state) const
@@ -239,7 +239,9 @@ void Sampler::releaseGLObjects(State* state) const
state->get<GLExtensions>()->glDeleteSamplers(1,&_PCsampler[contextID]);
}
}
int Sampler::compare(const StateAttribute& sa) const{
int Sampler::compare(const StateAttribute& sa) const
{
COMPARE_StateAttribute_Types(Sampler,sa)
COMPARE_StateAttribute_Parameter(_wrap_t)
COMPARE_StateAttribute_Parameter(_wrap_r)
@@ -253,4 +255,3 @@ int Sampler::compare(const StateAttribute& sa) const{
COMPARE_StateAttribute_Parameter(_lodbias)
return 0; // passed all the above comparison macros, must be equal.
}