00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "SceneComponent.h"
00018 #include "../../core/GameManager.h"
00019
00020
00021
00022
00023 SceneComponent::SceneComponent(Entity *parent)
00024 : EntityComponent(parent)
00025 {
00026
00027 init();
00028
00029
00030 ISceneManager *pScnMgr = GameManager::Instance()->getSceneManager();
00031
00032
00033 mTriSelector = pScnMgr->createTriangleSelectorFromBoundingBox(mSceneNode);
00034 mMetaSelector = pScnMgr->createMetaTriangleSelector();
00035
00036
00037 mCanAffectParent = false;
00038 mEvokedParentChange = false;
00039 mLastPos = getPosition();
00040 }
00041
00042
00043 SceneComponent::SceneComponent(Entity *parent, bool isDerived)
00044 : EntityComponent(parent)
00045 {
00046 init();
00047 }
00048
00049
00050 SceneComponent::~SceneComponent()
00051 {
00052 if(mSceneNode != NULL) mSceneNode->remove();
00053 if(mTriSelector != NULL) mTriSelector->drop();
00054 if(mMetaSelector != NULL) mMetaSelector->drop();
00055 }
00056
00057
00058 void SceneComponent::init()
00059 {
00060
00061 mName = "SceneComponent";
00062
00063
00064 pParent->connectEventSignal("onPositionChange", this, &SceneComponent::onPositionChange);
00065 pParent->connectEventSignal("onRotationChange", this, &SceneComponent::onRotationChange);
00066 pParent->connectEventSignal("onUpdate", this, &SceneComponent::onUpdate);
00067 pParent->connectEventSignal("onPause", this, &SceneComponent::onPause);
00068 pParent->connectEventSignal("onUnPause", this, &SceneComponent::onUnPause);
00069 }
00070
00071
00072 ISceneNode* SceneComponent::getSceneNode()
00073 {
00074 return mSceneNode;
00075 }
00076
00077
00078 IMetaTriangleSelector* SceneComponent::getMetaSelector() const
00079 {
00080 return mMetaSelector;
00081 }
00082
00083
00084 ITriangleSelector* SceneComponent::getTriangleSelector() const
00085 {
00086 return mTriSelector;
00087 }
00088
00089
00090 void SceneComponent::addAnimator(ISceneNodeAnimator *animator)
00091 {
00092 mSceneNode->addAnimator(animator);
00093 }
00094
00095
00096 void SceneComponent::addCollisionResponseAnimator(const vector3df &ellipsoidRadius,
00097 const vector3df &gravityPerSecond,
00098 const vector3df &ellipsoidTranslation,
00099 f32 slidingValue)
00100 {
00101 ISceneNodeAnimator *anim = GameManager::Instance()->getSceneManager()->
00102 createCollisionResponseAnimator(mMetaSelector, mSceneNode,
00103 ellipsoidRadius, gravityPerSecond, ellipsoidTranslation,
00104 slidingValue);
00105
00106 mSceneNode->addAnimator(anim);
00107 anim->drop();
00108 }
00109
00110
00111 void SceneComponent::addFlyCircleAnimator(const vector3df ¢er, f32 radius, f32 speed,
00112 const vector3df &direction)
00113 {
00114 ISceneNodeAnimator *anim = GameManager::Instance()->getSceneManager()->
00115 createFlyCircleAnimator(center, radius, speed, direction);
00116
00117 mSceneNode->addAnimator(anim);
00118 anim->drop();
00119 }
00120
00121
00122 void SceneComponent::addFlyStraightAnimator(const vector3df &startPoint, const vector3df &endPoint,
00123 u32 timeForWay, bool loop)
00124 {
00125 ISceneNodeAnimator *anim = GameManager::Instance()->getSceneManager()->
00126 createFlyStraightAnimator(startPoint, endPoint, timeForWay, loop);
00127
00128 mSceneNode->addAnimator(anim);
00129 anim->drop();
00130 }
00131
00132
00133
00134 void SceneComponent::addToMetaSelector(Entity *entity)
00135 {
00136 if(entity != NULL && mMetaSelector != NULL)
00137 {
00138 SceneComponent *component = static_cast<SceneComponent*>(entity->
00139 getComponent("SceneComponent"));
00140
00141 if(component != NULL)
00142 {
00143 ITriangleSelector *selector = component->getTriangleSelector();
00144
00145 if(selector != NULL)
00146 mMetaSelector->addTriangleSelector(selector);
00147 }
00148 }
00149 }
00150
00151
00152 void SceneComponent::addToMetaSelector(SceneComponent *component)
00153 {
00154 if(component != NULL && mMetaSelector != NULL)
00155 {
00156 ITriangleSelector *selector = component->getTriangleSelector();
00157
00158 if(selector != NULL)
00159 mMetaSelector->addTriangleSelector(selector);
00160 }
00161 }
00162
00163
00164 void SceneComponent::addToMetaSelector(ITriangleSelector *selector)
00165 {
00166 if(selector != NULL && mMetaSelector != NULL)
00167 mMetaSelector->addTriangleSelector(selector);
00168 }
00169
00170
00171 vector3df SceneComponent::getAbsolutePosition() const
00172 {
00173 return mSceneNode->getAbsolutePosition();
00174 }
00175
00176
00177 E_CULLING_TYPE SceneComponent::getAutomaticCulling() const
00178 {
00179 return mSceneNode->getAutomaticCulling();
00180 }
00181
00182
00183 const aabbox3df& SceneComponent::getBoundingBox() const
00184 {
00185 return mSceneNode->getBoundingBox();
00186 }
00187
00188
00189 u32 SceneComponent::getMaterialCount() const
00190 {
00191 return mSceneNode->getMaterialCount();
00192 }
00193
00194
00195 matrix4 SceneComponent::getRelativeTransformation() const
00196 {
00197 return mSceneNode->getRelativeTransformation();
00198 }
00199
00200
00201 const vector3df SceneComponent::getPosition() const
00202 {
00203 return mSceneNode->getAbsolutePosition() - pParent->getAbsolutePosition();
00204 }
00205
00206
00207 const vector3df& SceneComponent::getRotation() const
00208 {
00209 return mSceneNode->getRotation();
00210 }
00211
00212
00213 const vector3df& SceneComponent::getScale() const
00214 {
00215 return mSceneNode->getScale();
00216 }
00217
00218
00219 void SceneComponent::removeAnimators()
00220 {
00221 mSceneNode->removeAnimators();
00222 }
00223
00224
00225 void SceneComponent::setAbsolutePosition(const vector3df &position)
00226 {
00227 mSceneNode->setPosition(position);
00228 }
00229
00230
00231 void SceneComponent::setAutomaticCulling(E_CULLING_TYPE state)
00232 {
00233 mSceneNode->setAutomaticCulling(state);
00234 }
00235
00236
00237 void SceneComponent::setCanAffectParent(bool value)
00238 {
00239 mCanAffectParent = value;
00240 }
00241
00242
00243 void SceneComponent::setDebugDataVisible(s32 state)
00244 {
00245 mSceneNode->setDebugDataVisible(state);
00246 }
00247
00248
00249 void SceneComponent::setMaterialFlag(E_MATERIAL_FLAG flag, bool value)
00250 {
00251 mSceneNode->setMaterialFlag(flag, value);
00252 }
00253
00254
00255
00256 void SceneComponent::setMaterialTexture(u32 layer, const std::string &fileName)
00257 {
00258
00259 AssetGroup *assets = pParent->getAssetGroup();
00260 ITexture *texture = 0;
00261
00262
00263 if(assets != NULL)
00264 {
00265
00266 std::map<u32, std::string>::iterator it = mTextureFileNames.find(layer);
00267
00268 if(it != mTextureFileNames.end())
00269 assets->disconnectEventSignal(std::string("textures/") + it->second, this);
00270
00271
00272 TextureProcessor *processor = static_cast<TextureProcessor*>
00273 (assets->getAssetProcessor("textures"));
00274 texture = processor->getTexture(fileName);
00275
00276 if(texture)
00277 {
00278 assets->connectEventSignal(std::string("textures/") + fileName, this,
00279 &SceneComponent::onTexture);
00280 mTextureFileNames[layer] = fileName;
00281 }
00282 }
00283
00284 else
00285 texture = GameManager::Instance()->getDriver()->getTexture(fileName.c_str());
00286
00287
00288 mSceneNode->setMaterialTexture(layer, texture);
00289 }
00290
00291
00292 void SceneComponent::setMaterialTexture(u32 layer, ITexture *texture)
00293 {
00294
00295 AssetGroup *assets = pParent->getAssetGroup();
00296
00297 if(assets != NULL)
00298 {
00299 std::map<u32, std::string>::iterator it = mTextureFileNames.find(layer);
00300
00301 if(it != mTextureFileNames.end())
00302 {
00303 assets->disconnectEventSignal(std::string("textures/") + it->second, this);
00304 mTextureFileNames.erase(it);
00305 }
00306 }
00307
00308
00309 mSceneNode->setMaterialTexture(layer, texture);
00310 }
00311
00312
00313 void SceneComponent::setMaterialType(E_MATERIAL_TYPE type)
00314 {
00315 mSceneNode->setMaterialType(type);
00316 }
00317
00318
00319 void SceneComponent::setPosition(const vector3df &position)
00320 {
00321 mSceneNode->setPosition(pParent->getAbsolutePosition() + position);
00322 }
00323
00324
00325 void SceneComponent::setRotation(const vector3df &rotation)
00326 {
00327 mSceneNode->setRotation(pParent->getAbsoluteRotation() + rotation);
00328 }
00329
00330
00331 void SceneComponent::setScale(const vector3df &scale)
00332 {
00333 mSceneNode->setScale(scale);
00334 }
00335
00336
00337 void SceneComponent::setVisible(bool value)
00338 {
00339 mSceneNode->setVisible(value);
00340 }
00341
00342
00343
00344 void SceneComponent::onPositionChange(void *p)
00345 {
00346 if(!mEvokedParentChange)
00347 {
00348 vector3df diff = reinterpret_cast<vector3df*>(p)[0];
00349 mSceneNode->setPosition(mSceneNode->getPosition() + diff);
00350 }
00351 }
00352
00353
00354 void SceneComponent::onRotationChange(void *p)
00355 {
00356 if(!mEvokedParentChange)
00357 {
00358 vector3df diff = reinterpret_cast<vector3df*>(p)[0];
00359 mSceneNode->setRotation(mSceneNode->getRotation() + diff);
00360 }
00361 }
00362
00363
00364 void SceneComponent::onUpdate(void *p)
00365 {
00366 if(mCanAffectParent)
00367 {
00368
00369
00370 vector3df diff = mSceneNode->getPosition() - mLastPos;
00371 mLastPos = mSceneNode->getPosition();
00372
00373 if(diff != vector3df(0))
00374 {
00375 mEvokedParentChange = true;
00376 pParent->setAbsolutePosition(pParent->getAbsolutePosition() + diff);
00377 mEvokedParentChange = false;
00378 }
00379
00380
00381
00382 diff = mSceneNode->getRotation() - mLastRot;
00383 mLastRot = mSceneNode->getRotation();
00384
00385 if(diff != vector3df(0))
00386 {
00387 mEvokedParentChange = true;
00388 pParent->setAbsoluteRotation(pParent->getAbsoluteRotation() + diff);
00389 mEvokedParentChange = false;
00390 }
00391 }
00392 }
00393
00394
00395 void SceneComponent::onPause(void *p)
00396 {
00397 if(mSceneNode)
00398 {
00399 mWasVisible = mSceneNode->isVisible();
00400 mSceneNode->setVisible(false);
00401 }
00402 }
00403
00404
00405 void SceneComponent::onUnPause(void *p)
00406 {
00407 if(mSceneNode && mWasVisible)
00408 mSceneNode->setVisible(true);
00409 }
00410
00411
00412 void SceneComponent::onTexture(void *p)
00413 {
00414
00415 ITexture *texture = reinterpret_cast<ITexture*>(p);
00416
00417
00418 std::string fileName = (GameManager::Instance()->getDevice()->getFileSystem()->
00419 getFileBasename(texture->getName())).c_str();
00420
00421 u32 layer;
00422
00423 std::map<u32, std::string>::iterator it;
00424 for(it = mTextureFileNames.begin(); it != mTextureFileNames.end(); it++)
00425 {
00426 if(it->second == fileName)
00427 {
00428 layer = it->first;
00429 break;
00430 }
00431 }
00432
00433 if(it == mTextureFileNames.end())
00434 return;
00435
00436
00437 mSceneNode->setMaterialTexture(layer, texture);
00438 }
00439
00440
00441 bool SceneComponent::parseXML(IXMLReader *file, Entity *entity)
00442 {
00443
00444 SceneComponent *component = NULL;
00445
00446
00447 if(file->getNodeType() == io::EXN_ELEMENT)
00448 {
00449 if(stringw("SceneComponent") == file->getNodeName())
00450 {
00451
00452 component = new SceneComponent(entity);
00453 }
00454 }
00455
00456 if(component == NULL)
00457 return false;
00458
00459
00460 while(file->read())
00461 {
00462 switch(file->getNodeType())
00463 {
00464 case io::EXN_ELEMENT:
00465
00466
00467 SceneComponent::parseBaseXML(file, component);
00468
00469 break;
00470
00471 case io::EXN_ELEMENT_END:
00472
00473
00474 if(stringw("SceneComponent") == file->getNodeName())
00475 return true;
00476
00477 break;
00478
00479 default:
00480
00481 break;
00482 }
00483
00484 }
00485
00486
00487 return false;
00488 }
00489
00490
00491 void SceneComponent::parseBaseXML(IXMLReader *file, SceneComponent *component)
00492 {
00493
00494 if(stringw("CollisionResponseAnimator") == file->getNodeName())
00495 {
00496
00497 vector3df ellipsoidRadius;
00498 vector3df gravityPerSecond;
00499 vector3df ellipsoidTranslation;
00500 f32 slidingValue;
00501
00502 bool doneParsing = false;
00503
00504 while(file->read() && !doneParsing)
00505 {
00506 switch(file->getNodeType())
00507 {
00508 case io::EXN_ELEMENT:
00509
00510
00511 if(stringw("ellipsoidRadius") == file->getNodeName())
00512 {
00513 ellipsoidRadius = vector3df( file->getAttributeValueAsFloat(L"x"),
00514 file->getAttributeValueAsFloat(L"y"),
00515 file->getAttributeValueAsFloat(L"z") );
00516 }
00517
00518
00519 else if(stringw("gravityPerSecond") == file->getNodeName())
00520 {
00521 gravityPerSecond = vector3df( file->getAttributeValueAsFloat(L"x"),
00522 file->getAttributeValueAsFloat(L"y"),
00523 file->getAttributeValueAsFloat(L"z") );
00524 }
00525
00526
00527 else if(stringw("ellipsoidTranslation") == file->getNodeName())
00528 {
00529 ellipsoidTranslation = vector3df( file->getAttributeValueAsFloat(L"x"),
00530 file->getAttributeValueAsFloat(L"y"),
00531 file->getAttributeValueAsFloat(L"z") );
00532 }
00533
00534
00535 else if(stringw("slidingValue") == file->getNodeName())
00536 slidingValue = file->getAttributeValueAsFloat(L"value");
00537
00538 break;
00539
00540 case io::EXN_ELEMENT_END:
00541
00542
00543 if(stringw("CollisionRespondAnimator") == file->getNodeName())
00544 doneParsing = true;
00545
00546 break;
00547
00548 default:
00549
00550 break;
00551 }
00552 }
00553
00554
00555 component->addCollisionResponseAnimator(ellipsoidRadius, gravityPerSecond,
00556 ellipsoidTranslation, slidingValue);
00557 }
00558
00559
00560 else if(stringw("FlyCircleAnimator") == file->getNodeName())
00561 {
00562
00563 vector3df center;
00564 f32 radius;
00565 f32 speed;
00566 vector3df direction;
00567
00568 bool doneParsing = false;
00569
00570 while(file->read() && !doneParsing)
00571 {
00572 switch(file->getNodeType())
00573 {
00574 case io::EXN_ELEMENT:
00575
00576
00577 if(stringw("center") == file->getNodeName())
00578 {
00579 center = vector3df( file->getAttributeValueAsFloat(L"x"),
00580 file->getAttributeValueAsFloat(L"y"),
00581 file->getAttributeValueAsFloat(L"z") );
00582 }
00583
00584
00585 else if(stringw("radius") == file->getNodeName())
00586 radius = file->getAttributeValueAsFloat(L"value");
00587
00588
00589 else if(stringw("speed") == file->getNodeName())
00590 speed = file->getAttributeValueAsFloat(L"value");
00591
00592
00593 else if(stringw("direction") == file->getNodeName())
00594 {
00595 direction = vector3df( file->getAttributeValueAsFloat(L"x"),
00596 file->getAttributeValueAsFloat(L"y"),
00597 file->getAttributeValueAsFloat(L"z") );
00598 }
00599
00600 break;
00601
00602 case io::EXN_ELEMENT_END:
00603
00604
00605 if(stringw("FlyCircleAnimator") == file->getNodeName())
00606 doneParsing = true;
00607
00608 break;
00609
00610 default:
00611
00612 break;
00613 }
00614 }
00615
00616
00617 component->addFlyCircleAnimator(center, radius, speed, direction);
00618 }
00619
00620
00621 else if(stringw("FlyStraightAnimator") == file->getNodeName())
00622 {
00623
00624 vector3df startPoint;
00625 vector3df endPoint;
00626 u32 timeForWay;
00627 bool loop;
00628
00629 bool doneParsing = false;
00630
00631 while(file->read() && !doneParsing)
00632 {
00633 switch(file->getNodeType())
00634 {
00635 case io::EXN_ELEMENT:
00636
00637
00638 if(stringw("startPoint") == file->getNodeName())
00639 {
00640 startPoint = vector3df( file->getAttributeValueAsFloat(L"x"),
00641 file->getAttributeValueAsFloat(L"y"),
00642 file->getAttributeValueAsFloat(L"z") );
00643 }
00644
00645
00646 else if(stringw("endPoint") == file->getNodeName())
00647 {
00648 endPoint = vector3df( file->getAttributeValueAsFloat(L"x"),
00649 file->getAttributeValueAsFloat(L"y"),
00650 file->getAttributeValueAsFloat(L"z") );
00651 }
00652
00653
00654 else if(stringw("timeForWay") == file->getNodeName())
00655 timeForWay = (u32)file->getAttributeValueAsInt(L"timeForWay");
00656
00657
00658 else if(stringw("slidingValue") == file->getNodeName())
00659 {
00660 stringc value = file->getAttributeValue(L"value");
00661 loop = (value == "true") ? true : false ;
00662 }
00663
00664 break;
00665
00666 case io::EXN_ELEMENT_END:
00667
00668
00669 if(stringw("FlyStraightAnimator") == file->getNodeName())
00670 doneParsing = true;
00671
00672 break;
00673
00674 default:
00675
00676 break;
00677 }
00678 }
00679
00680
00681 component->addFlyStraightAnimator(startPoint, endPoint, timeForWay, loop);
00682 }
00683
00684
00685 else if(stringw("absolutePosition") == file->getNodeName())
00686 {
00687 component->setAbsolutePosition( vector3df(file->getAttributeValueAsFloat(L"x"),
00688 file->getAttributeValueAsFloat(L"y"),
00689 file->getAttributeValueAsFloat(L"z") ) );
00690 }
00691
00692
00693 else if(stringw("automaticCulling") == file->getNodeName())
00694 {
00695 stringc value = file->getAttributeValue(L"value");
00696 E_CULLING_TYPE type;
00697
00698 #define retrieveCullingType(x) \
00699 else if(value == #x) \
00700 type = x
00701
00702 if(value == "")
00703 type = EAC_OFF;
00704
00705 retrieveCullingType(EAC_OFF);
00706 retrieveCullingType(EAC_BOX);
00707 retrieveCullingType(EAC_FRUSTUM_BOX);
00708 retrieveCullingType(EAC_FRUSTUM_SPHERE);
00709
00710 #undef retrieveCullingType
00711
00712 component->setAutomaticCulling(type);
00713 }
00714
00715
00716 else if(stringw("canAffectParent") == file->getNodeName())
00717 {
00718 stringc value = file->getAttributeValue(L"value");
00719 component->setCanAffectParent( (value == "true") ? true : false );
00720 }
00721
00722
00723 else if(stringw("materialFlag") == file->getNodeName())
00724 {
00725 stringc materialFlag = file->getAttributeValue(L"flag");
00726 E_MATERIAL_FLAG flag;
00727
00728 #define retrieveMaterialFlag(x) \
00729 else if(materialFlag == #x) \
00730 flag = x
00731
00732 if(materialFlag == "")
00733 flag = EMF_WIREFRAME;
00734
00735 retrieveMaterialFlag(EMF_WIREFRAME);
00736 retrieveMaterialFlag(EMF_POINTCLOUD);
00737 retrieveMaterialFlag(EMF_GOURAUD_SHADING);
00738 retrieveMaterialFlag(EMF_LIGHTING);
00739 retrieveMaterialFlag(EMF_ZBUFFER);
00740 retrieveMaterialFlag(EMF_ZWRITE_ENABLE);
00741 retrieveMaterialFlag(EMF_BACK_FACE_CULLING);
00742 retrieveMaterialFlag(EMF_FRONT_FACE_CULLING);
00743 retrieveMaterialFlag(EMF_BILINEAR_FILTER);
00744 retrieveMaterialFlag(EMF_TRILINEAR_FILTER);
00745 retrieveMaterialFlag(EMF_ANISOTROPIC_FILTER);
00746 retrieveMaterialFlag(EMF_FOG_ENABLE);
00747 retrieveMaterialFlag(EMF_NORMALIZE_NORMALS);
00748 retrieveMaterialFlag(EMF_TEXTURE_WRAP);
00749
00750 #undef retrieveMaterialFlag
00751
00752 stringc value = file->getAttributeValue(L"value");
00753
00754 component->setMaterialFlag(flag, (value == "true") ? true : false );
00755 }
00756
00757
00758 else if(stringw("materialTexture") == file->getNodeName())
00759 {
00760 stringc fileName = file->getAttributeValue(L"fileName");
00761 component->setMaterialTexture(file->getAttributeValueAsInt(L"layer"), fileName.c_str());
00762 }
00763
00764
00765 else if(stringw("materialType") == file->getNodeName())
00766 {
00767 stringc value = file->getAttributeValue(L"value");
00768 E_MATERIAL_TYPE type;
00769
00770 #define retrieveMaterialType(x) \
00771 else if(value == #x) \
00772 type = x
00773
00774 if(value == "")
00775 type = EMT_SOLID;
00776
00777 retrieveMaterialType(EMT_SOLID);
00778 retrieveMaterialType(EMT_SOLID_2_LAYER);
00779 retrieveMaterialType(EMT_LIGHTMAP);
00780 retrieveMaterialType(EMT_LIGHTMAP_ADD);
00781 retrieveMaterialType(EMT_LIGHTMAP_M2);
00782 retrieveMaterialType(EMT_LIGHTMAP_M4);
00783 retrieveMaterialType(EMT_LIGHTMAP_LIGHTING);
00784 retrieveMaterialType(EMT_LIGHTMAP_LIGHTING_M2);
00785 retrieveMaterialType(EMT_LIGHTMAP_LIGHTING_M4);
00786 retrieveMaterialType(EMT_DETAIL_MAP);
00787 retrieveMaterialType(EMT_SPHERE_MAP);
00788 retrieveMaterialType(EMT_REFLECTION_2_LAYER);
00789 retrieveMaterialType(EMT_TRANSPARENT_ADD_COLOR);
00790 retrieveMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
00791 retrieveMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
00792 retrieveMaterialType(EMT_TRANSPARENT_VERTEX_ALPHA);
00793 retrieveMaterialType(EMT_TRANSPARENT_REFLECTION_2_LAYER);
00794 retrieveMaterialType(EMT_NORMAL_MAP_SOLID);
00795 retrieveMaterialType(EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR);
00796 retrieveMaterialType(EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA);
00797 retrieveMaterialType(EMT_PARALLAX_MAP_SOLID);
00798 retrieveMaterialType(EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR);
00799 retrieveMaterialType(EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA);
00800 retrieveMaterialType(EMT_ONETEXTURE_BLEND);
00801
00802 #undef retrieveMaterialType
00803
00804 component->setMaterialType(type);
00805 }
00806
00807
00808 else if(stringw("position") == file->getNodeName())
00809 {
00810 component->setPosition( vector3df(file->getAttributeValueAsFloat(L"x"),
00811 file->getAttributeValueAsFloat(L"y"),
00812 file->getAttributeValueAsFloat(L"z") ) );
00813 }
00814
00815
00816 else if(stringw("rotation") == file->getNodeName())
00817 {
00818 component->setRotation( vector3df(file->getAttributeValueAsFloat(L"x"),
00819 file->getAttributeValueAsFloat(L"y"),
00820 file->getAttributeValueAsFloat(L"z") ) );
00821 }
00822
00823
00824 else if(stringw("scale") == file->getNodeName())
00825 {
00826 component->setScale( vector3df(file->getAttributeValueAsFloat(L"x"),
00827 file->getAttributeValueAsFloat(L"y"),
00828 file->getAttributeValueAsFloat(L"z") ) );
00829 }
00830
00831
00832 else if(stringw("visible") == file->getNodeName())
00833 {
00834 stringc value = file->getAttributeValue(L"value");
00835 component->setVisible( (value == "true") ? true : false );
00836 }
00837 }
00838
00839