Changeset 3525
- Timestamp:
- 10/24/04 16:31:18 (9 years ago)
- Location:
- OpenSceneGraph/trunk/src/osgPlugins/ive
- Files:
-
- 2 modified
-
DrawArrayLengths.cpp (modified) (2 diffs)
-
DrawArrays.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/ive/DrawArrayLengths.cpp
r1980 r3525 1 1 /********************************************************************** 2 2 * 3 * FILE:DrawArrayLengths.cpp3 * FILE: DrawArrayLengths.cpp 4 4 * 5 * DESCRIPTION:Read/Write osg::DrawArrayLengths in binary format to disk.5 * DESCRIPTION: Read/Write osg::DrawArrayLengths in binary format to disk. 6 6 * 7 * CREATED BY:Auto generated by iveGenerated8 * and later modified by Rune Schmidt Jensen.7 * CREATED BY: Auto generated by iveGenerated 8 * and later modified by Rune Schmidt Jensen. 9 9 * 10 * HISTORY:Created 20.3.200310 * HISTORY: Created 20.3.2003 11 11 * 12 * Copyright 2003 VR-C12 * Copyright 2003 VR-C 13 13 **********************************************************************/ 14 14 … … 20 20 21 21 void DrawArrayLengths::write(DataOutputStream* out){ 22 // Write DrawArrayLengths's identification.23 out->writeInt(IVEDRAWARRAYLENGTHS);24 // If the osg class is inherited by any other class we should also write this to file.25 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);26 if(prim){27 ((ive::PrimitiveSet*)(prim))->write(out);28 }29 else30 throw Exception("DrawArrayLengths::write(): Could not cast this osg::DrawArrayLengths to an osg::PrimitiveSet.");22 // Write DrawArrayLengths's identification. 23 out->writeInt(IVEDRAWARRAYLENGTHS); 24 // If the osg class is inherited by any other class we should also write this to file. 25 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); 26 if(prim){ 27 ((ive::PrimitiveSet*)(prim))->write(out); 28 } 29 else 30 throw Exception("DrawArrayLengths::write(): Could not cast this osg::DrawArrayLengths to an osg::PrimitiveSet."); 31 31 32 // Write DrawArrayLengths's properties.33 out->writeInt(getFirst());32 // Write DrawArrayLengths's properties. 33 out->writeInt(getFirst()); 34 34 35 // Write array length and its elements.36 out->writeInt(size());37 for(unsigned int i=0; i<size(); i++){38 out->writeInt(((osg::VectorSizei)(*this))[i]);39 }35 // Write array length and its elements. 36 out->writeInt(size()); 37 for(unsigned int i=0; i<size(); i++){ 38 out->writeInt(((osg::VectorSizei)(*this))[i]); 39 } 40 40 41 41 } 42 42 43 43 void DrawArrayLengths::read(DataInputStream* in){ 44 // Read DrawArrayLengths's identification.45 int id = in->peekInt();46 if(id == IVEDRAWARRAYLENGTHS){47 // Code to read DrawArrayLengths's properties.48 id = in->readInt();49 // If the osg class is inherited by any other class we should also read this from file.50 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);51 if(prim){52 ((ive::PrimitiveSet*)(prim))->read(in);53 }54 else55 throw Exception("DrawArrayLengths::read(): Could not cast this osg::DrawArrayLengths to an osg::PrimtiveSet.");44 // Read DrawArrayLengths's identification. 45 int id = in->peekInt(); 46 if(id == IVEDRAWARRAYLENGTHS){ 47 // Code to read DrawArrayLengths's properties. 48 id = in->readInt(); 49 // If the osg class is inherited by any other class we should also read this from file. 50 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); 51 if(prim){ 52 ((ive::PrimitiveSet*)(prim))->read(in); 53 } 54 else 55 throw Exception("DrawArrayLengths::read(): Could not cast this osg::DrawArrayLengths to an osg::PrimtiveSet."); 56 56 57 // Read properties58 setFirst(in->readInt());59 60 // Read array length and its elements.61 int size = in->readInt();62 for(int i=0; i<size; i++){63 push_back(in->readInt());64 }57 // Read properties 58 setFirst(in->readInt()); 59 60 // Read array length and its elements. 61 int size = in->readInt(); 62 for(int i=0; i<size; i++){ 63 push_back(in->readInt()); 64 } 65 65 66 }67 else{68 throw Exception("DrawArrayLengths::read(): Expected DrawArrayLengths identification.");69 }66 } 67 else{ 68 throw Exception("DrawArrayLengths::read(): Expected DrawArrayLengths identification."); 69 } 70 70 } -
OpenSceneGraph/trunk/src/osgPlugins/ive/DrawArrays.cpp
r1980 r3525 1 1 /********************************************************************** 2 2 * 3 * FILE:DrawArrays.cpp3 * FILE: DrawArrays.cpp 4 4 * 5 * DESCRIPTION:Read/Write osg::DrawArrays in binary format to disk.5 * DESCRIPTION: Read/Write osg::DrawArrays in binary format to disk. 6 6 * 7 * CREATED BY:Auto generated by iveGenerated8 * and later modified by Rune Schmidt Jensen.7 * CREATED BY: Auto generated by iveGenerated 8 * and later modified by Rune Schmidt Jensen. 9 9 * 10 * HISTORY:Created 18.3.200310 * HISTORY: Created 18.3.2003 11 11 * 12 * Copyright 2003 VR-C12 * Copyright 2003 VR-C 13 13 **********************************************************************/ 14 14 … … 20 20 21 21 void DrawArrays::write(DataOutputStream* out){ 22 // Write DrawArrays's identification.23 out->writeInt(IVEDRAWARRAYS);24 // If the osg class is inherited by any other class we should also write this to file.25 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);26 if(prim){27 ((ive::PrimitiveSet*)(prim))->write(out);28 }29 else30 throw Exception("DrawArrays::write(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet.");22 // Write DrawArrays's identification. 23 out->writeInt(IVEDRAWARRAYS); 24 // If the osg class is inherited by any other class we should also write this to file. 25 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); 26 if(prim){ 27 ((ive::PrimitiveSet*)(prim))->write(out); 28 } 29 else 30 throw Exception("DrawArrays::write(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet."); 31 31 32 32 33 // Write DrawArrays's properties.34 out->writeInt(getFirst());35 out->writeInt(getCount());33 // Write DrawArrays's properties. 34 out->writeInt(getFirst()); 35 out->writeInt(getCount()); 36 36 } 37 37 38 38 void DrawArrays::read(DataInputStream* in){ 39 // Read DrawArrays's identification.40 int id = in->peekInt();41 if(id == IVEDRAWARRAYS){42 // Code to read DrawArrays's properties.43 id = in->readInt();44 // If the osg class is inherited by any other class we should also read this from file.45 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);46 if(prim){47 ((ive::PrimitiveSet*)(prim))->read(in);48 }49 else50 throw Exception("DrawArrays::read(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet.");39 // Read DrawArrays's identification. 40 int id = in->peekInt(); 41 if(id == IVEDRAWARRAYS){ 42 // Code to read DrawArrays's properties. 43 id = in->readInt(); 44 // If the osg class is inherited by any other class we should also read this from file. 45 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); 46 if(prim){ 47 ((ive::PrimitiveSet*)(prim))->read(in); 48 } 49 else 50 throw Exception("DrawArrays::read(): Could not cast this osg::DrawArrays to an osg::PrimitiveSet."); 51 51 52 52 53 // Read DrawArrays properties54 setFirst(in->readInt());55 setCount(in->readInt());56 }57 else{58 throw Exception("DrawArrays::read(): Expected DrawArrays identification.");59 }53 // Read DrawArrays properties 54 setFirst(in->readInt()); 55 setCount(in->readInt()); 56 } 57 else{ 58 throw Exception("DrawArrays::read(): Expected DrawArrays identification."); 59 } 60 60 }
