l33t-qfusion-cvs Mailing List for qfusion engine
Brought to you by:
digiman
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(24) |
Aug
(10) |
Sep
(5) |
Oct
(1) |
Nov
(23) |
Dec
(7) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(9) |
Feb
(3) |
Mar
(3) |
Apr
(19) |
May
(11) |
Jun
|
Jul
(6) |
Aug
(10) |
Sep
(1) |
Oct
|
Nov
|
Dec
(6) |
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(13) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(19) |
Dec
(10) |
| 2007 |
Jan
(36) |
Feb
(9) |
Mar
(26) |
Apr
(32) |
May
(8) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(35) |
Nov
(25) |
Dec
(24) |
| 2008 |
Jan
|
Feb
(8) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: qfusion s. c. <l33...@li...> - 2009-02-07 22:22:16
|
Revision: 813
http://l33t.svn.sourceforge.net/l33t/?rev=813&view=rev
Author: digiman
Date: 2009-02-07 21:48:37 +0000 (Sat, 07 Feb 2009)
Log Message:
-----------
Added Paths:
-----------
trunk/qfusion/source/ref_gl/r_framebuffer.c
Added: trunk/qfusion/source/ref_gl/r_framebuffer.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_framebuffer.c (rev 0)
+++ trunk/qfusion/source/ref_gl/r_framebuffer.c 2009-02-07 21:48:37 UTC (rev 813)
@@ -0,0 +1,270 @@
+/*
+Copyright (C) 2008 Victor Luchits
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+// r_framebuffer.c - Framebuffer Objects support
+
+#include "r_local.h"
+
+#define MAX_FRAMEBUFFER_OBJECTS 1024
+
+typedef struct
+{
+ int objectID;
+ int renderBufferAttachment;
+ image_t *textureAttachment;
+} r_fbo_t;
+
+static qboolean r_frambuffer_objects_initialized;
+static int r_bound_framebuffer_object;
+static int r_num_framebuffer_objects;
+static r_fbo_t r_framebuffer_objects[MAX_FRAMEBUFFER_OBJECTS];
+
+/*
+================
+R_InitFBObjects
+================
+*/
+void R_InitFBObjects( void )
+{
+ if( !glConfig.ext.framebuffer_object )
+ return;
+
+ r_num_framebuffer_objects = 0;
+ memset( r_framebuffer_objects, 0, sizeof( r_framebuffer_objects ) );
+
+ qglBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
+ r_bound_framebuffer_object = 0;
+
+ r_frambuffer_objects_initialized = qtrue;
+}
+
+/*
+================
+R_DeleteFBObject
+
+Delete framebuffer object along with attached render buffer
+================
+*/
+static void R_DeleteFBObject( r_fbo_t *fbo )
+{
+ GLuint t;
+
+ if( fbo->renderBufferAttachment )
+ {
+ t = fbo->renderBufferAttachment;
+ qglDeleteRenderbuffersEXT( 1, &t );
+ fbo->renderBufferAttachment = 0;
+ }
+
+ if( fbo->objectID )
+ {
+ t = fbo->objectID;
+ qglDeleteFramebuffersEXT( 1, &t );
+ fbo->objectID = 0;
+ }
+}
+
+/*
+================
+R_RegisterFBObject
+================
+*/
+int R_RegisterFBObject( void )
+{
+ int i;
+ GLuint fbID;
+ r_fbo_t *fbo;
+
+ if( !r_frambuffer_objects_initialized )
+ return 0;
+ if( r_num_framebuffer_objects == MAX_FRAMEBUFFER_OBJECTS )
+ {
+ Com_Printf( S_COLOR_YELLOW "R_RegisterFBObject: framebuffer objects limit exceeded\n" );
+ return 0;
+ }
+
+ qglGenFramebuffersEXT( 1, &fbID );
+
+ i = r_num_framebuffer_objects++;
+ fbo = r_framebuffer_objects + i;
+ memset( fbo, 0, sizeof( *fbo ) );
+ fbo->objectID = fbID;
+
+ return i+1;
+}
+
+/*
+================
+R_ActiveFBObject
+================
+*/
+int R_ActiveFBObject( void )
+{
+ return r_bound_framebuffer_object;
+}
+
+/*
+================
+R_UseFBObject
+================
+*/
+qboolean R_UseFBObject( int object )
+{
+ qboolean status;
+
+ if( !object )
+ {
+ if( r_frambuffer_objects_initialized )
+ qglBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
+ r_bound_framebuffer_object = 0;
+
+ return r_frambuffer_objects_initialized;
+ }
+
+ assert( object > 0 && object <= r_num_framebuffer_objects );
+
+ qglBindFramebufferEXT( GL_FRAMEBUFFER_EXT, r_framebuffer_objects[object-1].objectID );
+ r_bound_framebuffer_object = object;
+
+ status = R_CheckFBObjectStatus ();
+
+ return status;
+}
+
+/*
+================
+R_AttachTextureToFBOject
+================
+*/
+qboolean R_AttachTextureToFBOject( int object, image_t *texture, qboolean depthOnly )
+{
+ r_fbo_t *fbo;
+ qboolean status;
+
+ if( !object )
+ return qfalse;
+ if( !r_frambuffer_objects_initialized )
+ return qfalse;
+
+ assert( object > 0 && object <= r_num_framebuffer_objects );
+ assert( texture );
+
+ fbo = r_framebuffer_objects + object - 1;
+
+ qglBindFramebufferEXT( GL_FRAMEBUFFER_EXT, fbo->objectID );
+
+ if( depthOnly )
+ {
+ // Set up depth_tex for render-to-texture
+ qglFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, texture->texnum, 0 );
+
+ // inform the driver we do not wish to render to the color buffer
+ qglDrawBuffer( GL_NONE );
+ qglReadBuffer( GL_NONE );
+ }
+ else
+ {
+ // initialize depth renderbuffer
+ if( !fbo->renderBufferAttachment )
+ {
+ GLuint rbID;
+ qglGenRenderbuffersEXT( 1, &rbID );
+ fbo->renderBufferAttachment = rbID;
+ }
+
+ // setup 24bit depth buffer for render-to-texture
+ qglBindRenderbufferEXT( GL_RENDERBUFFER_EXT, fbo->renderBufferAttachment );
+ qglRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24,
+ texture->upload_width, texture->upload_height );
+ qglBindRenderbufferEXT( GL_RENDERBUFFER_EXT, 0 );
+
+ // attach depth renderbuffer
+ qglFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
+ GL_RENDERBUFFER_EXT, fbo->renderBufferAttachment );
+
+ // attach texture
+ qglFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+ (texture->upload_depth != 1 ? GL_TEXTURE_3D : GL_TEXTURE_2D), texture->texnum, 0 );
+ fbo->textureAttachment = texture;
+ }
+
+ status = R_CheckFBObjectStatus ();
+
+ if( r_bound_framebuffer_object )
+ qglBindFramebufferEXT( GL_FRAMEBUFFER_EXT, r_framebuffer_objects[r_bound_framebuffer_object-1].objectID );
+ else
+ qglBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
+
+ return status;
+}
+
+/*
+================
+R_CheckFBObjectStatus
+
+Boolean, returns qfalse in case of error
+================
+*/
+qboolean R_CheckFBObjectStatus( void )
+{
+ GLenum status;
+
+ if( !r_frambuffer_objects_initialized )
+ return qfalse;
+
+ status = qglCheckFramebufferStatusEXT( GL_FRAMEBUFFER_EXT );
+ switch( status )
+ {
+ case GL_FRAMEBUFFER_COMPLETE_EXT:
+ return qtrue;
+ case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
+ return qfalse;
+ default:
+ // programming error; will fail on all hardware
+ assert( 0 );
+ }
+
+ return qfalse;
+}
+
+/*
+================
+R_ShutdownFBObjects
+
+Delete all registered framebuffer and render buffer objects, clear memory
+================
+*/
+void R_ShutdownFBObjects( void )
+{
+ int i;
+
+ if( !r_frambuffer_objects_initialized )
+ return;
+
+ for( i = 0; i < r_num_framebuffer_objects; i++ )
+ R_DeleteFBObject( r_framebuffer_objects + i );
+
+ qglBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
+ r_bound_framebuffer_object = 0;
+
+ r_frambuffer_objects_initialized = qfalse;
+ r_num_framebuffer_objects = 0;
+ memset( r_framebuffer_objects, 0, sizeof( r_framebuffer_objects ) );
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2008-02-19 20:53:45
|
Revision: 812
http://l33t.svn.sourceforge.net/l33t/?rev=812&view=rev
Author: digiman
Date: 2008-02-19 12:53:39 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
update the readme
Modified Paths:
--------------
trunk/qfusion/doc/Readme.txt
Modified: trunk/qfusion/doc/Readme.txt
===================================================================
--- trunk/qfusion/doc/Readme.txt 2008-02-19 20:40:46 UTC (rev 811)
+++ trunk/qfusion/doc/Readme.txt 2008-02-19 20:53:39 UTC (rev 812)
@@ -27,6 +27,8 @@
- Moving\rotating portals and mirrors
- Stencil shadows
- Clientside HUD's
+ - Shadow maps
+ - GLSL shaders
Installation:
@@ -48,20 +50,11 @@
What's new in 3.10
-========-
-- OpenGL Shading Language support
-- Deluxemaps and bumpmapping support via GLSL, including support for lightstyles (see included "ravendelux" demo courtesy of Jalisko or use Nexuiz maps for demonstration)
-- Reworked OpenGL-states layer, minimizing the number of calls to OpenGL subsystem
-- OpenAL support (optional)
-- ALSA support for sound output on Linux systems
-- New shader keywords for GLSL, describing "materials" (diffusemap, heightmap/normalmap, glossmap)
-- New shader keywords for better compatibility with Warsow
-- Optimized mirrors and portals rendering using OpenGL scissor testing
-- Skyportals support (rendering the map from portal's camera position instead of regular skybox)
-- Rewritten renderer of SKM models (using matrix-palette animation)
-- Maps, models and shaders now take less memory and less likely to cause cache misses due to the redesign of used data structures and improved memory management
-- Support for .ogg files as regular sounds, not just background tracks
-- Optimized rendering of maps with global fog (automatic detection, farclip is set to distance of fog opacity).
-- A good bunch of bugfixes, speedups, cleanups and improvements in all areas
+- Shadow maps support for models
+- Occlusion queries support for shadow maps, portals and models
+- Outlines GLSL shader for cell shading effect
+- Added decal stage to "material" shader passes
+- Bugfixes and optimizations
-========-
What's new in 3.09
@@ -153,6 +146,7 @@
r_subdivisions - controls level of detail of world meshes
r_faceplanecull - enables\disables backface culling
r_shadows 1 - planar shadows. set r_stencilbits to 8 for stencil shadows
+ r_shadows 2 - shadow maps.
cm_nocurves - turn on/off collision detection on curves
@@ -162,17 +156,7 @@
gl_screenshot_jpeg_quality - quality of screenshots saved to jpeg
gl_ext_extensions - turn on/off all OpenGL extensions
- gl_ext_texture_filter_anisotropic - sets the degree of texture anisotropic filter
- gl_ext_max_texture_filter_anisotropic - constant variable, maximum value of texture anisotropic filter
- gl_ext_texture_edge_clamp - turn on/off usage of the OpenGL extension
- gl_ext_compressed_textures - turn on/off texture compression
- gl_ext_compiled_vertex_array - turn on/off usage of the OpenGL extension
- gl_ext_texture_env_combine - turn on/off usage of OpenGL multitexture combining
- extension.
- gl_ext_NV_texture_env_combine4 - turn on/off usage of OpenGL multitexture NVidia combining
- extension.
- gl_ext_swapinterval - enable/disable control over vertical synchronization
- gl_ext_vertex_buffer_object - turn on/off usage of GL_ARB_vertex_buffer_object
+ gl_ext_* - individually turn on/off various OpenGL extensions
vid_displayfrequency - sets the display frequency
-========-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2008-02-19 20:40:56
|
Revision: 811
http://l33t.svn.sourceforge.net/l33t/?rev=811&view=rev
Author: digiman
Date: 2008-02-19 12:40:46 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
Update installation script
Modified Paths:
--------------
trunk/qfusion/qfusion.nsi
Modified: trunk/qfusion/qfusion.nsi
===================================================================
--- trunk/qfusion/qfusion.nsi 2008-02-19 20:39:26 UTC (rev 810)
+++ trunk/qfusion/qfusion.nsi 2008-02-19 20:40:46 UTC (rev 811)
@@ -3,9 +3,9 @@
;Written by Joost Verburg
!define PRODUCT_NAME "qfusion"
-!define PRODUCT_VERSION "r9"
+!define PRODUCT_VERSION "r10"
!define PRODUCT_VENDOR "Hell's Kitchen"
-!define PRODUCT_HOMEPAGE "http://hkitchen.quakesrc.org/"
+!define PRODUCT_HOMEPAGE "http://hkitchen.net/qfusion/"
!define PRODUCT_FOLDER "Quake3 III Arena"
!define BASE_FOLDER "baseqf"
@@ -102,7 +102,7 @@
Delete "$INSTDIR\${BASE_FOLDER}\game_x86.dll"
Delete "$INSTDIR\${BASE_FOLDER}\ui_x86.dll"
- Delete "$INSTDIR\doc\readme.txt"
+ Delete "$INSTDIR\${BASE_FOLDER}\doc\readme.txt"
Delete "$INSTDIR\${BASE_FOLDER}\doc\moving mirrors and portals.txt"
Delete "$INSTDIR\${BASE_FOLDER}\doc\Shader Manual.rtf"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2008-02-19 20:39:30
|
Revision: 810
http://l33t.svn.sourceforge.net/l33t/?rev=810&view=rev
Author: digiman
Date: 2008-02-19 12:39:26 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
Update version
Modified Paths:
--------------
trunk/qfusion/source/qcommon/qcommon.h
Modified: trunk/qfusion/source/qcommon/qcommon.h
===================================================================
--- trunk/qfusion/source/qcommon/qcommon.h 2008-02-19 20:38:48 UTC (rev 809)
+++ trunk/qfusion/source/qcommon/qcommon.h 2008-02-19 20:39:26 UTC (rev 810)
@@ -28,7 +28,7 @@
//define PARANOID // speed sapping error checking
#ifndef VERSION
-# define VERSION 3.09
+# define VERSION 3.10
#endif
#ifndef APPLICATION
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2008-02-19 20:38:50
|
Revision: 809
http://l33t.svn.sourceforge.net/l33t/?rev=809&view=rev
Author: digiman
Date: 2008-02-19 12:38:48 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
update Readme.txt
Modified Paths:
--------------
trunk/qfusion/doc/Readme.txt
Modified: trunk/qfusion/doc/Readme.txt
===================================================================
--- trunk/qfusion/doc/Readme.txt 2008-02-19 20:33:28 UTC (rev 808)
+++ trunk/qfusion/doc/Readme.txt 2008-02-19 20:38:48 UTC (rev 809)
@@ -1,8 +1,8 @@
-=======================-
- Qfusion 3.09
+ Qfusion 3.10
Author: Vic
-Email: vi...@qu...
-Homepage: http://hkitchen.quakesrc.org/
+Email: vi...@hk...
+Homepage: http://hkitchen.net/qfusion/
-=======================-
Description:
@@ -43,7 +43,27 @@
Start Game:
- To start a game run qfusion.exe (./qfusion for linux) then go to menu 'Multiplayer' and 'Start network server'.
+
-========-
+What's new in 3.10
+-========-
+
+- OpenGL Shading Language support
+- Deluxemaps and bumpmapping support via GLSL, including support for lightstyles (see included "ravendelux" demo courtesy of Jalisko or use Nexuiz maps for demonstration)
+- Reworked OpenGL-states layer, minimizing the number of calls to OpenGL subsystem
+- OpenAL support (optional)
+- ALSA support for sound output on Linux systems
+- New shader keywords for GLSL, describing "materials" (diffusemap, heightmap/normalmap, glossmap)
+- New shader keywords for better compatibility with Warsow
+- Optimized mirrors and portals rendering using OpenGL scissor testing
+- Skyportals support (rendering the map from portal's camera position instead of regular skybox)
+- Rewritten renderer of SKM models (using matrix-palette animation)
+- Maps, models and shaders now take less memory and less likely to cause cache misses due to the redesign of used data structures and improved memory management
+- Support for .ogg files as regular sounds, not just background tracks
+- Optimized rendering of maps with global fog (automatic detection, farclip is set to distance of fog opacity).
+- A good bunch of bugfixes, speedups, cleanups and improvements in all areas
+
+-========-
What's new in 3.09
-========-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2008-02-19 20:33:31
|
Revision: 808
http://l33t.svn.sourceforge.net/l33t/?rev=808&view=rev
Author: digiman
Date: 2008-02-19 12:33:28 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
Add cvars for outlines
Modified Paths:
--------------
trunk/qfusion/source/cgame/cg_boneposes.c
trunk/qfusion/source/cgame/cg_local.h
trunk/qfusion/source/cgame/cg_main.c
trunk/qfusion/source/cgame/cg_pmodels.c
trunk/qfusion/source/cgame/cg_view.c
trunk/qfusion/source/game/q_shared.h
Modified: trunk/qfusion/source/cgame/cg_boneposes.c
===================================================================
--- trunk/qfusion/source/cgame/cg_boneposes.c 2008-02-19 19:34:44 UTC (rev 807)
+++ trunk/qfusion/source/cgame/cg_boneposes.c 2008-02-19 20:33:28 UTC (rev 808)
@@ -110,6 +110,18 @@
*/
void CG_AddEntityToScene( entity_t *ent )
{
+ if( cg_outlineModels->integer )
+ {
+ if( ent->flags & RF_WEAPONMODEL )
+ ent->outlineHeight = 0.1;
+ else
+ ent->outlineHeight = 0.5;
+ }
+ else
+ {
+ ent->outlineHeight = 0;
+ }
+
if( ent->model && trap_R_SkeletalGetNumBones( ent->model, NULL ) ) {
if( !ent->boneposes || !ent->oldboneposes )
CG_SetBoneposesForTemporaryEntity( ent );
Modified: trunk/qfusion/source/cgame/cg_local.h
===================================================================
--- trunk/qfusion/source/cgame/cg_local.h 2008-02-19 19:34:44 UTC (rev 807)
+++ trunk/qfusion/source/cgame/cg_local.h 2008-02-19 20:33:28 UTC (rev 808)
@@ -442,6 +442,9 @@
extern cvar_t *cg_testLights;
extern cvar_t *cg_testBlend;
+extern cvar_t *cg_outlineWorld;
+extern cvar_t *cg_outlineModels;
+
extern cvar_t *cg_thirdPerson;
extern cvar_t *cg_thirdPersonAngle;
extern cvar_t *cg_thirdPersonRange;
Modified: trunk/qfusion/source/cgame/cg_main.c
===================================================================
--- trunk/qfusion/source/cgame/cg_main.c 2008-02-19 19:34:44 UTC (rev 807)
+++ trunk/qfusion/source/cgame/cg_main.c 2008-02-19 20:33:28 UTC (rev 808)
@@ -36,6 +36,9 @@
cvar_t *gender;
cvar_t *gender_auto;
+cvar_t *cg_outlineWorld;
+cvar_t *cg_outlineModels;
+
cvar_t *cg_testEntities;
cvar_t *cg_testLights;
cvar_t *cg_testBlend;
@@ -285,6 +288,9 @@
cg_predict = trap_Cvar_Get ( "cg_predict", "1", 0 );
cg_showMiss = trap_Cvar_Get ( "cg_showMiss", "0", 0 );
+ cg_outlineWorld = trap_Cvar_Get ( "cg_outlineWorld", "0", CVAR_ARCHIVE );
+ cg_outlineModels = trap_Cvar_Get ( "cg_outlineModels", "0", CVAR_ARCHIVE );
+
cg_testBlend = trap_Cvar_Get ( "cg_testBlend", "0", CVAR_CHEAT );
cg_testEntities = trap_Cvar_Get ( "cg_testEntities", "0", CVAR_CHEAT );
cg_testLights = trap_Cvar_Get ( "cg_testLights", "0", CVAR_CHEAT );
Modified: trunk/qfusion/source/cgame/cg_pmodels.c
===================================================================
--- trunk/qfusion/source/cgame/cg_pmodels.c 2008-02-19 19:34:44 UTC (rev 807)
+++ trunk/qfusion/source/cgame/cg_pmodels.c 2008-02-19 20:33:28 UTC (rev 808)
@@ -1731,7 +1731,6 @@
ent->customShader = NULL;
ent->model = pmodel->pmodelinfo->model;
ent->customSkin = pmodel->pSkin->skin;
-
CG_AddEntityToScene( ent );
if( !ent->model )
Modified: trunk/qfusion/source/cgame/cg_view.c
===================================================================
--- trunk/qfusion/source/cgame/cg_view.c 2008-02-19 19:34:44 UTC (rev 807)
+++ trunk/qfusion/source/cgame/cg_view.c 2008-02-19 20:33:28 UTC (rev 808)
@@ -253,6 +253,9 @@
if( cg.portalInView )
rdflags |= RDF_PORTALINVIEW;
+ if( cg_outlineWorld->integer )
+ rdflags |= RDF_WORLDOUTLINES;
+
rdflags |= RDF_BLOOM;
rdflags |= CG_SkyPortal ();
Modified: trunk/qfusion/source/game/q_shared.h
===================================================================
--- trunk/qfusion/source/game/q_shared.h 2008-02-19 19:34:44 UTC (rev 807)
+++ trunk/qfusion/source/game/q_shared.h 2008-02-19 20:33:28 UTC (rev 808)
@@ -228,6 +228,8 @@
# define ALIGN(x)
#endif
+#define HARDWARE_OUTLINES
+
//==============================================
typedef unsigned char qbyte;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2008-02-19 19:34:49
|
Revision: 807
http://l33t.svn.sourceforge.net/l33t/?rev=807&view=rev
Author: digiman
Date: 2008-02-19 11:34:44 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
Fix screenshots
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_image.c
Modified: trunk/qfusion/source/ref_gl/r_image.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_image.c 2008-02-19 18:24:33 UTC (rev 806)
+++ trunk/qfusion/source/ref_gl/r_image.c 2008-02-19 19:34:44 UTC (rev 807)
@@ -1778,7 +1778,7 @@
Q_snprintfz( checkname, sizeof(checkname), "%s/screenshots", FS_Gamedir() );
Sys_Mkdir( checkname );
- if( name ) {
+ if( name && *name ) {
Q_snprintfz( checkname, sizeof(checkname), "%s/screenshots/%s", FS_Gamedir(), name );
if( r_screenshot_jpeg->integer )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2008-02-19 18:24:51
|
Revision: 806
http://l33t.svn.sourceforge.net/l33t/?rev=806&view=rev
Author: digiman
Date: 2008-02-19 10:24:33 -0800 (Tue, 19 Feb 2008)
Log Message:
-----------
Sync to warsow tree
Fix free'ing of child pools
Modified Paths:
--------------
trunk/qfusion/source/qcommon/mem.c
trunk/qfusion/source/qcommon/qcommon.h
Modified: trunk/qfusion/source/qcommon/mem.c
===================================================================
--- trunk/qfusion/source/qcommon/mem.c 2008-02-17 20:30:30 UTC (rev 805)
+++ trunk/qfusion/source/qcommon/mem.c 2008-02-19 18:24:33 UTC (rev 806)
@@ -23,7 +23,7 @@
cvar_t *developerMemory;
-mempool_t *poolChain = NULL;
+static mempool_t *poolChain = NULL;
// used for temporary memory allocations around the engine, not for longterm
// storage, if anything in this pool stays allocated during gameplay, it is
@@ -33,7 +33,10 @@
// only for zone
mempool_t *zoneMemPool;
-void *_Mem_AllocExt( mempool_t *pool, int size, int z, int musthave, int canthave, const char *filename, int fileline )
+static qboolean memory_initialized = qfalse;
+static qboolean commands_initialized = qfalse;
+
+void *_Mem_AllocExt( mempool_t *pool, size_t size, int z, int musthave, int canthave, const char *filename, int fileline )
{
#ifdef MEMCLUMPING
int i, j, k, needed, endbit, largest;
@@ -46,9 +49,9 @@
if( pool == NULL )
Sys_Error( "Mem_Alloc: pool == NULL (alloc at %s:%i)", filename, fileline );
- if( musthave && ((pool->flags & musthave) != musthave) )
+ if( musthave && ( ( pool->flags & musthave ) != musthave ) )
Sys_Error( "Mem_Alloc: bad pool flags (musthave) (alloc at %s:%i)", filename, fileline );
- if( canthave && (pool->flags & canthave) )
+ if( canthave && ( pool->flags & canthave ) )
Sys_Error( "Mem_Alloc: bad pool flags (canthave) (alloc at %s:%i)", filename, fileline );
if( developerMemory && developerMemory->integer )
@@ -57,12 +60,14 @@
pool->totalsize += size;
#ifdef MEMCLUMPING
- if( size < 4096 ) {
+ if( size < 4096 )
+ {
// clumping
- needed = (sizeof( memheader_t ) + size + sizeof( int ) + (MEMUNIT - 1)) / MEMUNIT;
+ needed = ( sizeof( memheader_t ) + size + sizeof( int ) + ( MEMUNIT - 1 ) ) / MEMUNIT;
endbit = MEMBITS - needed;
- for ( clumpChainPointer = &pool->clumpchain; *clumpChainPointer; clumpChainPointer = &(*clumpChainPointer)->chain ) {
+ for( clumpChainPointer = &pool->clumpchain; *clumpChainPointer; clumpChainPointer = &( *clumpChainPointer )->chain )
+ {
clump = *clumpChainPointer;
if( clump->sentinel1 != MEMCLUMP_SENTINEL )
@@ -70,16 +75,19 @@
if( clump->sentinel2 != MEMCLUMP_SENTINEL )
Sys_Error( "Mem_Alloc: trashed clump sentinel 2 (alloc at %s:%d)", filename, fileline );
- if( clump->largestavailable >= needed ) {
+ if( clump->largestavailable >= needed )
+ {
largest = 0;
- for( i = 0; i < endbit; i++ ) {
- if( clump->bits[i >> 5] & (1 << (i & 31)) )
+ for( i = 0; i < endbit; i++ )
+ {
+ if( clump->bits[i >> 5] & ( 1 << ( i & 31 ) ) )
continue;
k = i + needed;
- for( j = i; i < k; i++ ) {
- if( clump->bits[i >> 5] & (1 << (i & 31)) )
+ for( j = i; i < k; i++ )
+ {
+ if( clump->bits[i >> 5] & ( 1 << ( i & 31 ) ) )
goto loopcontinue;
}
@@ -114,13 +122,15 @@
j = 0;
choseclump:
- mem = ( memheader_t * )(( qbyte * ) clump->block + j * MEMUNIT);
+ mem = ( memheader_t * )( ( qbyte * ) clump->block + j * MEMUNIT );
mem->clump = clump;
clump->blocksinuse += needed;
for( i = j + needed; j < i; j++ )
- clump->bits[j >> 5] |= (1 << (j & 31));
- } else {
+ clump->bits[j >> 5] |= ( 1 << ( j & 31 ) );
+ }
+ else
+ {
// big allocations are not clumped
#endif
pool->realsize += sizeof( memheader_t ) + size + sizeof( int );
@@ -141,39 +151,41 @@
mem->sentinel1 = MEMHEADER_SENTINEL1;
// we have to use only a single byte for this sentinel, because it may not be aligned, and some platforms can't use unaligned accesses
- *((qbyte *) mem + sizeof(memheader_t) + mem->size) = MEMHEADER_SENTINEL2;
+ *( (qbyte *) mem + sizeof( memheader_t ) + mem->size ) = MEMHEADER_SENTINEL2;
// append to head of list
mem->next = pool->chain;
mem->prev = NULL;
pool->chain = mem;
- if ( mem->next )
+ if( mem->next )
mem->next->prev = mem;
if( z )
- memset((void *)((qbyte *) mem + sizeof(memheader_t)), 0, mem->size);
+ memset( (void *)( (qbyte *) mem + sizeof( memheader_t ) ), 0, mem->size );
- return (void *)((qbyte *) mem + sizeof(memheader_t));
+ return (void *)( (qbyte *) mem + sizeof( memheader_t ) );
}
-void *_Mem_Alloc( mempool_t *pool, int size, int musthave, int canthave, const char *filename, int fileline ) {
+void *_Mem_Alloc( mempool_t *pool, size_t size, int musthave, int canthave, const char *filename, int fileline )
+{
return _Mem_AllocExt( pool, size, 1, musthave, canthave, filename, fileline );
}
// FIXME: rewrite this?
-void *_Mem_Realloc( void *data, int size, const char *filename, int fileline )
+void *_Mem_Realloc( void *data, size_t size, const char *filename, int fileline )
{
void *newdata;
memheader_t *mem;
if( data == NULL )
Sys_Error( "Mem_Realloc: data == NULL (called at %s:%i)", filename, fileline );
- if( size <= 0 ) {
+ if( size <= 0 )
+ {
Mem_Free( data );
return NULL;
}
- mem = ( memheader_t * )((qbyte *) data - sizeof(memheader_t));
+ mem = ( memheader_t * )( (qbyte *) data - sizeof( memheader_t ) );
if( size <= mem->size )
return data;
@@ -184,7 +196,7 @@
return newdata;
}
-void _Mem_Free( void *data, int musthave, int canthave, const char *filename, int fileline )
+void _Mem_Free( void *data, int musthave, int canthave, const char *filename, int fileline )
{
#ifdef MEMCLUMPING
int i, firstblock, endblock;
@@ -194,27 +206,30 @@
mempool_t *pool;
if( data == NULL )
-// Sys_Error( "Mem_Free: data == NULL (called at %s:%i)", filename, fileline );
+ //Sys_Error( "Mem_Free: data == NULL (called at %s:%i)", filename, fileline );
return;
- mem = ( memheader_t * )((qbyte *) data - sizeof(memheader_t));
+ mem = ( memheader_t * )( (qbyte *) data - sizeof( memheader_t ) );
+
+ assert( mem->sentinel1 == MEMHEADER_SENTINEL1 );
+ assert( *( (qbyte *) mem + sizeof( memheader_t ) + mem->size ) == MEMHEADER_SENTINEL2 );
+
if( mem->sentinel1 != MEMHEADER_SENTINEL1 )
Sys_Error( "Mem_Free: trashed header sentinel 1 (alloc at %s:%i, free at %s:%i)", mem->filename, mem->fileline, filename, fileline );
-
- if( *((qbyte *)mem + sizeof(memheader_t) + mem->size) != MEMHEADER_SENTINEL2 )
+ if( *( (qbyte *)mem + sizeof( memheader_t ) + mem->size ) != MEMHEADER_SENTINEL2 )
Sys_Error( "Mem_Free: trashed header sentinel 2 (alloc at %s:%i, free at %s:%i)", mem->filename, mem->fileline, filename, fileline );
pool = mem->pool;
- if( musthave && ((pool->flags & musthave) != musthave) )
+ if( musthave && ( ( pool->flags & musthave ) != musthave ) )
Sys_Error( "Mem_Free: bad pool flags (musthave) (alloc at %s:%i)", filename, fileline );
- if( canthave && (pool->flags & canthave) )
+ if( canthave && ( pool->flags & canthave ) )
Sys_Error( "Mem_Free: bad pool flags (canthave) (alloc at %s:%i)", filename, fileline );
if( developerMemory && developerMemory->integer )
Com_DPrintf( "Mem_Free: pool %s, alloc %s:%i, free %s:%i, size %i bytes\n", pool->name, mem->filename, mem->fileline, filename, fileline, mem->size );
// unlink memheader from doubly linked list
- if( (mem->prev ? mem->prev->next != mem : pool->chain != mem) || (mem->next && mem->next->prev != mem) )
+ if( ( mem->prev ? mem->prev->next != mem : pool->chain != mem ) || ( mem->next && mem->next->prev != mem ) )
Sys_Error( "Mem_Free: not allocated or double freed (free at %s:%i)", filename, fileline );
if( mem->prev )
@@ -228,42 +243,52 @@
pool->totalsize -= mem->size;
#ifdef MEMCLUMPING
- if ( (clump = mem->clump) ) {
+ if( ( clump = mem->clump ) )
+ {
if( clump->sentinel1 != MEMCLUMP_SENTINEL )
Sys_Error( "Mem_Free: trashed clump sentinel 1 (free at %s:%i)", filename, fileline );
if( clump->sentinel2 != MEMCLUMP_SENTINEL )
Sys_Error( "Mem_Free: trashed clump sentinel 2 (free at %s:%i)", filename, fileline );
- firstblock = ((qbyte *) mem - (qbyte *) clump->block);
- if( firstblock & (MEMUNIT - 1) )
+ firstblock = ( (qbyte *) mem - (qbyte *) clump->block );
+ if( firstblock & ( MEMUNIT - 1 ) )
Sys_Error( "Mem_Free: address not valid in clump (free at %s:%i)", filename, fileline );
firstblock /= MEMUNIT;
- endblock = firstblock + ((sizeof(memheader_t) + mem->size + sizeof(int) + (MEMUNIT - 1)) / MEMUNIT);
+ endblock = firstblock + ( ( sizeof( memheader_t ) + mem->size + sizeof( int ) + ( MEMUNIT - 1 ) ) / MEMUNIT );
clump->blocksinuse -= endblock - firstblock;
// could use &, but we know the bit is set
- for( i = firstblock;i < endblock; i++ )
- clump->bits[i >> 5] -= (1 << (i & 31));
+ for( i = firstblock; i < endblock; i++ )
+ clump->bits[i >> 5] -= ( 1 << ( i & 31 ) );
- if( clump->blocksinuse <= 0 ) { // unlink from chain
- for( clumpChainPointer = &pool->clumpchain; *clumpChainPointer; clumpChainPointer = &(*clumpChainPointer)->chain ) {
- if( *clumpChainPointer == clump ) {
+ if( clump->blocksinuse <= 0 )
+ {
+ // unlink from chain
+ for( clumpChainPointer = &pool->clumpchain; *clumpChainPointer; clumpChainPointer = &( *clumpChainPointer )->chain )
+ {
+ if( *clumpChainPointer == clump )
+ {
*clumpChainPointer = clump->chain;
break;
}
}
- pool->realsize -= sizeof(memclump_t);
+ pool->realsize -= sizeof( memclump_t );
#ifdef MEMTRASH
- memset( clump, 0xBF, sizeof(memclump_t) );
+ memset( clump, 0xBF, sizeof( memclump_t ) );
#endif
free( clump );
- } else { // clump still has some allocations
+ }
+ else
+ {
+ // clump still has some allocations
// force re-check of largest available space on next alloc
clump->largestavailable = MEMBITS - clump->blocksinuse;
}
- } else {
+ }
+ else
+ {
#endif
pool->realsize -= sizeof( memheader_t ) + mem->size + sizeof( int );
#ifdef MEMTRASH
@@ -279,12 +304,12 @@
{
mempool_t *pool;
- if( parent && (parent->flags & MEMPOOL_TEMPORARY) )
+ if( parent && ( parent->flags & MEMPOOL_TEMPORARY ) )
Sys_Error( "Mem_AllocPool: nested temporary pools are not allowed (allocpool at %s:%i)", filename, fileline );
if( flags & MEMPOOL_TEMPORARY )
Sys_Error( "Mem_AllocPool: tried to allocate temporary pool, use Mem_AllocTempPool instead (allocpool at %s:%i)", filename, fileline );
- pool = malloc( sizeof(mempool_t) );
+ pool = malloc( sizeof( mempool_t ) );
if( pool == NULL )
Sys_Error( "Mem_AllocPool: out of memory (allocpool at %s:%i)", filename, fileline );
@@ -301,10 +326,13 @@
pool->realsize = sizeof( mempool_t );
Q_strncpyz( pool->name, name, sizeof( pool->name ) );
- if( parent ) {
+ if( parent )
+ {
pool->next = parent->child;
parent->child = pool;
- } else {
+ }
+ else
+ {
pool->next = poolChain;
poolChain = pool;
}
@@ -324,46 +352,66 @@
void _Mem_FreePool( mempool_t **pool, int musthave, int canthave, const char *filename, int fileline )
{
- mempool_t **chainAddress, **next;
+ mempool_t **chainAddress;
+#ifdef SHOW_NONFREED
+ memheader_t *mem;
+#endif
- if( !(*pool) )
+ if( !( *pool ) )
return;
- if ( musthave && (((*pool)->flags & musthave) != musthave) )
+ if( musthave && ( ( ( *pool )->flags & musthave ) != musthave ) )
Sys_Error( "Mem_FreePool: bad pool flags (musthave) (alloc at %s:%i)", filename, fileline );
- if ( canthave && ((*pool)->flags & canthave) )
+ if( canthave && ( ( *pool )->flags & canthave ) )
Sys_Error( "Mem_FreePool: bad pool flags (canthave) (alloc at %s:%i)", filename, fileline );
// recurse into children
- // note that children will be freed no matter if their flags
+ // note that children will be freed no matter if their flags
// do not match musthave\canthave pair
- if( (*pool)->child ) {
- for( chainAddress = &(*pool)->child; *chainAddress; chainAddress = next ) {
- next = &((*chainAddress)->next);
- _Mem_FreePool( chainAddress, 0, 0, filename, fileline );
+ if( ( *pool )->child )
+ {
+ mempool_t *tmp, *next;
+ for( chainAddress = &( *pool )->child; *chainAddress; chainAddress = &next )
+ {
+ next = ( *chainAddress )->next;
+ tmp = *chainAddress;
+ _Mem_FreePool( &tmp, 0, 0, filename, fileline );
}
}
-
- if( (*pool)->sentinel1 != MEMHEADER_SENTINEL1 )
- Sys_Error( "Mem_FreePool: trashed pool sentinel 1 (allocpool at %s:%i, freepool at %s:%i)", (*pool)->filename, (*pool)->fileline, filename, fileline );
- if( (*pool)->sentinel2 != MEMHEADER_SENTINEL1 )
- Sys_Error( "Mem_FreePool: trashed pool sentinel 2 (allocpool at %s:%i, freepool at %s:%i)", (*pool)->filename, (*pool)->fileline, filename, fileline );
+ assert( ( *pool )->sentinel1 == MEMHEADER_SENTINEL1 );
+ assert( ( *pool )->sentinel2 == MEMHEADER_SENTINEL1 );
+
+ if( ( *pool )->sentinel1 != MEMHEADER_SENTINEL1 )
+ Sys_Error( "Mem_FreePool: trashed pool sentinel 1 (allocpool at %s:%i, freepool at %s:%i)", ( *pool )->filename, ( *pool )->fileline, filename, fileline );
+ if( ( *pool )->sentinel2 != MEMHEADER_SENTINEL1 )
+ Sys_Error( "Mem_FreePool: trashed pool sentinel 2 (allocpool at %s:%i, freepool at %s:%i)", ( *pool )->filename, ( *pool )->fileline, filename, fileline );
+
+#ifdef SHOW_NONFREED
+ if( ( *pool )->chain )
+ Com_Printf( "Warning: Memory pool %s has resources that weren't freed:\n", ( *pool )->name );
+ for( mem = ( *pool )->chain; mem; mem = mem->next )
+ {
+ Com_Printf( "%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline );
+ }
+#endif
+
// unlink pool from chain
- if( (*pool)->parent )
- for( chainAddress = &(*pool)->parent->child; *chainAddress && *chainAddress != *pool; chainAddress = &((*chainAddress)->next) );
+ if( ( *pool )->parent )
+ for( chainAddress = &( *pool )->parent->child; *chainAddress && *chainAddress != *pool; chainAddress = &( ( *chainAddress )->next ) ) ;
else
- for( chainAddress = &poolChain; *chainAddress && *chainAddress != *pool; chainAddress = &((*chainAddress)->next) );
+ for( chainAddress = &poolChain; *chainAddress && *chainAddress != *pool; chainAddress = &( ( *chainAddress )->next ) ) ;
if( *chainAddress != *pool )
Sys_Error( "Mem_FreePool: pool already free (freepool at %s:%i)", filename, fileline );
- *chainAddress = (*pool)->next;
- while( (*pool)->chain ) // free memory owned by the pool
- Mem_Free( (void *)((qbyte *)(*pool)->chain + sizeof(memheader_t)) );
+ while( ( *pool )->chain ) // free memory owned by the pool
+ Mem_Free( (void *)( (qbyte *)( *pool )->chain + sizeof( memheader_t ) ) );
+ *chainAddress = ( *pool )->next;
+
// free the pool itself
#ifdef MEMTRASH
- memset( *pool, 0xBF, sizeof(mempool_t) );
+ memset( *pool, 0xBF, sizeof( mempool_t ) );
#endif
free( *pool );
*pool = NULL;
@@ -372,29 +420,45 @@
void _Mem_EmptyPool( mempool_t *pool, int musthave, int canthave, const char *filename, int fileline )
{
mempool_t *child, *next;
+#ifdef SHOW_NONFREED
+ memheader_t *mem;
+#endif
if( pool == NULL )
Sys_Error( "Mem_EmptyPool: pool == NULL (emptypool at %s:%i)", filename, fileline );
- if( musthave && ((pool->flags & musthave) != musthave) )
+ if( musthave && ( ( pool->flags & musthave ) != musthave ) )
Sys_Error( "Mem_EmptyPool: bad pool flags (musthave) (alloc at %s:%i)", filename, fileline );
- if( canthave && (pool->flags & canthave) )
+ if( canthave && ( pool->flags & canthave ) )
Sys_Error( "Mem_EmptyPool: bad pool flags (canthave) (alloc at %s:%i)", filename, fileline );
// recurse into children
- if( pool->child ) {
- for( child = pool->child; child; child = next ) {
+ if( pool->child )
+ {
+ for( child = pool->child; child; child = next )
+ {
next = child->next;
_Mem_EmptyPool( child, 0, 0, filename, fileline );
}
}
+ assert( pool->sentinel1 == MEMHEADER_SENTINEL1 );
+ assert( pool->sentinel2 == MEMHEADER_SENTINEL1 );
+
if( pool->sentinel1 != MEMHEADER_SENTINEL1 )
Sys_Error( "Mem_EmptyPool: trashed pool sentinel 1 (allocpool at %s:%i, emptypool at %s:%i)", pool->filename, pool->fileline, filename, fileline );
if( pool->sentinel2 != MEMHEADER_SENTINEL1 )
Sys_Error( "Mem_EmptyPool: trashed pool sentinel 2 (allocpool at %s:%i, emptypool at %s:%i)", pool->filename, pool->fileline, filename, fileline );
- while( pool->chain ) // free memory owned by the pool
- Mem_Free( (void *)((qbyte *) pool->chain + sizeof(memheader_t)) );
+#ifdef SHOW_NONFREED
+ if( pool->chain )
+ Com_Printf( "Warning: Memory pool %s has resources that weren't freed:\n", pool->name );
+ for( mem = pool->chain; mem; mem = mem->next )
+ {
+ Com_Printf( "%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline );
+ }
+#endif
+ while( pool->chain ) // free memory owned by the pool
+ Mem_Free( (void *)( (qbyte *) pool->chain + sizeof( memheader_t ) ) );
}
void _Mem_CheckSentinels( void *data, const char *filename, int fileline )
@@ -404,16 +468,23 @@
if( data == NULL )
Sys_Error( "Mem_CheckSentinels: data == NULL (sentinel check at %s:%i)", filename, fileline );
- mem = (memheader_t *)((qbyte *) data - sizeof(memheader_t));
+ mem = (memheader_t *)( (qbyte *) data - sizeof( memheader_t ) );
+
+ assert( mem->sentinel1 == MEMHEADER_SENTINEL1 );
+ assert( *( (qbyte *) mem + sizeof( memheader_t ) + mem->size ) == MEMHEADER_SENTINEL2 );
+
if( mem->sentinel1 != MEMHEADER_SENTINEL1 )
Sys_Error( "Mem_CheckSentinels: trashed header sentinel 1 (block allocated at %s:%i, sentinel check at %s:%i)", mem->filename, mem->fileline, filename, fileline );
- if( *((qbyte *) mem + sizeof(memheader_t) + mem->size) != MEMHEADER_SENTINEL2 )
+ if( *( (qbyte *) mem + sizeof( memheader_t ) + mem->size ) != MEMHEADER_SENTINEL2 )
Sys_Error( "Mem_CheckSentinels: trashed header sentinel 2 (block allocated at %s:%i, sentinel check at %s:%i)", mem->filename, mem->fileline, filename, fileline );
}
#ifdef MEMCLUMPING
static void _Mem_CheckClumpSentinels( memclump_t *clump, const char *filename, int fileline )
{
+ assert( clump->sentinel1 == MEMCLUMP_SENTINEL );
+ assert( clump->sentinel2 == MEMCLUMP_SENTINEL );
+
// this isn't really very useful
if( clump->sentinel1 != MEMCLUMP_SENTINEL )
Sys_Error( "Mem_CheckClumpSentinels: trashed sentinel 1 (sentinel check at %s:%i)", filename, fileline );
@@ -422,7 +493,7 @@
}
#endif
-void _Mem_CheckSentinelsPool( mempool_t *pool, const char *filename, int fileline )
+static void _Mem_CheckSentinelsPool( mempool_t *pool, const char *filename, int fileline )
{
memheader_t *mem;
#ifdef MEMCLUMPING
@@ -431,18 +502,22 @@
mempool_t *child;
// recurse into children
- if ( pool->child ) {
+ if( pool->child )
+ {
for( child = pool->child; child; child = child->next )
_Mem_CheckSentinelsPool( child, filename, fileline );
}
+ assert( pool->sentinel1 == MEMHEADER_SENTINEL1 );
+ assert( pool->sentinel2 == MEMHEADER_SENTINEL1 );
+
if( pool->sentinel1 != MEMHEADER_SENTINEL1 )
Sys_Error( "_Mem_CheckSentinelsPool: trashed pool sentinel 1 (allocpool at %s:%i, sentinel check at %s:%i)", pool->filename, pool->fileline, filename, fileline );
if( pool->sentinel2 != MEMHEADER_SENTINEL1 )
Sys_Error( "_Mem_CheckSentinelsPool: trashed pool sentinel 2 (allocpool at %s:%i, sentinel check at %s:%i)", pool->filename, pool->fileline, filename, fileline );
for( mem = pool->chain; mem; mem = mem->next )
- _Mem_CheckSentinels((void *)((qbyte *) mem + sizeof(memheader_t)), filename, fileline);
+ _Mem_CheckSentinels( (void *)( (qbyte *) mem + sizeof( memheader_t ) ), filename, fileline );
#ifdef MEMCLUMPING
for( clump = pool->clumpchain; clump; clump = clump->chain )
@@ -458,34 +533,36 @@
_Mem_CheckSentinelsPool( pool, filename, fileline );
}
-void Mem_CountPoolStats( mempool_t *pool, int *count, int *size, int *realsize )
+static void Mem_CountPoolStats( mempool_t *pool, int *count, int *size, int *realsize )
{
mempool_t *child;
// recurse into children
- if( pool->child ) {
+ if( pool->child )
+ {
for( child = pool->child; child; child = child->next )
Mem_CountPoolStats( child, count, size, realsize );
}
if( count )
- (*count)++;
+ ( *count )++;
if( size )
- (*size) += pool->totalsize;
+ ( *size ) += pool->totalsize;
if( realsize )
- (*realsize) += pool->realsize;
+ ( *realsize ) += pool->realsize;
}
-void Mem_PrintStats (void)
+static void Mem_PrintStats( void )
{
int count, size, real;
int total, totalsize, realsize;
mempool_t *pool;
memheader_t *mem;
- Mem_CheckSentinelsGlobal ();
+ Mem_CheckSentinelsGlobal();
- for( total = 0, totalsize = 0, realsize = 0, pool = poolChain; pool; pool = pool->next ) {
+ for( total = 0, totalsize = 0, realsize = 0, pool = poolChain; pool; pool = pool->next )
+ {
count = 0; size = 0; real = 0;
Mem_CountPoolStats( pool, &count, &size, &real );
total += count; totalsize += size; realsize += real;
@@ -495,58 +572,66 @@
realsize, realsize / 1048576.0 );
// temporary pools are not nested
- for ( pool = poolChain; pool; pool = pool->next ) {
- if ( (pool->flags & MEMPOOL_TEMPORARY) && pool->chain ) {
+ for( pool = poolChain; pool; pool = pool->next )
+ {
+ if( ( pool->flags & MEMPOOL_TEMPORARY ) && pool->chain )
+ {
Com_Printf( "%i bytes (%.3fMB) (%i bytes (%.3fMB actual)) of temporary memory still allocated (Leak!)\n", pool->totalsize, pool->totalsize / 1048576.0,
pool->realsize, pool->realsize / 1048576.0 );
Com_Printf( "listing temporary memory allocations for %s:\n", pool->name );
- for( mem = tempMemPool->chain; mem; mem = mem->next)
+ for( mem = tempMemPool->chain; mem; mem = mem->next )
Com_Printf( "%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline );
}
}
}
-void Mem_PrintPoolStats( mempool_t *pool, int listchildren, int listallocations )
+static void Mem_PrintPoolStats( mempool_t *pool, int listchildren, int listallocations )
{
mempool_t *child;
memheader_t *mem;
int totalsize = 0, realsize = 0;
- Mem_CountPoolStats ( pool, NULL, &totalsize, &realsize );
+ Mem_CountPoolStats( pool, NULL, &totalsize, &realsize );
- if ( pool->parent ) {
+ if( pool->parent )
+ {
if( pool->lastchecksize != 0 && totalsize != pool->lastchecksize )
- Com_Printf( "%6ik (%6ik actual) %s:%s (%i byte change)\n", (totalsize + 1023) / 1024, (realsize + 1023) / 1024, pool->parent->name, pool->name, totalsize - pool->lastchecksize );
+ Com_Printf( "%6ik (%6ik actual) %s:%s (%i byte change)\n", ( totalsize + 1023 ) / 1024, ( realsize + 1023 ) / 1024, pool->parent->name, pool->name, totalsize - pool->lastchecksize );
else
- Com_Printf( "%6ik (%6ik actual) %s:%s\n", (totalsize + 1023) / 1024, (realsize + 1023) / 1024, pool->parent->name, pool->name );
- } else {
+ Com_Printf( "%6ik (%6ik actual) %s:%s\n", ( totalsize + 1023 ) / 1024, ( realsize + 1023 ) / 1024, pool->parent->name, pool->name );
+ }
+ else
+ {
if( pool->lastchecksize != 0 && totalsize != pool->lastchecksize )
- Com_Printf( "%6ik (%6ik actual) %s (%i byte change)\n", (totalsize + 1023) / 1024, (realsize + 1023) / 1024, pool->name, totalsize - pool->lastchecksize );
+ Com_Printf( "%6ik (%6ik actual) %s (%i byte change)\n", ( totalsize + 1023 ) / 1024, ( realsize + 1023 ) / 1024, pool->name, totalsize - pool->lastchecksize );
else
- Com_Printf( "%6ik (%6ik actual) %s\n", (totalsize + 1023) / 1024, (realsize + 1023) / 1024, pool->name );
+ Com_Printf( "%6ik (%6ik actual) %s\n", ( totalsize + 1023 ) / 1024, ( realsize + 1023 ) / 1024, pool->name );
}
pool->lastchecksize = totalsize;
- if( listallocations ) {
+ if( listallocations )
+ {
for( mem = pool->chain; mem; mem = mem->next )
- Com_Printf ("%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline);
+ Com_Printf( "%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline );
}
- if( listchildren ) {
- if( pool->child ) {
+ if( listchildren )
+ {
+ if( pool->child )
+ {
for( child = pool->child; child; child = child->next )
- Mem_PrintPoolStats ( child, listchildren, listallocations );
+ Mem_PrintPoolStats( child, listchildren, listallocations );
}
}
}
-void Mem_PrintList( int listchildren, int listallocations )
+static void Mem_PrintList( int listchildren, int listallocations )
{
mempool_t *pool;
- Mem_CheckSentinelsGlobal ();
+ Mem_CheckSentinelsGlobal();
Com_Printf( "memory pool list:\n" "size name\n" );
@@ -554,31 +639,49 @@
Mem_PrintPoolStats( pool, listchildren, listallocations );
}
-void MemList_f( void )
+static void MemList_f( void )
{
- switch ( Cmd_Argc () ) {
+ mempool_t *pool;
+
+ switch( Cmd_Argc() )
+ {
case 1:
Mem_PrintList( qtrue, qfalse );
- Mem_PrintStats ();
+ Mem_PrintStats();
break;
case 2:
- if( !Q_stricmp( Cmd_Argv( 1 ), "all" ) ) {
+ if( !Q_stricmp( Cmd_Argv( 1 ), "all" ) )
+ {
Mem_PrintList( qtrue, qtrue );
- Mem_PrintStats ();
+ Mem_PrintStats();
break;
}
- // drop through
+
+ for( pool = poolChain; pool; pool = pool->next )
+ {
+ if( !Q_stricmp( pool->name, Cmd_Args() ) )
+ {
+ Com_Printf( "memory pool list:\n" "size name\n" );
+ Mem_PrintPoolStats( pool, qtrue, qtrue );
+ break;
+ }
+ }
+
+ if( pool )
+ break;
+
+ // fall through
default:
- Com_Printf( "MemList_f: unrecognized options\nusage: memlist [all]\n" );
+ Com_Printf( "MemList_f: unrecognized options\nusage: memlist [all|pool]\n" );
break;
}
}
-void MemStats_f( void )
+static void MemStats_f( void )
{
- Mem_CheckSentinelsGlobal ();
- Mem_PrintStats ();
+ Mem_CheckSentinelsGlobal();
+ Mem_PrintStats();
}
@@ -589,8 +692,12 @@
*/
void Memory_Init( void )
{
+ assert( !memory_initialized );
+
zoneMemPool = Mem_AllocPool( NULL, "Zone" );
tempMemPool = Mem_AllocTempPool( "Temporary Memory" );
+
+ memory_initialized = qtrue;
}
/*
@@ -600,10 +707,14 @@
*/
void Memory_InitCommands( void )
{
+ assert( !commands_initialized );
+
developerMemory = Cvar_Get( "developerMemory", "0", 0 );
Cmd_AddCommand( "memlist", MemList_f );
Cmd_AddCommand( "memstats", MemStats_f );
+
+ commands_initialized = qtrue;
}
/*
@@ -615,26 +726,43 @@
*/
void Memory_Shutdown( void )
{
- static qboolean isdown = qfalse;
mempool_t *pool, *next;
- if( isdown )
+ if( !memory_initialized )
return;
// set the cvar to NULL so nothing is printed to non-existing console
developerMemory = NULL;
- Cmd_RemoveCommand( "memlist" );
- Cmd_RemoveCommand( "memstats" );
+ Mem_CheckSentinelsGlobal();
- isdown = qtrue;
+ Mem_FreePool( &zoneMemPool );
+ Mem_FreePool( &tempMemPool );
- Mem_CheckSentinelsGlobal ();
-
- for( pool = poolChain; pool; pool = next ){
+ for( pool = poolChain; pool; pool = next )
+ {
// do it here, because pool is to be freed
// and the chain will be broken
next = pool->next;
+#ifdef SHOW_NONFREED
+ Com_Printf( "Warning: Memory pool %s was never freed\n", pool->name );
+#endif
Mem_FreePool( &pool );
}
+
+ memory_initialized = qfalse;
}
+
+/*
+========================
+Memory_ShutdownCommands
+========================
+*/
+void Memory_ShutdownCommands( void )
+{
+ if( !commands_initialized )
+ return;
+
+ Cmd_RemoveCommand( "memlist" );
+ Cmd_RemoveCommand( "memstats" );
+}
Modified: trunk/qfusion/source/qcommon/qcommon.h
===================================================================
--- trunk/qfusion/source/qcommon/qcommon.h 2008-02-17 20:30:30 UTC (rev 805)
+++ trunk/qfusion/source/qcommon/qcommon.h 2008-02-19 18:24:33 UTC (rev 806)
@@ -837,9 +837,9 @@
void Memory_InitCommands (void);
void Memory_Shutdown (void);
-void *_Mem_AllocExt ( mempool_t *pool, int size, int z, int musthave, int canthave, const char *filename, int fileline );
-void *_Mem_Alloc ( mempool_t *pool, int size, int musthave, int canthave, const char *filename, int fileline );
-void *_Mem_Realloc ( void *data, int size, const char *filename, int fileline );
+void *_Mem_AllocExt ( mempool_t *pool, size_t size, int z, int musthave, int canthave, const char *filename, int fileline );
+void *_Mem_Alloc ( mempool_t *pool, size_t size, int musthave, int canthave, const char *filename, int fileline );
+void *_Mem_Realloc ( void *data, size_t size, const char *filename, int fileline );
void _Mem_Free ( void *data, int musthave, int canthave, const char *filename, int fileline );
mempool_t *_Mem_AllocPool ( mempool_t *parent, const char *name, int flags, const char *filename, int fileline );
mempool_t *_Mem_AllocTempPool ( const char *name, const char *filename, int fileline );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2008-02-17 20:30:53
|
Revision: 805
http://l33t.svn.sourceforge.net/l33t/?rev=805&view=rev
Author: digiman
Date: 2008-02-17 12:30:30 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
Sync to Warsow
Modified Paths:
--------------
trunk/qfusion/source/cgame/cg_ents.c
trunk/qfusion/source/cgame/cg_public.h
trunk/qfusion/source/cgame/cg_screen.c
trunk/qfusion/source/cgame/cg_syscalls.h
trunk/qfusion/source/cgame/cg_view.c
trunk/qfusion/source/cgame/ref.h
trunk/qfusion/source/client/cl_game.c
trunk/qfusion/source/client/cl_vid.c
trunk/qfusion/source/client/snd_dma.c
trunk/qfusion/source/client/vid.h
trunk/qfusion/source/game/g_misc.c
trunk/qfusion/source/game/g_public.h
trunk/qfusion/source/game/g_spawn.c
trunk/qfusion/source/game/q_shared.c
trunk/qfusion/source/game/q_shared.h
trunk/qfusion/source/linux/vid_linux.c
trunk/qfusion/source/null/vid_null.c
trunk/qfusion/source/qcommon/common.c
trunk/qfusion/source/qcommon/cvar.c
trunk/qfusion/source/qcommon/files.c
trunk/qfusion/source/qcommon/qcommon.h
trunk/qfusion/source/qcommon/qfiles.h
trunk/qfusion/source/ref_gl/qgl.h
trunk/qfusion/source/ref_gl/r_alias.c
trunk/qfusion/source/ref_gl/r_backend.c
trunk/qfusion/source/ref_gl/r_backend.h
trunk/qfusion/source/ref_gl/r_bloom.c
trunk/qfusion/source/ref_gl/r_cin.c
trunk/qfusion/source/ref_gl/r_cull.c
trunk/qfusion/source/ref_gl/r_glimp.h
trunk/qfusion/source/ref_gl/r_image.c
trunk/qfusion/source/ref_gl/r_light.c
trunk/qfusion/source/ref_gl/r_local.h
trunk/qfusion/source/ref_gl/r_main.c
trunk/qfusion/source/ref_gl/r_math.c
trunk/qfusion/source/ref_gl/r_math.h
trunk/qfusion/source/ref_gl/r_mesh.c
trunk/qfusion/source/ref_gl/r_mesh.h
trunk/qfusion/source/ref_gl/r_model.c
trunk/qfusion/source/ref_gl/r_model.h
trunk/qfusion/source/ref_gl/r_poly.c
trunk/qfusion/source/ref_gl/r_program.c
trunk/qfusion/source/ref_gl/r_public.h
trunk/qfusion/source/ref_gl/r_register.c
trunk/qfusion/source/ref_gl/r_shader.c
trunk/qfusion/source/ref_gl/r_shader.h
trunk/qfusion/source/ref_gl/r_shadow.c
trunk/qfusion/source/ref_gl/r_shadow.h
trunk/qfusion/source/ref_gl/r_skin.c
trunk/qfusion/source/ref_gl/r_skm.c
trunk/qfusion/source/ref_gl/r_sky.c
trunk/qfusion/source/ref_gl/r_surf.c
trunk/qfusion/source/server/sv_ents.c
trunk/qfusion/source/ui/ui_public.h
trunk/qfusion/source/win32/vid_win.c
Modified: trunk/qfusion/source/cgame/cg_ents.c
===================================================================
--- trunk/qfusion/source/cgame/cg_ents.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/cg_ents.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -192,25 +192,17 @@
Matrix_Identity( ent.axis );
// when origin and origin2 are the same, it's drawn as a mirror, otherwise as portal
- if( !VectorCompare( ent.origin, ent.origin2 ) ) {
- vec3_t dir;
-
+ if( !VectorCompare( ent.origin, ent.origin2 ) )
+ {
cg.portalInView = qtrue;
- ByteToDir( state->skinnum, dir );
- NormalVectorToAxis( dir, ent.axis );
+ ent.frame = state->skinnum;
+ if( state->modelindex3 )
+ {
+ float phase = cent->current.frame / 256.0f;
+ float speed = cent->current.modelindex2 ? cent->current.modelindex2 : 50;
+ Matrix_Rotate( ent.axis, 5 * sin( ( phase + cg.time * 0.001 * speed * 0.01 ) * M_TWOPI ), 1, 0, 0 );
- if( state->modelindex3 ) {
- float phase = (float)state->frame / 256.0f;
- float speed = (float)(state->modelindex2 ? state->modelindex2 : 50);
- vec3_t tmp[3], tmp2[3];
-
- // FIXME: this is embarrassing...
- Matrix_Identity( tmp );
- Matrix_Rotate( tmp, 5 * sin( (phase + cg.time * 0.001 * speed * 0.01) * M_TWOPI ), 1, 0, 0 );
- Matrix_Transpose( tmp, tmp2 );
- Matrix_Multiply( tmp2, ent.axis, tmp );
- Matrix_Copy( tmp, ent.axis );
}
}
@@ -427,6 +419,7 @@
ent.flags = renderfx & RF_MINLIGHT; // renderfx go on color shell entity
else
ent.flags = renderfx;
+ ent.flags |= RF_PLANARSHADOW;
// respawning items
if( cent->respawnTime )
Modified: trunk/qfusion/source/cgame/cg_public.h
===================================================================
--- trunk/qfusion/source/cgame/cg_public.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/cg_public.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -20,7 +20,7 @@
// cg_public.h -- client game dll information visible to engine
-#define CGAME_API_VERSION 5
+#define CGAME_API_VERSION 6
//
// structs and variables shared with the main engine
@@ -57,12 +57,12 @@
void (*Print)( char *msg );
// console variable interaction
- cvar_t *(*Cvar_Get)( char *name, char *value, int flags );
- cvar_t *(*Cvar_Set)( char *name, char *value );
- void (*Cvar_SetValue)( char *name, float value );
- cvar_t *(*Cvar_ForceSet)( char *name, char *value ); // will return 0 0 if not found
- float (*Cvar_VariableValue)( char *name );
- char *(*Cvar_VariableString)( char *name );
+ cvar_t *(*Cvar_Get)( const char *name, const char *value, int flags );
+ cvar_t *(*Cvar_Set)( const char *name, const char *value );
+ void (*Cvar_SetValue)( const char *name, float value );
+ cvar_t *(*Cvar_ForceSet)( const char *name, const char *value ); // will return 0 0 if not found
+ float (*Cvar_VariableValue)( const char *name );
+ char *(*Cvar_VariableString)( const char *name );
int (*Cmd_Argc)( void );
char *(*Cmd_Argv)( int arg );
@@ -109,6 +109,7 @@
void (*R_AddPolyToScene)( poly_t *poly );
void (*R_AddLightStyleToScene)( int style, float r, float g, float b );
void (*R_RenderScene)( refdef_t *fd );
+ const char *(*R_SpeedsMessage)( char *out, size_t size );
void (*R_RegisterWorldModel)( char *name );
void (*R_ModelBounds)( struct model_s *mod, vec3_t mins, vec3_t maxs );
struct model_s *(*R_RegisterModel)( char *name );
@@ -119,7 +120,7 @@
void (*R_DrawStretchPic)( int x, int y, int w, int h, float s1, float t1, float s2, float t2, vec4_t color, struct shader_s *shader );
void (*R_TransformVectorToScreen)( refdef_t *rd, vec3_t in, vec2_t out );
int (*R_SkeletalGetNumBones)( struct model_s *mod, int *numFrames );
- int (*R_SkeletalGetBoneInfo)( struct model_s *mod, int bone, char *name, int size, int *flags );
+ int (*R_SkeletalGetBoneInfo)( struct model_s *mod, int bone, char *name, size_t name_size, int *flags );
void (*R_SkeletalGetBonePose)( struct model_s *mod, int bone, int frame, bonepose_t *bonepose );
void (*R_SetCustomColor)( int num, int r, int g, int b );
void (*R_LightForOrigin)( vec3_t origin, vec3_t dir, vec4_t ambient, vec4_t diffuse, float radius );
Modified: trunk/qfusion/source/cgame/cg_screen.c
===================================================================
--- trunk/qfusion/source/cgame/cg_screen.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/cg_screen.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -299,6 +299,48 @@
}
/*
+================
+SCR_DrawRSpeeds
+================
+*/
+void SCR_DrawRSpeeds( void )
+{
+ char msg[1024];
+ int x, y;
+ vec4_t color;
+
+ x = 5;
+ y = cgs.vidHeight / 2;
+ Vector4Copy( colorWhite, color );
+
+ trap_R_SpeedsMessage( msg, sizeof( msg ) );
+
+ if( msg[0] )
+ {
+ int height;
+ char *p, *start, *end;
+
+ height = SMALL_CHAR_HEIGHT;
+
+ p = start = msg;
+ do
+ {
+ end = strchr( p, '\n' );
+ if( end )
+ msg[end-start] = '\0';
+
+ CG_DrawString( x, y, p, FONT_SMALL, color );
+ y += height;
+
+ if( end )
+ p = end + 1;
+ else
+ break;
+ } while( 1 );
+ }
+}
+
+/*
=================
SCR_DrawCrosshair
=================
@@ -860,6 +902,8 @@
*/
void SCR_Draw2D( void )
{
+ SCR_DrawRSpeeds ();
+
SCR_DrawCrosshair ();
SCR_DrawStats ();
Modified: trunk/qfusion/source/cgame/cg_syscalls.h
===================================================================
--- trunk/qfusion/source/cgame/cg_syscalls.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/cg_syscalls.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -184,6 +184,10 @@
CGAME_IMPORT.R_RenderScene( fd );
}
+static inline const char *trap_R_SpeedsMessage( char *out, size_t size ) {
+ return CGAME_IMPORT.R_SpeedsMessage( out, size );
+}
+
static inline void trap_R_RegisterWorldModel( char *name ) {
CGAME_IMPORT.R_RegisterWorldModel( name );
}
Modified: trunk/qfusion/source/cgame/cg_view.c
===================================================================
--- trunk/qfusion/source/cgame/cg_view.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/cg_view.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -208,15 +208,20 @@
*/
int CG_SkyPortal( void )
{
- float fov;
- vec3_t origin;
+ float fov = 0;
+ float scale = 0;
+ float yawspeed = 0;
+ skyportal_t *sp = &cg.refdef.skyportal;
- if( cgs.configStrings[CS_SKYBOXORG][0] == '\0' )
+ if( cgs.configStrings[CS_SKYBOX][0] == '\0' )
return 0;
- if( sscanf( cgs.configStrings[CS_SKYBOXORG], "%f %f %f %f", &origin[0], &origin[1], &origin[2], &fov ) == 4 ) {
- cg.refdef.skyportal.fov = fov;
- VectorCopy( origin, cg.refdef.skyportal.origin );
+ if( sscanf( cgs.configStrings[CS_SKYBOX], "%f %f %f %f %f %f",
+ &sp->vieworg[0], &sp->vieworg[1], &sp->vieworg[2], &fov, &scale, &yawspeed ) >= 3 )
+ {
+ sp->fov = fov;
+ sp->scale = scale ? 1.0f / scale : 0;
+ VectorSet( sp->viewanglesOffset, 0, cg.refdef.time * 0.001f * yawspeed, 0 );
return RDF_SKYPORTALINVIEW;
}
Modified: trunk/qfusion/source/cgame/ref.h
===================================================================
--- trunk/qfusion/source/cgame/ref.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/ref.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -21,10 +21,10 @@
#define __REF_H
// FIXME: move these to r_local.h?
-#define MAX_DLIGHTS 32
-#define MAX_ENTITIES 2048
-#define MAX_POLY_VERTS 3000
-#define MAX_POLYS 2048
+#define MAX_DLIGHTS 32
+#define MAX_ENTITIES 2048
+#define MAX_POLY_VERTS 3000
+#define MAX_POLYS 2048
// refdef flags
#define RDF_UNDERWATER 1 // warp the screen as apropriate
@@ -34,6 +34,7 @@
#define RDF_PORTALINVIEW 16 // cull entities using vis too because pvs\areabits are merged serverside
#define RDF_SKYPORTALINVIEW 32 // draw skyportal instead of regular sky
#define RDF_NOFOVADJUSTMENT 64 // do not adjust fov for widescreen
+#define RDF_WORLDOUTLINES 128 // draw cell outlines for world surfaces
// skm flags
#define SKM_ATTACHMENT_BONE 1
@@ -79,7 +80,9 @@
typedef struct
{
float fov;
- vec3_t origin;
+ float scale;
+ vec3_t vieworg;
+ vec3_t viewanglesOffset;
} skyportal_t;
typedef enum
@@ -89,11 +92,11 @@
RT_PORTALSURFACE,
NUM_RTYPES
-} entity_rtype_t;
+} refEntityType_t;
typedef struct entity_s
{
- entity_rtype_t rtype;
+ refEntityType_t rtype;
union
{
int flags;
@@ -138,6 +141,15 @@
float scale;
float radius; // used as RT_SPRITE's radius
float rotation;
+
+#ifdef HARDWARE_OUTLINES
+ float outlineHeight;
+ union
+ {
+ byte_vec4_t outlineColor;
+ qbyte outlineRGBA[4];
+ };
+#endif
} entity_t;
typedef struct
Modified: trunk/qfusion/source/client/cl_game.c
===================================================================
--- trunk/qfusion/source/client/cl_game.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/client/cl_game.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -179,6 +179,7 @@
import.R_AddPolyToScene = R_AddPolyToScene;
import.R_AddLightStyleToScene = R_AddLightStyleToScene;
import.R_RenderScene = R_RenderScene;
+ import.R_SpeedsMessage = R_SpeedsMessage;
import.R_RegisterWorldModel = CL_GameModule_R_RegisterWorldModel;
import.R_ModelBounds = R_ModelBounds;
import.R_RegisterModel = R_RegisterModel;
Modified: trunk/qfusion/source/client/cl_vid.c
===================================================================
--- trunk/qfusion/source/client/cl_vid.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/client/cl_vid.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -37,11 +37,12 @@
#define VID_NUM_MODES (int)( sizeof( vid_modes ) / sizeof( vid_modes[0] ) )
-qboolean vid_ref_modified;
-qboolean vid_ref_active;
+static qboolean vid_ref_modified;
+static qboolean vid_ref_verbose;
+static qboolean vid_ref_active;
// These are system specific functions
-int VID_Sys_Init( void ); // wrapper around R_Init
+int VID_Sys_Init( qboolean verbose ); // wrapper around R_Init
void VID_Front_f( void );
void VID_UpdateWindowPosAndSize( int x, int y );
void VID_EnableAltTab( qboolean enable );
@@ -55,14 +56,15 @@
cause the entire video mode and refresh DLL to be reset on the next frame.
============
*/
-void VID_Restart (void)
+void VID_Restart( qboolean verbose )
{
vid_ref_modified = qtrue;
+ vid_ref_verbose = verbose;
}
void VID_Restart_f (void)
{
- VID_Restart ();
+ VID_Restart( (Cmd_Argc() >= 2 ? qtrue : qfalse) );
}
/*
@@ -175,11 +177,11 @@
CL_ShutdownMedia ();
if( vid_ref_active ) {
- R_Shutdown ();
+ R_Shutdown( qfalse );
vid_ref_active = qfalse;
}
- if( VID_Sys_Init () == -1 )
+ if( VID_Sys_Init( vid_ref_verbose ) == -1 )
Com_Error ( ERR_FATAL, "Failed to load %s", (gl_driver && gl_driver->name) ? gl_driver->string : "" );
CL_InitMedia ();
@@ -198,6 +200,7 @@
vid_ref_active = qtrue;
vid_ref_modified = qfalse;
+ vid_ref_verbose = qtrue;
}
/*
@@ -238,6 +241,7 @@
/* Start the graphics mode and load refresh DLL */
vid_ref_modified = qtrue;
vid_ref_active = qfalse;
+ vid_ref_verbose = qtrue;
vid_fullscreen->modified = qtrue;
VID_CheckChanges ();
}
@@ -250,7 +254,7 @@
void VID_Shutdown (void)
{
if( vid_ref_active ) {
- R_Shutdown();
+ R_Shutdown( qtrue );
vid_ref_active = qfalse;
}
Modified: trunk/qfusion/source/client/snd_dma.c
===================================================================
--- trunk/qfusion/source/client/snd_dma.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/client/snd_dma.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -246,11 +246,13 @@
*/
void S_Restart( qboolean noVideo )
{
+ qboolean verbose = (Cmd_Argc() >= 2 ? qtrue : qfalse);
+
S_Shutdown ();
S_Init ();
if( !noVideo )
- VID_Restart ();
+ VID_Restart( verbose );
}
// =======================================================================
Modified: trunk/qfusion/source/client/vid.h
===================================================================
--- trunk/qfusion/source/client/vid.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/client/vid.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -29,5 +29,5 @@
// Video module initialisation etc
void VID_Init (void);
void VID_Shutdown (void);
-void VID_Restart (void);
+void VID_Restart( qboolean verbose );
void VID_CheckChanges (void);
Modified: trunk/qfusion/source/game/g_misc.c
===================================================================
--- trunk/qfusion/source/game/g_misc.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/game/g_misc.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -1918,5 +1918,5 @@
// st.fov = 90;
ent->r.svflags |= SVF_NOCLIENT;
- trap_ConfigString( CS_SKYBOXORG, va("%.3f %.3f %.3f %.1f", ent->s.origin[0], ent->s.origin[1], ent->s.origin[2], st.fov ) );
+ trap_ConfigString( CS_SKYBOX, va("%.3f %.3f %.3f %.1f", ent->s.origin[0], ent->s.origin[1], ent->s.origin[2], st.fov ) );
}
Modified: trunk/qfusion/source/game/g_public.h
===================================================================
--- trunk/qfusion/source/game/g_public.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/game/g_public.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -20,7 +20,7 @@
// g_public.h -- game dll information visible to server
-#define GAME_API_VERSION 3
+#define GAME_API_VERSION 4
// edict->svflags
#define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects
@@ -149,9 +149,9 @@
void (*Mem_Free)( void *data, const char *filename, int fileline );
// console variable interaction
- cvar_t *(*Cvar_Get)( char *name, char *value, int flags );
- cvar_t *(*Cvar_Set)( char *name, char *value );
- cvar_t *(*Cvar_ForceSet)( char *name, char *value ); // will return 0 0 if not found
+ cvar_t *(*Cvar_Get)( const char *name, const char *value, int flags );
+ cvar_t *(*Cvar_Set)( const char *name, const char *value );
+ cvar_t *(*Cvar_ForceSet)( const char *name, const char *value ); // will return 0 0 if not found
// ClientCommand and ServerCommand parameter access
int (*Cmd_Argc)( void );
Modified: trunk/qfusion/source/game/g_spawn.c
===================================================================
--- trunk/qfusion/source/game/g_spawn.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/game/g_spawn.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -710,7 +710,7 @@
trap_ConfigString (CS_MAPNAME, level.mapname);
trap_ConfigString (CS_MAXCLIENTS, va("%i", sv_maxclients->integer ) );
trap_ConfigString (CS_AIRACCEL, va("%g", sv_airaccelerate->integer) );
- trap_ConfigString (CS_SKYBOXORG, "");
+ trap_ConfigString (CS_SKYBOX, "");
// status bar program
if (deathmatch->integer)
Modified: trunk/qfusion/source/game/q_shared.c
===================================================================
--- trunk/qfusion/source/game/q_shared.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/game/q_shared.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -167,6 +167,18 @@
}
/*
+==================
+COM_DefaultExtension
+==================
+*/
+char *COM_ReplaceExtension( char *path, const char *extension )
+{
+ COM_StripExtension( path, path );
+ strcat( path, extension );
+ return path;
+}
+
+/*
============================================================================
BYTE ORDER FUNCTIONS
@@ -349,7 +361,105 @@
return string[str_index];
}
+/*
+==============
+COM_Compress
+Parse a token out of a string
+==============
+*/
+int COM_Compress( char *data_p )
+{
+ char *in, *out;
+ int c;
+ qboolean newline = qfalse, whitespace = qfalse;
+
+ in = out = data_p;
+ if( in )
+ {
+ while( ( c = *in ) != 0 )
+ {
+ // skip double slash comments
+ if( c == '/' && in[1] == '/' )
+ {
+ while( *in && *in != '\n' )
+ {
+ in++;
+ }
+ // skip /* */ comments
+ }
+ else if( c == '/' && in[1] == '*' )
+ {
+ while( *in && ( *in != '*' || in[1] != '/' ) )
+ in++;
+ if( *in )
+ in += 2;
+ // record when we hit a newline
+ }
+ else if( c == '\n' || c == '\r' )
+ {
+ newline = qtrue;
+ in++;
+ // record when we hit whitespace
+ }
+ else if( c == ' ' || c == '\t' )
+ {
+ whitespace = qtrue;
+ in++;
+ // an actual token
+ }
+ else
+ {
+ // if we have a pending newline, emit it (and it counts as whitespace)
+ if( newline )
+ {
+ *out++ = '\n';
+ newline = qfalse;
+ whitespace = qfalse;
+ }
+ if( whitespace )
+ {
+ *out++ = ' ';
+ whitespace = qfalse;
+ }
+
+ // copy quoted strings unmolested
+ if( c == '"' )
+ {
+ *out++ = c;
+ in++;
+ while( 1 )
+ {
+ c = *in;
+ if( c && c != '"' )
+ {
+ *out++ = c;
+ in++;
+ }
+ else
+ {
+ break;
+ }
+ }
+ if( c == '"' )
+ {
+ *out++ = c;
+ in++;
+ }
+ }
+ else
+ {
+ *out = c;
+ out++;
+ in++;
+ }
+ }
+ }
+ }
+ *out = 0;
+ return out - data_p;
+}
+
char com_token[MAX_TOKEN_CHARS];
/*
@@ -359,11 +469,11 @@
Parse a token out of a string
==============
*/
-char *COM_ParseExt (char **data_p, qboolean nl)
+char *COM_ParseExt (const char **data_p, qboolean nl)
{
int c;
int len;
- char *data;
+ const char *data;
qboolean newlines = qfalse;
data = *data_p;
@@ -561,7 +671,7 @@
Q_isdigit
==============
*/
-qboolean Q_isdigit( char *str )
+qboolean Q_isdigit( const char *str )
{
if( str && *str ) {
while( isdigit( *str ) ) str++;
@@ -572,6 +682,25 @@
}
/*
+==============
+Q_strrstr
+==============
+*/
+const char *Q_strrstr( const char *s, const char *substr )
+{
+ const char *p;
+
+ s = p = strstr( s, substr );
+ while( s != NULL )
+ {
+ p = s;
+ s = strstr( s + 1, substr );
+ }
+
+ return p;
+}
+
+/*
============================================================================
WILDCARD COMPARES FUNCTIONS
Modified: trunk/qfusion/source/game/q_shared.h
===================================================================
--- trunk/qfusion/source/game/q_shared.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/game/q_shared.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -259,6 +259,7 @@
#define MAX_MODELS 256 // these are sent over the net as bytes
#define MAX_SOUNDS 256 // so they cannot be blindly increased
#define MAX_IMAGES 256
+#define MAX_SKINFILES 256
#define MAX_ITEMS 256
#define MAX_GENERAL (MAX_CLIENTS*2) // general config strings
@@ -473,9 +474,12 @@
char *COM_FileBase( const char *in, char *out );
char *COM_FilePath( const char *in, char *out );
char *COM_DefaultExtension( char *path, const char *extension );
+char *COM_ReplaceExtension( char *path, const char *extension );
+int COM_Compress( char *data_p );
+
// data is an in/out parm, returns a parsed out token
-char *COM_ParseExt (char **data_p, qboolean nl);
+char *COM_ParseExt (const char **data_p, qboolean nl);
#define COM_Parse(data_p) COM_ParseExt(data_p,qtrue)
//=============================================
@@ -530,7 +534,8 @@
void Q_snprintfz( char *dest, size_t size, const char *fmt, ... );
char *Q_strlwr( char *s );
qboolean Q_WildCmp( const char *pattern, const char *text );
-qboolean Q_isdigit( char *str );
+qboolean Q_isdigit( const char *str );
+const char *Q_strrstr( const char *s, const char *substr );
//=============================================
#if !defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG)
@@ -924,7 +929,7 @@
#define CS_AUDIOTRACK 2
#define CS_STATUSBAR 3 // display program string
#define CS_GAMETYPE 4
-#define CS_SKYBOXORG 5 // sky portal origin
+#define CS_SKYBOX 5 // sky portal origin
#define CS_AIRACCEL 29 // air acceleration control
#define CS_MAXCLIENTS 30
Modified: trunk/qfusion/source/linux/vid_linux.c
===================================================================
--- trunk/qfusion/source/linux/vid_linux.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/linux/vid_linux.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -25,8 +25,8 @@
VID_Sys_Init
============
*/
-int VID_Sys_Init( void ) {
- return R_Init( NULL, NULL );
+int VID_Sys_Init( qboolean verbose ) {
+ return R_Init( NULL, NULL, verbose );
}
/*
Modified: trunk/qfusion/source/null/vid_null.c
===================================================================
--- trunk/qfusion/source/null/vid_null.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/null/vid_null.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -27,8 +27,8 @@
VID_Sys_Init
============
*/
-int VID_Sys_Init( void ) {
- return R_Init( NULL, NULL );
+int VID_Sys_Init( qboolean verbose ) {
+ return R_Init( NULL, NULL, verbose );
}
/*
Modified: trunk/qfusion/source/qcommon/common.c
===================================================================
--- trunk/qfusion/source/qcommon/common.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/qcommon/common.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -303,7 +303,7 @@
Returns hash key for a string
==========
*/
-unsigned int Com_HashKey (char *name, int hashsize)
+unsigned int Com_HashKey (const char *name, int hashsize)
{
int i;
unsigned int v;
Modified: trunk/qfusion/source/qcommon/cvar.c
===================================================================
--- trunk/qfusion/source/qcommon/cvar.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/qcommon/cvar.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -31,7 +31,7 @@
Cvar_InfoValidate
============
*/
-static qboolean Cvar_InfoValidate (char *s, qboolean name)
+static qboolean Cvar_InfoValidate (const char *s, qboolean name)
{
if (strstr (s, "\\"))
return qfalse;
@@ -49,7 +49,7 @@
Cvar_FindVar
============
*/
-static cvar_t *Cvar_FindVar (char *var_name)
+static cvar_t *Cvar_FindVar (const char *var_name)
{
unsigned hash;
cvar_t *var;
@@ -67,7 +67,7 @@
Cvar_VariableValue
============
*/
-float Cvar_VariableValue (char *var_name)
+float Cvar_VariableValue (const char *var_name)
{
cvar_t *var;
@@ -83,7 +83,7 @@
Cvar_VariableString
============
*/
-char *Cvar_VariableString (char *var_name)
+char *Cvar_VariableString (const char *var_name)
{
cvar_t *var;
@@ -99,7 +99,7 @@
Cvar_CompleteVariable
============
*/
-char *Cvar_CompleteVariable (char *partial)
+char *Cvar_CompleteVariable (const char *partial)
{
cvar_t *cvar;
int len;
@@ -131,7 +131,7 @@
The flags will be or'ed and default value overwritten in if the variable exists.
============
*/
-cvar_t *Cvar_Get (char *var_name, char *var_value, int flags)
+cvar_t *Cvar_Get (const char *var_name, const char *var_value, int flags)
{
unsigned hash;
cvar_t *var;
@@ -204,7 +204,7 @@
Cvar_Set2
============
*/
-cvar_t *Cvar_Set2 (char *var_name, char *value, qboolean force)
+cvar_t *Cvar_Set2 (const char *var_name, const char *value, qboolean force)
{
cvar_t *var;
@@ -317,7 +317,7 @@
Cvar_ForceSet
============
*/
-cvar_t *Cvar_ForceSet (char *var_name, char *value)
+cvar_t *Cvar_ForceSet (const char *var_name, const char *value)
{
return Cvar_Set2 (var_name, value, qtrue);
}
@@ -327,7 +327,7 @@
Cvar_Set
============
*/
-cvar_t *Cvar_Set (char *var_name, char *value)
+cvar_t *Cvar_Set (const char *var_name, const char *value)
{
return Cvar_Set2 (var_name, value, qfalse);
}
@@ -337,7 +337,7 @@
Cvar_FullSet
============
*/
-cvar_t *Cvar_FullSet (char *var_name, char *value, int flags, qboolean overwriteFlags)
+cvar_t *Cvar_FullSet (const char *var_name, const char *value, int flags, qboolean overwriteFlags)
{
cvar_t *var;
@@ -369,7 +369,7 @@
Cvar_SetValue
============
*/
-void Cvar_SetValue (char *var_name, float value)
+void Cvar_SetValue (const char *var_name, float value)
{
char val[32];
@@ -671,7 +671,7 @@
*/
int
-Cvar_CompleteCountPossible (char *partial)
+Cvar_CompleteCountPossible (const char *partial)
{
cvar_t *v;
int len, h = 0;
@@ -698,7 +698,7 @@
Thanks to taniwha
*/
-char **Cvar_CompleteBuildList (char *partial)
+char **Cvar_CompleteBuildList (const char *partial)
{
cvar_t *v;
int len;
Modified: trunk/qfusion/source/qcommon/files.c
===================================================================
--- trunk/qfusion/source/qcommon/files.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/qcommon/files.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -1477,7 +1477,7 @@
*/
void FS_ExecAutoexec( void )
{
- char *dir;
+ const char *dir;
char name[MAX_OSPATH];
dir = Cvar_VariableString( "fs_gamedir" );
@@ -1519,7 +1519,7 @@
// flush all data, so it will be forced to reload
if( dedicated && !dedicated->integer )
- Cbuf_AddText( "snd_restart\nin_restart\n" );
+ Cbuf_AddText( "snd_restart 1\nin_restart\n" );
Q_snprintfz( fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basepath->string, dir );
Modified: trunk/qfusion/source/qcommon/qcommon.h
===================================================================
--- trunk/qfusion/source/qcommon/qcommon.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/qcommon/qcommon.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -455,36 +455,36 @@
extern cvar_t *cvar_vars;
-cvar_t *Cvar_Get (char *var_name, char *value, int flags);
+cvar_t *Cvar_Get (const char *var_name, const char *value, int flags);
// creates the variable if it doesn't exist, or returns the existing one
// if it exists, the value will not be changed, but flags will be ORed in
// that allows variables to be unarchived without needing bitflags
-cvar_t *Cvar_Set (char *var_name, char *value);
+cvar_t *Cvar_Set (const char *var_name, const char *value);
// will create the variable if it doesn't exist
-cvar_t *Cvar_ForceSet (char *var_name, char *value);
+cvar_t *Cvar_ForceSet (const char *var_name, const char *value);
// will set the variable even if NOSET or LATCH
-cvar_t *Cvar_FullSet (char *var_name, char *value, int flags, qboolean overwrite_flags);
+cvar_t *Cvar_FullSet (const char *var_name, const char *value, int flags, qboolean overwrite_flags);
-void Cvar_SetValue (char *var_name, float value);
+void Cvar_SetValue (const char *var_name, float value);
// expands value to a string and calls Cvar_Set
-float Cvar_VariableValue (char *var_name);
+float Cvar_VariableValue (const char *var_name);
// returns 0 if not defined or non numeric
-char *Cvar_VariableString (char *var_name);
+char *Cvar_VariableString (const char *var_name);
// returns an empty string if not defined
-char *Cvar_CompleteVariable (char *partial);
+char *Cvar_CompleteVariable (const char *partial);
// attempts to match a partial variable name for command line completion
// returns NULL if nothing fits
void Cmd_WriteAliases (FILE *f);
-int Cvar_CompleteCountPossible (char *partial);
-char **Cvar_CompleteBuildList (char *partial);
+int Cvar_CompleteCountPossible (const char *partial);
+char **Cvar_CompleteBuildList (const char *partial);
char *Cvar_TabComplete (const char *partial);
void Cvar_GetLatchedVars (int flags);
@@ -692,7 +692,7 @@
void Com_PageInMemory (qbyte *buffer, int size);
-unsigned int Com_HashKey (char *name, int hashsize);
+unsigned int Com_HashKey (const char *name, int hashsize);
extern cvar_t *developer;
extern cvar_t *dedicated;
Modified: trunk/qfusion/source/qcommon/qfiles.h
===================================================================
--- trunk/qfusion/source/qcommon/qfiles.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/qcommon/qfiles.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -187,7 +187,7 @@
int num_verts;
int num_tris;
- int ofs_indexes;
+ int ofs_elems;
int ofs_skins;
int ofs_tcs;
int ofs_verts;
@@ -433,7 +433,7 @@
#define LUMP_BRUSHES 8
#define LUMP_BRUSHSIDES 9
#define LUMP_VERTEXES 10
-#define LUMP_INDEXES 11
+#define LUMP_ELEMENTS 11
#define LUMP_FOGS 12
#define LUMP_FACES 13
#define LUMP_LIGHTING 14
@@ -573,8 +573,8 @@
int firstvert;
int numverts;
- unsigned firstindex;
- int numindexes;
+ unsigned firstelem;
+ int numelems;
int lm_texnum; // lightmap info
int lm_offset[2];
@@ -597,8 +597,8 @@
int firstvert;
int numverts;
- unsigned firstindex;
- int numindexes;
+ unsigned firstelem;
+ int numelems;
unsigned char lightmapStyles[MAX_LIGHTMAPS];
unsigned char vertexStyles[MAX_LIGHTMAPS];
Modified: trunk/qfusion/source/ref_gl/qgl.h
===================================================================
--- trunk/qfusion/source/ref_gl/qgl.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/ref_gl/qgl.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -56,8 +56,8 @@
/*
** QGL.H
*/
-#ifndef QGL_H
-#define QGL_H
+#ifndef __QGL_H__
+#define __QGL_H__
#define GL_GLEXT_LEGACY
#define GLX_GLXEXT_LEGACY
@@ -84,12 +84,6 @@
QGL_EXTERN void *qglGetProcAddress( const GLubyte * );
QGL_EXTERN const char *(*qglGetGLWExtensionsString)( void );
-#endif
-
-#ifndef APIENTRY
-# define APIENTRY
-#endif
-
/*
** extension constants
*/
@@ -105,6 +99,7 @@
#define GL_POLYGON_OFFSET 0x8037
#endif
+/* GL_ARB_texture_env_combine */
#ifndef GL_ARB_texture_env_combine
#define GL_ARB_texture_env_combine
@@ -129,7 +124,6 @@
#define GL_OPERAND0_ALPHA_ARB 0x8598
#define GL_OPERAND1_ALPHA_ARB 0x8599
#define GL_OPERAND2_ALPHA_ARB 0x859A
-
#endif /* GL_ARB_texture_env_combine */
/* GL_ARB_texture_compression */
@@ -147,7 +141,6 @@
#define GL_TEXTURE_COMPRESSED_ARB 0x86A1
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
-
#endif /* GL_ARB_texture_compression */
/* GL_EXT_texture_filter_anisotropic */
@@ -156,7 +149,6 @@
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-
#endif /* GL_EXT_texture_filter_anisotropic */
/* GL_EXT_texture_edge_clamp */
@@ -164,7 +156,6 @@
#define GL_EXT_texture_edge_clamp
#define GL_CLAMP_TO_EDGE 0x812F
-
#endif /* GL_EXT_texture_edge_clamp */
/* GL_ARB_vertex_buffer_object */
@@ -205,7 +196,6 @@
#define GL_BUFFER_ACCESS_ARB 0x88BB
#define GL_BUFFER_MAPPED_ARB 0x88BC
#define GL_BUFFER_MAP_POINTER_ARB 0x88BD
-
#endif /* GL_ARB_vertex_buffer_object */
/* GL_ARB_texture_cube_map */
@@ -224,7 +214,6 @@
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
-
#endif /* GL_ARB_texture_cube_map */
/* GL_EXT_bgra */
@@ -233,10 +222,9 @@
#define GL_BGR_EXT 0x80E0
#define GL_BGRA_EXT 0x80E1
-
#endif /* GL_EXT_bgra */
-/* GL_EXT_texture3D */
+/* gl_ext_texture3D */
#ifndef GL_EXT_texture3D
#define GL_EXT_texture3D
@@ -250,7 +238,6 @@
#define GL_TEXTURE_WRAP_R 0x8072
#define GL_MAX_3D_TEXTURE_SIZE 0x8073
#define GL_TEXTURE_BINDING_3D 0x806A
-
#endif /* GL_EXT_texture3D */
/* GL_ARB_shader_objects */
@@ -260,7 +247,6 @@
typedef char GLcharARB;
typedef unsigned int GLhandleARB;
-#ifndef GL_PROGRAM_OBJECT_ARB
#define GL_PROGRAM_OBJECT_ARB 0x8B40
#define GL_OBJECT_TYPE_ARB 0x8B4E
#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
@@ -297,15 +283,12 @@
#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
#define GL_SAMPLER_2D_RECT_ARB 0x8B63
#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
-#endif
-
#endif /* GL_ARB_shader_objects */
/* GL_ARB_vertex_shader */
#ifndef GL_ARB_vertex_shader
#define GL_ARB_vertex_shader
-#ifndef GL_VERTEX_SHADER_ARB
#define GL_VERTEX_SHADER_ARB 0x8B31
#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
@@ -332,68 +315,46 @@
#define GL_FLOAT_MAT2_ARB 0x8B5A
#define GL_FLOAT_MAT3_ARB 0x8B5B
#define GL_FLOAT_MAT4_ARB 0x8B5C
-#endif
-
#endif /* GL_ARB_vertex_shader */
/* GL_ARB_fragment_shader */
#ifndef GL_ARB_fragment_shader
#define GL_ARB_fragment_shader
-#ifndef GL_FRAGMENT_SHADER_ARB
#define GL_FRAGMENT_SHADER_ARB 0x8B30
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
-#endif
-
#endif /* GL_ARB_fragment_shader */
/* GL_ARB_shading_language_100 */
#ifndef GL_ARB_shading_language_100
#define GL_ARB_shading_language_100
-#ifndef GL_SHADING_LANGUAGE_VERSION_ARB
#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
-#endif
-
#endif /* GL_ARB_shading_language_100 */
/* ARB_depth_texture */
#ifndef ARB_depth_texture
#define ARB_depth_texture
-#ifndef GL_DEPTH_COMPONENT16
#define GL_DEPTH_COMPONENT16 0x81A5
-#endif
-#ifndef GL_DEPTH_COMPONENT24
#define GL_DEPTH_COMPONENT24 0x81A6
-#endif
-#ifndef GL_DEPTH_COMPONENT32
#define GL_DEPTH_COMPONENT32 0x81A7
-#endif
-#ifndef GL_TEXTURE_DEPTH_SIZE
#define GL_TEXTURE_DEPTH_SIZE 0x884A
-#endif
-#ifndef GL_DEPTH_TEXTURE_MODE
-#define GL_DEPTH_TEXTURE_MODE 0x884B
-#endif /* GL_DEPTH_TEXTURE_MODE */
+#define GL_DEPTH_TEXTURE_MODE 0x884B
+#endif /* ARB_depth_texture */
-#endif
-
/* GL_ARB_shadow */
#ifndef GL_ARB_shadow
#define GL_ARB_shadow
-#ifndef GL_DEPTH_TEXTURE_MODE_ARB
#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E
#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF
-#endif
-
#endif /* GL_ARB_shadow */
/* GL_ARB_occlusion_query */
@@ -405,7 +366,6 @@
#define GL_QUERY_RESULT_ARB 0x8866
#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
#define GL_SAMPLES_PASSED_ARB 0x8914
-
#endif /* GL_ARB_occlusion_query */
/* GL_SGIS_generate_mipmap */
@@ -414,9 +374,18 @@
#define GL_GENERATE_MIPMAP_SGIS 0x8191
#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
-
#endif /* GL_SGIS_generate_mipmap */
+#endif /*__QGL_H__*/
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
+#ifndef QGL_FUNC
+#define QGL_FUNC
+#endif
+
// WGL Functions
QGL_WGL(PROC, wglGetProcAddress, (LPCSTR));
QGL_WGL(int, wglChoosePixelFormat, (HDC, CONST PIXELFORMATDESCRIPTOR *));
@@ -577,3 +546,5 @@
QGL_WGL_EXT(const char *, wglGetExtensionsStringEXT, (void));
QGL_WGL_EXT(BOOL, wglGetDeviceGammaRamp3DFX, (HDC, WORD *));
QGL_WGL_EXT(BOOL, wglSetDeviceGammaRamp3DFX, (HDC, WORD *));
+
+// GLX_EXT Functions
Modified: trunk/qfusion/source/ref_gl/r_alias.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_alias.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/ref_gl/r_alias.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -8,7 +8,7 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@@ -17,15 +17,16 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
// r_alias.c: Quake 2 .md2 and Quake III Arena .md3 model formats support
#include "r_local.h"
-static mesh_t alias_mesh;
+static mesh_t alias_mesh;
-static vec3_t alias_mins;
-static vec3_t alias_maxs;
-static float alias_radius;
+static vec3_t alias_mins;
+static vec3_t alias_maxs;
+static float alias_radius;
/*
=================
@@ -40,20 +41,22 @@
maliasmodel_t *aliasmodel = ( maliasmodel_t * )mod->extradata;
frame = &aliasmodel->frames[0];
- for( k = 0; k < aliasmodel->nummeshes; k++ ) {
+ for( k = 0; k < aliasmodel->nummeshes; k++ )
+ {
maliasmesh_t *mesh = &aliasmodel->meshes[k];
- size = sizeof( vec4_t ) + sizeof( vec4_t ); // xyz and normals
+ size = sizeof( vec4_t ) + sizeof( vec4_t ); // xyz and normals
if( glConfig.ext.GLSL )
- size += sizeof( vec4_t ); // s-vectors
+ size += sizeof( vec4_t ); // s-vectors
size *= mesh->numverts;
mesh->xyzArray = ( vec4_t * )Mod_Malloc( mod, size );
- mesh->normalsArray = ( vec4_t * )(( qbyte * )mesh->xyzArray + mesh->numverts * sizeof( vec4_t ));
+ mesh->normalsArray = ( vec4_t * )( ( qbyte * )mesh->xyzArray + mesh->numverts * sizeof( vec4_t ) );
if( glConfig.ext.GLSL )
- mesh->sVectorsArray = ( vec4_t * )(( qbyte * )mesh->normalsArray + mesh->numverts * sizeof( vec4_t ));
+ mesh->sVectorsArray = ( vec4_t * )( ( qbyte * )mesh->normalsArray + mesh->numverts * sizeof( vec4_t ) );
- for( i = 0; i < mesh->numverts; i++ ) {
+ for( i = 0; i < mesh->numverts; i++ )
+ {
for( j = 0; j < 3; j++ )
mesh->xyzArray[i][j] = frame->translate[j] + frame->scale[j] * mesh->vertexes[i].point[j];
mesh->xyzArray[i][3] = 1;
@@ -62,7 +65,7 @@
}
if( glConfig.ext.GLSL )
- R_BuildTangentVectors( mesh->numverts, mesh->xyzArray, mesh->normalsArray, mesh->stArray, mesh->numtris, mesh->indexes, mesh->sVectorsArray );
+ R_BuildTangentVectors( mesh->numverts, mesh->xyzArray, mesh->normalsArray, mesh->stArray, mesh->numtris, mesh->elems, mesh->sVectorsArray );
}
}
@@ -82,7 +85,7 @@
Mod_AliasCalculateVertexNormals
=================
*/
-static void Mod_AliasCalculateVertexNormals( int numIndexes, index_t *indexes, int numVerts, maliasvertex_t *v )
+static void Mod_AliasCalculateVertexNormals( int numElems, elem_t *elems, int numVerts, maliasvertex_t *v )
{
int i, j, k, vertRemap[MD2_MAX_VERTS];
vec3_t dir1, dir2, normal, trnormals[MD2_MAX_TRIANGLES];
@@ -90,24 +93,29 @@
qbyte latlongs[MD2_MAX_VERTS][2];
// count unique verts
- for( i = 0, numUniqueVerts = 0; i < numVerts; i++ ) {
- for( j = 0; j < numUniqueVerts; j++ ) {
- if( VectorCompare( v[uniqueVerts[j]].point, v[i].point ) ) {
+ for( i = 0, numUniqueVerts = 0; i < numVerts; i++ )
+ {
+ for( j = 0; j < numUniqueVerts; j++ )
+ {
+ if( VectorCompare( v[uniqueVerts[j]].point, v[i].point ) )
+ {
vertRemap[i] = j;
break;
}
}
- if( j == numUniqueVerts ) {
+ if( j == numUniqueVerts )
+ {
vertRemap[i] = numUniqueVerts;
uniqueVerts[numUniqueVerts++] = i;
}
}
- for( i = 0, j = 0; i < numIndexes; i += 3, j++ ) {
+ for( i = 0, j = 0; i < numElems; i += 3, j++ )
+ {
// calculate two mostly perpendicular edge directions
- VectorSubtract( v[indexes[i+0]].point, v[indexes[i+1]].point, dir1 );
- VectorSubtract( v[indexes[i+2]].point, v[indexes[i+1]].point, dir2 );
+ VectorSubtract( v[elems[i+0]].point, v[elems[i+1]].point, dir1 );
+ VectorSubtract( v[elems[i+2]].point, v[elems[i+1]].point, dir2 );
// we have two edge directions, we can calculate a third vector from
// them, which is the direction of the surface normal
@@ -116,11 +124,13 @@
}
// sum all triangle normals
- for( i = 0; i < numUniqueVerts; i++ ) {
+ for( i = 0; i < numUniqueVerts; i++ )
+ {
VectorClear( normal );
- for( j = 0, k = 0; j < numIndexes; j += 3, k++ ) {
- if( vertRemap[indexes[j+0]] == i || vertRemap[indexes[j+1]] == i || vertRemap[indexes[j+2]] == i )
+ for( j = 0, k = 0; j < numElems; j += 3, k++ )
+ {
+ if( vertRemap[elems[j+0]] == i || vertRemap[elems[j+1]] == i || vertRemap[elems[j+2]] == i )
VectorAdd( normal, trnormals[k], normal );
}
@@ -140,23 +150,23 @@
*/
void Mod_LoadAliasMD2Model( model_t *mod, model_t *parent, void *buffer )
{
- int i, j, k;
- int version, framesize;
- float skinwidth, skinheight;
- int numverts, numindexes;
- int indremap[MD2_MAX_TRIANGLES*3];
- index_t ptempindex[MD2_MAX_TRIANGLES*3], ptempstindex[MD2_MAX_TRIANGLES*3];
- dmd2_t *pinmodel;
- dstvert_t *pinst;
- dtriangle_t *pintri;
- daliasframe_t *pinframe;
- index_t *poutindex;
- maliasmodel_t *poutmodel;
- maliasmesh_t *poutmesh;
- vec2_t *poutcoord;
- maliasframe_t *poutframe;
- maliasvertex_t *poutvertex;
- maliasskin_t *poutskin;
+ int i, j, k;
+ int version, framesize;
+ float skinwidth, skinheight;
+ int numverts, numelems;
+ int indremap[MD2_MAX_TRIANGLES*3];
+ elem_t ptempelem[MD2_MAX_TRIANGLES*3], ptempstelem[MD2_MAX_TRIANGLES*3];
+ dmd2_t *pinmodel;
+ dstvert_t *pinst;
+ dtriangle_t *pintri;
+ daliasframe_t *pinframe;
+ elem_t *poutelem;
+ maliasmodel_t *poutmodel;
+ maliasmesh_t *poutmesh;
+ vec2_t *poutcoord;
+ maliasframe_t *poutframe;
+ maliasvertex_t *poutvertex;
+ maliasskin_t *poutskin;
pinmodel = ( dmd2_t * )buffer;
version = LittleLong( pinmodel->version );
@@ -164,10 +174,10 @@
if( version != MD2_ALIAS_VERSION )
Com_Error( ERR_DROP, "%s has wrong version number (%i should be %i)",
- mod->name, version, MD2_ALIAS_VERSION );
+ mod->name, version, MD2_ALIAS_VERSION );
mod->type = mod_alias;
- mod->aliasmodel = poutmodel = Mod_Malloc( mod, sizeof(maliasmodel_t) );
+ mod->aliasmodel = poutmodel = Mod_Malloc( mod, sizeof( maliasmodel_t ) );
mod->radius = 0;
ClearBounds( mod->mins, mod->maxs );
@@ -196,7 +206,7 @@
poutmodel->tags = NULL;
poutmodel->nummeshes = 1;
- poutmesh = poutmodel->meshes = Mod_Malloc( mod, sizeof(maliasmesh_t) );
+ poutmesh = poutmodel->meshes = Mod_Malloc( mod, sizeof( maliasmesh_t ) );
Q_strncpyz( poutmesh->name, "default", MD3_MAX_PATH );
poutmesh->numverts = LittleLong( pinmodel->num_xyz );
@@ -211,86 +221,97 @@
else if( poutmesh->numtris <= 0 )
Com_Error( ERR_DROP, "model %s has no triangles", mod->name );
- numindexes = poutmesh->numtris * 3;
- poutindex = poutmesh->indexes = Mod_Malloc( mod, numindexes * sizeof(index_t) );
+ numelems = poutmesh->numtris * 3;
+ poutelem = poutmesh->elems = Mod_Malloc( mod, numelems * sizeof( elem_t ) );
-//
-// load triangle lists
-//
+ //
+ // load triangle lists
+ //
pintri = ( dtriangle_t * )( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_tris ) );
pinst = ( dstvert_t * ) ( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_st ) );
- for( i = 0, k = 0; i < poutmesh->numtris; i++, k += 3 ) {
- for( j = 0; j < 3; j++ ) {
- ptempindex[k+j] = ( index_t )LittleShort( pintri[i].index_xyz[j] );
- ptempstindex[k+j] = ( index_t )LittleShort( pintri[i].index_st[j] );
+ for( i = 0, k = 0; i < poutmesh->numtris; i++, k += 3 )
+ {
+ for( j = 0; j < 3; j++ )
+ {
+ ptempelem[k+j] = ( elem_t )LittleShort( pintri[i].index_xyz[j] );
+ ptempstelem[k+j] = ( elem_t )LittleShort( pintri[i].index_st[j] );
}
}
-//
-// build list of unique vertexes
-//
+ //
+ // build list of unique vertexes
+ //
numverts = 0;
- memset( indremap, -1, MD2_MAX_TRIANGLES * 3 * sizeof(int) );
+ memset( indremap, -1, MD2_MAX_TRIANGLES * 3 * sizeof( int ) );
- for( i = 0; i < numindexes; i++ ) {
+ for( i = 0; i < numelems; i++ )
+ {
if( indremap[i] != -1 )
continue;
// remap duplicates
- for( j = i + 1; j < numindexes; j++ ) {
- if( (ptempindex[j] == ptempindex[i])
- && (pinst[ptempstindex[j]].s == pinst[ptempstindex[i]].s)
- && (pinst[ptempstindex[j]].t == pinst[ptempstindex[i]].t) ) {
+ for( j = i + 1; j < numelems; j++ )
+ {
+ if( ( ptempelem[j] == ptempelem[i] )
+ && ( pinst[ptempstelem[j]].s == pinst[ptempstelem[i]].s )
+ && ( pinst[ptempstelem[j]].t == pinst[ptempstelem[i]].t ) )
+ {
indremap[j] = i;
- poutindex[j] = numverts;
+ poutelem[j] = numverts;
}
}
// add unique vertex
indremap[i] = i;
- poutindex[i] = numverts++;
+ poutelem[i] = numverts++;
}
Com_DPrintf( "%s: remapped %i verts to %i (%i tris)\n", mod->name, poutmesh->numverts, numverts, poutmesh->numtris );
poutmesh->numverts = numverts;
-//
-// load base s and t vertices
-//
- poutcoord = poutmesh->stArray = Mod_Malloc( mod, numverts * sizeof(vec2_t) );
+ //
+ // load base s and t vertices
+ //
+ poutcoord = poutmesh->stArray = Mod_Malloc( mod, numverts * sizeof( vec2_t ) );
- for( i = 0; i < numindexes; i++ ) {
- if( indremap[i] == i ) {
- poutcoord[poutindex[i]][0] = ((float)LittleShort( pinst[ptempstindex[i]].s ) + 0.5) / skinwidth;
- poutcoord[poutindex[i]][1] = ((float)LittleShort( pinst[ptempstindex[i]].t ) + 0.5) / skinheight;
+ for( i = 0; i < numelems; i++ )
+ {
+ if( indremap[i] == i )
+ {
+ poutcoord[poutelem[i]][0] = ( (float)LittleShort( pinst[ptempstelem[i]].s ) + 0.5 ) / skinwidth;
+ poutcoord[poutelem[i]][1] = ( (float)LittleShort( pinst[ptempstelem[i]].t ) + 0.5 ) / skinheight;
}
}
-//
-// load the frames
-//
- poutframe = poutmodel->frames = Mod_Malloc( mod, poutmodel->numframes * (sizeof(maliasframe_t) + numverts * sizeof(maliasvertex_t)) );
- poutvertex = poutmesh->vertexes = ( maliasvertex_t *)(( qbyte * )poutframe + poutmodel->numframes * sizeof(maliasframe_t));
+ //
+ // load the frames
+ //
+ poutframe = poutmodel->frames = Mod_Malloc( mod, poutmodel->numframes * ( sizeof( maliasframe_t ) + numverts * sizeof( maliasvertex_t ) ) );
+ poutvertex = poutmesh->vertexes = ( maliasvertex_t *)( ( qbyte * )poutframe + poutmodel->numframes * sizeof( maliasframe_t ) );
- for( i = 0; i < poutmodel->numframes; i++, poutframe++, poutvertex += numverts ) {
+ for( i = 0; i < poutmodel->numframes; i++, poutframe++, poutvertex += numverts )
+ {
pinframe = ( daliasframe_t * )( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_frames ) + i * framesize );
- for( j = 0; j < 3; j++ ) {
+ for( j = 0; j < 3; j++ )
+ {
poutframe->scale[j] = LittleFloat( pinframe->scale[j] );
poutframe->translate[j] = LittleFloat( pinframe->translate[j] );
}
- for( j = 0; j < numindexes; j++ ) { // verts are all 8 bit, so no swapping needed
- if( indremap[j] == j ) {
- poutvertex[poutindex[j]].point[0] = (short)pinframe->verts[ptempindex[j]].v[0];
- poutvertex[poutindex[j]].point[1] = (short)pinframe->verts[ptempindex[j]].v[1];
- poutvertex[poutindex[j]].point[2] = (short)pinframe->verts[ptempindex[j]].v[2];
+ for( j = 0; j < numelems; j++ )
+ { // verts are all 8 bit, so no swapping needed
+ if( indremap[j] == j )
+ {
+ poutvertex[poutelem[j]].point[0] = (short)pinframe->verts[ptempelem[j]].v[0];
+ poutvertex[poutelem[j]].point[1] = (short)pinframe->verts[ptempelem[j]].v[1];
+ poutvertex[poutelem[j]].point[2] = (short)pinframe->verts[ptempelem[j]].v[2];
}
}
- Mod_AliasCalculateVertexNormals( numindexes, poutindex, numverts, poutvertex );
+ Mod_AliasCalculateVertexNormals( numelems, poutelem, numverts, poutvertex );
VectorCopy( poutframe->translate, poutframe->mins );
VectorMA( poutframe->translate, 255, poutframe->scale, poutframe->maxs );
@@ -301,16 +322,17 @@
AddPointToBounds( poutframe->maxs, mod->mins, mod->maxs );
}
-//
-// build S and T vectors for frame 0
-//
+ //
+ // build S and T vectors for frame 0
+ //
Mod_AliasBuildMeshesForFrame0( mod );
// register all skins
- poutskin = poutmodel->skins = Mod_Malloc( mod, poutmodel->numskins * sizeof(maliasskin_t) );
+ poutskin = poutmodel->skins = Mod_Malloc( mod, poutmodel->numskins * sizeof( maliasskin_t ) );
- for( i = 0; i < poutmodel->numskins; i++, poutskin++ ) {
+ for( i = 0; i < poutmodel->numskins; i++, poutskin++ )
+ {
if( LittleLong( pinmodel->ofs_skins ) == -1 )
continue;
poutskin->shader = R_RegisterSkin( ( char * )pinmodel + LittleLong( pinmodel->ofs_skins ) + i*MD2_MAX_SKINNAME );
@@ -334,35 +356,35 @@
*/
void Mod_LoadAliasMD3Model( model_t *mod, model_t *parent, void *buffer )
{
- int version, i, j, l;
- int bufsize, numverts;
- qbyte *buf;
- dmd3header_t *pinmodel;
- dmd3frame_t *pinframe;
- dmd3tag_t *pintag;
- dmd3mesh_t *pinmesh;
- dmd3skin_t *pinskin;
- dmd3coord_t *pincoord;
- dmd3vertex_t *pinvert;
- index_t *pinindex, *poutindex;
- maliasvertex_t *poutvert;
- vec2_t *poutcoord;
- maliasskin_t *poutskin;
- maliasmesh_t *poutmesh;
- maliastag_t *pouttag;
- maliasframe_t *poutframe;
- maliasmodel_t *poutmodel;
- vec3_t ebbox = { 0, 0, 0 };
+ int version, i, j, l;
+ int bufsize, numverts;
+ qbyte *buf;
+ dmd3header_t *pinmodel;
+ dmd3frame_t *pinframe;
+ dmd3tag_t *pintag;
+ dmd3mesh_t *pinmesh;
+ dmd3skin_t *pinskin;
+ dmd3coord_t *pincoord;
+ dmd3vertex_t *pinvert;
+ elem_t *pinelem, *poutelem;
+ maliasvertex_t *poutvert;
+ vec2_t *poutcoord;
+ maliasskin_t *poutskin;
+ maliasmesh_t *poutmesh;
+ maliastag_t *pouttag;
+ maliasframe_t *poutframe;
+ maliasmodel_t *poutmodel;
+ vec3_t ebbox = { 0, 0, 0 };
pinmodel = ( dmd3header_t * )buffer;
version = LittleLong( pinmodel->version );
- if ( version != MD3_ALIAS_VERSION )
+ if( version != MD3_ALIAS_VERSION )
Com_Error( ERR_DROP, "%s has wrong version number (%i should be %i)",
- mod->name, version, MD3_ALIAS_VERSION );
+ mod->name, version, MD3_ALIAS_VERSION );
mod->type = mod_alias;
- mod->extradata = poutmodel = Mod_Malloc( mod, sizeof(maliasmodel_t) );
+ mod->extradata = poutmodel = Mod_Malloc( mod, sizeof( maliasmodel_t ) );
mod->radius = 0;
ClearBounds( mod->mins, mod->maxs );
@@ -374,8 +396,8 @@
if( poutmodel->numframes <= 0 )
Com_Error( ERR_DROP, "model %s has no frames", mod->name );
-// else if( poutmodel->numframes > MD3_MAX_FRAMES )
-// Com_Error( ERR_DROP, "model %s has too many frames", mod->name );
+ // else if( poutmodel->numframes > MD3_MAX_FRAMES )
+ // Com_Error( ERR_DROP, "model %s has too many frames", mod->name );
if( poutmodel->numtags > MD3_MAX_TAGS )
Com_Error( ERR_DROP, "model %s has too many tags", mod->name );
@@ -386,20 +408,22 @@
Com_Error( ERR_DROP, "model %s has invalid number of meshes", mod->name );
else if( !poutmodel->nummeshes && !poutmodel->numtags )
Com_Error( ERR_DROP, "model %s has no meshes and no tags", mod->name );
-// else if( poutmodel->nummeshes > MD3_MAX_MESHES )
-// Com_Error( ERR_DROP, "model %s has too many meshes", mod->name );
+ // else if( poutmodel->nummeshes > MD3_MAX_MESHES )
+ // Com_Error( ERR_DROP, "model %s has too many meshes", mod->name );
- bufsize = poutmodel->numframes * (sizeof( maliasframe_t ) + sizeof( maliastag_t ) * poutmodel->numtags) +
+ bufsize = poutmodel->numframes * ( sizeof( maliasframe_t ) + sizeof( maliastag_t ) * poutmodel->numtags ) +
poutmodel->nummeshes * sizeof( maliasmesh_t );
buf = Mod_Malloc( mod, bufsize );
-//
-// load the frames
-//
+ //
+ // load the frames
+ //
pinframe = ( dmd3frame_t * )( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_frames ) );
poutframe = poutmodel->frames = ( maliasframe_t * )buf; buf += sizeof( maliasframe_t ) * poutmodel->numframes;
- for( i = 0; i < poutmodel->numframes; i++, pinframe++, poutframe++ ) {
- for( j = 0; j < 3; j++ ) {
+ for( i = 0; i < poutmodel->numframes; i++, pinframe++, poutframe++ )
+ {
+ for( j = 0; j < 3; j++ )
+ {
poutframe->scale[j] = MD3_XYZ_SCALE;
poutframe->translate[j] = LittleFloat( pinframe->translate[j] );
}
@@ -407,17 +431,20 @@
// never trust the modeler utility and recalculate bbox and radius
ClearBounds( poutframe->mins, poutframe->maxs );
}
-
-//
-// load the tags
-//
+
+ //
+ // load the tags
+ //
pintag = ( dmd3tag_t * )( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_tags ) );
pouttag = poutmodel->tags = ( maliastag_t * )buf; buf += sizeof( maliastag_t ) * poutmodel->numframes * poutmodel->numtags;
- for( i = 0; i < poutmodel->numframes; i++ ) {
- for( l = 0; l < poutmodel->numtags; l++, pintag++, pouttag++ ) {
+ for( i = 0; i < poutmodel->numframes; i++ )
+ {
+ for( l = 0; l < poutmodel->numtags; l++, pintag++, pouttag++ )
+ {
vec3_t axis[3];
- for ( j = 0; j < 3; j++ ) {
+ for( j = 0; j < 3; j++ )
+ {
axis[0][j] = LittleFloat( pintag->axis[0][j] );
axis[1][j] = LittleFloat( pintag->axis[1][j] );
axis[2][j] = LittleFloat( pintag->axis[2][j] );
@@ -431,15 +458,16 @@
}
}
-//
-// load the meshes
-//
+ //
+ // load the meshes
+ //
pinmesh = ( dmd3mesh_t * )( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_meshes ) );
poutmesh = poutmodel->meshes = ( maliasmesh_t * )buf;
- for( i = 0; i < poutmodel->nummeshes; i++, poutmesh++ ) {
- if( strncmp( (const char *)pinmesh->id, IDMD3HEADER, 4) )
+ for( i = 0; i < poutmodel->nummeshes; i++, poutmesh++ )
+ {
+ if( strncmp( (const char *)pinmesh->id, IDMD3HEADER, 4 ) )
Com_Error( ERR_DROP, "mesh %s in model %s has wrong id (%s should be %s)",
- pinmesh->name, mod->name, pinmesh->id, IDMD3HEADER );
+ pinmesh->name, mod->name, pinmesh->id, IDMD3HEADER );
Q_strncpyz( poutmesh->name, pinmesh->name, MD3_MAX_PATH );
@@ -449,8 +477,8 @@
poutmesh->numskins = LittleLong( pinmesh->num_skins );
poutmesh->numverts = numverts = LittleLong( pinmesh->num_verts );
-/* if( poutmesh->numskins <= 0 )
- Com_Error( ERR_DROP, "mesh %i in model %s has no skins", i, mod->name );
+ /* if( poutmesh->numskins <= 0 )
+ Com_Error( ERR_DROP, "mesh %i in model %s has no skins", i, mod->name );
else*/ if( poutmesh->numskins > MD3_MAX_SHADERS )
Com_Error( ERR_DROP, "mesh %i in model %s has too many skins", i, mod->name );
if( poutmesh->numtris <= 0 )
@@ -462,50 +490,55 @@
else if( poutmesh->numverts > MD3_MAX_VERTS )
Com_Error( ERR_DROP, "mesh %i in model %s has too many vertices", i, mod->name );
- bufsize = sizeof(maliasskin_t) * poutmesh->numskins + poutmesh->numtris * sizeof(index_t) * 3 +
- numverts * (sizeof(vec2_t) + sizeof(maliasvertex_t) * poutmodel->numframes);
+ bufsize = sizeof( maliasskin_t ) * poutmesh->numskins + poutmesh->numtris * sizeof( elem_t ) * 3 +
+ numverts * ( sizeof( vec2_t ) + sizeof( maliasvertex_t ) * poutmodel->numframes );
buf = Mod_Malloc( mod, bufsize );
- //
- // load the skins
- //
+ //
+ // load the skins
+ //
pinskin = ( dmd3skin_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->ofs_skins ) );
- poutskin = poutmesh->skins = ( maliasskin_t * )buf; buf += sizeof(maliasskin_t) * poutmesh->numskins;
- for( j = 0; j < poutmesh->numskins; j++, pinskin++, poutskin++ ) {
+ poutskin = poutmesh->skins = ( maliasskin_t * )buf; buf += sizeof( maliasskin_t ) * poutmesh->numskins;
+ for( j = 0; j < poutmesh->numskins; j++, pinskin++, poutskin++ )
+ {
poutskin->shader = R_RegisterSkin( pinskin->name );
R_DeformvBBoxForShader( poutskin->shader, ebbox );
}
- //
- // load the indexes
- //
- pinindex = ( index_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->ofs_indexes ) );
- poutindex = poutmesh->indexes = ( index_t * )buf; buf += poutmesh->numtris * sizeof(index_t) * 3;
- for( j = 0; j < poutmesh->numtris; j++, pinindex += 3, poutindex += 3 ) {
- poutindex[0] = (index_t)LittleLong( pinindex[0] );
- poutindex[1] = (index_t)LittleLong( pinindex[1] );
- poutindex[2] = (index_t)LittleLong( pinindex[2] );
+ //
+ // load the elems
+ //
+ pinelem = ( elem_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->ofs_elems ) );
+ poutelem = poutmesh->elems = ( elem_t * )buf; buf += poutmesh->numtris * sizeof( elem_t ) * 3;
+ for( j = 0; j < poutmesh->numtris; j++, pinelem += 3, poutelem += 3 )
+ {
+ poutelem[0] = (elem_t)LittleLong( pinelem[0] );
+ poutelem[1] = (elem_t)LittleLong( pinelem[1] );
+ poutelem[2] = (elem_t)LittleLong( pinelem[2] );
}
- //
- // load the texture coordinates
- //
+ //
+ // load the texture coordinates
+ //
pincoord = ( dmd3coord_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->ofs_tcs ) );
- poutcoord = poutmesh->stArray = ( vec2_t * )buf; buf += poutmesh->numverts * sizeof(vec2_t);
- for( j = 0; j < poutmesh->numverts; j++, pincoord++ ) {
+ poutcoord = poutmesh->stArray = ( vec2_t * )buf; buf += poutmesh->numverts * sizeof( vec2_t );
+ for( j = 0; j < poutmesh->numverts; j++, pincoord++ )
+ {
poutcoord[j][0] = LittleFloat( pincoord->st[0] );
poutcoord[j][1] = LittleFloat( pincoord->st[1] );
}
- //
- // load the vertexes and normals
- //
+ //
+ // load the vertexes and normals
+ //
pinvert = ( dmd3vertex_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->ofs_verts ) );
poutvert = poutmesh->vertexes = ( maliasvertex_t * )buf;
- for( l = 0, poutframe = poutmodel->frames; l < poutmodel->numframes; l++, poutframe++, pinvert += poutmesh->numverts, poutvert += poutmesh->numverts ) {
+ for( l = 0, poutframe = poutmodel->frames; l < poutmodel->numframes; l++, poutframe++, pinvert += poutmesh->numverts, poutvert += poutmesh->numverts )
+ {
vec3_t v;
- for( j = 0; j < poutmesh->numverts; j++ ) {
+ for( j = 0; j < poutmesh->numverts; j++ )
+ {
poutvert[j].point[0] = LittleShort( pinvert[j].point[0] );
poutvert[j].point[1] = LittleShort( pinvert[j].point[1] );
poutvert[j].point[2] = LittleShort( pinvert[j].point[2] );
@@ -521,16 +554,17 @@
pinmesh = ( dmd3mesh_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->meshsize ) );
}
-//
-// build S and T vectors for frame 0
-//
+ //
+ // build S and T vectors for frame 0
+ //
Mod_AliasBuildMeshesForFrame0( mod );
-//
-// calculate model bounds
-//
+ //
+ // calculate model bounds
+ //
poutframe = poutmodel->frames;
- for( i = 0; i < poutmodel->numframes; i++, poutframe++ ) {
+ for( i = 0; i < poutmodel->numframes; i++, poutframe++ )
+ {
VectorMA( poutframe->translate, MD3_XYZ_SCALE, poutframe->mins, poutframe->mins );
VectorMA( poutframe->translate, MD3_XYZ_SCALE, poutframe->maxs, poutframe->maxs );
VectorSubtract( poutframe->mins, ebbox, poutframe->mins );
@@ -553,20 +587,20 @@
int lod;
float dist;
- if( !e->model->numlods || (e->flags & RF_FORCENOLOD) )
+ if( !e->model->numlods || ( e->flags & RF_FORCENOLOD ) )
return e->model;
dist = DistanceFast( e->origin, ri.viewOrigin );
dist *= ri.lod_dist_scale_for_fov;
- lod = (int)(dist / e->model->radius);
- if (r_lodscale->integer)
+ lod = (int)( dist / e->model->radius );
+ if( r_lodscale->integer )
lod /= r_lodscale->integer;
lod += r_lodbias->integer;
if( lod < 1 )
return e->model;
- return e->model->lods[min(lod, e->model->numlods)-1];
+ return e->model->lods[min( lod, e->model->numlods )-1];
}
/*
@@ -576,25 +610,30 @@
*/
static void R_AliasModelLerpBBox( entity_t *e, model_t *mod )
{
- int i;
- maliasmodel_t *aliasmodel = ( maliasmodel_t * )mod->extradata;
- maliasframe_t *pframe, *poldframe;
- float *thismins, *oldmins, *thismaxs, *oldmaxs;
+ int...
[truncated message content] |
|
From: qfusion s. c. <l33...@li...> - 2007-12-06 03:45:10
|
Revision: 800
http://l33t.svn.sourceforge.net/l33t/?rev=800&view=rev
Author: digiman
Date: 2007-12-05 19:45:09 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
Set r_shaderNoPicMip to qfalse before parsing a shader
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_shader.c
Modified: trunk/qfusion/source/ref_gl/r_shader.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_shader.c 2007-12-06 00:46:16 UTC (rev 799)
+++ trunk/qfusion/source/ref_gl/r_shader.c 2007-12-06 03:45:09 UTC (rev 800)
@@ -1982,6 +1982,7 @@
forceDefault = qtrue;
r_shaderNoMipMaps = qfalse;
+ r_shaderNoPicMip = qfalse;
r_shaderNoCompress = qfalse;
r_shaderHasDlightPass = qfalse;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-06 00:46:17
|
Revision: 799
http://l33t.svn.sourceforge.net/l33t/?rev=799&view=rev
Author: digiman
Date: 2007-12-05 16:46:16 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
Free memory pools BEFORE unloading the game modules as we may still need filename pointers for memory debugging (the __FILE__ macro)
Fixes crash with developer 1 and developerMemory 1
Modified Paths:
--------------
trunk/qfusion/source/client/cl_game.c
trunk/qfusion/source/client/cl_ui.c
Modified: trunk/qfusion/source/client/cl_game.c
===================================================================
--- trunk/qfusion/source/client/cl_game.c 2007-12-06 00:39:12 UTC (rev 798)
+++ trunk/qfusion/source/client/cl_game.c 2007-12-06 00:46:16 UTC (rev 799)
@@ -257,8 +257,8 @@
cls.cgameActive = qfalse;
cge->Shutdown ();
+ Mem_FreePool( &cl_gamemodulepool );
Sys_UnloadGameLibrary( LIB_CGAME );
- Mem_FreePool( &cl_gamemodulepool );
cge = NULL;
}
Modified: trunk/qfusion/source/client/cl_ui.c
===================================================================
--- trunk/qfusion/source/client/cl_ui.c 2007-12-06 00:39:12 UTC (rev 798)
+++ trunk/qfusion/source/client/cl_ui.c 2007-12-06 00:46:16 UTC (rev 799)
@@ -191,8 +191,8 @@
cls.uiActive = qfalse;
uie->Shutdown ();
+ Mem_FreePool( &ui_mempool );
Sys_UnloadGameLibrary( LIB_UI );
- Mem_FreePool( &ui_mempool );
uie = NULL;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-06 00:39:13
|
Revision: 798
http://l33t.svn.sourceforge.net/l33t/?rev=798&view=rev
Author: digiman
Date: 2007-12-05 16:39:12 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
Nicely isolate cin.h
Modified Paths:
--------------
trunk/qfusion/source/client/cin.c
trunk/qfusion/source/client/cl_cin.c
trunk/qfusion/source/client/cl_input.c
trunk/qfusion/source/client/cl_main.c
trunk/qfusion/source/client/cl_screen.c
trunk/qfusion/source/client/client.h
Modified: trunk/qfusion/source/client/cin.c
===================================================================
--- trunk/qfusion/source/client/cin.c 2007-12-05 23:15:09 UTC (rev 797)
+++ trunk/qfusion/source/client/cin.c 2007-12-06 00:39:12 UTC (rev 798)
@@ -19,6 +19,7 @@
*/
#include "client.h"
+#include "cin.h"
static short snd_sqr_arr[256];
Modified: trunk/qfusion/source/client/cl_cin.c
===================================================================
--- trunk/qfusion/source/client/cl_cin.c 2007-12-05 23:15:09 UTC (rev 797)
+++ trunk/qfusion/source/client/cl_cin.c 2007-12-06 00:39:12 UTC (rev 798)
@@ -17,7 +17,9 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "client.h"
+#include "cin.h"
/*
=================================================================
@@ -34,11 +36,12 @@
*/
void SCR_StopCinematic( void )
{
- cinematics_t *cin = &cl.cin;
+ cinematics_t *cin = cl.cin;
- if( !cin->file )
+ if( !cin || !cin->file )
return;
+ cl.cin = NULL;
cin->time = 0; // done
cin->pic = NULL;
cin->pic_pending = NULL;
@@ -79,7 +82,7 @@
*/
static qbyte *SCR_ReadNextCinematicFrame( void )
{
- cinematics_t *cin = &cl.cin;
+ cinematics_t *cin = cl.cin;
roq_chunk_t *chunk = &cin->chunk;
while( !FS_Eof( cin->file ) ) {
@@ -107,15 +110,35 @@
/*
==================
+SCR_InitCinematic
+==================
+*/
+void SCR_InitCinematic( void ) {
+ RoQ_Init ();
+}
+
+/*
+==================
+SCR_InitCinematic
+==================
+*/
+unsigned int SCR_GetCinematicTime( void )
+{
+ cinematics_t *cin = cl.cin;
+ return (cin ? cin->time : 0);
+}
+
+/*
+==================
SCR_RunCinematic
==================
*/
void SCR_RunCinematic( void )
{
unsigned int frame;
- cinematics_t *cin = &cl.cin;
+ cinematics_t *cin = cl.cin;
- if( cin->time <= 0 ) {
+ if( !cin || cin->time == 0 ) {
SCR_StopCinematic ();
return;
}
@@ -155,9 +178,9 @@
*/
qboolean SCR_DrawCinematic( void )
{
- cinematics_t *cin = &cl.cin;
+ cinematics_t *cin = cl.cin;
- if( cin->time <= 0 )
+ if( !cin || cin->time <= 0 )
return qfalse;
if( !cin->pic )
return qtrue;
@@ -176,7 +199,8 @@
{
int len;
size_t name_size;
- cinematics_t *cin = &cl.cin;
+ static cinematics_t clientCin;
+ cinematics_t *cin = cl.cin = &clientCin;
roq_chunk_t *chunk = &cin->chunk;
name_size = strlen( "video/" ) + strlen( arg ) + strlen( ".roq" ) + 1;
Modified: trunk/qfusion/source/client/cl_input.c
===================================================================
--- trunk/qfusion/source/client/cl_input.c 2007-12-05 23:15:09 UTC (rev 797)
+++ trunk/qfusion/source/client/cl_input.c 2007-12-06 00:39:12 UTC (rev 798)
@@ -552,8 +552,8 @@
SZ_Init (&buf, data, sizeof(data));
- if (cmd->buttons && cl.cin.time > 0 && !cl.attractloop
- && cls.realtime - cl.cin.time > 1000)
+ if (cmd->buttons && SCR_GetCinematicTime() > 0 && !cl.attractloop
+ && cls.realtime > SCR_GetCinematicTime() + 1000)
{ // skip the rest of the cinematic
SCR_StopCinematic ();
SCR_FinishCinematic ();
Modified: trunk/qfusion/source/client/cl_main.c
===================================================================
--- trunk/qfusion/source/client/cl_main.c 2007-12-05 23:15:09 UTC (rev 797)
+++ trunk/qfusion/source/client/cl_main.c 2007-12-06 00:39:12 UTC (rev 798)
@@ -1586,7 +1586,7 @@
time_after_ref = Sys_Milliseconds ();
// update audio
- if (cls.state != ca_active || cl.cin.time > 0)
+ if (cls.state != ca_active || SCR_GetCinematicTime() > 0)
S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin, vec3_origin);
if( cl_avidemo->modified ) {
@@ -1657,8 +1657,6 @@
SZ_Init (&net_recieved, net_recieved_buffer, sizeof(net_recieved_buffer));
SZ_Init (&net_message, net_message_buffer, sizeof(net_message_buffer));
- RoQ_Init ();
-
SCR_InitScreen ();
cls.disable_screen = qtrue; // don't draw yet
Modified: trunk/qfusion/source/client/cl_screen.c
===================================================================
--- trunk/qfusion/source/client/cl_screen.c 2007-12-05 23:15:09 UTC (rev 797)
+++ trunk/qfusion/source/client/cl_screen.c 2007-12-06 00:39:12 UTC (rev 798)
@@ -287,6 +287,8 @@
//
Cmd_AddCommand ("timerefresh", SCR_TimeRefresh_f);
+ SCR_InitCinematic ();
+
scr_initialized = qtrue;
}
@@ -537,7 +539,7 @@
}
// if a cinematic is supposed to be running, handle menus
// and console specially
- else if (cl.cin.time > 0)
+ else if (SCR_GetCinematicTime() > 0)
{
SCR_DrawCinematic ();
}
Modified: trunk/qfusion/source/client/client.h
===================================================================
--- trunk/qfusion/source/client/client.h 2007-12-05 23:15:09 UTC (rev 797)
+++ trunk/qfusion/source/client/client.h 2007-12-06 00:39:12 UTC (rev 798)
@@ -23,7 +23,6 @@
#include "../ref_gl/r_public.h"
#include "../cgame/cg_public.h"
-#include "cin.h"
#include "vid.h"
#include "sound.h"
#include "input.h"
@@ -66,8 +65,8 @@
// is rendering at. always <= cls.realtime
//
- // non-gameserver infornamtion
- cinematics_t cin;
+ // non-gameserver information
+ void *cin;
//
// server state information
@@ -183,6 +182,8 @@
//
// cl_cin.c
//
+void SCR_InitCinematic (void);
+unsigned int SCR_GetCinematicTime (void);
void SCR_PlayCinematic (char *name);
qboolean SCR_DrawCinematic (void);
void SCR_RunCinematic (void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-05 23:15:11
|
Revision: 797
http://l33t.svn.sourceforge.net/l33t/?rev=797&view=rev
Author: digiman
Date: 2007-12-05 15:15:09 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
Reorder functions in qgl.h so that wglGetProcAddress and glXGetProcAddressARB become available as early as possible
Modified Paths:
--------------
trunk/qfusion/source/linux/qgl_linux.c
trunk/qfusion/source/ref_gl/qgl.h
Modified: trunk/qfusion/source/linux/qgl_linux.c
===================================================================
--- trunk/qfusion/source/linux/qgl_linux.c 2007-12-05 22:08:30 UTC (rev 796)
+++ trunk/qfusion/source/linux/qgl_linux.c 2007-12-05 23:15:09 UTC (rev 797)
@@ -132,7 +132,7 @@
Com_Printf( "Using %s for OpenGL...", dllname );
}
-#define QGL_FUNC(type,name,params) (q##name) = ( void * )qglGetProcAddress( #name ); \
+#define QGL_FUNC(type,name,params) (q##name) = ( void * )qglGetProcAddress( (const GLubyte *)#name ); \
if( !(q##name) ) { Com_Printf( "QGL_Init: Failed to get address for %s\n", #name ); return qfalse; }
#define QGL_EXT(type,name,params) (q##name) = NULL;
#define QGL_WGL(type,name,params)
Modified: trunk/qfusion/source/ref_gl/qgl.h
===================================================================
--- trunk/qfusion/source/ref_gl/qgl.h 2007-12-05 22:08:30 UTC (rev 796)
+++ trunk/qfusion/source/ref_gl/qgl.h 2007-12-05 23:15:09 UTC (rev 797)
@@ -417,6 +417,28 @@
#endif /* GL_SGIS_generate_mipmap */
+// WGL Functions
+QGL_WGL(PROC, wglGetProcAddress, (LPCSTR));
+QGL_WGL(int, wglChoosePixelFormat, (HDC, CONST PIXELFORMATDESCRIPTOR *));
+QGL_WGL(int, wglDescribePixelFormat, (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR));
+QGL_WGL(BOOL, wglSetPixelFormat, (HDC, int, CONST PIXELFORMATDESCRIPTOR *));
+QGL_WGL(BOOL, wglSwapBuffers, (HDC));
+QGL_WGL(HGLRC, wglCreateContext, (HDC));
+QGL_WGL(BOOL, wglDeleteContext, (HGLRC));
+QGL_WGL(BOOL, wglMakeCurrent, (HDC, HGLRC));
+
+// GLX Functions
+QGL_GLX(void *, glXGetProcAddressARB, (const GLubyte *procName));
+QGL_GLX(XVisualInfo *, glXChooseVisual, (Display *dpy, int screen, int *attribList));
+QGL_GLX(GLXContext, glXCreateContext, (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct));
+QGL_GLX(void, glXDestroyContext, (Display *dpy, GLXContext ctx));
+QGL_GLX(Bool, glXMakeCurrent, (Display *dpy, GLXDrawable drawable, GLXContext ctx));
+QGL_GLX(Bool, glXCopyContext, (Display *dpy, GLXContext src, GLXContext dst, GLuint mask));
+QGL_GLX(Bool, glXSwapBuffers, (Display *dpy, GLXDrawable drawable));
+QGL_GLX(Bool, glXQueryVersion, (Display *dpy, int *major, int *minor));
+QGL_GLX(const char *, glXQueryExtensionsString, (Display *dpy, int screen));
+
+// GL Functions
QGL_FUNC(void, glAlphaFunc, (GLenum func, GLclampf ref));
QGL_FUNC(void, glArrayElement, (GLint i));
QGL_FUNC(void, glBegin, (GLenum mode));
@@ -551,28 +573,7 @@
QGL_EXT(void, glSwapInterval, (int interval));
-// WGL Functions
-QGL_WGL(int, wglChoosePixelFormat, (HDC, CONST PIXELFORMATDESCRIPTOR *));
-QGL_WGL(int, wglDescribePixelFormat, (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR));
-QGL_WGL(BOOL, wglSetPixelFormat, (HDC, int, CONST PIXELFORMATDESCRIPTOR *));
-QGL_WGL(BOOL, wglSwapBuffers, (HDC));
-QGL_WGL(HGLRC, wglCreateContext, (HDC));
-QGL_WGL(BOOL, wglDeleteContext, (HGLRC));
-QGL_WGL(BOOL, wglMakeCurrent, (HDC, HGLRC));
-QGL_WGL(PROC, wglGetProcAddress, (LPCSTR));
-
// WGL_EXT Functions
QGL_WGL_EXT(const char *, wglGetExtensionsStringEXT, (void));
QGL_WGL_EXT(BOOL, wglGetDeviceGammaRamp3DFX, (HDC, WORD *));
QGL_WGL_EXT(BOOL, wglSetDeviceGammaRamp3DFX, (HDC, WORD *));
-
-// GLX Functions
-QGL_GLX(XVisualInfo *, glXChooseVisual, (Display *dpy, int screen, int *attribList));
-QGL_GLX(GLXContext, glXCreateContext, (Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct));
-QGL_GLX(void, glXDestroyContext, (Display *dpy, GLXContext ctx));
-QGL_GLX(Bool, glXMakeCurrent, (Display *dpy, GLXDrawable drawable, GLXContext ctx));
-QGL_GLX(Bool, glXCopyContext, (Display *dpy, GLXContext src, GLXContext dst, GLuint mask));
-QGL_GLX(Bool, glXSwapBuffers, (Display *dpy, GLXDrawable drawable));
-QGL_GLX(void *, glXGetProcAddressARB, (const GLubyte *procName));
-QGL_GLX(Bool, glXQueryVersion, (Display *dpy, int *major, int *minor));
-QGL_GLX(const char *, glXQueryExtensionsString, (Display *dpy, int screen));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-05 22:08:33
|
Revision: 796
http://l33t.svn.sourceforge.net/l33t/?rev=796&view=rev
Author: digiman
Date: 2007-12-05 14:08:30 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
Use unsigned int and Sys_Milliseconds for cin->time
Modified Paths:
--------------
trunk/qfusion/source/client/cin.h
trunk/qfusion/source/client/cl_cin.c
Modified: trunk/qfusion/source/client/cin.h
===================================================================
--- trunk/qfusion/source/client/cin.h 2007-12-05 22:04:21 UTC (rev 795)
+++ trunk/qfusion/source/client/cin.h 2007-12-05 22:08:30 UTC (rev 796)
@@ -75,7 +75,7 @@
int file;
int headerlen;
- int time; // Sys_Milliseconds for first cinematic frame
+ unsigned int time; // Sys_Milliseconds for first cinematic frame
unsigned int frame;
qbyte *pic;
Modified: trunk/qfusion/source/client/cl_cin.c
===================================================================
--- trunk/qfusion/source/client/cl_cin.c 2007-12-05 22:04:21 UTC (rev 795)
+++ trunk/qfusion/source/client/cl_cin.c 2007-12-05 22:08:30 UTC (rev 796)
@@ -127,12 +127,12 @@
return;
}
- frame = (cls.realtime - cin->time) * (float)(RoQ_FRAMERATE) / 1000;
+ frame = (Sys_Milliseconds () - cin->time) * (float)(RoQ_FRAMERATE) / 1000;
if( frame <= cin->frame )
return;
if( frame > cin->frame + 1 ) {
Com_Printf( "Dropped frame: %i > %i\n", frame, cin->frame + 1 );
- cin->time = cls.realtime - cin->frame * 1000 / RoQ_FRAMERATE;
+ cin->time = Sys_Milliseconds () - cin->frame * 1000 / RoQ_FRAMERATE;
}
cin->pic = cin->pic_pending;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-05 22:04:30
|
Revision: 795
http://l33t.svn.sourceforge.net/l33t/?rev=795&view=rev
Author: digiman
Date: 2007-12-05 14:04:21 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
Make sure we have something to shutdown before actually trying to do that in various modules
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_cull.c
trunk/qfusion/source/ref_gl/r_image.c
trunk/qfusion/source/ref_gl/r_model.c
trunk/qfusion/source/ref_gl/r_program.c
trunk/qfusion/source/ref_gl/r_skin.c
Modified: trunk/qfusion/source/ref_gl/r_cull.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_cull.c 2007-12-05 22:01:30 UTC (rev 794)
+++ trunk/qfusion/source/ref_gl/r_cull.c 2007-12-05 22:04:21 UTC (rev 795)
@@ -534,6 +534,8 @@
*/
void R_ShutdownOcclusionQueries( void )
{
+ if( !r_occlusionShader )
+ return;
if( !glConfig.ext.occlusion_query )
return;
Modified: trunk/qfusion/source/ref_gl/r_image.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_image.c 2007-12-05 22:01:30 UTC (rev 794)
+++ trunk/qfusion/source/ref_gl/r_image.c 2007-12-05 22:04:21 UTC (rev 795)
@@ -2168,6 +2168,9 @@
{
int i;
+ if( !r_texturesPool )
+ return;
+
R_StopAviDemo ();
R_FreeImageBuffers ();
Modified: trunk/qfusion/source/ref_gl/r_model.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_model.c 2007-12-05 22:01:30 UTC (rev 794)
+++ trunk/qfusion/source/ref_gl/r_model.c 2007-12-05 22:04:21 UTC (rev 795)
@@ -195,6 +195,9 @@
{
int i;
+ if( !mod_mempool )
+ return;
+
if( mod_inline ) {
Mem_Free( mod_inline );
mod_inline = NULL;
Modified: trunk/qfusion/source/ref_gl/r_program.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_program.c 2007-12-05 22:01:30 UTC (rev 794)
+++ trunk/qfusion/source/ref_gl/r_program.c 2007-12-05 22:04:21 UTC (rev 795)
@@ -1033,6 +1033,8 @@
int i;
glsl_program_t *program;
+ if( !r_glslProgramsPool )
+ return;
if( !glConfig.ext.GLSL )
return;
Modified: trunk/qfusion/source/ref_gl/r_skin.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_skin.c 2007-12-05 22:01:30 UTC (rev 794)
+++ trunk/qfusion/source/ref_gl/r_skin.c 2007-12-05 22:04:21 UTC (rev 795)
@@ -199,6 +199,9 @@
int i;
skinfile_t *skinfile;
+ if( !r_skinsPool )
+ return;
+
for( i = 0, skinfile = r_skinfiles; i < MAX_SKINFILES; i++, skinfile++ ) {
if( !skinfile->name )
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-05 22:01:44
|
Revision: 794
http://l33t.svn.sourceforge.net/l33t/?rev=794&view=rev
Author: digiman
Date: 2007-12-05 14:01:30 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
Use the UNIX-way (qglGetProcAddressARB) to fetch pointers to gl* functions
Modified Paths:
--------------
trunk/qfusion/source/linux/qgl_linux.c
Modified: trunk/qfusion/source/linux/qgl_linux.c
===================================================================
--- trunk/qfusion/source/linux/qgl_linux.c 2007-12-05 21:22:30 UTC (rev 793)
+++ trunk/qfusion/source/linux/qgl_linux.c 2007-12-05 22:01:30 UTC (rev 794)
@@ -132,7 +132,7 @@
Com_Printf( "Using %s for OpenGL...", dllname );
}
-#define QGL_FUNC(type,name,params) (q##name) = ( void * )dlsym( glw_state.OpenGLLib, #name ); \
+#define QGL_FUNC(type,name,params) (q##name) = ( void * )qglGetProcAddress( #name ); \
if( !(q##name) ) { Com_Printf( "QGL_Init: Failed to get address for %s\n", #name ); return qfalse; }
#define QGL_EXT(type,name,params) (q##name) = NULL;
#define QGL_WGL(type,name,params)
@@ -160,9 +160,8 @@
*/
void *qglGetProcAddress( const GLubyte *procName )
{
-#if 0
- // check for broken driver
- if( glConfig.versionString && strcmp( glConfig.versionString, "1.3.1 NVIDIA 28.80" ) && qglXGetProcAddressARB )
+#if 1
+ if( qglXGetProcAddressARB )
return qglXGetProcAddressARB( procName );
#endif
if( glw_state.OpenGLLib )
@@ -177,9 +176,8 @@
{
int major = 0, minor = 0;
- if( !qglXQueryVersion || !qglXQueryVersion( x11display.dpy, &major, &minor ) || !(minor > 0 || major > 1) ) {
+ if( !qglXQueryVersion || !qglXQueryVersion( x11display.dpy, &major, &minor ) || !(minor > 0 || major > 1) )
qglXQueryExtensionsString = NULL;
- }
qglGetGLWExtensionsString = _qglGetGLWExtensionsString;
return qglGetGLWExtensionsString ();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-05 21:22:33
|
Revision: 793
http://l33t.svn.sourceforge.net/l33t/?rev=793&view=rev
Author: digiman
Date: 2007-12-05 13:22:30 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
Code cleanup
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_cin.c
Modified: trunk/qfusion/source/ref_gl/r_cin.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_cin.c 2007-12-05 21:03:24 UTC (rev 792)
+++ trunk/qfusion/source/ref_gl/r_cin.c 2007-12-05 21:22:30 UTC (rev 793)
@@ -358,17 +358,17 @@
r_cinhandle_t *handle;
handle = r_cinematics + id - 1;
+ if( !handle->cin )
+ return;
- if( handle->cin ) {
- R_StopRoQ( handle->cin );
- Cin_Free( handle->cin );
- handle->cin = NULL;
- }
- if( handle->name ) {
- Cin_Free( handle->name );
- handle->name = NULL;
- }
+ R_StopRoQ( handle->cin );
+ Cin_Free( handle->cin );
+ handle->cin = NULL;
+ assert( handle->name );
+ Cin_Free( handle->name );
+ handle->name = NULL;
+
// remove from linked active list
handle->prev->next = handle->next;
handle->next->prev = handle->prev;
@@ -378,7 +378,6 @@
r_free_cinematics = handle;
}
-
/*
==================
R_ShutdownCinematics
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-05 21:03:26
|
Revision: 792
http://l33t.svn.sourceforge.net/l33t/?rev=792&view=rev
Author: digiman
Date: 2007-12-05 13:03:24 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
Shutdown shaders before cinematics
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_register.c
Modified: trunk/qfusion/source/ref_gl/r_register.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_register.c 2007-12-05 20:55:21 UTC (rev 791)
+++ trunk/qfusion/source/ref_gl/r_register.c 2007-12-05 21:03:24 UTC (rev 792)
@@ -1019,8 +1019,8 @@
R_ShutdownShadows ();
R_ShutdownSkinFiles ();
R_ShutdownModels ();
+ R_ShutdownShaders ();
R_ShutdownCinematics ();
- R_ShutdownShaders ();
R_ShutdownImages ();
R_ShutdownGLSLPrograms ();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-05 20:55:23
|
Revision: 791
http://l33t.svn.sourceforge.net/l33t/?rev=791&view=rev
Author: digiman
Date: 2007-12-05 12:55:21 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
cleanup
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_cin.c
Modified: trunk/qfusion/source/ref_gl/r_cin.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_cin.c 2007-12-05 20:41:22 UTC (rev 790)
+++ trunk/qfusion/source/ref_gl/r_cin.c 2007-12-05 20:55:21 UTC (rev 791)
@@ -208,31 +208,32 @@
*/
void R_CinList_f( void )
{
- r_cinhandle_t *handle, *hnode, *next;
cinematics_t *cin;
image_t *image;
+ r_cinhandle_t *handle, *hnode;
Com_Printf( "Active cintematics:" );
hnode = &r_cinematics_headnode;
handle = hnode->prev;
- if( handle == hnode ) {
+ if( handle == hnode )
+ {
Com_Printf( " none\n" );
return;
}
Com_Printf( "\n" );
- for( ; handle != hnode; handle = next ) {
- next = handle->prev;
-
- assert( cin );
+ do {
cin = handle->cin;
image = handle->image;
+ assert( cin );
if( image && (cin->width != image->upload_width || cin->height != image->upload_height) )
Com_Printf( "%s %i(%i)x%i(%i) %i\n", cin->name, cin->width, image->upload_width, cin->height, image->upload_height, cin->frame );
else
Com_Printf( "%s %ix%i %i\n", cin->name, cin->width, cin->height, cin->frame );
- }
+
+ handle = handle->next;
+ } while( handle != hnode );
}
/*
@@ -275,7 +276,6 @@
hnode = &r_cinematics_headnode;
for( handle = hnode->prev; handle != hnode; handle = next ) {
next = handle->prev;
-
R_RunRoQ( handle->cin );
}
}
@@ -312,7 +312,6 @@
hnode = &r_cinematics_headnode;
for( handle = hnode->prev; handle != hnode; handle = next ) {
next = handle->prev;
-
assert( handle->cin );
// reuse
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-05 20:41:34
|
Revision: 790
http://l33t.svn.sourceforge.net/l33t/?rev=790&view=rev
Author: digiman
Date: 2007-12-05 12:41:22 -0800 (Wed, 05 Dec 2007)
Log Message:
-----------
Rewrite handling of videomaps, we can now add and remove cinematics on demand and reuse videomap handles for different shaders
Modified Paths:
--------------
trunk/qfusion/source/client/cin.c
trunk/qfusion/source/client/cin.h
trunk/qfusion/source/client/cl_cin.c
trunk/qfusion/source/ref_gl/r_cin.c
trunk/qfusion/source/ref_gl/r_local.h
trunk/qfusion/source/ref_gl/r_main.c
trunk/qfusion/source/ref_gl/r_register.c
trunk/qfusion/source/ref_gl/r_shader.c
trunk/qfusion/source/ref_gl/r_shader.h
Modified: trunk/qfusion/source/client/cin.c
===================================================================
--- trunk/qfusion/source/client/cin.c 2007-12-04 20:33:04 UTC (rev 789)
+++ trunk/qfusion/source/client/cin.c 2007-12-05 20:41:22 UTC (rev 790)
@@ -89,12 +89,13 @@
cin->height = LittleShort( t[1] );
if( cin->vid_buffer )
- Mem_ZoneFree( cin->vid_buffer );
+ Mem_Free( cin->vid_buffer );
- cin->vid_buffer = Mem_ZoneMallocExt( cin->width * cin->height * 4 * 2, 0 );
-
// default to 255 for alpha
- memset( cin->vid_buffer, 0xFF, cin->width * cin->height * 4 * 2 );
+ if( cin->mempool )
+ cin->vid_buffer = Mem_AllocExt( cin->mempool, cin->width * cin->height * 4 * 2, 0xFF );
+ else
+ cin->vid_buffer = Mem_ZoneMallocExt( cin->width * cin->height * 4 * 2, 0xFF );
cin->vid_pic[0] = cin->vid_buffer;
cin->vid_pic[1] = cin->vid_buffer + cin->width * cin->height * 4;
Modified: trunk/qfusion/source/client/cin.h
===================================================================
--- trunk/qfusion/source/client/cin.h 2007-12-04 20:33:04 UTC (rev 789)
+++ trunk/qfusion/source/client/cin.h 2007-12-05 20:41:22 UTC (rev 790)
@@ -76,10 +76,12 @@
int headerlen;
int time; // Sys_Milliseconds for first cinematic frame
- int frame;
+ unsigned int frame;
qbyte *pic;
qbyte *pic_pending;
+
+ mempool_t *mempool;
} cinematics_t;
void RoQ_Init (void);
Modified: trunk/qfusion/source/client/cl_cin.c
===================================================================
--- trunk/qfusion/source/client/cl_cin.c 2007-12-04 20:33:04 UTC (rev 789)
+++ trunk/qfusion/source/client/cl_cin.c 2007-12-05 20:41:22 UTC (rev 790)
@@ -50,7 +50,7 @@
cin->name = NULL;
if( cin->vid_buffer ) {
- Mem_ZoneFree( cin->vid_buffer );
+ Mem_Free( cin->vid_buffer );
cin->vid_buffer = NULL;
}
}
@@ -112,7 +112,7 @@
*/
void SCR_RunCinematic( void )
{
- int frame;
+ unsigned int frame;
cinematics_t *cin = &cl.cin;
if( cin->time <= 0 ) {
@@ -127,9 +127,6 @@
return;
}
- if( cin->frame == -1 )
- return;
-
frame = (cls.realtime - cin->time) * (float)(RoQ_FRAMERATE) / 1000;
if( frame <= cin->frame )
return;
Modified: trunk/qfusion/source/ref_gl/r_cin.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_cin.c 2007-12-04 20:33:04 UTC (rev 789)
+++ trunk/qfusion/source/ref_gl/r_cin.c 2007-12-05 20:41:22 UTC (rev 790)
@@ -17,39 +17,36 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
+// r_cin.c
#include "r_local.h"
+#include "../client/cin.h"
-//=============================================================
+#define MAX_CINEMATICS 256
-/*
-==================
-R_StopCinematic
-==================
-*/
-void R_StopCinematic( cinematics_t *cin )
+typedef struct r_cinhandle_s
{
- cin->time = 0; // done
- cin->pic = NULL;
- cin->pic_pending = NULL;
+ unsigned int id;
+ char *name;
+ cinematics_t *cin;
+ image_t *image;
+ struct r_cinhandle_s *prev, *next;
+} r_cinhandle_t;
- if( cin->file ) {
- FS_FCloseFile( cin->file );
- cin->file = 0;
- }
- if( cin->vid_buffer ) {
- Mem_ZoneFree( cin->vid_buffer );
- cin->vid_buffer = NULL;
- }
-}
+static mempool_t *r_cinMemPool;
-//==========================================================================
+static r_cinhandle_t *r_cinematics;
+static r_cinhandle_t r_cinematics_headnode, *r_free_cinematics;
+#define Cin_Malloc(size) _Mem_Alloc(r_cinMemPool,size,0,0,__FILE__,__LINE__)
+#define Cin_Free(data) Mem_Free(data)
+
/*
==================
-R_ReadNextCinematicFrame
+R_ReadNextRoQFrame
==================
*/
-static qbyte *R_ReadNextCinematicFrame( cinematics_t *cin )
+static qbyte *R_ReadNextRoQFrame( cinematics_t *cin )
{
roq_chunk_t *chunk = &cin->chunk;
@@ -76,97 +73,333 @@
/*
==================
+R_RunRoQ
+==================
+*/
+static void R_RunRoQ( cinematics_t *cin )
+{
+ unsigned int frame;
+
+ frame = (Sys_Milliseconds () - cin->time) * (float)(RoQ_FRAMERATE) / 1000;
+ if( frame <= cin->frame )
+ return;
+ if( frame > cin->frame + 1 )
+ cin->time = Sys_Milliseconds () - cin->frame * 1000 / RoQ_FRAMERATE;
+
+ cin->pic = cin->pic_pending;
+ cin->pic_pending = R_ReadNextRoQFrame( cin );
+
+ if( !cin->pic_pending ) {
+ FS_Seek( cin->file, cin->headerlen, FS_SEEK_SET );
+ cin->frame = 0;
+ cin->pic_pending = R_ReadNextRoQFrame( cin );
+ cin->time = Sys_Milliseconds ();
+ }
+
+ cin->new_frame = qtrue;
+}
+
+/*
+==================
+R_StopRoQ
+==================
+*/
+static void R_StopRoQ( cinematics_t *cin )
+{
+ cin->frame = 0;
+ cin->time = 0; // done
+ cin->pic = NULL;
+ cin->pic_pending = NULL;
+
+ if( cin->file ) {
+ FS_FCloseFile( cin->file );
+ cin->file = 0;
+ }
+ if( cin->name ) {
+ Mem_Free( cin->name );
+ cin->name = NULL;
+ }
+ if( cin->vid_buffer ) {
+ Mem_Free( cin->vid_buffer );
+ cin->vid_buffer = NULL;
+ }
+}
+
+/*
+==================
+R_OpenCinematics
+==================
+*/
+static cinematics_t *R_OpenCinematics( char *filename )
+{
+ int file = 0;
+ cinematics_t *cin = NULL;
+ roq_chunk_t *chunk = &cin->chunk;
+
+ if( FS_FOpenFile( filename, &file, FS_READ ) == -1 )
+ return NULL;
+
+ cin = Cin_Malloc( sizeof( cinematics_t ) );
+ memset( cin, 0, sizeof( cinematics_t ) );
+ cin->name = filename;
+ cin->file = file;
+ cin->mempool = r_cinMemPool;
+
+ // read header
+ RoQ_ReadChunk( cin );
+
+ chunk = &cin->chunk;
+ if( chunk->id != RoQ_HEADER1 || chunk->size != RoQ_HEADER2 || chunk->argument != RoQ_HEADER3 ) {
+ R_StopRoQ( cin );
+ Cin_Free( cin );
+ return NULL;
+ }
+
+ cin->headerlen = FS_Tell( cin->file );
+ cin->frame = 0;
+ cin->pic = cin->pic_pending = R_ReadNextRoQFrame( cin );
+ cin->time = Sys_Milliseconds ();
+ cin->new_frame = qtrue;
+
+ return cin;
+}
+
+/*
+==================
R_ResampleCinematicFrame
==================
*/
-image_t *R_ResampleCinematicFrame( shaderpass_t *pass )
+static image_t *R_ResampleCinematicFrame( r_cinhandle_t *handle )
{
image_t *image;
- cinematics_t *cin = pass->cin;
+ cinematics_t *cin = handle->cin;
if( !cin->pic )
return NULL;
- if( pass->anim_frames[0] ) {
- image = pass->anim_frames[0];
- } else {
- image = R_LoadPic( cin->name, &cin->pic, cin->width, cin->height, IT_CINEMATIC, 3 );
+ if( !handle->image ) {
+ handle->image = R_LoadPic( handle->name, &cin->pic, cin->width, cin->height, IT_CINEMATIC, 3 );
cin->new_frame = qfalse;
}
if( !cin->new_frame )
- return image;
+ return handle->image;
+
cin->new_frame = qfalse;
+ image = handle->image;
GL_Bind( 0, image );
if( image->width != cin->width || image->height != cin->height )
- R_Upload32( &cin->pic, image->width, image->height, IT_CINEMATIC, NULL, NULL, 3, qfalse );
+ R_Upload32( &cin->pic, image->width, image->height, IT_CINEMATIC, &(image->upload_width), &(image->upload_height), 3, qfalse );
else
- R_Upload32( &cin->pic, image->width, image->height, IT_CINEMATIC, NULL, NULL, 3, qtrue );
+ R_Upload32( &cin->pic, image->width, image->height, IT_CINEMATIC, &(image->upload_width), &(image->upload_height), 3, qtrue );
image->width = cin->width;
image->height = cin->height;
return image;
}
+//==================================================================================
+
/*
==================
-R_RunCinematic
+R_CinList_f
==================
*/
-void R_RunCinematic( cinematics_t *cin )
+void R_CinList_f( void )
{
- int frame;
+ r_cinhandle_t *handle, *hnode, *next;
+ cinematics_t *cin;
+ image_t *image;
- frame = (Sys_Milliseconds () - cin->time) * (float)(RoQ_FRAMERATE) / 1000;
- if( frame <= cin->frame )
+ Com_Printf( "Active cintematics:" );
+ hnode = &r_cinematics_headnode;
+ handle = hnode->prev;
+ if( handle == hnode ) {
+ Com_Printf( " none\n" );
return;
- if( frame > cin->frame + 1 )
- cin->time = Sys_Milliseconds () - cin->frame * 1000 / RoQ_FRAMERATE;
+ }
- cin->pic = cin->pic_pending;
- cin->pic_pending = R_ReadNextCinematicFrame( cin );
+ Com_Printf( "\n" );
+ for( ; handle != hnode; handle = next ) {
+ next = handle->prev;
- if( !cin->pic_pending ) {
- FS_Seek( cin->file, cin->headerlen, FS_SEEK_SET );
- cin->frame = 0;
- cin->pic_pending = R_ReadNextCinematicFrame( cin );
- cin->time = Sys_Milliseconds ();
+ assert( cin );
+ cin = handle->cin;
+ image = handle->image;
+
+ if( image && (cin->width != image->upload_width || cin->height != image->upload_height) )
+ Com_Printf( "%s %i(%i)x%i(%i) %i\n", cin->name, cin->width, image->upload_width, cin->height, image->upload_height, cin->frame );
+ else
+ Com_Printf( "%s %ix%i %i\n", cin->name, cin->width, cin->height, cin->frame );
}
+}
- cin->new_frame = qtrue;
+/*
+==================
+R_InitCinematics
+==================
+*/
+void R_InitCinematics( void )
+{
+ int i;
+
+ r_cinMemPool = Mem_AllocPool( NULL, "Cinematics" );
+
+ r_cinematics = Cin_Malloc( sizeof( r_cinhandle_t ) * MAX_CINEMATICS );
+ memset( r_cinematics, 0, sizeof( r_cinhandle_t ) * MAX_CINEMATICS );
+
+ // link cinemtics
+ r_free_cinematics = r_cinematics;
+ r_cinematics_headnode.id = 0;
+ r_cinematics_headnode.prev = &r_cinematics_headnode;
+ r_cinematics_headnode.next = &r_cinematics_headnode;
+ for( i = 0; i < MAX_CINEMATICS - 1; i++ ) {
+ if( i < MAX_CINEMATICS - 1 )
+ r_cinematics[i].next = &r_cinematics[i+1];
+ r_cinematics[i].id = i + 1;
+ }
+
+ Cmd_AddCommand( "cinlist", R_CinList_f );
}
/*
==================
-R_PlayCinematic
+R_RunAllCinematics
==================
*/
-void R_PlayCinematic( cinematics_t *cin )
+void R_RunAllCinematics( void )
{
- int len;
- roq_chunk_t *chunk = &cin->chunk;
+ r_cinhandle_t *handle, *hnode, *next;
- cin->width = cin->height = 0;
- len = FS_FOpenFile( cin->name, &cin->file, FS_READ );
- if( !cin->file || len < 1 ) {
- cin->time = 0; // done
- return;
+ hnode = &r_cinematics_headnode;
+ for( handle = hnode->prev; handle != hnode; handle = next ) {
+ next = handle->prev;
+
+ R_RunRoQ( handle->cin );
}
+}
- // read header
- RoQ_ReadChunk( cin );
+/*
+==================
+R_UploadCinematics
+==================
+*/
+image_t *R_UploadCinematics( unsigned int id )
+{
+ assert( id > 0 && id <= MAX_CINEMATICS );
+ return R_ResampleCinematicFrame( r_cinematics + id - 1 );
+}
- if( chunk->id != RoQ_HEADER1 || chunk->size != RoQ_HEADER2 || chunk->argument != RoQ_HEADER3 ) {
- R_StopCinematic( cin );
- cin->time = 0; // done
+/*
+==================
+R_StartCinematic
+==================
+*/
+unsigned int R_StartCinematics( const char *arg )
+{
+ char *name = NULL;
+ size_t name_size;
+ cinematics_t *cin = NULL;
+ r_cinhandle_t *handle, *hnode, *next;
+
+ name_size = strlen( "video/" ) + strlen( arg ) + strlen( ".roq" ) + 1;
+ name = Cin_Malloc( name_size );
+ Q_snprintfz( name, name_size, "video/%s", arg );
+ COM_DefaultExtension( name, ".roq" );
+
+ // find cinematics with the same name
+ hnode = &r_cinematics_headnode;
+ for( handle = hnode->prev; handle != hnode; handle = next ) {
+ next = handle->prev;
+
+ assert( handle->cin );
+
+ // reuse
+ if( !Q_stricmp( handle->cin->name, name ) ) {
+ Cin_Free( name );
+ return handle->id;
+ }
+ }
+
+ // open the file, read header, etc
+ cin = R_OpenCinematics( name );
+
+ // take a free cinematic handle if possible
+ if( !r_free_cinematics || !cin ) {
+ Cin_Free( name );
+ return 0;
+ }
+
+ handle = r_free_cinematics;
+ r_free_cinematics = handle->next;
+
+ name = va( "***r_cinematic%i***", handle->id-1 );
+ name_size = strlen( name ) + 1;
+ handle->name = Cin_Malloc( name_size );
+ memcpy( handle->name, name, name_size );
+ handle->cin = cin;
+
+ // put handle at the start of the list
+ handle->prev = &r_cinematics_headnode;
+ handle->next = r_cinematics_headnode.next;
+ handle->next->prev = handle;
+ handle->prev->next = handle;
+
+ return handle->id;
+}
+
+/*
+=================
+R_FreeCinematics
+=================
+*/
+void R_FreeCinematics( unsigned int id )
+{
+ r_cinhandle_t *handle;
+
+ handle = r_cinematics + id - 1;
+
+ if( handle->cin ) {
+ R_StopRoQ( handle->cin );
+ Cin_Free( handle->cin );
+ handle->cin = NULL;
+ }
+ if( handle->name ) {
+ Cin_Free( handle->name );
+ handle->name = NULL;
+ }
+
+ // remove from linked active list
+ handle->prev->next = handle->next;
+ handle->next->prev = handle->prev;
+
+ // insert into linked free list
+ handle->next = r_free_cinematics;
+ r_free_cinematics = handle;
+}
+
+
+/*
+==================
+R_ShutdownCinematics
+==================
+*/
+void R_ShutdownCinematics( void )
+{
+ r_cinhandle_t *handle, *hnode, *next;
+
+ if( !r_cinMemPool )
return;
+
+ hnode = &r_cinematics_headnode;
+ for( handle = hnode->prev; handle != hnode; handle = next ) {
+ next = handle->prev;
+ R_FreeCinematics( handle->id );
}
- cin->headerlen = FS_Tell( cin->file );
- cin->frame = 0;
- cin->pic = cin->pic_pending = R_ReadNextCinematicFrame( cin );
- cin->time = Sys_Milliseconds ();
+ Cin_Free( r_cinematics );
+ Mem_FreePool( &r_cinMemPool );
- cin->new_frame = qtrue;
+ Cmd_RemoveCommand( "cinlist" );
}
Modified: trunk/qfusion/source/ref_gl/r_local.h
===================================================================
--- trunk/qfusion/source/ref_gl/r_local.h 2007-12-04 20:33:04 UTC (rev 789)
+++ trunk/qfusion/source/ref_gl/r_local.h 2007-12-05 20:41:22 UTC (rev 790)
@@ -20,7 +20,6 @@
*/
#include "../qcommon/qcommon.h"
-#include "../client/cin.h"
#include "r_glimp.h"
#include "r_public.h"
@@ -374,10 +373,12 @@
//
// r_cin.c
//
-void R_PlayCinematic( cinematics_t *cin );
-void R_RunCinematic( cinematics_t *cin );
-void R_StopCinematic( cinematics_t *cin );
-image_t *R_ResampleCinematicFrame( shaderpass_t *pass );
+void R_InitCinematics( void );
+void R_ShutdownCinematics( void );
+unsigned int R_StartCinematics( const char *arg );
+void R_FreeCinematics( unsigned int id );
+void R_RunAllCinematics( void );
+image_t *R_UploadCinematics( unsigned int id );
//
// r_cull.c
Modified: trunk/qfusion/source/ref_gl/r_main.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_main.c 2007-12-04 20:33:04 UTC (rev 789)
+++ trunk/qfusion/source/ref_gl/r_main.c 2007-12-05 20:41:22 UTC (rev 790)
@@ -1824,8 +1824,8 @@
R_UpdateHWGamma ();
}
- // run cinematic passes on shaders
- R_RunCinematicShaders ();
+ // advance cinematics
+ R_RunAllCinematics ();
// go into 2D mode
R_Set2DMode( qtrue );
Modified: trunk/qfusion/source/ref_gl/r_register.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_register.c 2007-12-04 20:33:04 UTC (rev 789)
+++ trunk/qfusion/source/ref_gl/r_register.c 2007-12-05 20:41:22 UTC (rev 790)
@@ -989,6 +989,7 @@
R_InitLightStyles ();
R_InitGLSLPrograms ();
R_InitImages ();
+ R_InitCinematics ();
R_InitShaders( !r_firstTime );
R_InitModels ();
R_InitSkinFiles ();
@@ -1018,6 +1019,7 @@
R_ShutdownShadows ();
R_ShutdownSkinFiles ();
R_ShutdownModels ();
+ R_ShutdownCinematics ();
R_ShutdownShaders ();
R_ShutdownImages ();
R_ShutdownGLSLPrograms ();
Modified: trunk/qfusion/source/ref_gl/r_shader.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_shader.c 2007-12-04 20:33:04 UTC (rev 789)
+++ trunk/qfusion/source/ref_gl/r_shader.c 2007-12-05 20:41:22 UTC (rev 790)
@@ -46,9 +46,6 @@
static shader_t *shaders_hash[SHADERS_HASH_SIZE];
static shadercache_t *shadercache_hash[SHADERCACHE_HASH_SIZE];
-static shader_t *r_cinematicShaders[MAX_SHADERS];
-static int r_numCinematicShaders;
-
static deformv_t r_currentDeforms[MAX_SHADER_DEFORMVS];
static shaderpass_t r_currentPasses[MAX_SHADER_PASSES];
static float r_currentRGBgenArgs[MAX_SHADER_PASSES][3], r_currentAlphagenArgs[MAX_SHADER_PASSES][2];
@@ -67,6 +64,7 @@
static void Shader_ParseFunc( char **args, shaderfunc_t *func );
static void Shader_MakeCache( qboolean silent, const char *name );
static unsigned int Shader_GetCache( char *name, shadercache_t **cache );
+#define Shader_FreePassCinematics(pass) if( (pass)->cin ) { R_FreeCinematics( (pass)->cin ); (pass)->cin = 0; }
//===========================================================================
@@ -743,26 +741,23 @@
int flags;
char *token;
- if( pass->cin ) {
- Shader_Free( pass->cin );
- pass->cin = NULL;
- }
+ Shader_FreePassCinematics( pass );
token = Shader_ParseString( ptr );
if( !Q_stricmp( token, "$lightmap" ) ) {
pass->tcgen = TC_GEN_LIGHTMAP;
- pass->flags = (pass->flags & ~(SHADERPASS_VIDEOMAP|SHADERPASS_PORTALMAP|SHADERPASS_DLIGHT)) | SHADERPASS_LIGHTMAP;
+ pass->flags = (pass->flags & ~(SHADERPASS_PORTALMAP|SHADERPASS_DLIGHT)) | SHADERPASS_LIGHTMAP;
pass->anim_fps = 0;
pass->anim_frames[0] = NULL;
} else if( !Q_stricmp( token, "$dlight" ) ) {
pass->tcgen = TC_GEN_BASE;
- pass->flags = (pass->flags & ~(SHADERPASS_LIGHTMAP|SHADERPASS_VIDEOMAP|SHADERPASS_PORTALMAP)) | SHADERPASS_DLIGHT;
+ pass->flags = (pass->flags & ~(SHADERPASS_LIGHTMAP|SHADERPASS_PORTALMAP)) | SHADERPASS_DLIGHT;
pass->anim_fps = 0;
pass->anim_frames[0] = NULL;
r_shaderHasDlightPass = qtrue;
} else if( !Q_stricmp( token, "$portalmap" ) || !Q_stricmp( token, "$mirrormap" ) ) {
pass->tcgen = TC_GEN_PROJECTION;
- pass->flags = (pass->flags & ~(SHADERPASS_LIGHTMAP|SHADERPASS_VIDEOMAP|SHADERPASS_DLIGHT)) | SHADERPASS_PORTALMAP;
+ pass->flags = (pass->flags & ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT)) | SHADERPASS_PORTALMAP;
pass->anim_fps = 0;
pass->anim_frames[0] = NULL;
if( (shader->flags & SHADER_PORTAL) && (shader->sort == SHADER_SORT_PORTAL) ) {
@@ -780,7 +775,7 @@
flags = Shader_SetImageFlags( shader ) | addFlags;
pass->tcgen = TC_GEN_BASE;
- pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_VIDEOMAP|SHADERPASS_PORTALMAP);
+ pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_PORTALMAP);
pass->anim_fps = 0;
pass->anim_frames[0] = Shader_FindImage( shader, token, flags, 0 );
}
@@ -791,15 +786,12 @@
int flags;
char *token;
- if( pass->cin ) {
- Shader_Free( pass->cin );
- pass->cin = NULL;
- }
+ Shader_FreePassCinematics( pass );
flags = Shader_SetImageFlags( shader ) | addFlags;
pass->tcgen = TC_GEN_BASE;
- pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_VIDEOMAP|SHADERPASS_PORTALMAP);
+ pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_PORTALMAP);
pass->anim_fps = Shader_ParseFloat( ptr );
pass->anim_numframes = 0;
@@ -820,15 +812,12 @@
int flags;
char *token;
- if( pass->cin ) {
- Shader_Free( pass->cin );
- pass->cin = NULL;
- }
+ Shader_FreePassCinematics( pass );
token = Shader_ParseString( ptr );
flags = Shader_SetImageFlags( shader ) | addFlags;
pass->anim_fps = 0;
- pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_VIDEOMAP|SHADERPASS_PORTALMAP);
+ pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_PORTALMAP);
if( !glConfig.ext.texture_cube_map ) {
Com_DPrintf( S_COLOR_YELLOW "Shader %s has an unsupported cubemap stage: %s.\n", shader->name );
@@ -874,28 +863,15 @@
static void Shaderpass_VideoMap( shader_t *shader, shaderpass_t *pass, char **ptr )
{
char *token;
- size_t name_size;
- cinematics_t *cin;
- if( pass->cin ) {
- Shader_Free( pass->cin );
- pass->cin = NULL;
- }
+ Shader_FreePassCinematics( pass );
token = Shader_ParseString( ptr );
- name_size = strlen( "video/" ) + strlen( token ) + strlen( ".roq" ) + 1;
- cin = pass->cin = (cinematics_t *)Shader_Malloc( sizeof( cinematics_t ) + name_size );
- cin->frame = -1;
- cin->name = ( char * )(( qbyte * )cin + sizeof( cinematics_t ) );
- Q_snprintfz( cin->name, name_size, "video/%s", token );
- COM_DefaultExtension( cin->name, ".roq" );
-
+ pass->cin = R_StartCinematics( token );
pass->tcgen = TC_GEN_BASE;
pass->anim_fps = 0;
- pass->flags = (pass->flags & ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_PORTALMAP)) | SHADERPASS_VIDEOMAP;
- shader->flags |= SHADER_VIDEOMAP;
- r_cinematicShaders[r_numCinematicShaders++] = shader;
+ pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_PORTALMAP);
}
static void Shaderpass_NormalMap( shader_t *shader, shaderpass_t *pass, char **ptr )
@@ -910,10 +886,7 @@
return;
}
- if( pass->cin ) {
- Shader_Free( pass->cin );
- pass->cin = NULL;
- }
+ Shader_FreePassCinematics( pass );
flags = Shader_SetImageFlags( shader );
token = Shader_ParseString( ptr );
@@ -925,7 +898,7 @@
}
pass->tcgen = TC_GEN_BASE;
- pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_VIDEOMAP|SHADERPASS_PORTALMAP);
+ pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_PORTALMAP);
pass->anim_frames[1] = R_FindImage( token, flags, bumpScale );
if( pass->anim_frames[1] ) {
pass->program = DEFAULT_GLSL_PROGRAM;
@@ -952,10 +925,7 @@
return;
}
- if( pass->cin ) {
- Shader_Free( pass->cin );
- pass->cin = NULL;
- }
+ Shader_FreePassCinematics( pass );
flags = Shader_SetImageFlags( shader );
token = Shader_ParseString( ptr );
@@ -966,7 +936,7 @@
pass->anim_frames[1] = pass->anim_frames[2] = NULL;
pass->tcgen = TC_GEN_BASE;
- pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_VIDEOMAP|SHADERPASS_PORTALMAP);
+ pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_PORTALMAP);
norm[0] = gloss[0] = '\0';
while( 1 ) {
@@ -1022,13 +992,10 @@
return;
}
- if( pass->cin ) {
- Shader_Free( pass->cin );
- pass->cin = NULL;
- }
+ Shader_FreePassCinematics( pass );
flags = Shader_SetImageFlags( shader );
- pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_VIDEOMAP|SHADERPASS_PORTALMAP);
+ pass->flags &= ~(SHADERPASS_LIGHTMAP|SHADERPASS_DLIGHT|SHADERPASS_PORTALMAP);
norm[0] = dudv[0] = '\0';
while( 1 ) {
@@ -1481,7 +1448,7 @@
return key;
}
-void Shader_FreeShader( shader_t *shader )
+static void Shader_FreeShader( shader_t *shader )
{
int i;
int shaderNum;
@@ -1493,12 +1460,9 @@
r_skydomes[shaderNum] = NULL;
}
- for( i = 0, pass = shader->passes; i < shader->numpasses; i++, pass++ ) {
- if( pass->flags & SHADERPASS_VIDEOMAP ) {
- R_StopCinematic( pass->cin );
- Shader_Free( pass->cin );
- pass->cin = NULL;
- }
+ if( shader->flags & SHADER_VIDEOMAP ) {
+ for( i = 0, pass = shader->passes; i < shader->numpasses; i++, pass++ )
+ Shader_FreePassCinematics( pass );
}
Shader_Free( shader->name );
@@ -1509,17 +1473,18 @@
int i;
shader_t *shader;
+ if( !r_shadersmempool )
+ return;
+
for( i = 0, shader = r_shaders; i < r_numShaders; i++, shader++ )
Shader_FreeShader( shader );
Mem_FreePool( &r_shadersmempool );
r_numShaders = 0;
- r_numCinematicShaders = 0;
shaderPaths = NULL;
memset( r_shaders, 0, sizeof( r_shaders ) );
- memset( r_cinematicShaders, 0, sizeof( r_cinematicShaders ) );
memset( shaders_hash, 0, sizeof( shaders_hash ) );
memset( shadercache_hash, 0, sizeof( shadercache_hash ) );
}
@@ -1849,6 +1814,8 @@
s->flags |= SHADER_NO_MODULATIVE_DLIGHTS;
for( i = 0, pass = s->passes; i < s->numpasses; i++, pass++ ) {
+ if( pass->cin )
+ s->flags |= SHADER_VIDEOMAP;
if( pass->flags & SHADERPASS_LIGHTMAP )
s->flags |= SHADER_LIGHTMAP;
if( pass->program ) {
@@ -1943,41 +1910,11 @@
// upload cinematics
for( j = 0, pass = shader->passes; j < shader->numpasses; j++, pass++ ) {
- if( pass->flags & SHADERPASS_VIDEOMAP )
- pass->anim_frames[0] = R_ResampleCinematicFrame( pass );
+ if( pass->cin )
+ pass->anim_frames[0] = R_UploadCinematics( pass->cin );
}
}
-void R_RunCinematicShaders( void )
-{
- int i, j;
- shader_t *shader;
- shaderpass_t *pass;
-
- for( i = 0; i < r_numCinematicShaders; i++ ) {
- shader = r_cinematicShaders[i];
-
- for ( j = 0, pass = shader->passes; j < shader->numpasses; j++, pass++ ) {
- if( !(pass->flags & SHADERPASS_VIDEOMAP) )
- continue;
-
- // reinitialize
- if( pass->cin->frame == -1 ) {
- R_StopCinematic( pass->cin );
- R_PlayCinematic( pass->cin );
-
- if( pass->cin->time == 0 ) { // not found
- pass->flags &= ~SHADERPASS_VIDEOMAP;
- Shader_Free( pass->cin );
- }
- continue;
- }
-
- R_RunCinematic( pass->cin );
- }
- }
-}
-
void R_DeformvBBoxForShader( shader_t *shader, vec3_t ebbox )
{
int dv;
Modified: trunk/qfusion/source/ref_gl/r_shader.h
===================================================================
--- trunk/qfusion/source/ref_gl/r_shader.h 2007-12-04 20:33:04 UTC (rev 789)
+++ trunk/qfusion/source/ref_gl/r_shader.h 2007-12-05 20:41:22 UTC (rev 790)
@@ -83,18 +83,17 @@
enum
{
SHADERPASS_LIGHTMAP = SHADERPASS_MARK_BEGIN,
- SHADERPASS_VIDEOMAP = SHADERPASS_MARK_BEGIN << 1,
- SHADERPASS_DETAIL = SHADERPASS_MARK_BEGIN << 2,
- SHADERPASS_NOCOLORARRAY = SHADERPASS_MARK_BEGIN << 3,
- SHADERPASS_DLIGHT = SHADERPASS_MARK_BEGIN << 4,
- SHADERPASS_DELUXEMAP = SHADERPASS_MARK_BEGIN << 5,
- SHADERPASS_PORTALMAP = SHADERPASS_MARK_BEGIN << 6,
- SHADERPASS_STENCILSHADOW = SHADERPASS_MARK_BEGIN << 7,
+ SHADERPASS_DETAIL = SHADERPASS_MARK_BEGIN << 1,
+ SHADERPASS_NOCOLORARRAY = SHADERPASS_MARK_BEGIN << 2,
+ SHADERPASS_DLIGHT = SHADERPASS_MARK_BEGIN << 3,
+ SHADERPASS_DELUXEMAP = SHADERPASS_MARK_BEGIN << 4,
+ SHADERPASS_PORTALMAP = SHADERPASS_MARK_BEGIN << 5,
+ SHADERPASS_STENCILSHADOW = SHADERPASS_MARK_BEGIN << 6,
- SHADERPASS_BLEND_REPLACE = SHADERPASS_MARK_BEGIN << 8,
- SHADERPASS_BLEND_MODULATE = SHADERPASS_MARK_BEGIN << 9,
- SHADERPASS_BLEND_ADD = SHADERPASS_MARK_BEGIN << 10,
- SHADERPASS_BLEND_DECAL = SHADERPASS_MARK_BEGIN << 11
+ SHADERPASS_BLEND_REPLACE = SHADERPASS_MARK_BEGIN << 7,
+ SHADERPASS_BLEND_MODULATE = SHADERPASS_MARK_BEGIN << 8,
+ SHADERPASS_BLEND_ADD = SHADERPASS_MARK_BEGIN << 9,
+ SHADERPASS_BLEND_DECAL = SHADERPASS_MARK_BEGIN << 10
};
#define SHADERPASS_BLENDMODE (SHADERPASS_BLEND_REPLACE|SHADERPASS_BLEND_MODULATE|SHADERPASS_BLEND_ADD|SHADERPASS_BLEND_DECAL)
@@ -229,7 +228,7 @@
unsigned short numtcmods;
tcmod_t *tcmods;
- cinematics_t *cin;
+ unsigned int cin;
const char *program;
unsigned short program_type;
@@ -272,14 +271,13 @@
extern int r_numShaders;
extern skydome_t *r_skydomes[MAX_SHADERS];
-#define Shader_Malloc(size) Mem_Alloc(r_shadersmempool,size)
+#define Shader_Malloc(size) _Mem_Alloc(r_shadersmempool,size,0,0,__FILE__,__LINE__)
#define Shader_Free(data) Mem_Free(data)
#define Shader_Sortkey(shader,sort) (((sort)<<26)|(shader-r_shaders))
void R_InitShaders( qboolean silent );
void R_ShutdownShaders( void );
-void R_RunCinematicShaders( void );
void R_UploadCinematicShader( shader_t *shader );
void R_DeformvBBoxForShader( shader_t *shader, vec3_t ebbox );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-04 20:33:17
|
Revision: 789
http://l33t.svn.sourceforge.net/l33t/?rev=789&view=rev
Author: digiman
Date: 2007-12-04 12:33:04 -0800 (Tue, 04 Dec 2007)
Log Message:
-----------
Only lerp reflection and refraction of alphagen is not identity
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_backend.c
trunk/qfusion/source/ref_gl/r_local.h
trunk/qfusion/source/ref_gl/r_program.c
trunk/qfusion/source/ref_gl/r_shader.c
Modified: trunk/qfusion/source/ref_gl/r_backend.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_backend.c 2007-12-03 21:24:42 UTC (rev 788)
+++ trunk/qfusion/source/ref_gl/r_backend.c 2007-12-04 20:33:04 UTC (rev 789)
@@ -1880,16 +1880,14 @@
R_BindShaderpass( pass, pass->anim_frames[0], 0 ); // dudvmap
+ // calculate the fragment color
+ R_ModifyColor( pass );
+
if( frontPlane )
- { // calculate the fragment color
- R_ModifyColor( pass );
+ {
+ if( pass->alphagen.type != ALPHA_GEN_IDENTITY )
+ programFeatures |= PROGRAM_APPLY_DISTORTION_ALPHA;
}
- else
- { // set refractional part to 1 (1-alpha), reflection doesn't work on backplane
- numColors = 1;
- colorArray[0][0] = colorArray[0][1] = colorArray[0][2] = 255;
- colorArray[0][3] = 0;
- }
// set shaderpass state (blending, depthwrite, etc)
state = r_currentShaderState | (pass->flags & r_currentShaderPassMask) | GLSTATE_BLEND_MTEX;
Modified: trunk/qfusion/source/ref_gl/r_local.h
===================================================================
--- trunk/qfusion/source/ref_gl/r_local.h 2007-12-03 21:24:42 UTC (rev 788)
+++ trunk/qfusion/source/ref_gl/r_local.h 2007-12-04 20:33:04 UTC (rev 789)
@@ -545,13 +545,14 @@
PROGRAM_APPLY_RELIEFMAPPING = 1 << 8,
PROGRAM_APPLY_EYEDOT = 1 << 9,
+ PROGRAM_APPLY_DISTORTION_ALPHA = 1 << 10,
- PROGRAM_APPLY_PCF2x2 = 1 << 10,
- PROGRAM_APPLY_PCF3x3 = 1 << 11,
+ PROGRAM_APPLY_PCF2x2 = 1 << 11,
+ PROGRAM_APPLY_PCF3x3 = 1 << 12,
- PROGRAM_APPLY_BRANCHING = 1 << 12,
- PROGRAM_APPLY_CLIPPING = 1 << 13,
- PROGRAM_APPLY_AMBIENT_COMPENSATION = 1 << 14
+ PROGRAM_APPLY_BRANCHING = 1 << 13,
+ PROGRAM_APPLY_CLIPPING = 1 << 14,
+ PROGRAM_APPLY_AMBIENT_COMPENSATION = 1 << 15
};
void R_InitGLSLPrograms( void );
Modified: trunk/qfusion/source/ref_gl/r_program.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_program.c 2007-12-03 21:24:42 UTC (rev 788)
+++ trunk/qfusion/source/ref_gl/r_program.c 2007-12-04 20:33:04 UTC (rev 789)
@@ -209,7 +209,9 @@
{ PROGRAM_APPLY_SPECULAR, "#define APPLY_SPECULAR\n", "_gloss" },
{ PROGRAM_APPLY_OFFSETMAPPING, "#define APPLY_OFFSETMAPPING\n", "_offmap" },
{ PROGRAM_APPLY_RELIEFMAPPING, "#define APPLY_RELIEFMAPPING\n", "_relmap" },
+
{ PROGRAM_APPLY_EYEDOT, "#define APPLY_EYEDOT\n", "_eyedot" },
+ { PROGRAM_APPLY_DISTORTION_ALPHA, "#define APPLY_DISTORTION_ALPHA\n", "_alpha" },
{ PROGRAM_APPLY_PCF2x2, "#define APPLY_PCF2x2\n", "_pcf2x2" },
{ PROGRAM_APPLY_PCF3x3, "#define APPLY_PCF3x3\n", "_pcf3x3" },
@@ -557,7 +559,7 @@
"\n"
"void main(void)\n"
"{\n"
-"vec4 color = vec4 (0.0);\n"
+"vec3 color = vec3 (0.0);\n"
"\n"
"vec3 displacement = vec3(texture2D(DuDvMapTexture, vec2(TexCoord.pq) * vec2(0.25)));\n"
"vec2 coord = vec2(TexCoord.st) + vec2(displacement) * vec2 (0.2);\n"
@@ -580,7 +582,7 @@
"vec3 eyeNormal = vec3(normalize(vec3(EyeVector)));\n"
"\n"
"float refrdot = float(dot(surfaceNormal, eyeNormal));\n"
-"refrdot = float (clamp (refrdot, 0.0, 1.0));\n"
+"//refrdot = float (clamp (refrdot, 0.0, 1.0));\n"
"float refldot = 1.0 - refrdot;\n"
"// get refraction and reflection\n"
"vec3 refr = (vec3(texture2D(RefractionTexture, vec2(projCoord.st)))) * refrdot;\n"
@@ -592,8 +594,13 @@
"\n"
"\n"
"// add reflection and refraction\n"
-"color.rgb = (refr.rgb + vec3 (1.0) - vec3 (gl_Color.rgb)) * (1.0 - float(gl_Color.a)) + refl.rgb * (float(gl_Color.a));\n"
-"gl_FragColor = color;\n"
+"#ifdef APPLY_DISTORTION_ALPHA\n"
+"color = vec3(gl_Color.rgb) + mix (refr, refl, float(gl_Color.a));\n"
+"#else\n"
+"color = vec3(gl_Color.rgb) + refr + refl;\n"
+"#endif\n"
+"\n"
+"gl_FragColor = vec4 (color, 1.0);\n"
"}\n"
"\n"
"#endif // FRAGMENT_SHADER\n"
Modified: trunk/qfusion/source/ref_gl/r_shader.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_shader.c 2007-12-03 21:24:42 UTC (rev 788)
+++ trunk/qfusion/source/ref_gl/r_shader.c 2007-12-04 20:33:04 UTC (rev 789)
@@ -1055,6 +1055,11 @@
pass->program_type = PROGRAM_TYPE_DISTORTION;
pass->anim_frames[0] = R_FindImage( dudv, flags & ~IT_HEIGHTMAP, 0 );
pass->anim_frames[1] = NULL;
+ if( pass->rgbgen.type == RGB_GEN_UNKNOWN )
+ {
+ pass->rgbgen.type = RGB_GEN_CONST;
+ VectorClear( pass->rgbgen.args );
+ }
if( !pass->anim_frames[0] ) {
Com_DPrintf( S_COLOR_YELLOW "WARNING: missing dudvmap image %s in shader %s.\n", dudv, shader->name );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-03 21:25:08
|
Revision: 788
http://l33t.svn.sourceforge.net/l33t/?rev=788&view=rev
Author: digiman
Date: 2007-12-03 13:24:42 -0800 (Mon, 03 Dec 2007)
Log Message:
-----------
misc small changes
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_main.c
trunk/qfusion/source/ref_gl/r_public.h
trunk/qfusion/source/ref_gl/r_register.c
Modified: trunk/qfusion/source/ref_gl/r_main.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_main.c 2007-12-03 19:49:05 UTC (rev 787)
+++ trunk/qfusion/source/ref_gl/r_main.c 2007-12-03 21:24:42 UTC (rev 788)
@@ -638,6 +638,7 @@
*/
static void R_PushCorona( const meshbuffer_t *mb )
{
+ int i;
vec4_t color;
vec3_t origin, point;
dlight_t *light = r_dlights + (-mb->infokey - 1);
@@ -661,14 +662,11 @@
light->color[1] * colorscale,
light->color[2] * colorscale,
255 );
- clamp( color[0], 0, 255 );
- clamp( color[1], 0, 255 );
- clamp( color[2], 0, 255 );
+ for( i = 0; i < 4; i++ )
+ clamp( color[i], 0, 255 );
- Vector4Copy( color, spr_color[0] );
- Vector4Copy( color, spr_color[1] );
- Vector4Copy( color, spr_color[2] );
- Vector4Copy( color, spr_color[3] );
+ for( i = 0; i < 4; i++ )
+ Vector4Copy( color, spr_color[i] );
MB_NUM2SHADER( mb->shaderkey, shader );
@@ -923,7 +921,7 @@
R_PolyBlend
============
*/
-void R_PolyBlend (void)
+static void R_PolyBlend (void)
{
if( !r_polyblend->integer )
return;
@@ -960,7 +958,7 @@
R_ApplySoftwareGamma
===============
*/
-void R_ApplySoftwareGamma( void )
+static void R_ApplySoftwareGamma( void )
{
double f, div;
Modified: trunk/qfusion/source/ref_gl/r_public.h
===================================================================
--- trunk/qfusion/source/ref_gl/r_public.h 2007-12-03 19:49:05 UTC (rev 787)
+++ trunk/qfusion/source/ref_gl/r_public.h 2007-12-03 21:24:42 UTC (rev 788)
@@ -60,7 +60,6 @@
void R_BeginFrame( float cameraSeparation, qboolean forceClear );
void R_EndFrame( void );
-void R_ApplySoftwareGamma( void );
void R_BeginAviDemo( void );
void R_WriteAviFrame( int frame, qboolean scissor );
Modified: trunk/qfusion/source/ref_gl/r_register.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_register.c 2007-12-03 19:49:05 UTC (rev 787)
+++ trunk/qfusion/source/ref_gl/r_register.c 2007-12-03 21:24:42 UTC (rev 788)
@@ -18,7 +18,7 @@
*/
-// r_main.c
+// r_register.c
#include "r_local.h"
glconfig_t glConfig;
@@ -513,7 +513,6 @@
//=======================================================================
-
/*
==================
R_Register
@@ -706,10 +705,24 @@
/*
===============
+R_SetDefaultTexState
+===============
+*/
+static void R_SetDefaultTexState( void )
+{
+ memset( glState.currentTextures, -1, MAX_TEXTURE_UNITS*sizeof(*glState.currentTextures) );
+ memset( glState.currentEnvModes, -1, MAX_TEXTURE_UNITS*sizeof(*glState.currentEnvModes) );
+ memset( glState.texIdentityMatrix, 0, MAX_TEXTURE_UNITS*sizeof(*glState.texIdentityMatrix) );
+ memset( glState.genSTEnabled, 0, MAX_TEXTURE_UNITS*sizeof(*glState.genSTEnabled) );
+ memset( glState.texCoordArrayMode, 0, MAX_TEXTURE_UNITS*sizeof(*glState.texCoordArrayMode) );
+}
+
+/*
+===============
R_SetDefaultState
===============
*/
-void R_SetDefaultState( void )
+static void R_SetDefaultState( void )
{
// FIXME: dynamically allocate these?
static GLuint r_currentTextures[MAX_TEXTURE_UNITS];
@@ -720,18 +733,13 @@
memset( &glState, 0, sizeof(glState) );
- glState.currentTMU = 0;
glState.currentTextures = r_currentTextures;
glState.currentEnvModes = r_currentEnvModes;
glState.texIdentityMatrix = r_texIdentityMatrix;
glState.genSTEnabled = r_genSTEnabled;
glState.texCoordArrayMode = r_texCoordArrayMode;
- memset( glState.currentTextures, -1, MAX_TEXTURE_UNITS*sizeof(*glState.currentTextures) );
- memset( glState.currentEnvModes, -1, MAX_TEXTURE_UNITS*sizeof(*glState.currentEnvModes) );
- memset( glState.texIdentityMatrix, 0, MAX_TEXTURE_UNITS*sizeof(*glState.texIdentityMatrix) );
- memset( glState.genSTEnabled, 0, MAX_TEXTURE_UNITS*sizeof(*glState.genSTEnabled) );
- memset( glState.texCoordArrayMode, 0, MAX_TEXTURE_UNITS*sizeof(*glState.texCoordArrayMode) );
+ R_SetDefaultTexState ();
// set our "safe" modes
glState.previousMode = 3;
@@ -989,6 +997,8 @@
R_InitOcclusionQueries ();
R_InitCustomColors ();
+ R_SetDefaultTexState ();
+
memset( &ri, 0, sizeof( refinst_t ) );
glState.initializedMedia = qtrue;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-03 19:49:10
|
Revision: 787
http://l33t.svn.sourceforge.net/l33t/?rev=787&view=rev
Author: digiman
Date: 2007-12-03 11:49:05 -0800 (Mon, 03 Dec 2007)
Log Message:
-----------
Fix: R_SurfPotentiallyLit should return qfalse for SURF_NODLIGHT surfaces
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_light.c
Modified: trunk/qfusion/source/ref_gl/r_light.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_light.c 2007-12-03 18:42:41 UTC (rev 786)
+++ trunk/qfusion/source/ref_gl/r_light.c 2007-12-03 19:49:05 UTC (rev 787)
@@ -40,7 +40,7 @@
shader_t *shader;
if( surf->flags & (SURF_SKY|SURF_NODLIGHT|SURF_NODRAW) )
- return qtrue;
+ return qfalse;
shader = surf->shader;
if( (shader->flags & (SHADER_SKY|SHADER_FLARE)) || !shader->numpasses )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-03 18:42:42
|
Revision: 786
http://l33t.svn.sourceforge.net/l33t/?rev=786&view=rev
Author: digiman
Date: 2007-12-03 10:42:41 -0800 (Mon, 03 Dec 2007)
Log Message:
-----------
Default r_bloom_sample_size to 320 and make it possible to have NPOT sampling texture
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_bloom.c
trunk/qfusion/source/ref_gl/r_register.c
Modified: trunk/qfusion/source/ref_gl/r_bloom.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_bloom.c 2007-12-03 15:53:38 UTC (rev 785)
+++ trunk/qfusion/source/ref_gl/r_bloom.c 2007-12-03 18:42:41 UTC (rev 786)
@@ -141,30 +141,21 @@
static void R_Bloom_InitEffectTexture( void )
{
qbyte *data;
- float bloomsizecheck;
+ int limit;
if( r_bloom_sample_size->integer < 32 )
- Cvar_SetValue ("r_bloom_sample_size", 32);
+ Cvar_ForceSet( "r_bloom_sample_size", "32" );
- // make sure bloom size is a power of 2
- BLOOM_SIZE = r_bloom_sample_size->integer;
- bloomsizecheck = (float)BLOOM_SIZE;
- while( bloomsizecheck > 1.0f )
- bloomsizecheck /= 2.0f;
-
- if( bloomsizecheck != 1.0f ) {
- BLOOM_SIZE = 32;
- while( BLOOM_SIZE < r_bloom_sample_size->integer )
- BLOOM_SIZE *= 2;
- }
-
// make sure bloom size doesn't have stupid values
- if( BLOOM_SIZE > screen_texture_width ||
- BLOOM_SIZE > screen_texture_height )
- BLOOM_SIZE = min( screen_texture_width, screen_texture_height );
+ limit = min( r_bloom_sample_size->integer, min( screen_texture_width, screen_texture_height ) );
+ if( glConfig.ext.texture_non_power_of_two )
+ BLOOM_SIZE = limit;
+ else // make sure bloom size is a power of 2
+ for( BLOOM_SIZE = 32; (BLOOM_SIZE<<1) <= limit; BLOOM_SIZE <<= 1 );
+
if( BLOOM_SIZE != r_bloom_sample_size->integer )
- Cvar_SetValue ("r_bloom_sample_size", BLOOM_SIZE);
+ Cvar_ForceSet( "r_bloom_sample_size", va( "%i", BLOOM_SIZE ) );
data = Mem_TempMalloc( BLOOM_SIZE * BLOOM_SIZE * 4 );
memset( data, 0, BLOOM_SIZE * BLOOM_SIZE * 4 );
@@ -189,17 +180,14 @@
screen_texture_height = glState.height;
} else {
// find closer power of 2 to screen size
- for (screen_texture_width = 1;screen_texture_width < glState.width;screen_texture_width <<= 1);
- for (screen_texture_height = 1;screen_texture_height < glState.height;screen_texture_height <<= 1);
+ for( screen_texture_width = 1; screen_texture_width < glState.width; screen_texture_width <<= 1 );
+ for( screen_texture_height = 1; screen_texture_height < glState.height; screen_texture_height <<= 1 );
}
- // disable blooms if we can't handle a texture of that size
- if( screen_texture_width > glConfig.maxTextureSize ||
- screen_texture_height > glConfig.maxTextureSize ) {
- screen_texture_width = screen_texture_height = 0;
- Cvar_ForceSet( "r_bloom", "0" );
- Com_Printf( S_COLOR_YELLOW"WARNING: 'R_InitBloomScreenTexture' too high resolution for light bloom, effect disabled\n" );
- return;
+ // make sure we don't go off limits
+ if( screen_texture_width > glConfig.maxTextureSize || screen_texture_height > glConfig.maxTextureSize ) {
+ screen_texture_width = glConfig.maxTextureSize;
+ screen_texture_height = glConfig.maxTextureSize;
}
// init the screen texture
Modified: trunk/qfusion/source/ref_gl/r_register.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_register.c 2007-12-03 15:53:38 UTC (rev 785)
+++ trunk/qfusion/source/ref_gl/r_register.c 2007-12-03 18:42:41 UTC (rev 786)
@@ -546,7 +546,7 @@
r_bloom_diamond_size = Cvar_Get( "r_bloom_diamond_size", "8", CVAR_ARCHIVE );
r_bloom_intensity = Cvar_Get( "r_bloom_intensity", "1.3", CVAR_ARCHIVE );
r_bloom_darken = Cvar_Get( "r_bloom_darken", "4", CVAR_ARCHIVE );
- r_bloom_sample_size = Cvar_Get( "r_bloom_sample_size", "128", CVAR_ARCHIVE|CVAR_LATCH_VIDEO );
+ r_bloom_sample_size = Cvar_Get( "r_bloom_sample_size", "320", CVAR_ARCHIVE|CVAR_LATCH_VIDEO );
r_bloom_fast_sample = Cvar_Get( "r_bloom_fast_sample", "0", CVAR_ARCHIVE|CVAR_LATCH_VIDEO );
r_environment_color = Cvar_Get( "r_environment_color", "0 0 0", CVAR_ARCHIVE );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: qfusion s. c. <l33...@li...> - 2007-12-02 23:49:48
|
Revision: 784
http://l33t.svn.sourceforge.net/l33t/?rev=784&view=rev
Author: digiman
Date: 2007-12-02 15:49:45 -0800 (Sun, 02 Dec 2007)
Log Message:
-----------
Default texture compression to off
Modified Paths:
--------------
trunk/qfusion/source/ref_gl/r_register.c
Modified: trunk/qfusion/source/ref_gl/r_register.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_register.c 2007-12-02 22:50:36 UTC (rev 783)
+++ trunk/qfusion/source/ref_gl/r_register.c 2007-12-02 23:49:45 UTC (rev 784)
@@ -225,7 +225,7 @@
,GL_EXTENSION( ARB, texture_env_add, NULL )
,GL_EXTENSION( ARB, texture_env_combine, NULL )
,GL_EXTENSION( EXT, texture_env_combine, NULL )
- ,GL_EXTENSION( ARB, texture_compression, NULL )
+ ,GL_EXTENSION_EXT( ARB, texture_compression, 0, NULL, _extMarker )
,GL_EXTENSION( EXT, texture_edge_clamp, NULL )
,GL_EXTENSION( SGIS, texture_edge_clamp, NULL )
,GL_EXTENSION( EXT, texture_filter_anisotropic, NULL )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|