|
Revision 13041, 1.9 kB
(checked in by robert, 14 months ago)
|
|
Ran script to remove trailing spaces and tabs
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | #include "Exception.h" |
|---|
| 15 | #include "VolumeScalarProperty.h" |
|---|
| 16 | #include "Object.h" |
|---|
| 17 | |
|---|
| 18 | #include <osgDB/ReadFile> |
|---|
| 19 | |
|---|
| 20 | using namespace ive; |
|---|
| 21 | |
|---|
| 22 | void VolumeScalarProperty::write(DataOutputStream* out) |
|---|
| 23 | { |
|---|
| 24 | |
|---|
| 25 | out->writeInt(IVEVOLUMESCALARPROPERTY); |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | osg::Object* object = dynamic_cast<osg::Object*>(this); |
|---|
| 29 | if (object) |
|---|
| 30 | ((ive::Object*)(object))->write(out); |
|---|
| 31 | else |
|---|
| 32 | out_THROW_EXCEPTION("VolumeScalarProperty::write(): Could not cast this osgVolume::ScalarProperty to an osg::Object."); |
|---|
| 33 | |
|---|
| 34 | out->writeFloat(getValue()); |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | void VolumeScalarProperty::read(DataInputStream* in) |
|---|
| 38 | { |
|---|
| 39 | |
|---|
| 40 | int id = in->peekInt(); |
|---|
| 41 | if (id != IVEVOLUMESCALARPROPERTY) |
|---|
| 42 | in_THROW_EXCEPTION("VolumeScalarProperty::read(): Expected CompositeProperty identification."); |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | id = in->readInt(); |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | osg::Object* object = dynamic_cast<osg::Object*>(this); |
|---|
| 49 | if (object) |
|---|
| 50 | ((ive::Object*)(object))->read(in); |
|---|
| 51 | else |
|---|
| 52 | in_THROW_EXCEPTION("VolumeScalarProperty::write(): Could not cast this osgVolume::ScalarProperty to an osg::Object."); |
|---|
| 53 | |
|---|
| 54 | setValue(in->readFloat()); |
|---|
| 55 | } |
|---|