From da8ef894c148dff0294e51a2036461285b59999b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 28 Sep 2003 10:15:10 +0000 Subject: [PATCH] Added equals operator to CUllingSet. Update AUTHORS file. Change tabs to 4 spaces in ive/TextureCubeMap.cpp --- AUTHORS.txt | 3 + include/osg/CullingSet | 14 ++ src/osgPlugins/ive/TextureCubeMap.cpp | 195 +++++++++++++------------- 3 files changed, 115 insertions(+), 97 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 4949da310..564a00550 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -85,6 +85,9 @@ Mike Connell - First implementation of shadow occlusion culling. - improvements to 3ds plugin. +Michael Gronager + - jp2 plugin - for reading and writing JPEG2000 image files + Phil Atkin - MacOS X port. diff --git a/include/osg/CullingSet b/include/osg/CullingSet index 2d554b64b..abb039f36 100644 --- a/include/osg/CullingSet +++ b/include/osg/CullingSet @@ -55,6 +55,20 @@ class SG_EXPORT CullingSet : public Referenced } } + CullingSet& operator = (const CullingSet& cs) + { + if (this==&cs) return *this; + + _mask = cs._mask; + _frustum = cs._frustum; + _occluderList = cs._occluderList; + _pixelSizeVector = cs._pixelSizeVector; + _smallFeatureCullingPixelSize = cs._smallFeatureCullingPixelSize; + + return *this; + } + + inline void set(const CullingSet& cs) { _mask = cs._mask; diff --git a/src/osgPlugins/ive/TextureCubeMap.cpp b/src/osgPlugins/ive/TextureCubeMap.cpp index b3cb2057d..ab05d10c1 100644 --- a/src/osgPlugins/ive/TextureCubeMap.cpp +++ b/src/osgPlugins/ive/TextureCubeMap.cpp @@ -1,15 +1,15 @@ /********************************************************************** * - * FILE: TextureCubeMap.cpp + * FILE: TextureCubeMap.cpp * - * DESCRIPTION: Read/Write osg::TextureCubeMap in binary format to disk. + * DESCRIPTION: Read/Write osg::TextureCubeMap in binary format to disk. * - * CREATED BY: Auto generated by iveGenerated - * and later modified by Rune Schmidt Jensen. + * CREATED BY: Auto generated by iveGenerated + * and later modified by Rune Schmidt Jensen. * - * HISTORY: Created 21.3.2003 + * HISTORY: Created 21.3.2003 * - * Copyright 2003 VR-C + * Copyright 2003 VR-C **********************************************************************/ #include "Exception.h" @@ -20,110 +20,111 @@ using namespace ive; void TextureCubeMap::write(DataOutputStream* out){ - // Write TextureCubeMap's identification. - out->writeInt(IVETEXTURECUBEMAP); - // If the osg class is inherited by any other class we should also write this to file. - osg::Texture* tex = dynamic_cast(this); - if(tex){ - ((ive::Texture*)(tex))->write(out); - } - else - throw Exception("TextureCubeMap::write(): Could not cast this osg::TextureCubeMap to an osg::Texture."); - // Write TextureCubeMap's properties. + // Write TextureCubeMap's identification. + out->writeInt(IVETEXTURECUBEMAP); + // If the osg class is inherited by any other class we should also write this to file. + osg::Texture* tex = dynamic_cast(this); + if(tex){ + ((ive::Texture*)(tex))->write(out); + } + else + throw Exception("TextureCubeMap::write(): Could not cast this osg::TextureCubeMap to an osg::Texture."); + // Write TextureCubeMap's properties. - // Write texture size - int width,height; - getTextureSize(width, height); - out->writeInt(width); - out->writeInt(height); + // Write texture size + int width,height; + getTextureSize(width, height); + out->writeInt(width); + out->writeInt(height); - // Write number of mipmap levels - out->writeInt(getNumMipmapLevels()); + // Write number of mipmap levels + out->writeInt(getNumMipmapLevels()); - // Write images if any - out->writeBool(getImage(osg::TextureCubeMap::POSITIVE_X)!=0); - if(getImage(osg::TextureCubeMap::POSITIVE_X)) - ((ive::Image*)(getImage(osg::TextureCubeMap::POSITIVE_X)))->write(out); + // Write images if any + out->writeBool(getImage(osg::TextureCubeMap::POSITIVE_X)!=0); + if(getImage(osg::TextureCubeMap::POSITIVE_X)) + ((ive::Image*)(getImage(osg::TextureCubeMap::POSITIVE_X)))->write(out); - out->writeBool(getImage(osg::TextureCubeMap::NEGATIVE_X)!=0); - if(getImage(osg::TextureCubeMap::NEGATIVE_X)) - ((ive::Image*)(getImage(osg::TextureCubeMap::NEGATIVE_X)))->write(out); + out->writeBool(getImage(osg::TextureCubeMap::NEGATIVE_X)!=0); + if(getImage(osg::TextureCubeMap::NEGATIVE_X)) + ((ive::Image*)(getImage(osg::TextureCubeMap::NEGATIVE_X)))->write(out); - out->writeBool(getImage(osg::TextureCubeMap::POSITIVE_Y)!=0); - if(getImage(osg::TextureCubeMap::POSITIVE_Y)) - ((ive::Image*)(getImage(osg::TextureCubeMap::POSITIVE_Y)))->write(out); + out->writeBool(getImage(osg::TextureCubeMap::POSITIVE_Y)!=0); + if(getImage(osg::TextureCubeMap::POSITIVE_Y)) + ((ive::Image*)(getImage(osg::TextureCubeMap::POSITIVE_Y)))->write(out); - out->writeBool(getImage(osg::TextureCubeMap::NEGATIVE_Y)!=0); - if(getImage(osg::TextureCubeMap::NEGATIVE_Y)) - ((ive::Image*)(getImage(osg::TextureCubeMap::NEGATIVE_Y)))->write(out); + out->writeBool(getImage(osg::TextureCubeMap::NEGATIVE_Y)!=0); + if(getImage(osg::TextureCubeMap::NEGATIVE_Y)) + ((ive::Image*)(getImage(osg::TextureCubeMap::NEGATIVE_Y)))->write(out); - out->writeBool(getImage(osg::TextureCubeMap::POSITIVE_Z)!=0); - if(getImage(osg::TextureCubeMap::POSITIVE_Z)) - ((ive::Image*)(getImage(osg::TextureCubeMap::POSITIVE_Z)))->write(out); + out->writeBool(getImage(osg::TextureCubeMap::POSITIVE_Z)!=0); + if(getImage(osg::TextureCubeMap::POSITIVE_Z)) + ((ive::Image*)(getImage(osg::TextureCubeMap::POSITIVE_Z)))->write(out); - out->writeBool(getImage(osg::TextureCubeMap::NEGATIVE_Z)!=0); - if(getImage(osg::TextureCubeMap::NEGATIVE_Z)) - ((ive::Image*)(getImage(osg::TextureCubeMap::NEGATIVE_Z)))->write(out); + out->writeBool(getImage(osg::TextureCubeMap::NEGATIVE_Z)!=0); + if(getImage(osg::TextureCubeMap::NEGATIVE_Z)) + ((ive::Image*)(getImage(osg::TextureCubeMap::NEGATIVE_Z)))->write(out); } -void TextureCubeMap::read(DataInputStream* in){ - // Peek on TextureCubeMap's identification. - int id = in->peekInt(); - if(id == IVETEXTURECUBEMAP){ - // Read TextureCubeMap's identification. - id = in->readInt(); - // If the osg class is inherited by any other class we should also read this from file. - osg::Texture* tex = dynamic_cast(this); - if(tex){ - ((ive::Texture*)(tex))->read(in); - } - else - throw Exception("TextureCubeMap::read(): Could not cast this osg::TextureCubeMap to an osg::Texture."); - // Read TextureCubeMap's properties +void TextureCubeMap::read(DataInputStream* in) +{ + // Peek on TextureCubeMap's identification. + int id = in->peekInt(); + if(id == IVETEXTURECUBEMAP){ + // Read TextureCubeMap's identification. + id = in->readInt(); + // If the osg class is inherited by any other class we should also read this from file. + osg::Texture* tex = dynamic_cast(this); + if(tex){ + ((ive::Texture*)(tex))->read(in); + } + else + throw Exception("TextureCubeMap::read(): Could not cast this osg::TextureCubeMap to an osg::Texture."); + // Read TextureCubeMap's properties - // Read texture size - int width = in->readInt(); - int height = in->readInt(); - setTextureSize(width, height); + // Read texture size + int width = in->readInt(); + int height = in->readInt(); + setTextureSize(width, height); - // Read number of mipmap levels - setNumMipmapLevels((unsigned int)in->readInt()); + // Read number of mipmap levels + setNumMipmapLevels((unsigned int)in->readInt()); - // Read images if any - if(in->readBool()){ - osg::Image* image = new osg::Image(); - ((ive::Image*)(image))->read(in); - setImage(osg::TextureCubeMap::POSITIVE_X, image); - } - if(in->readBool()){ - osg::Image* image = new osg::Image(); - ((ive::Image*)(image))->read(in); - setImage(osg::TextureCubeMap::NEGATIVE_X, image); - } - if(in->readBool()){ - osg::Image* image = new osg::Image(); - ((ive::Image*)(image))->read(in); - setImage(osg::TextureCubeMap::POSITIVE_Y, image); - } - if(in->readBool()){ - osg::Image* image = new osg::Image(); - ((ive::Image*)(image))->read(in); - setImage(osg::TextureCubeMap::NEGATIVE_Y, image); - } - if(in->readBool()){ - osg::Image* image = new osg::Image(); - ((ive::Image*)(image))->read(in); - setImage(osg::TextureCubeMap::POSITIVE_Z, image); - } - if(in->readBool()){ - osg::Image* image = new osg::Image(); - ((ive::Image*)(image))->read(in); - setImage(osg::TextureCubeMap::NEGATIVE_Z, image); - } + // Read images if any + if(in->readBool()){ + osg::Image* image = new osg::Image(); + ((ive::Image*)(image))->read(in); + setImage(osg::TextureCubeMap::POSITIVE_X, image); + } + if(in->readBool()){ + osg::Image* image = new osg::Image(); + ((ive::Image*)(image))->read(in); + setImage(osg::TextureCubeMap::NEGATIVE_X, image); + } + if(in->readBool()){ + osg::Image* image = new osg::Image(); + ((ive::Image*)(image))->read(in); + setImage(osg::TextureCubeMap::POSITIVE_Y, image); + } + if(in->readBool()){ + osg::Image* image = new osg::Image(); + ((ive::Image*)(image))->read(in); + setImage(osg::TextureCubeMap::NEGATIVE_Y, image); + } + if(in->readBool()){ + osg::Image* image = new osg::Image(); + ((ive::Image*)(image))->read(in); + setImage(osg::TextureCubeMap::POSITIVE_Z, image); + } + if(in->readBool()){ + osg::Image* image = new osg::Image(); + ((ive::Image*)(image))->read(in); + setImage(osg::TextureCubeMap::NEGATIVE_Z, image); + } - } - else{ - throw Exception("TextureCubeMap::read(): Expected TextureCubeMap identification."); - } + } + else{ + throw Exception("TextureCubeMap::read(): Expected TextureCubeMap identification."); + } }