#include <dali/internal/render/shaders/scene-graph-shader.h>
#include <dali/internal/render/shaders/program.h>
#include <dali/internal/render/data-providers/node-data-provider.h>
+#include <dali/internal/render/common/render-instruction.h>
namespace Dali
{
namespace
{
-static Matrix gModelViewProjectionMatrix( false ); ///< a shared matrix to calculate the MVP matrix, dont want to store it in object to reduce storage overhead
-static Matrix3 gNormalMatrix; ///< a shared matrix to calculate normal matrix, dont want to store it in object to reduce storage overhead
/**
* Helper to set view and projection matrices once per program
loc = program.GetUniformLocation( Program::UNIFORM_MVP_MATRIX );
if( Program::UNIFORM_UNKNOWN != loc )
{
- Matrix::Multiply( gModelViewProjectionMatrix, modelViewMatrix, projectionMatrix );
- program.SetUniformMatrix4fv( loc, 1, gModelViewProjectionMatrix.AsFloat() );
+ Matrix modelViewProjectionMatrix(false);
+ Matrix::Multiply( modelViewProjectionMatrix, modelViewMatrix, projectionMatrix );
+ program.SetUniformMatrix4fv( loc, 1, modelViewProjectionMatrix.AsFloat() );
}
loc = program.GetUniformLocation( Program::UNIFORM_NORMAL_MATRIX );
if( Program::UNIFORM_UNKNOWN != loc )
{
- gNormalMatrix = modelViewMatrix;
- gNormalMatrix.Invert();
- gNormalMatrix.Transpose();
- program.SetUniformMatrix3fv( loc, 1, gNormalMatrix.AsFloat() );
+ Matrix3 normalMatrix;
+ normalMatrix = modelViewMatrix;
+ normalMatrix.Invert();
+ normalMatrix.Transpose();
+ program.SetUniformMatrix3fv( loc, 1, normalMatrix.AsFloat() );
}
}
const Matrix& projectionMatrix,
const Vector3& size,
bool blend,
- Vector<GLuint>& boundTextures )
+ Vector<GLuint>& boundTextures,
+ const Dali::Internal::SceneGraph::RenderInstruction& instruction )
{
// Get the program to use:
Program* program = mRenderDataProvider->GetShader().GetProgram();
}
//Set cull face mode
- context.CullFace( mFaceCullingMode );
+ const Dali::Internal::SceneGraph::Camera* cam = instruction.GetCamera();
+ if (cam->GetReflectionUsed())
+ {
+ auto adjFaceCullingMode = mFaceCullingMode;
+ switch( mFaceCullingMode )
+ {
+ case FaceCullingMode::Type::FRONT:
+ {
+ adjFaceCullingMode = FaceCullingMode::Type::BACK;
+ break;
+ }
+ case FaceCullingMode::Type::BACK:
+ {
+ adjFaceCullingMode = FaceCullingMode::Type::FRONT;
+ break;
+ }
+ default:
+ {
+ // nothing to do, leave culling as it is
+ }
+ }
+ context.CullFace( adjFaceCullingMode );
+ }
+ else
+ {
+ context.CullFace( mFaceCullingMode );
+ }
//Set blending mode
SetBlending( context, blend );