root/OpenSceneGraph/trunk/include/osgDB/DataTypes @ 13788

Revision 13788, 3.9 kB (checked in by robert, 11 days ago)

Added shaders to support experimental shader based displacement mapping technique osgTerrain::ShaderTerrain?.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
2 *
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.
7 *
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.
12*/
13// Written by Wang Rui, (C) 2010
14
15#ifndef OSGDB_DATATYPES
16#define OSGDB_DATATYPES
17
18#include <string>
19#include <osg/GL>
20
21namespace osgDB
22{
23
24// OSG Header (MD5, 16Bit)
25#define OSG_HEADER_LOW  0x6C910EA1
26#define OSG_HEADER_HIGH 0x1AFB4545
27
28// Reader/writer plugin version
29const unsigned int PLUGIN_VERSION = 2;
30
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 FLOAT_SIZE =  4;
37const int DOUBLE_SIZE = 8;
38const int GLENUM_SIZE = 4;
39
40const int ID_BYTE_ARRAY = 0;
41const int ID_UBYTE_ARRAY = 1;
42const int ID_SHORT_ARRAY = 2;
43const int ID_USHORT_ARRAY = 3;
44const int ID_INT_ARRAY = 4;
45const int ID_UINT_ARRAY = 5;
46const int ID_FLOAT_ARRAY = 6;
47const int ID_DOUBLE_ARRAY = 7;
48const int ID_VEC2B_ARRAY = 8;
49const int ID_VEC3B_ARRAY = 9;
50const int ID_VEC4B_ARRAY = 10;
51const int ID_VEC4UB_ARRAY = 11;
52const int ID_VEC2S_ARRAY = 12;
53const int ID_VEC3S_ARRAY = 13;
54const int ID_VEC4S_ARRAY = 14;
55const int ID_VEC2_ARRAY = 15;
56const int ID_VEC3_ARRAY = 16;
57const int ID_VEC4_ARRAY = 17;
58const int ID_VEC2D_ARRAY = 18;
59const int ID_VEC3D_ARRAY = 19;
60const int ID_VEC4D_ARRAY = 20;
61const int ID_VEC2UB_ARRAY = 21;
62const int ID_VEC3UB_ARRAY = 22;
63const int ID_VEC2US_ARRAY = 23;
64const int ID_VEC3US_ARRAY = 24;
65const int ID_VEC4US_ARRAY = 25;
66
67const int ID_VEC2I_ARRAY = 26;
68const int ID_VEC3I_ARRAY = 27;
69const int ID_VEC4I_ARRAY = 28;
70const int ID_VEC2UI_ARRAY = 29;
71const int ID_VEC3UI_ARRAY = 30;
72const int ID_VEC4UI_ARRAY = 31;
73
74const int ID_DRAWARRAYS = 50;
75const int ID_DRAWARRAY_LENGTH = 51;
76const int ID_DRAWELEMENTS_UBYTE = 52;
77const int ID_DRAWELEMENTS_USHORT = 53;
78const int ID_DRAWELEMENTS_UINT = 54;
79
80// Used by BEGIN_BRACKET and END_BRACKET
81const int INDENT_VALUE = 2;
82
83// Used by the writeImage/readImage parameter
84const int IMAGE_INLINE_DATA = 0;
85const int IMAGE_INLINE_FILE = 1;
86const int IMAGE_EXTERNAL = 2;
87const int IMAGE_WRITE_OUT = 3;
88
89struct ObjectGLenum
90{
91    ObjectGLenum( GLenum value=0 ) : _value(value) {}
92    ObjectGLenum( const ObjectGLenum& copy ) : _value(copy._value) {}
93    void set( GLenum e ) { _value = e; }
94    GLenum get() const { return _value; }
95    GLenum _value;
96};
97#define GLENUM(value) osgDB::ObjectGLenum(value)
98#define DEF_GLENUM(var) osgDB::ObjectGLenum var;
99
100class ObjectProperty
101{
102public:
103    ObjectProperty() : _value(0), _mapProperty(false) {}
104
105    ObjectProperty( const char* name, int value=0, bool useMap=false )
106    : _name(name), _value(value), _mapProperty(useMap) {}
107
108    ObjectProperty( const ObjectProperty& copy )
109    : _name(copy._name), _value(copy._value), _mapProperty(copy._mapProperty) {}
110
111    ObjectProperty& operator()( const char* name )
112    { _name = name; return *this; }
113
114    void set( int v ) { _value = v; }
115    int get() const { return _value; }
116
117    std::string _name;
118    int _value;
119    bool _mapProperty;
120};
121#define MAPPEE(pairName, value) osgDB::ObjectProperty(#pairName, value, true)
122#define DEF_MAPPEE(pairName, var) osgDB::ObjectProperty var(#pairName, 0, true);
123
124class ObjectMark
125{
126public:
127    ObjectMark() : _indentDelta(0) {}
128
129    ObjectMark( const ObjectMark& copy )
130    : _name(copy._name), _indentDelta(copy._indentDelta) {}
131
132    void set( const char* name, int delta=0 )
133    { _name = name, _indentDelta = delta; }
134
135    std::string _name;
136    int _indentDelta;
137};
138
139}
140#endif
Note: See TracBrowser for help on using the browser.