Exemple #1
0
void DebugDrawer::reset()
{
	GeometryBuffer* linesGB = lines->getGeometryBuffer().get();
	linesGB->clear();

	GeometryBuffer* trianglesGB = triangles->getGeometryBuffer().get();
	trianglesGB->clear();

	GeometryBuffer* quadsGB = quads->getGeometryBuffer().get();
	quadsGB->clear();

	//renderables.clear();

	currentColor = Color::White;
	currentColor.a = 0.4f;
}
Exemple #2
0
void Overlay::rebuildGeometry()
{
    Vector<Vector3> pos;
    Vector< Color > colors;

    pos.Push( Vector3(borderWidth, borderWidth, -0.1f) );
    pos.Push( Vector3(borderWidth, size.y-borderWidth, -0.1f) );
    pos.Push( Vector3(size.x-borderWidth, size.y-borderWidth, -0.1f) );
    pos.Push( Vector3(size.x-borderWidth, borderWidth, -0.1f) );

    Color color = backgroundColor;
    color.a = opacity;
    
    colors.Push(color);
    colors.Push(color);
    colors.Push(color);
    colors.Push(color);

    if( borderWidth > 0 )
    {
        pos.Push( Vector3(0, 0, -0.2f) );
        pos.Push( Vector3(0, size.y, -0.2f) );
        pos.Push( Vector3(size.x, size.y, -0.2f) );
        pos.Push( Vector3(size.x, 0, -0.2f) );
    
        color = borderColor;

        colors.Push(color);
        colors.Push(color);
        colors.Push(color);
        colors.Push(color);
    }

    GeometryBuffer* gb = renderable->getGeometryBuffer().get();
    
    gb->clear();
    gb->declarations.reset();

    gb->set( VertexAttribute::Position, pos );
    gb->set( VertexAttribute::Color, colors );

    updateBounds();
}