1 / 3

Objects

Objects. aka Polygonal Mesh (6.2) Objects are hollow and made of faces that share common edges Faces are considered to be outward facing Data Structure vertex list (geometry) face list (topology) normal list (orientation) normal list ignored by uisGL Sample Data ~grissom/367/DATA

liv
Download Presentation

Objects

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Objects • aka Polygonal Mesh (6.2) • Objects are hollow and made of faces that share common edges • Faces are considered to be outward facing • Data Structure • vertex list (geometry) • face list (topology) • normal list (orientation) • normal list ignored by uisGL • Sample Data • ~grissom/367/DATA • several files “*.3vn” • Sample code • uisObject Obj; // define • ifstream datafile; • datafile.open(“file.3vn”, ios::in); • datafile >> Obj; // reads data from file • datafile.close(); • numV = Obj.getNumVertices(); • numF = Obj.getNumFaces(); • F1 = Obj.getFace(16); // return face # 17 • P1 = Obj.getVertex(3); // return vertex # 4

  2. Rendering Faces • Faces are made of an ordered sequence of points (counter clockwise is the convention) • Assumed to be planar and convex • Triangles are often used • Face • uisVertex P; • uisFace F1, F2; // define • P = F1.getVertex(2); // get third vertex of face • size = F1.getNumVertices(); • See documentation for additional operations • Group Activity • write pseudo code to render a face

  3. Rendering Objects • Pseudo code • For each Face • Draw Face • OpenGL code • uisObject Obj; // define • in_file >> Obj; // reads data from file • for i=0 to Obj.getNumFaces() • Face = Obj.getFace(i); • glBegin(GL_LINE_LOOP); • for j = 0 to Face.getNumVertices() • P1 = Face.getVertex(j); • glVertex3fv(P1); • glEnd( ); • Group Activity • Write pseudo code to render an object

More Related