From d37b2da593ee0d254069ae1ead26fb8e10477ac6 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Mon, 2 May 2011 20:30:14 +0000 Subject: [PATCH] - Add licence headers to new files - Add patch from Zack Middleton which fixes a few issues still --- code/renderer/iqm.h | 20 ++++++++++++++++++++ code/renderer/tr_animation.c | 2 +- code/renderer/tr_main.c | 4 ++-- code/renderer/tr_mesh.c | 6 ++---- code/renderer/tr_model.c | 24 ++++++++++++------------ code/renderer/tr_model_iqm.c | 32 ++++++++++++++++++++++++++++---- 6 files changed, 65 insertions(+), 23 deletions(-) diff --git a/code/renderer/iqm.h b/code/renderer/iqm.h index bbfc053f..f9ac3c83 100644 --- a/code/renderer/iqm.h +++ b/code/renderer/iqm.h @@ -1,3 +1,23 @@ +/* +=========================================================================== +This file is part of Quake III Arena source code. + +Quake III Arena source code 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. + +Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +=========================================================================== +*/ + #ifndef __IQM_H__ #define __IQM_H__ diff --git a/code/renderer/tr_animation.c b/code/renderer/tr_animation.c index 93b9fd31..c123e9ef 100644 --- a/code/renderer/tr_animation.c +++ b/code/renderer/tr_animation.c @@ -326,7 +326,7 @@ void R_MDRAddAnimSurfaces( trRefEntity_t *ent ) { int cull; qboolean personalModel; - header = (mdrHeader_t *) tr.currentModel->md4; + header = (mdrHeader_t *) tr.currentModel->modelData; personalModel = (ent->e.renderfx & RF_THIRD_PERSON) && !tr.viewParms.isPortal; diff --git a/code/renderer/tr_main.c b/code/renderer/tr_main.c index 064f7522..4ea6bfb7 100644 --- a/code/renderer/tr_main.c +++ b/code/renderer/tr_main.c @@ -1260,8 +1260,8 @@ void R_AddEntitySurfaces (void) { break; #endif case MOD_IQM: - R_AddIQMSurfaces( ent ); - break; + R_AddIQMSurfaces( ent ); + break; case MOD_BRUSH: R_AddBrushModelSurfaces( ent ); break; diff --git a/code/renderer/tr_mesh.c b/code/renderer/tr_mesh.c index 9b60348b..fcc82364 100644 --- a/code/renderer/tr_mesh.c +++ b/code/renderer/tr_mesh.c @@ -185,12 +185,10 @@ int R_ComputeLOD( trRefEntity_t *ent ) { // and use that as a criteria for selecting LOD #ifdef RAVENMD4 - // This is an MDR model. - - if(tr.currentModel->md4) + if(tr.currentModel->type == MOD_MDR) { int frameSize; - mdr = (mdrHeader_t *) tr.currentModel->md4; + mdr = (mdrHeader_t *) tr.currentModel->modelData; frameSize = (size_t) (&((mdrFrame_t *)0)->bones[mdr->numBones]); mdrframe = (mdrFrame_t *) ((byte *) mdr + mdr->ofsFrames + frameSize * ent->e.frame); diff --git a/code/renderer/tr_model.c b/code/renderer/tr_model.c index e4953864..a082733d 100644 --- a/code/renderer/tr_model.c +++ b/code/renderer/tr_model.c @@ -81,7 +81,7 @@ qhandle_t R_RegisterMD3(const char *name, model_t *mod) if (ident == MD3_IDENT) loaded = R_LoadMD3(mod, lod, buf.u, name); else - ri.Printf(PRINT_WARNING,"RE_RegisterMD3: unknown fileid for %s\n", name); + ri.Printf(PRINT_WARNING,"R_RegisterMD3: unknown fileid for %s\n", name); } ri.FS_FreeFile(buf.v); @@ -109,7 +109,7 @@ qhandle_t R_RegisterMD3(const char *name, model_t *mod) } #ifdef _DEBUG - ri.Printf(PRINT_WARNING,"RE_RegisterMD3: couldn't load %s\n", name); + ri.Printf(PRINT_WARNING,"R_RegisterMD3: couldn't load %s\n", name); #endif mod->type = MOD_BAD; @@ -147,7 +147,7 @@ qhandle_t R_RegisterMDR(const char *name, model_t *mod) if(!loaded) { - ri.Printf(PRINT_WARNING,"RE_RegisterMDR: couldn't load mdr file %s\n", name); + ri.Printf(PRINT_WARNING,"R_RegisterMDR: couldn't load mdr file %s\n", name); mod->type = MOD_BAD; return 0; } @@ -183,7 +183,7 @@ qhandle_t R_RegisterIQM(const char *name, model_t *mod) if(!loaded) { - ri.Printf(PRINT_WARNING,"RE_RegisterIQM: couldn't load mdr file %s\n", name); + ri.Printf(PRINT_WARNING,"R_RegisterIQM: couldn't load iqm file %s\n", name); mod->type = MOD_BAD; return 0; } @@ -202,12 +202,12 @@ typedef struct // when there are multiple models of different formats available static modelExtToLoaderMap_t modelLoaders[ ] = { + { "iqm", R_RegisterIQM }, #ifdef RAVENMD4 { "mdr", R_RegisterMDR }, #endif { "md4", R_RegisterMD3 }, - { "md3", R_RegisterMD3 }, - { "iqm", R_RegisterIQM } + { "md3", R_RegisterMD3 } }; static int numModelLoaders = ARRAY_LEN(modelLoaders); @@ -546,7 +546,7 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char { int i, j, k, l; mdrHeader_t *pinmodel, *mdr; - mdrFrame_t *frame; + mdrFrame_t *frame; mdrLOD_t *lod, *curlod; mdrSurface_t *surf, *cursurf; mdrTriangle_t *tri, *curtri; @@ -598,7 +598,7 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char } mod->dataSize += size; - mod->md4 = mdr = ri.Hunk_Alloc( size, h_low ); + mod->modelData = mdr = ri.Hunk_Alloc( size, h_low ); // Copy all the values over from the file and fix endian issues in the process, if necessary. @@ -1207,10 +1207,10 @@ int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFram } else #endif - if( model->type == MOD_IQM ) { - return R_IQMLerpTag( tag, model->modelData, - startFrame, endFrame, - frac, tagName ); + if( model->type == MOD_IQM ) { + return R_IQMLerpTag( tag, model->modelData, + startFrame, endFrame, + frac, tagName ); } else { AxisClear( tag->axis ); diff --git a/code/renderer/tr_model_iqm.c b/code/renderer/tr_model_iqm.c index 2a0b1aad..0a615f46 100644 --- a/code/renderer/tr_model_iqm.c +++ b/code/renderer/tr_model_iqm.c @@ -1,4 +1,25 @@ -/* copyright */ +/* +=========================================================================== +Copyright (C) 2011 Thilo Schulz +Copyright (C) 2011 Matthias Bentrup + +This file is part of Quake III Arena source code. + +Quake III Arena source code 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. + +Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +=========================================================================== +*/ #include "tr_local.h" @@ -50,8 +71,9 @@ static void InterpolateMatrix( float *a, float *b, float lerp, float *mat ) { /* ================= R_LoadIQM -================= + Load an IQM model and compute the joint matrices for every frame. +================= */ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_name ) { iqmHeader_t *header; @@ -628,8 +650,9 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na /* ================= R_AddIQMSurfaces -================= + Add all surfaces of this model +================= */ void R_AddIQMSurfaces( trRefEntity_t *ent ) { iqmData_t *data; @@ -689,8 +712,9 @@ static void ComputeJointMats( iqmData_t *data, int frame, int oldframe, /* ================= RB_AddIQMSurfaces -================= + Compute vertices for this model surface +================= */ void RB_IQMSurfaceAnim( surfaceType_t *surface ) { srfIQModel_t *surf = (srfIQModel_t *)surface;