From 1ceb43f609ef41cc1afbcc953d082186d317cea7 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Wed, 11 Apr 2007 12:08:10 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@956 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/model.h | 2 -- source/src/vertmodel.h | 81 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 76 insertions(+), 7 deletions(-) diff --git a/source/src/model.h b/source/src/model.h index b6589ebe..07c1cec6 100644 --- a/source/src/model.h +++ b/source/src/model.h @@ -39,8 +39,6 @@ struct model virtual void genshadows(float height, float rad) {} virtual void rendershadow(int anim, int varseed, float speed, int basetime, const vec &o, float yaw, model *vwepmdl = NULL) {} virtual bool hasshadows() { return false; } - - virtual char *shadowfile() { return NULL; } }; struct mapmodelinfo { int rad, h, zoff; string name; model *m; }; diff --git a/source/src/vertmodel.h b/source/src/vertmodel.h index f5c626ec..b189dc8a 100644 --- a/source/src/vertmodel.h +++ b/source/src/vertmodel.h @@ -1,5 +1,6 @@ VARP(dynshadowsize, 4, 5, 8); VARP(aadynshadow, 0, 3, 4); +VARP(saveshadows, 0, 1, 1); struct vertmodel : model { @@ -189,7 +190,7 @@ struct vertmodel : model struct part { - bool loaded; + char *filename; vertmodel *model; int index, numframes; vector meshes; @@ -200,9 +201,10 @@ struct vertmodel : model GLuint *shadows; float shadowrad; - part() : loaded(false), anims(NULL), links(NULL), tags(NULL), numtags(0), shadows(NULL), shadowrad(0) {} + part() : filename(NULL), anims(NULL), links(NULL), tags(NULL), numtags(0), shadows(NULL), shadowrad(0) {} virtual ~part() { + DELETEA(filename); meshes.deletecontentsp(); DELETEA(anims); DELETEA(links); @@ -390,7 +392,7 @@ struct vertmodel : model { } - void genshadow(int aasize, int frame) + void genshadow(int aasize, int frame, FILE *f) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -408,13 +410,25 @@ struct vertmodel : model #endif if(aasize > 1< scr_w || aasize > scr_h) aasize /= 2; + FILE *f = filename ? fopen(filename, "wb") : NULL; + if(f) + { + shadowhdr hdr; + hdr.size = min(aasize, 1<