Index: trunk/nv/interface/map_area.hh
===================================================================
--- trunk/nv/interface/map_area.hh	(revision 275)
+++ trunk/nv/interface/map_area.hh	(revision 276)
@@ -32,4 +32,6 @@
 		virtual rectangle get_rectangle() const { return rectangle( get_shift(), get_shift() + get_size() ); }
 		virtual map_area* create_sub_area( const rectangle& area );
+		virtual bool is_visible( const position& ) const { return true; }
+		virtual bool is_explored( const position& ) const { return true; }
 		virtual ~map_area(){}
 	};
Index: trunk/nv/rogue/fov.hh
===================================================================
--- trunk/nv/rogue/fov.hh	(revision 276)
+++ trunk/nv/rogue/fov.hh	(revision 276)
@@ -0,0 +1,41 @@
+// Copyright (C) 2014 ChaosForge Ltd
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+//
+// TODO : get rid of per-cell virtual calls
+
+#ifndef NV_ROGUE_FOV_HH
+#define NV_ROGUE_FOV_HH
+
+#include <nv/common.hh>
+#include <nv/position.hh>
+
+namespace nv
+{
+
+	namespace rogue
+	{
+
+		class fov_interface
+		{
+		public:
+			virtual void set_visible( const position& p, bool visible ) = 0;
+			virtual bool is_visible( const position& p ) const = 0;
+			virtual bool is_transparent( const position& p ) const = 0;
+		};
+
+		class fov_algorithm
+		{
+		public:
+			virtual void initialize( fov_interface*, const dimension& size ) = 0;
+			virtual void run( const position& p, uint16 radius ) = 0;
+
+		};
+
+	}
+
+}
+
+#endif // NV_ROGUE_FOV_HH
Index: trunk/nv/rogue/fov_recursive_shadowcasting.hh
===================================================================
--- trunk/nv/rogue/fov_recursive_shadowcasting.hh	(revision 276)
+++ trunk/nv/rogue/fov_recursive_shadowcasting.hh	(revision 276)
@@ -0,0 +1,46 @@
+// Copyright (C) 2014 ChaosForge Ltd
+// http://chaosforge.org/
+//
+// This file is part of NV Libraries.
+// For conditions of distribution and use, see copyright notice in nv.hh
+
+#ifndef NV_ROGUE_FOV_RECURSIVE_SHADOWCASTING_HH
+#define NV_ROGUE_FOV_RECURSIVE_SHADOWCASTING_HH
+
+#include <nv/common.hh>
+#include <nv/position.hh>
+#include <nv/rogue/fov.hh>
+
+namespace nv
+{
+
+	namespace rogue
+	{
+
+		class fov_recursive_shadowcasting : public fov_algorithm
+		{
+		public:
+			fov_recursive_shadowcasting( bool light_walls = true ) 
+				: m_light_walls( light_walls ) {}
+			virtual void initialize( fov_interface* map, const dimension& size )
+			{
+				m_map  = map;
+				m_size = size;
+			}
+			virtual void run( const position& p, uint16 radius );
+		private:
+			void cast_light( int row,float start, float end, int oct );
+
+			bool           m_light_walls;
+			int            m_radius;
+			int            m_radius2;
+			position       m_position;
+			dimension      m_size;
+			fov_interface* m_map;
+		};
+
+	}
+
+}
+
+#endif // NV_ROGUE_FOV_RECURSIVE_SHADOWCASTING_HH
Index: trunk/src/rogue/fov_recursive_shadowcasting.cc
===================================================================
--- trunk/src/rogue/fov_recursive_shadowcasting.cc	(revision 276)
+++ trunk/src/rogue/fov_recursive_shadowcasting.cc	(revision 276)
@@ -0,0 +1,91 @@
+// 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
+
+#include "nv/rogue/fov_recursive_shadowcasting.hh"
+
+#include <nv/math.hh>
+
+static int nv_rogue_rs_mult[4][8] = {
+	{ 1, 0, 0,-1,-1, 0, 0, 1},
+	{ 0, 1,-1, 0, 0,-1, 1, 0},
+	{ 0, 1, 1, 0, 0,-1,-1, 0},
+	{ 1, 0, 0, 1,-1, 0, 0,-1},
+};
+
+void nv::rogue::fov_recursive_shadowcasting::run( const position& p, uint16 radius )
+{
+	m_position = p;
+	m_radius   = radius;
+
+	if ( m_radius == 0 )
+	{
+		position max_radius = m_size-m_position;
+		max_radius.x=glm::max(max_radius.x,m_position.x);
+		max_radius.y=glm::max(max_radius.y,m_position.y);
+		m_radius = (int)glm::length((glm::vec2)max_radius)+1;
+	}
+	m_radius2 = m_radius * m_radius;
+	for ( int oct=0; oct < 8; oct++ ) cast_light( 1, 1.0, 0.0, oct );
+	m_map->set_visible( p, true );
+}
+
+void nv::rogue::fov_recursive_shadowcasting::cast_light( int row, float start, float end, int oct )
+{
+	if ( start < end ) return;
+
+	int xx = nv_rogue_rs_mult[0][oct];
+	int xy = nv_rogue_rs_mult[1][oct];
+	int yx = nv_rogue_rs_mult[2][oct];
+	int yy = nv_rogue_rs_mult[3][oct];
+
+	float new_start = 0.0f;
+	for ( int j = row; j < m_radius + 1; j++ )
+	{
+		int dx=-j-1;
+		int dy=-j;
+		bool blocked = false;
+		while ( dx++ <= 0 )
+		{
+			ivec2 c( dx*xx+dy*xy, dx*yx+dy*yy );
+			c += m_position;
+			if ( c.x >= 0 && c.x < m_size.x && c.y >= 0 && c.y < m_size.y )
+			{
+				float l_slope = ( dx - 0.5f ) / ( dy + 0.5f );
+				float r_slope = ( dx + 0.5f ) / ( dy - 0.5f );
+				if ( start < r_slope ) continue;
+				if ( end   > l_slope ) break;
+				bool transparent = m_map->is_transparent( c );
+
+				if ( dx*dx+dy*dy <= m_radius2 && (m_light_walls || transparent)) 
+				{
+					m_map->set_visible( c, true );
+				}
+				if ( blocked )
+				{
+					if ( !transparent )
+					{
+						new_start = r_slope;
+						continue;
+					}
+					blocked = false;
+					start = new_start;
+				}
+				else
+				{
+					if ( !transparent && j < m_radius )
+					{
+						blocked = true;
+						cast_light( j+1, start, l_slope, oct );
+						new_start = r_slope;
+					}
+				}
+			}
+		}
+		if ( blocked ) break;
+	}
+
+}
+
