Changeset 11073
- Timestamp:
- Jan 18, 2016, 10:12:53 PM (9 years ago)
- Location:
- code/branches/shaders_merge
- Files:
-
- 12 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/shaders_merge
- Property svn:mergeinfo changed
/code/branches/shaders (added) merged: 9379,9395,9401-9403,9407,9409,9419-9420,9422-9423,9426,9428,9433,9445-9446,9448,9461-9462,9464,9466,9491-9492,9500,9504,9510-9511
- Property svn:mergeinfo changed
-
code/branches/shaders_merge/src/libraries/tools/Mesh.cc
r11071 r11073 33 33 #include <string> 34 34 #include <OgreEntity.h> 35 #include <OgreSubEntity.h> 35 36 #include <OgreSceneManager.h> 36 37 … … 93 94 } 94 95 96 void Mesh::setMaterial(const std::string& name) 97 { 98 if (this->entity_) 99 this->entity_->setMaterialName(name); 100 } 101 102 const std::string& Mesh::getMaterial() const 103 { 104 if (this->entity_) 105 { 106 if(this->entity_->getSubEntity(0)) 107 return this->entity_->getSubEntity(0)->getMaterialName(); //return the Material of the first SubEntity, should be enough for now 108 else 109 return BLANKSTRING; 110 } 111 else 112 return BLANKSTRING; 113 } 114 95 115 void Mesh::setVisible(bool bVisible) 96 116 { -
code/branches/shaders_merge/src/libraries/tools/Mesh.h
r5781 r11073 48 48 const std::string& getName() const; 49 49 50 void setMaterial(const std::string& name); 51 const std::string& getMaterial() const; 52 50 53 void setVisible(bool bVisible); 51 54 bool isVisible() const; -
code/branches/shaders_merge/src/orxonox/CMakeLists.txt
r10624 r11073 36 36 CameraManager.cc 37 37 Scene.cc 38 RenderQueueListener.cc 38 39 END_BUILD_UNIT 39 40 ) -
code/branches/shaders_merge/src/orxonox/OrxonoxPrereqs.h
r11052 r11073 75 75 class PlayerManager; 76 76 class Radar; 77 class RenderQueueListener; 77 78 class Scene; 78 79 class GSLevelMemento; -
code/branches/shaders_merge/src/orxonox/Scene.cc
r11071 r11073 27 27 * 28 28 */ 29 30 /** 31 @file Scene.cc 32 @brief Implementation of Scene Class 33 */ 34 29 35 30 36 #include "Scene.h" … … 51 57 #include "worldentities/WorldEntity.h" 52 58 #include "Level.h" 59 #include "RenderQueueListener.h" 53 60 54 61 namespace orxonox 55 62 { 56 63 RegisterClass(Scene); 57 64 65 /** 66 @brief 67 Constructor, it sets common standard paramters for a scene depending on whether it will be rendered or not. 68 It also makes sure we user our own render queue listener for rendering instead of the standard listener provided by Ogre 69 */ 58 70 SetConsoleCommand("Scene", "debugDrawPhysics", &Scene::consoleCommand_debugDrawPhysics).addShortcut().defaultValue(1, true).defaultValue(2, 0.5f); 59 71 … … 75 87 this->sceneManager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC); 76 88 this->rootSceneNode_ = this->sceneManager_->getRootSceneNode(); 89 this->renderQueueListener_ = new RenderQueueListener(); 90 this->sceneManager_->addRenderQueueListener(this->renderQueueListener_);//add our own renderQueueListener 77 91 78 92 this->radar_ = new Radar(); -
code/branches/shaders_merge/src/orxonox/Scene.h
r11071 r11073 28 28 */ 29 29 30 /** 31 @file Scene.h 32 @brief Definition of Scene Class 33 */ 34 30 35 #ifndef _Scene_H__ 31 36 #define _Scene_H__ … … 49 54 { 50 55 public: 56 /** 57 @brief 58 This class holds a Scene which is a collection of all kinds of objects to be rendered in the same space, 59 with the same physics and the same light properties. Objects can be anything from a light source, over non physical objects 60 like Billboards to just plain Models with an attached Mesh 61 */ 51 62 Scene(Context* context); 52 63 virtual ~Scene(); … … 59 70 inline Ogre::SceneNode* getRootSceneNode() const 60 71 { return this->rootSceneNode_; } 72 inline RenderQueueListener* getRenderQueueListener() const 73 { return this->renderQueueListener_; } 61 74 62 75 void setSkybox(const std::string& skybox); … … 95 108 { this->setShadow(this->bShadows_); } 96 109 97 Ogre::SceneManager* sceneManager_; 98 Ogre::SceneNode* rootSceneNode_; 110 Ogre::SceneManager* sceneManager_; //!< This is a pointer to the Ogre SceneManager we're using to render the Scene 111 Ogre::SceneNode* rootSceneNode_; //!< This is a pointer to the root node of the Scene tree 112 RenderQueueListener* renderQueueListener_; //!< this is a pointer to the RenderQueueListener we're using for this Scene 99 113 100 std::string skybox_; 101 ColourValue ambientLight_; 102 std::list<BaseObject*> objects_; 103 bool bShadows_; 104 float soundReferenceDistance_; 105 Radar* radar_; 114 std::string skybox_; //!< This string holds information about the skybox we're using 115 ColourValue ambientLight_; //!< This variable holds the color value for the ambient light in our scene, usually black in space 116 std::list<BaseObject*> objects_; //!< This list holds all the objects created in our scene 117 bool bShadows_; //!< Do we want shadows in our scene? 118 float soundReferenceDistance_; //!< This holds a reference distance, which represents the distance between our scene and the listener 119 Radar* radar_; //!< This is a pointer to a Radar object assigned with this scene 106 120 107 121 -
code/branches/shaders_merge/src/orxonox/graphics/Billboard.cc
r11071 r11073 171 171 } 172 172 } 173 174 void Billboard::setRenderQueueGroup(unsigned char groupID) 175 { 176 Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet(); 177 if( bSet != NULL ) 178 { 179 bSet->setRenderQueueGroup(groupID); 180 } 181 } 182 183 void Billboard::disableFrustumCulling() 184 { 185 Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet(); 186 if( bSet != NULL ) 187 { 188 bSet->setBounds(Ogre::AxisAlignedBox(Ogre::AxisAlignedBox::EXTENT_INFINITE),0); 189 } 190 } 173 191 } -
code/branches/shaders_merge/src/orxonox/graphics/Billboard.h
r11071 r11073 81 81 82 82 void setDefaultDimensions(float width, float height); 83 84 void setRenderQueueGroup(unsigned char groupID); 85 86 void disableFrustumCulling(); 83 87 84 88 -
code/branches/shaders_merge/src/orxonox/graphics/CMakeLists.txt
r8729 r11073 13 13 Backlight.cc 14 14 Camera.cc 15 LensFlare.cc 15 16 Light.cc 16 17 END_BUILD_UNIT -
code/branches/shaders_merge/src/orxonox/graphics/LensFlare.cc
r11072 r11073 45 45 namespace orxonox 46 46 { 47 CreateFactory(LensFlare);47 RegisterClass(LensFlare); 48 48 49 LensFlare::LensFlare( BaseObject* creator) : StaticEntity(creator), scale_(1.0f), fadeOnViewBorder_(true), fadeResolution_(7), fadeExponent_(2.0f), colour_(new ColourValue(1.0f,0.9f,0.9f))49 LensFlare::LensFlare(Context* context) : StaticEntity(context), scale_(1.0f), fadeOnViewBorder_(true), fadeResolution_(7), fadeExponent_(2.0f), colour_(new ColourValue(1.0f,0.9f,0.9f)) 50 50 { 51 51 RegisterObject(LensFlare); … … 94 94 void LensFlare::createBillboards() 95 95 { 96 this->occlusionBillboard_ = new Billboard(this );96 this->occlusionBillboard_ = new Billboard(this->getContext()); 97 97 this->occlusionBillboard_->setMaterial("lensflare/hoq"); 98 98 this->occlusionBillboard_->setVisible(false); … … 102 102 103 103 for(std::vector<LensFlare::Lens*>::iterator it = lensConfiguration_->begin(); it != lensConfiguration_->end(); ++it) { 104 Billboard* lensPart=new Billboard(this );104 Billboard* lensPart=new Billboard(this->getContext()); 105 105 lensPart->setMaterial(*(*it)->material_); 106 106 lensPart->disableFrustumCulling(); -
code/branches/shaders_merge/src/orxonox/graphics/LensFlare.h
r11072 r11073 82 82 83 83 public: 84 LensFlare( BaseObject* creator);84 LensFlare(Context* context); 85 85 virtual ~LensFlare(); 86 86 -
code/branches/shaders_merge/src/orxonox/graphics/Model.cc
r11071 r11073 37 37 #include "core/XMLPort.h" 38 38 #include "Scene.h" 39 #include "RenderQueueListener.h" 39 40 #include "graphics/MeshLodInformation.h" 40 41 #include "Level.h" … … 45 46 46 47 Model::Model(Context* context) : 47 StaticEntity(context), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15f)48 StaticEntity(context), bCastShadows_(true), renderQueueGroup_(RENDER_QUEUE_MAIN), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15f) 48 49 { 49 50 RegisterObject(Model); … … 72 73 73 74 XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode); 75 XMLPortParam(Model, "renderQueueGroup", setRenderQueueGroup, getRenderQueueGroup, xmlelement, mode); 76 XMLPortParam(Model, "material", setMaterial, getMaterial, xmlelement, mode); 74 77 XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true); 75 78 } 79 80 /** 81 @brief 82 This function turns a string from XML Port into a usable ID for the rendering system 83 It defaults to the main queue if the group isn't recognized. 84 85 @param renderQueueGroup 86 This is a string representing the render queue group. Accepted values: 87 'main', 'stencil glow', 'stencil object' 88 */ 89 const unsigned int Model::getRenderQueueGroupID(const std::string& renderQueueGroup) const 90 { 91 if(renderQueueGroup.compare("stencil glow")==0) 92 { 93 return RENDER_QUEUE_STENCIL_GLOW; 94 } 95 if(renderQueueGroup.compare("stencil object")==0) 96 { 97 return RENDER_QUEUE_STENCIL_OBJECTS; 98 } 99 return RENDER_QUEUE_MAIN; 100 } 76 101 77 102 void Model::registerVariables() 78 103 { 79 104 registerVariable(this->meshSrc_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMesh)); 105 registerVariable(this->renderQueueGroup_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedRenderQueueGroup)); 106 registerVariable(this->materialName_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMaterial)); 80 107 registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedShadows)); 81 108 } … … 104 131 this->attachOgreObject(this->mesh_.getEntity()); 105 132 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_); 133 this->mesh_.getEntity()->setRenderQueueGroup(this->renderQueueGroup_); 106 134 this->mesh_.setVisible(this->isVisible()); 107 135 … … 110 138 } 111 139 } 140 } 141 142 void Model::changedRenderQueueGroup() 143 { 144 if (GameMode::showsGraphics()) 145 { 146 if (this->mesh_.getEntity()) 147 { 148 this->mesh_.getEntity()->setRenderQueueGroup(this->renderQueueGroup_); 149 } 150 } 151 } 152 153 void Model::changedMaterial() 154 { 155 this->mesh_.setMaterial(this->materialName_); 112 156 } 113 157 -
code/branches/shaders_merge/src/orxonox/graphics/Model.h
r11071 r11073 27 27 */ 28 28 29 /** 30 @file Model.h 31 @brief Definition of Model Class 32 */ 33 29 34 #ifndef _Model_H__ 30 35 #define _Model_H__ … … 34 39 #include <string> 35 40 #include "tools/Mesh.h" 41 #include "RenderQueueListener.h" 36 42 #include "worldentities/StaticEntity.h" 37 43 … … 40 46 class _OrxonoxExport Model : public StaticEntity 41 47 { 48 /** 49 @brief 50 The class Model stores a Mesh and some additional properties, so you can easily render any Model and apply different effects to it. 51 52 You can assign any Material to any Mesh to completely change the way it looks, to further add versatility you can also assign the Model 53 to a render queue group, to enable proper rendering of fancy effect like glowing edges around objects with alpha blending. 54 */ 42 55 public: 43 56 Model(Context* context); … … 58 71 { return this->meshSrc_; } 59 72 73 inline void setRenderQueueGroup(const std::string& renderQueueGroup) 74 { this->renderQueueGroup_ = getRenderQueueGroupID(renderQueueGroup); this->changedRenderQueueGroup(); } 75 inline const int getRenderQueueGroup() const 76 { return this->renderQueueGroup_; } 77 60 78 inline void setCastShadows(bool bCastShadows) 61 79 { this->bCastShadows_ = bCastShadows; this->changedShadows(); } … … 63 81 { return this->bCastShadows_; } 64 82 83 inline void setMaterial(const std::string& materialname) 84 { this->materialName_ = materialname; this->changedMaterial(); } 85 inline const std::string& getMaterial() const 86 { return this->materialName_; } 87 65 88 protected: 89 /** 90 @brief 91 This function turns a string from XML Port into a usable ID for the rendering system 92 It defaults to the main queue if the group isn't recognized. 93 94 @param renderQueueGroup 95 This is a string representing the render queue group. Accepted values: 96 main, stencil glow, stencil object 97 */ 98 const unsigned int getRenderQueueGroupID(const std::string& renderQueueGroup) const; 99 66 100 void registerVariables(); 67 101 void changedMesh(); 102 void changedRenderQueueGroup(); 103 void changedMaterial(); 68 104 void changedShadows(); 69 105 … … 77 113 float getBiggestScale(Vector3 scale3d); 78 114 79 std::string meshSrc_; 80 Mesh mesh_; 81 bool bCastShadows_; 115 std::string meshSrc_; //!< This string stores the path where the mesh is stored 116 Mesh mesh_; //!< This is the mesh object linked to this Object, it stores the data from the mesh file in a usable format for the Ogre engine 117 bool bCastShadows_; //!< This value determines whether a Model is casting a shadow or not, turn it off to save performance, when not needed 118 unsigned int renderQueueGroup_; //!< This variable stores which render queue group this object is assigned to 119 std::string materialName_; //!< This string stores the name of the material to be applied to the mesh/model 82 120 83 121 //LoD 84 bool bGlobalEnableLod_; 85 float lodLevel_; 86 bool bLodEnabled_; 87 unsigned int numLodLevels_; 88 float lodReductionRate_; 122 bool bGlobalEnableLod_; //!< Has LoD been turned on in the graphics configuration? 123 float lodLevel_; //!< Standard LoD Level 124 bool bLodEnabled_; //!< Is LoD to be used on this model? 125 unsigned int numLodLevels_; //!< How many LoD does this model feature 126 float lodReductionRate_; //!< How fast should be switched to lower LoDs 89 127 90 128 };
Note: See TracChangeset
for help on using the changeset viewer.