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: LWSceneObjectDisplacement.cpp,v 1.1 2002/02/16 12:41:39 tksuoran Exp $ 00022 */ 00023 00024 00025 #include "Teddy/TeddyConfig.h" 00026 #if defined( TEDDY_INCLUDE_LW_SCENE ) 00027 00028 00029 #include "Teddy/Imports/LWSceneFile.h" 00030 #include "Teddy/Imports/LWSceneParser.h" 00031 00032 00033 namespace Teddy { 00034 namespace Imports { 00035 00036 00037 /* 00038 DisplacementMap <mapping type> ¦ Clip Map <mapping type> 00039 00040 DisplacementMap <projection type> ¦ <procedural texture> 00041 00042 The DisplacementMap function is the first line of a 00043 Displacement Map segment. It provides the mapping type 00044 and selection. 00045 00046 - Image Mapping 00047 00048 example: DisplacementMap cylindrical image map 00049 00050 If image mapping is used, the argument of the projection 00051 type is provided. This mapping type produces additional 00052 listings for the TextureImage and the TextureAxis functions. 00053 00054 <projection type>: 00055 Planar Image Map 00056 Cylindrical Image Map 00057 Spherical Image Map 00058 00059 - Procedural Texture Mapping 00060 00061 example: DisplacementMap Ripples 00062 00063 If procedural texture mapping is used, the argument of 00064 a texture name is provided. This mapping type produces 00065 the additional listings given with each procedural below: 00066 00067 <procedural type>: 00068 00069 Ripples: 00070 TextureInt0 <int> - Wave Sources 00071 TextureFloat0 <float> - Wavelength 00072 TextureFloat1 <float> - Wave Speed 00073 00074 Fractal Bumps: 00075 TextureInt0 <int> - Frequencies 00076 00077 - ClipMap <projection type> ¦ <procedural texture> 00078 00079 The ClipMap function is the first line of a Clip 00080 Map segment. It provides the mapping type and selection. 00081 00082 - Image Mapping 00083 00084 If image mapping is used, the argument of the projection 00085 type is provided. This mapping type produces an additional 00086 listing for the TextureImage and TextureAxis functions. 00087 00088 example: ClipMap Planar Image Map 00089 00090 <projection type>: 00091 Planar Image Map 00092 Cylindrical Image Map 00093 Spherical Image Map 00094 Cubic Image Map 00095 Front Projection Map 00096 00097 00098 - Procedural Texture Mapping 00099 00100 example: ClipMap Underwater 00101 00102 If procedural texture mapping is used, the argument of a 00103 texture name is provided. This mapping type produces the 00104 additional listings given with each procedural below: 00105 00106 <procedural texture>: 00107 Checkerboard: no additional listings. 00108 Grid: TextureFloat0 <float> - Line Thickness 00109 Dots: TextureFloat0 <float> - Dot Diameter 00110 TextureFloat1 <float> - Fuzzy Edge Width 00111 Marble: TextureInt0 <int> - Frequencies 00112 TextureFloat0 <float> - Turbulence 00113 TextureFloat1 <float> - Vein Spacing 00114 TextureFloat2 <float> - Vein Sharpness 00115 Wood: TextureInt0 <int> - Frequencies 00116 TextureFloat0 <float> - Turbulence 00117 TextureFloat1 <float> - Ring Spacing 00118 TextureFloat2 <float> - Ring Sharpness 00119 Underwater: TextureInt0 <int> - Wave Sources 00120 TextureFloat0 <float> - Wavelength 00121 TextureFloat1 <float> - Wave Speed 00122 TextureFloat2 <float> - Band Sharpness 00123 Fractal Noise:TextureInt0 <int> - Frequencies 00124 TextureFloat0 <float> - Contrast 00125 Bump Array: TextureFloat0 <float> - Radius 00126 TextureFloat1 <float> - Spacing 00127 TextureFloat2 <float> - Bump Strength 00128 Crust: TextureFloat0 <float> - Coverage 00129 TextureFloat1 <float> - Ledge Level 00130 TextureFloat2 <float> - Ledge Width 00131 TextureFloat3 <float> - Bump Strength 00132 Veins: TextureFloat0 <float> - Coverage 00133 TextureFloat1 <float> - Ledge Level 00134 TextureFloat2 <float> - Ledge Width 00135 TextureFloat3 <float> - Bump Strength 00136 */ 00137 00138 00139 /* 00140 DisplacementMap: (See Displacement Map Section 3.4) 00141 00142 The DisplacementMap function deforms the geometry of an object 00143 using either image maps or procedural textures. 00144 00145 This function is described in detail in the DisplacementMap/ClipMap 00146 Section 3.4. 00147 00148 User Interface: The DisplacementMap controls are located on the Objects Panel. 00149 */ 00150 void LWSceneParser::DisplacementMap(){} 00151 00152 00153 /* 00154 ClipMap: (See Clip Map Section 3.4) 00155 00156 The ClipMap function "clips" or removes parts of an object's 00157 geometry using either image maps or procedural textures. 00158 00159 This function is described in detail in the ClipMap Section 3.4. 00160 00161 User Interface: The ClipMap controls are located on the Objects Panel. 00162 */ 00163 void LWSceneParser::ClipMap(){} 00164 00165 00166 /* 00167 TextureImage <path + filename> [ (sequence) ] 00168 00169 example: TextureImage Images\LWLogo.tga 00170 00171 The TextureImage function provides the path and 00172 filename for the image to be loaded. The path is 00173 generated by checking the current content directory 00174 for the listed filename. 00175 00176 In this example if the current content directory 00177 is <c:\NewTek>, LightWave would attempt to load 00178 the file <c:\NewTek\Images\LWLogo.tga>. 00179 00180 It is possible to use image sequences as texture 00181 images. If an image sequence is chosen, a sequence 00182 identifier is appended to the image path and filename. 00183 An image sequence also produces an additional 00184 ImageSequenceInfo listing. (See Image Sequences Section 1.5) 00185 */ 00186 void LWSceneParser::TextureImage(){} 00187 00188 00189 /* 00190 TextureFlags <bit-field value> 00191 00192 example: TextureFlags 12 00193 00194 The TextureFlags function provides additional texture settings. 00195 00196 The bit-field value is produced by calculating the 00197 decimal value of a 4 position bit-field whose bits 00198 represent logical on/off switches that are number 00199 left to right from 0 - 3. The least-significant bit 00200 for this field is the rightmost bit. Each channel 00201 has a corresponding bit in the bit-field. When a 00202 texture setting is chosen, its bit (or switch) 00203 is turned on. 00204 00205 <bit positions>: 00206 0 - World Coordinates 00207 1 - Negative Image 00208 2 - Pixel Blending 00209 3 - Antialiasing 00210 */ 00211 void LWSceneParser::TextureFlags(){ 00212 int texture_flags = file->read_int(); 00213 } 00214 00215 00216 void LWSceneParser::TextureAxis(){ 00217 int texture_axis = file->read_int(); 00218 } 00219 00220 00221 /* 00222 TextureSize <X size> <Y size> <Z size> 00223 00224 example: TextureSize 1.5 2 5.25 00225 00226 The TextureSize function provides the x, y and z 00227 dimensions of the image map or the procedural texture. 00228 00229 The arguments are given in meters. 00230 */ 00231 void LWSceneParser::TextureSize(){ 00232 double texture_x_size = file->read_double(); 00233 double texture_y_size = file->read_double(); 00234 double texture_z_size = file->read_double(); 00235 } 00236 00237 00238 /* 00239 TextureCenter <X position> <Y position> <Z position> 00240 00241 example: TextureCenter 5 5 10 00242 00243 The TextureCenter function provides the X, Y, and Z 00244 positions of the center of the image map or the procedural 00245 texture. 00246 00247 The argument are given in meters from the origin (0,0,0) 00248 */ 00249 void LWSceneParser::TextureCenter(){ 00250 double texture_x_center = file->read_double(); 00251 double texture_y_center = file->read_double(); 00252 double texture_z_center = file->read_double(); 00253 } 00254 00255 00256 /* 00257 TextureFalloff <X percentage> <Y percentage> <Z percentage> 00258 00259 example: TextureFalloff 25 10.5 25 00260 00261 This function provides the percentage of falloff per 00262 meter in the X, Y and Z directions. 00263 00264 The arguments are given in percentage per unit measure 00265 (meter). 00266 */ 00267 void LWSceneParser::TextureFalloff(){ 00268 double texture_x_falloff = file->read_double(); 00269 double texture_y_falloff = file->read_double(); 00270 double texture_z_falloff = file->read_double(); 00271 } 00272 00273 00274 /* 00275 TextureVelocity <X velocity> <Y velocity> <Z velocity> 00276 00277 example: TextureVelocity 2.5 0 0 00278 00279 The TextureVelocity function provides the velocity 00280 of image map or procedural texture. The value given 00281 is the value in units per frame. The example would 00282 move the center of the texture 2.5 meters per frame 00283 in the positive x direction. 00284 */ 00285 void LWSceneParser::TextureVelocity(){ 00286 double texture_x_velocity = file->read_double(); 00287 double texture_y_velocity = file->read_double(); 00288 double texture_z_velocity = file->read_double(); 00289 } 00290 00291 00292 /* 00293 Texture Amplitude <float> / Texture Value <percentage> 00294 00295 - TextureAmplitude (Displacement map only) 00296 00297 example: TextureAmplitude .25 00298 00299 The TextureAmplitude function provides the amplitude 00300 (offset amount) for the displacement map. 00301 */ 00302 void LWSceneParser::TextureAmplitude(){ 00303 double texture_amplitude = file->read_double(); 00304 } 00305 00306 00307 /* 00308 - TextureValue (Clip map only) 00309 00310 example: TextureValue 0.500000 00311 00312 The TextureValue function provides a percentage value 00313 for the texture. 00314 */ 00315 void LWSceneParser::TextureValue(){ 00316 double texture_value = file->read_double(); 00317 } 00318 00319 00320 /* 00321 TextureInt(index) <int> (Multiple Instances Possible) 00322 00323 example: TextureInt0 3 00324 00325 The TextureInt function provides an integer value for 00326 a parameter of the texture selected in the DisplacementMap 00327 or ClipMap functions. This function may be called multiple 00328 times, each time the index is incremented and added to the 00329 function name. For instance, the third parameter that 00330 required an integer value would be TextureInt2. 00331 */ 00332 void LWSceneParser::TextureInt(){ 00333 file->skip(); 00334 //int texture_int = file->read_int(); 00335 } 00336 00337 00338 /* 00339 TextureFloat(index) <float> (Multiple Instances Possible) 00340 00341 example: TextureFloat2 0.250000 00342 00343 The TextureFloat function provides a floating point 00344 value for a parameter of a texture selected in the 00345 DisplacementMap or ClipMap functions. This function 00346 may be called multiple times, each time the index is 00347 incremented and added to the function name. For 00348 instance, the third parameter that required a floating 00349 point value would be TextureFloat2. 00350 */ 00351 void LWSceneParser::TextureFloat(){ 00352 file->skip(); 00353 //double texture_float 00354 } 00355 00356 00357 }; // namespace Imports 00358 }; // namespace Teddy 00359 00360 00361 #endif // TEDDY_INCLUDE_LW_SCENE 00362 00363 00364 /* 00365 The DisplacementMap function deforms the geometry of an 00366 object using either image maps or procedural textures. 00367 00368 The ClipMap function "clips" or removes parts of an 00369 object's geometry using either image maps or procedural 00370 textures. 00371 00372 Two types of mapping available to these functions. An image 00373 map or a built-in procedural texture can be used with these 00374 functions. 00375 00376 00377 DisplacementMap ¦ ClipMap * 00378 TextureImage * (Image Mapping only) 00379 TextureFlags * 00380 TextureAxis * (Image Mapping only) 00381 TextureSize * 00382 TextureCenter 00383 TextureFalloff 00384 TextureVelocity 00385 TextureAmplitude ¦ TextureValue 00386 TextureInt(index) (Multiple instances possible) 00387 TextureFloat(index) (Multiple instances possible) 00388 */ 00389