root/OpenSceneGraph/trunk/src/osgPlugins/ive/ClipPlane.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
  • Property svn:keywords set to Author Date Id Revision
Line 
1/**********************************************************************
2 *
3 *    FILE:            ClipPlane.cpp
4 *
5 *    DESCRIPTION:    Read/Write osg::ClipPlane (partially) in binary format to disk.
6 *
7 *    CREATED BY:        Stanislav Blinov
8 *
9 *    HISTORY:        Created 7.09.2004
10 *
11 *    Copyright 2004 OtherSide
12 **********************************************************************/
13
14#include "Exception.h"
15#include "ClipPlane.h"
16#include "Object.h"
17
18using namespace ive;
19
20void ClipPlane::write(DataOutputStream* out){
21
22  // write ClipPlane's identification
23  out->writeInt(IVECLIPPLANE);
24
25  // if the osg class is inherited by any other class we should also write this to file
26  osg::Object*  obj = dynamic_cast<osg::Object*>(this);
27  if(obj)
28    ((ive::Object*)(obj))->write(out);
29  else
30    out_THROW_EXCEPTION("ClipPlane::write(): Could not cast this osg::ClipPlane to an osg::Object.");
31
32  // write ClipPlane's properties
33
34  out->writeVec4d(getClipPlane());
35
36  out->writeUInt(getClipPlaneNum());
37
38}
39
40void ClipPlane::read(DataInputStream* in){
41
42  // peek on ClipPlane's identification
43  int id = in->peekInt();
44  if(id == IVECLIPPLANE)
45    {
46      // read ClipPlane's identification
47      id = in->readInt();
48
49      // if the osg class is inherited by any other class we should also read this from file
50      osg::Object*  obj = dynamic_cast<osg::Object*>(this);
51      if(obj)
52        ((ive::Object*)(obj))->read(in);
53      else
54        in_THROW_EXCEPTION("ClipPlane::read(): Could not cast this osg::ClipPlane to an osg::Object.");
55
56      setClipPlane(in->readVec4d());
57
58      setClipPlaneNum(in->readUInt());
59    }
60  else{
61    in_THROW_EXCEPTION("ClipPlane::read(): Expected ClipPlane identification.");
62  }
63}
Note: See TracBrowser for help on using the browser.