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