From Pavel Moloshtan, speed improvments in reading and writing index arrays
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: DrawElementsUByte.cpp
|
||||
* FILE: DrawElementsUByte.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::DrawElementsUByte in binary format to disk.
|
||||
* DESCRIPTION: Read/Write osg::DrawElementsUByte in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerated
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
* CREATED BY: Auto generated by iveGenerated
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 20.3.2003
|
||||
* HISTORY: Created 20.3.2003
|
||||
*
|
||||
* Copyright 2003 VR-C
|
||||
* Copyright 2003 VR-C
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
@@ -19,46 +19,43 @@
|
||||
using namespace ive;
|
||||
|
||||
void DrawElementsUByte::write(DataOutputStream* out){
|
||||
// Write DrawElementsUByte's identification.
|
||||
out->writeInt(IVEDRAWELEMENTSUBYTE);
|
||||
// Write DrawElementsUByte's identification.
|
||||
out->writeInt(IVEDRAWELEMENTSUBYTE);
|
||||
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUByte::write(): Could not cast this osg::DrawElementsUByte to an osg::PrimitiveSet.");
|
||||
// Write DrawElementsUByte's properties.
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUByte::write(): Could not cast this osg::DrawElementsUByte to an osg::PrimitiveSet.");
|
||||
// Write DrawElementsUByte's properties.
|
||||
|
||||
// Write array length and its elements.
|
||||
out->writeInt(size());
|
||||
for(unsigned int i=0; i<size(); i++){
|
||||
out->writeUChar((*this)[i]);
|
||||
}
|
||||
// Write array length and its elements.
|
||||
out->writeInt(size());
|
||||
out->writeCharArray((const char*)&front(), size() * CHARSIZE);
|
||||
}
|
||||
|
||||
void DrawElementsUByte::read(DataInputStream* in){
|
||||
// Read DrawElementsUByte's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEDRAWELEMENTSUBYTE){
|
||||
// Code to read DrawElementsUByte's properties.
|
||||
id = in->readInt();
|
||||
// If the osg class is inherited by any other class we should also read this from file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->read(in);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUByte::read(): Could not cast this osg::DrawElementsUByte to an osg::PrimtiveSet.");
|
||||
// Read DrawElementsUByte's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEDRAWELEMENTSUBYTE){
|
||||
// Code to read DrawElementsUByte's properties.
|
||||
id = in->readInt();
|
||||
// If the osg class is inherited by any other class we should also read this from file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->read(in);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUByte::read(): Could not cast this osg::DrawElementsUByte to an osg::PrimtiveSet.");
|
||||
|
||||
// Read array length and its elements.
|
||||
int size = in->readInt();
|
||||
for(int i=0; i<size; i++){
|
||||
push_back(in->readUChar());
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw Exception("DrawElementsUByte::read(): Expected DrawElementsUByte identification.");
|
||||
}
|
||||
// Read array length and its elements.
|
||||
int size = in->readInt();
|
||||
resize(size);
|
||||
in->readCharArray((char*)&front(), size * CHARSIZE);
|
||||
}
|
||||
else{
|
||||
throw Exception("DrawElementsUByte::read(): Expected DrawElementsUByte identification.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: DrawElementsUInt.cpp
|
||||
* FILE: DrawElementsUInt.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::DrawElementsUInt in binary format to disk.
|
||||
* DESCRIPTION: Read/Write osg::DrawElementsUInt in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Copied from DrawElementsUShort.cpp by Marco Jez
|
||||
*
|
||||
* CREATED BY: Copied from DrawElementsUShort.cpp by Marco Jez
|
||||
*
|
||||
*
|
||||
* HISTORY: Created 20.3.2003
|
||||
* HISTORY: Created 20.3.2003
|
||||
*
|
||||
* Copyright 2003 VR-C
|
||||
* Copyright 2003 VR-C
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
@@ -19,46 +19,43 @@
|
||||
using namespace ive;
|
||||
|
||||
void DrawElementsUInt::write(DataOutputStream* out){
|
||||
// Write DrawElementsUInt's identification.
|
||||
out->writeInt(IVEDRAWELEMENTSUINT);
|
||||
// Write DrawElementsUInt's identification.
|
||||
out->writeInt(IVEDRAWELEMENTSUINT);
|
||||
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUInt::write(): Could not cast this osg::DrawElementsUInt to an osg::PrimitiveSet.");
|
||||
// Write DrawElementsUInt's properties.
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUInt::write(): Could not cast this osg::DrawElementsUInt to an osg::PrimitiveSet.");
|
||||
// Write DrawElementsUInt's properties.
|
||||
|
||||
// Write array length and its elements.
|
||||
out->writeInt(size());
|
||||
for(unsigned int i=0; i<size(); i++){
|
||||
out->writeUInt((*this)[i]);
|
||||
}
|
||||
// Write array length and its elements.
|
||||
out->writeInt(size());
|
||||
out->writeCharArray((const char*)&front(), size() * INTSIZE);
|
||||
}
|
||||
|
||||
void DrawElementsUInt::read(DataInputStream* in){
|
||||
// Read DrawElementsUInt's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEDRAWELEMENTSUINT){
|
||||
// Code to read DrawElementsUInt's properties.
|
||||
id = in->readInt();
|
||||
// If the osg class is inherited by any other class we should also read this from file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->read(in);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUInt::read(): Could not cast this osg::DrawElementsUInt to an osg::PrimtiveSet.");
|
||||
// Read DrawElementsUInt's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEDRAWELEMENTSUINT){
|
||||
// Code to read DrawElementsUInt's properties.
|
||||
id = in->readInt();
|
||||
// If the osg class is inherited by any other class we should also read this from file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->read(in);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUInt::read(): Could not cast this osg::DrawElementsUInt to an osg::PrimtiveSet.");
|
||||
|
||||
// Read array length and its elements.
|
||||
int size = in->readInt();
|
||||
for(int i=0; i<size; i++){
|
||||
push_back(in->readUInt());
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw Exception("DrawElementsUInt::read(): Expected DrawElementsUInt identification.");
|
||||
}
|
||||
// Read array length and its elements.
|
||||
int size = in->readInt();
|
||||
resize(size);
|
||||
in->readCharArray((char*)&front(), size * INTSIZE);
|
||||
}
|
||||
else{
|
||||
throw Exception("DrawElementsUInt::read(): Expected DrawElementsUInt identification.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* FILE: DrawElementsUShort.cpp
|
||||
* FILE: DrawElementsUShort.cpp
|
||||
*
|
||||
* DESCRIPTION: Read/Write osg::DrawElementsUShort in binary format to disk.
|
||||
* DESCRIPTION: Read/Write osg::DrawElementsUShort in binary format to disk.
|
||||
*
|
||||
* CREATED BY: Auto generated by iveGenerated
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
* CREATED BY: Auto generated by iveGenerated
|
||||
* and later modified by Rune Schmidt Jensen.
|
||||
*
|
||||
* HISTORY: Created 20.3.2003
|
||||
* HISTORY: Created 20.3.2003
|
||||
*
|
||||
* Copyright 2003 VR-C
|
||||
* Copyright 2003 VR-C
|
||||
**********************************************************************/
|
||||
|
||||
#include "Exception.h"
|
||||
@@ -19,46 +19,43 @@
|
||||
using namespace ive;
|
||||
|
||||
void DrawElementsUShort::write(DataOutputStream* out){
|
||||
// Write DrawElementsUShort's identification.
|
||||
out->writeInt(IVEDRAWELEMENTSUSHORT);
|
||||
// Write DrawElementsUShort's identification.
|
||||
out->writeInt(IVEDRAWELEMENTSUSHORT);
|
||||
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUShort::write(): Could not cast this osg::DrawElementsUShort to an osg::PrimitiveSet.");
|
||||
// Write DrawElementsUShort's properties.
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->write(out);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUShort::write(): Could not cast this osg::DrawElementsUShort to an osg::PrimitiveSet.");
|
||||
// Write DrawElementsUShort's properties.
|
||||
|
||||
// Write array length and its elements.
|
||||
out->writeInt(size());
|
||||
for(unsigned int i=0; i<size(); i++){
|
||||
out->writeUShort((*this)[i]);
|
||||
}
|
||||
// Write array length and its elements.
|
||||
out->writeInt(size());
|
||||
out->writeCharArray((const char*)&front(), size() * SHORTSIZE);
|
||||
}
|
||||
|
||||
void DrawElementsUShort::read(DataInputStream* in){
|
||||
// Read DrawElementsUShort's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEDRAWELEMENTSUSHORT){
|
||||
// Code to read DrawElementsUShort's properties.
|
||||
id = in->readInt();
|
||||
// If the osg class is inherited by any other class we should also read this from file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->read(in);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUShort::read(): Could not cast this osg::DrawElementsUShort to an osg::PrimtiveSet.");
|
||||
// Read DrawElementsUShort's identification.
|
||||
int id = in->peekInt();
|
||||
if(id == IVEDRAWELEMENTSUSHORT){
|
||||
// Code to read DrawElementsUShort's properties.
|
||||
id = in->readInt();
|
||||
// If the osg class is inherited by any other class we should also read this from file.
|
||||
osg::PrimitiveSet* prim = dynamic_cast<osg::PrimitiveSet*>(this);
|
||||
if(prim){
|
||||
((ive::PrimitiveSet*)(prim))->read(in);
|
||||
}
|
||||
else
|
||||
throw Exception("DrawElementsUShort::read(): Could not cast this osg::DrawElementsUShort to an osg::PrimtiveSet.");
|
||||
|
||||
// Read array length and its elements.
|
||||
int size = in->readInt();
|
||||
for(int i=0; i<size; i++){
|
||||
push_back(in->readUShort());
|
||||
}
|
||||
}
|
||||
else{
|
||||
throw Exception("DrawElementsUShort::read(): Expected DrawElementsUShort identification.");
|
||||
}
|
||||
// Read array length and its elements.
|
||||
int size = in->readInt();
|
||||
resize(size);
|
||||
in->readCharArray((char*)&front(), size * SHORTSIZE);
|
||||
}
|
||||
else{
|
||||
throw Exception("DrawElementsUShort::read(): Expected DrawElementsUShort identification.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user