00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __PRIMITSTREE_H__
00013 #define __PRIMITSTREE_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 "doubleparam.h"
00027 #include "floatparam.h"
00028 #include "enumparam.h"
00029
00030
00031
00036 class PrimitsTree : public CmdTreeNode
00037 {
00038 public:
00039 PrimitsTree()
00040 : CmdTreeNode( "Primitives", new QPtrList<CmdTreeNode> )
00041 {
00042
00043
00044
00045
00046 mySubTree->append( new CmdTreeNode( "glPolygonMode", NULL, cmd_glPolygonMode,
00047 new SuperPtrList<CmdParam>( 2,
00048 new EnumParam( "face", "1032",
00049 SuperValueList<char*>( 3,
00050 "GL_FRONT",
00051 "GL_BACK",
00052 "GL_FRONT_AND_BACK" ),
00053 SuperValueList<int>( 3,
00054 GL_FRONT,
00055 GL_BACK,
00056 GL_FRONT_AND_BACK ),
00057 "GLenum" ),
00058 new EnumParam( "mode", "6914",
00059 SuperValueList<char*>( 3,
00060 "GL_POINT",
00061 "GL_LINE",
00062 "GL_FILL" ),
00063 SuperValueList<int>( 3,
00064 GL_POINT,
00065 GL_LINE,
00066 GL_FILL ),
00067 "GLenum" ) ) ) );
00068 mySubTree->append( new CmdTreeNode( "glBegin", NULL, cmd_glBegin,
00069 new SuperPtrList<CmdParam>( 1,
00070 new EnumParam( "mode", "1",
00071 SuperValueList<char*>( 10,
00072 "GL_POINTS",
00073 "GL_LINES",
00074 "GL_LINE_LOOP",
00075 "GL_LINE_STRIP",
00076 "GL_TRIANGLES",
00077 "GL_TRIANGLE_STRIP",
00078 "GL_TRIANGLE_FAN",
00079 "GL_QUADS",
00080 "GL_QUAD_STRIP",
00081 "GL_POLYGON" ),
00082 SuperValueList<int>( 10,
00083 GL_POINTS,
00084 GL_LINES,
00085 GL_LINE_LOOP,
00086 GL_LINE_STRIP,
00087 GL_TRIANGLES,
00088 GL_TRIANGLE_STRIP,
00089 GL_TRIANGLE_FAN,
00090 GL_QUADS,
00091 GL_QUAD_STRIP,
00092 GL_POLYGON ),
00093 "GLenum" ) ) ) );
00094 mySubTree->append( new CmdTreeNode( "glEnd", NULL, cmd_glEnd, NULL ) );
00095 mySubTree->append( new CmdTreeNode( "glVertex2d", NULL, cmd_glVertex2d,
00096 new SuperPtrList<CmdParam>( 2,
00097 new DoubleParam( "x", "0", "GLdouble" ),
00098 new DoubleParam( "y", "0", "GLdouble" ) ) ) );
00099 mySubTree->append( new CmdTreeNode( "glVertex2f", NULL, cmd_glVertex2f,
00100 new SuperPtrList<CmdParam>( 2,
00101 new FloatParam( "x", "0", "GLfloat" ),
00102 new FloatParam( "y", "0", "GLfloat" ) ) ) );
00103 mySubTree->append( new CmdTreeNode( "glVertex3d", NULL, cmd_glVertex3d,
00104 new SuperPtrList<CmdParam>( 3,
00105 new DoubleParam( "x", "0", "GLdouble" ),
00106 new DoubleParam( "y", "0", "GLdouble" ),
00107 new DoubleParam( "z", "0", "GLdouble" ) ) ) );
00108 mySubTree->append( new CmdTreeNode( "glVertex3f", NULL, cmd_glVertex3f,
00109 new SuperPtrList<CmdParam>( 3,
00110 new FloatParam( "x", "0", "GLfloat" ),
00111 new FloatParam( "y", "0", "GLfloat" ),
00112 new FloatParam( "z", "0", "GLfloat" ) ) ) );
00113 mySubTree->append( new CmdTreeNode( "glNormal3d", NULL, cmd_glNormal3d,
00114 new SuperPtrList<CmdParam>( 3,
00115 new DoubleParam( "nx", "0", "GLdouble" ),
00116 new DoubleParam( "ny", "0", "GLdouble" ),
00117 new DoubleParam( "nz", "0", "GLdouble" ) ) ) );
00118 mySubTree->append( new CmdTreeNode( "glNormal3f", NULL, cmd_glNormal3f,
00119 new SuperPtrList<CmdParam>( 3,
00120 new FloatParam( "nx", "0", "GLfloat" ),
00121 new FloatParam( "ny", "0", "GLfloat" ),
00122 new FloatParam( "nz", "0", "GLfloat" ) ) ) );
00123 mySubTree->append( new CmdTreeNode( "glRectd", NULL, cmd_glRectd,
00124 new SuperPtrList<CmdParam>( 4,
00125 new DoubleParam( "x1", "0", "GLdouble" ),
00126 new DoubleParam( "y1", "0", "GLdouble" ),
00127 new DoubleParam( "x2", "1", "GLdouble" ),
00128 new DoubleParam( "y2", "1", "GLdouble" ) ) ) );
00129 mySubTree->append( new CmdTreeNode( "glRectf", NULL, cmd_glRectf,
00130 new SuperPtrList<CmdParam>( 4,
00131 new FloatParam( "x1", "0", "GLfloat" ),
00132 new FloatParam( "y1", "0", "GLfloat" ),
00133 new FloatParam( "x2", "1", "GLfloat" ),
00134 new FloatParam( "y2", "1", "GLfloat" ) ) ) );
00135 }
00136
00137
00138
00139
00140
00141 static void cmd_glPolygonMode( const QStringList& p ) {
00142 glPolygonMode( p[0].toInt(), p[1].toInt() );
00143 }
00144 static void cmd_glBegin( const QStringList& p ) {
00145 glBegin( p[0].toInt() );
00146 } static void cmd_glEnd( const QStringList& ) {
00147 glEnd();
00148 }
00149
00150 static void cmd_glVertex2d( const QStringList& p ) {
00151 glVertex2d( p[0].toDouble(), p[1].toDouble() );
00152 }
00153 static void cmd_glVertex2f( const QStringList& p ) {
00154 glVertex2f( p[0].toFloat(), p[1].toFloat() );
00155 }
00156 static void cmd_glVertex3d( const QStringList& p ) {
00157 glVertex3d( p[0].toDouble(), p[1].toDouble(), p[2].toDouble() );
00158 }
00159 static void cmd_glVertex3f( const QStringList& p ) {
00160 glVertex3f( p[0].toFloat(), p[1].toFloat(), p[2].toFloat() );
00161 }
00162 static void cmd_glNormal3d( const QStringList& p ) {
00163 glNormal3d( p[0].toDouble(), p[1].toDouble(), p[2].toDouble() );
00164 }
00165 static void cmd_glNormal3f( const QStringList& p ) {
00166 glNormal3f( p[0].toFloat(), p[1].toFloat(), p[2].toFloat() );
00167 }
00168 static void cmd_glRectd( const QStringList& p ) {
00169 glRectd( p[0].toDouble(), p[1].toDouble(), p[2].toDouble(), p[3].toDouble() );
00170 }
00171 static void cmd_glRectf( const QStringList& p ) {
00172 glRectf( p[0].toFloat(), p[1].toFloat(), p[2].toFloat(), p[3].toFloat() );
00173 }
00174
00175 private:
00176
00177 };
00178
00179
00180 #endif // __PRIMITSTREE_H__