Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-07-29 23:38:07 +0000
committerStijn Buys <ingar@osirion.org>2011-07-29 23:38:07 +0000
commit044d0183e254d89dd12d0799be6aa8f8f0f979f2 (patch)
tree285ec77a8cf5ac57fb17f4168272e1a600e13917 /src/render/state.h
parent8924c07280cdd96b01c501b3b820711f89039edd (diff)
Moved material context functions into the State class.
Diffstat (limited to 'src/render/state.h')
-rw-r--r--src/render/state.h86
1 files changed, 74 insertions, 12 deletions
diff --git a/src/render/state.h b/src/render/state.h
index 6387be8..b614c1b 100644
--- a/src/render/state.h
+++ b/src/render/state.h
@@ -7,6 +7,7 @@
#ifndef __INCLUDED_RENDER_STATE_H__
#define __INCLUDED_RENDER_STATE_H__
+#include "core/entity.h"
#include "render/gl.h"
namespace render
@@ -15,41 +16,102 @@ namespace render
class State
{
public:
+ /* ---- render context ------------------------------------- */
+
+ /**
+ * @brief Initialize the render state
+ **/
static void init(int width, int height);
+
+ /**
+ * @brief Initialize the render state
+ **/
static void shutdown();
+ /**
+ * @brief Resize the render context
+ **/
static void resize(int width, int height);
+
+ /**
+ * @brief Clear the render context state
+ **/
static void clear();
+
+ /* ---- material context ----------------------------------- */
+
+ /**
+ * @brief Reset the material context
+ **/
+ static void reset();
+ /**
+ * @brief Set the primary color of the material context
+ * set_color() should be used before calling set_material().
+ **/
+ static void set_color(const math::Color & color);
+
+ /**
+ * @brief Set the secondary color of the material context
+ * set_color_second() should be used before calling set_material().
+ **/
+ static void set_color_second(const math::Color & color);
+
+ /**
+ * @brief Set the engine color of the material context
+ * set_color_engine() should be used before calling set_material().
+ **/
+ static void set_color_engine(const math::Color & color);
+
+ /**
+ * @brief Copy primary, secondary and engine color from an entity
+ * set_color() should be used before calling set_material().
+ **/
+ static void set_color(const core::Entity *entity);
+
+ /**
+ * @brief Set the material context
+ * use_material() will alter the current render context according to the settings
+ * defined by the material. If the material uses primary, secondary or engine color,
+ * the current material context colors will be used.
+ **/
+ static void use_material(const model::Material * material);
+
+
inline static int width() {
- return render_width;
+ return state_width;
}
inline static int height() {
- return render_height;
+ return state_height;
}
inline static float aspect() {
- return render_aspect;
+ return state_aspect;
}
inline static bool has_generate_mipmaps() {
- return render_has_generate_mipmaps;
+ return state_has_generate_mipmaps;
}
inline static bool has_vbo() {
- return render_has_vbo;
+ return state_has_vbo;
}
inline static GLuint vbo() {
- return render_vbo;
+ return state_vbo;
}
static void set_normalize(const bool enable=true);
private:
- static int render_width;
- static int render_height;
+ static int state_width;
+ static int state_height;
- static float render_aspect;
- static bool render_has_generate_mipmaps;
- static bool render_has_vbo;
- static GLuint render_vbo;
+ static float state_aspect;
+ static bool state_has_generate_mipmaps;
+ static bool state_has_vbo;
+ static GLuint state_vbo;
+
+ static math::Color state_color_primary; // current primary color
+ static math::Color state_color_secondary; // current secondary color
+ static math::Color state_color_engine; // current secondary color
+
};
} // namespace render