summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
99e2ea0)
Change-Id: I99fd9d4ae844cd66bb6621de6adb7f701f19c339
}
mImpl->mRenderer = Renderer::New( mGeometry, mShader );
}
mImpl->mRenderer = Renderer::New( mGeometry, mShader );
+ mImpl->mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
}
void PrimitiveVisual::UpdateShaderUniforms()
}
void PrimitiveVisual::UpdateShaderUniforms()
for( int i = 1; i <= slices; i++, indiceIndex += 3 )
{
indices[indiceIndex] = 0;
for( int i = 1; i <= slices; i++, indiceIndex += 3 )
{
indices[indiceIndex] = 0;
- indices[indiceIndex + 1] = i;
if( i == slices )
{
//End, so loop around.
if( i == slices )
{
//End, so loop around.
- indices[indiceIndex + 2] = 1;
+ indices[indiceIndex + 1] = 1;
- indices[indiceIndex + 2] = i + 1;
+ indices[indiceIndex + 1] = i + 1;
+ indices[indiceIndex + 2] = i;
}
//Middle Stacks. Want to form triangles between the top and bottom stacks, so loop up to the number of stacks - 2.
}
//Middle Stacks. Want to form triangles between the top and bottom stacks, so loop up to the number of stacks - 2.
{
//End, so loop around.
indices[indiceIndex] = previousCycleBeginning + j;
{
//End, so loop around.
indices[indiceIndex] = previousCycleBeginning + j;
- indices[indiceIndex + 1] = currentCycleBeginning + j;
- indices[indiceIndex + 2] = previousCycleBeginning;
+ indices[indiceIndex + 1] = previousCycleBeginning;
+ indices[indiceIndex + 2] = currentCycleBeginning + j;
indices[indiceIndex + 3] = currentCycleBeginning + j;
indices[indiceIndex + 3] = currentCycleBeginning + j;
- indices[indiceIndex + 4] = currentCycleBeginning;
- indices[indiceIndex + 5] = previousCycleBeginning;
+ indices[indiceIndex + 4] = previousCycleBeginning;
+ indices[indiceIndex + 5] = currentCycleBeginning;
}
else
{
indices[indiceIndex] = previousCycleBeginning + j;
}
else
{
indices[indiceIndex] = previousCycleBeginning + j;
- indices[indiceIndex + 1] = currentCycleBeginning + j;
- indices[indiceIndex + 2] = previousCycleBeginning + 1 + j;
+ indices[indiceIndex + 1] = previousCycleBeginning + 1 + j;
+ indices[indiceIndex + 2] = currentCycleBeginning + j;
indices[indiceIndex + 3] = currentCycleBeginning + j;
indices[indiceIndex + 3] = currentCycleBeginning + j;
- indices[indiceIndex + 4] = currentCycleBeginning + 1 + j;
- indices[indiceIndex + 5] = previousCycleBeginning + 1 + j;
+ indices[indiceIndex + 4] = previousCycleBeginning + 1 + j;
+ indices[indiceIndex + 5] = currentCycleBeginning + 1 + j;
for( int i = 0; i < slices; i++, indiceIndex += 3 )
{
indices[indiceIndex] = bottomFaceCycleBeginning;
for( int i = 0; i < slices; i++, indiceIndex += 3 )
{
indices[indiceIndex] = bottomFaceCycleBeginning;
- indices[indiceIndex + 1] = bottomFaceCycleBeginning + i;
if( i == slices - 1 )
{
//End, so loop around.
if( i == slices - 1 )
{
//End, so loop around.
- indices[indiceIndex + 2] = bottomFaceCycleBeginning;
+ indices[indiceIndex + 1] = bottomFaceCycleBeginning;
- indices[indiceIndex + 2] = bottomFaceCycleBeginning + i + 1;
+ indices[indiceIndex + 1] = bottomFaceCycleBeginning + i + 1;
+ indices[indiceIndex + 2] = bottomFaceCycleBeginning + i;
}
}
else if( !coneTop || !coneBottom )
}
}
else if( !coneTop || !coneBottom )
for( int i = 1; i <= slices; i++, indiceIndex += 3 )
{
indices[indiceIndex] = 2 * slices + 1;
for( int i = 1; i <= slices; i++, indiceIndex += 3 )
{
indices[indiceIndex] = 2 * slices + 1;
- indices[indiceIndex + 1] = slices + i;
if( i == slices )
{
//End, so loop around.
if( i == slices )
{
//End, so loop around.
- indices[indiceIndex + 2] = slices + 1;
+ indices[indiceIndex + 1] = slices + 1;
- indices[indiceIndex + 2] = slices + i + 1;
+ indices[indiceIndex + 1] = slices + i + 1;
+ indices[indiceIndex + 2] = slices + i;
//Top face.
indices[triangleIndex] = 0;
//Top face.
indices[triangleIndex] = 0;
- indices[triangleIndex + 1] = 1;
- indices[triangleIndex + 2] = 2;
+ indices[triangleIndex + 1] = 2;
+ indices[triangleIndex + 2] = 1;
indices[triangleIndex + 3] = 2;
indices[triangleIndex + 3] = 2;
- indices[triangleIndex + 4] = 3;
- indices[triangleIndex + 5] = 0;
+ indices[triangleIndex + 4] = 0;
+ indices[triangleIndex + 5] = 3;
triangleIndex += 6;
int topFaceStart = 4;
triangleIndex += 6;
int topFaceStart = 4;
for( int i = 0; i < 8; i += 2, triangleIndex += 6 )
{
indices[triangleIndex ] = i + topFaceStart;
for( int i = 0; i < 8; i += 2, triangleIndex += 6 )
{
indices[triangleIndex ] = i + topFaceStart;
- indices[triangleIndex + 1] = i + bottomFaceStart + 1;
- indices[triangleIndex + 2] = i + topFaceStart + 1;
+ indices[triangleIndex + 1] = i + topFaceStart + 1;
+ indices[triangleIndex + 2] = i + bottomFaceStart + 1;
indices[triangleIndex + 3] = i + topFaceStart;
indices[triangleIndex + 3] = i + topFaceStart;
- indices[triangleIndex + 4] = i + bottomFaceStart;
- indices[triangleIndex + 5] = i + bottomFaceStart + 1;
+ indices[triangleIndex + 4] = i + bottomFaceStart + 1;
+ indices[triangleIndex + 5] = i + bottomFaceStart;
//End, so loop around.
vertices[vertexIndex ].position = positions[0];
vertices[vertexIndex ].normal = outerNormals[0] * smoothness + normals[i] * (1 - smoothness);
//End, so loop around.
vertices[vertexIndex ].position = positions[0];
vertices[vertexIndex ].normal = outerNormals[0] * smoothness + normals[i] * (1 - smoothness);
- vertices[vertexIndex + 1].position = positions[i + 1];
- vertices[vertexIndex + 1].normal = outerNormals[i + 1] * smoothness + normals[i] * (1 - smoothness);
- vertices[vertexIndex + 2].position = positions[1];
- vertices[vertexIndex + 2].normal = outerNormals[1] * smoothness + normals[i] * (1 - smoothness);
+ vertices[vertexIndex + 1].position = positions[1];
+ vertices[vertexIndex + 1].normal = outerNormals[1] * smoothness + normals[i] * (1 - smoothness);
+ vertices[vertexIndex + 2].position = positions[i + 1];
+ vertices[vertexIndex + 2].normal = outerNormals[i + 1] * smoothness + normals[i] * (1 - smoothness);
}
else
{
vertices[vertexIndex ].position = positions[0];
vertices[vertexIndex ].normal = outerNormals[0] * smoothness + normals[i] * (1 - smoothness);
}
else
{
vertices[vertexIndex ].position = positions[0];
vertices[vertexIndex ].normal = outerNormals[0] * smoothness + normals[i] * (1 - smoothness);
- vertices[vertexIndex + 1].position = positions[i + 1];
- vertices[vertexIndex + 1].normal = outerNormals[i + 1] * smoothness + normals[i] * (1 - smoothness);
- vertices[vertexIndex + 2].position = positions[i + 2];
- vertices[vertexIndex + 2].normal = outerNormals[i + 2] * smoothness + normals[i] * (1 - smoothness);
+ vertices[vertexIndex + 1].position = positions[i + 2];
+ vertices[vertexIndex + 1].normal = outerNormals[i + 2] * smoothness + normals[i] * (1 - smoothness);
+ vertices[vertexIndex + 2].position = positions[i + 1];
+ vertices[vertexIndex + 2].normal = outerNormals[i + 1] * smoothness + normals[i] * (1 - smoothness);
//Top face.
indices[indiceIndex ] = vertexIndex;
//Top face.
indices[indiceIndex ] = vertexIndex;
- indices[indiceIndex + 1] = vertexIndex + 1;
- indices[indiceIndex + 2] = vertexIndex + 2;
+ indices[indiceIndex + 1] = vertexIndex + 2;
+ indices[indiceIndex + 2] = vertexIndex + 1;
indices[indiceIndex + 3] = vertexIndex + 0;
indices[indiceIndex + 3] = vertexIndex + 0;
- indices[indiceIndex + 4] = vertexIndex + 2;
- indices[indiceIndex + 5] = vertexIndex + 3;
+ indices[indiceIndex + 4] = vertexIndex + 3;
+ indices[indiceIndex + 5] = vertexIndex + 2;
indiceIndex += 6;
vertexIndex += 4;
indiceIndex += 6;
vertexIndex += 4;
{
//Triangle part.
indices[indiceIndex ] = vertexIndex;
{
//Triangle part.
indices[indiceIndex ] = vertexIndex;
- indices[indiceIndex + 1] = vertexIndex + 1;
- indices[indiceIndex + 2] = vertexIndex + 2;
+ indices[indiceIndex + 1] = vertexIndex + 2;
+ indices[indiceIndex + 2] = vertexIndex + 1;
//Rectangle part.
indices[indiceIndex + 3] = vertexIndex + 3;
indices[indiceIndex + 4] = vertexIndex + 4;
indices[indiceIndex + 5] = vertexIndex + 5;
indices[indiceIndex + 6] = vertexIndex + 4;
//Rectangle part.
indices[indiceIndex + 3] = vertexIndex + 3;
indices[indiceIndex + 4] = vertexIndex + 4;
indices[indiceIndex + 5] = vertexIndex + 5;
indices[indiceIndex + 6] = vertexIndex + 4;
- indices[indiceIndex + 7] = vertexIndex + 5;
- indices[indiceIndex + 8] = vertexIndex + 6;
+ indices[indiceIndex + 7] = vertexIndex + 6;
+ indices[indiceIndex + 8] = vertexIndex + 5;
indices[indiceIndex + 1] = vertexIndex + 1;
indices[indiceIndex + 2] = vertexIndex + 2;
indices[indiceIndex + 3] = vertexIndex + 1;
indices[indiceIndex + 1] = vertexIndex + 1;
indices[indiceIndex + 2] = vertexIndex + 2;
indices[indiceIndex + 3] = vertexIndex + 1;
- indices[indiceIndex + 4] = vertexIndex + 2;
- indices[indiceIndex + 5] = vertexIndex + 3;
+ indices[indiceIndex + 4] = vertexIndex + 3;
+ indices[indiceIndex + 5] = vertexIndex + 2;
indices[indiceIndex + 4] = vertexIndex + 4;
indices[indiceIndex + 5] = vertexIndex + 5;
indices[indiceIndex + 6] = vertexIndex + 4;
indices[indiceIndex + 4] = vertexIndex + 4;
indices[indiceIndex + 5] = vertexIndex + 5;
indices[indiceIndex + 6] = vertexIndex + 4;
- indices[indiceIndex + 7] = vertexIndex + 5;
- indices[indiceIndex + 8] = vertexIndex + 6;
+ indices[indiceIndex + 7] = vertexIndex + 6;
+ indices[indiceIndex + 8] = vertexIndex + 5;
/**
* The visual which renders a simple 3D shape to the control's quad
*
/**
* The visual which renders a simple 3D shape to the control's quad
*
+ * Primitives are created with clockwise winding and back-face culling by default.
+ *
* The following properties are required to create a PrimitiveRender
*
* | %Property Name | Type |
* The following properties are required to create a PrimitiveRender
*
* | %Property Name | Type |
Renders a simple 3D shape, such as a cube or sphere. Scaled to fit the control.
Renders a simple 3D shape, such as a cube or sphere. Scaled to fit the control.
+The shapes are generated with clockwise winding and back-face culling on by default.
+
![ ](../assets/img/visuals/cube.png)
![ ](visuals/cube.png)
![ ](../assets/img/visuals/cube.png)
![ ](visuals/cube.png)