Changeset 3524
- Timestamp:
- 10/24/04 16:31:07 (9 years ago)
- Location:
- OpenSceneGraph/trunk/src/osgPlugins/ive
- Files:
-
- 3 modified
-
DrawElementsUByte.cpp (modified) (2 diffs)
-
DrawElementsUInt.cpp (modified) (2 diffs)
-
DrawElementsUShort.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUByte.cpp
r3433 r3524 1 1 /********************************************************************** 2 2 * 3 * FILE:DrawElementsUByte.cpp3 * FILE: DrawElementsUByte.cpp 4 4 * 5 * DESCRIPTION:Read/Write osg::DrawElementsUByte in binary format to disk.5 * DESCRIPTION: Read/Write osg::DrawElementsUByte 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 DrawElementsUByte::write(DataOutputStream* out){ 22 // Write DrawElementsUByte's identification.23 out->writeInt(IVEDRAWELEMENTSUBYTE);22 // Write DrawElementsUByte's identification. 23 out->writeInt(IVEDRAWELEMENTSUBYTE); 24 24 25 // If the osg class is inherited by any other class we should also write this to file.26 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);27 if(prim){28 ((ive::PrimitiveSet*)(prim))->write(out);29 }30 else31 throw Exception("DrawElementsUByte::write(): Could not cast this osg::DrawElementsUByte to an osg::PrimitiveSet.");32 // Write DrawElementsUByte's properties.25 // If the osg class is inherited by any other class we should also write this to file. 26 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); 27 if(prim){ 28 ((ive::PrimitiveSet*)(prim))->write(out); 29 } 30 else 31 throw Exception("DrawElementsUByte::write(): Could not cast this osg::DrawElementsUByte to an osg::PrimitiveSet."); 32 // Write DrawElementsUByte's properties. 33 33 34 // Write array length and its elements. 35 out->writeInt(size()); 36 for(unsigned int i=0; i<size(); i++){ 37 out->writeUChar((*this)[i]); 38 } 34 // Write array length and its elements. 35 out->writeInt(size()); 36 out->writeCharArray((const char*)&front(), size() * CHARSIZE); 39 37 } 40 38 41 39 void DrawElementsUByte::read(DataInputStream* in){ 42 // Read DrawElementsUByte's identification.43 int id = in->peekInt();44 if(id == IVEDRAWELEMENTSUBYTE){45 // Code to read DrawElementsUByte's properties.46 id = in->readInt();47 // If the osg class is inherited by any other class we should also read this from file.48 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);49 if(prim){50 ((ive::PrimitiveSet*)(prim))->read(in);51 }52 else53 throw Exception("DrawElementsUByte::read(): Could not cast this osg::DrawElementsUByte to an osg::PrimtiveSet.");40 // Read DrawElementsUByte's identification. 41 int id = in->peekInt(); 42 if(id == IVEDRAWELEMENTSUBYTE){ 43 // Code to read DrawElementsUByte'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::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); 47 if(prim){ 48 ((ive::PrimitiveSet*)(prim))->read(in); 49 } 50 else 51 throw Exception("DrawElementsUByte::read(): Could not cast this osg::DrawElementsUByte to an osg::PrimtiveSet."); 54 52 55 // Read array length and its elements. 56 int size = in->readInt(); 57 for(int i=0; i<size; i++){ 58 push_back(in->readUChar()); 59 } 60 } 61 else{ 62 throw Exception("DrawElementsUByte::read(): Expected DrawElementsUByte identification."); 63 } 53 // Read array length and its elements. 54 int size = in->readInt(); 55 resize(size); 56 in->readCharArray((char*)&front(), size * CHARSIZE); 57 } 58 else{ 59 throw Exception("DrawElementsUByte::read(): Expected DrawElementsUByte identification."); 60 } 64 61 } -
OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUInt.cpp
r3433 r3524 1 1 /********************************************************************** 2 2 * 3 * FILE:DrawElementsUInt.cpp3 * FILE: DrawElementsUInt.cpp 4 4 * 5 * DESCRIPTION:Read/Write osg::DrawElementsUInt in binary format to disk.5 * DESCRIPTION: Read/Write osg::DrawElementsUInt in binary format to disk. 6 6 * 7 * CREATED BY:Copied from DrawElementsUShort.cpp by Marco Jez8 * 7 * CREATED BY: Copied from DrawElementsUShort.cpp by Marco Jez 8 * 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 DrawElementsUInt::write(DataOutputStream* out){ 22 // Write DrawElementsUInt's identification.23 out->writeInt(IVEDRAWELEMENTSUINT);22 // Write DrawElementsUInt's identification. 23 out->writeInt(IVEDRAWELEMENTSUINT); 24 24 25 // If the osg class is inherited by any other class we should also write this to file.26 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);27 if(prim){28 ((ive::PrimitiveSet*)(prim))->write(out);29 }30 else31 throw Exception("DrawElementsUInt::write(): Could not cast this osg::DrawElementsUInt to an osg::PrimitiveSet.");32 // Write DrawElementsUInt's properties.25 // If the osg class is inherited by any other class we should also write this to file. 26 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); 27 if(prim){ 28 ((ive::PrimitiveSet*)(prim))->write(out); 29 } 30 else 31 throw Exception("DrawElementsUInt::write(): Could not cast this osg::DrawElementsUInt to an osg::PrimitiveSet."); 32 // Write DrawElementsUInt's properties. 33 33 34 // Write array length and its elements. 35 out->writeInt(size()); 36 for(unsigned int i=0; i<size(); i++){ 37 out->writeUInt((*this)[i]); 38 } 34 // Write array length and its elements. 35 out->writeInt(size()); 36 out->writeCharArray((const char*)&front(), size() * INTSIZE); 39 37 } 40 38 41 39 void DrawElementsUInt::read(DataInputStream* in){ 42 // Read DrawElementsUInt's identification.43 int id = in->peekInt();44 if(id == IVEDRAWELEMENTSUINT){45 // Code to read DrawElementsUInt's properties.46 id = in->readInt();47 // If the osg class is inherited by any other class we should also read this from file.48 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);49 if(prim){50 ((ive::PrimitiveSet*)(prim))->read(in);51 }52 else53 throw Exception("DrawElementsUInt::read(): Could not cast this osg::DrawElementsUInt to an osg::PrimtiveSet.");40 // Read DrawElementsUInt's identification. 41 int id = in->peekInt(); 42 if(id == IVEDRAWELEMENTSUINT){ 43 // Code to read DrawElementsUInt'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::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); 47 if(prim){ 48 ((ive::PrimitiveSet*)(prim))->read(in); 49 } 50 else 51 throw Exception("DrawElementsUInt::read(): Could not cast this osg::DrawElementsUInt to an osg::PrimtiveSet."); 54 52 55 // Read array length and its elements. 56 int size = in->readInt(); 57 for(int i=0; i<size; i++){ 58 push_back(in->readUInt()); 59 } 60 } 61 else{ 62 throw Exception("DrawElementsUInt::read(): Expected DrawElementsUInt identification."); 63 } 53 // Read array length and its elements. 54 int size = in->readInt(); 55 resize(size); 56 in->readCharArray((char*)&front(), size * INTSIZE); 57 } 58 else{ 59 throw Exception("DrawElementsUInt::read(): Expected DrawElementsUInt identification."); 60 } 64 61 } -
OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUShort.cpp
r3433 r3524 1 1 /********************************************************************** 2 2 * 3 * FILE:DrawElementsUShort.cpp3 * FILE: DrawElementsUShort.cpp 4 4 * 5 * DESCRIPTION:Read/Write osg::DrawElementsUShort in binary format to disk.5 * DESCRIPTION: Read/Write osg::DrawElementsUShort 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 DrawElementsUShort::write(DataOutputStream* out){ 22 // Write DrawElementsUShort's identification.23 out->writeInt(IVEDRAWELEMENTSUSHORT);22 // Write DrawElementsUShort's identification. 23 out->writeInt(IVEDRAWELEMENTSUSHORT); 24 24 25 // If the osg class is inherited by any other class we should also write this to file.26 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);27 if(prim){28 ((ive::PrimitiveSet*)(prim))->write(out);29 }30 else31 throw Exception("DrawElementsUShort::write(): Could not cast this osg::DrawElementsUShort to an osg::PrimitiveSet.");32 // Write DrawElementsUShort's properties.25 // If the osg class is inherited by any other class we should also write this to file. 26 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); 27 if(prim){ 28 ((ive::PrimitiveSet*)(prim))->write(out); 29 } 30 else 31 throw Exception("DrawElementsUShort::write(): Could not cast this osg::DrawElementsUShort to an osg::PrimitiveSet."); 32 // Write DrawElementsUShort's properties. 33 33 34 // Write array length and its elements. 35 out->writeInt(size()); 36 for(unsigned int i=0; i<size(); i++){ 37 out->writeUShort((*this)[i]); 38 } 34 // Write array length and its elements. 35 out->writeInt(size()); 36 out->writeCharArray((const char*)&front(), size() * SHORTSIZE); 39 37 } 40 38 41 39 void DrawElementsUShort::read(DataInputStream* in){ 42 // Read DrawElementsUShort's identification.43 int id = in->peekInt();44 if(id == IVEDRAWELEMENTSUSHORT){45 // Code to read DrawElementsUShort's properties.46 id = in->readInt();47 // If the osg class is inherited by any other class we should also read this from file.48 osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);49 if(prim){50 ((ive::PrimitiveSet*)(prim))->read(in);51 }52 else53 throw Exception("DrawElementsUShort::read(): Could not cast this osg::DrawElementsUShort to an osg::PrimtiveSet.");40 // Read DrawElementsUShort's identification. 41 int id = in->peekInt(); 42 if(id == IVEDRAWELEMENTSUSHORT){ 43 // Code to read DrawElementsUShort'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::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this); 47 if(prim){ 48 ((ive::PrimitiveSet*)(prim))->read(in); 49 } 50 else 51 throw Exception("DrawElementsUShort::read(): Could not cast this osg::DrawElementsUShort to an osg::PrimtiveSet."); 54 52 55 // Read array length and its elements. 56 int size = in->readInt(); 57 for(int i=0; i<size; i++){ 58 push_back(in->readUShort()); 59 } 60 } 61 else{ 62 throw Exception("DrawElementsUShort::read(): Expected DrawElementsUShort identification."); 63 } 53 // Read array length and its elements. 54 int size = in->readInt(); 55 resize(size); 56 in->readCharArray((char*)&front(), size * SHORTSIZE); 57 } 58 else{ 59 throw Exception("DrawElementsUShort::read(): Expected DrawElementsUShort identification."); 60 } 64 61 }
