From 34dd065d66399a66f7cf20c876aff39203d84a51 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 7 Oct 2005 07:46:48 +0000 Subject: [PATCH] Added into CVS missing PolgonMode files. --- src/osgPlugins/ive/PolygonMode.cpp | 57 ++++++++++++++++++++++++++++++ src/osgPlugins/ive/PolygonMode.h | 16 +++++++++ 2 files changed, 73 insertions(+) create mode 100644 src/osgPlugins/ive/PolygonMode.cpp create mode 100644 src/osgPlugins/ive/PolygonMode.h diff --git a/src/osgPlugins/ive/PolygonMode.cpp b/src/osgPlugins/ive/PolygonMode.cpp new file mode 100644 index 000000000..50513dc73 --- /dev/null +++ b/src/osgPlugins/ive/PolygonMode.cpp @@ -0,0 +1,57 @@ +/********************************************************************** + * + * FILE: PolygonMode.cpp + * + * DESCRIPTION: Read/Write osg::PolygonMode in binary format to disk. + * + * CREATED BY: Auto generated by iveGenerator + * and later modified by Rune Schmidt Jensen. + * + * HISTORY: Created 6.10.2005 + * + * Copyright 2003 VR-C + **********************************************************************/ + +#include "Exception.h" +#include "PolygonMode.h" +#include "Object.h" + +using namespace ive; + +void PolygonMode::write(DataOutputStream* out){ + // Write PolygonMode's identification. + out->writeInt(IVEPOLYGONMODE); + // 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("PolygonMode::write(): Could not cast this osg::PolygonMode to an osg::Object."); + // Write PolygonMode's properties. + out->writeInt(getMode(osg::PolygonMode::FRONT)); + out->writeInt(getMode(osg::PolygonMode::BACK)); +} + +void PolygonMode::read(DataInputStream* in){ + // Peek on PolygonMode's identification. + int id = in->peekInt(); + if(id == IVEPOLYGONMODE){ + // Read PolygonMode'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("PolygonMode::read(): Could not cast this osg::PolygonMode to an osg::Object."); + // Read PolygonMode's properties + setMode(osg::PolygonMode::FRONT,(Mode)in->readInt()); + setMode(osg::PolygonMode::BACK,(Mode)in->readInt()); + } + else{ + throw Exception("PolygonMode::read(): Expected PolygonMode identification."); + } +} + diff --git a/src/osgPlugins/ive/PolygonMode.h b/src/osgPlugins/ive/PolygonMode.h new file mode 100644 index 000000000..67e73af55 --- /dev/null +++ b/src/osgPlugins/ive/PolygonMode.h @@ -0,0 +1,16 @@ +#ifndef IVE_POLYGONMODE +#define IVE_POLYGONMODE 1 + +#include +#include "ReadWrite.h" + +namespace ive{ +class PolygonMode : public osg::PolygonMode, public ReadWrite { +public: + void write(DataOutputStream* out); + void read(DataInputStream* in); +}; +} + +#endif +