00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __LIGHTTREE_H__
00013 #define __LIGHTTREE_H__
00014
00015
00016 #include <qgl.h>
00017 #include <qptrlist.h>
00018 #include <qstring.h>
00019 #include <qstringlist.h>
00020
00021 #include "cmdtreenode.h"
00022 #include "cmdparam.h"
00023 #include "superptrlist.h"
00024 #include "supervaluelist.h"
00025
00026 #include "floatparam.h"
00027 #include "arrayparam.h"
00028 #include "enumparam.h"
00029 #include "intparam.h"
00030
00031
00032
00037 class LightTree : public CmdTreeNode
00038 {
00039 public:
00040 LightTree()
00041 : CmdTreeNode( "Light", new QPtrList<CmdTreeNode> )
00042 {
00043
00044
00045
00046
00047 mySubTree->append( new CmdTreeNode( "glLightf", NULL, cmd_glLightf,
00048 new SuperPtrList<CmdParam>( 3,
00049 new EnumParam( "light", "16384",
00050 SuperValueList<char*>( 8,
00051 "GL_LIGHT0",
00052 "GL_LIGHT1",
00053 "GL_LIGHT2",
00054 "GL_LIGHT3",
00055 "GL_LIGHT4",
00056 "GL_LIGHT5",
00057 "GL_LIGHT6",
00058 "GL_LIGHT7" ),
00059 SuperValueList<int>( 8,
00060 GL_LIGHT0,
00061 GL_LIGHT1,
00062 GL_LIGHT2,
00063 GL_LIGHT3,
00064 GL_LIGHT4,
00065 GL_LIGHT5,
00066 GL_LIGHT6,
00067 GL_LIGHT7 ),
00068 "GLenum" ),
00069 new EnumParam( "pname", "4611",
00070 SuperValueList<char*>( 5,
00071 "GL_SPOT_EXPONENT",
00072 "GL_SPOT_CUTOFF",
00073 "GL_CONSTANT_ATTENUATION",
00074 "GL_LINEAR_ATTENUATION",
00075 "GL_QUADRATIC_ATTENUATION" ),
00076 SuperValueList<int>( 5,
00077 GL_SPOT_EXPONENT,
00078 GL_SPOT_CUTOFF,
00079 GL_CONSTANT_ATTENUATION,
00080 GL_LINEAR_ATTENUATION,
00081 GL_QUADRATIC_ATTENUATION ),
00082 "GLenum" ),
00083 new FloatParam( "param", "0", "GLfloat" ) ) ) );
00084 mySubTree->append( new CmdTreeNode( "glLighti", NULL, cmd_glLighti,
00085 new SuperPtrList<CmdParam>( 3,
00086 new EnumParam( "light", "16384",
00087 SuperValueList<char*>( 8,
00088 "GL_LIGHT0",
00089 "GL_LIGHT1",
00090 "GL_LIGHT2",
00091 "GL_LIGHT3",
00092 "GL_LIGHT4",
00093 "GL_LIGHT5",
00094 "GL_LIGHT6",
00095 "GL_LIGHT7" ),
00096 SuperValueList<int>( 8,
00097 GL_LIGHT0,
00098 GL_LIGHT1,
00099 GL_LIGHT2,
00100 GL_LIGHT3,
00101 GL_LIGHT4,
00102 GL_LIGHT5,
00103 GL_LIGHT6,
00104 GL_LIGHT7 ),
00105 "GLenum" ),
00106 new EnumParam( "pname", "4611",
00107 SuperValueList<char*>( 5,
00108 "GL_SPOT_EXPONENT",
00109 "GL_SPOT_CUTOFF",
00110 "GL_CONSTANT_ATTENUATION",
00111 "GL_LINEAR_ATTENUATION",
00112 "GL_QUADRATIC_ATTENUATION" ),
00113 SuperValueList<int>( 5,
00114 GL_SPOT_EXPONENT,
00115 GL_SPOT_CUTOFF,
00116 GL_CONSTANT_ATTENUATION,
00117 GL_LINEAR_ATTENUATION,
00118 GL_QUADRATIC_ATTENUATION ),
00119 "GLenum" ),
00120 new IntParam( "param", "0", "GLint" ) ) ) );
00121 mySubTree->append( new CmdTreeNode( "glLightfv", NULL, cmd_glLightfv,
00122 new SuperPtrList<CmdParam>( 3,
00123 new EnumParam( "light", "16384",
00124 SuperValueList<char*>( 8,
00125 "GL_LIGHT0",
00126 "GL_LIGHT1",
00127 "GL_LIGHT2",
00128 "GL_LIGHT3",
00129 "GL_LIGHT4",
00130 "GL_LIGHT5",
00131 "GL_LIGHT6",
00132 "GL_LIGHT7" ),
00133 SuperValueList<int>( 8,
00134 GL_LIGHT0,
00135 GL_LIGHT1,
00136 GL_LIGHT2,
00137 GL_LIGHT3,
00138 GL_LIGHT4,
00139 GL_LIGHT5,
00140 GL_LIGHT6,
00141 GL_LIGHT7 ),
00142 "GLenum" ),
00143 new EnumParam( "pname", "4611",
00144 SuperValueList<char*>( 5,
00145 "GL_AMBIENT",
00146 "GL_DIFFUSE",
00147 "GL_SPECULAR",
00148 "GL_POSITION",
00149 "GL_SPOT_DIRECTION" ),
00150 SuperValueList<int>( 5,
00151 GL_AMBIENT,
00152 GL_DIFFUSE,
00153 GL_SPECULAR,
00154 GL_POSITION,
00155 GL_SPOT_DIRECTION ),
00156 "GLenum" ),
00157 new ArrayParam( "params", "light",
00158 new SuperPtrList<CmdParam>( 4,
00159 new FloatParam( "0", "0" ),
00160 new FloatParam( "1", "0" ),
00161 new FloatParam( "2", "0" ),
00162 new FloatParam( "3", "1" ) ),
00163 "GLfloat*" ) ) ) );
00164 mySubTree->append( new CmdTreeNode( "glLightiv", NULL, cmd_glLightiv,
00165 new SuperPtrList<CmdParam>( 3,
00166 new EnumParam( "light", "16384",
00167 SuperValueList<char*>( 8,
00168 "GL_LIGHT0",
00169 "GL_LIGHT1",
00170 "GL_LIGHT2",
00171 "GL_LIGHT3",
00172 "GL_LIGHT4",
00173 "GL_LIGHT5",
00174 "GL_LIGHT6",
00175 "GL_LIGHT7" ),
00176 SuperValueList<int>( 8,
00177 GL_LIGHT0,
00178 GL_LIGHT1,
00179 GL_LIGHT2,
00180 GL_LIGHT3,
00181 GL_LIGHT4,
00182 GL_LIGHT5,
00183 GL_LIGHT6,
00184 GL_LIGHT7 ),
00185 "GLenum" ),
00186 new EnumParam( "pname", "4611",
00187 SuperValueList<char*>( 5,
00188 "GL_AMBIENT",
00189 "GL_DIFFUSE",
00190 "GL_SPECULAR",
00191 "GL_POSITION",
00192 "GL_SPOT_DIRECTION" ),
00193 SuperValueList<int>( 5,
00194 GL_AMBIENT,
00195 GL_DIFFUSE,
00196 GL_SPECULAR,
00197 GL_POSITION,
00198 GL_SPOT_DIRECTION ),
00199 "GLenum" ),
00200 new ArrayParam( "params", "light",
00201 new SuperPtrList<CmdParam>( 4,
00202 new IntParam( "0", "0" ),
00203 new IntParam( "1", "0" ),
00204 new IntParam( "2", "0" ),
00205 new IntParam( "3", "1" ) ),
00206 "GLint*" ) ) ) );
00207 mySubTree->append( new CmdTreeNode( "glLightModelf", NULL, cmd_glLightModelf,
00208 new SuperPtrList<CmdParam>( 2,
00209 new EnumParam( "pname", "2897",
00210 SuperValueList<char*>( 2,
00211 "GL_LIGHT_MODEL_LOCAL_VIEWER",
00212 "GL_LIGHT_MODEL_TWO_SIDE" ),
00213 SuperValueList<int>( 2,
00214 GL_LIGHT_MODEL_LOCAL_VIEWER,
00215 GL_LIGHT_MODEL_TWO_SIDE ),
00216 "GLenum" ),
00217 new FloatParam( "param", "0", "GLfloat" ) ) ) );
00218 mySubTree->append( new CmdTreeNode( "glLightModelfv", NULL, cmd_glLightModelfv,
00219 new SuperPtrList<CmdParam>( 2,
00220 new EnumParam( "pname", "2899",
00221 SuperValueList<char*>( 1,
00222 "GL_LIGHT_MODEL_AMBIENT" ),
00223 SuperValueList<int>( 1,
00224 GL_LIGHT_MODEL_AMBIENT ),
00225 "GLenum" ),
00226 new ArrayParam( "params", "light_model",
00227 new SuperPtrList<CmdParam>( 4,
00228 new FloatParam( "0", "0.2" ),
00229 new FloatParam( "1", "0.2" ),
00230 new FloatParam( "2", "0.2" ),
00231 new FloatParam( "3", "1" ) ),
00232 "GLfloat*" ) ) ) );
00233 }
00234
00235
00236
00237
00238
00239 static void cmd_glLightf( const QStringList& p ) {
00240 glLightf( p[0].toInt(), p[1].toInt(), p[2].toFloat() );
00241 }
00242 static void cmd_glLighti( const QStringList& p ) {
00243 glLighti( p[0].toInt(), p[1].toInt(), p[2].toInt() );
00244 }
00245 static void cmd_glLightfv( const QStringList& p ) {
00246 GLfloat params[4] = { p[2].toFloat(), p[3].toFloat(), p[4].toFloat(), p[5].toFloat() };
00247 glLightfv( p[0].toInt(), p[1].toInt(), params );
00248 }
00249 static void cmd_glLightiv( const QStringList& p ) {
00250 GLint params[4] = { p[2].toInt(), p[3].toInt(), p[4].toInt(), p[5].toInt() };
00251 glLightiv( p[0].toInt(), p[1].toInt(), params );
00252 }
00253 static void cmd_glLightModelf( const QStringList& p ) {
00254 glLightModelf( p[0].toInt(), p[1].toFloat() );
00255 }
00256 static void cmd_glLightModelfv( const QStringList& p ) {
00257 GLfloat params[4] = { p[1].toFloat(), p[2].toFloat(), p[3].toFloat(), p[4].toFloat() };
00258 glLightModelfv( p[0].toInt(), params );
00259 }
00260
00261 private:
00262
00263 };
00264
00265
00266 #endif // __LIGHTTREE_H__