diff --git a/NEWS.txt b/NEWS.txt index 2498b0157..7e9406d74 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,7 +1,7 @@ OSG News (most significant items from ChangeLog) ================================================ -16th September 2003 - OpenSceneGraph-0.9.6 +2nd October 2003 - OpenSceneGraph-0.9.6-2 >>> osgFX Special Effects nodekit (for bumping mapping & cartoon effects etc), support for double Matrix traversals, >>> improved build support, thread safety and robustness. @@ -30,6 +30,9 @@ OSG News (most significant items from ChangeLog) on performance since camera operations are only done a small number of times per frame. + osg::Quat now supports doubles by default, but also allows users to select + float version osg::Quat simply by changing the osg::Quat::value_type typedef. + Work has been on OpenThreads and OpenProducer, in particular to improve thread safety and robustness on the Win32 platform. Reported crashes on exit from osgProducer::Viewer based apps, and freezes during runtime @@ -57,6 +60,9 @@ OSG News (most significant items from ChangeLog) mean that the .ive format has has changed and is no longer compatible with previous version of .ive. It is recommend that one recreates .ive for the original source via osgconv or similar to ensure consistency. + + A JPEG2000 image plugin has added, written by Michael Gronager. The new jp2 + plugin uses the japser open source project to read and write JPEG2000 files. A scalar bar, and sphere segment helper classes have been added to osgSim, the new osgscalarbar and osgspheresegment examples demonstrate how to use @@ -72,9 +78,15 @@ OSG News (most significant items from ChangeLog) set OSG_GL_EXTENSION_DISABLE = "ATI:GL_SGIS_generate_mipmap;Sun:GL_EXT_texture_filter_anisotropic:" - - + New examples include: + + osgforest - an example which demonstrates simple techniques for creating forests + osgfxbrowser - an example which demonstrates the various osgFX Effects available + osgscalabar - an example of how to set up the osgSim::ScalarBar. + osgspheresegment - an example of how to set up the osgSim::SphereSegement + osgpagelod - a very simply test program for setting up osg::PagedLOD/osgDB::DatabasePager + 23rd July 2003 - OpenSceneGraph-0.9.5 >>> Support added for OpenGL2.0 shaders, native multi-threaded Database paging, diff --git a/src/osgPlugins/ive/TextureCubeMap.cpp b/src/osgPlugins/ive/TextureCubeMap.cpp index ab05d10c1..659f8095b 100644 --- a/src/osgPlugins/ive/TextureCubeMap.cpp +++ b/src/osgPlugins/ive/TextureCubeMap.cpp @@ -40,31 +40,38 @@ void TextureCubeMap::write(DataOutputStream* out){ // 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); + // Should we include images date in stream + bool includeImg = out->getIncludeImageData(); + out->writeBool(includeImg); - out->writeBool(getImage(osg::TextureCubeMap::NEGATIVE_X)!=0); - if(getImage(osg::TextureCubeMap::NEGATIVE_X)) - ((ive::Image*)(getImage(osg::TextureCubeMap::NEGATIVE_X)))->write(out); + writeImage(out,includeImg,getImage(osg::TextureCubeMap::POSITIVE_X)); + writeImage(out,includeImg,getImage(osg::TextureCubeMap::NEGATIVE_X)); + writeImage(out,includeImg,getImage(osg::TextureCubeMap::POSITIVE_Y)); + writeImage(out,includeImg,getImage(osg::TextureCubeMap::NEGATIVE_Y)); + writeImage(out,includeImg,getImage(osg::TextureCubeMap::POSITIVE_Z)); + writeImage(out,includeImg,getImage(osg::TextureCubeMap::NEGATIVE_Z)); - 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::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); +void TextureCubeMap::writeImage(DataOutputStream* out,bool includeImg,osg::Image* image) +{ + if(includeImg) + { + // Write images if any + out->writeBool(image!=0); + if(image) + ((ive::Image*)(image))->write(out); + } + else + { + if (image && !(image->getFileName().empty())){ + out->writeString(image->getFileName()); + } + else{ + out->writeString(""); + } + } } void TextureCubeMap::read(DataInputStream* in) @@ -91,40 +98,43 @@ void TextureCubeMap::read(DataInputStream* in) // 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); - } + // Should we read image data from stream + bool includeImg = in->readBool(); + setImage(osg::TextureCubeMap::POSITIVE_X,readImage(in, includeImg)); + setImage(osg::TextureCubeMap::NEGATIVE_X,readImage(in, includeImg)); + setImage(osg::TextureCubeMap::POSITIVE_Y,readImage(in, includeImg)); + setImage(osg::TextureCubeMap::NEGATIVE_Y,readImage(in, includeImg)); + setImage(osg::TextureCubeMap::POSITIVE_Z,readImage(in, includeImg)); + setImage(osg::TextureCubeMap::NEGATIVE_Z,readImage(in, includeImg)); + } else{ throw Exception("TextureCubeMap::read(): Expected TextureCubeMap identification."); } } + +osg::Image* TextureCubeMap::readImage(DataInputStream* in, bool includeImg) +{ + if(includeImg) + { + // Read image data from stream + if(in->readBool()) + { + osg::Image* image = new osg::Image(); + ((ive::Image*)image)->read(in); + return image; + } + } + else + { + // Only read image name from stream. + std::string filename = in->readString(); + if(filename.compare("")!=0) + { + osg::Image* image = in->readImage(filename); + return image; + } + } + return 0; +} diff --git a/src/osgPlugins/ive/TextureCubeMap.h b/src/osgPlugins/ive/TextureCubeMap.h index f58151934..e5ac1b389 100644 --- a/src/osgPlugins/ive/TextureCubeMap.h +++ b/src/osgPlugins/ive/TextureCubeMap.h @@ -4,11 +4,21 @@ #include #include "ReadWrite.h" -namespace ive{ -class TextureCubeMap : public osg::TextureCubeMap, public ReadWrite { +namespace ive +{ + +class TextureCubeMap : public osg::TextureCubeMap, public ReadWrite +{ public: void write(DataOutputStream* out); + + void writeImage(DataOutputStream* out,bool includeImg,osg::Image* image); + void read(DataInputStream* in); + + osg::Image* readImage(DataInputStream* in, bool includeImg); + + }; }