📄 geode.cpp
字号:
{ OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindex+1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindex+3, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindex+2, pVertexIndices, pTexCoords, pTexIndices, fout); vindex+=2; } }}void Geode::OutputPolygonDARR(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices,const osg::DrawArrayLengths* drawArrayLengths, ostream& fout){ unsigned int vindex = drawArrayLengths->getFirst(); for(osg::DrawArrayLengths::const_iterator primItr = drawArrayLengths->begin(); primItr <drawArrayLengths->end(); ++primItr) { unsigned int localPrimLength; localPrimLength = *primItr; for(GLsizei primCount = 0; primCount < *primItr; ++primCount) { if ((primCount%localPrimLength)==0) { OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); } OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); ++vindex; } }}void Geode::OutputTriangleStripDARR(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices,const osg::DrawArrayLengths* drawArrayLengths, ostream& fout){ unsigned int vindex = drawArrayLengths->getFirst(); for(osg::DrawArrayLengths::const_iterator primItr = drawArrayLengths->begin(); primItr <drawArrayLengths->end(); ++primItr) { // RFJ!!!!!!!!!! fixes for indexing int localPrimLength= *primItr; bool evenodd=true; for(GLsizei primCount = 0; primCount < localPrimLength - 2; ++primCount) { OutputSurfHead(iCurrentMaterial, surfaceFlags, 3, fout); if (evenodd) { OutputVertex(vindex + primCount, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindex + primCount + 1, pVertexIndices, pTexCoords, pTexIndices, fout); } else { OutputVertex(vindex + primCount + 1 , pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindex + primCount, pVertexIndices, pTexCoords, pTexIndices, fout); } OutputVertex(vindex + primCount + 2, pVertexIndices, pTexCoords, pTexIndices, fout); evenodd=!evenodd; } vindex += localPrimLength; }}void Geode::OutputTriangleFanDARR(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices,const osg::DrawArrayLengths* drawArrayLengths, ostream& fout){ unsigned int vindex = drawArrayLengths->getFirst(); for(osg::DrawArrayLengths::const_iterator primItr = drawArrayLengths->begin(); primItr <drawArrayLengths->end(); ++primItr) { int localPrimLength = *primItr; for(GLsizei primCount = 0; primCount < localPrimLength - 2; primCount++) { OutputSurfHead(iCurrentMaterial,surfaceFlags,3, fout); OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindex+1+primCount, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindex+2+primCount, pVertexIndices, pTexCoords, pTexIndices, fout); } vindex += localPrimLength; }}// DrawElements .... Ubytevoid Geode::OutputTriangleDelsUByte(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices, const osg::DrawElementsUByte* drawElements, ostream& fout){ unsigned int primLength =3; unsigned int primCount = 0; for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItr<drawElements->end(); ++primCount,++primItr) { if ((primCount%primLength) == 0) { OutputSurfHead(iCurrentMaterial,surfaceFlags,primLength, fout); } unsigned int vindex=*primItr; OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); }}void Geode::OutputTriangleStripDelsUByte(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices, const osg::DrawElementsUByte* drawElements, ostream& fout){ unsigned int localPrimLength = 3; bool evenodd=true; for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItr<drawElements->end()-2; ++primItr) { unsigned int vindex=*primItr; unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); if (evenodd) { OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); } else { OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); } OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); evenodd=!evenodd; }}void Geode::OutputTriangleFanDelsUByte(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices, const osg::DrawElementsUByte* drawElements, ostream& fout){ const unsigned int localPrimLength = 3; unsigned int vindex=*(drawElements->begin()); for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItr<drawElements->end()-2; ++primItr) { unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); }}void Geode::OutputQuadStripDelsUByte(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices, const osg::DrawElementsUByte* drawElements, ostream& fout){ const unsigned int localPrimLength=4; for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItr<drawElements->end()-3; primItr+=2) { unsigned int vindex=*primItr; unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+3); unsigned int vindexp3=*(primItr+2); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp3, pVertexIndices, pTexCoords, pTexIndices, fout); }}void Geode::OutputQuadsDelsUByte(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices, const osg::DrawElementsUByte* drawElements, ostream& fout){ const unsigned int localPrimLength=4; for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItr<drawElements->end()-3; primItr+=4) { unsigned int vindex=*primItr; unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); unsigned int vindexp3=*(primItr+3); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp3, pVertexIndices, pTexCoords, pTexIndices, fout); }}void Geode::OutputPolygonDelsUByte(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices, const osg::DrawElementsUByte* drawElements, ostream& fout){ unsigned int primLength =drawElements->size(); unsigned int primCount = 0; OutputSurfHead(iCurrentMaterial,surfaceFlags,primLength, fout); for(osg::DrawElementsUByte::const_iterator primItr=drawElements->begin(); primItr<drawElements->end(); ++primCount,++primItr) { unsigned int vindex=*primItr; OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); }}// DrawElements .... UShortvoid Geode::OutputTriangleDelsUShort(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices, const osg::DrawElementsUShort* drawElements, ostream& fout){ unsigned int primLength =3; unsigned int primCount = 0; for(osg::DrawElementsUShort::const_iterator primItr=drawElements->begin(); primItr<drawElements->end(); ++primCount,++primItr) { if ((primCount%primLength) == 0) { OutputSurfHead(iCurrentMaterial,surfaceFlags,primLength, fout); } unsigned int vindex=*primItr; OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); }}void Geode::OutputTriangleStripDelsUShort(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices, const osg::DrawElementsUShort* drawElements, ostream& fout){ unsigned int localPrimLength = 3; bool evenodd=true; for(osg::DrawElementsUShort::const_iterator primItr=drawElements->begin(); primItr<drawElements->end()-2; ++primItr) { unsigned int vindex=*primItr; unsigned int vindexp1=*(primItr+1); unsigned int vindexp2=*(primItr+2); OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); if (evenodd) { OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); } else { OutputVertex(vindexp1, pVertexIndices, pTexCoords, pTexIndices, fout); OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); } OutputVertex(vindexp2, pVertexIndices, pTexCoords, pTexIndices, fout); evenodd=!evenodd; }}void Geode::OutputTriangleFanDelsUShort(const int iCurrentMaterial, const unsigned int surfaceFlags, const osg::IndexArray *pVertexIndices, const osg::Vec2 *pTexCoords, const osg::IndexArray *pTexIndices, const osg::DrawElementsUShort* drawElements, ostream& fout){ const unsigned int localPrimLength = 3;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -