DataTypes
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
// Written by Wang Rui, (C) 2010
#ifndef OSGDB_DATATYPES
#define OSGDB_DATATYPES
#include <string>
#include <osg/GL>
namespace osgDB
{
// OSG Header (MD5, 16Bit)
#define OSG_HEADER_LOW 0x6C910EA1
#define OSG_HEADER_HIGH 0x1AFB4545
// Reader/writer plugin version
const unsigned int PLUGIN_VERSION = 2;
const int BOOL_SIZE = 1;
const int CHAR_SIZE = 1;
const int SHORT_SIZE = 2;
const int INT_SIZE = 4;
const int LONG_SIZE = 4;
const int INT64_SIZE = 8;
const int FLOAT_SIZE = 4;
const int DOUBLE_SIZE = 8;
const int GLENUM_SIZE = 4;
const int ID_BYTE_ARRAY = 0;
const int ID_UBYTE_ARRAY = 1;
const int ID_SHORT_ARRAY = 2;
const int ID_USHORT_ARRAY = 3;
const int ID_INT_ARRAY = 4;
const int ID_UINT_ARRAY = 5;
const int ID_FLOAT_ARRAY = 6;
const int ID_DOUBLE_ARRAY = 7;
const int ID_VEC2B_ARRAY = 8;
const int ID_VEC3B_ARRAY = 9;
const int ID_VEC4B_ARRAY = 10;
const int ID_VEC4UB_ARRAY = 11;
const int ID_VEC2S_ARRAY = 12;
const int ID_VEC3S_ARRAY = 13;
const int ID_VEC4S_ARRAY = 14;
const int ID_VEC2_ARRAY = 15;
const int ID_VEC3_ARRAY = 16;
const int ID_VEC4_ARRAY = 17;
const int ID_VEC2D_ARRAY = 18;
const int ID_VEC3D_ARRAY = 19;
const int ID_VEC4D_ARRAY = 20;
const int ID_VEC2UB_ARRAY = 21;
const int ID_VEC3UB_ARRAY = 22;
const int ID_VEC2US_ARRAY = 23;
const int ID_VEC3US_ARRAY = 24;
const int ID_VEC4US_ARRAY = 25;
const int ID_VEC2I_ARRAY = 26;
const int ID_VEC3I_ARRAY = 27;
const int ID_VEC4I_ARRAY = 28;
const int ID_VEC2UI_ARRAY = 29;
const int ID_VEC3UI_ARRAY = 30;
const int ID_VEC4UI_ARRAY = 31;
const int ID_UINT64_ARRAY = 32;
const int ID_INT64_ARRAY = 33;
const int ID_DRAWARRAYS = 50;
const int ID_DRAWARRAY_LENGTH = 51;
const int ID_DRAWELEMENTS_UBYTE = 52;
const int ID_DRAWELEMENTS_USHORT = 53;
const int ID_DRAWELEMENTS_UINT = 54;
// Used by BEGIN_BRACKET and END_BRACKET
const int INDENT_VALUE = 2;
// Used by the writeImage/readImage parameter
const int IMAGE_INLINE_DATA = 0;
const int IMAGE_INLINE_FILE = 1;
const int IMAGE_EXTERNAL = 2;
const int IMAGE_WRITE_OUT = 3;
struct ObjectGLenum
{
ObjectGLenum( GLenum value=0 ) : _value(value) {}
ObjectGLenum( const ObjectGLenum& copy ) : _value(copy._value) {}
void set( GLenum e ) { _value = e; }
GLenum get() const { return _value; }
GLenum _value;
};
#define GLENUM(value) osgDB::ObjectGLenum(value)
#define DEF_GLENUM(var) osgDB::ObjectGLenum var;
class ObjectProperty
{
public:
ObjectProperty() : _value(0), _mapProperty(false) {}
ObjectProperty( const char* name, int value=0, bool useMap=false )
: _name(name), _value(value), _mapProperty(useMap) {}
ObjectProperty( const ObjectProperty& copy )
: _name(copy._name), _value(copy._value), _mapProperty(copy._mapProperty) {}
ObjectProperty& operator()( const char* name )
{ _name = name; return *this; }
void set( int v ) { _value = v; }
int get() const { return _value; }
std::string _name;
int _value;
bool _mapProperty;
};
#define MAPPEE(pairName, value) osgDB::ObjectProperty(#pairName, value, true)
#define DEF_MAPPEE(pairName, var) osgDB::ObjectProperty var(#pairName, 0, true);
class ObjectMark
{
public:
ObjectMark() : _indentDelta(0) {}
ObjectMark( const ObjectMark& copy )
: _name(copy._name), _indentDelta(copy._indentDelta) {}
void set( const char* name, int delta=0 )
{ _name = name; _indentDelta = delta; }
std::string _name;
int _indentDelta;
};
}
#endif
osgDB::ObjectMark::ObjectMark
ObjectMark(const ObjectMark &copy)
Definition DataTypes:133
osgDB::ObjectMark::ObjectMark
ObjectMark()
Definition DataTypes:131
osgDB::ObjectMark::set
void set(const char *name, int delta=0)
Definition DataTypes:136
osgDB::ObjectMark::_indentDelta
int _indentDelta
Definition DataTypes:140
osgDB::ObjectMark::_name
std::string _name
Definition DataTypes:139
osgDB::ObjectProperty::get
int get() const
Definition DataTypes:119
osgDB::ObjectProperty::_mapProperty
bool _mapProperty
Definition DataTypes:123
osgDB::ObjectProperty::_name
std::string _name
Definition DataTypes:121
osgDB::ObjectProperty::ObjectProperty
ObjectProperty()
Definition DataTypes:107
osgDB::ObjectProperty::operator()
ObjectProperty & operator()(const char *name)
Definition DataTypes:115
osgDB::ObjectProperty::ObjectProperty
ObjectProperty(const char *name, int value=0, bool useMap=false)
Definition DataTypes:109
osgDB::ObjectProperty::_value
int _value
Definition DataTypes:122
osgDB::ObjectProperty::ObjectProperty
ObjectProperty(const ObjectProperty &copy)
Definition DataTypes:112
osgDB::ObjectProperty::set
void set(int v)
Definition DataTypes:118
osgDB
Definition Archive:24
osgDB::ID_VEC4I_ARRAY
const int ID_VEC4I_ARRAY
Definition DataTypes:70
osgDB::ID_UINT_ARRAY
const int ID_UINT_ARRAY
Definition DataTypes:46
osgDB::ID_VEC4_ARRAY
const int ID_VEC4_ARRAY
Definition DataTypes:58
osgDB::ID_VEC3_ARRAY
const int ID_VEC3_ARRAY
Definition DataTypes:57
osgDB::ID_UINT64_ARRAY
const int ID_UINT64_ARRAY
Definition DataTypes:75
osgDB::ID_VEC2B_ARRAY
const int ID_VEC2B_ARRAY
Definition DataTypes:49
osgDB::ID_VEC4UI_ARRAY
const int ID_VEC4UI_ARRAY
Definition DataTypes:73
osgDB::FLOAT_SIZE
const int FLOAT_SIZE
Definition DataTypes:37
osgDB::ID_VEC2I_ARRAY
const int ID_VEC2I_ARRAY
Definition DataTypes:68
osgDB::SHORT_SIZE
const int SHORT_SIZE
Definition DataTypes:33
osgDB::ID_DRAWARRAYS
const int ID_DRAWARRAYS
Definition DataTypes:78
osgDB::IMAGE_INLINE_DATA
const int IMAGE_INLINE_DATA
Definition DataTypes:88
osgDB::ID_INT_ARRAY
const int ID_INT_ARRAY
Definition DataTypes:45
osgDB::INT64_SIZE
const int INT64_SIZE
Definition DataTypes:36
osgDB::ID_VEC4UB_ARRAY
const int ID_VEC4UB_ARRAY
Definition DataTypes:52
osgDB::ID_VEC4S_ARRAY
const int ID_VEC4S_ARRAY
Definition DataTypes:55
osgDB::ID_VEC4D_ARRAY
const int ID_VEC4D_ARRAY
Definition DataTypes:61
osgDB::ID_VEC2UB_ARRAY
const int ID_VEC2UB_ARRAY
Definition DataTypes:62
osgDB::ID_BYTE_ARRAY
const int ID_BYTE_ARRAY
Definition DataTypes:41
osgDB::ID_VEC3B_ARRAY
const int ID_VEC3B_ARRAY
Definition DataTypes:50
osgDB::IMAGE_WRITE_OUT
const int IMAGE_WRITE_OUT
Definition DataTypes:91
osgDB::ID_VEC3UI_ARRAY
const int ID_VEC3UI_ARRAY
Definition DataTypes:72
osgDB::ID_DOUBLE_ARRAY
const int ID_DOUBLE_ARRAY
Definition DataTypes:48
osgDB::ID_VEC3I_ARRAY
const int ID_VEC3I_ARRAY
Definition DataTypes:69
osgDB::ID_VEC3D_ARRAY
const int ID_VEC3D_ARRAY
Definition DataTypes:60
osgDB::ID_INT64_ARRAY
const int ID_INT64_ARRAY
Definition DataTypes:76
osgDB::CHAR_SIZE
const int CHAR_SIZE
Definition DataTypes:32
osgDB::ID_DRAWELEMENTS_USHORT
const int ID_DRAWELEMENTS_USHORT
Definition DataTypes:81
osgDB::ID_DRAWELEMENTS_UINT
const int ID_DRAWELEMENTS_UINT
Definition DataTypes:82
osgDB::ID_SHORT_ARRAY
const int ID_SHORT_ARRAY
Definition DataTypes:43
osgDB::ID_VEC2D_ARRAY
const int ID_VEC2D_ARRAY
Definition DataTypes:59
osgDB::BOOL_SIZE
const int BOOL_SIZE
Definition DataTypes:31
osgDB::ID_VEC3US_ARRAY
const int ID_VEC3US_ARRAY
Definition DataTypes:65
osgDB::INDENT_VALUE
const int INDENT_VALUE
Definition DataTypes:85
osgDB::LONG_SIZE
const int LONG_SIZE
Definition DataTypes:35
osgDB::IMAGE_INLINE_FILE
const int IMAGE_INLINE_FILE
Definition DataTypes:89
osgDB::IMAGE_EXTERNAL
const int IMAGE_EXTERNAL
Definition DataTypes:90
osgDB::ID_USHORT_ARRAY
const int ID_USHORT_ARRAY
Definition DataTypes:44
osgDB::ID_DRAWARRAY_LENGTH
const int ID_DRAWARRAY_LENGTH
Definition DataTypes:79
osgDB::ID_UBYTE_ARRAY
const int ID_UBYTE_ARRAY
Definition DataTypes:42
osgDB::ID_VEC2UI_ARRAY
const int ID_VEC2UI_ARRAY
Definition DataTypes:71
osgDB::ID_VEC2US_ARRAY
const int ID_VEC2US_ARRAY
Definition DataTypes:64
osgDB::PLUGIN_VERSION
const unsigned int PLUGIN_VERSION
Definition DataTypes:29
osgDB::ID_VEC2_ARRAY
const int ID_VEC2_ARRAY
Definition DataTypes:56
osgDB::DOUBLE_SIZE
const int DOUBLE_SIZE
Definition DataTypes:38
osgDB::ID_VEC3UB_ARRAY
const int ID_VEC3UB_ARRAY
Definition DataTypes:63
osgDB::GLENUM_SIZE
const int GLENUM_SIZE
Definition DataTypes:39
osgDB::ID_FLOAT_ARRAY
const int ID_FLOAT_ARRAY
Definition DataTypes:47
osgDB::ID_VEC3S_ARRAY
const int ID_VEC3S_ARRAY
Definition DataTypes:54
osgDB::ID_VEC4B_ARRAY
const int ID_VEC4B_ARRAY
Definition DataTypes:51
osgDB::INT_SIZE
const int INT_SIZE
Definition DataTypes:34
osgDB::ID_VEC2S_ARRAY
const int ID_VEC2S_ARRAY
Definition DataTypes:53
osgDB::ID_VEC4US_ARRAY
const int ID_VEC4US_ARRAY
Definition DataTypes:66
osgDB::ID_DRAWELEMENTS_UBYTE
const int ID_DRAWELEMENTS_UBYTE
Definition DataTypes:80
osgDB::ObjectGLenum::_value
GLenum _value
Definition DataTypes:99
osgDB::ObjectGLenum::ObjectGLenum
ObjectGLenum(const ObjectGLenum &copy)
Definition DataTypes:96
osgDB::ObjectGLenum::set
void set(GLenum e)
Definition DataTypes:97
osgDB::ObjectGLenum::ObjectGLenum
ObjectGLenum(GLenum value=0)
Definition DataTypes:95
osgDB::ObjectGLenum::get
GLenum get() const
Definition DataTypes:98