Adds r_parallaxskyclamping and r_parallaxskypanning.

git-svn-id: https://svn.eduke32.com/eduke32@623 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2008-02-18 08:46:42 +00:00
parent c45bd7dd53
commit e67e3dc8fc
5 changed files with 41 additions and 15 deletions

View file

@ -203,19 +203,19 @@ $(OBJ)/%.$o: $(SRC)/%.nasm
$(AS) $(ASFLAGS) $< -o $@
$(OBJ)/%.$o: $(SRC)/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@
$(OBJ)/%.$o: $(SRC)/%.cpp
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@
$(OBJ)/%.$o: $(SRC)/misc/%.rc
$(RC) -i $< -o $@ --include-dir=$(INC) --include-dir=$(SRC)
$(OBJ)/%.$o: $(SRC)/util/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@
$(OBJ)/%.$o: $(RSRC)/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@
$(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c
echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@

View file

@ -526,6 +526,8 @@ extern int r_vertexarrays;
extern int r_vbos;
extern int r_vbocount;
extern int r_animsmoothing;
extern int r_parallaxskyclamping;
extern int r_parallaxskypanning;
extern int mdtims, omdtims;
#endif

View file

@ -169,6 +169,10 @@ int r_vbocount = 64;
// model animation smoothing cvar
int r_animsmoothing = 1;
// polymost ART sky control
int r_parallaxskyclamping = 1;
int r_parallaxskypanning = 0;
static float fogresult, fogcol[4];
// making this a macro should speed things up at the expense of code size
@ -3035,7 +3039,7 @@ static void polymost_drawalls(int bunch)
//Use clamping for tiled sky textures
for (i=(1<<pskybits)-1;i>0;i--)
if (pskyoff[i] != pskyoff[i-1])
{ skyclamphack = 0; break; }
{ skyclamphack = r_parallaxskyclamping; break; }
}
#endif
if (bpp == 8 || !usehightile || !hicfindsubst(globalpicnum,globalpal,1))
@ -3045,7 +3049,7 @@ static void polymost_drawalls(int bunch)
vv[1] = dd[0]*((double)xdimscale*(double)viewingrange)/(65536.0*65536.0);
vv[0] = dd[0]*((double)((tilesizy[globalpicnum]>>1)+parallaxyoffs)) - vv[1]*ghoriz;
i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesizy[globalpicnum]) i += i;
vv[0] += dd[0]*((double)sec->floorypanning)*((double)i)/256.0;
vv[0] += dd[0]*((double)((r_parallaxskypanning)?sec->floorypanning:0))*((double)i)/256.0;
//Hack to draw black rectangle below sky when looking down...
@ -3081,7 +3085,7 @@ static void polymost_drawalls(int bunch)
do
{
globalpicnum = pskyoff[y&((1<<pskybits)-1)]+i;
guo = gdo*(t*((double)(globalang-(y<<(11-pskybits))))/2048.0 + (double)sec->floorxpanning) - gux*ghalfx;
guo = gdo*(t*((double)(globalang-(y<<(11-pskybits))))/2048.0 + (double)((r_parallaxskypanning)?sec->floorxpanning:0)) - gux*ghalfx;
y++;
ox = fx; fx = ((double)((y<<(11-pskybits))-globalang))*oz+ghalfx;
if (fx > x1) { fx = x1; i = -1; }
@ -3408,7 +3412,7 @@ static void polymost_drawalls(int bunch)
//Use clamping for tiled sky textures
for (i=(1<<pskybits)-1;i>0;i--)
if (pskyoff[i] != pskyoff[i-1])
{ skyclamphack = 0; break; }
{ skyclamphack = r_parallaxskyclamping; break; }
}
#endif
//Parallaxing sky...
@ -3420,7 +3424,7 @@ static void polymost_drawalls(int bunch)
vv[1] = dd[0]*((double)xdimscale*(double)viewingrange)/(65536.0*65536.0);
vv[0] = dd[0]*((double)((tilesizy[globalpicnum]>>1)+parallaxyoffs)) - vv[1]*ghoriz;
i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesizy[globalpicnum]) i += i;
vv[0] += dd[0]*((double)sec->ceilingypanning)*((double)i)/256.0;
vv[0] += dd[0]*((double)((r_parallaxskypanning)?sec->ceilingypanning:0))*((double)i)/256.0;
//Hack to draw black rectangle below sky when looking down...
gdx = 0; gdy = gxyaspect / -262144.0; gdo = -ghoriz*gdy;
@ -3454,7 +3458,7 @@ static void polymost_drawalls(int bunch)
do
{
globalpicnum = pskyoff[y&((1<<pskybits)-1)]+i;
guo = gdo*(t*((double)(globalang-(y<<(11-pskybits))))/2048.0 + (double)sec->ceilingxpanning) - gux*ghalfx;
guo = gdo*(t*((double)(globalang-(y<<(11-pskybits))))/2048.0 + (double)((r_parallaxskypanning)?sec->ceilingxpanning:0)) - gux*ghalfx;
y++;
ox = fx; fx = ((double)((y<<(11-pskybits))-globalang))*oz+ghalfx;
if (fx > x1) { fx = x1; i = -1; }
@ -5703,6 +5707,18 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm)
else r_animsmoothing = (val != 0);
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "r_parallaxskyclamping"))
{
if (showval) { OSD_Printf("r_parallaxskyclamping is %d\n", r_parallaxskyclamping); }
else r_parallaxskyclamping = (val != 0);
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "r_parallaxskypanning"))
{
if (showval) { OSD_Printf("r_parallaxskypanning is %d\n", r_parallaxskypanning); }
else r_parallaxskypanning = (val != 0);
return OSDCMD_OK;
}
else if (!Bstrcasecmp(parm->name, "glpolygonmode"))
{
if (showval) { OSD_Printf("glpolygonmode is %d\n", glpolygonmode); }
@ -5801,6 +5817,8 @@ void polymost_initosdfuncs(void)
OSD_RegisterFunction("r_vbos","r_vbos: enable/disable using Vertex Buffer Objects when drawing models",osdcmd_polymostvars);
OSD_RegisterFunction("r_vbocount","r_vbocount: sets the number of Vertex Buffer Objects to use when drawing models",osdcmd_polymostvars);
OSD_RegisterFunction("r_animsmoothing","r_animsmoothing: enable/disable model animation smoothing",osdcmd_polymostvars);
OSD_RegisterFunction("r_parallaxskyclamping","r_parallaxskyclamping: enable/disable parallaxed floor/ceiling sky texture clamping",osdcmd_polymostvars);
OSD_RegisterFunction("r_parallaxskypanning","r_parallaxskypanning: enable/disable parallaxed floor/ceiling panning when drawing a parallaxed sky",osdcmd_polymostvars);
#endif
OSD_RegisterFunction("usemodels","usemodels: enable/disable model rendering in >8-bit mode",osdcmd_polymostvars);
OSD_RegisterFunction("usehightile","usehightile: enable/disable hightile texture rendering in >8-bit mode",osdcmd_polymostvars);

View file

@ -220,19 +220,19 @@ $(OBJ)/%.$o: $(SRC)/jaudiolib/%.nasm
nasm $(NASMFLAGS) $< -o $@
$(OBJ)/%.$o: $(SRC)/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@
$(OBJ)/%.$o: $(SRC)/%.cpp
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@
$(OBJ)/%.$o: $(SRC)/jmact/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@
$(OBJ)/%.$o: $(SRC)/jaudiolib/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@
$(OBJ)/%.$o: $(SRC)/misc/%.rc
windres -i $< -o $@ --include-dir=$(EINC) --include-dir=$(SRC)
$(OBJ)/%.$o: $(SRC)/util/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@
$(OBJ)/%.$o: $(RSRC)/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1

View file

@ -639,6 +639,9 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing", &r_animsmoothing);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping", &r_parallaxskyclamping);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning", &r_parallaxskypanning);
dummy = usemodels;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseModels",&dummy);
usemodels = dummy != 0;
@ -810,6 +813,9 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", r_vbocount,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing",r_animsmoothing,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping",r_parallaxskyclamping,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning",r_parallaxskypanning,false,false);
#endif
#ifdef RENDERTYPEWIN
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq",maxrefreshfreq,false,false);