transparency test (old stuff from 2008)

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7192 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Alejandro V. Garcia
2013-02-13 13:26:12 +00:00
parent 9c9d5be91a
commit a0640ddeed
4 changed files with 19 additions and 7 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ context_mdlcfg = 4 // mdl configs, same
// set allowed commands for the map config context
mapcfgidents = [ loadnotexture loadsky mapmodelreset mapmodel texturereset texture fog fogcolour mapsoundreset mapsound watercolour shadowyaw ]
mdlcfgidents = [ md2anim md2emit md2tag md3anim md3emit md3link md3load md3skin mdlalphatest mdlcachelimit mdlcullface mdlscale mdlshadowdist mdltrans mdltranslucent mdlvertexlight]
mdlcfgidents = [ md2anim md2emit md2tag md3anim md3emit md3link md3load md3skin mdlalphatest mdlalphablend mdlcachelimit mdlcullface mdlscale mdlshadowdist mdltrans mdltranslucent mdlvertexlight]
loop i (listlen $mapcfgidents) [ scriptcontext $context_mapcfg (at $mapcfgidents $i) ]
loop i (listlen $mdlcfgidents) [ scriptcontext $context_mdlcfg (at $mdlcfgidents $i) ]
@@ -10,3 +10,4 @@ mdlalphablend 1
mdltranslucent 100
//mdlalphatest 30
//mdlalphatexture 1
+4 -3
View File
@@ -41,12 +41,13 @@ class dynent;
struct model
{
bool cullface, vertexlight;
bool cullface, vertexlight, alphablend; //ALX Alpha channel models
float alphatest, translucency, scale, radius, shadowdist;
vec translate;
int cachelimit, batch;
model() : cullface(true), vertexlight(false), alphatest(0.9f), translucency(0.25f), scale(1), radius(0), shadowdist(0), translate(0, 0, 0), cachelimit(8), batch(-1) {}
//model() : cullface(true), vertexlight(false), alphatest(0.9f), translucency(0.25f), scale(1), radius(0), shadowdist(0), translate(0, 0, 0), cachelimit(8), batch(-1) {}
model() : cullface(true), vertexlight(false), alphablend(false), alphatest(0.9f), translucency(0.25f), scale(1), radius(0), shadowdist(0), translate(0, 0, 0), cachelimit(8), batch(-1) {}
virtual ~model() {}
virtual bool load() = 0;
+13 -3
View File
@@ -44,6 +44,13 @@ void mdlalphatest(int *alphatest)
COMMAND(mdlalphatest, "i");
void mdlalphablend(int *alphablend) //ALX Alpha channel models
{
checkmdl;
loadingmodel->alphablend = *alphablend!=0;
}
COMMAND(mdlalphablend, "i");
void mdlscale(int *percent)
{
checkmdl;
@@ -219,7 +226,8 @@ void renderbatchedmodel(model *m, batchedmodel &b)
m->setskin(b.tex);
if(b.anim&ANIM_TRANSLUCENT)
//if(b.anim&ANIM_TRANSLUCENT)
if(b.anim&ANIM_TRANSLUCENT || m->alphablend) //ALX Alpha channel models
{
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
m->render(b.anim|ANIM_NOSKIN, b.varseed, b.speed, b.basetime, b.o, b.yaw, b.pitch, b.d, a, b.scale);
@@ -236,7 +244,8 @@ void renderbatchedmodel(model *m, batchedmodel &b)
m->render(b.anim, b.varseed, b.speed, b.basetime, b.o, b.yaw, b.pitch, b.d, a, b.scale);
if(b.anim&ANIM_TRANSLUCENT)
//if(b.anim&ANIM_TRANSLUCENT)
if(b.anim&ANIM_TRANSLUCENT || m->alphablend) //ALX Alpha channel models
{
glDepthFunc(GL_LESS);
glDisable(GL_BLEND);
@@ -304,7 +313,8 @@ void endmodelbatches(bool flush)
loopvj(b.batched)
{
batchedmodel &bm = b.batched[j];
if(bm.anim&ANIM_TRANSLUCENT)
//if(bm.anim&ANIM_TRANSLUCENT)
if(bm.anim&ANIM_TRANSLUCENT || b.m->alphablend) //ALX Alpha channel models
{
translucentmodel &tm = translucent.add();
tm.m = b.m;