Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

LWSurface.h

Go to the documentation of this file.
00001 
00002 /*
00003     TEDDY - General graphics application library
00004     Copyright (C) 1999-2002  Timo Suoranta
00005     tksuoran@cc.helsinki.fi
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2.1 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021     $Id: LWSurface.h,v 1.4 2002/01/11 14:34:59 tksuoran Exp $
00022 */
00023 
00024 
00025 #ifndef TEDDY__IMPORTS__LW_SURFACE__H
00026 #define TEDDY__IMPORTS__LW_SURFACE__H
00027 
00028 
00029 #include "Teddy/TeddyConfig.h"
00030 #if defined( TEDDY_INCLUDE_LW_SCENE )
00031 
00032 
00033 #include "Teddy/Materials/Material.h"
00034 #include "Teddy/Graphics/Color.h"
00035 #include "Teddy/SysSupport/StdMap.h"
00036 #include "Teddy/Imports/lwdef.h"
00037 namespace Teddy {
00038     namespace Models { class Model; };
00039 };
00040 using namespace Teddy::Materials;
00041 using namespace Teddy::Models;
00042 
00043 
00044 namespace Teddy   {
00045 namespace Imports {
00046 
00047 
00048 class LWClip;
00049 class LWEnvelope;
00050 class LWFile;
00051 class LWLayer;
00052 class LWModel;
00053 class LWSurfaceBlok;
00054 class LWTexture;
00055 
00056 
00057 typedef std::map<int, LWTexture     *> int_to_LWTexture;
00058 typedef std::map<int, LWSurfaceBlok *> int_to_LWSurfaceBlok;
00059 
00060 
00062 class LWSurface : public Material {
00063 public:
00064     LWSurface( LWLayer *layer, Model *model, const std::string &name );
00065     virtual ~LWSurface();
00066 
00067     void          processSubChunk ();
00068     void          setModel        ( Model *model );
00069     LWLayer      *getLayer        ();
00070     Model        *getModel        ();
00071     void          endSurface      ();
00072     virtual void  setTexture      ( Texture *t, bool enable=false );
00073 
00074 protected:
00075     int  getMapType          ( const char *s );
00076     void endTexture          ();
00077     void useTextureColormap  ();
00078 
00079     void readBaseColor_COL4  ();  //  COLR
00080     void readStateFlags_U2   ();  //  FLAG
00081     void readLuminosity_IP2  ();  //  LUMI
00082     void readLuminosity_FP4  ();  //  VLUM
00083     void readDiffuse_IP2     ();  //  DIFF
00084     void readDiffuse_FP4     ();  //  VDIF
00085     void readSpecular_IP2_4  ();  //  SPEC
00086     void readSpecular_FP4    ();  //  VSPC
00087     void readReflection_IP2_4();  //  REFL
00088     void readReflection_FP4  ();  //  VRFL
00089     void readTransparency_IP2();  //  TRAN
00090     void readTransparency_FP4();  //  VTRN
00091 
00092     void readSpecularGlossiness_I2_4         ();  //  GLOS
00093     void readReflectionMode_U2               ();  //  RFLT
00094     void readReflectionMapImage_FNAM0        ();  //  RIMG
00095     void readReflectionMapImageSeamAngle_DEG4();  //  RSAN
00096     void readRefractiveIndex_F4              ();  //  RIND
00097     void readEdgeTransparencyTreshold_F4     ();  //  EDGE
00098     void readMaxSmoothingAngle_DEG4          ();  //  SMAN
00099 
00100     void readAlphaMode_U2_U2           ();  //  ALPH
00101     void readShaderPlugin_S0           ();  //  SHDR
00102     void readShaderData_f              ();  //  SDAT
00103     void readSequenceOptions_U2_U2_U2  ();  //  IMSQ
00104     void readFlyerClipOptions_U4_U4    ();  //  FLYR
00105     void readColorCycleOptions_U2_U2_U2();  //  IMCC
00106 
00107     void readColorTexture_S0       ();  //  CTEX
00108     void readDiffuseTexture_S0     ();  //  DTEX
00109     void readSpecularTexture_S0    ();  //  STEX
00110     void readReflectionTexture_S0  ();  //  RTEX
00111     void readTransparencyTexture_S0();  //  TTEX
00112     void readLuminosityTexture_S0  ();  //  LTEX
00113     void readBumpTexture_S0        ();  //  BTEX
00114 
00115     void readBaseColor_COL12_VX                 ();
00116     void readLuminosity_FP4_VX                  ();
00117     void readDiffuse_FP4_VX                     ();
00118     void readSpecular_FP4_VX                    ();
00119     void readReflection_FP4_VX                  ();
00120     void readTransparency_FP4_VX                ();
00121     void readTranslucency_FP4_VX                ();
00122     void readSpecularGlossiness_FP4_VX          ();
00123     void readDiffuseSharpness_FP4_VX            ();
00124     void readBumpIntensity_FP4_VX               ();
00125     void readPolygonSidedness_U2                ();
00126     void readMaxSmoothingAngle_ANG4             ();
00127     void readReflectionOptions_U2               ();
00128     void readReflectionMapImage_VX              ();
00129     void readReflectionMapImageSeamAngle_ANG4_VX();
00130     void readRefractiveIndex_F4_VX              ();
00131     void readColorHighlights_FP4_VX             ();
00132     void readTransparencyOptions_U2             ();
00133     void readRefractionMapImage_VX              ();
00134     void readColorFilter_FP4_VX                 ();
00135     void readAdditiveTransparency_FP4_VX        ();
00136     void readGlowEffect_U2_F4_VX_F4_VX          ();
00137     void readRenderOutlines_U2_F4_VX_COL12_VX   ();
00138     void readAlphaMode_U2_FP4                   ();
00139     void readBlok                               ();
00140 
00141     void readComment_S0                         ();
00142 
00143 protected:
00144     LWFile               *f;
00145     LWLayer              *layer;
00146     Model                *model;
00147     LWModel              *root_model;
00148     ID4                   subchunk_id;
00149     U4                    subchunk_length;
00150     Color                 baseColor;
00151     long                  stateFlags;
00152     float                 luminosity_p;
00153     float                 diffuse_p;
00154     float                 specular_p;
00155     float                 reflection_p;
00156     float                 transparency_p;
00157     float                 translucency_p;  //  LWO2
00158     float                 specularGlossiness_p;
00159     long                  reflectionMode;
00160     unsigned char         reflectionMapImage[256];
00161     float                 reflectionMapImageSeamAngle;
00162     float                 refractiveIndex;
00163     float                 edgeTransparencyTreshold;
00164     float                 maxSmoothingAngle;
00165     long                  alphaMode;
00166     int_to_LWTexture      textures;
00167     int_to_LWSurfaceBlok  bloks;
00168     LWTexture            *current_texture;
00169     // shaderPlugin      
00170     // shaderData
00171     // sequenceOptions
00172     // flyerClipOptions
00173     // colorCycleOptions
00174 
00175     static char          *LW_ImageMapStrings[];
00176 };
00177 
00178 
00179 };  //  namespace Imports
00180 };  //  namespace Teddy
00181 
00182 
00183 #endif  //  TEDDY_INCLUDE_LW_SCENE
00184 #endif  //  TEDDY__IMPORTS__LW_SURFACE__H
00185 
00186 
00187