{
}
-void Renderer::SetShader( Shader* shader )
-{
- mShader = shader;
-}
-
-void Renderer::SetUseBlend( bool useBlend )
+void Renderer::SetDataProvider( NodeDataProvider* dataProvider )
{
- mUseBlend = useBlend;
+ mDataProvider = dataProvider;
}
-void Renderer::SetBlendingOptions( unsigned int options )
-{
- mBlendingOptions.SetBitmask( options );
-}
-
-void Renderer::SetBlendColor( const Vector4& color )
+void Renderer::SetShader( Shader* shader )
{
- mBlendingOptions.SetBlendColor( color );
+ mShader = shader;
}
void Renderer::SetCullFace( CullFaceMode mode )
}
// Calculate the MVP matrix first so we can do the culling test
- const Matrix& modelMatrix = mDataProvider.GetModelMatrix( bufferIndex );
+ const Matrix& modelMatrix = mDataProvider->GetModelMatrix( bufferIndex );
Matrix::Multiply( gModelViewProjectionMatrix, modelViewMatrix, projectionMatrix );
// Get the program to use:
GLint loc = program->GetUniformLocation( Program::UNIFORM_COLOR );
if( Program::UNIFORM_UNKNOWN != loc )
{
- const Vector4& color = mDataProvider.GetRenderColor( bufferIndex );
+ const Vector4& color = mDataProvider->GetRenderColor( bufferIndex );
program->SetUniform4f( loc, color.r, color.g, color.b, color.a );
}
loc = program->GetUniformLocation(Program::UNIFORM_TIME_DELTA);
context.CullFace( mCullFaceMode );
}
-// can be overridden by deriving class
-void Renderer::DoSetBlending(Context& context, BufferIndex bufferIndex )
-{
- // Enables/disables blending mode.
- context.SetBlend( mUseBlend );
-
- // Set the blend color
- const Vector4* const customColor = mBlendingOptions.GetBlendColor();
- if( customColor )
- {
- context.SetCustomBlendColor( *customColor );
- }
- else
- {
- context.SetDefaultBlendColor();
- }
-
- // Set blend source & destination factors
- context.BlendFuncSeparate( mBlendingOptions.GetBlendSrcFactorRgb(),
- mBlendingOptions.GetBlendDestFactorRgb(),
- mBlendingOptions.GetBlendSrcFactorAlpha(),
- mBlendingOptions.GetBlendDestFactorAlpha() );
-
- // Set blend equations
- context.BlendEquationSeparate( mBlendingOptions.GetBlendEquationRgb(),
- mBlendingOptions.GetBlendEquationAlpha() );
-
-}
-
Renderer::Renderer( NodeDataProvider& dataprovider )
-: mDataProvider( dataprovider ),
+: mDataProvider( &dataprovider ),
mContextDELETEME(NULL),
mTextureCacheDELETEME( NULL ),
mShader( NULL ),
mSamplerBitfield( ImageSampler::PackBitfield( FilterMode::DEFAULT, FilterMode::DEFAULT ) ),
- mUseBlend( false ),
mCullFaceMode( CullNone )
{
}