Changeset 8557 for code/branches/environment2/src/orxonox/worldentities
- Timestamp:
- May 24, 2011, 12:28:31 AM (14 years ago)
- Location:
- code/branches/environment2/src/orxonox/worldentities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/environment2/src/orxonox/worldentities/WorldEntity.cc
r7937 r8557 177 177 // Attached collision shapes 178 178 XMLPortObject(WorldEntity, CollisionShape, "collisionShapes", attachCollisionShape, getAttachedCollisionShape, xmlelement, mode); 179 // Attach WorldEntityShaders that depend on WorldEntity data (e.g. position). -- TODO -- Extend to WorldEntityShader. 180 XMLPortObject(WorldEntity, GodrayShader, "shaders", attachShader, getAttachedObject, xmlelement, mode); 179 181 } 180 182 … … 510 512 return 0; 511 513 } 514 515 void WorldEntity::attachShader(GodrayShader* object) 516 { 517 object->setWorldEntity(object); 518 519 this->shaders_.insert(object); 520 } 521 void WorldEntity::detachShader(GodrayShader* object) 522 { 523 std::set<WorldEntity*>::iterator it = this->children_.find(object); 524 this->shaders_.erase(it); 525 526 } 527 GodrayShader* WorldEntity::getAttachedShader(unsigned int index) 528 { 529 unsigned int i = 0; 530 for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it) 531 { 532 if (i == index) 533 return (*it); 534 ++i; 535 } 536 return 0; 537 } 512 538 513 539 //! Attaches an Ogre::SceneNode to this WorldEntity. -
code/branches/environment2/src/orxonox/worldentities/WorldEntity.h
r7910 r8557 199 199 void attachToNode(Ogre::SceneNode* node); 200 200 void detachFromNode(Ogre::SceneNode* node); 201 202 void attachShader(GodrayShader* object); 203 void detachShader(GodrayShader* object); 204 GodrayShader* getAttachedShader(unsigned int index); 205 inline const std::set<WorldEntity*>& getAttachedShaders() const 206 { return this->shaders_; } 201 207 202 208 inline void setDeleteWithParent(bool value) … … 234 240 unsigned int parentID_; 235 241 std::set<WorldEntity*> children_; 242 std::set<WorldEntity*> shaders_; 236 243 bool bDeleteWithParent_; 237 244
Note: See TracChangeset
for help on using the changeset viewer.