OGRE: Ogre::HlmsUnlitDatablock Class Reference

| OGRE 2.2.4 Object-Oriented Graphics Rendering Engine

Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
Ogre::HlmsUnlitDatablock Class Reference
Core » Resources

Contains information needed by PBS (Physically Based Shading) for OpenGL 3+ & D3D11+. More...

`#include <OgreHlmsUnlitDatablock.h>`

Inheritance diagram for Ogre::HlmsUnlitDatablock:
[legend]

## Public Member Functions
| HlmsUnlitDatablock (IdString name, HlmsUnlit *creator, const HlmsMacroblock *macroblock, const HlmsBlendblock *blendblock, const HlmsParamVec &params)
| Valid parameters in params: More...
virtual | ~HlmsUnlitDatablock ()
virtual void | calculateHash ()
const Matrix4 & | getAnimationMatrix (uint8 textureUnit) const
UnlitBlendModes | getBlendMode (uint8 texType) const
ColourValue | getColour (void) const
| Gets the current colour. The returned value is meaningless if mHasColour is false. More...
virtual ColourValue | getDiffuseColour (void) const
virtual ColourValue | getEmissiveColour (void) const
virtual TextureGpu * | getEmissiveTexture (void) const
bool | getEnableAnimationMatrix (uint8 textureUnit) const
bool | getEnablePlanarReflection (uint8 textureUnit) const
uint8 | getTextureUvSource (uint8 sourceType) const
bool | hasColour (void) const
| If this returns false, the values of mR, mG, mB & mA will be ignored. More...
void | setAnimationMatrix (uint8 textureUnit, const Matrix4 &matrix)
void | setBlendMode (uint8 texType, UnlitBlendModes blendMode)
| Sets the blending mode (how the texture unit gets layered on top of the previous texture units). More...
void | setColour (const ColourValue &diffuse)
| Sets a new colour value. Asserts if mHasColour is false. More...
void | setEnableAnimationMatrix (uint8 textureUnit, bool bEnable)
| Enables the animation of the given texture unit. More...
void | setEnablePlanarReflection (uint8 textureUnit, bool bEnable)
| Set to true if the texture at the given texture unit is a planar reflection texture. More...
void | setTexture (uint8 texUnit, const String &name, const HlmsSamplerblock *refParams=0)
void | setTextureSwizzle (uint8 texType, uint8 r, uint8 g, uint8 b, uint8 a)
| Sets the final swizzle when sampling the given texture. More...
void | setTextureUvSource (uint8 sourceType, uint8 uvSet)
| Sets which UV set to use for the given texture. More...
void | setUseColour (bool useColour)
| Controls whether the value in. More...

## Public Attributes
Matrix4 | mTextureMatrices [NUM_UNLIT_TEXTURE_TYPES]

## Static Public Attributes
static const uint8 | A_MASK
static const uint8 | B_MASK
static const uint8 | G_MASK
static const size_t | MaterialSizeInGpu
static const size_t | MaterialSizeInGpuAligned
static const uint8 | R_MASK

## Friends
class | HlmsUnlit

## Detailed Description

Contains information needed by PBS (Physically Based Shading) for OpenGL 3+ & D3D11+.

## Constructor & Destructor Documentation

## ◆ HlmsUnlitDatablock()

Ogre::HlmsUnlitDatablock::HlmsUnlitDatablock | ( | IdString | name,
|  | HlmsUnlit * | creator,
|  | const HlmsMacroblock * | macroblock,
|  | const HlmsBlendblock * | blendblock,
|  | const HlmsParamVec & | params
| ) |  |

Valid parameters in params:

Parameters

  params | diffuse [r g b [a]] If absent, the values of mR, mG, mB & mA will be ignored by the pixel shader. When present, the rgba values can be specified. Default: Absent Default (when present): diffuse 1 1 1 1

diffuse_map [texture name] [#uv] Name of the diffuse texture for the base image (optional, otherwise a dummy is set) The #uv parameter is optional, and specifies the texcoord set that will be used. Valid range is [0; 8) If the Renderable doesn't have enough UV texcoords, HLMS will throw an exception.

Note: The UV set is evaluated when creating the Renderable cache.

diffuse_map1 [texture name] [blendmode] [#uv] Name of the diffuse texture that will be layered on top of the base image. The #uv parameter is optional. Valid range is [0; 8) The blendmode parameter is optional. Valid values are: NormalNonPremul, NormalPremul, Add, Subtract, Multiply, Multiply2x, Screen, Overlay, Lighten, Darken, GrainExtract, GrainMerge, Difference which are very similar to Photoshop/GIMP's blend modes. See Samples/Media/Hlms/GuiMobile/GLSL/BlendModes_piece_ps.glsl for the exact math. Default blendmode: NormalPremul Default uv: 0 Example: diffuse_map1 myTexture.png Add 3

diffuse_map2 through diffuse_map16 Same as diffuse_map1 but for subsequent layers to be applied on top of the previous images. You can't leave gaps (i.e. specify diffuse_map0 & diffuse_map2 but not diffuse_map1). Note that not all mobile HW supports 16 textures at the same time, thus we will just cut/ignore the extra textures that won't fit (we log a warning though).

animate <#tex_unit> [<#tex_unit> <#tex_unit> ... <#tex_unit>] Enables texture animation through a 4x4 matrix for the specified textures. Default: All texture animation/manipulation disabled. Example: animate 0 1 2 3 4 14 15

alpha_test [compare_func] [threshold] When present, mAlphaTestThreshold is used. compare_func is optional. Valid values are: less, less_equal, equal, greater, greater_equal, not_equal Threshold is optional, and a value in the range (0; 1) Default: alpha_test less 0.5 Example: alpha_test equal 0.1

## ◆ ~HlmsUnlitDatablock()

virtual Ogre::HlmsUnlitDatablock::~HlmsUnlitDatablock | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ calculateHash()

virtual void Ogre::HlmsUnlitDatablock::calculateHash | ( |  | ) |
| virtual

## ◆ getAnimationMatrix()

const Matrix4& Ogre::HlmsUnlitDatablock::getAnimationMatrix | ( | uint8 | textureUnit | ) | const

## ◆ getBlendMode()

UnlitBlendModes Ogre::HlmsUnlitDatablock::getBlendMode | ( | uint8 | texType | ) | const

## ◆ getColour()

ColourValue Ogre::HlmsUnlitDatablock::getColour | ( | void |  | ) | const
| inline

Gets the current colour. The returned value is meaningless if mHasColour is false.

## ◆ getDiffuseColour()

virtual ColourValue Ogre::HlmsUnlitDatablock::getDiffuseColour | ( | void |  | ) | const
| virtual

## ◆ getEmissiveColour()

virtual ColourValue Ogre::HlmsUnlitDatablock::getEmissiveColour | ( | void |  | ) | const
| virtual

## ◆ getEmissiveTexture()

virtual TextureGpu* Ogre::HlmsUnlitDatablock::getEmissiveTexture | ( | void |  | ) | const
| virtual

## ◆ getEnableAnimationMatrix()

bool Ogre::HlmsUnlitDatablock::getEnableAnimationMatrix | ( | uint8 | textureUnit | ) | const

## ◆ getEnablePlanarReflection()

bool Ogre::HlmsUnlitDatablock::getEnablePlanarReflection | ( | uint8 | textureUnit | ) | const

## ◆ getTextureUvSource()

uint8 Ogre::HlmsUnlitDatablock::getTextureUvSource | ( | uint8 | sourceType | ) | const

## ◆ hasColour()

bool Ogre::HlmsUnlitDatablock::hasColour | ( | void |  | ) | const
| inline

If this returns false, the values of mR, mG, mB & mA will be ignored.

See also
  setUseColour.

## ◆ setAnimationMatrix()

void Ogre::HlmsUnlitDatablock::setAnimationMatrix | ( | uint8 | textureUnit,
|  | const Matrix4 & | matrix
| ) |  |

## ◆ setBlendMode()

void Ogre::HlmsUnlitDatablock::setBlendMode | ( | uint8 | texType,
|  | UnlitBlendModes | blendMode
| ) |  |

Sets the blending mode (how the texture unit gets layered on top of the previous texture units).

Calling this function triggers a HlmsDatablock::flushRenderables.

Parameters

  texType | The texture unit. Must be in range [1; NUM_UNLIT_TEXTURE_TYPES) The value 0 is ignored.
  blendMode | The blending mode to use.

## ◆ setColour()

void Ogre::HlmsUnlitDatablock::setColour | ( | const ColourValue & | diffuse | ) |

Sets a new colour value. Asserts if mHasColour is false.

## ◆ setEnableAnimationMatrix()

void Ogre::HlmsUnlitDatablock::setEnableAnimationMatrix | ( | uint8 | textureUnit,
|  | bool | bEnable
| ) |  |

Enables the animation of the given texture unit.

Calling this function triggers a HlmsDatablock::flushRenderables.

Parameters

  textureUnit | Texture unit. Must be in range [0; NUM_UNLIT_TEXTURE_TYPES)
  bEnable | Whether to enable or disable. Default is disabled.

## ◆ setEnablePlanarReflection()

void Ogre::HlmsUnlitDatablock::setEnablePlanarReflection | ( | uint8 | textureUnit,
|  | bool | bEnable
| ) |  |

Set to true if the texture at the given texture unit is a planar reflection texture.

UVs will be ignored for that texture unit. Calling this function triggers a HlmsDatablock::flushRenderables.

Parameters

  textureUnit | Texture unit. Must be in range [0; NUM_UNLIT_TEXTURE_TYPES)
  bEnable | Whether to enable or disable. Default is disabled.

## ◆ setTexture()

void Ogre::HlmsUnlitDatablock::setTexture | ( | uint8 | texUnit,
|  | const String & | name,
|  | const HlmsSamplerblock * | refParams = `0`
| ) |  |

## ◆ setTextureSwizzle()

void Ogre::HlmsUnlitDatablock::setTextureSwizzle | ( | uint8 | texType,
|  | uint8 | r,
|  | uint8 | g,
|  | uint8 | b,
|  | uint8 | a
| ) |  |

Sets the final swizzle when sampling the given texture.

e.g. calling setTextureSwizzle( 0, R_MASK, G_MASK, R_MASK, G_MASK ); will generated the following pixel shader: vec4 texColour = texture( tex, uv ).xyxy;

Calling this function triggers a HlmsDatablock::flushRenderables.

Parameters

  texType | Texture unit. Must be in range [0; NUM_UNLIT_TEXTURE_TYPES)
  r | Where to source the red channel from. Must be R_MASK, G_MASK, B_MASK or A_MASK. Default: R_MASK
  g | Where to source the green channel from. Default: G_MASK
  b | Where to source the blue channel from. Default: B_MASK
  a | Where to source the alpha channel from. Default: A_MASK

## ◆ setTextureUvSource()

void Ogre::HlmsUnlitDatablock::setTextureUvSource | ( | uint8 | sourceType,
|  | uint8 | uvSet
| ) |  |

Sets which UV set to use for the given texture.

Calling this function triggers a HlmsDatablock::flushRenderables.

Parameters

  sourceType | Source texture to modify. Must be in range [0; NUM_UNLIT_TEXTURE_TYPES)
  uvSet | UV coordinate set. Value must be between in range [0; 8)

## ◆ setUseColour()

void Ogre::HlmsUnlitDatablock::setUseColour | ( | bool | useColour | ) |

Controls whether the value in.

See also
  setColour is used. Calling this function implies calling see HlmsDatablock::flushRenderables.

## Friends And Related Function Documentation

## ◆ HlmsUnlit

friend class HlmsUnlit
| friend

## Member Data Documentation

## ◆ A_MASK

const uint8 Ogre::HlmsUnlitDatablock::A_MASK
| static

## ◆ B_MASK

const uint8 Ogre::HlmsUnlitDatablock::B_MASK
| static

## ◆ G_MASK

const uint8 Ogre::HlmsUnlitDatablock::G_MASK
| static

## ◆ MaterialSizeInGpu

const size_t Ogre::HlmsUnlitDatablock::MaterialSizeInGpu
| static

## ◆ MaterialSizeInGpuAligned

const size_t Ogre::HlmsUnlitDatablock::MaterialSizeInGpuAligned
| static

## ◆ mTextureMatrices

Matrix4 Ogre::HlmsUnlitDatablock::mTextureMatrices[NUM_UNLIT_TEXTURE_TYPES]

## ◆ R_MASK

const uint8 Ogre::HlmsUnlitDatablock::R_MASK
| static

The documentation for this class was generated from the following file:

- OgreHlmsUnlitDatablock.h