From f5108459be773fd6580ee2ed5f1a5593c45d2a2f Mon Sep 17 00:00:00 2001 From: OpenSceneGraph git repository Date: Fri, 5 Jan 2018 09:41:32 +0000 Subject: [PATCH] Fixed indentation and spacing issues --- src/osg/Sampler.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/osg/Sampler.cpp b/src/osg/Sampler.cpp index 3f83debd2..803362d13 100644 --- a/src/osg/Sampler.cpp +++ b/src/osg/Sampler.cpp @@ -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 ©op ):StateAttribute(sampler,copyop), _wrap_s(sampler._wrap_s), _wrap_t(sampler._wrap_t), @@ -58,8 +59,8 @@ Sampler::Sampler(const Sampler& sampler,const CopyOp ©op ):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<<")"<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()->glBindSampler( state.getActiveTextureUnit(), _PCsampler[contextID] ); - } void Sampler::releaseGLObjects(State* state) const @@ -239,7 +239,9 @@ void Sampler::releaseGLObjects(State* state) const state->get()->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. } -