soucres and ambient lighting to produce the base color of a surface. Textures
can be used to add detail.
-Material provides a set of uniform variables for use with shaders. Standard
-shaders generated by ProgramBuilder only use it when legacy mode is disabled.
-
-In legacy mode, materials are applied with several calls to glMaterial.
+Material provides a set of uniform variables for use with shaders.
*/
-class Material: public BindableWithDefault<Material>
+class Material
{
public:
class Loader: public DataFile::CollectionObjectLoader<Material>
};
private:
- enum ParameterMask
- {
- AMBIENT = 1,
- DIFFUSE = 2,
- SPECULAR = 4,
- EMISSION = 8,
- SHININESS = 16
- };
-
Color ambient;
Color diffuse;
Color specular;
public:
Material();
-private:
- void update_parameter(int) const;
-
-public:
/** Sets the ambient color of the material. Provided to shaders with the
name material.ambient. */
void set_ambient(const Color &);
float get_shininess() const { return shininess; }
float get_reflectivity() const { return reflectivity; }
- /** Returns the uniforms for the material. Not needed for shaders that use
- the legacy built-in uniform gl_FrontMaterial and have no reflections. */
+ /** Returns the uniforms for the material. */
const ProgramData &get_shader_data() const { return shdata; }
-
- void bind() const;
};
} // namespace GL