Material Class Reference

#include <Material.h>

Description

Defines how an AspectMesh is visualized.

Data Structures

struct  State
 

Public Types

enum  CoreProgram {
  Basic,
  Lighting
}
 
enum  TextureSlot {
  Color,
  Normal,
  Shiny
}
 

Functions

void SetProgram (CoreProgram)
 
void SetProgram (ProgramID)
 
void AddTexture (TextureSlot, AssetID image)
 
void SetFramebufferSource (Camera &)
 
void NextTextureFrame ()
 

Properties

State state
 

Member Enumeration Documentation

enum CoreProgram
strong

The shader type alters how the attributes of the Material are interpreted.

Enumerator
Basic 

Default material. No lighting. The color is determined by the Ambient color.

Lighting 

Lighting material. The lighting shader is guaranteed to follow and Phong-like shading model.

enum TextureSlot
strong
Enumerator
Color 

Interprets the texture as an RGBA texture.

Normal 

Interprets the texture as a normal map. Each 4-pixel component is interpreted as a normal vector, using rgb saturation values as xyz directions respectively. The alpha component is ignored.

Shiny 

Interprets the texture as a shiny map. Each red component of each 4-pixel is interpreted as a shiny value. The bga values are ignored.

Member Function Documentation

void SetProgram ( CoreProgram  )

Alters the rendering method to a built-in rendering program.

void SetProgram ( ProgramID  )

Alters the rendering method to a shader program.

void AddTexture ( TextureSlot  ,
AssetID  image 
)

Adds a texture to be drawn.

How textures interact with the mesh is dependent on the Material attached with SetMaterial(). If the Material is using a Material::CoreProgram, TextureSlot::Color will be used as an RGBA texture, TextureSlot::Normal will be used as a lighting normal map, and TextureSlot::Shiny will be used as a light reflectivity map. For user-made programs using Shader, the first argument refers to what texture slot you can access the texture from in the shader programming language. Refer to Shader for more info. Note that using TextureSlot::Color, TextureSlot::Normal, and TextureSlot::Shiny is equivalent to calling AddTexture() with 0, 1, and 2 respectively as the texture slot argument.

void SetFramebufferSource ( Camera )

Sets the given camera as the source framebuffer.

The source framebuffer is an optional input you can specify to utilize the last known visual of the camera as a texture source. This can be used in a few different ways. Once its set, Material::CoreProgram s will map it as another texture binding. To disable this, simple SetFramebufferSource again with a default CameraID(). If your material uses a custom shader, the shader can access if through the Dynacoe_SampleFramebuffer function.

void NextTextureFrame ( )

Iterates all textures to the next texture frame.

Field Documentation

State state

Public state of the Material.


The documentation for this class was generated from the following file:
  • /home/jc/git/Dynacoe/DynacoeSrc/includes/Dynacoe/Material.h