27 #if defined(REQUIRE_GL_ES)
52 : diffuse(ambient_and_diffuse),
53 ambient(ambient_and_diffuse),
65 return 0.1f * float(log(m_power)/log(2.0
f));
69 m_power = float(pow(2.0
f, 10.0
f * shininess));
82 #ifndef DISABLE_GL_FIXED
87 if(!(m_optimization & (1 << 0)))
89 if(!(m_optimization & (1 << 1)))
91 if(!(m_optimization & (1 << 2)))
93 if(!(m_optimization & (1 << 3)))
95 if(!(m_optimization & (1 << 4)))
101 if(!(m_optimization & (1 << 5)) &&
102 !m_texture.
empty()) {
116 if(!(m_optimization & (1 << 11)) &&
122 #ifndef DISABLE_GL_SHADER
127 if(!(m_optimization & (1 << 0)))
129 if(!(m_optimization & (1 << 1)))
131 if(!(m_optimization & (1 << 2)))
133 if(!(m_optimization & (1 << 3)))
135 if(!(m_optimization & (1 << 4)))
141 if(!(m_optimization & (1 << 5)) &&
142 !m_texture.
empty()) {
156 if(!(m_optimization & (1 << 11)) &&
165 if((m_optimization & ((1 << 5) - 1)) != 0x1F)
166 vdx.
get_d3d_device()->SetMaterial(reinterpret_cast<const D3DMATERIAL9 *>(
this));
171 if(!(m_optimization & (1 << 5)) &&
177 if(!(m_optimization & (1 << 11)) &&
184 return m_texture < rhs.m_texture || (m_texture == rhs.m_texture &&
189 m_power < rhs.m_power)))))))));
193 return m_texture == rhs.m_texture &&
198 m_power == rhs.m_power;
202 m_optimization &= 0xFFFFFFC0;
205 m_optimization |= (1 << 0);
207 m_optimization |= (1 << 1);
209 m_optimization |= (1 << 2);
211 m_optimization |= (1 << 3);
212 if(m_power == rhs.m_power)
213 m_optimization |= (1 << 4);
214 if(m_texture == rhs.m_texture)
215 m_optimization |= (1 << 5);
219 m_optimization &= 0xFFFFF03F;
222 m_optimization |= (1 << 6);
224 m_optimization |= (1 << 7);
226 m_optimization |= (1 << 8);
228 m_optimization |= (1 << 9);
229 if(m_power == rhs.m_power)
230 m_optimization |= (1 << 10);
231 if(m_texture == rhs.m_texture)
232 m_optimization |= (1 << 11);
void set_Color(const Color &color)
Set the current color.
void optimize_to_follow(const Material &rhs)
If this Material will be set regularly after another Material, and only after that other Material...
The Direct3D9 Rendering System.
LPDIRECT3DDEVICE9 & get_d3d_device()
See DirectX Documentation for details.
#define ZENI_DEFAULT_MATERIAL_EMISSIVE
Color specular
The specular Color.
static bool get_lighting()
Determine whether dynamic lighting is enabled.
void apply_Texture(const String &name)
Apply a texture by name.
#define ZENI_DIFFUSE_TO_SPECULAR(d)
An Abstraction of a Material.
float get_shininess() const
Get the shininess of the Material (indicates the focus of the specular highlights - logarithmically t...
unsigned long get_id(const String &name) const
Get an id by name, possibly throwing an Error.
#define GL_FRONT_AND_BACK
bool operator==(const Material &rhs) const
A simple equality test. Close hits are misses.
void unset(Video_GL_Fixed &screen) const
The OpenGL Rendering System.
void apply_Texture(const String &name)
Apply a texture by name.
void unapply_Texture()
Unapply a texture.
void unapply_Texture()
Unapply a texture.
Color ambient
The ambient Color.
The OpenGL Rendering System.
Color diffuse
The diffuse Color.
Color emissive
The emissive Color.
void optimize_to_precede(const Material &rhs)
If this Material will be set regularly before another Material, and only before that other Material...
void set_Color(const Color &)
Set the current color.
Material(const Color &ambient=ZENI_DEFAULT_MATERIAL_DIFFUSE, const Color &diffuse=ZENI_DEFAULT_MATERIAL_DIFFUSE, const Color &specular=ZENI_DEFAULT_MATERIAL_SPECULAR, const Color &emissive=ZENI_DEFAULT_MATERIAL_EMISSIVE, const float &power=ZENI_DEFAULT_MATERIAL_POWER, const String &texture="")
An Alternative to the numerous setter functions.
void set(Video_GL_Fixed &screen) const
Textures & get_Textures()
Get access to the singleton.
void set_shininess(const float &shininess)
Set the shininess of the Material (indicates the focus of the specular highlights - logarithmically t...
GLenum GLenum GLuint texture
bool operator<(const Material &rhs) const
To provide an arbitrary total ordering. Do not depend on it remaining the same in the future...
void set_Color(const Color &color)
Set the current color.
#define ZENI_DEFAULT_MATERIAL_POWER
void clear_optimization()
Simply undo any previous optimizations.
void unapply_Texture()
Unapply a texture.
void apply_Texture(const String &name)
Apply a texture by name.
void set_Texture(const String &texture)
Set the texture identifier.