Changeset 1543 for GTP/trunk/Lib
- Timestamp:
- 09/29/06 14:26:17 (18 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared/GeoTool
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h
r1526 r1543 86 86 87 87 using namespace Geometry; 88 using namespace std; 88 89 89 90 class GeoToolIndexData : public Geometry::IndexData 90 91 { 91 public: 92 GeoToolIndexData(unsigned int submeshes):Geometry::IndexData(){ 93 submeshcount = submeshes; 94 indices=new unsigned int*[submeshcount]; 95 indexCount=new unsigned int[submeshcount]; 96 for (int i=0; i<submeshcount; i++) 97 { 98 indices[i]=NULL; 99 indexCount[i]=0; 92 public: 93 GeoToolIndexData(unsigned int submeshes):Geometry::IndexData(){ 94 submeshcount = submeshes; 95 indices=new unsigned int*[submeshcount]; 96 indexCount=new unsigned int[submeshcount]; 97 for (int i=0; i<submeshcount; i++) 98 { 99 indices[i]=NULL; 100 indexCount[i]=0; 101 } 100 102 } 101 } 102 virtual ~GeoToolIndexData(void){ 103 for (int i=0; i<submeshcount; i++) 104 if (indices[i]) 105 delete[] indices[i]; 106 delete[] indices; 107 delete[] indexCount; 108 } 109 110 virtual void Begin(unsigned int submesh, unsigned int numinds){ 111 if (indices[submesh]) 112 delete[] indices[submesh]; 113 indices[submesh] = new unsigned int[numinds]; 114 indexCount[submesh] = numinds; 115 modifySubmesh=submesh; 116 } 117 118 virtual void SetIndex(unsigned int i, unsigned int index){ 119 indices[modifySubmesh][i] = index; 120 } 121 122 virtual void End(void){} 123 virtual void BorrowIndexData(const IndexData *){} 124 125 unsigned int submeshcount; 126 unsigned int **indices; 127 unsigned int *indexCount; 128 unsigned int modifySubmesh; 103 virtual ~GeoToolIndexData(void){ 104 for (int i=0; i<submeshcount; i++) 105 if (indices[i]) 106 delete[] indices[i]; 107 delete[] indices; 108 delete[] indexCount; 109 } 110 111 virtual void Begin(unsigned int submesh, unsigned int numinds){ 112 if (indices[submesh]) 113 delete[] indices[submesh]; 114 indices[submesh] = new unsigned int[numinds]; 115 indexCount[submesh] = numinds; 116 modifySubmesh=submesh; 117 } 118 119 virtual void SetIndex(unsigned int i, unsigned int index){ 120 indices[modifySubmesh][i] = index; 121 } 122 123 virtual void End(void){} 124 virtual void BorrowIndexData(const IndexData *){} 125 126 unsigned int submeshcount; 127 unsigned int **indices; 128 unsigned int *indexCount; 129 unsigned int modifySubmesh; 129 130 }; 130 131 -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp
r1526 r1543 399 399 : fltk::GlWindow(x,y,w,h,l) 400 400 { 401 mStripColors= NULL;402 mSharedPosArray= NULL;403 mSharedNorArray= NULL;404 mSharedTexCoordArray= NULL;405 mPosArray= NULL;406 mNorArray= NULL;407 mTexCoordArray= NULL;408 mIndexArray= NULL;409 vAng= 0.0;410 hAng= 0.0;411 size= 0.0;412 mSizeY= 0;413 xshift= 0.0;414 yshift= 0.0;415 geoMesh= 0;416 mRotate= true;417 mPan= false;418 mLodStrip= false;419 mLodTree= false;420 mIdVisualList= 0;421 mSubMeshCount= 0;422 mStripColorsCount= 0;423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 current_texture = 0; 438 current_texture_submesh=NULL;439 use_texture_mapping =true;401 mStripColors = NULL; 402 mSharedPosArray = NULL; 403 mSharedNorArray = NULL; 404 mSharedTexCoordArray = NULL; 405 mPosArray = NULL; 406 mNorArray = NULL; 407 mTexCoordArray = NULL; 408 mIndexArray = NULL; 409 vAng = 0.0; 410 hAng = 0.0; 411 size = 0.0; 412 mSizeY = 0; 413 xshift = 0.0; 414 yshift = 0.0; 415 geoMesh = 0; 416 mRotate = true; 417 mPan = false; 418 mLodStrip = false; 419 mLodTree = false; 420 mIdVisualList = 0; 421 mSubMeshCount = 0; 422 mStripColorsCount = 0; 423 424 // Initialize the model view. 425 deactiveWire(); 426 deactiveSolid(); 427 activeRotate(); 428 deactiveCW(); 429 activeCCW(); 430 431 // Initialize start time for FPS. 432 mStartTime = clock(); 433 434 // Cross Reference. 435 mGeoMeshViewUI = geoMeshViewUI; 436 current_texture = 0; 437 438 current_texture_submesh = NULL; 439 use_texture_mapping = true; 440 440 } 441 441 … … 464 464 465 465 if (current_texture_submesh) 466 delete[] current_texture_submesh; 467 current_texture_submesh=new GLuint[getSubMeshCount()]; 466 { 467 delete [] current_texture_submesh; 468 } 469 470 current_texture_submesh = new GLuint[getSubMeshCount()]; 471 468 472 for (int i=0; i<getSubMeshCount(); i++) 469 current_texture_submesh[i]=0; 473 { 474 current_texture_submesh[i] = 0; 475 } 470 476 } 471 477 … … 505 511 mSharedPosArray = new GLfloat[vertex_buffer->mVertexCount * 3]; 506 512 mSharedNorArray = new GLfloat[vertex_buffer->mVertexCount * 3]; 513 507 514 if (vertex_buffer->mTexCoords) 515 { 508 516 mSharedTexCoordArray = new GLfloat[vertex_buffer->mVertexCount * 2]; 517 } 509 518 else 519 { 510 520 mSharedTexCoordArray = NULL; 521 } 511 522 512 523 for (int vertex = 0; vertex < vertex_buffer->mVertexCount; vertex++) 513 524 { 514 mSharedPosArray[3 * vertex] = vertex_buffer->mPosition[vertex].x;525 mSharedPosArray[3 * vertex] = vertex_buffer->mPosition[vertex].x; 515 526 mSharedPosArray[(3 * vertex) + 1] = vertex_buffer->mPosition[vertex].y; 516 527 mSharedPosArray[(3 * vertex) + 2] = vertex_buffer->mPosition[vertex].z; 517 528 518 mSharedNorArray[3 * vertex] = vertex_buffer->mNormal[vertex].x;529 mSharedNorArray[3 * vertex] = vertex_buffer->mNormal[vertex].x; 519 530 mSharedNorArray[(3 * vertex) + 1] = vertex_buffer->mNormal[vertex].y; 520 531 mSharedNorArray[(3 * vertex) + 2] = vertex_buffer->mNormal[vertex].z; … … 522 533 if (vertex_buffer->mTexCoords) 523 534 { 524 mSharedTexCoordArray[2 * vertex] = vertex_buffer->mTexCoords[vertex].x; 525 mSharedTexCoordArray[(2 * vertex) + 1] = vertex_buffer->mTexCoords[vertex].y; 535 mSharedTexCoordArray[2 * vertex] = vertex_buffer-> 536 mTexCoords[vertex].x; 537 538 mSharedTexCoordArray[(2 * vertex) + 1] = vertex_buffer-> 539 mTexCoords[vertex].y; 526 540 } 527 541 } … … 529 543 530 544 // Build the arrays of vertices and indices. 531 mPosArray = new GLfloat*[geomesh->mSubMeshCount];532 mNorArray = new GLfloat*[geomesh->mSubMeshCount];545 mPosArray = new GLfloat*[geomesh->mSubMeshCount]; 546 mNorArray = new GLfloat*[geomesh->mSubMeshCount]; 533 547 mTexCoordArray = new GLfloat*[geomesh->mSubMeshCount]; 534 mIndexArray = new GLuint*[geomesh->mSubMeshCount];548 mIndexArray = new GLuint*[geomesh->mSubMeshCount]; 535 549 536 550 // For each submesh. … … 555 569 556 570 // Allocate memory for vertices of the actual submesh. 557 mPosArray[submesh] = new GLfloat[vertex_buffer->mVertexCount * 3];558 mNorArray[submesh] = new GLfloat[vertex_buffer->mVertexCount * 3];571 mPosArray[submesh] = new GLfloat[vertex_buffer->mVertexCount * 3]; 572 mNorArray[submesh] = new GLfloat[vertex_buffer->mVertexCount * 3]; 559 573 mTexCoordArray[submesh] = new GLfloat[vertex_buffer->mVertexCount * 2]; 560 574 … … 577 591 else 578 592 { 579 mPosArray[submesh] = NULL;580 mNorArray[submesh] = NULL;593 mPosArray[submesh] = NULL; 594 mNorArray[submesh] = NULL; 581 595 mTexCoordArray[submesh] = NULL; 582 596 } … … 880 894 { 881 895 SubMesh *geosubmesh; 882 Index position;896 Index position; 883 897 Vector3 vector3; 884 898 Vector2 vector2; 899 float x,y,z; 900 float r,g,b; 901 int color_index; 902 int current_strip; 903 904 // Initialize current strip. 905 current_strip = 0; 906 907 // For each submesh. 908 for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) 909 { 910 // bind current texture to use 911 bool usetex = SetTextureRenderingState(submesh); 912 913 color_index = 0; 914 915 // Gets the actual submesh. 916 geosubmesh = &geoMesh->mSubMesh[submesh]; 917 918 // For each one of the strips. 919 int indices_to_render = lodStripsLib->GetValidIndexCount(submesh); 920 int offset = lodStripsLib->GetValidOffset(submesh); 921 922 glBegin(GL_TRIANGLE_STRIP); 923 924 for ( int index = 0; 925 index < mGeoMeshViewUI->lod_index_data->indexCount[submesh]; 926 index ++) 927 { 928 position = mGeoMeshViewUI->lod_index_data->indices[submesh][index]; 929 930 // Gets the vertex normal. 931 vector3 = geosubmesh->mVertexBuffer->mNormal[position]; 932 933 x = vector3[0]; 934 y = vector3[1]; 935 z = vector3[2]; 936 937 // Sets the vertex normal. 938 glNormal3f(x,y,z); 939 940 // set the texture coordinates if needed 941 if (usetex) 942 { 943 vector2 = geosubmesh->mVertexBuffer->mTexCoords[position]; 944 x = vector2[0]; 945 y = vector2[1]; 946 947 glTexCoord2f(x,y); 948 } 949 950 // Gets the vertex coordinates. 951 vector3 = geosubmesh->mVertexBuffer->mPosition[position]; 952 953 x = vector3[0]; 954 y = vector3[1]; 955 z = vector3[2]; 956 957 // Sets the vertex position. 958 glVertex3f(x,y,z); 959 } 960 glEnd(); 961 962 } 963 964 }//End drawTriangleStrip. 965 966 //--------------------------------------------------------------------------- 967 // Paint lodtree object. 968 //--------------------------------------------------------------------------- 969 void GeoMeshView::drawLodTree() 970 { 971 SubMesh *geosubmesh; 972 Index position; 973 Vector3 vector3; 974 Vector2 vector2; 885 975 float x,y,z; 886 976 float r,g,b; … … 889 979 890 980 // Initialize current strip. 891 current_strip = 0; 892 981 current_strip = 0; 982 983 // DRAW THE TRUNK AS A LODSTRIP OBJECT 893 984 // For each submesh. 894 985 for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) 895 986 { 987 if (submesh == lodTreeLib->GetLeavesSubMesh()) 988 { 989 continue; 990 } 991 896 992 // bind current texture to use 897 993 bool usetex = SetTextureRenderingState(submesh); … … 903 999 904 1000 // For each one of the strips. 905 int indices_to_render = lodStripsLib->GetValidIndexCount(submesh);906 int offset = lodStripsLib->GetValidOffset(submesh);907 1001 int indices_to_render = lodTreeLib->GetValidTrunkIndexCount(submesh); 1002 int begin_index = lodTreeLib->GetValidTrunkOffset(submesh); 1003 908 1004 glBegin(GL_TRIANGLE_STRIP); 909 // for (int index = offset; index < indices_to_render+offset; index ++) 910 for (int index = 0; index < mGeoMeshViewUI->lod_index_data->indexCount[submesh]; index ++) 911 { 912 // position = lodStripsLib->dataRetrievalInterface->GetIndex(index); 1005 1006 for ( int index = 0; 1007 index < mGeoMeshViewUI->lod_index_data->indexCount[submesh]; 1008 index ++) 1009 { 913 1010 position = mGeoMeshViewUI->lod_index_data->indices[submesh][index]; 914 1011 … … 943 1040 } 944 1041 glEnd(); 945 946 }947 948 949 }//End drawTriangleStrip.950 951 //---------------------------------------------------------------------------952 // Paint lodtree object.953 //---------------------------------------------------------------------------954 void GeoMeshView::drawLodTree()955 {956 SubMesh *geosubmesh;957 Index position;958 Vector3 vector3;959 Vector2 vector2;960 float x,y,z;961 float r,g,b;962 int color_index;963 int current_strip;964 965 // Initialize current strip.966 current_strip = 0;967 968 // DRAW THE TRUNK AS A LODSTRIP OBJECT969 // For each submesh.970 for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)971 {972 //if (submesh==leavesSubMesh)973 if (submesh == lodTreeLib->GetLeavesSubMesh())974 continue;975 976 // bind current texture to use977 bool usetex = SetTextureRenderingState(submesh);978 979 color_index = 0;980 981 // Gets the actual submesh.982 geosubmesh = &geoMesh->mSubMesh[submesh];983 984 // For each one of the strips.985 int indices_to_render = lodTreeLib->GetValidTrunkIndexCount(submesh);986 int begin_index = lodTreeLib->GetValidTrunkOffset(submesh);987 988 glBegin(GL_TRIANGLE_STRIP);989 // for (int index = begin_index; index < indices_to_render+begin_index; index ++)990 for (int index = 0; index < mGeoMeshViewUI->lod_index_data->indexCount[submesh]; index ++)991 {992 // position = lodTreeLib->CurrentLOD_Trunk_Indices()->GetIndex(index);993 position = mGeoMeshViewUI->lod_index_data->indices[submesh][index];994 995 // Gets the vertex normal.996 vector3 = geosubmesh->mVertexBuffer->mNormal[position];997 998 x = vector3[0];999 y = vector3[1];1000 z = vector3[2];1001 1002 // Sets the vertex normal.1003 glNormal3f(x,y,z);1004 1005 // set the texture coordinates if needed1006 if (usetex)1007 {1008 vector2 = geosubmesh->mVertexBuffer->mTexCoords[position];1009 x = vector2[0];1010 y = vector2[1];1011 glTexCoord2f(x,y);1012 }1013 1014 // Gets the vertex coordinates.1015 vector3 = geosubmesh->mVertexBuffer->mPosition[position];1016 1017 x = vector3[0];1018 y = vector3[1];1019 z = vector3[2];1020 1021 // Sets the vertex position.1022 glVertex3f(x,y,z);1023 }1024 glEnd();1025 1042 } 1026 1043 … … 1034 1051 1035 1052 glBegin(GL_TRIANGLES); 1036 Geometry::SubMesh & foliageSubMesh = geoMesh->mSubMesh[lodTreeLib->GetLeavesSubMesh()]; 1037 Geometry::Vector3 auxv; 1038 for (int j=0; j<mGeoMeshViewUI->lod_index_data->indexCount[lodTreeLib->GetLeavesSubMesh()]; j++) 1039 { 1040 int k = mGeoMeshViewUI->lod_index_data->indices[lodTreeLib->GetLeavesSubMesh()][j]; 1053 1054 SubMesh & foliageSubMesh = geoMesh->mSubMesh[lodTreeLib->GetLeavesSubMesh()]; 1055 Vector3 auxv; 1056 1057 for ( int j = 0; 1058 j < mGeoMeshViewUI->lod_index_data-> 1059 indexCount[lodTreeLib->GetLeavesSubMesh()]; 1060 j++) 1061 { 1062 int k = mGeoMeshViewUI->lod_index_data-> 1063 indices[lodTreeLib->GetLeavesSubMesh()][j]; 1064 1041 1065 if (usetex) 1042 1066 { 1043 Geometry::Vector2 tc = foliageSubMesh.mVertexBuffer->mTexCoords[k];1067 Vector2 tc = foliageSubMesh.mVertexBuffer->mTexCoords[k]; 1044 1068 glTexCoord2f(tc.x,tc.y); 1045 1069 } 1046 auxv = foliageSubMesh.mVertexBuffer->mNormal[k]; 1070 1071 auxv = foliageSubMesh.mVertexBuffer->mNormal[k]; 1072 1047 1073 glNormal3f(auxv.x,auxv.y,auxv.z); 1048 auxv = foliageSubMesh.mVertexBuffer->mPosition[k]; 1074 1075 auxv = foliageSubMesh.mVertexBuffer->mPosition[k]; 1076 1049 1077 glVertex3f(auxv.x,auxv.y,auxv.z); 1050 1078 } 1079 1051 1080 glEnd(); 1052 1081 1053 1082 glColor3f(1,1,1); 1054 1083 glDisable(GL_ALPHA_TEST); 1055 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,0); 1084 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,0); 1056 1085 } 1057 1086 … … 1080 1109 { 1081 1110 if (mLodStrip) 1111 { 1082 1112 lodStripsLib->GoToLod(lod); 1113 } 1114 1083 1115 if (mLodTree) 1116 { 1084 1117 lodTreeLib->GoToTrunkLod(lod); 1118 } 1119 1085 1120 draw(); 1086 1121 } … … 1092 1127 { 1093 1128 if (mLodTree) 1129 { 1094 1130 lodTreeLib->GoToFoliageLod(lod); 1131 } 1132 1095 1133 draw(); 1096 1134 } … … 1117 1155 1118 1156 GLfloat light_ambient[] = {0.3,0.3,0.3,1.0}; 1119 GLfloat luzpos[] = {0.0,0.0,1.0,0.0};1120 GLfloat luzcolor[] = {1.0,1.0,1.0,1.0};1157 GLfloat luzpos[] = {0.0,0.0,1.0,0.0}; 1158 GLfloat luzcolor[] = {1.0,1.0,1.0,1.0}; 1121 1159 1122 1160 // glLightModelfv(GL_LIGHT_MODEL_AMBIENT, light_ambient); … … 1143 1181 // Set white color to the object. 1144 1182 glColor3d(1.0, 1.0, 1.0); 1183 1145 1184 GLfloat color_blanco[] = {1.0f,1.0f,1.0f,1.0f}; 1185 1146 1186 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,color_blanco); 1147 1187 … … 1183 1223 //glDisable(GL_LIGHTING); 1184 1224 glColor3d(0.0, 0.0, 0.0); 1225 1185 1226 GLfloat color[] = {0.0f,0.0f,0.0f,1.0f}; 1227 1186 1228 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,color); 1187 1229 … … 1215 1257 1216 1258 current_texture = ilutGLLoadImage((const ILstring)imgfile); 1259 1217 1260 if (!current_texture) 1261 { 1218 1262 fltk::alert("Error loading texture!"); 1263 } 1219 1264 1220 1265 ilShutDown(); … … 1228 1273 1229 1274 current_texture_submesh[isubmesh] = ilutGLLoadImage((const ILstring)imgfile); 1275 1230 1276 if (!current_texture_submesh[isubmesh]) 1277 { 1231 1278 fltk::alert("Error loading texture!"); 1279 } 1232 1280 1233 1281 ilShutDown(); … … 1239 1287 { 1240 1288 glDeleteTextures(1,¤t_texture); 1241 current_texture=0; 1242 } 1289 1290 current_texture = 0; 1291 } 1292 1243 1293 if (current_texture_submesh) 1244 1294 { 1245 1295 glDeleteTextures(getSubMeshCount(),current_texture_submesh); 1246 for (int i=0; i<getSubMeshCount(); i++) 1247 current_texture_submesh[i]=0; 1296 1297 for (int i = 0; i < getSubMeshCount(); i++) 1298 { 1299 current_texture_submesh[i] = 0; 1300 } 1248 1301 } 1249 1302 } … … 1251 1304 bool GeoMeshView::SetTextureRenderingState(int submesh) 1252 1305 { 1253 GLuint usetex = 0; 1306 GLuint usetex = 0; 1307 1254 1308 if (use_texture_mapping) 1255 1309 { 1256 1310 if (current_texture_submesh[submesh]) 1257 usetex=current_texture_submesh[submesh]; 1311 { 1312 usetex = current_texture_submesh[submesh]; 1313 } 1258 1314 else if (current_texture) 1259 usetex=current_texture; 1260 } 1315 { 1316 usetex = current_texture; 1317 } 1318 } 1319 1261 1320 if (usetex) 1321 { 1262 1322 glEnable(GL_TEXTURE_2D); 1323 } 1263 1324 else 1325 { 1264 1326 glDisable(GL_TEXTURE_2D); 1327 } 1265 1328 1266 1329 glBindTexture(GL_TEXTURE_2D,usetex); 1267 1330 1268 return (usetex !=0);1331 return (usetex != 0); 1269 1332 } 1270 1333 1271 1334 int GeoMeshView::findLeavesSubMesh(void) 1272 1335 { 1273 for (int i=0; i<geoMesh->mSubMeshCount; i++) 1274 if (geoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST) 1275 return i; 1276 return -1; 1277 } 1278 1336 for (int i = 0; i < geoMesh->mSubMeshCount; i++) 1337 { 1338 if (geoMesh->mSubMesh[i].mType == GEO_TRIANGLE_LIST) 1339 { 1340 return i; 1341 } 1342 } 1343 1344 return -1; 1345 } 1346 -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
r1526 r1543 1148 1148 // Refresh geometry attributes. 1149 1149 refreshApplicationBar(); 1150 1151 // Set textures. 1152 geoMeshView->resetTextures(); 1153 setTextures(); 1150 1154 } 1151 1155 … … 1289 1293 // Refresh data aplication. 1290 1294 refreshApplicationBar(); 1295 1296 // Set textures. 1297 geoMeshView->resetTextures(); 1298 setTextures(); 1291 1299 } 1292 1300 } … … 1645 1653 showEdgeCollapse(); 1646 1654 1655 // Deactive VMI option. 1656 mViewPointDriven->deactivate(); 1657 1647 1658 mButtonBuild->set_visible(); 1648 1659 //mButtonBuild->activate(); … … 1659 1670 // Shows the simplify panel. 1660 1671 showEdgeCollapse(); 1672 1673 // Deactive VMI option. 1674 mViewPointDriven->deactivate(); 1661 1675 1662 1676 mButtonBuild->set_visible(); … … 2264 2278 // Repaint the window. 2265 2279 mMainWindow->redraw(); 2280 2281 // Set textures. 2282 geoMeshView->resetTextures(); 2283 setTextures(); 2266 2284 } 2267 2285 } … … 2492 2510 { 2493 2511 material = string(mGeoMesh->mSubMesh[submesh].mMaterialName); 2494 2512 2495 2513 if (loader->existsMaterial(material)) 2496 { 2497 // Debug. 2498 cout << "Material " 2499 << material 2500 << " found." 2501 << endl; 2502 2514 { 2503 2515 filename = loader->getTextureFileName(material); 2504 2516 2505 // Debug.2506 cout << "File: "2507 << filename.c_str()2508 << endl;2509 2510 2517 geoMeshView->LoadTextureSubMesh(submesh, filename.c_str()); 2511 2518 } … … 3121 3128 } 3122 3129 3123 3130 // Build Textures menu. 3124 3131 void GeoMeshViewUI::BuildLoadTextureSubMeshMenu(void) 3125 3132 { … … 3127 3134 { 3128 3135 menuLoadTextures->clear(); 3129 for (int i=0; i<numSubMeshNames; i++) 3136 3137 for (int i = 0; i < numSubMeshNames; i++) 3130 3138 { 3131 3139 delete[] SubMeshNames[i]; … … 3135 3143 3136 3144 menuFileLoadTexture = new fltk::Item("Entire model"); 3145 3137 3146 menuFileLoadTexture->callback((fltk::Callback*)cb_menuFileLoadTexture); 3138 3147 menuLoadTextures->add(menuFileLoadTexture); 3139 3148 3140 numSubMeshNames =geoMeshView->getSubMeshCount();3141 SubMeshNames =new char*[numSubMeshNames];3142 3143 for (int i =0; i<numSubMeshNames; i++)3144 { 3145 SubMeshNames[i] =new char[10];3149 numSubMeshNames = geoMeshView->getSubMeshCount(); 3150 SubMeshNames = new char*[numSubMeshNames]; 3151 3152 for (int i = 0; i < numSubMeshNames; i++) 3153 { 3154 SubMeshNames[i] = new char[10]; 3146 3155 3147 3156 sprintf(SubMeshNames[i],"submesh %d",i); 3148 fltk::Item *item = new fltk::Item(SubMeshNames[i]); 3157 3158 fltk::Item *item = new fltk::Item(SubMeshNames[i]); 3159 3149 3160 item->callback((fltk::Callback*)cb_menuFileLoadTextureSubMesh); 3150 3161 menuLoadTextures->add(item); 3151 3162 } 3152 3163 } 3164
Note: See TracChangeset
for help on using the changeset viewer.