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

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

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#include "Exception.h"
15#include "Volume.h"
16#include "Group.h"
17
18using namespace ive;
19
20void Volume::write(DataOutputStream* out)
21{
22    // Write Volume's identification.
23    out->writeInt(IVEVOLUME);
24    // If the osg class is inherited by any other class we should also write this to file.
25    osg::Group*  group = dynamic_cast<osg::Group*>(this);
26    if(group)
27        ((ive::Group*)(group))->write(out);
28    else
29        out_THROW_EXCEPTION("Volume::write(): Could not cast this osgVolume::Volume to an osg::Group.");
30}
31
32void Volume::read(DataInputStream* in)
33{
34    // Peek on Volume's identification.
35    int id = in->peekInt();
36    if (id != IVEVOLUME) in_THROW_EXCEPTION("Volume::read(): Expected Volume identification.");
37
38    // Read Volume's identification.
39    id = in->readInt();
40    // If the osg class is inherited by any other class we should also read this from file.
41    osg::Group*  group = dynamic_cast<osg::Group*>(this);
42    if(group)
43        ((ive::Group*)(group))->read(in);
44    else
45        in_THROW_EXCEPTION("Volume::read(): Could not cast this osgVolume::Volume to an osg::Group.");
46
47}
Note: See TracBrowser for help on using the browser.