From 61c127abc0a7668ead9890e6667e80edab961ac0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 22 Jan 2012 15:48:32 +0900 Subject: [PATCH] Make a start on skin support. I had this lying around for a while since it was more important to get other things working first. --- libs/video/renderer/glsl/Makefile.am | 2 +- libs/video/renderer/glsl/glsl_alias.c | 14 ++++-- libs/video/renderer/glsl/glsl_main.c | 32 ------------ libs/video/renderer/glsl/glsl_skin.c | 70 +++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 36 deletions(-) create mode 100644 libs/video/renderer/glsl/glsl_skin.c diff --git a/libs/video/renderer/glsl/Makefile.am b/libs/video/renderer/glsl/Makefile.am index 6c89c3272..851ed86ea 100644 --- a/libs/video/renderer/glsl/Makefile.am +++ b/libs/video/renderer/glsl/Makefile.am @@ -15,7 +15,7 @@ shader_gen= \ glsl_src = \ glsl_alias.c glsl_bsp.c glsl_draw.c glsl_lightmap.c glsl_main.c \ - glsl_particles.c glsl_screen.c glsl_sprite.c glsl_textures.c + glsl_particles.c glsl_screen.c glsl_skin.c glsl_sprite.c glsl_textures.c if BUILD_GLSL noinst_LTLIBRARIES= libglsl.la diff --git a/libs/video/renderer/glsl/glsl_alias.c b/libs/video/renderer/glsl/glsl_alias.c index c276c2817..b63c81ad7 100644 --- a/libs/video/renderer/glsl/glsl_alias.c +++ b/libs/video/renderer/glsl/glsl_alias.c @@ -42,6 +42,7 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$"; #include #include "QF/render.h" +#include "QF/skin.h" #include "QF/GLSL/defines.h" #include "QF/GLSL/funcs.h" @@ -201,7 +202,7 @@ R_DrawAlias (void) aliashdr_t *hdr; vec_t norm_mat[9]; mat4_t mvp_mat; - maliasskindesc_t *skin; + int skin_tex; aliasvrt_t *pose1 = 0; // VBO's are null based aliasvrt_t *pose2 = 0; // VBO's are null based @@ -225,7 +226,14 @@ R_DrawAlias (void) Mat4Mult (ent->transform, mvp_mat, mvp_mat); Mat4Mult (alias_vp, mvp_mat, mvp_mat); - skin = R_AliasGetSkindesc (ent->skinnum, hdr); + if (ent->skin) { + skin_t *skin = ent->skin; + skin_tex = skin->texture; + } else { + maliasskindesc_t *skindesc; + skindesc = R_AliasGetSkindesc (ent->skinnum, hdr); + skin_tex = skindesc->texnum; + } blend = R_AliasGetLerpedFrames (ent, hdr); pose1 += ent->pose1 * hdr->poseverts; @@ -234,7 +242,7 @@ R_DrawAlias (void) skin_size[0] = hdr->mdl.skinwidth; skin_size[1] = hdr->mdl.skinheight; - qfglBindTexture (GL_TEXTURE_2D, skin->texnum); + qfglBindTexture (GL_TEXTURE_2D, skin_tex); #ifndef TETRAHEDRON qfglBindBuffer (GL_ARRAY_BUFFER, hdr->posedata); diff --git a/libs/video/renderer/glsl/glsl_main.c b/libs/video/renderer/glsl/glsl_main.c index f161d5ee4..ece38d4c3 100644 --- a/libs/video/renderer/glsl/glsl_main.c +++ b/libs/video/renderer/glsl/glsl_main.c @@ -44,7 +44,6 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$"; #include "QF/image.h" #include "QF/render.h" #include "QF/screen.h" -#include "QF/skin.h" #include "QF/sys.h" #include "QF/GLSL/defines.h" @@ -259,37 +258,6 @@ Fog_ParseWorldspawn (struct plitem_s *worldspawn) { } -VISIBLE void -Skin_Player_Model (model_t *model) -{ -} - -VISIBLE void -Skin_Set_Translate (int top, int bottom, void *_dest) -{ -} - -VISIBLE void -Skin_Do_Translation (skin_t *player_skin, int slot, skin_t *skin) -{ -} - -VISIBLE void -Skin_Do_Translation_Model (struct model_s *model, int skinnum, int slot, - skin_t *skin) -{ -} - -VISIBLE void -Skin_Process (skin_t *skin, struct tex_s * tex) -{ -} - -VISIBLE void -Skin_Init_Translation (void) -{ -} - VISIBLE void R_LineGraph (int x, int y, int *h_vals, int count) { diff --git a/libs/video/renderer/glsl/glsl_skin.c b/libs/video/renderer/glsl/glsl_skin.c new file mode 100644 index 000000000..9e70a13cd --- /dev/null +++ b/libs/video/renderer/glsl/glsl_skin.c @@ -0,0 +1,70 @@ +/* + glsl_skin.c + + GLSL rendering + + Copyright (C) 2012 Bill Currie + + Author: Bill Currie + Date: 2012/1/13 + + 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: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + +*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +static __attribute__ ((used)) const char rcsid[] = "$Id$"; + +#include "QF/image.h" +#include "QF/model.h" +#include "QF/skin.h" + +VISIBLE void +Skin_Player_Model (model_t *model) +{ +} + +VISIBLE void +Skin_Set_Translate (int top, int bottom, void *_dest) +{ +} + +VISIBLE void +Skin_Do_Translation (skin_t *player_skin, int slot, skin_t *skin) +{ +} + +VISIBLE void +Skin_Do_Translation_Model (model_t *model, int skinnum, int slot, + skin_t *skin) +{ +} + +VISIBLE void +Skin_Process (skin_t *skin, tex_t *tex) +{ +} + +VISIBLE void +Skin_Init_Translation (void) +{ +} +