Index: trunk/nv/interface/clear_state.hh
===================================================================
--- trunk/nv/interface/clear_state.hh	(revision 31)
+++ trunk/nv/interface/clear_state.hh	(revision 31)
@@ -0,0 +1,86 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+/**
+ * @file clear_state.hh
+ * @author Kornel Kisielewicz epyon@chaosforge.org
+ * @brief Clear state class
+ */
+
+#ifndef NV_CLEAR_STATE_HH
+#define NV_CLEAR_STATE_HH
+
+#include <nv/common.hh>
+#include <nv/types.hh>
+
+namespace nv
+{
+
+	struct color_mask
+	{
+		bool red;
+		bool green;
+		bool blue;
+		bool alpha;
+
+		color_mask() : red( true ), blue( true ), green( true ), alpha( true ) {}
+		color_mask( bool red, bool green, bool blue, bool alpha )
+			: red( red ), green( green ), blue( blue ), alpha( alpha ) {}
+
+		bool operator==(const color_mask& rhs) const
+		{
+			return (rhs.red == red) && (rhs.green == green) && (rhs.blue == blue) && (rhs.alpha == alpha);
+		}
+		bool operator!=(const color_mask& rhs) const
+		{
+			return !operator==(rhs);
+		}
+	};
+
+	struct scissor_test
+	{
+		bool enabled;
+		ivec2 pos;
+		ivec2 dim;
+
+		scissor_test() :
+		enabled( false ),
+			pos(), dim()
+		{}
+	};
+
+	struct clear_state
+	{
+		enum buffers_type
+		{
+			COLOR_BUFFER = 1,
+			DEPTH_BUFFER = 2,
+			STENCIL_BUFFER = 4,
+			COLOR_AND_DEPTH_BUFFER = COLOR_BUFFER | DEPTH_BUFFER, 
+			ALL = COLOR_BUFFER | DEPTH_BUFFER | STENCIL_BUFFER
+		};
+
+		scissor_test scissor_test;
+		color_mask color_mask;
+		bool depth_mask;
+		uint32 front_stencil_mask;
+		uint32 back_stencil_mask;
+
+		buffers_type buffers;
+		vec4 color;
+		float depth;
+		int stencil;
+
+		clear_state() 
+			: scissor_test(), color_mask(), depth_mask( true ), 
+			  front_stencil_mask( uint32(-1) ), back_stencil_mask( uint32(-1) ),
+			  buffers( ALL ), color( vec4(0,0,0,1) ), depth( 1.0f ), stencil( 0 ) {}
+	};
+
+} // namespace nv
+
+
+#endif // NV_CLEAR_STATE_HH
Index: trunk/nv/interface/render_state.hh
===================================================================
--- trunk/nv/interface/render_state.hh	(revision 31)
+++ trunk/nv/interface/render_state.hh	(revision 31)
@@ -0,0 +1,191 @@
+// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+/**
+ * @file render_state.hh
+ * @author Kornel Kisielewicz epyon@chaosforge.org
+ * @brief Render state class
+ */
+
+#ifndef NV_RENDER_STATE_HH
+#define NV_RENDER_STATE_HH
+
+#include <nv/common.hh>
+#include <nv/types.hh>
+#include <nv/interface/clear_state.hh>
+#include <nv/string.hh>
+
+namespace nv
+{
+	struct depth_test
+	{
+		enum function_type
+		{
+			NEVER,
+			LESS,
+			EQUAL,
+			LESS_OR_EQUAL,
+			GREATER,
+			NOT_EQUAL,
+			GREATER_OR_EQUAL,
+			ALWAYS
+		};
+		
+		bool enabled;
+		function_type function;
+
+		depth_test() : enabled( true ), function( LESS ) {}
+	};
+
+	struct blending
+	{
+		enum factor
+		{
+			ZERO,
+			ONE,
+			SRC_COLOR,
+			SRC_ALPHA,
+			DST_COLOR,
+			DST_ALPHA,
+			CONSTANT_COLOR,
+			CONSTANT_ALPHA,
+			ONE_MINUS_SRC_COLOR,
+			ONE_MINUS_SRC_ALPHA,
+			ONE_MINUS_DST_COLOR,
+			ONE_MINUS_DST_ALPHA,
+			ONE_MINUS_CONSTANT_COLOR,
+			ONE_MINUS_CONSTANT_ALPHA,
+			SRC_ALPHA_SATURATE,
+		};
+
+		enum equation
+		{
+			ADD,
+			MINIMUM,
+			MAXIMUM,
+			SUBTRACT,
+			REVERSE_SUBTRACT,
+		};
+
+		bool enabled;
+		factor src_rgb_factor;
+		factor src_alpha_factor;
+		factor dst_rgb_factor;
+		factor dst_alpha_factor;
+		equation rgb_equation;
+		equation alpha_equation;
+		vec4 color;
+
+		blending() :
+			src_rgb_factor( ONE ), src_alpha_factor( ONE ), 
+			dst_rgb_factor( ZERO ), dst_alpha_factor( ZERO ), 
+			rgb_equation( ADD ), alpha_equation( ADD ),
+			color( vec4() ) {}
+	};
+
+	struct stencil_test_face
+	{
+		enum operation
+		{
+			ZERO,
+			INVERT,
+			KEEP,
+			REPLACE,
+			INCREMENT,
+			DECREMENT,
+			INCREMENT_WRAP,
+			DECREMENT_WRAP
+		};
+
+		enum function_type
+		{
+			NEVER,
+			LESS,
+			EQUAL,
+			LESS_OR_EQUAL,
+			GREATER,
+			NOT_EQUAL,
+			GREATER_OR_EQUAL,
+			ALWAYS
+		};
+
+		operation op_fail;
+		operation op_depth_pass;
+		operation op_depth_fail;
+
+		function_type function;
+		int ref_value;
+		uint32 mask;
+
+		stencil_test_face()	:
+			op_fail( KEEP ),
+			op_depth_pass( KEEP ),
+			op_depth_fail( KEEP ),
+			function( ALWAYS ),
+			ref_value( 0 ),
+			mask( uint32(-1) )
+		{}
+	};
+
+	struct stencil_test
+	{
+		bool enabled;
+		stencil_test_face front_face;
+		stencil_test_face back_face;
+
+		stencil_test() :
+			enabled( false ),
+			front_face(),
+			back_face()
+		{}
+	};
+	
+	struct culling
+	{
+		enum face_type
+		{
+			FRONT,
+			BACK,
+			FRONT_AND_BACK
+		};
+
+		enum order_type
+		{
+			CW,
+			CCW
+		};
+
+		bool enabled;
+		face_type face;
+		order_type order;
+
+		culling() : enabled( true ), face( BACK ), order( CCW ) {}
+	};
+
+	struct depth_range
+	{
+		f64 near;
+		f64 far;
+
+		depth_range() : near(0.0), far(1.0) {}
+	};
+
+	struct render_state
+	{
+		nv::stencil_test stencil_test;
+		nv::depth_test   depth_test;
+		nv::scissor_test scissor_test;
+		nv::depth_range  depth_range;
+		nv::blending     blending;
+		nv::culling      culling;
+		nv::color_mask   color_mask;
+		bool depth_mask;
+	};
+
+} // namespace nova
+
+
+#endif // NOVA_RENDER_STATE_HH
