From aee27a18eb283ece82874a2b35edb31f99556cdf Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 9 Oct 2003 20:56:15 +0000 Subject: [PATCH] Fix for 64bit build. --- src/osgPlugins/ive/ConvexPlanarOccluder.cpp | 109 ++++++++++---------- 1 file changed, 52 insertions(+), 57 deletions(-) diff --git a/src/osgPlugins/ive/ConvexPlanarOccluder.cpp b/src/osgPlugins/ive/ConvexPlanarOccluder.cpp index f2d3cd357..df41650df 100644 --- a/src/osgPlugins/ive/ConvexPlanarOccluder.cpp +++ b/src/osgPlugins/ive/ConvexPlanarOccluder.cpp @@ -1,15 +1,15 @@ /********************************************************************** * - * FILE: ConvexPlanarOccluder.cpp + * FILE: ConvexPlanarOccluder.cpp * - * DESCRIPTION: Read/Write osg::ConvexPlanarOccluder in binary format to disk. + * DESCRIPTION: Read/Write osg::ConvexPlanarOccluder in binary format to disk. * - * CREATED BY: Auto generated by iveGenerator - * and later modified by Rune Schmidt Jensen. + * CREATED BY: Auto generated by iveGenerator + * and later modified by Rune Schmidt Jensen. * - * HISTORY: Created 23.4.2003 + * HISTORY: Created 23.4.2003 * - * Copyright 2003 VR-C + * Copyright 2003 VR-C **********************************************************************/ #include "Exception.h" @@ -20,63 +20,58 @@ using namespace ive; void ConvexPlanarOccluder::write(DataOutputStream* out){ - // Write ConvexPlanarOccluder's identification. - out->writeInt(IVECONVEXPLANAROCCLUDER); - // If the osg class is inherited by any other class we should also write this to file. - osg::Object* obj = dynamic_cast(this); - if(obj){ - ((ive::Object*)(obj))->write(out); - } - else - throw Exception("ConvexPlanarOccluder::write(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object."); - // Write ConvexPlanarOccluder's properties. + // Write ConvexPlanarOccluder's identification. + out->writeInt(IVECONVEXPLANAROCCLUDER); + // If the osg class is inherited by any other class we should also write this to file. + osg::Object* obj = dynamic_cast(this); + if(obj){ + ((ive::Object*)(obj))->write(out); + } + else + throw Exception("ConvexPlanarOccluder::write(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object."); + // Write ConvexPlanarOccluder's properties. - // Write planar polygon occluder. - out->writeInt((int)&getOccluder()); - if(&getOccluder()) - ((ive::ConvexPlanarPolygon*)(&getOccluder()))->write(out); + // Write planar polygon occluder. + ((ive::ConvexPlanarPolygon*)(&getOccluder()))->write(out); - // Write hole list. - HoleList holeList = getHoleList(); - int size = holeList.size(); - out->writeInt(size); - for(int i=0; iwrite(out); - } + // Write hole list. + HoleList holeList = getHoleList(); + int size = holeList.size(); + out->writeInt(size); + for(int i=0; iwrite(out); + } } void ConvexPlanarOccluder::read(DataInputStream* in){ - // Peek on ConvexPlanarOccluder's identification. - int id = in->peekInt(); - if(id == IVECONVEXPLANAROCCLUDER){ - // Read ConvexPlanarOccluder's identification. - id = in->readInt(); - // If the osg class is inherited by any other class we should also read this from file. - osg::Object* obj = dynamic_cast(this); - if(obj){ - ((ive::Object*)(obj))->read(in); - } - else - throw Exception("ConvexPlanarOccluder::read(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object."); - // Read ConvexPlanarOccluder's properties + // Peek on ConvexPlanarOccluder's identification. + int id = in->peekInt(); + if(id == IVECONVEXPLANAROCCLUDER){ + // Read ConvexPlanarOccluder's identification. + id = in->readInt(); + // If the osg class is inherited by any other class we should also read this from file. + osg::Object* obj = dynamic_cast(this); + if(obj){ + ((ive::Object*)(obj))->read(in); + } + else + throw Exception("ConvexPlanarOccluder::read(): Could not cast this osg::ConvexPlanarOccluder to an osg::Object."); + // Read ConvexPlanarOccluder's properties - // Read planar polygon occluder. - if(in->readInt()){ - osg::ConvexPlanarPolygon* cpp = new osg::ConvexPlanarPolygon(); - ((ive::ConvexPlanarPolygon*)(cpp))->read(in); - setOccluder(*cpp); - } + // Read planar polygon occluder. + osg::ConvexPlanarPolygon* cpp = &getOccluder(); + ((ive::ConvexPlanarPolygon*)(cpp))->read(in); - // Read hole list. - int size = in->readInt(); - for(int i=0; iread(in); - addHole(*cpp); - } + // Read hole list. + int size = in->readInt(); + for(int i=0; iread(in); + addHole(*cpp); + } - } - else{ - throw Exception("ConvexPlanarOccluder::read(): Expected ConvexPlanarOccluder identification."); - } + } + else{ + throw Exception("ConvexPlanarOccluder::read(): Expected ConvexPlanarOccluder identification."); + } }