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

LWSurface.cpp

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.cpp,v 1.4 2002/01/11 14:34:59 tksuoran Exp $
00022 */
00023 
00024 
00025 #include "Teddy/TeddyConfig.h"
00026 #if defined( TEDDY_INCLUDE_LW_SCENE )
00027 
00028 
00029 #include "Teddy/Graphics/Color.h"
00030 #include "Teddy/Imports/LWFile.h"
00031 #include "Teddy/Imports/LWLayer.h"
00032 #include "Teddy/Imports/LWModel.h"
00033 #include "Teddy/Imports/LWSurface.h"
00034 #include "Teddy/Imports/LWSurfaceBlok.h"
00035 #include "Teddy/Imports/LWTexture.h"
00036 #include "Teddy/SysSupport/Messages.h"
00037 #include "Teddy/SysSupport/StdMaths.h"
00038 #include <cstring>
00039 using namespace Teddy::Graphics;
00040 using namespace Teddy::SysSupport;
00041 
00042 
00043 namespace Teddy   {
00044 namespace Imports {
00045 
00046 
00047 char *LWSurface::LW_ImageMapStrings[] = {
00048     "Planar Image Map",
00049     "Cylindrical Image Map",
00050     "Spherical Image Map",
00051     "Cubic Image Map",
00052 };
00053 
00054 /*
00055 #define LW_PLANAR_IMAGE_MAP      1
00056 #define LW_CYLINDRICAL_IMAGE_MAP 2
00057 #define LW_SPHERICAL_IMAGE_MAP   3
00058 #define LW_CUBIC_IMAGE_MAP       4
00059 */
00060 
00061 int LWSurface::getMapType( const char *s ){
00062     int type = 0;
00063 
00064     if( strcmp( s, "Planar Image Map"      ) == 0 ) type = LW_PLANAR_IMAGE_MAP;
00065     if( strcmp( s, "Cylindrical Image Map" ) == 0 ) type = LW_CYLINDRICAL_IMAGE_MAP;
00066     if( strcmp( s, "Spherical Image Map"   ) == 0 ) type = LW_SPHERICAL_IMAGE_MAP;
00067     if( strcmp( s, "Cubic Image Map"       ) == 0 ) type = LW_CUBIC_IMAGE_MAP;
00068 
00069     return type;
00070 }
00071 
00072 
00074 LWSurface::LWSurface( LWLayer *layer, Model *model, const std::string &name )
00075 :Material(
00076     name,
00077     RENDER_MODE_FILL/*_OUTLINE*/,
00078     RENDER_LIGHTING_SIMPLE,
00079 //  RENDER_LIGHTING_COLOR,
00080     RENDER_OPTION_CULL_FACE_M  |
00081     RENDER_OPTION_DEPTH_TEST_M |
00082     RENDER_OPTION_AMBIENT_M    |
00083     RENDER_OPTION_DIFFUSE_M    |
00084     RENDER_OPTION_SPECULAR_M   |
00085     RENDER_OPTION_EMISSION_M   |
00086     RENDER_OPTION_SHINYNESS_M 
00087 //  RENDER_OPTION_BORDER_M
00088 //  RENDER_OPTION_SMOOTH_M
00089 ){
00090     Color lwdef = Color( 200.0f/255.0f, 200.0f/255.0f, 200.0f/255.0f );
00091     setEmission( Color::BLACK   );
00092     setAmbient ( lwdef );
00093     setDiffuse ( lwdef );
00094     setSpecular( Color::GRAY_25 );
00095     setBorder  ( Color::WHITE   );
00096     this->f             = layer->getModel()->getFile();
00097     this->layer         = layer;
00098     this->model         = model;
00099     baseColor           = Color::WHITE;
00100     luminosity_p        = 0.00f; // emission
00101     diffuse_p           = 1.00f;
00102     specular_p          = 0.25f; 
00103     reflection_p        = 0;
00104     transparency_p      = 0;
00105     translucency_p      = 0;
00106     shininess           = shininess = pow( 2, (10.0f * 0.40f) + 2 );
00107     current_texture     = NULL;
00108     max_smoothing_angle = 0;
00109     //lwo_debug_msg( "Surface %s", name );
00110     dmsg( M_LWS, "Surface %s", name.c_str() );
00111 }
00112 
00113 
00115 /*virtual*/ LWSurface::~LWSurface(){
00116     //  FIX
00117 }
00118 
00119 
00120 LWLayer *LWSurface::getLayer(){
00121     return layer;
00122 }
00123 
00124 Model *LWSurface::getModel(){
00125     return model;
00126 }
00127 
00128 void LWSurface::setModel( Model *model ){
00129     this->model = model;
00130     /*dmsg( 
00131         M_LWS, 
00132         "Surface %s -> setModel( %s )", 
00133         model->getName().c_str(),
00134         name.c_str() 
00135     );*/
00136 }
00137 
00138 
00140 void LWSurface::processSubChunk(){
00141     if( f== (LWFile*)(0xfdfdfdfd) ){
00142         emsg( M_LWO, "ERROR" );
00143         return;
00144     }
00145     subchunk_id     = f->read_ID4();
00146     subchunk_length = f->read_U2 ();
00147 
00148     //did( subchunk_id );
00149     //cout << " subchunk of length " << subchunk_length << endl;
00150 
00151     f->pushDomain( subchunk_length );
00152 
00153     dmsg( M_LWO,
00154         "%s::SURF::%s (%d bytes)",
00155         did( f->getType() ),
00156         did( subchunk_id ),
00157         subchunk_length
00158     );
00159 
00160     switch( f->getType() ){
00161     case ID_LWOB:
00162         switch( subchunk_id ){
00163         case ID_COLR: readBaseColor_COL4                  (); break;
00164         case ID_FLAG: readStateFlags_U2                   (); break;
00165         case ID_LUMI: readLuminosity_IP2                  (); break;
00166         case ID_DIFF: readDiffuse_IP2                     (); break;
00167         case ID_SPEC: readSpecular_IP2_4                  (); break;
00168         case ID_REFL: readReflection_IP2_4                (); break;
00169         case ID_TRAN: readTransparency_IP2                (); break;
00170         case ID_VLUM: readLuminosity_FP4                  (); break;
00171         case ID_VDIF: readDiffuse_FP4                     (); break;
00172         case ID_VSPC: readSpecular_FP4                    (); break;
00173         case ID_VRFL: readReflection_FP4                  (); break;
00174         case ID_VTRN: readTransparency_FP4                (); break;
00175         case ID_GLOS: readSpecularGlossiness_I2_4         (); break;
00176         case ID_RFLT: readReflectionMode_U2               (); break;
00177         case ID_RIMG: readReflectionMapImage_FNAM0        (); break;
00178         case ID_RSAN: readReflectionMapImageSeamAngle_DEG4(); break;
00179         case ID_RIND: readRefractiveIndex_F4              (); break;
00180         case ID_EDGE: readEdgeTransparencyTreshold_F4     (); break;
00181         case ID_SMAN: readMaxSmoothingAngle_DEG4          (); break;
00182         case ID_ALPH: readAlphaMode_U2_U2                 (); break;
00183         case ID_SHDR: readShaderPlugin_S0                 (); break;
00184         case ID_SDAT: readShaderData_f                    (); break;
00185         case ID_IMSQ: readSequenceOptions_U2_U2_U2        (); break;
00186         case ID_FLYR: readFlyerClipOptions_U4_U4          (); break;
00187         case ID_IMCC: readColorCycleOptions_U2_U2_U2      (); break;
00188         case ID_CTEX: readColorTexture_S0                 (); break;
00189         case ID_DTEX: readDiffuseTexture_S0               (); break;
00190         case ID_STEX: readSpecularTexture_S0              (); break;
00191         case ID_RTEX: readReflectionTexture_S0            (); break;
00192         case ID_TTEX: readTransparencyTexture_S0          (); break;
00193         case ID_LTEX: readLuminosityTexture_S0            (); break;
00194         case ID_BTEX: readBumpTexture_S0                  (); break;
00195 
00196         //  Texture parameters are actually handled by current texture
00197 
00198         default:
00199             if( current_texture != NULL ){
00200                 switch( subchunk_id ){
00201                 case ID_TFLG: current_texture->readTextureFlags_U2          (); break;
00202                 case ID_TSIZ: current_texture->readTextureSize_VEC12        (); break;
00203                 case ID_TCTR: current_texture->readTextureCenter_VEC12      (); break;
00204                 case ID_TFAL: current_texture->readTextureFallOff_VEC12     (); break;
00205                 case ID_TVEL: current_texture->readTextureVelocity_VEC12    (); break;
00206                 case ID_TREF: current_texture->readTextureReferenceObject_S0(); break;
00207                 case ID_TCLR: current_texture->readTextureColor_COL4        (); break;
00208                 case ID_TVAL: current_texture->readTextureValue_IP2         (); break;
00209                 case ID_TAMP: current_texture->readBumpTextureAmplitude_FP4 (); break;
00210                 case ID_TFP : current_texture->readTextureAlgorithm_F4      (); break;  // ns not yet handled
00211                 case ID_TIP : current_texture->readTextureAlgorithm_I2      (); break;
00212                 case ID_TSP : current_texture->readTextureAlgorithm_F4      (); break;  // obsolete
00213                 case ID_TFRQ: current_texture->readTextureAlgorithm_I2      (); break;  // obsolete
00214                 case ID_TIMG: current_texture->readImageMap_FNAM0           (); break;
00215                 case ID_TALP: current_texture->readImageAlpha_FNAM0         (); break;
00216                 case ID_TWRP: current_texture->readImageWarpOptions_U2_U2   (); break;
00217                 case ID_TAAS: current_texture->readAntialiasingStrength_FP4 (); break;
00218                 case ID_TOPC: current_texture->readTextureOpacity_FP4       (); break;
00219                 default:
00220 //                  cout << "handler not implemented\n";
00221                     break;
00222                         }
00223             }else{
00224                 emsg( M_LWO, "There is no texture where to bind found texture subchunk\n" );
00225             }
00226             break;
00227         }
00228         break;
00229 
00230     case ID_LWO2:
00231         switch( subchunk_id ){
00232         case ID_COLR: readBaseColor_COL12_VX                 (); break;
00233         case ID_LUMI: readLuminosity_FP4_VX                  (); break;
00234         case ID_DIFF: readDiffuse_FP4_VX                     (); break;
00235         case ID_SPEC: readSpecular_FP4_VX                    (); break;
00236         case ID_REFL: readReflection_FP4_VX                  (); break;
00237         case ID_TRAN: readTransparency_FP4_VX                (); break;
00238         case ID_TRNL: readTranslucency_FP4_VX                (); break;
00239         case ID_GLOS: readSpecularGlossiness_FP4_VX          (); break;
00240         case ID_SHRP: readDiffuseSharpness_FP4_VX            (); break;
00241         case ID_BUMP: readBumpIntensity_FP4_VX               (); break;
00242         case ID_SIDE: readPolygonSidedness_U2                (); break;
00243         case ID_SMAN: readMaxSmoothingAngle_ANG4             (); break;
00244         case ID_RFOP: readReflectionOptions_U2               (); break;
00245         case ID_RIMG: readReflectionMapImage_VX              (); break;
00246         case ID_RSAN: readReflectionMapImageSeamAngle_ANG4_VX(); break;
00247         case ID_RIND: readRefractiveIndex_F4_VX              (); break;
00248         case ID_CLRH: readColorHighlights_FP4_VX             (); break;
00249         case ID_TROP: readTransparencyOptions_U2             (); break;
00250         case ID_TIMG: readRefractionMapImage_VX              (); break;
00251         case ID_CLRF: readColorFilter_FP4_VX                 (); break;
00252         case ID_ADTR: readAdditiveTransparency_FP4_VX        (); break;
00253         case ID_GLOW: readGlowEffect_U2_F4_VX_F4_VX          (); break;
00254         case ID_LINE: readRenderOutlines_U2_F4_VX_COL12_VX   (); break;
00255         case ID_ALPH: readAlphaMode_U2_FP4                   (); break;
00256         case ID_BLOK: readBlok                               (); break;
00257         case ID_CMNT: readComment_S0                         (); break;
00258 
00259         //  Texture parameters are actually handled by current texture
00260 
00261         default:
00262             if( current_texture != NULL ){
00263                 switch( subchunk_id ){
00264                 case ID_TFLG: current_texture->readTextureFlags_U2          (); break;
00265                 case ID_TSIZ: current_texture->readTextureSize_VEC12        (); break;
00266                 case ID_TCTR: current_texture->readTextureCenter_VEC12      (); break;
00267                 case ID_TFAL: current_texture->readTextureFallOff_VEC12     (); break;
00268                 case ID_TVEL: current_texture->readTextureVelocity_VEC12    (); break;
00269                 case ID_TREF: current_texture->readTextureReferenceObject_S0(); break;
00270                 case ID_TCLR: current_texture->readTextureColor_COL4        (); break;
00271                 case ID_TVAL: current_texture->readTextureValue_IP2         (); break;
00272                 case ID_TAMP: current_texture->readBumpTextureAmplitude_FP4 (); break;
00273                 case ID_TFP : current_texture->readTextureAlgorithm_F4      (); break;  // ns not yet handled
00274                 case ID_TIP : current_texture->readTextureAlgorithm_I2      (); break;
00275                 case ID_TSP : current_texture->readTextureAlgorithm_F4      (); break;  // obsolete
00276                 case ID_TFRQ: current_texture->readTextureAlgorithm_I2      (); break;  // obsolete
00277                 case ID_TIMG: current_texture->readImageMap_FNAM0           (); break;
00278                 case ID_TALP: current_texture->readImageAlpha_FNAM0         (); break;
00279                 case ID_TWRP: current_texture->readImageWarpOptions_U2_U2   (); break;
00280                 case ID_TAAS: current_texture->readAntialiasingStrength_FP4 (); break;
00281                 case ID_TOPC: current_texture->readTextureOpacity_FP4       (); break;
00282                 default:
00283                     dmsg( M_LWO, "Handler not implemented" );
00284                     break;
00285                 }
00286 
00287             }else{
00288                 dmsg( M_LWO, "There is no texture where to bind found texture subchunk" );
00289             }
00290             break;
00291         }
00292         break;
00293 
00294     default:
00295         dmsg( M_LWO, "handler not implemented" );
00296         break;
00297     }
00298 
00299     f->popDomain( true );
00300 }
00301 
00302 
00303 void LWSurface::endSurface(){
00304     endTexture();
00305 }
00306 
00307 void LWSurface::endTexture(){
00308     if( current_texture != NULL ){
00309         current_texture->applyTexture();
00310     }
00311     current_texture = NULL;
00312 }
00313 
00314 
00315 void LWSurface::setTexture( Texture *t, bool enable ){
00316     Material::setTexture( t, enable );
00317     if( t->isGood() ){
00318         useTextureColormap();
00319     }
00320 }
00321 
00322 
00323 
00324 void LWSurface::useTextureColormap(){
00325     baseColor = Color::WHITE;
00326     emission  = baseColor * luminosity_p;
00327     ambient   = baseColor * diffuse_p;
00328     diffuse   = baseColor * diffuse_p;
00329     specular  = Color::WHITE * specular_p;
00330 }
00331 
00332 
00341 void LWSurface::readBaseColor_COL4(){
00342     U1 red   = f->read_U1();
00343     U1 green = f->read_U1();
00344     U1 blue  = f->read_U1();
00345     (void)f->read_U1();
00346 
00347     baseColor = Color( red/255., green/255., blue/255. );
00348     emission  = baseColor * luminosity_p;
00349     ambient   = baseColor * diffuse_p;
00350     diffuse   = baseColor * diffuse_p;
00351     specular  = Color::WHITE * specular_p;
00352 }
00353 
00354 
00371 void LWSurface::readStateFlags_U2(){
00372     int count = 0;
00373     U2  flags = f->read_U2();
00374 }
00375 
00376 
00378 void LWSurface::readLuminosity_IP2(){
00379     luminosity_p = f->read_U2() / 255.0;
00380     emission  = baseColor * luminosity_p;
00381     ambient   = baseColor * diffuse_p;
00382     diffuse   = baseColor * diffuse_p;
00383     specular  = Color::WHITE * specular_p;
00384     dmsg( M_LWS, "LWSurface::readLuminosity_IP2()" );
00385     dmsg( M_LWS, "Object material luminosity %f", luminosity_p );
00386 }
00387 
00388 
00390 void LWSurface::readLuminosity_FP4(){
00391     luminosity_p = f->read_FP4();
00392     emission  = baseColor * luminosity_p;
00393     ambient   = baseColor * diffuse_p;
00394     diffuse   = baseColor * diffuse_p;
00395     specular  = Color::WHITE * specular_p;
00396     dmsg( M_LWS, "LWSurface::readLuminosity_FP4()" );
00397     dmsg( M_LWS, "Object material luminosity %f", luminosity_p );
00398 }
00399 
00400 
00402 void LWSurface::readDiffuse_IP2(){
00403     diffuse_p = f->read_U2() / 255.0;
00404     emission  = baseColor * luminosity_p;
00405     ambient   = baseColor * diffuse_p;
00406     diffuse   = baseColor * diffuse_p;
00407     specular  = Color::WHITE * specular_p;
00408 }
00409 
00410 
00412 void LWSurface::readDiffuse_FP4(){
00413     diffuse_p = f->read_FP4();
00414     emission  = baseColor * luminosity_p;
00415     ambient   = baseColor * diffuse_p;
00416     diffuse   = baseColor * diffuse_p;
00417     specular  = Color::WHITE * specular_p;
00418 }
00419 
00420 
00422 void LWSurface::readSpecular_IP2_4(){
00423     specular_p = f->read_U2() / 255.0;
00424     emission  = baseColor * luminosity_p;
00425     ambient   = baseColor * diffuse_p;
00426     diffuse   = baseColor * diffuse_p;
00427     specular  = Color::WHITE * specular_p;
00428 }
00429 
00430 
00432 void LWSurface::readSpecular_FP4(){
00433     specular_p = f->read_FP4();
00434     emission  = baseColor * luminosity_p;
00435     ambient   = baseColor * diffuse_p;
00436     diffuse   = baseColor * diffuse_p;
00437     specular  = Color::WHITE * specular_p;
00438 }
00439 
00440 
00442 void LWSurface::readSpecularGlossiness_I2_4(){
00443     U4 dl = f->domainLeft();
00444     if( dl != 2 ){
00445         emsg( M_LWO, "Domain left %ld bytes, expecting 2", dl );
00446     }
00447 
00448     I2 int_shi = f->read_I2();
00449     shininess = pow( 2, (10.0f * int_shi) + 2 );
00450 //      cout << "Shininess " << shininess << endl;
00451     if( shininess < 0 ){
00452         dmsg( M_LWO,
00453             "Negative specular glossiness % 4.1f is invalid, replacing with zero.",
00454             shininess
00455         );
00456         shininess = 0;
00457     }
00458     if( shininess > 128 ){
00459         shininess = 128;
00460     }
00461     //lwo_debug_msg( "Glossiness %4.1f", shininess );
00462 }
00463 
00464 
00465 void LWSurface::readReflection_IP2_4(){}
00466 void LWSurface::readTransparency_IP2(){}
00467 void LWSurface::readReflection_FP4(){}
00468 void LWSurface::readTransparency_FP4(){}
00469 void LWSurface::readReflectionMode_U2(){}
00470 void LWSurface::readReflectionMapImage_FNAM0(){}
00471 void LWSurface::readReflectionMapImageSeamAngle_DEG4(){}
00472 void LWSurface::readRefractiveIndex_F4(){}
00473 void LWSurface::readEdgeTransparencyTreshold_F4(){}
00474 
00475 
00476 void LWSurface::readMaxSmoothingAngle_DEG4(){
00477     max_smoothing_angle = f->read_ANG4();
00478 }
00479 
00480 
00481 void LWSurface::readAlphaMode_U2_U2(){}
00482 void LWSurface::readShaderPlugin_S0(){}
00483 void LWSurface::readShaderData_f(){}
00484 void LWSurface::readSequenceOptions_U2_U2_U2(){}
00485 void LWSurface::readFlyerClipOptions_U4_U4(){}
00486 void LWSurface::readColorCycleOptions_U2_U2_U2(){}
00487 
00488 
00504 void LWSurface::readColorTexture_S0(){
00505     S0 color_texture = f->read_S0();
00506     endTexture();
00507     current_texture = new LWTexture( this, getMapType(color_texture.c_str()) );
00508 }
00509 
00510 
00511 void LWSurface::readDiffuseTexture_S0(){
00512     S0 diffuse_texture = f->read_S0();
00513     //current_texture = new LWTexture( this, getMapType(diffuse_texture) );
00514 }
00515 
00516 
00517 void LWSurface::readSpecularTexture_S0(){
00518     S0 specular_texture = f->read_S0();
00519     //current_texture = new LWTexture( this, getMapType(specular_texture) );
00520 }
00521 
00522 
00523 void LWSurface::readReflectionTexture_S0(){
00524     S0 reflection_texture = f->read_S0();
00525     //current_texture = new LWTexture( this, getMapType(reflection_texture) );
00526 }
00527 
00528 
00529 void LWSurface::readTransparencyTexture_S0(){
00530     S0 transparency_texture = f->read_S0();
00531     //current_texture = new LWTexture( this, getMapType(transparency_texture) );
00532 }
00533 
00534 
00535 void LWSurface::readLuminosityTexture_S0(){
00536     S0 luminosity_texture = f->read_S0();
00537     //current_texture = new LWTexture( this, getMapType(luminosity_texture) );
00538 }
00539 
00540 
00541 void LWSurface::readBumpTexture_S0(){
00542     S0 bump_texture = f->read_S0();
00543     //current_texture = new LWTexture( this, getMapType(bump_texture) );
00544 }
00545 
00546 
00547 //  LWO2
00548 
00549 
00550 void LWSurface::readComment_S0(){
00551     std::string comment = f->read_S0();
00552     if( strstr(comment.c_str(),"polygon_offset") != NULL ){
00553         setPolygonOffset( 1 );
00554 //      printf( "Polygon offset enabled\n" );
00555     }
00556 }
00557 
00566 void LWSurface::readBaseColor_COL12_VX(){
00567     baseColor   = f->read_COL12();
00568     VX envelope = f->read_VX();     //  FIX envelope
00569 
00570     emission  = baseColor * luminosity_p;
00571     ambient   = baseColor * diffuse_p;
00572     diffuse   = baseColor * diffuse_p;
00573     specular  = Color::WHITE * specular_p;
00574 }
00575 
00576 
00587 void LWSurface::readLuminosity_FP4_VX(){
00588     luminosity_p = f->read_FP4();
00589     VX envelope  = f->read_VX();     //  FIX envelope
00590 
00591     emission  = baseColor * luminosity_p;
00592     ambient   = baseColor * diffuse_p;
00593     diffuse   = baseColor * diffuse_p;
00594     specular  = Color::WHITE * specular_p;
00595 }
00596 
00597 
00598 void LWSurface::readDiffuse_FP4_VX(){
00599     diffuse_p   = f->read_FP4();
00600     VX envelope = f->read_VX();     //  FIX envelope
00601 
00602     emission  = baseColor * luminosity_p;
00603     ambient   = baseColor * diffuse_p;
00604     diffuse   = baseColor * diffuse_p;
00605     specular  = Color::WHITE * specular_p;
00606 }
00607 
00608 
00609 void LWSurface::readSpecular_FP4_VX(){
00610     specular_p  = f->read_FP4();
00611     VX envelope = f->read_VX();     //  FIX envelope
00612 
00613     emission  = baseColor * luminosity_p;
00614     ambient   = baseColor * diffuse_p;
00615     diffuse   = baseColor * diffuse_p;
00616     specular  = Color::WHITE * specular_p;
00617 }
00618 
00619 
00620 void LWSurface::readReflection_FP4_VX(){
00621     reflection_p = f->read_FP4();
00622     VX envelope  = f->read_VX();     //  FIX envelope
00623 
00624     //  FIX no reflections yet? reflection = baseColor * reflection_p;
00625 }
00626 
00627 
00628 void LWSurface::readTransparency_FP4_VX(){
00629     transparency_p = f->read_FP4();
00630     VX envelope    = f->read_VX();     //  FIX envelope
00631 
00632     //  FIX no transparency yet
00633 }
00634 
00635 
00636 void LWSurface::readTranslucency_FP4_VX(){
00637     translucency_p = f->read_FP4();
00638     VX envelope    = f->read_VX();     //  FIX envelope
00639 
00640     //  FIX no translucency yet
00641 }
00642 
00643 
00662 void LWSurface::readSpecularGlossiness_FP4_VX(){
00663     float shi = f->read_FP4();
00664     shininess = pow( 2, (10.0f * shi) + 2 );
00665     if( shininess < 0 ){
00666         dmsg( M_LWO, "Negative specular glossiness %f is invalid, replacing with zero", shi );
00667         shininess = 0;
00668     }
00669     if( shininess > 128 ){
00670         shininess = 128;
00671     }
00672     VX envelope = f->read_VX();  //  FIX envelope
00673     //lwo_debug_msg( "Glossiness %4.1f", shininess );
00674 }
00675 
00676 
00695 void LWSurface::readDiffuseSharpness_FP4_VX(){
00696     FP4  sharpness = f->read_FP4();
00697     VX   envelope  = f->read_VX();   //  FIX envelope
00698     //  FIX Is this possible to be done with OpenGL?
00699 }
00700 
00701 
00711 void LWSurface::readBumpIntensity_FP4_VX(){
00712     FP4  streangth = f->read_FP4();
00713     VX   envelope  = f->read_VX();   //  FIX envelope
00714     //  FIX Neither am I :)
00715 }
00716 
00717 
00727 void LWSurface::readPolygonSidedness_U2(){
00728     U2 side = f->read_U2();
00729     switch( side ){
00730     case 1:
00731     case 2:
00732     case 3:
00733     default:
00734         break;
00735     }
00736 }
00737 
00738 
00750 void LWSurface::readMaxSmoothingAngle_ANG4(){
00751     max_smoothing_angle = f->read_ANG4();
00752 }
00753 
00754 
00788 void LWSurface::readReflectionOptions_U2(){
00789     U2 reflection_options = f->read_U2();
00790     //  FIX support for this
00791 }
00792 
00793 
00807 void LWSurface::readReflectionMapImage_VX(){
00808     VX reflection_map_image = f->read_VX();
00809     //  FIX support for this
00810 }
00811 
00812 
00820 void LWSurface::readReflectionMapImageSeamAngle_ANG4_VX(){
00821     ANG4  seam_angle = f->read_ANG4();
00822     VX    envelope   = f->read_VX();    //  FIX envelope
00823 }
00824 
00825 
00837 void LWSurface::readRefractiveIndex_F4_VX(){
00838     F4  refractive_index = f->read_F4();
00839     VX  envelope         = f->read_VX();  //  FIX envelope
00840     //  FIX support for this.. ?
00841 }
00842 
00843 
00863 void LWSurface::readColorHighlights_FP4_VX(){
00864     FP4 color_highlights = f->read_FP4();
00865     VX  envelope         = f->read_VX();   //  FIX envelope
00866 }
00867 
00868 
00878 void LWSurface::readTransparencyOptions_U2(){
00879     //  FIX support for this
00880 }
00881 
00882 
00893 void LWSurface::readRefractionMapImage_VX(){
00894     //  FIX support for this
00895 }
00896 
00897 
00907 void LWSurface::readColorFilter_FP4_VX(){
00908     FP4 color_filter = f->read_FP4();
00909     VX  envelope     = f->read_VX();   //  FIX envelope
00910     //  FIX support for this
00911 }
00912 
00913 
00925 void LWSurface::readAdditiveTransparency_FP4_VX(){
00926     FP4 additive = f->read_FP4();
00927     VX  envelope = f->read_VX();   //  FIX envelope
00928     //  FIX support for this
00929 }
00930 
00931 
00942 void LWSurface::readGlowEffect_U2_F4_VX_F4_VX(){
00943     U2 type               = f->read_U2();
00944     F4 intensity          = f->read_F4();
00945     VX intensity_envelope = f->read_VX();     //  FIX envelope
00946     F4 size               = f->read_F4();
00947     VX size_envelope      = f->read_VX();     //  FIX envelope
00948     //  Unclear to me too
00949     //  FIX support for this
00950 }
00951 
00952 
00969 void LWSurface::readRenderOutlines_U2_F4_VX_COL12_VX(){
00970     U2    flags          = f->read_U2();
00971     if( f->domainLeft()<4 ) return;
00972     F4    size           = f->read_F4();
00973     if( f->domainLeft()<4 ) return;
00974     VX    size_envelope  = f->read_VX();     //  FIX envelope
00975     Color color          = f->read_COL12();
00976     VX    color_envelope = f->read_VX();     //  FIX envelope
00977 }
00978 
00979 
00998 void LWSurface::readAlphaMode_U2_FP4(){
00999     //  FIX support for this
01000 }
01001 
01002 
01029 void LWSurface::readBlok(){
01030     LWSurfaceBlok *blok = new LWSurfaceBlok( this );
01031     blok->processBlok();
01032 }
01033 
01034 
01035 };  //  namespace Imports
01036 };  //  namespace Teddy
01037 
01038 
01039 #endif  //  TEDDY_INCLUDE_LW_SCENE