From 6b6bc4de10085eff507b6816a9338964d2c7b545 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 17 Nov 2006 14:51:48 +0000 Subject: [PATCH] Added missing PointSprite files --- src/osgPlugins/ive/PointSprite.cpp | 60 ++++++++++++++++++++++++++++++ src/osgPlugins/ive/PointSprite.h | 16 ++++++++ 2 files changed, 76 insertions(+) create mode 100644 src/osgPlugins/ive/PointSprite.cpp create mode 100644 src/osgPlugins/ive/PointSprite.h diff --git a/src/osgPlugins/ive/PointSprite.cpp b/src/osgPlugins/ive/PointSprite.cpp new file mode 100644 index 000000000..cb46571fe --- /dev/null +++ b/src/osgPlugins/ive/PointSprite.cpp @@ -0,0 +1,60 @@ +/********************************************************************** + * + * FILE: PointSprite.cpp + * + * DESCRIPTION: Read/Write osg::PointSprite in binary format to disk. + * + * CREATED BY: Auto generated by iveGenerated + * and later modified by Rune Schmidt Jensen. + * + * HISTORY: Created 21.3.2003 + * + * Copyright 2003 VR-C + **********************************************************************/ + +#include "Exception.h" +#include "PointSprite.h" +#include "Object.h" + +using namespace ive; + +void PointSprite::write(DataOutputStream* out){ + // Write PointSprite's identification. + out->writeInt(IVEPOINTSPRITE); + // 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("PointSprite::write(): Could not cast this osg::PointSprite to an osg::Object."); + // Write PointSprite's properties. + + // Write mode + out->writeInt(getCoordOriginMode()); +} + +void PointSprite::read(DataInputStream* in){ + // Peek on PointSprite's identification. + int id = in->peekInt(); + if(id == IVEPOINTSPRITE){ + // Read PointSprite'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("PointSprite::read(): Could not cast this osg::PointSprite to an osg::Object."); + // Read PointSprite's properties + + // Read mode + setCoordOriginMode((osg::PointSprite::CoordOriginMode)in->readInt()); + + } + else{ + throw Exception("PointSprite::read(): Expected PointSprite identification."); + } +} + diff --git a/src/osgPlugins/ive/PointSprite.h b/src/osgPlugins/ive/PointSprite.h new file mode 100644 index 000000000..53ae8f21d --- /dev/null +++ b/src/osgPlugins/ive/PointSprite.h @@ -0,0 +1,16 @@ +#ifndef IVE_POINTSPRITE +#define IVE_POINTSPRITE 1 + +#include +#include "ReadWrite.h" + +namespace ive{ +class PointSprite : public osg::PointSprite, public ReadWrite { +public: + void write(DataOutputStream* out); + void read(DataInputStream* in); +}; +} + +#endif +