ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/txtprt_import.C
(Generate patch)

Comparing libgender/txtprt_import.C (file contents):
Revision 1.8 by root, Sun Oct 3 23:34:02 2004 UTC vs.
Revision 1.9 by root, Mon Oct 4 02:32:20 2004 UTC

87 match_nl (); 87 match_nl ();
88 verts[i].t = texc (u,v); 88 verts[i].t = texc (u,v);
89 } 89 }
90 match_section ('A', tmpn); 90 match_section ('A', tmpn);
91 } 91 }
92 entity_triangles *tri = new entity_triangles; 92 vector<vertex2d> vd;
93 ec->add (tri);
94 tri->m = m;
95 for (i = 0; i < tmpn; i++) { 93 for (i = 0; i < tmpn; i++) {
96 double a, b, c; 94 double a, b, c;
97 match_number (a); 95 match_number (a);
98 if (verts.size () < a) 96 if (verts.size () < a)
99 throw txtprt_i_exception ("Vertex a out of range!"); 97 throw txtprt_i_exception ("Vertex a out of range!");
110 match_number (smooth_fl); match_nl (); 108 match_number (smooth_fl); match_nl ();
111 if (!smooth_fl) { 109 if (!smooth_fl) {
112 point ap = verts[(int)a].p; 110 point ap = verts[(int)a].p;
113 point bp = verts[(int)b].p; 111 point bp = verts[(int)b].p;
114 point cp = verts[(int)c].p; 112 point cp = verts[(int)c].p;
115 vec3 nv = cross ( vec3 (cp.x - bp.x, cp.y - bp.y, cp.z - bp.z), 113 vec3 nv = normalize (cross (vec3 (cp.x - bp.x, cp.y - bp.y, cp.z - bp.z),
116 vec3 (ap.x - bp.x, ap.y - bp.y, ap.z - bp.z)); 114 vec3 (ap.x - bp.x, ap.y - bp.y, ap.z - bp.z)));
117 115
118 verts[(int)a].n = nv; 116 verts[(int)a].n = nv;
119 verts[(int)b].n = nv; 117 verts[(int)b].n = nv;
120 verts[(int)c].n = nv; 118 verts[(int)c].n = nv;
121 } 119 }
122 tri->push_back (verts[(int)a]); 120 vd.push_back (verts[(int)a]);
123 tri->push_back (verts[(int)b]); 121 vd.push_back (verts[(int)b]);
124 tri->push_back (verts[(int)c]); 122 vd.push_back (verts[(int)c]);
125 } 123 }
124
125 entity_triangles *tri = new entity_triangles;
126 tri->m = m;
127 tri->set (vd);
128 ec->add (tri);
126 } 129 }
127 return e; 130 return e;
128} 131}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines