Changeset 998 for GTP/trunk/Lib/Geom/shared/GeoTool/src
- Timestamp:
- 05/31/06 10:20:15 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared
-
Property
svn:ignore
set to
arbolkk.mesh
arbol.leafseq
arbol.lod
arbol.mesh
arbol2.leafseq
arbol3.leafseq
arbol3.lod
arbol3.mesh
arbolkk.leafseq
arbolkk.lod
-
Property
svn:ignore
set to
-
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp
r995 r998 671 671 672 672 // bind current texture to use 673 GLuint usetex = 0; 674 if (use_texture_mapping) 675 { 676 if (current_texture_submesh[submesh]) 677 usetex=current_texture_submesh[submesh]; 678 else if (current_texture) 679 usetex=current_texture; 680 } 681 glBindTexture(GL_TEXTURE_2D,usetex); 682 673 bool usetex = SetTextureRenderingState(submesh); 683 674 684 675 // For each one of the strips. … … 797 788 geosubmesh = &geoMesh->mSubMesh[submesh]; 798 789 790 // bind current texture to use 791 bool usetex = SetTextureRenderingState(submesh); 792 799 793 // If wire is not selected. 800 794 if (!paintWire) … … 817 811 if (submesh == leavesSubMesh) 818 812 { 819 glColor3d(0.0,1.0,0.0); 820 GLfloat green[] = {0.0f,1.0f,0.0f,1.0f}; 821 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,green); 813 if (!usetex) 814 { 815 glColor3d(0.0,1.0,0.0); 816 GLfloat green[] = {0.0f,1.0f,0.0f,1.0f}; 817 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,green); 818 } 819 else 820 { 821 glEnable(GL_ALPHA_TEST); 822 glAlphaFunc(GL_GREATER,0.5f); 823 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,1); 824 } 822 825 } 823 826 } … … 832 835 } 833 836 834 // bind current texture to use 835 GLuint usetex = 0; 836 if (use_texture_mapping) 837 { 838 if (current_texture_submesh[submesh]) 839 usetex=current_texture_submesh[submesh]; 840 else if (current_texture) 841 usetex=current_texture; 842 } 843 glBindTexture(GL_TEXTURE_2D,usetex); 844 837 if (usetex) 838 { 839 glColor4f(1.0f,1.0f,1.0f,1.0f); 840 GLfloat white[] = {1.0f,1.0f,1.0f,1.0f}; 841 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,white); 842 } 843 845 844 // Enable arrays. 846 845 glEnableClientState(GL_VERTEX_ARRAY); … … 871 870 GL_UNSIGNED_INT, 872 871 mIndexArray[submesh]); 872 873 if (submesh==leavesSubMesh) 874 { 875 glDisable(GL_ALPHA_TEST); 876 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,0); 877 } 873 878 874 879 }//End drawTriangleList … … 895 900 { 896 901 // bind current texture to use 897 GLuint usetex = 0; 898 if (use_texture_mapping) 899 { 900 if (current_texture_submesh[submesh]) 901 usetex=current_texture_submesh[submesh]; 902 else if (current_texture) 903 usetex=current_texture; 904 } 905 glBindTexture(GL_TEXTURE_2D,usetex); 902 bool usetex = SetTextureRenderingState(submesh); 906 903 907 904 color_index = 0; … … 994 991 current_strip = 0; 995 992 996 glEnable(GL_ALPHA_TEST);997 // glEnable(GL_BLEND);998 993 // DRAW THE TRUNK AS A LODSTRIP OBJECT 999 994 … … 1001 996 for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) 1002 997 { 998 if (submesh==leavesSubMesh) 999 continue; 1000 1003 1001 // bind current texture to use 1004 GLuint usetex = 0; 1005 if (use_texture_mapping) 1006 { 1007 if (current_texture_submesh[submesh]) 1008 usetex=current_texture_submesh[submesh]; 1009 else if (current_texture) 1010 usetex=current_texture; 1011 } 1012 glBindTexture(GL_TEXTURE_2D,usetex); 1002 bool usetex = SetTextureRenderingState(submesh); 1013 1003 1014 1004 color_index = 0; … … 1082 1072 1083 1073 // DRAW THE LEAVES AS A TRIANGLE SOUP 1084 glColor3f(0,1,1); 1085 glDisable(GL_LIGHTING); 1074 // bind current texture to use 1075 bool usetex = SetTextureRenderingState(leavesSubMesh); 1076 1077 glEnable(GL_ALPHA_TEST); 1078 glAlphaFunc(GL_GREATER,0.5f); 1079 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,1); 1080 1086 1081 glBegin(GL_TRIANGLES); 1087 1082 const Geometry::VertexData *foliage_verts = lodTreeLib->Get_Foliage_VertexData(); … … 1090 1085 { 1091 1086 float vx,vy,vz; 1087 if (usetex) 1088 { 1089 foliage_verts->GetVertexTexCoord(foliage_inds->GetIndex(j),vx,vy); 1090 glTexCoord2f(vx,vy); 1091 } 1092 foliage_verts->GetVertexNormal(foliage_inds->GetIndex(j),vx,vy,vz); 1093 glNormal3f(vx,vy,vz); 1092 1094 foliage_verts->GetVertexCoord(foliage_inds->GetIndex(j),vx,vy,vz); 1093 1095 glVertex3f(vx,vy,vz); … … 1095 1097 glEnd(); 1096 1098 1097 glEnable(GL_LIGHTING);1098 1099 glColor3f(1,1,1); 1099 1100 }//End drawTriangleStrip. 1100 glDisable(GL_ALPHA_TEST); 1101 glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,0); 1102 } 1101 1103 1102 1104 … … 1150 1152 glMatrixMode(GL_PROJECTION); 1151 1153 glLoadIdentity(); 1152 1153 if (current_texture && use_texture_mapping)1154 glEnable(GL_TEXTURE_2D);1155 else1156 glDisable(GL_TEXTURE_2D);1157 1154 1158 1155 glEnable(GL_LIGHTING); … … 1299 1296 } 1300 1297 } 1298 1299 1300 bool GeoMeshView::SetTextureRenderingState(int submesh) 1301 { 1302 GLuint usetex = 0; 1303 if (use_texture_mapping) 1304 { 1305 if (current_texture_submesh[submesh]) 1306 usetex=current_texture_submesh[submesh]; 1307 else if (current_texture) 1308 usetex=current_texture; 1309 } 1310 if (usetex) 1311 glEnable(GL_TEXTURE_2D); 1312 else 1313 glDisable(GL_TEXTURE_2D); 1314 1315 glBindTexture(GL_TEXTURE_2D,usetex); 1316 1317 return (usetex!=0); 1318 } 1319 1320 1321 int GeoMeshView::findLeavesSubMesh(void) 1322 { 1323 for (int i=0; i<geoMesh->mSubMeshCount; i++) 1324 if (geoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST) 1325 return i; 1326 return -1; 1327 } -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
r995 r998 24 24 // Deactive Lod tree visualization. 25 25 geoMeshView->deactiveLodTree(); 26 27 geoMeshView->resetTextures();28 BuildLoadTextureSubMeshMenu();29 26 30 27 // Repaint the window. … … 922 919 // Show title. 923 920 mProcessTitle->label("Visualize LodTrees"); 921 922 // set the submesh with triangle lists as the leaves submesh 923 geoMeshView->setLeavesSubMesh(geoMeshView->findLeavesSubMesh()); 924 924 925 925 // Show the Visulize LodTree panel. … … 2521 2521 // Restore simplification state. 2522 2522 simplificationState = NO_SIMPLIFICATION; 2523 2524 geoMeshView->resetTextures(); 2525 BuildLoadTextureSubMeshMenu(); 2523 2526 } 2524 2527 }
Note: See TracChangeset
for help on using the changeset viewer.