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

Revision 13041, 3.4 kB (checked in by robert, 3 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:            TexEnvCombine.cpp
4 *
5 *    DESCRIPTION:    Read/Write osg::TexEnvCombine 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 21.3.2003
11 *
12 *    Copyright 2003 VR-C
13 **********************************************************************/
14
15#include "Exception.h"
16#include "TexEnvCombine.h"
17#include "Object.h"
18
19using namespace ive;
20
21void TexEnvCombine::write(DataOutputStream* out){
22    // Write TexEnvCombine's identification.
23    out->writeInt(IVETEXENVCOMBINE);
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("TexEnvCombine::write(): Could not cast this osg::TexEnvCombine to an osg::Object.");
31    // Write TexEnvCombine's properties.
32
33    // Write combine method
34    out->writeInt(getCombine_RGB());
35    out->writeInt(getCombine_Alpha());
36    // Write source params
37    out->writeInt(getSource0_RGB());
38    out->writeInt(getSource1_RGB());
39    out->writeInt(getSource2_RGB());
40    out->writeInt(getSource0_Alpha());
41    out->writeInt(getSource1_Alpha());
42    out->writeInt(getSource2_Alpha());
43    // Write operand params
44    out->writeInt(getOperand0_RGB());
45    out->writeInt(getOperand1_RGB());
46    out->writeInt(getOperand2_RGB());
47    out->writeInt(getOperand0_Alpha());
48    out->writeInt(getOperand1_Alpha());
49    out->writeInt(getOperand2_Alpha());
50    // Write scale and constant color
51    out->writeFloat(getScale_RGB());
52    out->writeFloat(getScale_Alpha());
53    out->writeVec4(getConstantColor());
54
55}
56
57void TexEnvCombine::read(DataInputStream* in){
58    // Peek on TexEnvCombine's identification.
59    int id = in->peekInt();
60    if(id == IVETEXENVCOMBINE){
61        // Read TexEnvCombine's identification.
62        id = in->readInt();
63        // If the osg class is inherited by any other class we should also read this from file.
64        osg::Object*  obj = dynamic_cast<osg::Object*>(this);
65        if(obj){
66            ((ive::Object*)(obj))->read(in);
67        }
68        else
69            in_THROW_EXCEPTION("TexEnvCombine::read(): Could not cast this osg::TexEnvCombine to an osg::Object.");
70        // Read TexEnvCombine's properties
71
72        // Read combine method
73        setCombine_RGB((GLint)in->readInt());
74        setCombine_Alpha((GLint)in->readInt());
75        // Read combine source
76        setSource0_RGB((GLint)in->readInt());
77        setSource1_RGB((GLint)in->readInt());
78        setSource2_RGB((GLint)in->readInt());
79        setSource0_Alpha((GLint)in->readInt());
80        setSource1_Alpha((GLint)in->readInt());
81        setSource2_Alpha((GLint)in->readInt());
82        // read combine params
83        setOperand0_RGB((GLint)in->readInt());
84        setOperand1_RGB((GLint)in->readInt());
85        setOperand2_RGB((GLint)in->readInt());
86        setOperand0_Alpha((GLint)in->readInt());
87        setOperand1_Alpha((GLint)in->readInt());
88        setOperand2_Alpha((GLint)in->readInt());
89        // Read scale and constant color
90        setScale_RGB(in->readFloat());
91        setScale_Alpha(in->readFloat());
92        setConstantColor(in->readVec4());
93
94    }
95    else{
96        in_THROW_EXCEPTION("TexEnvCombine::read(): Expected TexEnvCombine identification.");
97    }
98}
Note: See TracBrowser for help on using the browser.