root/OpenSceneGraph/trunk/src/osgPlugins/ive/PrimitiveSet.cpp @ 13041

Revision 13041, 2.0 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/**********************************************************************
2 *
3 *    FILE:            PrimitiveSet.cpp
4 *
5 *    DESCRIPTION:    Read/Write osg::PrimitiveSet in binary format to disk.
6 *
7 *    CREATED BY:        Auto generated by iveGenerated
8 *                    and later modified by Rune Schmidt Jensen.
9 *
10 *    HISTORY:        Created 18.3.2003
11 *
12 *    Copyright 2003 VR-C
13 **********************************************************************/
14
15#include "Exception.h"
16#include "Object.h"
17#include "PrimitiveSet.h"
18
19using namespace ive;
20
21void PrimitiveSet::write(DataOutputStream* out){
22    // Write PrimitiveSet's identification.
23    out->writeInt(IVEPRIMITIVESET);
24    // If the osg class is inherited by any other class we should also write this to file.
25    osg::Object*  obj = dynamic_cast<osg::Object*>(this);
26    if(obj){
27        ((ive::Object*)(obj))->write(out);
28    }
29    else
30        out_THROW_EXCEPTION("PrimitiveSet::write(): Could not cast this osg::PrimitiveSet to an osg::Object.");
31
32
33    if ( out->getVersion() >= VERSION_0038 )
34    {
35        out->writeInt(getNumInstances());
36    }
37
38    // Write PrimitiveSet's properties.
39    out->writeInt(getMode());
40}
41
42void PrimitiveSet::read(DataInputStream* in){
43    // Read PrimitiveSet's identification.
44    int id = in->peekInt();
45    if(id == IVEPRIMITIVESET){
46        // Code to read PrimitiveSet's properties.
47        id = in->readInt();
48        // If the osg class is inherited by any other class we should also read this from file.
49        osg::Object*  obj = dynamic_cast<osg::Object*>(this);
50        if(obj){
51            ((ive::Object*)(obj))->read(in);
52        }
53        else
54            in_THROW_EXCEPTION("PrimitiveSet::read(): Could not cast this osg::PrimitiveSet to an osg::Object.");
55
56
57        if ( in->getVersion() >= VERSION_0038 )
58        {
59            setNumInstances(in->readInt());
60        }
61
62        // Read in primitiveset properties.
63        setMode(in->readInt());
64    }
65    else{
66        in_THROW_EXCEPTION("PrimitiveSet::read(): Expected PrimitiveSet identification.");
67    }
68}
Note: See TracBrowser for help on using the browser.