|
Revision 13041, 2.0 kB
(checked in by robert, 14 months 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 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | #include "Exception.h" |
|---|
| 16 | #include "Texture1D.h" |
|---|
| 17 | #include "Texture.h" |
|---|
| 18 | #include "Image.h" |
|---|
| 19 | |
|---|
| 20 | using namespace ive; |
|---|
| 21 | |
|---|
| 22 | void Texture1D::write(DataOutputStream* out){ |
|---|
| 23 | |
|---|
| 24 | out->writeInt(IVETEXTURE1D); |
|---|
| 25 | |
|---|
| 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("Texture1D::write(): Could not cast this osg::Texture1D to an osg::Texture."); |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | out->writeImage(getImage()); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | void Texture1D::read(DataInputStream* in){ |
|---|
| 40 | |
|---|
| 41 | int id = in->peekInt(); |
|---|
| 42 | if(id == IVETEXTURE1D){ |
|---|
| 43 | |
|---|
| 44 | id = in->readInt(); |
|---|
| 45 | |
|---|
| 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("Texture1D::read(): Could not cast this osg::Texture1D to an osg::Texture."); |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | osg::Image *image = in->readImage(); |
|---|
| 56 | if(image) { |
|---|
| 57 | setImage(image); |
|---|
| 58 | } |
|---|
| 59 | } |
|---|
| 60 | else{ |
|---|
| 61 | in_THROW_EXCEPTION("Texture1D::read(): Expected Texture1D identification."); |
|---|
| 62 | } |
|---|
| 63 | } |
|---|