Exemplo n.º 1
0
void OpenVG_SVGHandler::draw_recursive( group_t& group ) {

    // push the group matrix onto the stack
    pushTransform( group.transform );
    vgLoadMatrix( topTransform().m );

    for ( list<path_object_t>::iterator it = group.path_objects.begin(); it != group.path_objects.end(); it++ ) {
        path_object_t& po = *it;
        uint32_t draw_params = 0;
        if ( po.fill ) {
            vgSetPaint( po.fill, VG_FILL_PATH );
            draw_params |= VG_FILL_PATH;
        }

        if ( po.stroke ) {
            vgSetPaint( po.stroke, VG_STROKE_PATH );
            vgSetf( VG_STROKE_LINE_WIDTH, po.stroke_width );
            draw_params |= VG_STROKE_PATH;
        }

        if( draw_params == 0 ) {	// if no stroke or fill use the default black fill
            vgSetPaint( _blackBackFill, VG_FILL_PATH );
            draw_params |= VG_FILL_PATH;
        }

        // set the fill rule
        vgSeti( VG_FILL_RULE, po.fill_rule );
        // trasnform
        pushTransform( po.transform );
        vgLoadMatrix( topTransform().m );
        vgDrawPath( po.path, draw_params );
        popTransform();
        vgLoadMatrix( topTransform().m );
    }

    for ( list<group_t>::iterator it = group.children.begin(); it != group.children.end(); it++ ) {
        draw_recursive( *it );
    }

    popTransform();
    vgLoadMatrix( topTransform().m );
}
Exemplo n.º 2
0
void RaceScene::DrawObjects(GeometryShader * curShade) {
	//Track/City
	sweep->renderWithDisplayList(*curShade,50, true, 0.3,20);

	//Vehicle Location
	vec3 vehLoc = vehicle->worldSpacePos();

	//Put matrices together for smaller stack size
	mat4 transformation = vehicle->orientationBasis() *
		translation3D(vehLoc).transpose();

	pushMat4(transformation);
	vehicle->draw(curShade); 
	popTransform();
}