VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
TerrainMaterialDef.h
1 /*
2  * Copyright (C) 2014 Google Inc.
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 TERRAINMATERIALDEF_H
18 #define TERRAINMATERIALDEF_H
19 
20 #include <QVariant>
21 
43 public:
47  enum class BlendMode {
53  Add,
59  Multiply,
70  Overlay,
76  Blend,
81  Count,
82  };
83 
88 
92  const QString& getName() const { return mName; }
97  void setName(const QString& value);
101  const QString& getBaseTexture() const { return mBaseTexture; }
106  void setBaseTexture(const QString& value);
110  const QString& getBevelTexture() const { return mBevelTexture; }
115  void setBevelTexture(const QString& value);
119  const QString& getEdgeTexture() const { return mEdgeTexture; }
124  void setEdgeTexture(const QString& value);
128  bool isTiled() const { return mTiled; }
134  void setTiled(bool value);
139  bool isOpaque() const { return mOpaque; }
151  void setOpaque(bool value);
156  float getEdgeWidth() const { return mEdgeWidth; }
168  void setEdgeWidth(float value);
173  float getEdgeOffset() const { return mEdgeOffset; }
181  void setEdgeOffset(float value);
185  float getEdgeScale() const { return mEdgeScale; }
196  void setEdgeScale(float value);
200  float getBevelScale() const { return mBevelScale; }
211  void setBevelScale(float value);
215  BlendMode getBlendMode() const { return mBlendMode; }
222  void setBlendMode(BlendMode value);
223 
227  void reset();
232  void mergeFromJson(const QVariantMap& jsonValue);
233 
239  static BlendMode parseBlendMode(const QString& str, BlendMode defaultValue);
240 
241 private:
242  QString mName;
243  QString mBaseTexture;
244  QString mBevelTexture;
245  QString mEdgeTexture;
246 
247  bool mTiled = true;
248  bool mOpaque = true;
249  float mEdgeWidth = 0.0f;
250  float mEdgeOffset = 0.0f;
251  float mEdgeScale = 1.0f;
252  float mBevelScale = 1.0f;
253 
254  BlendMode mBlendMode = BlendMode::Add;
255 };
256 
257 #endif // TERRAINMATERIALDEF_H
void mergeFromJson(const QVariantMap &jsonValue)
Initializes the terrain material properties from a JSON-based property map.
void setOpaque(bool value)
Returns whether or not the alpha channel on the base texture should be used for alpha blending...
void setEdgeTexture(const QString &value)
Sets the graphics root relative path to the edge texture.
bool isTiled() const
Whether or not the base texture should be tiled past the first instance.
Definition: TerrainMaterialDef.h:128
void setEdgeScale(float value)
Sets the scaling factor on edge texture coordinates, controlling the tightness of tiling...
Total number of blending modes.
const QString & getEdgeTexture() const
Returns the graphics root relative path to the edge texture.
Definition: TerrainMaterialDef.h:119
const QString & getName() const
Returns the name of this material.
Definition: TerrainMaterialDef.h:92
const QString & getBaseTexture() const
Returns the graphics root relative path to the base texture.
Definition: TerrainMaterialDef.h:101
BlendMode getBlendMode() const
Returns the blend mode used to composite the bevel texture over the base texture. ...
Definition: TerrainMaterialDef.h:215
void reset()
Sets all properties in this TerrainMaterialDef to their default.
float getEdgeScale() const
Returns the scaling factor on edge texture coordinates.
Definition: TerrainMaterialDef.h:185
bool isOpaque() const
Whether or not the alpha channel on the base texture should be used for alpha blending.
Definition: TerrainMaterialDef.h:139
static BlendMode parseBlendMode(const QString &str, BlendMode defaultValue)
Returns a string converted into the corresponding BlendMode.
void setTiled(bool value)
Sets whether or not the base texture should be tiled past the first instance.
void setName(const QString &value)
Sets the name of this material, used to identify it and look it up.
float getBevelScale() const
Returns the horizontal scaling factor on bevel texture coordinates.
Definition: TerrainMaterialDef.h:200
const QString & getBevelTexture() const
Returns the graphics root relative path to the bevel texture.
Definition: TerrainMaterialDef.h:110
BlendMode
Blend modes used to mix the bevel texture with the base texture.
Definition: TerrainMaterialDef.h:47
void setBaseTexture(const QString &value)
Sets the graphics root relative path to the base texture.
float getEdgeWidth() const
Returns the width of the edge, in world coordinates.
Definition: TerrainMaterialDef.h:156
void setEdgeOffset(float value)
Sets the offset to apply to the start of the edge polygon's texture coordinates, to shift the start o...
void setBevelTexture(const QString &value)
Sets the graphics root relative path to the bevel texture.
TerrainMaterialDef()
Construct a default TerrainMaterialDef.
Definition of a terrain material.
Definition: TerrainMaterialDef.h:42
void setBlendMode(BlendMode value)
Returns the blend mode used to composite the bevel texture over the base texture. ...
void setEdgeWidth(float value)
Sets the width of the edge, in world coordinates.
float getEdgeOffset() const
Returns the offset to apply to the start of the edge polygon's texture coordinates.
Definition: TerrainMaterialDef.h:173
void setBevelScale(float value)
Sets the horizontal scaling factor on bevel texture coordinates, controlling the tightness of tiling...