root/OpenSceneGraph/trunk/src/osgPlugins/ive/DrawArrays.cpp @ 1980

Revision 1980, 1.7 kB (checked in by robert, 12 years ago)

Converted dos to unix file endings.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/**********************************************************************
2 *
3 *      FILE:                   DrawArrays.cpp
4 *
5 *      DESCRIPTION:    Read/Write osg::DrawArrays 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 "DrawArrays.h"
17#include "PrimitiveSet.h"
18
19using namespace ive;
20
21void DrawArrays::write(DataOutputStream* out){
22        // Write DrawArrays's identification.
23        out->writeInt(IVEDRAWARRAYS);
24        // If the osg class is inherited by any other class we should also write this to file.
25        osg::PrimitiveSet*  prim = dynamic_cast<osg::PrimitiveSet*>(this);
26        if(prim){
27                ((ive::PrimitiveSet*)(prim))->write(out);
28        }
29        else
30                throw Exception("DrawArrays::write(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet.");
31
32
33        // Write DrawArrays's properties.
34        out->writeInt(getFirst());
35        out->writeInt(getCount());
36}
37
38void DrawArrays::read(DataInputStream* in){
39        // Read DrawArrays's identification.
40        int id = in->peekInt();
41        if(id == IVEDRAWARRAYS){
42                // Code to read DrawArrays's properties.
43                id = in->readInt();
44                // If the osg class is inherited by any other class we should also read this from file.
45                osg::PrimitiveSet*  prim = dynamic_cast<osg::PrimitiveSet*>(this);
46                if(prim){
47                        ((ive::PrimitiveSet*)(prim))->read(in);
48                }
49                else
50                        throw Exception("DrawArrays::read(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet.");
51
52
53                // Read DrawArrays properties
54                setFirst(in->readInt());
55                setCount(in->readInt());
56        }
57        else{
58                throw Exception("DrawArrays::read(): Expected DrawArrays identification.");
59        }
60}
Note: See TracBrowser for help on using the browser.