- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/pfb/ConvertFromPerformer.cpp
r12132 r13041 384 384 osgTransform = new osg::MatrixTransform; 385 385 if (osgParent) osgParent->addChild(osgTransform); 386 386 387 387 osgTransform->setDataVariance(osg::Object::STATIC); 388 388 … … 585 585 geom->addPrimitiveSet(new osg::DrawArrayLengths(GL_TRIANGLE_STRIP,0,np,plen)); 586 586 break; 587 587 588 588 case PFGS_TRIFANS : 589 589 geom->addPrimitiveSet(new osg::DrawArrayLengths(GL_TRIANGLE_FAN,0,np,plen)); … … 593 593 geom->addPrimitiveSet(new osg::DrawArrayLengths(GL_TRIANGLE_STRIP,0,np,plen)); 594 594 break; 595 595 596 596 case PFGS_POLYS : 597 597 geom->addPrimitiveSet(new osg::DrawArrayLengths(GL_POLYGON,0,np,plen)); 598 598 break; 599 599 600 600 case PFGS_LINESTRIPS : 601 601 geom->addPrimitiveSet(new osg::DrawArrayLengths(GL_LINE_STRIP,0,np,plen)); … … 641 641 (*osg_coords)[i][2] = coords[i][2]; 642 642 } 643 643 644 644 geom->setVertexArray(osg_coords); 645 645 … … 659 659 { 660 660 int bind = geoset->getAttrBind( PFGS_TEXCOORD2 ); 661 662 661 662 663 663 if (bind==PFGS_PER_VERTEX && bind != PFGS_OFF) 664 664 { … … 727 727 cc++; 728 728 729 // straight forward mapping of normals across. 729 // straight forward mapping of normals across. 730 730 osg::Vec3Array* osg_norms = new osg::Vec3Array(cc); 731 731 for( i = 0; i < cc; i++ ) … … 735 735 (*osg_norms)[i][2] = norms[i][2]; 736 736 } 737 geom->setNormalArray(osg_norms); 737 geom->setNormalArray(osg_norms); 738 738 739 739 osg::UShortArray* osg_indices = new osg::UShortArray; 740 740 osg_indices->reserve(nv); 741 741 742 742 int ni=0; 743 743 for( i = 0; i < np; ++i) … … 752 752 } 753 753 } 754 755 if (ni!=nn) 754 755 if (ni!=nn) 756 756 { 757 757 OSG_INFO << "1 ni!=nn"<<std::endl; 758 758 } 759 759 760 760 geom->setNormalIndices(osg_indices); 761 762 761 762 763 763 } 764 764 else … … 766 766 osg::Vec3Array* osg_norms = new osg::Vec3Array; 767 767 osg_norms->reserve(nv); 768 768 769 769 int ni=0; 770 770 for( i = 0; i < np; ++i) … … 781 781 } 782 782 783 geom->setNormalArray(osg_norms); 783 geom->setNormalArray(osg_norms); 784 784 } 785 785 … … 814 814 (*osg_norms)[i][2] = norms[i][2]; 815 815 } 816 geom->setNormalArray(osg_norms); 816 geom->setNormalArray(osg_norms); 817 817 818 818 if(ilist) … … 848 848 cc++; 849 849 850 // straight forward mapping of normals across. 850 // straight forward mapping of normals across. 851 851 osg::Vec4Array* osg_colors = new osg::Vec4Array(cc); 852 852 for( i = 0; i < cc; i++ ) … … 857 857 (*osg_colors)[i][3] = colors[i][3]; 858 858 } 859 geom->setColorArray(osg_colors); 859 geom->setColorArray(osg_colors); 860 860 861 861 osg::UShortArray* osg_indices = new osg::UShortArray; 862 862 osg_indices->reserve(nv); 863 863 864 864 int ni=0; 865 865 for( i = 0; i < np; ++i) … … 874 874 } 875 875 } 876 877 if (ni!=nn) 876 877 if (ni!=nn) 878 878 { 879 879 OSG_INFO << "1 ni!=nn"<<std::endl; 880 880 } 881 881 882 882 geom->setColorIndices(osg_indices); 883 884 883 884 885 885 } 886 886 else … … 888 888 osg::Vec4Array* osg_colors = new osg::Vec4Array; 889 889 osg_colors->reserve(nv); 890 890 891 891 int ni=0; 892 892 for( i = 0; i < np; ++i) … … 903 903 } 904 904 905 geom->setColorArray(osg_colors); 905 geom->setColorArray(osg_colors); 906 906 } 907 907 } … … 949 949 { 950 950 } 951 952 953 951 952 953 954 954 visitGeoState(geom,geoset->getGState()); 955 955 956 956 if (flat_shaded_skip_per_primitive) 957 957 { … … 1204 1204 // } 1205 1205 // } 1206 // 1207 1208 1206 // 1207 1208 1209 1209 pfMaterial* front_mat = (pfMaterial*)geostate->getAttr(PFSTATE_FRONTMTL); 1210 1210 pfMaterial* back_mat = (pfMaterial*)geostate->getAttr(PFSTATE_BACKMTL); … … 1215 1215 1216 1216 pfTexEnv* texenv = (pfTexEnv*)geostate->getAttr(PFSTATE_TEXENV); 1217 1217 1218 1218 if(texenv) 1219 1219 { 1220 1220 osg::TexEnv* osgTexEnv = new osg::TexEnv(); 1221 1221 int mode = texenv->getMode(); 1222 1222 1223 1223 float r,g,b,a; 1224 1224 texenv->getBlendColor(&r, &g, &b, &a); 1225 1225 1226 1226 switch(mode) 1227 1227 { … … 1448 1448 // not quite sure what is supposed to be interpret the Peformer 1449 1449 // filter modes here so will simple go with OpenGL default. 1450 1450 1451 1451 return osg::Texture2D::LINEAR; 1452 1452 }
