Changeset 7163 for code/trunk/src/orxonox/graphics
- Timestamp:
- Aug 11, 2010, 8:55:13 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 13 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/graphics/Backlight.h
r5781 r7163 45 45 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 void registerVariables();48 47 49 48 virtual void tick(float dt); … … 81 80 82 81 private: 82 void registerVariables(); 83 83 virtual void startturnonoff(); 84 84 virtual void stopturnonoff(); -
code/trunk/src/orxonox/graphics/Billboard.h
r5781 r7163 46 46 47 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 48 void registerVariables();49 48 50 49 virtual void changedVisibility(); … … 78 77 79 78 private: 79 void registerVariables(); 80 80 void changedMaterial(); 81 81 // void changedRotation(); -
code/trunk/src/orxonox/graphics/BlinkingBillboard.cc
r6417 r7163 66 66 void BlinkingBillboard::registerVariables() 67 67 { 68 // registerVariable(this->amplitude_, VariableDirection::ToClient); 69 // registerVariable(this->frequency_, VariableDirection::ToClient); 70 // registerVariable(this->phase_, VariableDirection::ToClient); 68 unregisterVariable(this->getScale3D()); 69 registerVariable(this->amplitude_, VariableDirection::ToClient); 70 registerVariable(this->frequency_, VariableDirection::ToClient); 71 registerVariable(this->phase_, VariableDirection::ToClient); 72 registerVariable(this->bQuadratic_, VariableDirection::ToClient); 71 73 } 72 74 … … 75 77 SUPER(BlinkingBillboard, tick, dt); 76 78 77 if ( GameMode::isMaster() &&this->isActive())79 if (this->isActive()) 78 80 { 79 81 this->time_ += dt; -
code/trunk/src/orxonox/graphics/BlinkingBillboard.h
r5781 r7163 45 45 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 void registerVariables();48 47 49 48 virtual void tick(float dt); … … 70 69 71 70 private: 71 void registerVariables(); 72 72 73 float amplitude_; 73 74 float frequency_; -
code/trunk/src/orxonox/graphics/CMakeLists.txt
r5929 r7163 4 4 FadingBillboard.cc 5 5 GlobalShader.cc 6 MeshLodInformation.cc 6 7 Model.cc 8 AnimatedModel.cc 7 9 ParticleEmitter.cc 8 10 ParticleSpawner.cc -
code/trunk/src/orxonox/graphics/Camera.cc
r6501 r7163 111 111 SUPER(Camera, tick, dt); 112 112 113 if (this->bDrag_ )113 if (this->bDrag_ && this->getTimeFactor() != 0) 114 114 { 115 115 // this stuff here may need some adjustments -
code/trunk/src/orxonox/graphics/FadingBillboard.h
r5929 r7163 46 46 47 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 48 void registerVariables();49 48 50 49 virtual void tick(float dt); … … 66 65 67 66 protected: 67 void registerVariables(); 68 68 virtual void startturnonoff(); 69 69 virtual void stopturnonoff(); -
code/trunk/src/orxonox/graphics/GlobalShader.h
r5781 r7163 45 45 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 void registerVariables();48 47 49 48 virtual void changedVisibility(); … … 53 52 54 53 private: 54 void registerVariables(); 55 55 void changedCompositor(); 56 56 -
code/trunk/src/orxonox/graphics/Light.h
r5781 r7163 57 57 58 58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 59 void registerVariables();60 59 61 60 virtual void changedVisibility(); … … 132 131 133 132 private: 133 void registerVariables(); 134 134 void setTypeString(const std::string& type); 135 135 std::string getTypeString() const; -
code/trunk/src/orxonox/graphics/Model.cc
r5781 r7163 35 35 #include "core/XMLPort.h" 36 36 #include "Scene.h" 37 #include "graphics/MeshLodInformation.h" 38 #include "Level.h" 37 39 38 40 namespace orxonox … … 40 42 CreateFactory(Model); 41 43 42 Model::Model(BaseObject* creator) : StaticEntity(creator) 44 Model::Model(BaseObject* creator) : 45 StaticEntity(creator), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15) 43 46 { 44 47 RegisterObject(Model); 45 46 this->bCastShadows_ = true;47 48 48 49 this->registerVariables(); … … 59 60 SUPER(Model, XMLPort, xmlelement, mode); 60 61 62 XMLPortParam(Model, "lodLevel", setLodLevel, getLodLevel, xmlelement, mode); 63 61 64 XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode); 62 65 XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true); … … 67 70 registerVariable(this->meshSrc_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMesh)); 68 71 registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedShadows)); 72 } 73 74 float Model::getBiggestScale(Vector3 scale3d) 75 { 76 float scaleFactor = scale3d.x; 77 if(scale3d.y>scaleFactor) 78 scaleFactor = scale3d.y; 79 if(scale3d.z>scaleFactor) 80 scaleFactor = scale3d.z; 81 return scaleFactor; 69 82 } 70 83 … … 83 96 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_); 84 97 this->mesh_.setVisible(this->isVisible()); 98 99 100 //LOD 101 if( this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 ) 102 { 103 Level* level = this->getLevel(); 104 105 assert( level != 0 ); 106 107 MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_); 108 if( lodInfo ) 109 { 110 setLodLevel(lodInfo->getLodLevel()); 111 this->bLodEnabled_ = lodInfo->getEnabled(); 112 this->numLodLevels_ = lodInfo->getNumLevels(); 113 this->lodReductionRate_ = lodInfo->getReductionRate(); 114 } 115 if( this->numLodLevels_>10 ) 116 { 117 CCOUT(2) << "More than 10 LoD levels requested. Creating only 10." << endl; 118 this->numLodLevels_ = 10; 119 } 120 if( this->bLodEnabled_ ) 121 { 122 float volume = this->mesh_.getEntity()->getBoundingBox().volume(); 123 // float scaleFactor = 1; 124 125 // BaseObject* creatorPtr = this; 126 // 127 // while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr)) 128 // { 129 // scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D()); 130 // creatorPtr = creatorPtr->getCreator(); 131 // } 132 // COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl; 133 134 COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << std::endl; 135 136 #if OGRE_VERSION >= 0x010700 137 Ogre::Mesh::LodValueList distList; 138 #else 139 Ogre::Mesh::LodDistanceList distList; 140 #endif 141 142 if( lodLevel_>0 ) 143 { 144 // float factor = scaleFactor*5/lodLevel_; 145 float factor = pow(volume, 2.0f / 3.0f) * 15.0f / lodLevel_; 146 147 COUT(4) << "LodLevel set with factor: " << factor << endl; 148 149 distList.push_back(70.0f*factor); 150 distList.push_back(140.0f*factor); 151 distList.push_back(170.0f*factor); 152 distList.push_back(200.0f*factor); 153 distList.push_back(230.0f*factor); 154 distList.push_back(250.0f*factor); 155 distList.push_back(270.0f*factor); 156 distList.push_back(290.0f*factor); 157 distList.push_back(310.0f*factor); 158 distList.push_back(330.0f*factor); 159 while(distList.size()>this->numLodLevels_) 160 distList.pop_back(); 161 162 163 //Generiert LOD-Levels 164 this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, this->lodReductionRate_); 165 } 166 else 167 { 168 std::string what; 169 if(lodLevel_>5) 170 what = ">5"; 171 else 172 what = "<0"; 173 174 COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl; 175 } 176 } 177 else 178 COUT(4) << "LodLevel for " << this->meshSrc_ << " not set because is disabled." << endl; 179 } 85 180 } 86 181 } -
code/trunk/src/orxonox/graphics/Model.h
r5781 r7163 45 45 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 void registerVariables();48 47 49 48 virtual void changedVisibility(); … … 62 61 { return this->bCastShadows_; } 63 62 64 private: 63 protected: 64 void registerVariables(); 65 65 void changedMesh(); 66 66 void changedShadows(); 67 68 //LoD 69 inline void setLodLevel(float lodLevel) 70 { this->lodLevel_ = lodLevel; } 71 inline float getLodLevel() const 72 { return this->lodLevel_; } 73 float getBiggestScale(Vector3 scale3d); 67 74 68 75 std::string meshSrc_; 69 76 Mesh mesh_; 70 77 bool bCastShadows_; 78 79 //LoD 80 float lodLevel_; 81 bool bLodEnabled_; 82 unsigned int numLodLevels_; 83 float lodReductionRate_; 84 71 85 }; 72 86 } -
code/trunk/src/orxonox/graphics/ParticleEmitter.h
r5781 r7163 44 44 45 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 void registerVariables();47 46 48 47 virtual void changedVisibility(); … … 74 73 std::string source_; 75 74 LODParticle::Value LOD_; 75 76 private: 77 void registerVariables(); 76 78 }; 77 79 }
Note: See TracChangeset
for help on using the changeset viewer.