فهرست منبع

Apply suggestions from code review

marauder2k7 2 سال پیش
والد
کامیت
63b2aba467

+ 5 - 4
Engine/source/gfx/D3D11/gfxD3D11StateBlock.cpp

@@ -186,10 +186,11 @@ GFXD3D11StateBlock::GFXD3D11StateBlock(const GFXStateBlockDesc& desc)
          else
             mSamplerDesc[i].Filter = comparison ? D3D11_FILTER_COMPARISON_ANISOTROPIC : D3D11_FILTER_ANISOTROPIC;
 
-         mSamplerDesc[i].BorderColor[0] = gfxSamplerState.borderColor.red;
-         mSamplerDesc[i].BorderColor[1] = gfxSamplerState.borderColor.green;
-         mSamplerDesc[i].BorderColor[2] = gfxSamplerState.borderColor.blue;
-         mSamplerDesc[i].BorderColor[3] = gfxSamplerState.borderColor.alpha;
+         LinearColorF bc = LinearColorF(gfxSamplerState.borderColor);
+         mSamplerDesc[i].BorderColor[0] = bc.red;
+         mSamplerDesc[i].BorderColor[1] = bc.green;
+         mSamplerDesc[i].BorderColor[2] = bc.blue;
+         mSamplerDesc[i].BorderColor[3] = bc.alpha;
          mSamplerDesc[i].ComparisonFunc = GFXD3D11CmpFunc[gfxSamplerState.samplerFunc];
 
          hr = D3D11DEVICE->CreateSamplerState(&mSamplerDesc[i], &mSamplerStates[i]);

+ 1 - 1
Engine/source/gfx/gfxStateBlock.cpp

@@ -278,7 +278,7 @@ GFXSamplerStateDesc::GFXSamplerStateDesc()
    samplerFunc = GFXCmpNever;
    maxAnisotropy = 1;
    mipLODBias = 0.0f;
-   borderColor = LinearColorF::WHITE;
+   borderColor = ColorI::WHITE;
 }
 
 GFXSamplerStateDesc GFXSamplerStateDesc::getWrapLinear()

+ 1 - 1
Engine/source/gfx/gfxStateBlock.h

@@ -49,7 +49,7 @@ struct GFXSamplerStateDesc
 
    GFXCmpFunc samplerFunc;
 
-   LinearColorF borderColor;
+   ColorI borderColor;
 
    /// The maximum anisotropy used when one of the filter types
    /// is set to anisotropic.

+ 3 - 1
Engine/source/gfx/gl/gfxGLTextureObject.cpp

@@ -220,7 +220,9 @@ void GFXGLTextureObject::initSamplerState(const GFXSamplerStateDesc &ssd)
    if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() )
       glTexParameterf(mBinding, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy);
 
-   glTexParameterfv(mBinding, GL_TEXTURE_BORDER_COLOR, ssd.borderColor);
+   LinearColorF bc = LinearColorF(ssd.borderColor);
+   GLfloat color[4]={bc.red, bc.green, bc.blue, bc.alpha};
+   glTexParameterfv(mBinding, GL_TEXTURE_BORDER_COLOR, color);
    mNeedInitSamplerState = false;
    mSampler = ssd;
 }

+ 1 - 1
Engine/source/gfx/sim/gfxStateBlockData.cpp

@@ -315,7 +315,7 @@ void GFXSamplerStateData::initPersistFields()
 
    endGroup( "Filter State" );
 
-   addField("borderColor", TypeColorF, Offset(mState.borderColor, GFXSamplerStateData), "");
+   addField("borderColor", TypeColorI, Offset(mState.borderColor, GFXSamplerStateData), "");
 
    addField("samplerFunc", TypeGFXCmpFunc, Offset(mState.samplerFunc, GFXSamplerStateData),
       "Compares sampled data against existing sampled data.  The default is GFXCmpNever.");