All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GBufferSchemeHandler.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef _GBUFFERSCHEMEHANDLER_HH_
18 #define _GBUFFERSCHEMEHANDLER_HH_
19 #include <OgreMaterialManager.h>
20 
21 #include <vector>
22 #include <string>
23 
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
29  namespace rendering
30  {
39  public Ogre::MaterialManager::Listener
40  {
42  : type(_type), materialGenerator(_type) {}
43 
44  public: virtual Ogre::Technique* handleSchemeNotFound(
45  uint16_t _schemeIndex,
46  const Ogre::String &_schemeName,
47  Ogre::Material *_originalMaterial,
48  uint16_t _lodIndex,
49  const Ogre::Renderable *_rend);
50 
54  protected: struct PassProperties
55  {
56  PassProperties() : isDeferred(true), normalMap(0),
57  isSkinned(false), hasDiffuseColor(true)
58  {}
59 
60  bool isDeferred;
61  std::vector<Ogre::TextureUnitState*> regularTextures;
62  Ogre::TextureUnitState *normalMap;
63  bool isSkinned;
65 
66  // Example of possible extension : vertex colours
67  // Ogre::TrackVertexColourType vertexColorType;
68  };
69 
71  protected: PassProperties InspectPass(Ogre::Pass *_pass,
72  uint16_t _lodIndex, const Ogre::Renderable *_rend);
73 
76  protected: MaterialGenerator::Perm GetPermutation(
77  const PassProperties &_props);
78 
80  protected: void FillPass(Ogre::Pass *_gBufferPass,
81  Ogre::Pass *_originalPass,
82  const PassProperties &_props);
83 
86  protected: bool CheckNormalMap(Ogre::TextureUnitState *_tus,
87  PassProperties &_props);
88 
90 
93 
94  // The string that will be checked in textures to determine whether
95  // they are normal maps
96  protected: static const std::string normal_map_pattern;
97  };
98  }
99 }
100 #endif
bool isDeferred
Definition: GBufferSchemeHandler.hh:60
GBufferMaterialGenerator::GBufferType type
Definition: GBufferSchemeHandler.hh:89
Class for generating materials for objects to render themselves to the GBuffer.
Definition: GBufferMaterialGenerator.hh:33
std::vector< Ogre::TextureUnitState * > regularTextures
Definition: GBufferSchemeHandler.hh:61
static const std::string normal_map_pattern
Definition: GBufferSchemeHandler.hh:96
Ogre::TextureUnitState * normalMap
Definition: GBufferSchemeHandler.hh:62
GBufferSchemeHandler(GBufferMaterialGenerator::GBufferType _type)
Definition: GBufferSchemeHandler.hh:41
Class for handling materials who did not specify techniques for rendering themselves into the GBuffer...
Definition: GBufferSchemeHandler.hh:38
A structure for containing the properties of a material, relevant to GBuffer rendering.
Definition: GBufferSchemeHandler.hh:54
bool isSkinned
Definition: GBufferSchemeHandler.hh:63
GBufferType
The types of g buffers.
Definition: GBufferMaterialGenerator.hh:36
GBufferMaterialGenerator materialGenerator
The material generator.
Definition: GBufferSchemeHandler.hh:92
bool hasDiffuseColor
Definition: GBufferSchemeHandler.hh:64
PassProperties()
Definition: GBufferSchemeHandler.hh:56
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
uint32_t Perm
Bitfield used to signify a material permutations.
Definition: MaterialGenerator.hh:42