root/OpenSceneGraph/trunk/src/osgPlugins/txp/trpage_geom.cpp @ 12597

Revision 12597, 21.7 kB (checked in by robert, 3 years ago)

Resolved warnings reported by g++ 4.6's -Wunused-but-set-variable.

Warnings were:

/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osg/ShapeDrawable.cpp: In member function ‘void PrimitiveShapeVisitor::createHalfSphere(unsigned int, unsigned int, float, int, float, const Matrix&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osg/ShapeDrawable.cpp:1409:11: warning: variable ‘nzBase’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osg/ShapeDrawable.cpp:1410:11: warning: variable ‘nRatioBase’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/DelaunayTriangulator.cpp: In function ‘osgUtil::Triangle_list osgUtil::fillHole(osg::Vec3Array*, std::vector<unsigned int, std::allocator<unsigned int> >)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/DelaunayTriangulator.cpp:569:27: warning: variable ‘ptest’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/DelaunayTriangulator.cpp: In member function ‘bool osgUtil::DelaunayTriangulator::triangulate()’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/DelaunayTriangulator.cpp:979:45: warning: variable ‘curp’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/RenderStage.cpp: In member function ‘void osgUtil::RenderStage::runCameraSetUp(osg::RenderInfo?&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/RenderStage.cpp:631:18: warning: variable ‘stencilAttached’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgText/FadeText.cpp: In member function ‘void FadeTextPolytopeData::buildPolytope()’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgText/FadeText.cpp:74:20: warning: variable ‘edge23’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgText/FadeText.cpp:75:20: warning: variable ‘edge30’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgText/Text.cpp: In member function ‘void osgText::Text::computeBackdropPositions(unsigned int) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgText/Text.cpp:747:10: warning: variable ‘is_valid_size’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/NodeTrackerManipulator.cpp: In member function ‘virtual bool osgGA::NodeTrackerManipulator::performMovementLeftMouseButton(double, double, double)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/NodeTrackerManipulator.cpp:257:21: warning: variable ‘lookVector’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/NodeTrackerManipulator.cpp:259:21: warning: variable ‘upVector’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/TerrainManipulator.cpp: In member function ‘virtual bool osgGA::TerrainManipulator::performMovementMiddleMouseButton(double, double, double)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/TerrainManipulator.cpp:217:11: warning: variable ‘lookVector’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/TerrainManipulator.cpp:219:11: warning: variable ‘upVector’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgVolume/FixedFunctionTechnique.cpp: In member function ‘virtual void osgVolume::FixedFunctionTechnique::init()’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgVolume/FixedFunctionTechnique.cpp:124:30: warning: variable ‘tf’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgParticle/FluidProgram.cpp: In member function ‘virtual void osgParticle::FluidProgram::execute(double)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgParticle/FluidProgram.cpp:38:23: warning: variable ‘velBefore’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgShadow/ParallelSplitShadowMap.cpp: In member function ‘virtual void osgShadow::ParallelSplitShadowMap::cull(osgUtil::CullVisitor?&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgShadow/ParallelSplitShadowMap.cpp:593:22: warning: variable ‘bb’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgTerrain/GeometryTechnique.cpp: In member function ‘virtual void osgTerrain::GeometryTechnique::generateGeometry(osgTerrain::GeometryTechnique::BufferData?&, osgTerrain::Locator*, const osg::Vec3d&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgTerrain/GeometryTechnique.cpp:777:12: warning: variable ‘i_sampleFactor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgTerrain/GeometryTechnique.cpp:778:12: warning: variable ‘j_sampleFactor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/dds/ReaderWriterDDS.cpp: In function ‘osg::Image* ReadDDSFile(std::istream&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/dds/ReaderWriterDDS.cpp:314:10: warning: variable ‘is3dImage’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/dds/ReaderWriterDDS.cpp: In function ‘bool WriteDDSFile(const osg::Image*, std::ostream&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/dds/ReaderWriterDDS.cpp:721:10: warning: variable ‘is3dImage’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/hdr/hdrloader.cpp: In static member function ‘static bool HDRLoader::load(const char*, bool, HDRLoaderResult&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/hdr/hdrloader.cpp:101:10: warning: variable ‘cmd’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/vtf/ReaderWriterVTF.cpp: In function ‘osg::Image* ReadVTFFile(std::istream&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/vtf/ReaderWriterVTF.cpp:360:23: warning: variable ‘base’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/jp2/ReaderWriterJP2.cpp: In function ‘int putdata(jas_stream_t*, jas_image_t*, int)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/jp2/ReaderWriterJP2.cpp:41:13: warning: variable ‘linelen’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/Inventor/ConvertToInventor.cpp: In member function ‘void ConvertToInventor::processGeometry(const osg::Geometry*, ConvertToInventor::InventorState?*)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/Inventor/ConvertToInventor.cpp:1639:10: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/Inventor/ConvertFromInventor.cpp: In member function ‘virtual SbBool? SoVRMLImageTextureOsg::readInstance(SoInput?*, short unsigned int)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/Inventor/ConvertFromInventor.cpp:1264:16: warning: variable ‘retval’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/GeometryRecords.cpp: In member function ‘virtual void flt::Face::readRecord(flt::RecordInputStream?&, flt::Document&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/GeometryRecords.cpp:369:19: warning: variable ‘secondaryPackedColor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/GeometryRecords.cpp: In member function ‘virtual void flt::Mesh::readRecord(flt::RecordInputStream?&, flt::Document&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/GeometryRecords.cpp:942:19: warning: variable ‘secondaryPackedColor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp: In member function ‘virtual osgDB::ReaderWriter::ReadResult? FLTReaderWriter::readNode(std::istream&, const Options*) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp:427:40: warning: variable ‘pos’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ive/ShapeAttributeList.cpp: In member function ‘void ive::ShapeAttributeList::write(ive::DataOutputStream?*)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ive/ShapeAttributeList.cpp:31:48: warning: variable ‘it’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp: In member function ‘void ac3d::Geode::ProcessGeometry?(std::ostream&, unsigned int)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp:806:35: warning: variable ‘fRep_s’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp:806:43: warning: variable ‘fRep_t’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp:807:35: warning: variable ‘fOffset_s’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp:807:46: warning: variable ‘fOffset_t’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp:932:38: warning: variable ‘primLength’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_geom.cpp: In member function ‘virtual bool trpgGeometry::Write(trpgWriteBuffer&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_geom.cpp:615:19: warning: variable ‘u’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_material.cpp: In member function ‘int trpgMatTable::AddMaterial?(const trpgMaterial&, bool)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_material.cpp:103:10: warning: variable ‘spaceInTable’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_rarchive.cpp: In member function ‘virtual bool trpgr_Archive::ReadHeader?(bool)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_rarchive.cpp:261:14: warning: variable ‘headerHasTexTable’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/unzip.cpp: In member function ‘ZRESULT TUnzip::Get(int, ZIPENTRY*)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/unzip.cpp:4055:8: warning: variable ‘hidden’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/unzip.cpp:4055:22: warning: variable ‘system’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/unzip.cpp:4055:36: warning: variable ‘archive’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/ZipArchive.cpp: In member function ‘virtual bool ZipArchive::getFileNames(osgDB::Archive::FileNameList?&) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/ZipArchive.cpp:91:37: warning: variable ‘iterEnd’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/pvr/ReaderWriterPVR.cpp: In member function ‘osgDB::ReaderWriter::ReadResult? ReaderWriterPVR::readPVRStream(std::istream&) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/pvr/ReaderWriterPVR.cpp:155:14: warning: variable ‘hasAlpha’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/View.cpp: In function ‘osg::Geometry* create3DSphericalDisplayDistortionMesh(const Vec3&, const Vec3&, const Vec3&, double, double, osg::Image*, const Matrix&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/View.cpp:737:15: warning: variable ‘cursor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/View.cpp: In function ‘osg::Geometry* createParoramicSphericalDisplayDistortionMesh(const Vec3&, const Vec3&, const Vec3&, double, double, osg::Image*, const Matrix&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/View.cpp:1130:19: warning: variable ‘cursor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/View.cpp:1118:15: warning: variable ‘dx’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/GraphicsWindowX11.cpp: In member function ‘virtual void osgViewer::GraphicsWindowX11::checkEvents()’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/GraphicsWindowX11.cpp:1181:10: warning: variable ‘destroyWindowRequested’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/cfg/ConfigParser.cpp: In member function ‘bool osgProducer::CameraConfig::parseFile(const string&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/cfg/ConfigParser.cpp:2247:13: warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgQt/QGraphicsViewAdapter.cpp: In member function ‘bool osgQt::QGraphicsViewAdapter::handlePointerEvent(int, int, int)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgQt/QGraphicsViewAdapter.cpp:344:17: warning: variable ‘viewportGeometry’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgdistortion/osgdistortion.cpp: In function ‘osg::Node* createDistortionSubgraph(osg::Node*, const Vec4&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgdistortion/osgdistortion.cpp:125:19: warning: variable ‘cursor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgdistortion/osgdistortion.cpp:126:19: warning: variable ‘texcoord’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgdistortion/osgdistortion.cpp: In function ‘osg::Geometry* createDomeDistortionMesh(const Vec3&, const Vec3&, const Vec3&, osg::ArgumentParser?&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgdistortion/osgdistortion.cpp:358:15: warning: variable ‘cursor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgposter/osgposter.cpp: In function ‘int main(int, char**)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgposter/osgposter.cpp:253:31: warning: variable ‘outputTiles’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgthreadedterrain/osgthreadedterrain.cpp: In function ‘int main(int, char**)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgthreadedterrain/osgthreadedterrain.cpp:669:10: warning: variable ‘readParameter’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgtext3D/TextNode.cpp: In member function ‘virtual void osgText::Layout::layout(osgText::TextNode?&) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgtext3D/TextNode.cpp:80:11: warning: variable ‘characterHeightScale’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgvolume/osgvolume.cpp: In function ‘int main(int, char**)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgvolume/osgvolume.cpp:678:38: warning: variable ‘internalFormatMode’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgwidgetcanvas/osgwidgetcanvas.cpp: In function ‘bool windowMouseOver(osgWidget::Event&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgwidgetcanvas/osgwidgetcanvas.cpp:27:24: warning: variable ‘xy’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgwidgetcanvas/osgwidgetcanvas.cpp: In function ‘bool widgetMouseOver(osgWidget::Event&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgwidgetcanvas/osgwidgetcanvas.cpp:35:24: warning: variable ‘xy’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/p3d/ReaderWriterP3D.cpp: In member function ‘osg::Node* ReaderWriterP3DXML::parseXmlGraph(osgDB::XmlNode?*, bool, osgDB::Options*) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/p3d/ReaderWriterP3D.cpp:2121:10: warning: variable ‘readSlide’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/applications/present3D/present3D.cpp: In function ‘int main(int, char**)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/applications/present3D/present3D.cpp:639:10: warning: variable ‘sizesSpecified’ set but not used [-Wunused-but-set-variable]

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* ************************
2   Copyright Terrain Experts Inc.
3   Terrain Experts Inc (TERREX) reserves all rights to this source code
4   unless otherwise specified in writing by the President of TERREX.
5   This copyright may be updated in the future, in which case that version
6   supercedes this one.
7   -------------------
8   Terrex Experts Inc.
9   4400 East Broadway #314
10   Tucson, AZ  85711
11   info@terrex.com
12   Tel: (520) 323-7990
13   ************************
14   */
15
16/* trpage_geom.cpp
17    Methods for the trpgGeometry class.
18    This includes read and write methods.
19    You should only need to change something in here if you want to modify
20     what trpgGeometry contains.
21    */
22
23#include <stdlib.h>
24#include <stdio.h>
25#include <string.h>
26
27#include <trpage_geom.h>
28#include <trpage_read.h>
29
30#if defined(_WIN32)
31#define ALIGNMENT_WORKAROUND    false
32#else
33#define ALIGNMENT_WORKAROUND    true
34#endif
35
36// Constructor
37trpgGeometry::trpgGeometry()
38{
39    primType = Polygons;
40    normBind = Overall;
41    numPrim = 0;
42}
43trpgGeometry::~trpgGeometry()
44{
45}
46
47// Reset function
48void trpgGeometry::Reset()
49{
50    primType = Polygons;
51    numPrim = 0;
52    primLength.resize(0);
53    materials.resize(0);
54    vertDataFloat.resize(0);
55    vertDataDouble.resize(0);
56    normBind = Overall;
57    normDataFloat.resize(0);
58    normDataDouble.resize(0);
59    colors.resize(0);
60    texData.resize(0);
61    edgeFlags.resize(0);
62}
63
64// Set functions
65void trpgGeometry::SetPrimType(PrimType type)
66{
67    primType = type;
68}
69void trpgGeometry::SetPrimLengths(int num,const int *len)
70{
71    if (num < 0)
72        return;
73
74    numPrim = num;
75    for (int i=0;i<num;i++)
76        primLength.push_back(len[i]);
77}
78void trpgGeometry::AddPrimLength(int len)
79{
80    if (len < 0)
81        return;
82
83    numPrim++;
84    primLength.push_back(len);
85}
86void trpgGeometry::AddPrim()
87{
88    numPrim++;
89}
90void trpgGeometry::SetNumPrims(int num)
91{
92    numPrim = num;
93}
94void trpgGeometry::SetNumMaterial(int no)
95{
96    if (no < 0)
97        return;
98
99    materials.resize(no,-1);
100}
101void trpgGeometry::SetMaterial(int which,int mat,bool isLocal)
102{
103    if (which < 0 || which >= (int)materials.size())
104        return;
105
106    materials[which] = (isLocal ? -(mat+1) : mat);
107}
108void trpgGeometry::SetMaterials(int32 num,const int32 *mat)
109{
110    materials.resize(num);
111    for (int i=0;i<num;i++)
112        materials[i] = mat[i];
113}
114int trpgGeometry::AddMaterial(int mat)
115{
116    materials.push_back(mat);
117
118    return materials.size()-1;
119}
120
121// Geometry/color/normal/etc... set functions
122void trpgGeometry::SetVertices(int num,const float32 *data)
123{
124    if (num < 0)
125        return;
126
127    vertDataFloat.resize(0);
128    vertDataDouble.resize(0);
129    for (int i=0;i<3*num;i++)
130        vertDataFloat.push_back(data[i]);
131}
132void trpgGeometry::SetVertices(int num,const float64 *data)
133{
134    if (num < 0)
135        return;
136
137    vertDataFloat.resize(0);
138    vertDataDouble.resize(0);
139    for (int i=0;i<3*num;i++)
140        vertDataDouble.push_back(data[i]);
141}
142void trpgGeometry::AddVertex(DataType type,trpg3dPoint &pt)
143{
144    if (type == FloatData) {
145        vertDataFloat.push_back(static_cast<float>(pt.x));
146        vertDataFloat.push_back(static_cast<float>(pt.y));
147        vertDataFloat.push_back(static_cast<float>(pt.z));
148    } else {
149        vertDataDouble.push_back(pt.x);
150        vertDataDouble.push_back(pt.y);
151        vertDataDouble.push_back(pt.z);
152    }
153}
154void trpgGeometry::SetNormals(int num,BindType bind,const float32 *data)
155{
156    if (num < 0)
157        return;
158
159    normBind = bind;
160    normDataFloat.resize(0);
161    normDataDouble.resize(0);
162    for (int i=0;i<3*num;i++)
163        normDataFloat.push_back(data[i]);
164}
165void trpgGeometry::SetNormals(int num,BindType bind,const float64 *data)
166{
167    if (num <0)
168        return;
169
170    normBind = bind;
171    normDataFloat.resize(0);
172    normDataDouble.resize(0);
173    for (int i=0;i<3*num;i++)
174        normDataDouble.push_back(data[i]);
175}
176void trpgGeometry::AddNormal(DataType type,trpg3dPoint &pt)
177{
178    if (type == FloatData) {
179        normDataFloat.push_back(static_cast<float>(pt.x));
180        normDataFloat.push_back(static_cast<float>(pt.y));
181        normDataFloat.push_back(static_cast<float>(pt.z));
182    } else {
183        normDataDouble.push_back(pt.x);
184        normDataDouble.push_back(pt.y);
185        normDataDouble.push_back(pt.z);
186    }
187}
188// Constructor
189trpgColorInfo::trpgColorInfo()
190{
191}
192trpgColorInfo::~trpgColorInfo()
193{
194}
195void trpgColorInfo::Reset()
196{
197    bind = 0;
198    type = 0;
199    data.resize(0);
200}
201void trpgGeometry::SetColors(int num,ColorType type,BindType bind,const trpgColor *data)
202{
203    trpgColorInfo ci;
204
205    if (num < 0)
206        return;
207
208    // Set up color list
209    ci.type = type;
210    ci.bind = bind;
211    for (int i=0;i<num;i++)
212        ci.data.push_back(data[i]);
213
214    colors.push_back(ci);
215}
216// Constructor
217trpgTexData::trpgTexData()
218{
219}
220trpgTexData::~trpgTexData()
221{
222}
223void trpgTexData::set(int num,int in_bind,const float32 *data)
224{
225    bind = in_bind;
226    floatData.resize(0);
227    doubleData.resize(0);
228    for (int i=0;i<2*num;i++)
229        floatData.push_back(data[i]);
230}
231void trpgTexData::set(int num,int in_bind,const float64 *data)
232{
233    bind = in_bind;
234    floatData.resize(0);
235    doubleData.resize(0);
236    for (int i=0;i<2*num;i++)
237        doubleData.push_back(data[i]);
238}
239void trpgTexData::Reset()
240{
241    bind = 0;
242    floatData.resize(0);
243    doubleData.resize(0);
244}
245
246void trpgGeometry::SetTexCoords(int num,BindType bind,const float32 *data)
247{
248    if (num < 0)
249        return;
250
251    trpgTexData td;
252    td.set(num,bind,data);
253    texData.push_back(td);
254}
255void trpgGeometry::SetTexCoords(int num,BindType bind,const float64 *data)
256{
257    if (num < 0)
258        return;
259
260    trpgTexData td;
261    td.set(num,bind,data);
262    texData.push_back(td);
263}
264void trpgGeometry::AddTexCoord(DataType type,trpg2dPoint &pt, int n)
265{
266    if ((n<0) || (n >= (int)texData.size()))
267        return;
268    trpgTexData *td = &texData[n];
269
270    if (type == FloatData) {
271        td->floatData.push_back(static_cast<float>(pt.x));
272        td->floatData.push_back(static_cast<float>(pt.y));
273    } else {
274        td->doubleData.push_back(pt.x);
275        td->doubleData.push_back(pt.y);
276    }
277}
278void trpgGeometry::AddTexCoord(DataType type,std::vector<trpg2dPoint> &pts)
279{
280    if (texData.size() != pts.size())
281        return;
282
283    for (unsigned int loop = 0; loop < pts.size(); loop++ ) {
284        trpgTexData *td = &texData[loop];
285
286        if (type == FloatData) {
287            td->floatData.push_back(static_cast<float>(pts[loop].x));
288            td->floatData.push_back(static_cast<float>(pts[loop].y));
289        } else {
290            td->doubleData.push_back(pts[loop].x);
291            td->doubleData.push_back(pts[loop].y);
292        }
293    }
294}
295void trpgGeometry::AddTexCoords(BindType bind)
296{
297    trpgTexData td;
298    td.bind = bind;
299    texData.push_back(td);
300}
301void trpgGeometry::SetEdgeFlags(int num,const char *flags)
302{
303    if (num < 0)
304        return;
305
306    edgeFlags.resize(0);
307    for (int i=0;i<num;i++)
308        edgeFlags.push_back(flags[i]);
309}
310
311// Get methods
312bool trpgGeometry::GetPrimType(PrimType &t) const
313{
314    if (!isValid()) return false;
315    t = (PrimType)primType;
316    return true;
317}
318bool trpgGeometry::GetNumPrims(int &n) const
319{
320    if (!isValid()) return false;
321    n = numPrim;
322    return true;
323}
324bool trpgGeometry::GetPrimLengths(int *ret) const
325{
326    if (!isValid()) return false;
327    for (int i=0;i<numPrim;i++)
328        ret[i] = primLength[i];
329    return true;
330}
331bool trpgGeometry::GetNumMaterial(int &n) const
332{
333    if (!isValid()) return false;
334    n = materials.size();
335    return true;
336}
337bool trpgGeometry::GetMaterial(int id,int32 &m,bool &isLocal) const
338{
339    isLocal = false;
340    if (!isValid() || id < 0 || id >= (int)materials.size()) return false;
341    m = materials[id];
342    if (m < 0) {
343        m = -m - 1;
344        isLocal = true;
345    }
346    return true;
347}
348bool trpgGeometry::GetNumVertex(int &v) const
349{
350    if (!isValid()) return false;
351    int nvf = vertDataFloat.size();
352    int nvd = vertDataDouble.size();
353    v = MAX(nvf,nvd);
354    v = v / 3;
355    return true;
356}
357bool trpgGeometry::GetVertices(float32 *v) const
358{
359    unsigned int i;
360
361    if (!isValid()) return false;
362    if (vertDataFloat.size() != 0)
363        for (i=0;i<vertDataFloat.size();i++)
364            v[i] = vertDataFloat[i];
365    else
366        for (i=0;i<vertDataDouble.size();i++)
367            v[i] = static_cast<float32>(vertDataDouble[i]);
368    return true;
369}
370bool trpgGeometry::GetVertices(float64 *v) const
371{
372    unsigned int i;
373
374    if (!isValid()) return false;
375    if (vertDataFloat.size() != 0)
376        for (i=0;i<vertDataFloat.size();i++)
377            v[i] = vertDataFloat[i];
378    else
379        for (i=0;i<vertDataDouble.size();i++)
380            v[i] = vertDataDouble[i];
381    return true;
382}
383bool trpgGeometry::GetVertex(int n,trpg3dPoint &pt) const
384{
385    int id = 3*n;
386    int idMax = 3*n+2;
387    if (id < 0 || (idMax >= (int)vertDataFloat.size() && idMax >= (int)vertDataDouble.size()))
388        return false;
389    if (vertDataFloat.size() > vertDataDouble.size()) {
390        pt.x = vertDataFloat[id];
391        pt.y = vertDataFloat[id+1];
392        pt.z = vertDataFloat[id+2];
393    } else {
394        pt.x = vertDataDouble[id];
395        pt.y = vertDataDouble[id+1];
396        pt.z = vertDataDouble[id+2];
397    }
398    return true;
399}
400bool trpgGeometry::GetNumNormal(int32 &n) const
401{
402    if (!isValid()) return false;
403    if (normDataFloat.size() != 0)
404        n = normDataFloat.size();
405    if (normDataDouble.size() != 0)
406        n = normDataDouble.size();
407    n = n / 3;
408    return true;
409}
410bool trpgGeometry::GetNormals(float32 *v) const
411{
412    unsigned int i;
413
414    if (!isValid()) return false;
415    if (normDataFloat.size() != 0)
416        for (i=0;i<normDataFloat.size();i++)
417            v[i] = normDataFloat[i];
418    else
419        for (i=0;i<normDataDouble.size();i++)
420            v[i] = static_cast<float32>(normDataDouble[i]);
421    return true;
422}
423bool trpgGeometry::GetNormals(float64 *v) const
424{
425    unsigned int i;
426
427    if (!isValid()) return false;
428    if (normDataFloat.size() != 0)
429        for (i=0;i<normDataFloat.size();i++)
430            v[i] = normDataFloat[i];
431    else
432        for (i=0;i<normDataDouble.size();i++)
433            v[i] = normDataDouble[i];
434    return true;
435}
436bool trpgGeometry::GetNumColorSets(int &n) const
437{
438    if (!isValid()) return false;
439    n = colors.size();
440    return true;
441}
442bool trpgGeometry::GetColorSet(int id,trpgColorInfo *ci) const
443{
444    if (!isValid() || id < 0 || id >= (int)colors.size()) return false;
445    *ci = colors[id];
446    return true;
447}
448bool trpgGeometry::GetNumTexCoordSets(int &n) const
449{
450    if (!isValid()) return false;
451    n = texData.size();
452    return true;
453}
454bool trpgGeometry::GetTexCoordSet(int id,trpgTexData *tx) const
455{
456    if (!isValid() || id < 0 || id >= (int)texData.size()) return false;
457    *tx = texData[id];
458    return true;
459}
460const trpgTexData *trpgGeometry::GetTexCoordSet(int id) const
461{
462    if (!isValid() || id < 0 || id >= (int)texData.size()) return 0;
463    return &(texData[id]);
464}
465bool trpgGeometry::GetNumEdgeFlag(int &n) const
466{
467    if (!isValid()) return false;
468    n = edgeFlags.size();
469    return true;
470}
471bool trpgGeometry::GetEdgeFlags(char *e) const
472{
473    if (!isValid()) return false;
474    for (unsigned int i=0;i<edgeFlags.size();i++)
475        e[i] = edgeFlags[i];
476    return true;
477}
478
479// Validity check
480// Note: maybe I should do this sometime
481bool trpgGeometry::isValid() const
482{
483    return true;
484}
485
486// Write geometry fields.
487// Order doesn't matter very much for this
488bool trpgGeometry::Write(trpgWriteBuffer &buf)
489{
490    unsigned int i,j;
491
492    if (!isValid())
493        return false;
494
495    buf.Begin(TRPG_GEOMETRY);
496    /* Primitive info
497        Primitive Type
498         Number of primitives
499        Primitive array lengths
500        */
501    buf.Begin(TRPG_GEOM_PRIM);
502     buf.Add(primType);
503    buf.Add(numPrim);
504    if (primLength.size() != 0) {
505        buf.Add((uint8)1);
506        for (i=0;i<(unsigned int)numPrim;i++)
507            buf.Add(primLength[i]);
508    } else
509        buf.Add((uint8)0);
510    buf.End();
511
512    /* Material info
513        Num materials
514        Material indicies
515        */
516    if (materials.size() > 0) {
517        buf.Begin(TRPG_GEOM_MATERIAL);
518        buf.Add((int32)materials.size());
519        for (i=0;i<materials.size();i++)
520            buf.Add(materials[i]);
521        buf.End();
522    }
523
524    /* Vertices
525        Float and Double should never both be here
526        Num vertex
527        Vertex data
528        */
529    if (vertDataFloat.size() > 0) {
530        buf.Begin(TRPG_GEOM_VERT32);
531        int32 num = vertDataFloat.size()/3;
532        buf.Add(num);
533        for (i=0;i<(unsigned int)3*num;i++)
534            buf.Add(vertDataFloat[i]);
535        buf.End();
536    }
537    if (vertDataDouble.size() > 0) {
538        buf.Begin(TRPG_GEOM_VERT64);
539        int32 num = vertDataDouble.size()/3;
540        buf.Add(num);
541        for (i=0;i<(unsigned int)3*num;i++)
542            buf.Add(vertDataDouble[i]);
543        buf.End();
544    }
545
546    /* Normals
547        Normal binding
548        Num normals
549        Normal data
550        */
551    if (normDataFloat.size() > 0) {
552        buf.Begin(TRPG_GEOM_NORM32);
553        buf.Add((int32)normBind);
554        int32 num = normDataFloat.size()/3;
555        buf.Add(num);
556        for (i=0;i<(unsigned int)3*num;i++)
557            buf.Add(normDataFloat[i]);
558        buf.End();
559    }
560    if (normDataDouble.size() > 0) {
561        buf.Begin(TRPG_GEOM_NORM64);
562        buf.Add((int32)normBind);
563        int32 num = normDataDouble.size()/3;
564        buf.Add(num);
565        for (i=0;i<(unsigned int)3*num;i++)
566            buf.Add(normDataDouble[i]);
567        buf.End();
568    }
569
570    /* Colors
571        Color binding
572        Num colors
573        Colors
574           */
575    if (colors.size() > 0) {
576        for (i=0;i<colors.size();i++) {
577            trpgColorInfo &ci = colors[i];
578            if (ci.data.size()) {
579                buf.Begin(TRPG_GEOM_COLOR);
580                buf.Add((int32)ci.type);
581                buf.Add((int32)ci.bind);
582                buf.Add((int32)ci.data.size());
583                for (j=0;j<ci.data.size();j++)
584                    buf.Add(ci.data[j]);
585                buf.End();
586            }
587        }
588    }
589
590    /* Texture coordinates
591        Binding
592        Num coords
593        Texture coords
594        */
595    for (i=0;i<texData.size();i++) {
596        trpgTexData &td = texData[i];
597        if (td.floatData.size()) {
598            buf.Begin(TRPG_GEOM_TEX32);
599            buf.Add((int32)td.bind);
600            int32 num = td.floatData.size()/2;
601            buf.Add(num);
602            for (j=0;j<(unsigned int)num*2;j++)
603                buf.Add(td.floatData[j]);
604            buf.End();
605        }
606        if (td.doubleData.size()) {
607            buf.Begin(TRPG_GEOM_TEX64);
608            buf.Add((int32)td.bind);
609            int32 num = td.doubleData.size()/2;
610            buf.Add(num);
611            for (j=0;j<(unsigned int)num*2;j++)
612                buf.Add(td.doubleData[j]);
613            buf.End();
614        }
615    }
616
617    // Edge flags (for triangle strips, etc..)
618    if (edgeFlags.size() > 0) {
619        buf.Begin(TRPG_GEOM_EFLAG);
620        buf.Add((int32)edgeFlags.size());
621        for (i=0;i<edgeFlags.size();i++)
622            buf.Add(edgeFlags[i]);
623        buf.End();
624    }
625
626    buf.End();
627
628    return true;
629}
630
631// Geometry class is made up of individual tokens.
632class geomCB : public trpgr_Callback {
633public:
634    void *Parse(trpgToken,trpgReadBuffer &buf);
635    trpgGeometry *geom;
636};
637
638void *geomCB::Parse(trpgToken tok,trpgReadBuffer &buf)
639{
640    int32 *iData;
641    int32 num,primType,bind,type;
642    float32 *fData;
643    float64 *dData;
644    trpgColor *cData;
645    char *charData;
646    uint8 hasPrimLen;
647
648    try {
649        switch (tok) {
650        case TRPG_GEOM_PRIM:
651            buf.Get(primType);
652            geom->SetPrimType((trpgGeometry::PrimType)primType);
653            buf.Get(num);
654            if (num < 0) throw 1;
655            geom->SetNumPrims(num);
656            buf.Get(hasPrimLen);
657            if (hasPrimLen) {
658                buf.GetArray(num,&iData);
659                if (ALIGNMENT_WORKAROUND)
660                {
661                    int32 *aligned;
662                    aligned = (int32 *)calloc (num, sizeof(int32));
663                    memcpy (aligned, iData, num * sizeof(int32));
664                    geom->SetPrimLengths(num, aligned);
665                    free (aligned);
666                }
667                else
668                    geom->SetPrimLengths(num,iData);
669            }
670            break;
671        case TRPG_GEOM_MATERIAL:
672            buf.Get(num);
673            if (num < 0) throw 1;
674            buf.GetArray(num,&iData);
675            if (ALIGNMENT_WORKAROUND)
676            {
677                int32 *aligned;
678                aligned = (int32 *)calloc (num, sizeof(int32));
679                memcpy (aligned, iData, num * sizeof(int32));
680                geom->SetMaterials(num,aligned);
681                free (aligned);
682            }
683            else
684                geom->SetMaterials(num,iData);
685            break;
686        case TRPG_GEOM_VERT32:
687            buf.Get(num);
688            if (num < 0) throw 1;
689            buf.GetArray(3*num,&fData);
690            if (ALIGNMENT_WORKAROUND)
691            {
692                float32 *aligned;
693                aligned = (float32 *)calloc (3*num, sizeof(float32));
694                memcpy (aligned, fData, 3*num * sizeof(float32));
695                geom->SetVertices(num,aligned);
696                free (aligned);
697            }
698            else
699                geom->SetVertices(num,fData);
700            break;
701        case TRPG_GEOM_VERT64:
702            buf.Get(num);
703            if (num < 0) throw 1;
704            buf.GetArray(3*num,&dData);
705            if (ALIGNMENT_WORKAROUND)
706            {
707                float64 *aligned;
708                aligned = (float64 *)calloc (3*num, sizeof(float64));
709                memcpy (aligned, dData, 3*num * sizeof(float64));
710                geom->SetVertices(num,aligned);
711                free (aligned);
712            }
713            else
714                geom->SetVertices(num,dData);
715            break;
716        case TRPG_GEOM_NORM32:
717            buf.Get(bind);
718            buf.Get(num);
719            if (num < 0) throw 1;
720            buf.GetArray(3*num,&fData);
721            if (ALIGNMENT_WORKAROUND)
722            {
723                float32 *aligned;
724                aligned = (float32 *)calloc (3*num, sizeof(float32));
725                memcpy (aligned, fData, 3*num * sizeof(float32));
726                geom->SetNormals(num,(trpgGeometry::BindType)bind,aligned);
727                free (aligned);
728            }
729            else
730                geom->SetNormals(num,(trpgGeometry::BindType)bind,fData);
731            break;
732        case TRPG_GEOM_NORM64:
733            buf.Get(bind);
734            buf.Get(num);
735            if (num < 0) throw 1;
736            buf.GetArray(3*num,&dData);
737            if (ALIGNMENT_WORKAROUND)
738            {
739                float64 *aligned;
740                aligned = (float64 *)calloc (3*num, sizeof(float64));
741                memcpy (aligned, dData, 3*num * sizeof(float64));
742                geom->SetNormals(num,(trpgGeometry::BindType)bind,aligned);
743                free (aligned);
744            }
745            else
746                geom->SetNormals(num,(trpgGeometry::BindType)bind,dData);
747            break;
748        case TRPG_GEOM_COLOR:
749            buf.Get(num);
750            if (num < 0) throw 1;
751            buf.Get(type);
752            buf.Get(bind);
753            buf.GetArray(num,&cData);
754            if (ALIGNMENT_WORKAROUND)
755            {
756                trpgColor *aligned;
757                aligned = (trpgColor *)calloc (num, sizeof(trpgColor));
758                memcpy (aligned, cData, num * sizeof(trpgColor));
759                geom->SetColors(num,(trpgGeometry::ColorType)type,(trpgGeometry::BindType)bind,aligned);
760                free (aligned);
761            }
762            else
763                geom->SetColors(num,(trpgGeometry::ColorType)type,(trpgGeometry::BindType)bind,cData);
764            break;
765        case TRPG_GEOM_TEX32:
766            buf.Get(bind);
767            buf.Get(num);
768            if (num < 0) throw 1;
769            buf.GetArray(2*num,&fData);
770            if (ALIGNMENT_WORKAROUND)
771            {
772                float32 *aligned;
773                aligned = (float32 *)calloc (2*num, sizeof(float32));
774                memcpy (aligned, fData, 2*num * sizeof(float32));
775                geom->SetTexCoords(num,(trpgGeometry::BindType)bind,aligned);
776                free (aligned);
777            }
778            else
779                geom->SetTexCoords(num,(trpgGeometry::BindType)bind,fData);
780            break;
781        case TRPG_GEOM_TEX64:
782            buf.Get(bind);
783            buf.Get(num);
784            if (num < 0) throw 1;
785            buf.GetArray(2*num,&dData);
786            if (ALIGNMENT_WORKAROUND)
787            {
788                float64 *aligned;
789                aligned = (float64 *)calloc (2*num, sizeof(float64));
790                memcpy (aligned, dData, 2*num * sizeof(float64));
791                geom->SetTexCoords(num,(trpgGeometry::BindType)bind,aligned);
792                free (aligned);
793            }
794            else
795                geom->SetTexCoords(num,(trpgGeometry::BindType)bind,dData);
796            break;
797        case TRPG_GEOM_EFLAG:
798            buf.Get(num);
799            if (num < 0) throw 1;
800            buf.GetArray(num,&charData);
801            geom->SetEdgeFlags(num,charData);
802            break;
803        default:
804            // Skip
805            break;
806        }
807    }
808    catch (...) {
809        return NULL;
810    }
811
812    return geom;
813}
814
815// Read Geometry
816bool trpgGeometry::Read(trpgReadBuffer &buf)
817{
818    trpgr_Parser parse;
819    geomCB gcb;
820
821    gcb.geom = this;
822    parse.AddCallback(TRPG_GEOM_PRIM,&gcb,false);
823    parse.AddCallback(TRPG_GEOM_MATERIAL,&gcb,false);
824    parse.AddCallback(TRPG_GEOM_VERT32,&gcb,false);
825    parse.AddCallback(TRPG_GEOM_VERT64,&gcb,false);
826    parse.AddCallback(TRPG_GEOM_NORM32,&gcb,false);
827    parse.AddCallback(TRPG_GEOM_NORM64,&gcb,false);
828    parse.AddCallback(TRPG_GEOM_COLOR,&gcb,false);
829    parse.AddCallback(TRPG_GEOM_TEX32,&gcb,false);
830    parse.AddCallback(TRPG_GEOM_TEX64,&gcb,false);
831    parse.AddCallback(TRPG_GEOM_EFLAG,&gcb,false);
832    parse.Parse(buf);
833
834    return isValid();
835}
Note: See TracBrowser for help on using the browser.