- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/lwo/old_Lwo2Layer.cpp
r11517 r13041 19 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 * 21 * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for 22 * real-time rendering of large 3D photo-realistic models. 21 * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for 22 * real-time rendering of large 3D photo-realistic models. 23 23 * The OSG homepage is http://www.openscenegraph.org/ 24 24 */ … … 57 57 OSG_NOTIFY(severity) << " \t" << (*itr).coord << "\t\t" << (*itr).texcoord << endl; 58 58 } 59 59 60 60 // polygons 61 61 OSG_NOTIFY(severity) << " polygons:\t" << _polygons.size() << endl; … … 90 90 // variable used to track using textures 91 91 bool have_texture_coords; 92 92 93 93 // create diffirent geomerty for each tag 94 94 for (short current_tag = 0; current_tag < tags_count; current_tag++) … … 151 151 (*texcoords).push_back((*itr).texcoord); 152 152 153 if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) 153 if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) 154 154 { 155 155 have_texture_coords = true; 156 156 } 157 157 } 158 158 159 159 unsigned int points_start = (*coords).size() - (*polygon_iterator).size(); 160 160 unsigned int points_count = (*polygon_iterator).size(); … … 167 167 geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::QUADS, points_start, points_count)); 168 168 } 169 else 169 else 170 170 { 171 171 geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::POLYGON, points_start, points_count)); … … 188 188 (*texcoords).push_back((*itr).texcoord); 189 189 190 if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) 190 if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) 191 191 { 192 192 have_texture_coords = true; 193 193 } 194 194 } 195 195 196 196 unsigned int points_start = (*coords).size() - (*polygon_iterator).size(); 197 197 unsigned int points_count = (*polygon_iterator).size(); … … 213 213 (*texcoords).push_back((*itr).texcoord); 214 214 215 if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) 215 if ((*itr).texcoord.x() != -1.0f || (*itr).texcoord.y() != -1.0f) 216 216 { 217 217 have_texture_coords = true; 218 218 } 219 219 } 220 220 221 221 unsigned int points_start = (*coords).size() - (*polygon_iterator).size(); 222 222 unsigned int points_count = (*polygon_iterator).size(); … … 225 225 226 226 // add geometry if it contains any points 227 if (coords->size() != 0) 227 if (coords->size() != 0) 228 228 { 229 229 geometry->setVertexArray(coords.get()); … … 247 247 } 248 248 249 bool 249 bool 250 250 Lwo2Layer::_find_triangle_fans(PolygonsList& polygons, PolygonsList& triangle_fans) 251 251 { 252 252 bool found = false; 253 253 254 while (_find_triangle_fan(polygons, triangle_fans)) 254 while (_find_triangle_fan(polygons, triangle_fans)) 255 255 { 256 256 found = true; … … 265 265 } 266 266 267 bool 267 bool 268 268 Lwo2Layer::_find_triangle_strips(PolygonsList& polygons, PolygonsList& triangle_strips) 269 269 { 270 270 bool found = false; 271 271 272 while (_find_triangle_strip(polygons, triangle_strips)) 272 while (_find_triangle_strip(polygons, triangle_strips)) 273 273 { 274 274 found = true; … … 283 283 } 284 284 285 bool 285 bool 286 286 Lwo2Layer::_find_triangle_fan(PolygonsList& polygons, PolygonsList& triangle_fans) 287 287 { … … 298 298 299 299 int next_polygon_index = _find_triangle_begins_with(polygons, a, c); 300 while (next_polygon_index >= 0) 300 while (next_polygon_index >= 0) 301 301 { 302 302 found = true; … … 326 326 c = d; 327 327 } 328 328 329 329 triangle_fans.push_back(point_list); 330 330 } … … 335 335 } 336 336 337 bool 337 bool 338 338 Lwo2Layer::_find_triangle_strip(PolygonsList& polygons, PolygonsList& triangle_strips) 339 339 { … … 352 352 int next_polygon_index = _find_triangle_begins_with(polygons, c, b); 353 353 354 while (next_polygon_index >= 0) 354 while (next_polygon_index >= 0) 355 355 { 356 356 found = true; … … 382 382 strip_a = d; 383 383 } 384 else 384 else 385 385 { 386 386 strip_b = d; … … 391 391 (*(polygons.begin() + next_polygon_index))[0].point_index = -1; 392 392 } 393 393 394 394 triangle_strips.push_back(point_list); 395 395 } … … 401 401 } 402 402 403 int 403 int 404 404 Lwo2Layer::_find_triangle_begins_with(PolygonsList& polygons, PointData& a, PointData& b) 405 405 {
