Explorar el Código

*Improving blending stage

Panagiotis Christopoulos Charitos hace 16 años
padre
commit
562522ba02

+ 2 - 1
shaders/final.glsl

@@ -16,4 +16,5 @@ void main()
 	//gl_FragColor.rgb = MedianFilter( raster_image, tex_coords );
 	//gl_FragColor.rgb = vec3( gl_FragCoord.xy/tex_size_, 0.0 );
 	//gl_FragColor.rgb = vec3( gl_FragCoord.xy*vec2( 1.0/R_W, 1.0/R_H ), 0.0 );
-}
+	//gl_FragColor.rgb = texture2D( raster_image, gl_FragCoord.xy/textureSize(raster_image,0) ).rgb;
+}

+ 1 - 0
shaders/is_ap.glsl

@@ -8,6 +8,7 @@
 uniform vec3 ambient_color;
 #pragma anki uniform ms_diffuse_fai 1
 uniform sampler2D ms_diffuse_fai;
+
 varying vec2 tex_coords;
 
 void main()

+ 3 - 11
shaders/pps.glsl

@@ -5,6 +5,7 @@
 #pragma anki frag_shader_begins
 
 #pragma anki include "shaders/photoshop_filters.glsl"
+#pragma anki include "shaders/median_filter.glsl"
 
 uniform sampler2D is_fai;
 uniform sampler2D pps_ssao_fai;
@@ -60,17 +61,8 @@ EdgeAA
 
 vec3 EdgeAA()
 {
-	vec2 kernel[8];
-	kernel[0] = vec2(-1,1);
-	kernel[1] = vec2(1,-1);
-	kernel[2] = vec2(-1,-1);
-	kernel[3] = vec2(1,1);
-	kernel[4] = vec2(-1,0);
-	kernel[5] = vec2(1,0);
-	kernel[6] = vec2(0,-1);
-	kernel[7] = vec2(0,1);
-
-	vec2 pixelsize = vec2( 1.0/(R_W*R_Q), 1.0/(R_H*R_Q) );
+	const vec2 pixelsize = vec2( 1.0/(R_W*R_Q), 1.0/(R_H*R_Q) );
+	const vec2 kernel[8] = vec2[]( vec2(-1.0,1.0), vec2(1.0,-1.0), vec2(-1.0,-1.0), vec2(1.0,1.0), vec2(-1.0,0.0), vec2(1.0,0.0), vec2(0.0,-1.0), vec2(0.0,1.0) );
 	const float weight = 1.0;
 
 	vec3 tex = texture2D( ms_normal_fai, tex_coords ).rgb;

+ 2 - 12
shaders/pps_hdr_generic.glsl

@@ -31,18 +31,8 @@ void main()
 		#endif
 
 		const int KERNEL_SIZE = 9;
-		float kernel[KERNEL_SIZE];
-		kernel[0] = -3.0 * offset;
-		kernel[1] = -2.0 * offset;
-		kernel[2] = -1.0 * offset;
-		kernel[3] = 0.0 * offset;
-		kernel[4] = 1.0 * offset;
-		kernel[5] = 2.0 * offset;
-		kernel[6] = 3.0 * offset;
-		kernel[7] = -4.0 * offset;
-		kernel[8] = 4.0 * offset;
-		/*kernel[9] = -5.0 * offset;
-		kernel[10] = 5.0 * offset;*/
+		float kernel[KERNEL_SIZE] = float[]( -3.0 * offset, -2.0 * offset, -1.0 * offset, 0.0 * offset, 1.0 * offset, 2.0 * offset,
+				                                  3.0 * offset, -4.0 * offset, 4.0 * offset );
 
 		vec3 color = vec3(0.0);
 

+ 1 - 1
src/main.cpp

@@ -281,7 +281,7 @@ int main( int /*argc*/, char* /*argv*/[] )
 		// std stuff follow
 		SDL_GL_SwapBuffers();
 		r::PrintLastError();
-		if( 0 )
+		if( 1 )
 		{
 			if( r::frames_num == 10 ) r::TakeScreenshot("gfx/screenshot.tga");
 			hndl::WaitForNextFrame();

+ 52 - 52
src/math/vec3.inl.h

@@ -8,59 +8,59 @@ namespace m {
 
 
 // accessors
-M_INLINE float& vec3_t::operator []( uint i )
+inline float& vec3_t::operator []( uint i )
 {
 	return (&x)[i];
 }
 
-M_INLINE float vec3_t::operator []( uint i ) const
+inline float vec3_t::operator []( uint i ) const
 {
 	return (&x)[i];
 }
 
 // constructor []
-M_INLINE vec3_t::vec3_t()
+inline vec3_t::vec3_t()
 	: x(0.0), y(0.0), z(0.0)
 {}
 
 // constructor [float, float, float]
-M_INLINE vec3_t::vec3_t( float x_, float y_, float z_ )
+inline vec3_t::vec3_t( float x_, float y_, float z_ )
 	: x(x_), y(y_), z(z_)
 {}
 
 // constructor [float]
-M_INLINE vec3_t::vec3_t( float f )
+inline vec3_t::vec3_t( float f )
 	: x(f), y(f), z(f)
 {}
 
 // constructor [vec3]
-M_INLINE vec3_t::vec3_t( const vec3_t& b )
+inline vec3_t::vec3_t( const vec3_t& b )
 	: x(b.x), y(b.y), z(b.z)
 {}
 
 // constructor [vec2, float]
-M_INLINE vec3_t::vec3_t( const vec2_t& v2, float z_ )
+inline vec3_t::vec3_t( const vec2_t& v2, float z_ )
 	: x(v2.x), y(v2.y), z(z_)
 {}
 
 // constructor [vec4]
-M_INLINE vec3_t::vec3_t( const vec4_t& v4 )
+inline vec3_t::vec3_t( const vec4_t& v4 )
 	: x(v4.x), y(v4.y), z(v4.z)
 {}
 
 // constructor [quat]
-M_INLINE vec3_t::vec3_t( const quat_t& q )
+inline vec3_t::vec3_t( const quat_t& q )
 	: x(q.x), y(q.y), z(q.z)
 {}
 
 // +
-M_INLINE vec3_t vec3_t::operator +( const vec3_t& b ) const
+inline vec3_t vec3_t::operator +( const vec3_t& b ) const
 {
 	return vec3_t( x+b.x, y+b.y, z+b.z );
 }
 
 // +=
-M_INLINE vec3_t& vec3_t::operator +=( const vec3_t& b )
+inline vec3_t& vec3_t::operator +=( const vec3_t& b )
 {
 	x += b.x;
 	y += b.y;
@@ -69,13 +69,13 @@ M_INLINE vec3_t& vec3_t::operator +=( const vec3_t& b )
 }
 
 // -
-M_INLINE vec3_t vec3_t::operator -( const vec3_t& b ) const
+inline vec3_t vec3_t::operator -( const vec3_t& b ) const
 {
 	return vec3_t( x-b.x, y-b.y, z-b.z );
 }
 
 // -=
-M_INLINE vec3_t& vec3_t::operator -=( const vec3_t& b )
+inline vec3_t& vec3_t::operator -=( const vec3_t& b )
 {
 	x -= b.x;
 	y -= b.y;
@@ -84,13 +84,13 @@ M_INLINE vec3_t& vec3_t::operator -=( const vec3_t& b )
 }
 
 // *
-M_INLINE vec3_t vec3_t::operator *( const vec3_t& b ) const
+inline vec3_t vec3_t::operator *( const vec3_t& b ) const
 {
 	return vec3_t( x*b.x, y*b.y, z*b.z );
 }
 
 // *=
-M_INLINE vec3_t& vec3_t::operator *=( const vec3_t& b )
+inline vec3_t& vec3_t::operator *=( const vec3_t& b )
 {
 	x *= b.x;
 	y *= b.y;
@@ -99,13 +99,13 @@ M_INLINE vec3_t& vec3_t::operator *=( const vec3_t& b )
 }
 
 // /
-M_INLINE vec3_t vec3_t::operator /( const vec3_t& b ) const
+inline vec3_t vec3_t::operator /( const vec3_t& b ) const
 {
 	return vec3_t( x/b.x, y/b.y, z/b.z );
 }
 
 // /=
-M_INLINE vec3_t& vec3_t::operator /=( const vec3_t& b )
+inline vec3_t& vec3_t::operator /=( const vec3_t& b )
 {
 	x /= b.x;
 	y /= b.y;
@@ -114,149 +114,149 @@ M_INLINE vec3_t& vec3_t::operator /=( const vec3_t& b )
 }
 
 // negative
-M_INLINE vec3_t vec3_t::operator -() const
+inline vec3_t vec3_t::operator -() const
 {
 	return vec3_t( -x, -y, -z );
 }
 
 // ==
-M_INLINE bool vec3_t::operator ==( const vec3_t& b ) const
+inline bool vec3_t::operator ==( const vec3_t& b ) const
 {
 	return ( IsZero(x-b.x) && IsZero(y-b.y) && IsZero(z-b.z) ) ? true : false;
 }
 
 // !=
-M_INLINE bool vec3_t::operator !=( const vec3_t& b ) const
+inline bool vec3_t::operator !=( const vec3_t& b ) const
 {
 	return ( IsZero(x-b.x) && IsZero(y-b.y) && IsZero(z-b.z) ) ? false : true;
 }
 
 // vec3 + float
-M_INLINE vec3_t vec3_t::operator +( float f ) const
+inline vec3_t vec3_t::operator +( float f ) const
 {
 	return ME + vec3_t(f);
 }
 
 // float + vec3
-M_INLINE vec3_t operator +( float f, const vec3_t& v )
+inline vec3_t operator +( float f, const vec3_t& v )
 {
 	return v+f;
 }
 
 // vec3 += float
-M_INLINE vec3_t& vec3_t::operator +=( float f )
+inline vec3_t& vec3_t::operator +=( float f )
 {
 	ME += vec3_t(f);
 	return ME;
 }
 
 // vec3 - float
-M_INLINE vec3_t vec3_t::operator -( float f ) const
+inline vec3_t vec3_t::operator -( float f ) const
 {
 	return ME - vec3_t(f);
 }
 
 // float - vec3
-M_INLINE vec3_t operator -( float f, const vec3_t& v )
+inline vec3_t operator -( float f, const vec3_t& v )
 {
 	return vec3_t(f-v.x, f-v.y, f-v.z);
 }
 
 // vec3 -= float
-M_INLINE vec3_t& vec3_t::operator -=( float f )
+inline vec3_t& vec3_t::operator -=( float f )
 {
 	ME -= vec3_t(f);
 	return ME;
 }
 
 // vec3 * float
-M_INLINE vec3_t vec3_t::operator *( float f ) const
+inline vec3_t vec3_t::operator *( float f ) const
 {
 	return ME * vec3_t(f);
 }
 
 // float * vec3
-M_INLINE vec3_t operator *( float f, const vec3_t& v )
+inline vec3_t operator *( float f, const vec3_t& v )
 {
 	return v*f;
 }
 
 // vec3 *= float
-M_INLINE vec3_t& vec3_t::operator *=( float f )
+inline vec3_t& vec3_t::operator *=( float f )
 {
 	ME *= vec3_t(f);
 	return ME;
 }
 
 // vec3 / float
-M_INLINE vec3_t vec3_t::operator /( float f ) const
+inline vec3_t vec3_t::operator /( float f ) const
 {
 	return ME / vec3_t(f);
 }
 
 // float / vec3
-M_INLINE vec3_t operator /( float f, const vec3_t& v )
+inline vec3_t operator /( float f, const vec3_t& v )
 {
 	return vec3_t(f/v.x, f/v.y, f/v.z);
 }
 
 // vec3 /= float
-M_INLINE vec3_t& vec3_t::operator /=( float f )
+inline vec3_t& vec3_t::operator /=( float f )
 {
 	ME /= vec3_t(f);
 	return ME;
 }
 
 // Dot
-M_INLINE float vec3_t::Dot( const vec3_t& b ) const
+inline float vec3_t::Dot( const vec3_t& b ) const
 {
 	return x*b.x + y*b.y + z*b.z;
 }
 
 // cross prod
-M_INLINE vec3_t vec3_t::Cross( const vec3_t& b ) const
+inline vec3_t vec3_t::Cross( const vec3_t& b ) const
 {
 	return vec3_t( y*b.z-z*b.y, z*b.x-x*b.z, x*b.y-y*b.x );
 }
 
 // Length
-M_INLINE float vec3_t::Length() const
+inline float vec3_t::Length() const
 {
 	return Sqrt( x*x + y*y + z*z );
 }
 
 // LengthSquared
-M_INLINE float vec3_t::LengthSquared() const
+inline float vec3_t::LengthSquared() const
 {
 	return x*x + y*y + z*z;
 }
 
 // DistanceSquared
-M_INLINE float vec3_t::DistanceSquared( const vec3_t& b ) const
+inline float vec3_t::DistanceSquared( const vec3_t& b ) const
 {
 	return (ME-b).LengthSquared();
 }
 
 // Normalize
-M_INLINE void vec3_t::Normalize()
+inline void vec3_t::Normalize()
 {
 	ME *= InvSqrt( x*x + y*y + z*z );
 }
 
 // Normalized (return the normalized)
-M_INLINE vec3_t vec3_t::GetNormalized() const
+inline vec3_t vec3_t::GetNormalized() const
 {
 	return ME * InvSqrt( x*x + y*y + z*z );
 }
 
 // Project
-M_INLINE vec3_t vec3_t::Project( const vec3_t& to_this ) const
+inline vec3_t vec3_t::Project( const vec3_t& to_this ) const
 {
 	return to_this * ( ME.Dot(to_this)/(to_this.Dot(to_this)) );
 }
 
 // Rotated
-M_INLINE vec3_t vec3_t::GetRotated( const quat_t& q ) const
+inline vec3_t vec3_t::GetRotated( const quat_t& q ) const
 {
 	DEBUG_ERR( !IsZero(1.0f-q.Length()) ); // Not normalized quat
 
@@ -272,13 +272,13 @@ M_INLINE vec3_t vec3_t::GetRotated( const quat_t& q ) const
 }
 
 // Rotate
-M_INLINE void vec3_t::Rotate( const quat_t& q )
+inline void vec3_t::Rotate( const quat_t& q )
 {
 	ME = GetRotated(q);
 }
 
 // Print
-M_INLINE void vec3_t::Print() const
+inline void vec3_t::Print() const
 {
 	for( int i=0; i<3; i++ )
 		cout << fixed << ME[i] << " ";
@@ -286,49 +286,49 @@ M_INLINE void vec3_t::Print() const
 }
 
 // Lerp
-M_INLINE vec3_t vec3_t::Lerp( const vec3_t& v1, float t ) const
+inline vec3_t vec3_t::Lerp( const vec3_t& v1, float t ) const
 {
 	return (ME*(1.0f-t))+(v1*t);
 }
 
 // GetTransformed [mat3]
-M_INLINE vec3_t vec3_t::GetTransformed( const vec3_t& translate, const mat3_t& rotate, float scale ) const
+inline vec3_t vec3_t::GetTransformed( const vec3_t& translate, const mat3_t& rotate, float scale ) const
 {
 	return (rotate * (ME * scale)) + translate;
 }
 
 // Transform [mat3]
-M_INLINE void vec3_t::Transform( const vec3_t& translate, const mat3_t& rotate, float scale )
+inline void vec3_t::Transform( const vec3_t& translate, const mat3_t& rotate, float scale )
 {
 	ME = GetTransformed( translate, rotate, scale );
 }
 
 // GetTransformed [mat3] no scale
-M_INLINE vec3_t vec3_t::GetTransformed( const vec3_t& translate, const mat3_t& rotate ) const
+inline vec3_t vec3_t::GetTransformed( const vec3_t& translate, const mat3_t& rotate ) const
 {
 	return (rotate * ME) + translate;
 }
 
 // Transform [mat3] no scale
-M_INLINE void vec3_t::Transform( const vec3_t& translate, const mat3_t& rotate )
+inline void vec3_t::Transform( const vec3_t& translate, const mat3_t& rotate )
 {
 	ME = GetTransformed( translate, rotate );
 }
 
 // GetTransformed [quat]
-M_INLINE vec3_t vec3_t::GetTransformed( const vec3_t& translate, const quat_t& rotate, float scale ) const
+inline vec3_t vec3_t::GetTransformed( const vec3_t& translate, const quat_t& rotate, float scale ) const
 {
 	return (ME * scale).GetRotated(rotate) + translate;
 }
 
 // Transform [quat3] no scale
-M_INLINE void vec3_t::Transform( const vec3_t& translate, const quat_t& rotate, float scale )
+inline void vec3_t::Transform( const vec3_t& translate, const quat_t& rotate, float scale )
 {
 	ME = GetTransformed( translate, rotate, scale );
 }
 
 // GetTransformed [mat4]
-M_INLINE vec3_t vec3_t::GetTransformed( const mat4_t& transform ) const
+inline vec3_t vec3_t::GetTransformed( const mat4_t& transform ) const
 {
 	return vec3_t(
 		transform(0,0)*x + transform(0,1)*y + transform(0,2)*z + transform(0,3),
@@ -338,7 +338,7 @@ M_INLINE vec3_t vec3_t::GetTransformed( const mat4_t& transform ) const
 }
 
 // GetTransformed [mat4]
-M_INLINE void vec3_t::Transform( const mat4_t& transform )
+inline void vec3_t::Transform( const mat4_t& transform )
 {
 	ME = GetTransformed( transform );
 }

+ 8 - 8
src/renderer/fbo.h

@@ -17,29 +17,29 @@ class fbo_t
 		void Create()
 		{
 			DEBUG_ERR( gl_id != 0 ); // FBO allready initialized
-			glGenFramebuffersEXT( 1, &gl_id );
+			glGenFramebuffers( 1, &gl_id );
 		}
 
 		/// Binds FBO
 		void Bind() const
 		{
 			DEBUG_ERR( gl_id == 0 );  // FBO unitialized
-			glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, gl_id );
+			glBindFramebuffer( GL_FRAMEBUFFER, gl_id );
 		}
 
 		/// Unbinds the FBO. Actualy unbinds all FBOs
-		static void Unbind() { glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); }
+		static void Unbind() { glBindFramebuffer( GL_FRAMEBUFFER, 0 ); }
 
 		/**
 		 * Checks the status of an initialized FBO
 		 * @return True if FBO is ok and false if not
 		 */
-		bool CheckStatus() const
+		bool IsGood() const
 		{
 			DEBUG_ERR( gl_id == 0 );  // FBO unitialized
 			DEBUG_ERR( GetCurrentFBO() != gl_id ); // another FBO is binded
 
-			return glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT;
+			return glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE;
 		}
 
 		/// Set the number of color attachements of the FBO
@@ -55,8 +55,8 @@ class fbo_t
 			}
 			else
 			{
-				GLenum color_attachments[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_COLOR_ATTACHMENT3_EXT,
-				                               GL_COLOR_ATTACHMENT4_EXT, GL_COLOR_ATTACHMENT5_EXT, GL_COLOR_ATTACHMENT6_EXT, GL_COLOR_ATTACHMENT7_EXT };
+				GLenum color_attachments[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3,
+				                               GL_COLOR_ATTACHMENT4, GL_COLOR_ATTACHMENT5, GL_COLOR_ATTACHMENT6, GL_COLOR_ATTACHMENT7 };
 				glDrawBuffers( num, color_attachments );
 			}
 		}
@@ -68,7 +68,7 @@ class fbo_t
 		static uint GetCurrentFBO()
 		{
 			int fbo_gl_id;
-			glGetIntegerv( GL_FRAMEBUFFER_BINDING_EXT, &fbo_gl_id );
+			glGetIntegerv( GL_FRAMEBUFFER_BINDING, &fbo_gl_id );
 			return (uint)fbo_gl_id;
 		}
 };

+ 30 - 19
src/renderer/r_bs.cpp

@@ -22,9 +22,9 @@ VARS
 static fbo_t b_fbo; ///< blending models FBO
 static fbo_t r_fbo; ///< refracting models FBO
 
-static uint stencil_rb; ///< ToDo
+static texture_t r_fai; ///< RGB for color and A for mask (0 doesnt pass, 1 pass)
 
-static texture_t r_fai;
+static shader_prog_t* r2b_shdr;
 
 
 /*
@@ -32,7 +32,7 @@ static texture_t r_fai;
 InitBFBO                                                                                                                              =
 =======================================================================================================================================
 */
-static void InitBFBO()
+static void InitB()
 {
 	// create FBO
 	b_fbo.Create();
@@ -46,7 +46,7 @@ static void InitBFBO()
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,  GL_TEXTURE_2D, r::ms::depth_fai.GetGLID(), 0 );
 
 	// test if success
-	if( !b_fbo.CheckStatus() )
+	if( !b_fbo.IsGood() )
 		FATAL( "Cannot create deferred shading blending stage FBO" );
 
 	// unbind
@@ -59,35 +59,30 @@ static void InitBFBO()
 InitRFBO                                                                                                                              =
 =======================================================================================================================================
 */
-static void InitRFBO()
+static void InitR()
 {
 	// create FBO
 	r_fbo.Create();
 	r_fbo.Bind();
 
-	// init the stencil render buffer
-	glGenRenderbuffers( 1, &stencil_rb );
-	glBindRenderbuffer( GL_RENDERBUFFER, stencil_rb );
-	glRenderbufferStorage( GL_RENDERBUFFER, GL_STENCIL_INDEX, r::w * r::rendering_quality, r::h * r::rendering_quality );
-	glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, stencil_rb );
-
-
 	// inform FBO about the color buffers
-	r_fbo.SetNumOfColorAttachements(0);
+	r_fbo.SetNumOfColorAttachements(1);
 
 	// texture
-	r_fai.CreateEmpty( r::w * r::rendering_quality, r::h * r::rendering_quality, GL_RGB, GL_RGB );
+	r_fai.CreateEmpty( r::w * r::rendering_quality, r::h * r::rendering_quality, GL_RGBA, GL_RGBA );
 
 	// attach the texes
 	glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, r_fai.GetGLID(), 0 );
 	glFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,  GL_TEXTURE_2D, r::ms::depth_fai.GetGLID(), 0 );
 
 	// test if success
-	if( !r_fbo.CheckStatus() )
+	if( !r_fbo.IsGood() )
 		FATAL( "Cannot create deferred shading blending stage FBO" );
 
 	// unbind
 	r_fbo.Unbind();
+
+	//r2b_shdr =
 }
 
 
@@ -96,8 +91,8 @@ static void InitRFBO()
 //=====================================================================================================================================
 void Init()
 {
-	InitBFBO();
-	//InitRFBO();
+	InitB();
+	InitR();
 }
 
 
@@ -113,12 +108,28 @@ void RunStage( const camera_t& cam )
 	glEnable( GL_DEPTH_TEST );
 	glDepthMask( false );
 
-	b_fbo.Bind();
+
 
 	// render the meshes
 	for( uint i=0; i<scene::meshes.size(); i++ )
 	{
-		Render< mesh_t, true >( scene::meshes[i] );
+		mesh_t* mesh = scene::meshes[i];
+		if( mesh->material->blends )
+		{
+			b_fbo.Bind();
+			mesh->material->Setup();
+			mesh->Render();
+		}
+		else if( mesh->material->refracts )
+		{
+			// write to the rFbo
+			r_fbo.Bind();
+			glClear( GL_COLOR_BUFFER_BIT );
+			mesh->material->Setup();
+			mesh->Render();
+
+			b_fbo.Bind();
+		}
 	}
 
 	// render the smodels

+ 1 - 1
src/renderer/r_dbg.cpp

@@ -48,7 +48,7 @@ void Init()
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,  GL_TEXTURE_2D, r::ms::depth_fai.GetGLID(), 0 );
 
 	// test if success
-	if( !fbo.CheckStatus() )
+	if( !fbo.IsGood() )
 		FATAL( "Cannot create debug FBO" );
 
 	// unbind

+ 5 - 5
src/renderer/r_is.cpp

@@ -83,10 +83,10 @@ calc the view vector that we will use inside the shader to calculate the frag po
 */
 static void CalcViewVector( const camera_t& cam )
 {
-	float _w = r::w * r::rendering_quality;
-	float _h = r::h * r::rendering_quality;
-	int pixels[4][2]={ {_w,_h}, {0.0,_h}, { 0.0,0.0 }, {_w,0.0} }; // from righ up and CC wise to right down, Just like we render the quad
-	int viewport[4]={ 0.0, 0.0, _w, _h };
+	int _w = r::w * r::rendering_quality;
+	int _h = r::h * r::rendering_quality;
+	int pixels[4][2]={ {_w,_h}, {0,_h}, { 0,0 }, {_w,0} }; // from righ up and CC wise to right down, Just like we render the quad
+	int viewport[4]={ 0, 0, _w, _h };
 
 	for( int i=0; i<4; i++ )
 	{
@@ -147,7 +147,7 @@ static void InitStageFBO()
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, fai.GetGLID(), 0 );
 
 	// test if success
-	if( !fbo.CheckStatus() )
+	if( !fbo.IsGood() )
 		FATAL( "Cannot create deferred shading illumination stage FBO" );
 
 	// unbind

+ 1 - 1
src/renderer/r_is_shadows.cpp

@@ -55,7 +55,7 @@ void Init()
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, shadow_map.GetGLID(), 0 );
 
 	// test if success
-	if( !fbo.CheckStatus() )
+	if( !fbo.IsGood() )
 		FATAL( "Cannot create shadow FBO" );
 
 	// unbind

+ 1 - 1
src/renderer/r_ms.cpp

@@ -59,7 +59,7 @@ void Init()
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,  GL_TEXTURE_2D, depth_fai.GetGLID(), 0 );
 
 	// test if success
-	if( !fbo.CheckStatus() )
+	if( !fbo.IsGood() )
 		FATAL( "Cannot create deferred shading material pass FBO" );
 
 	// unbind

+ 1 - 1
src/renderer/r_pps.cpp

@@ -55,7 +55,7 @@ void Init()
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, fai.GetGLID(), 0 );
 
 	// test if success
-	if( !fbo.CheckStatus() )
+	if( !fbo.IsGood() )
 		FATAL( "Cannot create post-processing stage FBO" );
 
 	fbo.Unbind();

+ 1 - 1
src/renderer/r_pps_hdr.cpp

@@ -57,7 +57,7 @@ static void InitFBOs( fbo_t& fbo, texture_t& fai, int internal_format )
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, fai.GetGLID(), 0 );
 
 	// test if success
-	if( !fbo.CheckStatus() )
+	if( !fbo.IsGood() )
 		FATAL( "Cannot create deferred shading post-processing stage HDR passes FBO" );
 
 	// unbind

+ 1 - 1
src/renderer/r_pps_lscatt.cpp

@@ -54,7 +54,7 @@ void Init()
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, fai.GetGLID(), 0 );
 
 	// test if success
-	if( !fbo.CheckStatus() )
+	if( !fbo.IsGood() )
 		FATAL( "Cannot create deferred shading post-processing stage light scattering pass FBO" );
 
 	// unbind

+ 2 - 2
src/renderer/r_pps_ssao.cpp

@@ -54,7 +54,7 @@ static void InitBlurFBO()
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, blured_fai.GetGLID(), 0 );
 
 	// test if success
-	if( !blur_fbo.CheckStatus() )
+	if( !blur_fbo.IsGood() )
 		FATAL( "Cannot create deferred shading post-processing stage SSAO blur FBO" );
 
 	// unbind
@@ -89,7 +89,7 @@ void Init()
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, fai.GetGLID(), 0 );
 
 	// test if success
-	if( !fbo.CheckStatus() )
+	if( !fbo.IsGood() )
 		FATAL( "Cannot create deferred shading post-processing stage SSAO pass FBO" );
 
 	// unbind

+ 1 - 1
src/renderer/renderer.cpp

@@ -430,7 +430,7 @@ void TakeScreenshot( const char* filename )
 		return;
 	}
 	if( !ret ) ERROR( "In taking screenshot" )
-	else INFO( "Screenshot \"" << filename << "\" saved" );
+	else PRINT( "Screenshot \"" << filename << "\" saved" );
 }
 
 

+ 4 - 4
src/renderer2/r_is.cpp

@@ -45,10 +45,10 @@ void renderer_t::illumination_stage_t::point_light_pass_t::DrawSMOUVS( const poi
 /// calc the view vector that we will use inside the shader to calculate the frag pos in view space
 void renderer_t::illumination_stage_t::CalcViewVector()
 {
-	float _w = renderer.width;
-	float _h = renderer.height;
-	int pixels[4][2]={ {_w,_h}, {0.0,_h}, { 0.0,0.0 }, {_w,0.0} }; // from righ up and CC wise to right down, Just like we render the quad
-	int viewport[4]={ 0.0, 0.0, _w, _h };
+	int _w = renderer.width;
+	int _h = renderer.height;
+	int pixels[4][2]={ {_w,_h}, {0,_h}, { 0,0 }, {_w,0} }; // from righ up and CC wise to right down, Just like we render the quad
+	int viewport[4]={ 0, 0, _w, _h };
 
 	for( int i=0; i<4; i++ )
 	{

+ 1 - 1
src/renderer2/r_ms.cpp

@@ -33,7 +33,7 @@ void renderer_t::material_stage_t::Init()
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,  GL_TEXTURE_2D, fais.depth.GetGLID(), 0 );
 
 	// test if success
-	if( !fbo.CheckStatus() )
+	if( !fbo.IsGood() )
 		FATAL( "Cannot create deferred shading material pass FBO" );
 
 	// unbind

+ 3 - 6
src/uncategorized/common.h

@@ -74,25 +74,22 @@ extern string GetFunctionFromPrettyFunction( const char* pretty_function );
 #endif
 
 #define GENERAL_ERR( x, y, col ) \
-    cout << col << "-->" << x << " (" << __FILENAME__ << ":" << __LINE__ << " " << __G_FUNCTION__ << "): " << y << COL_DEFAULT << endl;
+	cerr << col << "**" << x << "** " << __FILENAME__ << "(" << __LINE__ << ") " << __G_FUNCTION__ << ": " << y << COL_DEFAULT << endl;
 
 /// in ERROR you can write something like this: ERROR( "tralala" << 10 << ' ' )
 #define ERROR( x ) GENERAL_ERR( "ERROR", x, COL_ERROR )
 
 /// WARNING
-#define WARNING( x ) GENERAL_ERR( "WARNING", x, COL_WARNING );
+#define WARNING( x ) GENERAL_ERR( "WARNG", x, COL_WARNING );
 
 /// FATAL ERROR
 #define FATAL( x ) { GENERAL_ERR( "FATAL", x << ". Bye!", COL_FATAL ); exit( EXIT_FAILURE ); };
 
-/// INFO
-#define INFO( x ) GENERAL_ERR( "INFO", x, COL_INFO );
-
 /// DEBUG_ERR
 #ifdef _DEBUG_
 	#define DEBUG_ERR( x ) \
 		if( x ) \
-			GENERAL_ERR( "DEBUG_ERR", "See file", COL_DEBUG_ERR );
+			GENERAL_ERR( "ASSRT", #x, COL_DEBUG_ERR );
 #else
     #define DEBUG_ERR( x )
 #endif

+ 11 - 0
src/uncategorized/material.cpp

@@ -113,6 +113,17 @@ bool material_t::Load( const char* filename )
 			}
 			blends = token->value.int_;
 		}
+		//** REFRACTS **
+		else if( token->code == scanner_t::TC_IDENTIFIER && !strcmp( token->value.string, "REFRACTS" ) )
+		{
+			token = &scanner.GetNextToken();
+			if( token->code != scanner_t::TC_NUMBER )
+			{
+				PARSE_ERR_EXPECTED( "number" );
+				return false;
+			}
+			refracts = token->value.int_;
+		}
 		//** BLENDING_SFACTOR **
 		else if( token->code == scanner_t::TC_IDENTIFIER && !strcmp( token->value.string, "BLENDING_SFACTOR" ) )
 		{

+ 6 - 7
src/uncategorized/material.h

@@ -28,14 +28,13 @@ class material_t: public resource_t
 					VEC4
 				};
 
-				class value_t       // unfortunately we cannot use union with vec3_t and vec4_t
+				struct value_t       // unfortunately we cannot use union with vec3_t and vec4_t
 				{
-					public:
-						texture_t* texture;
-						float      float_;
-						vec3_t     vec3;
-						vec4_t     vec4;
-						value_t(): texture(NULL) {}
+					texture_t* texture;
+					float      float_;
+					vec3_t     vec3;
+					vec4_t     vec4;
+					value_t(): texture(NULL) {}
 				};
 
 				type_e type;

+ 2 - 2
src/uncategorized/shader_prog.cpp

@@ -118,7 +118,7 @@ void shader_prog_t::GetUniAndAttribLocs()
 		int loc = glGetAttribLocation(gl_id, name_);
 		if( loc == -1 )
 		{
-			SHADER_WARNING( "You are using FFP vertex attributes (\"" << name_ << "\")" );
+			//SHADER_WARNING( "You are using FFP vertex attributes (\"" << name_ << "\")" );
 			continue;
 		}
 
@@ -137,7 +137,7 @@ void shader_prog_t::GetUniAndAttribLocs()
 		int loc = glGetUniformLocation(gl_id, name_);
 		if( loc == -1 )
 		{
-			SHADER_WARNING( "You are using FFP uniforms (\"" << name_ << "\")" );
+			//SHADER_WARNING( "You are using FFP uniforms (\"" << name_ << "\")" );
 			continue;
 		}
 

+ 2 - 2
src/uncategorized/texture.cpp

@@ -373,7 +373,7 @@ void texture_t::CreateEmpty( float width_, float height_, int internal_format, i
 		return;
 	}
 
-	// ogl stuff
+	// GL stuff
 	glGenTextures( 1, &gl_id );
 	Bind();
 	TexParameter( GL_TEXTURE_MIN_FILTER, GL_NEAREST );
@@ -382,7 +382,7 @@ void texture_t::CreateEmpty( float width_, float height_, int internal_format, i
 	TexParameter( GL_TEXTURE_WRAP_T, GL_CLAMP );
 
 	// allocate to vram
-	glTexImage2D( GL_TEXTURE_2D, 0, internal_format, width_, height_, 0, format_, GL_UNSIGNED_BYTE, NULL );
+	glTexImage2D( GL_TEXTURE_2D, 0, internal_format, width_, height_, 0, format_, GL_FLOAT, NULL );
 
 	if( r::mipmaping ) glGenerateMipmap(GL_TEXTURE_2D);