| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /****************************************************************************** 00002 * VRS - The Virtual Rendering System 00003 * Copyright (C) 2002 Computer Graphics Systems Group at the 00004 * Hasso-Plattner-Institute (HPI), Potsdam, Germany. 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or (at 00009 * your option) any later version. This library is distributed in the hope 00010 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 00011 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. You should have received 00013 * a copy of the GNU Lesser+ General Public License along with this library; if 00014 * not, write to the FreeSoftware Foundation, Inc., 59 Temple Place, Suite 330, 00015 * Boston, MA, 02111-1307, USA. 00016 ******************************************************************************/ 00017 00018 #ifndef VRS_X3D_X3DHELPER_H 00019 #define VRS_X3D_X3DHELPER_H 00020 00021 #include <vrs/x3d/config.h> 00022 #include <vrs/sg/scenething.h> 00023 #include <vrs/polygonset.h> 00024 #include <vrs/linestyle.h> 00025 #include <vrs/facestyle.h> 00026 #include <vrs/opengl/shapematerialgl.h> 00027 #include <vrs/opengl/imagetexture2dgl.h> 00028 #include <vrs/opengl/texenvcombinegl.h> 00029 #include <vrs/opengl/texgengl.h> 00030 #include <vrs/container/array.h> 00031 #include <vrs/matrix.h> 00032 00033 namespace VRS { 00034 namespace X3D { 00035 00036 struct X3DMultiTexture : public SharedObj { 00037 X3DMultiTexture(void) { 00038 colorOps_ = new Array<TexEnvCombineGL::CombineMode>; 00039 alphaOps_ = new Array<TexEnvCombineGL::CombineMode>; 00040 source_ = new Array<GLenum>; 00041 scaleRGB_ = new Array<int>; 00042 scaleAlpha_ = new Array<int>; 00043 textures_ = new Array<SO<ImageTexture2DGL> >; 00044 } 00045 00046 SO<Array<TexEnvCombineGL::CombineMode> > colorOps_, alphaOps_; 00047 SO<Array<GLenum> > source_; 00048 SO<Array<int> > scaleRGB_, scaleAlpha_; 00049 SO<Array<SO<ImageTexture2DGL> > > textures_; 00050 }; 00051 00052 struct X3DAppearance : public SharedObj { 00053 X3DAppearance(void) { 00054 x3dMultiTexture_ = new X3DMultiTexture; 00055 textureTransforms_ = new Array<Matrix>; 00056 lineStyle_ = 0; 00057 mat_ = 0; 00058 } 00059 00060 SO<X3DMultiTexture> x3dMultiTexture_; 00061 00062 SO<LineStyle> lineStyle_; 00063 SO<ShapeMaterialGL> mat_; 00064 00065 SO<Array<Matrix> > textureTransforms_; 00066 }; 00067 00068 struct X3DGeometry : public SharedObj { 00069 X3DGeometry(void) { 00070 texcoordinates_ = new Array<SO<Iterator<Vector> > >; 00071 texGenerators_ = new Array<SO<TexGenGL> >; 00072 polySet_ = 0; 00073 faceStyle_ = 0; 00074 coordinates_ = 0; 00075 normals_ = 0; 00076 colors_ = 0; 00077 ranges_ = 0; 00078 coordIndices_ = 0; 00079 colorIndices_ = 0; 00080 normalIndices_ = 0; 00081 texcoordIndices_ = 0; 00082 00083 normalPerVertex_ = true; 00084 colorPerVertex_ = true; 00085 } 00086 00087 SO<PolygonSet> polySet_; 00088 SO<FaceStyle> faceStyle_; 00089 00090 SO<Array<SO<Iterator<Vector> > > > texcoordinates_; 00091 SO<Array<SO<TexGenGL> > > texGenerators_; 00092 Iterator<Vector>* coordinates_, *normals_; 00093 Iterator<Color>* colors_; 00094 Iterator<unsigned int>* ranges_, *coordIndices_, *colorIndices_, *normalIndices_, *texcoordIndices_; 00095 00096 bool normalPerVertex_, colorPerVertex_; 00097 }; 00098 00099 } // namespace X3D 00100 } // namespace VRS 00101 00102 #endif // VRS_X3D_X3DHELPER_H