All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MaterialGenerator.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 _MATERIALGENERATOR_HH_
18 #define _MATERIALGENERATOR_HH_
19 
20 #include <OgreMaterial.h>
21 #include <OgreStringVector.h>
22 #include <map>
23 
24 #include <string>
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
29  namespace rendering
30  {
40  {
42  public: typedef uint32_t Perm;
43 
48  protected: MaterialGenerator();
49 
50  public: virtual ~MaterialGenerator();
51 
52  public: const Ogre::MaterialPtr &GetMaterial(Perm permutation);
53 
59  public: class Impl
60  {
61  public: virtual ~Impl();
62  public: virtual Ogre::GpuProgramPtr GenerateVertexShader(
63  Perm _permutation) = 0;
64  public: virtual Ogre::GpuProgramPtr GenerateFragmentShader(
65  Perm _permutation) = 0;
66  public: virtual Ogre::MaterialPtr GenerateTemplateMaterial(
67  Perm permutation) = 0;
68  };
69 
70 
71  protected: const Ogre::GpuProgramPtr &GetVertexShader(Perm _perm);
72  protected: const Ogre::GpuProgramPtr &GetFragmentShader(Perm _perm);
73  protected: const Ogre::MaterialPtr &GetTemplateMaterial(Perm _perm);
74 
75  protected: std::string schemeName;
76 
78  protected: Ogre::String materialBaseName;
79 
81  protected: Perm vsMask;
82 
84  protected: Perm fsMask;
85 
87  protected: Perm matMask;
88 
90  protected: Impl *impl;
91 
92  protected: typedef std::map<Perm, Ogre::GpuProgramPtr> ProgramMap;
93  protected: typedef std::map<Perm, Ogre::MaterialPtr> MaterialMap;
94 
95  protected: ProgramMap vs, fs;
96  protected: MaterialMap templateMat, materials;
97  };
98  }
99 }
100 #endif
Perm matMask
Mask of permutation bits that influence template material choice.
Definition: MaterialGenerator.hh:87
std::map< Perm, Ogre::MaterialPtr > MaterialMap
Definition: MaterialGenerator.hh:93
Implementation class that takes care of actual generation or lookup of the various constituent parts ...
Definition: MaterialGenerator.hh:59
Perm vsMask
Mask of permutation bits that influence vertex shader choice.
Definition: MaterialGenerator.hh:81
ProgramMap vs
Definition: MaterialGenerator.hh:95
std::string schemeName
Definition: MaterialGenerator.hh:75
MaterialMap templateMat
Definition: MaterialGenerator.hh:96
Perm fsMask
Mask of permutation bits that influence fragment shader choice.
Definition: MaterialGenerator.hh:84
Impl * impl
Generator.
Definition: MaterialGenerator.hh:90
std::map< Perm, Ogre::GpuProgramPtr > ProgramMap
Definition: MaterialGenerator.hh:92
Caching, on-the-fly material generator.
Definition: MaterialGenerator.hh:39
Ogre::String materialBaseName
Base name of materials generated by this.
Definition: MaterialGenerator.hh:78
#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