void mepp_component_CGAL_Example_plugin::draw_connections(Viewer* viewer, int frame_i, int frame_j)
{
#if (1)
	PolyhedronPtr pMesh_i = viewer->getScenePtr()->get_polyhedron(frame_i);
	PolyhedronPtr pMesh_j = viewer->getScenePtr()->get_polyhedron(frame_j);

	int nbp_i = pMesh_i->size_of_vertices();
	int nbp_j = pMesh_j->size_of_vertices();

	if (nbp_i == nbp_j)
	{
		glLineWidth(2);
		glColor3f(1., 0., 0.);

		Vertex_iterator pVertex_i = NULL;
		Vertex_iterator pVertex_j = NULL;
		for (pVertex_i = pMesh_i->vertices_begin(), pVertex_j = pMesh_j->vertices_begin(); pVertex_i != pMesh_i->vertices_end(); pVertex_i++, pVertex_j++)
		{
			Vec pi(pVertex_i->point().x(), pVertex_i->point().y(), pVertex_i->point().z());
			Vec pj(pVertex_j->point().x(), pVertex_j->point().y(), pVertex_j->point().z());

			draw_link(viewer, frame_i, frame_j, pi, pj);
		}
	}
#endif
}
示例#2
0
//------------------------------------------------------------------------------
/// Draws a link and descends the hierarchy of child joints and draws any
/// links attached down the kinematic chain
/// Note: No Push or Pop Matrix
void draw_link( Link* link ) {
    GLfloat* material_Ka = (GLfloat*)link->material.ambient.arrayOpenGL();
    GLfloat* material_Kd = (GLfloat*)link->material.diffuse.arrayOpenGL();
    GLfloat* material_Ks = (GLfloat*)link->material.specular.arrayOpenGL();
    GLfloat* material_Ke = (GLfloat*)link->material.emissive.arrayOpenGL();
    GLfloat material_Se = (GLfloat)link->material.shininess;

    glMaterialfv(GL_FRONT, GL_AMBIENT, material_Ka);
    glMaterialfv(GL_FRONT, GL_DIFFUSE, material_Kd);
    glMaterialfv(GL_FRONT, GL_SPECULAR, material_Ks);
    glMaterialfv(GL_FRONT, GL_EMISSION, material_Ke);
    glMaterialf(GL_FRONT, GL_SHININESS, material_Se);

    glLoadMatrixd( link->pose.transform.arrayOpenGL() );

    for( unsigned int geometry_id = 0; geometry_id < link->geometryCount( ); geometry_id++ ) {
        Mesh* mesh = static_cast<Mesh*>( link->geometry( geometry_id ) );
        draw_mesh( mesh );
    }

    for( unsigned int i = 0; i < link->child_joints(); i++ ) {
        Joint* joint = link->child_joint( i );
        draw_link( joint->outboard_link );
    }

}
示例#3
0
static void draw_instagram(char **id, char **link) {
	draw_clear();

	draw_photo(&*id);
	draw_username();
	draw_likes();
	draw_video();
	draw_link(&*link);

	draw_update();
}
示例#4
0
//------------------------------------------------------------------------------
/// Draw the animated actor.  Starts at the root link and descends the hierarchy
/// to draw each link
/// Note: This is the only pair of Push and Pop Matrix associated with the
/// articulated body hierarchy
void draw_articulatedbody( const ArticulatedBody& body ) {

    // By requirements can only have one push and pop of OpenGL's matrix stack
    // Therefore do that here then descend the hierarchy
    glPushMatrix();

    // recursive descent beginning with the root
    draw_link( body.root_link );

    glPopMatrix();

    //sim_pause = true;
}