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: LWSceneObjectSkeleton.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/LWBone.h" 00030 #include "Teddy/Imports/LWSceneFile.h" 00031 #include "Teddy/Imports/LWSceneParser.h" 00032 00033 00034 namespace Teddy { 00035 namespace Imports { 00036 00037 00038 /* 00039 Metamorph <percentage> ¦ (envelope) 00040 00041 example: Metamorph 0.500000 00042 00043 The Metamorph function provides LightWave with the 00044 information needed to morph the current object into 00045 a target object that is provided in the MorphTarget 00046 function. 00047 00048 The value is the percentage of change between the 00049 current object and its target. The function's value 00050 can be changed over time with an envelope. If an 00051 envelope is chosen, the functions value is replaced 00052 with an envelope identifier. For more information on 00053 envelopes, see the Envelopes Section 1.4. 00054 00055 When the Metamorph function is selected, two additional 00056 function listings are necessary. These are listed below: 00057 */ 00058 void LWSceneParser::MorphAmount(){ 00059 double metamorph = file->read_double(); 00060 } 00061 00062 00063 /* 00064 Additional: MorphTarget <object instance> 00065 00066 example: MorphTarget 2 00067 00068 The MorphTarget function provides the morph target's 00069 object position in the object listing. 00070 */ 00071 void LWSceneParser::MorphTarget(){ 00072 int morph_target = file->read_int(); 00073 } 00074 00075 00076 /* 00077 Additional: MorphSurfaces <flag> 00078 00079 example: MorphSurfaces 1 00080 00081 The MorphSurfaces flag activates the morphing of 00082 the surface attributes. 00083 00084 <flag>: 00085 0 - Off 00086 1 - On 00087 00088 User Interface: 00089 00090 The Metamorph functions are set from the Objects Panel. 00091 */ 00092 void LWSceneParser::MorphSurfaces(){ 00093 int morph_surfaces = file->read_int(); 00094 } 00095 00096 00097 void LWSceneParser::UseBonesFrom(){ 00098 int use_bones_from = file->read_int(); 00099 } 00100 00101 00102 void LWSceneParser::BoneFalloffType(){ 00103 int bone_falloff_type = file->read_int(); 00104 } 00105 00106 00107 /* 00108 AddBone 00109 00110 example: AddBone 00111 00112 The AddBone function is the first function called in 00113 an object skeleton. It is called for each instance of 00114 a bone loading. This function will add a bone to the 00115 current object and produce a series of function listings 00116 for this bone. 00117 */ 00118 void LWSceneParser::AddBone(){ 00119 current_object = current_bone = new LWBone(); 00120 } 00121 00122 00123 /* 00124 BoneName Bone ¦ <string> 00125 00126 example: BoneName FootBone 00127 00128 The BoneName function provides a name for the bone 00129 created with the AddBone function. If the user renames 00130 the bone using the Rename Bone function from the Object 00131 Skeleton control panel the string is listed following 00132 the function name. If the user does not rename the bone, 00133 it is given the default name of Bone. If multiple bones 00134 instances have the same name, duplicate bones are given 00135 a numbered suffix to the name during the loading/creation 00136 process. This number is enclosed in parenthesis and 00137 follows the bone name. 00138 00139 An example: FootBone (2) is the second instance of a 00140 bone with the name FootBone. The suffix is not saved in 00141 the scene file, and is used only as a user reference. 00142 */ 00143 void LWSceneParser::BoneName(){ 00144 char *bone_name = file->read_string(); 00145 } 00146 00147 00148 /* 00149 ShowBone <refresh value> <color value> 00150 00151 example: ShowBone 1 2 00152 00153 The ShowBone function determines how the bone is 00154 going to be displayed in Layout. The above example 00155 would display this (as opposed to hiding it) as 00156 a green bone. 00157 00158 Refresh value 00159 00160 This argument sets the bones display type in Layout. 00161 00162 <Refresh value>: 0 - No Refresh (Hide) 00163 1 - Refresh (Show) 00164 00165 User Interface: The refresh value is selected in the 00166 second column of the Scene Overview from the Scene Menu. 00167 00168 Color value 00169 00170 This argument sets the color of the bone when not 00171 selected in Layout. When selected, all items highlight 00172 to yellow. 00173 00174 <Color value>: 00175 1 - Blue 00176 2 - Green 00177 3 - Light Blue 00178 4 - Red 00179 5 - Purple 00180 6 - Orange 00181 7 - Gray 00182 00183 User Interface: 00184 00185 The color value is selected in the first column of the 00186 Scene Overview from the Scene Menu. 00187 */ 00188 void LWSceneParser::ShowBone(){ 00189 int refresh_value = file->read_int(); 00190 int color_value = file->read_int(); 00191 } 00192 00193 00194 /* 00195 BoneActive <flag> 00196 00197 example: BoneActive 1 00198 00199 The BoneActive flag activates the bone in layout and 00200 will allow it to begin deforming the object's geometry. 00201 This function produces a BoneActive listing with a value 00202 of 1 when turned on. When turned off, this function 00203 does not produce a listing in the scene file. 00204 00205 <flag>: 0 - Off (No function listing) 00206 1 - On 00207 00208 User Interface: 00209 00210 This function is set from the Object Skeleton control 00211 panel or by the keyboard shortcut of <r> for rest. 00212 00213 The BoneActive function is listed for all bones. 00214 */ 00215 void LWSceneParser::BoneActive(){ 00216 int bone_active = file->read_int(); 00217 } 00218 00219 00220 /* 00221 BoneRestPosition <x position> <y position> <z position> 00222 00223 example: BoneRestPosition 0.500000 0.200000 1.35000 00224 00225 The BoneRestPosition function provides the initial 00226 rest x, y, z position of the bone. In this position, 00227 the bone does not influence (distort) the object geometry. 00228 00229 User Interface: 00230 00231 The BoneRestPosition function is set from the 00232 Object Skeleton control panel or by the keyboard 00233 shortcut of <r> for rest. 00234 00235 The BoneRestPosition function is listed for all bones. 00236 */ 00237 void LWSceneParser::BoneRestPosition(){ 00238 double x = file->read_double(); 00239 double y = file->read_double(); 00240 double z = file->read_double(); 00241 } 00242 00243 00244 /* 00245 BoneRestDirection <Heading angle> <Pitch angle> <Bank angle> 00246 00247 example: BoneRestDirection 39.000000 7.900000 0.000000 00248 00249 The BoneRestDirection function provides the initial 00250 rest H, P, B rotations of the bone. In this position, 00251 the bone does not influence (distort) the object geometry. 00252 00253 User Interface: 00254 00255 The BoneRestDirection function is set from the Object 00256 Skeleton control panel or by the keyboard shortcut of <r> 00257 for rest. 00258 00259 The BoneRestDirection function is listed for all bones. 00260 */ 00261 void LWSceneParser::BoneRestDirection(){ 00262 double h = file->read_double(); 00263 double p = file->read_double(); 00264 double b = file->read_double(); 00265 } 00266 00267 00268 /* 00269 BoneRestLength <float> 00270 00271 example: BoneRestLength 1.078000 00272 00273 The BoneRestLength function provides the initial rest 00274 length of the bone. This is the "size" of the bone in Layout. 00275 00276 User Interface: 00277 00278 The BoneRestLength function is set from the Rest Length 00279 field on the Object Skeleton control panel or by the 00280 Rest Length mouse control in Layout. 00281 00282 The BoneRestLength function is listed for all bones. 00283 */ 00284 void LWSceneParser::BoneRestLength(){ 00285 double bone_rest_length = file->read_double(); 00286 } 00287 00288 00289 /* 00290 BoneStrength <float> 00291 00292 example: BoneStrength 2.500000 00293 00294 The BoneStrength function provides the strength of a bone 00295 that is separate from it's rest length. This functions 00296 value is used when the ScaleBoneStrength flag is turned 00297 off (0). When the ScaleBoneStrength function is turned on, 00298 the bone strength is equal to the BoneRestLength. 00299 00300 User Interface: 00301 00302 The BoneStrength functions value is set from the Strength 00303 field on the Object Skeleton control panel. 00304 00305 The BoneStrength function is listed for all bones. 00306 */ 00307 void LWSceneParser::BoneStrength(){ 00308 double bone_strength = file->read_double(); 00309 } 00310 00311 00312 /* 00313 ScaleBoneStrength <flag> 00314 00315 example: ScaleBoneStrength 1 00316 00317 The ScaleBoneStrength flag turns the ScaleBoneStrength 00318 function on. The listing is produced by the Scale Strength 00319 by Rest Length check box on the Object Skeleton control 00320 panel. This function allows the user to either lock the 00321 bone strength to the rest length of the bone, or to adjust 00322 them separately. This function produces a ScaleBoneStrength 00323 listing with a value of 1 when turned on. 00324 00325 <flag>: 00326 0 - Off (Default) 00327 1 - On (Scale Strength by Rest Length) 00328 00329 User Interface: 00330 00331 The ScaleBoneStrength function is set from the Scale 00332 Strength by Rest Length check box on the Object Skeleton 00333 control panel. 00334 00335 The ScaleBoneStrength flag is listed for all bones. 00336 */ 00337 void LWSceneParser::ScaleBoneStrength(){ 00338 int scale_bone_strength = file->read_int(); 00339 } 00340 void LWSceneParser::BoneLimitedRange(){ 00341 } 00342 void LWSceneParser::BoneMinRange(){} 00343 void LWSceneParser::BoneMaxRange(){} 00344 00345 /* 00346 BoneMotion (unnamed) 00347 00348 example: BoneMotion (unnamed) 00349 00350 The BoneMotion identifier denotes the beginning of the keyframe information 00351 for the current bone segment. It does not require any arguments to be passed 00352 to it. 00353 00354 The BoneMotion identifier is listed with all bones. 00355 */ 00356 void LWSceneParser::BoneMotion(){} 00357 00358 void LWSceneParser::HController(){ 00359 int h_controller = file->read_int(); 00360 } 00361 void LWSceneParser::PController(){ 00362 int p_controller = file->read_int(); 00363 } 00364 void LWSceneParser::BController(){ 00365 int b_controller = file->read_int(); 00366 } 00367 00368 00369 /* 00370 HLimits <min. angle> <max. angle> 00371 00372 example: HLimits -37.5 180 00373 00374 The HLimits function provides the minimum and maximum angles of heading 00375 rotation for the Inverse Kinematics function. 00376 00377 <min. angle>,<max. angle>: Range = -360 to 360 00378 00379 User Interface: The HLimits angles are set from the IK Options controls 00380 from Layout. 00381 */ 00382 void LWSceneParser::HLimits(){ 00383 double min = file->read_double(); 00384 double max = file->read_double(); 00385 } 00386 00387 00388 /* 00389 PLimits <min. angle> <max. angle> 00390 00391 example: PLimits -37.5 180 00392 00393 The PLimits function provides the minimum and maximum angles of the pitch 00394 rotation for the Inverse Kinematics function. 00395 00396 <min. angle>,<max. angle>: Range = -360 to 360 00397 00398 User Interface: The PLimits angles are set from the IK Options controls 00399 from Layout. 00400 */ 00401 void LWSceneParser::PLimits(){ 00402 double min = file->read_double(); 00403 double max = file->read_double(); 00404 } 00405 00406 00407 /* 00408 BLimits <min. angle> <max. angle> 00409 00410 example: BLimits -37.5 180 00411 00412 The BLimits function provides the minimum and maximum angles of the banking 00413 rotation for the Inverse Kinematics function. 00414 00415 <min. angle>,<max. angle>: Range = -360 to 360 00416 00417 User Interface: The BLimits angles are set from the IK Options controls 00418 from Layout. 00419 */ 00420 void LWSceneParser::BLimits(){ 00421 double min = file->read_double(); 00422 double max = file->read_double(); 00423 } 00424 00425 00426 /* 00427 IKAnchor <flag> 00428 00429 example: IKAnchor 1 00430 00431 The IKAnchor function sets the current bone as an anchor bone in an inverse 00432 kinematics chain. The predecessors of this bone would not be affected by 00433 the goal of its children. 00434 00435 <flag>: 0 - Off (No function listing) 00436 1 - On (Function listing) 00437 00438 User Interface: The IKAnchor function is set from the IK options from Layout. 00439 */ 00440 void LWSceneParser::IKAnchor(){ 00441 int ik_anchor = file->read_int(); 00442 } 00443 00444 00445 }; // namespace Imports 00446 }; // namespace Teddy 00447 00448 00449 #endif // TEDDY_INCLUDE_LW_SCENE 00450 00451 00452 /* 00453 The Object Skeleton Section is a series of one or more bone descriptions 00454 that are listed within an object segment. 00455 00456 An object skeleton does not appear in all object segments. It is listed 00457 when at least one bone has been added to an object. 00458 00459 Multiple bones in an object segment are listed sequentially in the 00460 order in which they were created. 00461 00462 AddBone * 00463 BoneName * 00464 ShowBone * 00465 BoneActive * 00466 BoneRestPosition * 00467 BoneRestDirection * 00468 BoneRestLength * 00469 ScaleBoneStrength * 00470 BoneStrength * 00471 BoneLimitedRange 00472 BoneMinRange 00473 BoneMaxRange 00474 BoneMotion (identifier) * 00475 Number of Information Channels * 00476 Number of Keyframes * 00477 Keyframe Information * 00478 EndBehavior * 00479 LockedChannels 00480 HLimits 00481 PLimits 00482 BLimits 00483 ParentObject 00484 GoalObject 00485 IKAnchor 00486 */ 00487