📄 geode.cpp
字号:
// if (backface==osg::StateAttribute::ON) surfaceFlags |= 0x10;// else if (backface==osg::StateAttribute::OFF) surfaceFlags &= 0x0f; const osg::DrawArrays* drawArray = static_cast<const osg::DrawArrays*>(primitiveset); switch(primitiveset->getType()) { case(osg::PrimitiveSet::DrawArraysPrimitiveType): { switch(mode) { case(osg::PrimitiveSet::POINTS): break; case(osg::PrimitiveSet::LINES): OutputLines(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArray, fout); break; case(osg::PrimitiveSet::LINE_LOOP): OutputLineLoop(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArray, fout); break; case(osg::PrimitiveSet::LINE_STRIP): OutputLineStrip(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArray, fout); break; case(osg::PrimitiveSet::TRIANGLES): OutputTriangle(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArray, fout); break; case(osg::PrimitiveSet::QUADS): OutputQuads(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArray, fout); break; case(osg::PrimitiveSet::TRIANGLE_STRIP): OutputTriangleStrip(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArray, fout); break; case(osg::PrimitiveSet::TRIANGLE_FAN): OutputTriangleFan(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArray, fout); break; case(osg::PrimitiveSet::QUAD_STRIP): OutputQuadStrip(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArray, fout); break; case(osg::PrimitiveSet::POLYGON): OutputPolygon(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArray, fout); break; default: break; // unknown shape } break; } case(osg::PrimitiveSet::DrawArrayLengthsPrimitiveType): { const osg::DrawArrayLengths* drawArrayLengths = static_cast<const osg::DrawArrayLengths*>(primitiveset); switch(mode) { case(osg::PrimitiveSet::LINES): OutputLineDARR(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArrayLengths, fout); break; case(osg::PrimitiveSet::TRIANGLES): OutputTriangleDARR(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArrayLengths, fout); break; case(osg::PrimitiveSet::QUADS): OutputQuadsDARR(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArrayLengths, fout); break; case(osg::PrimitiveSet::TRIANGLE_STRIP): OutputTriangleStripDARR(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArrayLengths, fout); break; case(osg::PrimitiveSet::TRIANGLE_FAN): OutputTriangleFanDARR(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArrayLengths, fout); break; case(osg::PrimitiveSet::QUAD_STRIP): OutputQuadStripDARR(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArrayLengths, fout); break; case(osg::PrimitiveSet::POLYGON): OutputPolygonDARR(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawArrayLengths, fout); break; default: break; // unknown shape } /* const osg::DrawArrayLengths* drawArrayLengths = static_cast<const osg::DrawArrayLengths*>(primitiveset); unsigned int vindex = drawArrayLengths->getFirst(); for(osg::DrawArrayLengths::const_iterator primItr = drawArrayLengths->begin(); primItr !=drawArrayLengths->end(); ++primItr) { unsigned int localPrimLength; if (primLength == 0) localPrimLength = *primItr; else localPrimLength = primLength; for(GLsizei primCount = 0; primCount < *primItr; ++primCount) { if ((primCount%localPrimLength)==0) { OutputSurfHead(iCurrentMaterial,surfaceFlags,localPrimLength, fout); } OutputVertex(vindex, pVertexIndices, pTexCoords, pTexIndices, fout); ++vindex; } }*/ break; } case(osg::PrimitiveSet::DrawElementsUBytePrimitiveType): { const osg::DrawElementsUByte* drawElements = static_cast<const osg::DrawElementsUByte*>(primitiveset); switch(mode) { case(osg::PrimitiveSet::TRIANGLES): OutputTriangleDelsUByte(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::QUADS): OutputQuadsDelsUByte(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::TRIANGLE_STRIP): OutputTriangleStripDelsUByte(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::TRIANGLE_FAN): OutputTriangleFanDelsUByte(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::QUAD_STRIP): OutputQuadStripDelsUByte(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::POLYGON): OutputPolygonDelsUByte(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; default: break; // unknown shape }/* if (primLength == 0) primLength = primitiveset->getNumIndices(); const osg::DrawElementsUByte* drawElements = static_cast<const osg::DrawElementsUByte*>(primitiveset); 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); } */ break; } case(osg::PrimitiveSet::DrawElementsUShortPrimitiveType): { const osg::DrawElementsUShort* drawElements = static_cast<const osg::DrawElementsUShort*>(primitiveset); switch(mode) { case(osg::PrimitiveSet::TRIANGLES): OutputTriangleDelsUShort(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::QUADS): OutputQuadsDelsUShort(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::TRIANGLE_STRIP): OutputTriangleStripDelsUShort(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::TRIANGLE_FAN): OutputTriangleFanDelsUShort(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::QUAD_STRIP): OutputQuadStripDelsUShort(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::POLYGON): OutputPolygonDelsUShort(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; default: break; // unknown shape }/* if (primLength == 0) if (primLength == 0) primLength = primitiveset->getNumIndices(); const osg::DrawElementsUShort* drawElements = static_cast<const osg::DrawElementsUShort*>(primitiveset); 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); } */ break; } case(osg::PrimitiveSet::DrawElementsUIntPrimitiveType): { const osg::DrawElementsUInt* drawElements = static_cast<const osg::DrawElementsUInt*>(primitiveset); switch(mode) { case(osg::PrimitiveSet::TRIANGLES): OutputTriangleDelsUInt(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::QUADS): OutputQuadsDelsUInt(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::TRIANGLE_STRIP): OutputTriangleStripDelsUInt(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::TRIANGLE_FAN): OutputTriangleFanDelsUInt(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::QUAD_STRIP): OutputQuadStripDelsUInt(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; case(osg::PrimitiveSet::POLYGON): OutputPolygonDelsUInt(iCurrentMaterial,surfaceFlags, pVertexIndices, pTexCoords, pTexIndices, drawElements, fout); break; default: break; // unknown shape }/* if (primLength == 0) if (primLength == 0) primLength = primitiveset->getNumIndices(); const osg::DrawElementsUInt* drawElements = static_cast<const osg::DrawElementsUInt*>(primitiveset); unsigned int primCount=0; for(osg::DrawElementsUInt::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); } */ break; } default:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -