- // Create a mesh actor to contain the post-effect render
- MeshData::VertexContainer vertices;
- MeshData::FaceIndices face;
-
- vertices.push_back( MeshData::Vertex( Vector3( tlx + shadowOffset.x, tly + shadowOffset.y, ZERO ),
- Vector2::ZERO,
- Vector3::ZERO ) );
-
- vertices.push_back( MeshData::Vertex( Vector3( brx + shadowOffset.x, tly + shadowOffset.y, ZERO ),
- Vector2( ONE, ZERO ),
- Vector3::ZERO ) );
-
- vertices.push_back( MeshData::Vertex( Vector3( tlx + shadowOffset.x, bry + shadowOffset.y, ZERO ),
- Vector2( ZERO, ONE ),
- Vector3::ZERO ) );
-
- vertices.push_back( MeshData::Vertex( Vector3( brx + shadowOffset.x, bry + shadowOffset.y, ZERO ),
- Vector2::ONE,
- Vector3::ZERO ) );
-
- MeshData meshData;
- Material newMaterial = Material::New("effect buffer");
- newMaterial.SetDiffuseTexture( meshRecord.mBuffer );
- meshData.SetMaterial( newMaterial );
- meshData.SetVertices( vertices );
- meshData.SetFaceIndices( mFace );
- meshData.SetHasNormals( true );
- meshData.SetHasColor( false );
- meshData.SetHasTextureCoords( true );
- MeshActor actor = MeshActor::New( Mesh::New( meshData ) );
- actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR );
- actor.SetShaderEffect( mBgraShader );
- actor.SetFilterMode( FilterMode::LINEAR, FilterMode::LINEAR );
- actor.SetSortModifier( 0.1f ); // force behind main text
-
- // Create a sub actor to render once with normalized vertex positions
- MeshData newMeshData;
- MeshData::VertexContainer newVerts;
- MeshData::FaceIndices newFaces;
- MeshData::FaceIndices faces = meshRecord.mMeshData.GetFaces();
- for ( uint32_t i = 0; i < verts.size(); ++i )
- {
- MeshData::Vertex vertex = verts[ i ];
- vertex.x = ( ( vertex.x - tlx ) * divWidth ) - ONE;
- vertex.y = ( ( vertex.y - tly ) * divHeight ) - ONE;
- newVerts.push_back( vertex );
- }
+ // We will render a quad into this buffer
+ unsigned int indices[ 6 ] = { 1, 0, 2, 2, 3, 1 };
+ PropertyBuffer quadVertices = PropertyBuffer::New( mQuadVertexFormat, 4u );
+ PropertyBuffer quadIndices = PropertyBuffer::New( mQuadIndexFormat, sizeof(indices)/sizeof(indices[0]) );
+
+ AtlasManager::Vertex2D vertices[ 4 ] = {
+ { Vector2( tlx + shadowOffset.x, tly + shadowOffset.y ), Vector2( ZERO, ZERO ) },
+ { Vector2( brx + shadowOffset.x, tly + shadowOffset.y ), Vector2( ONE, ZERO ) },
+ { Vector2( tlx + shadowOffset.x, bry + shadowOffset.y ), Vector2( ZERO, ONE ) },
+ { Vector2( brx + shadowOffset.x, bry + shadowOffset.y ), Vector2( ONE, ONE ) } };
+
+ quadVertices.SetData( vertices );
+ quadIndices.SetData( indices );
+
+ Geometry quadGeometry = Geometry::New();
+ quadGeometry.AddVertexBuffer( quadVertices );
+ quadGeometry.SetIndexBuffer( quadIndices );
+
+ Sampler sampler = Sampler::New( meshRecord.mBuffer, "sTexture" );
+ Material material = Material::New( mGlyphManager.GetEffectBufferShader() );
+ material.AddSampler( sampler );