{"uMvpMatrix", GL_FLOAT_MAT4, 1},
{"uNormalMatrix", GL_FLOAT_MAT4, 1},
{"uProjection", GL_FLOAT_MAT4, 1},
+ {"uScale", GL_FLOAT_VEC3, 1},
{"uSize", GL_FLOAT_VEC3, 1},
{"uViewMatrix", GL_FLOAT_MAT4, 1},
{"uLightCameraProjectionMatrix", GL_FLOAT_MAT4, 1},
UniformData("uMvpMatrix", Property::Type::MATRIX),
UniformData("uNormalMatrix", Property::Type::MATRIX3),
UniformData("uProjection", Property::Type::MATRIX),
+ UniformData("uScale", Property::Type::VECTOR3),
UniformData("uSize", Property::Type::VECTOR3),
UniformData("uViewMatrix", Property::Type::MATRIX),
UniformData("uLightCameraProjectionMatrix", Property::Type::MATRIX),
for(auto queue = 0u; queue < MAX_QUEUE; ++queue)
{
// Render the item. It will write into the command buffer everything it has to render
- item.mRenderer->Render(secondaryCommandBuffer, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix, viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque, instruction, queue);
+ item.mRenderer->Render(secondaryCommandBuffer, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix, viewMatrix, projectionMatrix, item.mScale, item.mSize, !item.mIsOpaque, instruction, queue);
}
}
}
RenderItem::RenderItem()
: mModelMatrix(false),
mModelViewMatrix(false),
+ mScale(),
mSize(),
mRenderer{},
mNode(nullptr),
Matrix mModelMatrix;
Matrix mModelViewMatrix;
+ Vector3 mScale;
Vector3 mSize;
Vector4 mUpdateArea; ///< Update area hint is provided for damaged area calculation. (x, y, width, height)
Render::RendererKey mRenderer;
const Matrix& modelViewMatrix,
const Matrix& viewMatrix,
const Matrix& projectionMatrix,
+ const Vector3& scale,
const Vector3& size,
bool blend,
const Dali::Internal::SceneGraph::RenderInstruction& instruction,
if(queueIndex == 0)
{
- std::size_t nodeIndex = BuildUniformIndexMap(bufferIndex, node, size, *program);
- WriteUniformBuffer(bufferIndex, commandBuffer, program, instruction, node, modelMatrix, modelViewMatrix, viewMatrix, projectionMatrix, size, nodeIndex);
+ std::size_t nodeIndex = BuildUniformIndexMap(bufferIndex, node, *program);
+ WriteUniformBuffer(bufferIndex, commandBuffer, program, instruction, node, modelMatrix, modelViewMatrix, viewMatrix, projectionMatrix, scale, size, nodeIndex);
}
// @todo We should detect this case much earlier to prevent unnecessary work
// Reuse latest bound vertex attributes location, or Bind buffers to attribute locations.
return drawn;
}
-std::size_t Renderer::BuildUniformIndexMap(BufferIndex bufferIndex, const SceneGraph::NodeDataProvider& node, const Vector3& size, Program& program)
+std::size_t Renderer::BuildUniformIndexMap(BufferIndex bufferIndex, const SceneGraph::NodeDataProvider& node, Program& program)
{
// Check if the map has changed
DALI_ASSERT_DEBUG(mRenderDataProvider && "No Uniform map data provider available");
const Matrix& modelViewMatrix,
const Matrix& viewMatrix,
const Matrix& projectionMatrix,
+ const Vector3& scale,
const Vector3& size,
std::size_t nodeIndex)
{
WriteDefaultUniformV2(normalUniformInfo, uboViews, normalMatrix);
}
+ WriteDefaultUniformV2(program->GetDefaultUniform(Program::DefaultUniformIndex::SCALE), uboViews, scale);
+
Vector4 finalColor; ///< Applied renderer's opacity color
const Vector4& color = node.GetRenderColor(bufferIndex); ///< Actor's original color
if(mPremultipliedAlphaEnabled)
{
finalColor = Vector4(color.r, color.g, color.b, color.a * mRenderDataProvider->GetOpacity(bufferIndex));
}
-
WriteDefaultUniformV2(program->GetDefaultUniform(Program::DefaultUniformIndex::COLOR), uboViews, finalColor);
WriteDefaultUniformV2(program->GetDefaultUniform(Program::DefaultUniformIndex::ACTOR_COLOR), uboViews, color);
* @param[in] modelViewMatrix The model-view matrix.
* @param[in] viewMatrix The view matrix.
* @param[in] projectionMatrix The projection matrix.
+ * @param[in] scale Scale factor of the render item
* @param[in] size Size of the render item
* @param[in] blend If true, blending is enabled
* @param[in] instruction. for use case like reflection where CullFace needs to be adjusted
const Matrix& modelViewMatrix,
const Matrix& viewMatrix,
const Matrix& projectionMatrix,
+ const Vector3& scale,
const Vector3& size,
bool blend,
const Dali::Internal::SceneGraph::RenderInstruction& instruction,
* Builds a uniform map based on the index of the cached location in the Program.
* @param[in] bufferIndex The index of the previous update buffer.
* @param[in] node The node using the renderer
- * @param[in] size The size of the renderer
* @param[in] program The shader program on which to set the uniforms.
*
* @return the index of the node in change counters store / uniform maps store.
*/
- std::size_t BuildUniformIndexMap(BufferIndex bufferIndex, const SceneGraph::NodeDataProvider& node, const Vector3& size, Program& program);
+ std::size_t BuildUniformIndexMap(BufferIndex bufferIndex, const SceneGraph::NodeDataProvider& node, Program& program);
/**
* Bind the textures and setup the samplers
* @param[in] modelViewMatrix The model-view matrix.
* @param[in] viewMatrix The view matrix.
* @param[in] projectionMatrix The projection matrix.
+ * @param[in] scale Scale factor of the render item
* @param[in] size Size of the render item
* @param[in] blend If true, blending is enabled
* @param[in] instruction The render instruction
const Matrix& modelViewMatrix,
const Matrix& viewMatrix,
const Matrix& projectionMatrix,
+ const Vector3& scale,
const Vector3& size,
std::size_t nodeIndex);
CalculateHash(std::string("uModelView")),
CalculateHash(std::string("uNormalMatrix")),
CalculateHash(std::string("uProjection")),
+ CalculateHash(std::string("uScale")),
CalculateHash(std::string("uSize")),
CalculateHash(std::string("uColor")),
CalculateHash(std::string("uActorColor"))};
MODEL_VIEW_MATRIX,
NORMAL_MATRIX,
PROJECTION_MATRIX,
+ SCALE,
SIZE,
COLOR,
ACTOR_COLOR,
bool inside(true);
Node* node = renderable.mNode;
Matrix nodeWorldMatrix(false);
+ Vector3 nodeScale;
Vector3 nodeSize;
Vector4 nodeUpdateArea;
bool nodeUpdateAreaSet(false);
SetNodeUpdateArea(node, isLayer3d, nodeWorldMatrix, nodeSize, nodeUpdateArea);
nodeUpdateAreaSet = true;
- const Vector3& scale = nodeWorldMatrix.GetScale();
- const Vector3& size = Vector3(nodeUpdateArea.z, nodeUpdateArea.w, 0.0f) * scale;
+ nodeScale = nodeWorldMatrix.GetScale();
+
+ const Vector3& size = Vector3(nodeUpdateArea.z, nodeUpdateArea.w, 0.0f) * nodeScale;
if(size.LengthSquared() > Math::MACHINE_EPSILON_1000)
{
if(!nodeUpdateAreaSet)
{
SetNodeUpdateArea(node, isLayer3d, nodeWorldMatrix, nodeSize, nodeUpdateArea);
+ nodeScale = nodeWorldMatrix.GetScale();
}
+ item.mScale = nodeScale;
item.mSize = nodeSize;
item.mUpdateArea = nodeUpdateArea;
item.mModelMatrix = nodeWorldMatrix;