![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
#include <Material.hpp>
Public Types | |
enum | LightingModel : uint64 { LightingModel::None = 0ull, LightingModel::Gouraud = 1ull << 63, LightingModel::Flat = Gouraud | Gouraud >> 1, LightingModel::Phong = Gouraud >> 2, LightingModel::BlinnPhong = Phong | Phong >> 1, LightingModel::Default } |
enum | Reflection { Reflection::Ambient, Reflection::Diffuse, Reflection::Specular, Reflection::Emission } |
enum | Map : uint64 { Map::Diffuse0, Map::Specular, Map::Emission, Map::Environment, Map::Reflection, Map::Opacity, Map::Gloss, Map::__Last } |
Public Member Functions | |
JOP_DISALLOW_COPY_MOVE (Material) | |
Material (const Material &other, const std::string &newName) | |
Material (const std::string &name) | |
Constructor. More... | |
void | sendToShader (ShaderProgram &shader) const |
Send this material to a shader. More... | |
Material & | setLightingModel (const LightingModel model) |
Set the lighting model. More... | |
LightingModel | getLightingModel () const |
Get the lighting model. More... | |
Material & | setReflection (const Reflection reflection, const Color &color) |
Set a reflection value. More... | |
Material & | setReflection (const Color &ambient, const Color &diffuse, const Color &specular, const Color &emission) |
Set the reflection values. More... | |
const Color & | getReflection (const Reflection reflection) const |
Get a reflection value. More... | |
Material & | setShininess (const float value) |
Set the shininess value. More... | |
float | getShininess () const |
Get the shininess value. More... | |
Material & | setReflectivity (const float reflectivity) |
Set the reflectivity. More... | |
float | getReflectivity () const |
Get the reflectivity value. More... | |
Material & | setMap (const Map map, const Texture &tex) |
Set a map. More... | |
Material & | removeMap (const Map map) |
Remove a map. More... | |
const Texture * | getMap (const Map map) const |
Get a map. More... | |
bool | hasAlpha () const |
Check if this material has potential transparency. More... | |
ShaderProgram & | getShader () const |
Get the shader for this material. More... | |
uint64 | getAttributes () const |
Get the internal attribute field. More... | |
![]() | |
Resource (const std::string &name) | |
Constructor. More... | |
virtual | ~Resource ()=0 |
Virtual destructor. More... | |
const std::string & | getName () const |
Get the name of this resource. More... | |
void | setPersistence (const unsigned short level) |
Set the persistence level. More... | |
unsigned short | getPersistence () const |
Get the persistence level. More... | |
![]() | |
WeakReference< Resource > | getReference () const |
Get a weak reference to the bound object. More... | |
![]() | |
SerializeInfo () | |
void | setSerializePackage (const uint16 package) |
uint16 | getSerializePackage () const |
void | setShouldSerialize (const bool set) |
bool | shouldSerialize () const |
void | setLightSerializeable (const bool set) |
bool | isLightSerializeable () const |
Static Public Member Functions | |
static Material & | getDefault () |
Get the default material. More... | |
Static Public Attributes | |
static const uint64 | LightingAttribs |
Friends | |
class | ShaderAssembler |
Additional Inherited Members | |
![]() | |
Resource (const Resource &other, const std::string &newName) | |
Copy constructor. More... | |
![]() | |
SafeReferenceable (Resource *ref) | |
Constructor. More... | |
SafeReferenceable (SafeReferenceable< Resource > &&other) | |
Move constructor. More... | |
SafeReferenceable & | operator= (SafeReferenceable< Resource > &&other) |
Move assignment operator. More... | |
~SafeReferenceable () | |
Protected destructor. More... | |
Definition at line 40 of file Material.hpp.
|
strong |
Definition at line 52 of file Material.hpp.
|
strong |
The map attribute
Definition at line 127 of file Material.hpp.
|
strong |
The reflection attribute
Definition at line 117 of file Material.hpp.
jop::Material::Material | ( | const Material & | other, |
const std::string & | newName | ||
) |
jop::Material::Material | ( | const std::string & | name | ) |
Constructor.
name | Name of the resource. This must be the file path if this resource is loaded from a file. |
By default the material defines no functionality (only Drawable's color will be used in rendering).
uint64 jop::Material::getAttributes | ( | ) | const |
Get the internal attribute field.
This is for internal use only.
|
static |
Get the default material.
The default material has no attributes, meaning only the Drawable color will be used.
LightingModel jop::Material::getLightingModel | ( | ) | const |
Get the lighting model.
Get a map.
map | The map enum |
const Color& jop::Material::getReflection | ( | const Reflection | reflection | ) | const |
Get a reflection value.
reflection | The reflection attribute |
float jop::Material::getReflectivity | ( | ) | const |
Get the reflectivity value.
ShaderProgram& jop::Material::getShader | ( | ) | const |
Get the shader for this material.
float jop::Material::getShininess | ( | ) | const |
Get the shininess value.
bool jop::Material::hasAlpha | ( | ) | const |
Check if this material has potential transparency.
jop::Material::JOP_DISALLOW_COPY_MOVE | ( | Material | ) |
Remove a map.
map | The map to remove |
void jop::Material::sendToShader | ( | ShaderProgram & | shader | ) | const |
Send this material to a shader.
shader | Reference to the shader to send this material to |
Material& jop::Material::setLightingModel | ( | const LightingModel | model | ) |
Set the lighting model.
model | The lighting model to set |
Set a map.
map | The map enum |
tex | Reference to the texture |
Material& jop::Material::setReflection | ( | const Reflection | reflection, |
const Color & | color | ||
) |
Set a reflection value.
reflection | The reflection attribute |
color | The reflection color |
Material& jop::Material::setReflection | ( | const Color & | ambient, |
const Color & | diffuse, | ||
const Color & | specular, | ||
const Color & | emission | ||
) |
Set the reflection values.
ambient | The ambient reflection |
diffuse | The diffuse reflection |
specular | The specular reflection |
emission | The emission value |
Material& jop::Material::setReflectivity | ( | const float | reflectivity | ) |
Set the reflectivity.
Do not confuse this with reflection. What this defines is how strongly an environment map is reflected. 0 means there's no reflection and 1 makes the surface mirror-like. This attribute has no effect if there's no environment map
reflectivity | The reflectivity value |
Material& jop::Material::setShininess | ( | const float | value | ) |
Set the shininess value.
value | The shininess value |
|
friend |
Definition at line 48 of file Material.hpp.
|
static |
All the lighting model attributes combined
For internal use only.
Definition at line 164 of file Material.hpp.