Panagiotis Christopoulos Charitos 16 år sedan
förälder
incheckning
aad43132a0

+ 1 - 1
src/renderer/r_bs.cpp

@@ -72,7 +72,7 @@ static void InitR()
 	r_fbo.SetNumOfColorAttachements(1);
 
 	// texture
-	r_fai.CreateEmpty( r::w * r::rendering_quality, r::h * r::rendering_quality, GL_RGBA, GL_RGBA );
+	r_fai.CreateEmpty2D( 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 );

+ 1 - 1
src/renderer/r_is.cpp

@@ -138,7 +138,7 @@ static void InitStageFBO()
 	fbo.SetNumOfColorAttachements(1);
 
 	// create the txtrs
-	fai.CreateEmpty( r::w * r::rendering_quality, r::h * r::rendering_quality, GL_RGB, GL_RGB );
+	fai.CreateEmpty2D( r::w * r::rendering_quality, r::h * r::rendering_quality, GL_RGB, GL_RGB );
 
 	// attach
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, fai.GetGLID(), 0 );

+ 1 - 1
src/renderer/r_is_shadows.cpp

@@ -40,7 +40,7 @@ void Init()
 	fbo.Bind();
 
 	// texture
-	shadow_map.CreateEmpty( shadow_resolution * r::rendering_quality, shadow_resolution * r::rendering_quality, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT );
+	shadow_map.CreateEmpty2D( shadow_resolution * r::rendering_quality, shadow_resolution * r::rendering_quality, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT );
 	shadow_map.TexParameter( GL_TEXTURE_MIN_FILTER, GL_NEAREST );
 	if( bilinear ) shadow_map.TexParameter( GL_TEXTURE_MAG_FILTER, GL_LINEAR );
 	else           shadow_map.TexParameter( GL_TEXTURE_MAG_FILTER, GL_NEAREST );

+ 4 - 4
src/renderer/r_ms.cpp

@@ -41,11 +41,11 @@ void Init()
 
 	// create buffers
 	const int internal_format = GL_RGBA16F_ARB;
-	normal_fai.CreateEmpty( r::w * r::rendering_quality, r::h * r::rendering_quality, internal_format, GL_RGBA );
-	diffuse_fai.CreateEmpty( r::w * r::rendering_quality, r::h * r::rendering_quality, internal_format, GL_RGBA );
-	specular_fai.CreateEmpty( r::w * r::rendering_quality, r::h * r::rendering_quality, internal_format, GL_RGBA );
+	normal_fai.CreateEmpty2D( r::w * r::rendering_quality, r::h * r::rendering_quality, internal_format, GL_RGBA );
+	diffuse_fai.CreateEmpty2D( r::w * r::rendering_quality, r::h * r::rendering_quality, internal_format, GL_RGBA );
+	specular_fai.CreateEmpty2D( r::w * r::rendering_quality, r::h * r::rendering_quality, internal_format, GL_RGBA );
 
-	depth_fai.CreateEmpty( r::w * r::rendering_quality, r::h * r::rendering_quality, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT );
+	depth_fai.CreateEmpty2D( r::w * r::rendering_quality, r::h * r::rendering_quality, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT );
 	// you could use the above for SSAO but the difference is very litle.
 	//depth_fai.TexParameter( GL_TEXTURE_MAG_FILTER, GL_LINEAR );
 	//depth_fai.TexParameter( GL_TEXTURE_MIN_FILTER, GL_LINEAR );

+ 1 - 1
src/renderer/r_pps.cpp

@@ -49,7 +49,7 @@ void Init()
 	fbo.SetNumOfColorAttachements(1);
 
 	// create the texes
-	fai.CreateEmpty( r::w * r::rendering_quality, r::h * r::rendering_quality, GL_RGB, GL_RGB );
+	fai.CreateEmpty2D( r::w * r::rendering_quality, r::h * r::rendering_quality, GL_RGB, GL_RGB );
 
 	// attach
 	glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, fai.GetGLID(), 0 );

+ 1 - 1
src/renderer/r_pps_hdr.cpp

@@ -49,7 +49,7 @@ static void InitFBOs( fbo_t& fbo, texture_t& fai, int internal_format )
 	fbo.SetNumOfColorAttachements(1);
 
 	// create the texes
-	fai.CreateEmpty( wwidth, wheight, internal_format, GL_RGB );
+	fai.CreateEmpty2D( wwidth, wheight, internal_format, GL_RGB );
 	fai.TexParameter( GL_TEXTURE_MAG_FILTER, GL_LINEAR );
 	fai.TexParameter( GL_TEXTURE_MIN_FILTER, GL_NEAREST );
 

+ 1 - 1
src/renderer/r_pps_lscatt.cpp

@@ -46,7 +46,7 @@ void Init()
 	fbo.SetNumOfColorAttachements(1);
 
 	// create the texes
-	fai.CreateEmpty( wwidth, wheight, GL_RGB, GL_RGB );
+	fai.CreateEmpty2D( wwidth, wheight, GL_RGB, GL_RGB );
 	fai.TexParameter( GL_TEXTURE_MAG_FILTER, GL_LINEAR );
 	fai.TexParameter( GL_TEXTURE_MIN_FILTER, GL_LINEAR );
 

+ 2 - 2
src/renderer/r_pps_ssao.cpp

@@ -47,7 +47,7 @@ static void InitBlurFBO()
 	blur_fbo.SetNumOfColorAttachements(1);
 
 	// create the texes
-	blured_fai.CreateEmpty( wwidth, wheight, GL_ALPHA8, GL_ALPHA );
+	blured_fai.CreateEmpty2D( wwidth, wheight, GL_ALPHA8, GL_ALPHA );
 	blured_fai.TexParameter( GL_TEXTURE_MAG_FILTER, GL_LINEAR );
 	blured_fai.TexParameter( GL_TEXTURE_MIN_FILTER, GL_NEAREST );
 
@@ -82,7 +82,7 @@ void Init()
 	fbo.SetNumOfColorAttachements(1);
 
 	// create the texes
-	fai.CreateEmpty( wwidth, wheight, GL_ALPHA8, GL_ALPHA );
+	fai.CreateEmpty2D( wwidth, wheight, GL_ALPHA8, GL_ALPHA );
 	fai.TexParameter( GL_TEXTURE_MAG_FILTER, GL_NEAREST );
 	fai.TexParameter( GL_TEXTURE_MIN_FILTER, GL_NEAREST );
 

+ 2 - 2
src/resources/texture.cpp

@@ -379,7 +379,7 @@ void texture_t::CreateEmpty2D( float width_, float height_, int internal_format,
 //=====================================================================================================================================
 void texture_t::CreateEmpty2DMSAA( float width, float height, int samples_num, int internal_format )
 {
-	type = GL_TEXTURE_2D_MULTISAMPLE;
+	/*type = GL_TEXTURE_2D_MULTISAMPLE;
 	DEBUG_ERR( internal_format>0 && internal_format<=4 ); // deprecated internal format
 	DEBUG_ERR( gl_id != numeric_limits<uint>::max() ) // Texture already loaded
 
@@ -387,7 +387,7 @@ void texture_t::CreateEmpty2DMSAA( float width, float height, int samples_num, i
 	Bind();
 	
 	// allocate
-	glTexImage2DMultisample( type, samples_num, internal_format, width, height, false );
+	glTexImage2DMultisample( type, samples_num, internal_format, width, height, false );*/
 }
 
 

+ 0 - 197
src/uncategorized/object.cpp

@@ -1,197 +0,0 @@
-#include <stdio.h>
-#include <stdarg.h>
-#include "object.h"
-#include "primitives.h"
-#include "renderer.h"
-#include "collision.h"
-
-
-/*
-=======================================================================================================================================
-Constructor                                                                                                                           =
-=======================================================================================================================================
-*/
-object_t::object_t( type_e type_ )
-{
-	type = type_;
-	parent = NULL;
-	translation_lspace = vec3_t( 0.0, 0.0, 0.0 );
-	scale_lspace = 1.0;
-	rotation_lspace = mat3_t::GetIdentity();
-	//mat3_t::ident.Print();
-	//rotation_lspace.Print();
-	translation_wspace = vec3_t( 0.0, 0.0, 0.0 );
-	scale_wspace = 1.0;
-	rotation_wspace = mat3_t::GetIdentity();
-	bvolume_lspace = NULL;
-}
-
-
-/*
-=======================================================================================================================================
-GetTypeStr                                                                                                                            =
-=======================================================================================================================================
-*/
-const char* object_t::GetTypeStr() const
-{
-	switch( type )
-	{
-		case LIGHT:
-			return "LIGHT";
-		case CAMERA:
-			return "CAMERA";
-		case MODEL:
-			return "MODEL";
-		case MESH:
-			return "MESH";
-		default:
-			return "OTHER";
-	}
-}
-
-
-/*
-=======================================================================================================================================
-RenderAxis                                                                                                                            =
-In localspace                                                                                                                         =
-=======================================================================================================================================
-*/
-void object_t::RenderAxis()
-{
-	glDisable( GL_DEPTH_TEST );
-
-	glBegin( GL_LINES );
-		glColor3fv( &vec3_t( 1.0, 0.0, 0.0 )[0] );
-		glVertex3fv( &vec3_t( 0.0, 0.0, 0.0 )[0] );
-		glVertex3fv( &vec3_t( 1.0, 0.0, 0.0 )[0] );
-
-		glColor3fv( &vec3_t( 0.0, 1.0, 0.0 )[0] );
-		glVertex3fv( &vec3_t( 0.0, 0.0, 0.0 )[0] );
-		glVertex3fv( &vec3_t( 0.0, 1.0, 0.0 )[0] );
-
-		glColor3fv( &vec3_t( 0.0, 0.0, 1.0 )[0] );
-		glVertex3fv( &vec3_t( 0.0, 0.0, 0.0 )[0] );
-		glVertex3fv( &vec3_t( 0.0, 0.0, 1.0 )[0] );
-	glEnd();
-}
-
-
-/*
-=======================================================================================================================================
-UpdateWorldTransform                                                                                                                  =
-=======================================================================================================================================
-*/
-void object_t::UpdateWorldTransform()
-{
-	if( parent )
-	{
-		/* the original code:
-		scale_wspace = parent->scale_wspace * scale_lspace;
-		rotation_wspace = parent->rotation_wspace * rotation_lspace;
-		translation_wspace = translation_lspace.Transformed( parent->translation_wspace, parent->rotation_wspace, parent->scale_wspace ); */
-		CombineTransformations( parent->translation_wspace, parent->rotation_wspace, parent->scale_wspace, translation_lspace, rotation_lspace,
-														scale_lspace, translation_wspace, rotation_wspace, scale_wspace );
-	}
-	else
-	{
-		scale_wspace = scale_lspace;
-		rotation_wspace = rotation_lspace;
-		translation_wspace = translation_lspace;
-	}
-
-	transformation_wspace = mat4_t( translation_wspace, rotation_wspace, scale_wspace );
-
-
-	// transform the bvolume
-	if( bvolume_lspace != NULL )
-	{
-		DEBUG_ERR( bvolume_lspace->type!=bvolume_t::BSPHERE && bvolume_lspace->type!=bvolume_t::AABB && bvolume_lspace->type!=bvolume_t::OBB );
-
-		switch( bvolume_lspace->type )
-		{
-			case bvolume_t::BSPHERE:
-			{
-				bsphere_t sphere = static_cast<bsphere_t*>(bvolume_lspace)->Transformed( translation_wspace, rotation_wspace, scale_wspace );
-				*static_cast<bsphere_t*>(bvolume_wspace) = sphere;
-				break;
-			}
-
-			case bvolume_t::AABB:
-			{
-				aabb_t aabb = static_cast<aabb_t*>(bvolume_lspace)->Transformed( translation_wspace, rotation_wspace, scale_wspace );
-				*static_cast<aabb_t*>(bvolume_wspace) = aabb;
-				break;
-			}
-
-			case bvolume_t::OBB:
-			{
-				obb_t obb = static_cast<obb_t*>(bvolume_lspace)->Transformed( translation_wspace, rotation_wspace, scale_wspace );
-				*static_cast<obb_t*>(bvolume_wspace) = obb;
-				break;
-			}
-
-			default:
-				FATAL( "What the fuck" );
-		}
-	}
-}
-
-
-/*
-=======================================================================================================================================
-Move(s)                                                                                                                               =
-Move the object according to it's local axis                                                                                          =
-=======================================================================================================================================
-*/
-void object_t::MoveLocalX( float distance )
-{
-	vec3_t x_axis = rotation_lspace.GetColumn(0);
-	translation_lspace += x_axis * distance;
-}
-
-void object_t::MoveLocalY( float distance )
-{
-	vec3_t y_axis = rotation_lspace.GetColumn(1);
-	translation_lspace += y_axis * distance;
-}
-
-void object_t::MoveLocalZ( float distance )
-{
-	vec3_t z_axis = rotation_lspace.GetColumn(2);
-	translation_lspace += z_axis * distance;
-}
-
-
-/*
-=======================================================================================================================================
-AddChilds                                                                                                                             =
-=======================================================================================================================================
-*/
-void object_t::AddChilds( uint amount, ... )
-{
-	va_list vl;
-  va_start(vl, amount);
-
-	for( uint i=0; i<amount; i++ )
-	{
-		object_t* child = va_arg( vl, object_t* );
-		child->parent = this;
-		childs.push_back( child );
-	}
-
-	va_end(vl);
-}
-
-
-/*
-=======================================================================================================================================
-MakeParent                                                                                                                            =
-make "this" the parent of the obj given as param                                                                                      =
-=======================================================================================================================================
-*/
-void object_t::MakeParent( object_t* obj )
-{
-	DEBUG_ERR( obj->parent ); // cant have allready a parent
-	childs.push_back( obj );
-	obj->parent = this;
-}

+ 0 - 61
src/uncategorized/object.h

@@ -1,61 +0,0 @@
-#ifndef _OBJECT_H_
-#define _OBJECT_H_
-
-#include "common.h"
-#include "gmath.h"
-#include "engine_class.h"
-
-class bvolume_t;
-class material_t;
-
-class object_t: public data_user_class_t
-{
-	public:
-		vec3_t translation_lspace;
-		float  scale_lspace;
-		mat3_t rotation_lspace;
-
-		vec3_t translation_wspace;
-		float  scale_wspace;
-		mat3_t rotation_wspace;
-
-		mat4_t transformation_wspace;
-
-		object_t* parent;
-		vec_t<object_t*> childs;
-
-		enum type_e
-		{
-			LIGHT,
-			CAMERA,
-			MODEL,
-			MESH,
-			CUSTOM
-		};
-		type_e type;
-
-		bvolume_t* bvolume_lspace;
-		bvolume_t* bvolume_wspace;
-
-		// funcs
-		 object_t( type_e type_ );
-		~object_t() {};
-		virtual void Render() = 0; ///< Later make that const
-		virtual void RenderDepth() = 0; ///< Later make that const
-		virtual void UpdateWorldStuff() { UpdateWorldTransform(); }; ///< This update happens only when the object gets moved. Override it if you want more
-		const char* GetTypeStr() const;
-		void RenderAxis();
-		void UpdateWorldTransform();
-		void RotateLocalX( float ang_degrees ) { rotation_lspace.RotateXAxis( ang_degrees ); }
-		void RotateLocalY( float ang_degrees ) { rotation_lspace.RotateYAxis( ang_degrees ); }
-		void RotateLocalZ( float ang_degrees ) { rotation_lspace.RotateZAxis( ang_degrees ); }
-		void MoveLocalX( float distance );
-		void MoveLocalY( float distance );
-		void MoveLocalZ( float distance );
-		void AddChilds( uint amount, ... );
-		void MakeParent( object_t* obj );
-};
-
-
-#endif
-

+ 10 - 8
src/uncategorized/particles.cpp

@@ -1,3 +1,4 @@
+/*
 #include "particles.h"
 #include "renderer.h"
 #include "util.h"
@@ -9,11 +10,11 @@ using namespace std;
 #define VEL0 0
 #define VEL1 1
 
-/*
+
 =============================================================================================================================================================
 Render @ particle_t                                                                                                                                         =
 =============================================================================================================================================================
-*/
+
 void particle_t::Render()
 {
 	if( !life ) return;
@@ -92,11 +93,11 @@ void particle_t::Render()
 }
 
 
-/*
+
 =============================================================================================================================================================
 Init @ particle_emitter_t                                                                                                                                   =
 =============================================================================================================================================================
-*/
+
 void particle_emitter_t::Init()
 {
 	particles.resize(200);
@@ -122,11 +123,11 @@ void particle_emitter_t::Init()
 }
 
 
-/*
+
 ==============================================================================================================================================================
 ReInitParticle @ particle_emitter_t                                                                                                                          =
 ==============================================================================================================================================================
-*/
+
 void particle_emitter_t::ReInitParticle( particle_t& particle )
 {
 	// life
@@ -168,11 +169,11 @@ void particle_emitter_t::ReInitParticle( particle_t& particle )
 }
 
 
-/*
+
 =============================================================================================================================================================
 Render @ particle_emitter_t                                                                                                                                 =
 =============================================================================================================================================================
-*/
+
 void particle_emitter_t::Render()
 {
 	UpdateWorldTransform();
@@ -215,3 +216,4 @@ void particle_emitter_t::Render()
 		glPopMatrix();
 	}
 }
+*/

+ 6 - 4
src/uncategorized/particles.h

@@ -1,3 +1,4 @@
+/*
 #ifndef _PARTICLES_H_
 #define _PARTICLES_H_
 
@@ -8,11 +9,11 @@
 
 #define PARTICLE_VELS_NUM 2
 
-/*
+
 ===============================================================================================================================================================
 particle_t                                                                                                                                                    =
 ===============================================================================================================================================================
-*/
+
 class particle_t: public object_t
 {
 	public:
@@ -27,11 +28,11 @@ class particle_t: public object_t
 };
 
 
-/*
+
 ========
 particle_emitter_t
 ========
-*/
+
 class particle_emitter_t: public object_t
 {
 	private:
@@ -78,3 +79,4 @@ class particle_emitter_t: public object_t
 };
 
 #endif
+*/