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