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

Revision 13041, 1.8 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/**********************************************************************
2 *
3 *    FILE:            Multisample.cpp
4 *
5 *    DESCRIPTION:    Read/Write osg::Multisample in binary format to disk.
6 *
7 *    CREATED BY:     Nikolaus Hanekamp
8 *
9 *
10 *    HISTORY:        Created 15.06.2007
11 *
12 **********************************************************************/
13
14#include "Exception.h"
15#include "Multisample.h"
16#include "Object.h"
17
18using namespace ive;
19
20void Multisample::write(DataOutputStream* out){
21    // Write CullFace's identification.
22    out->writeInt(IVEMULTISAMPLE);
23    // If the osg class is inherited by any other class we should also write this to file.
24    osg::Object*  obj = dynamic_cast<osg::Object*>(this);
25    if(obj){
26        ((ive::Object*)(obj))->write(out);
27    }
28    else
29        out_THROW_EXCEPTION("Multisample::write(): Could not cast this osg::Multisample to an osg::Object.");
30    // Write Multisample's properties.
31    out->writeFloat(getCoverage());
32    out->writeBool(getInvert());
33    out->writeInt(getHint());
34}
35
36void Multisample::read(DataInputStream* in){
37    // Peek on Multisample's identification.
38    int id = in->peekInt();
39    if(id == IVEMULTISAMPLE){
40        // Read Multisample's identification.
41        id = in->readInt();
42        // If the osg class is inherited by any other class we should also read this from file.
43        osg::Object*  obj = dynamic_cast<osg::Object*>(this);
44        if(obj){
45            ((ive::Object*)(obj))->read(in);
46        }
47        else
48            in_THROW_EXCEPTION("Multisample::read(): Could not cast this osg::Multisample to an osg::Object.");
49        // Read Multisample's properties
50        setCoverage(in->readFloat());
51        setInvert(in->readBool());
52        setHint((Mode) in->readInt());
53    }
54    else{
55        in_THROW_EXCEPTION("Multisample::read(): Expected Multisample identification.");
56    }
57}
Note: See TracBrowser for help on using the browser.