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: LWSceneCamera.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/LWCamera.h" 00030 #include "Teddy/Imports/LWMotion.h" 00031 #include "Teddy/Imports/LWSceneFile.h" 00032 #include "Teddy/Imports/LWSceneParser.h" 00033 00034 00035 namespace Teddy { 00036 namespace Imports { 00037 00038 00039 00040 00041 00042 /* 00043 ParentObject <object instance> 00044 00045 example: ParentObject 4 00046 00047 This function provides LightWave with the camera's parent object in the 00048 hierarchical chain. The value is equal to the parent objects position 00049 in the loading/creation sequence. The example function would parent the 00050 camera to the fourth object instance in the scene file. When the 00051 ParentObject function is active, all keyframe information for the camera 00052 becomes an offset from the parents information. 00053 */ 00054 00055 /* 00056 00057 TargetObject <object instance> 00058 00059 example: TargetObject 3 00060 00061 This function provides LightWave with the camera's target object in the 00062 scene. The value is equal to the target object's position in the 00063 loading/creation sequence. The example function would target the 00064 camera at the third object instance in the scene file. 00065 */ 00066 00067 00068 void LWSceneParser::AddCamera(){ 00069 current_object = current_camera = new LWCamera(); 00070 cameras.insert( make_pair(next_camera,current_camera) ); 00071 next_camera++; 00072 } 00073 00074 void LWSceneParser::CameraName(){ 00075 char *camera_name = file->read_string(); 00076 } 00077 00078 00079 /* 00080 ShowCamera <Refresh value> <Color value> 00081 00082 example: ShowCamera 0 5 00083 00084 The ShowCamera function determines how the camera is going to be displayed 00085 in Layout. The above example would hide the camera until selected. If it 00086 were set to visible refresh, it would be purple when not selected. 00087 00088 00089 Refresh value 00090 00091 This argument sets the camera display type in Layout. 00092 00093 <Refresh value>: 0 - No Refresh (Hide) 00094 1 - Refresh (Show) 00095 00096 User: This value is selected in the second column of the Scene Overview from 00097 the Scene Menu. 00098 00099 00100 Color value 00101 00102 This argument sets the color of the camera wireframe in Layout. When the 00103 camera is selected, the wireframe highlights to yellow. 00104 00105 <Color value>: 1 - Blue 00106 2 - Green 00107 3 - Light Blue 00108 4 - Red 00109 5 - Purple 00110 6 - Orange 00111 7 - Gray 00112 00113 User: This value is selected in the first column of the Scene Overview from 00114 the Scene Menu. 00115 */ 00116 void LWSceneParser::ShowCamera(){ 00117 int refresh_value = file->read_int(); 00118 int color_value = file->read_int(); 00119 } 00120 00121 00122 void LWSceneParser::CameraMotion(){ 00123 current_motion = new LWMotion(); 00124 current_object->setMotion( current_motion ); 00125 } 00126 00127 00128 /* 00129 ZoomFactor <float> ¦ (envelope) 00130 00131 example: ZoomFactor 3.200000 00132 00133 The ZoomFactor function provides a floating point number that represents 00134 the zoom amount of the camera's lens. This function can be fluctuated over 00135 time with an envelope. If an envelope is chosen, the floating point value 00136 is replaced with an envelope identifier. 00137 */ 00138 void LWSceneParser::ZoomFactor(){ 00139 double zoom_factor = file->read_double(); 00140 } 00141 00142 00143 /* 00144 MotionBlur <bit-field value> 00145 00146 example: MotionBlur 7 00147 00148 The MotionBlur function determines the active motion blur functions for the 00149 rendering process. When particle blur or motion blur are selected, they 00150 produce an additional BlurLength listing. 00151 00152 The value is produced by calculating the decimal value of a 3 position 00153 bit-field whose bits represent logical on/off switches that are numbered 00154 left to right from 0 - 2. The field's least-significant bit is the 00155 rightmost bit. Each motion blur option has a corresponding bit in this 00156 bit-field. When an option is selected, it's bit (or switch) is turned on. 00157 00158 <bit position>: 0 - Particle Blur (Additional Listing) 00159 1 - Motion Blur (Additional Listing) 00160 2 - Dithered Motion Blur 00161 */ 00162 void LWSceneParser::MotionBlur(){ 00163 int motion_blur = file->read_int(); 00164 } 00165 00166 00167 /* 00168 Additional: BlurLength <percentage> ¦ (envelope) 00169 00170 example: BlurLength 0.500000 00171 00172 The BlurLength function provides the amount of blur to be applied 00173 during the rendering process. 00174 */ 00175 void LWSceneParser::BlurLength(){ 00176 double blur_length = file->read_double(); 00177 } 00178 00179 00180 /* 00181 DepthofField <flag> 00182 00183 example: DepthofField 1 00184 00185 The DepthofField flag activates the depth of field function for the 00186 rendering process. This function, when activated, produces additional 00187 FocalDistance and LensFStop listings. 00188 00189 <flag>: 0 - Off (Listing) 00190 1 - On (Listing plus additional Listings) 00191 */ 00192 void LWSceneParser::DepthofField(){ 00193 int depth_of_field = file->read_int(); 00194 } 00195 00196 00197 /* 00198 Additional: FocalDistance <Distance> ¦ (envelope) 00199 00200 example: FocalDistance 25.0000 00201 00202 The FocalDistance function provides the distance from the camera of 00203 it's focal point. This distance is given in meters. 00204 */ 00205 void LWSceneParser::FocalDistance(){ 00206 double focal_distance = file->read_double(); 00207 } 00208 00209 00210 /* 00211 Additional: LensFStop <float> ¦ (envelope) 00212 00213 example: LensFStop 4.000000 00214 00215 The LensFStop function determines the range of in-focus items from 00216 the focal point. The larger the F-stop, the larger the focal range. 00217 */ 00218 void LWSceneParser::LensFStop(){ 00219 double lens_f_stop = file->read_double(); 00220 } 00221 00222 00223 void LWSceneParser::ResolutionMultiplier(){ 00224 double resolution_multiplier = file->read_double(); 00225 } 00226 00227 void LWSceneParser::FrameSize(){ 00228 int frame_width = file->read_int(); 00229 int frmae_height = file->read_int(); 00230 } 00231 00232 00233 /* 00234 Resolution <value> 00235 00236 example: Resolution 1 00237 00238 The Resolution function determines the resolution of the rendering in 00239 the current scene. 00240 00241 <value>: -1 - Super Low Resolution 00242 0 - Low Resolution 00243 1 - Medium Resolution 00244 2 - High Resolution 00245 3 - Print Resolution 00246 */ 00247 void LWSceneParser::Resolution(){ 00248 int resolution = file->read_int(); 00249 } 00250 00251 00252 /* 00253 CustomSize <Horizontal resolution> <Vertical resolution> 00254 00255 example: Custom Size 1024 768 00256 00257 The CustomSize function provides the horizontal and vertical pixel 00258 resolutions for rendering. 00259 */ 00260 void LWSceneParser::CustomSize(){ 00261 int horizontal_resolution = file->read_int(); 00262 int vertical_resolution = file->read_int(); 00263 } 00264 00265 00266 /* 00267 FilmSize <value> 00268 00269 example: FilmSize 1 00270 00271 The FilmSize function determines what type of film LightWave is going to 00272 simulate during the rendering process. This adjusts the optical qualities 00273 in the cameras adjustment of zoom factor and depth of field. 00274 00275 <value>: 0 - Super 8 motion picture 00276 1 - 16mm motion picture 00277 2 - 35mm motion picture (Default) 00278 3 - 65mm Super Panavision motion picture 00279 4 - 65mm Imax motion picture 00280 5 - Size 110 (pocket camera) 00281 6 - Size 135 (35mm SLR) 00282 7 - Size 120 (60 x 45 mm rollfilm camera) 00283 8 - Size 120 (90 x 60 mm rollfilm camera) 00284 9 - 1/3 " CCD video camera 00285 10 - 1/2" CCD video camera 00286 */ 00287 void LWSceneParser::FilmSize(){ 00288 int film_size = file->read_int(); 00289 } 00290 00291 00292 /* 00293 NTSCWidescreen <flag> 00294 00295 example: NTSCWidescreen 1 00296 00297 The NTSCWidescreen flag activates a function that will compress the 00298 rendered image horizontally. When this image is displayed in the 00299 NTSC Widescreen format it will display in the proper aspect. 00300 */ 00301 void LWSceneParser::NTSCWidescreen(){ 00302 int ntsc_widescreen = file->read_int(); 00303 } 00304 00305 00306 void LWSceneParser::PixelAspect(){ 00307 double pixel_aspect = file->read_double(); 00308 } 00309 00310 00311 /* 00312 PixelAspectRatio <value> 00313 00314 example: PixelAspectRatio 0 00315 00316 The PixelAspectRatio function provides the aspect (shape) of the pixel 00317 in a rendered image. 00318 00319 <value>: -1 - Custom (Produces Additional CustomPixelRatio Listing) 00320 0 - D2 NTSC 00321 1 - D1 NTSC 00322 2 - Square Pixels 00323 3 - D2 PAL 00324 4 - D1 PAL 00325 00326 */ 00327 void LWSceneParser::PixelAspectRatio(){ 00328 int pixel_aspect_ratio = file->read_int(); 00329 } 00330 00331 00332 /* 00333 Additional: CustomPixelRatio <float> 00334 00335 example: CustomPixelRatio 1.000000 00336 00337 The CustomPixelRatio function provides a custom pixel aspect for 00338 rendering. The floating point value is the height to width ratio 00339 of the needed pixels. 00340 */ 00341 void LWSceneParser::CustomPixelRatio(){ 00342 double custom_pixel_ration = file->read_double(); 00343 } 00344 00345 00346 /* 00347 LimitedRegion <flag> 00348 00349 example: LimitedRegion 1 00350 00351 The LimitedRegion flag activates the limited region function to render a 00352 portion of the full camera view. This function, when activated, produces 00353 an additional RegionLimits listing. 00354 00355 <flag>: 0 - Off (No Listing) 00356 1 - On (Listing plus additional RegionLimits listing) 00357 */ 00358 void LWSceneParser::LimitedRegion(){ 00359 int limited_region = file->read_int(); 00360 } 00361 00362 00363 /* 00364 Additional: RegionLimits <Left %><Right %><Top %><Bottom %> 00365 00366 example: RegionLimits 0.50000 1.000000 0.500000 1.000000 00367 00368 The RegionLimits function provides the dimensions of the area to be 00369 rendered for the LimitedRegion function. The values given are a 00370 percentage of screen size. 00371 00372 <% limits>: Left - 0.000000 to 0.990000 00373 Right - 0.010000 to 1.000000 00374 Top - 0.000000 to 0.990000 00375 Bottom - 0.010000 to 1.000000 00376 */ 00377 void LWSceneParser::RegionLimits(){ 00378 double left = file->read_double(); 00379 double right = file->read_double(); 00380 double top = file->read_double(); 00381 double bottom = file->read_double(); 00382 } 00383 00384 void LWSceneParser::MaskPosition(){ 00385 int mask_x1 = file->read_int(); 00386 int mask_y1 = file->read_int(); 00387 int mask_x2 = file->read_int(); 00388 int mask_y2 = file->read_int(); 00389 } 00390 00391 00392 void LWSceneParser::ApertureHeight(){ 00393 double aperture_height = file->read_double(); 00394 } 00395 00396 00397 /* 00398 SegmentMemory <bytes> 00399 00400 example: SegmentMemory 88000000 00401 00402 The SegmentMemory determines the amount of memory to be allocated for the 00403 rendering process. If the amount of memory is too low, LightWave will 00404 divide the rendering process into separate segments. 00405 */ 00406 void LWSceneParser::SegmentMemory(){ 00407 int segment_memory = file->read_int(); 00408 } 00409 00410 00411 /* 00412 Antialiasing <value> 00413 00414 example: Antialiasing 2 00415 00416 The Antialiasing function determines the number of antialiasing (smoothing) 00417 passes that will be used for rendering. 00418 00419 <value>: 0 - Off 00420 1 - Low Antialiasing (5 passes) 00421 2 - Medium Antialiasing (9 passes) 00422 3 - High Antialiasing (17 passes) 00423 */ 00424 void LWSceneParser::Antialiasing(){ 00425 int antialiasing = file->read_int(); 00426 } 00427 00428 00429 void LWSceneParser::EnhancedAA(){ 00430 int enchaced_aa = file->read_int(); 00431 } 00432 00433 00434 /* 00435 FilterType<flag> 00436 00437 example: FilterType 1 00438 00439 The FilterType flag activates the Soft Filter effect for the rendering process. 00440 00441 <flag>: 0 - Off (No listing) 00442 1 - On (Listing) 00443 */ 00444 void LWSceneParser::FilterType(){ 00445 int filter_type = file->read_int(); 00446 } 00447 00448 00449 /* 00450 AdaptiveSampling <flag> 00451 00452 example: AdaptiveSampling 1 00453 00454 The AdaptiveSampling flat activates adaptive sampling for the rendering 00455 process. This function, when activated, produces an additional 00456 AdaptiveThreshold listing. 00457 00458 <flag>: 0 - Off (Listing) 00459 1 - On (Listing plus additional AdaptiveThreshold listing) 00460 */ 00461 void LWSceneParser::AdaptiveSampling(){ 00462 int adaptive_sampling = file->read_int(); 00463 } 00464 00465 00466 /* 00467 Additional: AdaptiveThreshold <int> 00468 00469 TIS: appears to use doubles in LWSC 3 00470 00471 example: AdaptiveThreshold 8 00472 00473 The AdaptiveThreshold function provides a value for the level of 00474 adaptive sampling during the rendering process. This value is a 00475 threshold, or cutoff level, for the antialiasing process. 00476 */ 00477 void LWSceneParser::AdaptiveThreshold(){ 00478 double adaptive_treshold = file->read_double(); 00479 } 00480 00481 00482 /* 00483 FieldRendering <flag> 00484 00485 example: FieldRendering 1 00486 00487 The FieldRendering flag activates the field rendering function during the 00488 rendering process. This function, when activated, produces an additional 00489 ReverseFields listing. 00490 00491 <flag>: 0 - Off (Listing) 00492 1 - On (Listing plus additional ReverseFields listing) 00493 */ 00494 void LWSceneParser::FieldRendering(){ 00495 int field_rendering = file->read_int(); 00496 } 00497 00498 00499 /* 00500 Additional: ReverseFields <flag> 00501 00502 example: ReverseFields 1 00503 00504 The ReverseFields flag activates the reverse fields function. 00505 This function shifts the order in which the fields are rendered. 00506 */ 00507 void LWSceneParser::ReverseFields(){ 00508 int reverse_field = file->read_int(); 00509 } 00510 00511 00512 }; // namespace Imports 00513 }; // namespace Teddy 00514 00515 00516 #endif // TEDDY_INCLUDE_LW_SCENE 00517 00518 00519 /* 00520 00521 The Camera Section contains all of the information that relates to the 00522 camera in a LightWave Scene. 00523 00524 There is only one (1) camera instance per scene file. 00525 00526 The Target and Parent functions use a value that is equal to the order 00527 in which the referenced object was loaded/created in the scene. i.e. The 00528 value given in the example: ParentObject 3 references the third object 00529 instance in the scene file. 00530 00531 00532 The following is a list of light functions that are listed in the order in 00533 which they appear in the scene file. 00534 00535 Functions denoted with an asterisk (*) are required for all light loading 00536 instances. 00537 Italicized entries denote function labels and not true function names. 00538 Indented entries denote an optional function of the preceding function. 00539 Optional functions will produce a listing only when activated by the user. 00540 00541 ShowCamera * 00542 CameraMotion (identifier) * 00543 Number of Information Channels * 00544 Number of Keyframes * 00545 Keyframe Information * 00546 EndBehavior * 00547 LockedChannels 00548 ParentObject 00549 TargetObject 00550 ZoomFactor * 00551 RenderMode * 00552 RayTraceEffects * 00553 Resolution * 00554 CustomSize 00555 NTSCWidescreen 00556 PixelAspectRatio 00557 CustomPixelRatio 00558 LimitedRegion 00559 RegionLimits 00560 SegmentMemory * 00561 Antialiasing * 00562 FilterType 00563 AdaptiveSampling * 00564 AdaptiveThreshold 00565 FilmSize * 00566 FieldRendering * 00567 ReverseFields 00568 MotionBlur * 00569 BlurLength 00570 DepthofField * 00571 FocalDistance 00572 LensFStop 00573 */ 00574 00575