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

Revision 13041, 2.0 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:            Texture3D.cpp
4 *
5 *    DESCRIPTION:    Read/Write osg::Texture3D 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 20.3.2003
11 *
12 *    Copyright 2003 VR-C
13 **********************************************************************/
14
15#include "Exception.h"
16#include "Texture3D.h"
17#include "Texture.h"
18#include "Image.h"
19
20using namespace ive;
21
22void Texture3D::write(DataOutputStream* out){
23    // Write Texture3D's identification.
24    out->writeInt(IVETEXTURE3D);
25    // If the osg class is inherited by any other class we should also write this to file.
26    osg::Texture*  tex = dynamic_cast<osg::Texture*>(this);
27    if(tex){
28        ((ive::Texture*)(tex))->write(out);
29    }
30    else
31        out_THROW_EXCEPTION("Texture3D::write(): Could not cast this osg::Texture3D to an osg::Texture.");
32    // Write Texture3D's properties.
33    // Write image.
34
35    // Should we include images date in stream
36    out->writeImage(getImage());
37}
38
39void Texture3D::read(DataInputStream* in){
40    // Read Texture3D's identification.
41    int id = in->peekInt();
42    if(id == IVETEXTURE3D){
43        // Code to read Texture3D's properties.
44        id = in->readInt();
45        // If the osg class is inherited by any other class we should also read this from file.
46        osg::Texture*  tex = dynamic_cast<osg::Texture*>(this);
47        if(tex){
48            ((ive::Texture*)(tex))->read(in);
49        }
50        else
51            in_THROW_EXCEPTION("Texture3D::read(): Could not cast this osg::Texture3D to an osg::Texture.");
52        // Read image.
53
54        // Should we read image data from stream
55        osg::Image *image = in->readImage();
56        if(image) {
57            setImage(image);
58        }
59    }
60    else{
61        in_THROW_EXCEPTION("Texture3D::read(): Expected Texture3D identification.");
62    }
63}
Note: See TracBrowser for help on using the browser.