- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgWrappers/deprecated-dotosg/osg/Geometry.cpp
r12049 r13041 49 49 int capacity; 50 50 fr[1].getInt(capacity); 51 51 52 52 Geometry::PrimitiveSetList& primitives = geom.getPrimitiveSetList(); 53 53 if (capacity>0) primitives.reserve(capacity); 54 54 55 55 56 56 fr += 3; 57 57 58 58 59 59 while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) … … 63 63 64 64 ++fr; 65 65 66 66 iteratorAdvanced = true; 67 67 … … 115 115 } 116 116 } 117 117 118 118 if (fr[0].matchWord("VertexIndices")) 119 119 { … … 292 292 int unit=0; 293 293 fr[1].getInt(unit); 294 294 295 295 fr+=2; 296 296 Array* texcoords = Array_readLocalData(fr); … … 300 300 } 301 301 iteratorAdvanced = true; 302 302 303 303 } 304 304 … … 307 307 int unit=0; 308 308 fr[1].getInt(unit); 309 309 310 310 fr+=2; 311 311 IndexArray* indices = dynamic_cast<IndexArray*>(Array_readLocalData(fr)); … … 331 331 int unit=0; 332 332 fr[1].getInt(unit); 333 334 if (fr[2].matchString("TRUE")) 333 334 if (fr[2].matchString("TRUE")) 335 335 geom.setVertexAttribNormalize(unit,GL_TRUE); 336 336 else 337 337 geom.setVertexAttribNormalize(unit,GL_FALSE); 338 338 339 339 fr+=3; 340 340 iteratorAdvanced = true; … … 345 345 int unit=0; 346 346 fr[1].getInt(unit); 347 347 348 348 fr+=2; 349 349 Array* vertexattrib = Array_readLocalData(fr); … … 353 353 } 354 354 iteratorAdvanced = true; 355 355 356 356 } 357 357 … … 360 360 int unit=0; 361 361 fr[1].getInt(unit); 362 362 363 363 fr+=2; 364 364 IndexArray* indices = dynamic_cast<IndexArray*>(Array_readLocalData(fr)); … … 786 786 return_array = array; 787 787 } 788 789 if (return_array) 788 789 if (return_array) 790 790 { 791 791 if (!uniqueID.empty()) fr.registerUniqueIDForObject(uniqueID.c_str(),return_array); 792 792 } 793 793 794 794 return return_array; 795 795 } … … 1005 1005 bool iteratorAdvanced = false; 1006 1006 bool firstMatched = false; 1007 if ((firstMatched = fr.matchSequence("DrawArrays %w %i %i %i")) || 1007 if ((firstMatched = fr.matchSequence("DrawArrays %w %i %i %i")) || 1008 1008 fr.matchSequence("DrawArrays %w %i %i") ) 1009 1009 { 1010 1010 1011 1011 GLenum mode; 1012 1012 Geometry_matchPrimitiveModeStr(fr[1].getStr(),mode); … … 1014 1014 int first; 1015 1015 fr[2].getInt(first); 1016 1016 1017 1017 int count; 1018 1018 fr[3].getInt(count); … … 1031 1031 geom.addPrimitiveSet(new DrawArrays(mode, first, count, numInstances)); 1032 1032 1033 1034 iteratorAdvanced = true; 1035 1036 } 1037 else if ((firstMatched = fr.matchSequence("DrawArrayLengths %w %i %i %i {")) || 1033 1034 iteratorAdvanced = true; 1035 1036 } 1037 else if ((firstMatched = fr.matchSequence("DrawArrayLengths %w %i %i %i {")) || 1038 1038 fr.matchSequence("DrawArrayLengths %w %i %i {") ) 1039 1039 { … … 1048 1048 int capacity; 1049 1049 fr[3].getInt(capacity); 1050 1050 1051 1051 int numInstances = 0; 1052 1052 if (firstMatched) … … 1076 1076 } 1077 1077 ++fr; 1078 1078 1079 1079 geom.addPrimitiveSet(prim); 1080 1081 iteratorAdvanced = true; 1082 } 1083 else if ((firstMatched = fr.matchSequence("DrawElementsUByte %w %i %i {")) || 1080 1081 iteratorAdvanced = true; 1082 } 1083 else if ((firstMatched = fr.matchSequence("DrawElementsUByte %w %i %i {")) || 1084 1084 fr.matchSequence("DrawElementsUByte %w %i {")) 1085 1085 { … … 1091 1091 int capacity; 1092 1092 fr[2].getInt(capacity); 1093 1093 1094 1094 int numInstances = 0; 1095 1095 if (firstMatched) … … 1118 1118 } 1119 1119 ++fr; 1120 1120 1121 1121 geom.addPrimitiveSet(prim); 1122 1123 iteratorAdvanced = true; 1124 } 1125 else if ((firstMatched = fr.matchSequence("DrawElementsUShort %w %i %i {")) || 1122 1123 iteratorAdvanced = true; 1124 } 1125 else if ((firstMatched = fr.matchSequence("DrawElementsUShort %w %i %i {")) || 1126 1126 fr.matchSequence("DrawElementsUShort %w %i {")) 1127 1127 { … … 1133 1133 int capacity; 1134 1134 fr[2].getInt(capacity); 1135 1135 1136 1136 int numInstances = 0; 1137 1137 if (firstMatched) … … 1144 1144 fr += 4; 1145 1145 } 1146 1146 1147 1147 DrawElementsUShort* prim = new DrawElementsUShort; 1148 1148 prim->setMode(mode); … … 1160 1160 } 1161 1161 ++fr; 1162 1162 1163 1163 geom.addPrimitiveSet(prim); 1164 1165 iteratorAdvanced = true; 1166 } 1167 else if ((firstMatched = fr.matchSequence("DrawElementsUInt %w %i %i {")) || 1164 1165 iteratorAdvanced = true; 1166 } 1167 else if ((firstMatched = fr.matchSequence("DrawElementsUInt %w %i %i {")) || 1168 1168 fr.matchSequence("DrawElementsUInt %w %i {")) 1169 1169 { … … 1175 1175 int capacity; 1176 1176 fr[2].getInt(capacity); 1177 1177 1178 1178 int numInstances = 0; 1179 1179 if (firstMatched) … … 1186 1186 fr += 4; 1187 1187 } 1188 1188 1189 1189 DrawElementsUInt* prim = new DrawElementsUInt; 1190 1190 prim->setMode(mode); … … 1202 1202 } 1203 1203 ++fr; 1204 1204 1205 1205 geom.addPrimitiveSet(prim); 1206 1206 1207 1207 iteratorAdvanced = true; 1208 1208 } … … 1299 1299 fw.indent()<<"VertexArray "; 1300 1300 Array_writeLocalData(*geom.getVertexArray(),fw); 1301 1301 1302 1302 } 1303 1303 if (geom.getVertexIndices()) 1304 1304 { 1305 1305 fw.indent()<<"VertexIndices "; 1306 Array_writeLocalData(*geom.getVertexIndices(),fw); 1306 Array_writeLocalData(*geom.getVertexIndices(),fw); 1307 1307 } 1308 1308 1309 1309 if (geom.getNormalArray()) 1310 1310 { 1311 1311 1312 1312 fw.indent()<<"NormalBinding "<<Geometry_getBindingTypeStr(geom.getNormalBinding())<<std::endl; 1313 1313 1314 1314 // const Vec3Array& normals = *geom.getNormalArray(); 1315 1315 // fw.indent()<<"NormalArray "<<normals.size()<<std::endl; … … 1317 1317 1318 1318 fw.indent()<<"NormalArray "; 1319 Array_writeLocalData(*geom.getNormalArray(),fw); 1320 1319 Array_writeLocalData(*geom.getNormalArray(),fw); 1320 1321 1321 } 1322 1322 if (geom.getNormalIndices()) 1323 1323 { 1324 1324 fw.indent()<<"NormalIndices "; 1325 Array_writeLocalData(*geom.getNormalIndices(),fw); 1325 Array_writeLocalData(*geom.getNormalIndices(),fw); 1326 1326 } 1327 1327 … … 1335 1335 { 1336 1336 fw.indent()<<"ColorIndices "; 1337 Array_writeLocalData(*geom.getColorIndices(),fw); 1337 Array_writeLocalData(*geom.getColorIndices(),fw); 1338 1338 } 1339 1339 … … 1347 1347 { 1348 1348 fw.indent()<<"SecondayColorIndices "; 1349 Array_writeLocalData(*geom.getSecondaryColorIndices(),fw); 1349 Array_writeLocalData(*geom.getSecondaryColorIndices(),fw); 1350 1350 } 1351 1351 … … 1359 1359 { 1360 1360 fw.indent()<<"FogCoordIndices "; 1361 Array_writeLocalData(*geom.getFogCoordIndices(),fw); 1361 Array_writeLocalData(*geom.getFogCoordIndices(),fw); 1362 1362 } 1363 1363 … … 1377 1377 } 1378 1378 } 1379 1379 1380 1380 const Geometry::ArrayDataList& vaal=geom.getVertexAttribArrayList(); 1381 1381 for(i=0;i<vaal.size();++i) 1382 1382 { 1383 1383 const osg::Geometry::ArrayData& arrayData = vaal[i]; 1384 1384 1385 1385 if (arrayData.array.valid()) 1386 1386 { 1387 1387 fw.indent()<<"VertexAttribBinding "<<i<<" "<<Geometry_getBindingTypeStr(arrayData.binding)<<std::endl; 1388 1388 1389 1389 if (arrayData.normalize) 1390 1390 fw.indent()<<"VertexAttribNormalize "<<i<<" TRUE"<<std::endl; 1391 1391 else 1392 1392 fw.indent()<<"VertexAttribNormalize "<<i<<" FALSE"<<std::endl; 1393 1393 1394 1394 fw.indent()<<"VertexAttribArray "<<i<<" "; 1395 1395 Array_writeLocalData(*(arrayData.array),fw);
