added support for ambient/diffuse/specular scale properties on rtlights.

attempting to fix up the avi code for mingw weirdness.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3947 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2012-01-01 11:22:24 +00:00
parent 3b3d08542a
commit 1e621416ce
14 changed files with 130 additions and 55 deletions

View file

@ -369,23 +369,14 @@ CLIENT_OBJS = \
GLQUAKE_OBJS = \
gl_draw.o \
gl_model.o \
gl_ngraph.o \
gl_backend.o \
gl_rlight.o \
gl_rmain.o \
gl_rmisc.o \
gl_font.o \
gl_heightmap.o \
gl_rsurf.o \
r_surf.o \
ltface.o \
r_2d.o \
gl_screen.o \
gl_bloom.o \
gl_shadow.o \
gl_shader.o \
gl_warp.o \
gl_vidcommon.o \
gl_hlmdl.o
@ -399,6 +390,7 @@ D3DONLY_OBJS = \
gl_font.o \
gl_model.o \
gl_shader.o \
gl_shadow.o \
gl_rlight.o \
gl_warp.o \
ltface.o \
@ -503,7 +495,7 @@ COMMON_OBJS = \
q2pmove.o
#the defaults for sdl come first
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o
GL_EXE_NAME=../fteqw_sdl.gl$(BITS)
GLCL_EXE_NAME=../fteqwcl_sdl.gl$(BITS)
ifdef windir
@ -525,7 +517,7 @@ MINGL_EXE_NAME=../fteqw_sdl.mingl$(BITS)
MB_DIR=m_sdl$(FTE_TARGET)$(BITS)
M_EXE_NAME=../fteqw_sdl$(BITS)
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o
M_CFLAGS=$(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS)
@ -548,7 +540,7 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win(32|64)_sdl$$"),)
endif
#the defaults for sdl come first
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
GL_EXE_NAME=../fteqw_sdl_gl$(BITS).exe
GLCL_EXE_NAME=../fteqwcl_sdl$(BITS).exe
ifdef windir
@ -575,7 +567,7 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win(32|64)_sdl$$"),)
MB_DIR=m_mgw_sdl$(BITS)
M_EXE_NAME=../fteqw_sdl$(BITS).exe
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
M_CFLAGS=$(D3DCFLAGS) -D_SDL -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL $(DX7SDK)
ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win32.*sdl"),)
@ -591,7 +583,7 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -i -v "win(32|64)_sdl$$"),)
M_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(MINGW_LIBS_DIR)/libSDL.a $(MINGW_LIBS_DIR)/libSDLmain.a -mwindows -ldxguid -lwinmm -lole32 $(MLDFLAGS) `sdl-config --libs` $(IMAGELDFLAGS)
endif
D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DONLY_OBJS) $(LTO_END) resources.o $(LTO_START)
D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END) resources.o $(LTO_START)
D3D_EXE_NAME=../fted3d_sdl_qw$(BITS).exe
D3DCL_EXE_NAME=../fted3d_sdl_clqw$(BITS).exe
D3D_LDFLAGS=$(IMAGELDFLAGS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32
@ -628,7 +620,7 @@ ifeq ($(FTE_TARGET),vc)
SV_LDFLAGS=/subsystem:console
M_EXE_NAME=../fteqw.exe
MCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o
MCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o
M_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS)
MB_DIR=m_vc
M_LDFLAGS=$(GLLDFLAGS) libs/jpeg.lib libs/libpng.lib libs/zlib.lib uuid.lib gdi32.lib ole32.lib /subsystem:windows
@ -656,7 +648,7 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -v "win(32|64)$$"),)
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(WINDOWSSERVERONLY_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START)
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START)
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START)
GL_EXE_NAME=../fteglqw$(BITS).exe
GLCL_EXE_NAME=../fteglqwcl$(BITS).exe
GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
@ -664,7 +656,7 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -v "win(32|64)$$"),)
GLB_DIR=gl_mgw$(BITS)
GLCL_DIR=glcl_mgw$(BITS)
NPFTECL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_npfte.o sys_axfte.o sys_plugfte.o $(LTO_END) npplug.o ../../ftequake/npapi.def $(LTO_START)
NPFTECL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_npfte.o sys_axfte.o sys_plugfte.o $(LTO_END) npplug.o ../../ftequake/npapi.def $(LTO_START)
NPFTE_DLL_NAME=../npfte$(BITS).dll
NPFTECL_DLL_NAME=../npftecl$(BITS).dll
NPFTE_LDFLAGS=-Wl,--enable-stdcall-fixup $(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -loleaut32 -luuid -lstdc++ -shared
@ -672,7 +664,7 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -v "win(32|64)$$"),)
NPFTEB_DIR=npfte_mgw$(BITS)
NPFTECL_DIR=npqtvcl_mgw$(BITS)
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(LTO_END) resources.o $(LTO_START)
M_EXE_NAME=../fteqw$(BITS).exe
MCL_EXE_NAME=../fteqwcl$(BITS).exe
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
@ -680,7 +672,7 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -E -v "win(32|64)$$"),)
MB_DIR=m_mgw$(BITS)
MCL_DIR=mcl_mgw$(BITS)
D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(D3DONLY_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START)
D3DCL_OBJS=$(D3DQUAKE_OBJS) snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o $(D3DGL_OBJS) fs_win32.o $(LTO_END) resources.o $(LTO_START)
D3D_EXE_NAME=../fted3dqw$(BITS).exe
D3DCL_EXE_NAME=../fted3dclqw$(BITS).exe
D3D_LDFLAGS=$(IMAGELDFLAGS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32
@ -699,7 +691,7 @@ ifeq ($(FTE_TARGET),bsd)
SV_DIR=sv_linux
SV_LDFLAGS=-lz -ldl
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
GL_EXE_NAME=../fteqw.gl
GLCL_EXE_NAME=../fteqwcl.gl
GL_LDFLAGS= -L/usr/local/lib $(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lpthread
@ -707,7 +699,7 @@ ifeq ($(FTE_TARGET),bsd)
GLB_DIR=gl_bsd
GLCL_DIR=glcl_bsd
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
M_EXE_NAME=../fteqw
MCL_EXE_NAME=../fteqwcl
M_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lpthread
@ -724,7 +716,7 @@ ifneq ($(shell echo $(FTE_TARGET)|grep linux),)
SV_LDFLAGS=-lz
SV_EXE_NAME=../fteqw.sv$(BITS)
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_alsa.o snd_linux.o cd_linux.o sys_linux.o
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_alsa.o snd_linux.o cd_linux.o sys_linux.o
GL_EXE_NAME=../fteqw.gl$(BITS)
GLCL_EXE_NAME=../fteqwcl.gl$(BITS)
GL_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lXxf86dga
@ -732,7 +724,7 @@ ifneq ($(shell echo $(FTE_TARGET)|grep linux),)
GLB_DIR=gl_linux$(BITS)
GLCL_DIR=glcl_linux$(BITS)
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o snd_alsa.o cd_linux.o sys_linux.o
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o snd_alsa.o cd_linux.o sys_linux.o
M_EXE_NAME=../fteqw$(BITS)
MCL_EXE_NAME=../fteqwcl$(BITS)
M_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS) -lXxf86vm -lXxf86dga
@ -764,7 +756,7 @@ ifneq ($(shell echo $(FTE_TARGET)|grep macosx),)
endif
GL_LDFLAGS=-framework AGL -framework OpenGL -framework Cocoa -framework AudioUnit -lz -lpng -ljpeg
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidcocoa.mo gl_vidmacos.o sys_linux.o in_macos.o cd_null.o snd_macos.o
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidcocoa.mo gl_vidmacos.o sys_linux.o in_macos.o cd_null.o snd_macos.o
GL_EXE_NAME=../macosx_fteqw.gl$(EXTENSION)$(BITS)
GLCL_EXE_NAME=../macosx_fteqwcl.gl$(EXTENSION)$(BITS)
@ -788,7 +780,7 @@ ifeq ($(FTE_TARGET),morphos)
SV_DIR=sv_morphos
SV_LDFLAGS=-ldl -lz
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidmorphos.o in_morphos.o snd_morphos.o cd_null.o sys_morphos.o
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidmorphos.o in_morphos.o snd_morphos.o cd_null.o sys_morphos.o
GL_EXE_NAME=../morphos_fteqw.gl
GLCL_EXE_NAME=../morphos_fteqwcl.gl
GL_LDFLAGS=$(GLLDFLAGS) -ldl $(IMAGELDFLAGS) -lz
@ -796,7 +788,7 @@ ifeq ($(FTE_TARGET),morphos)
GLB_DIR=gl_morphos
GLCL_DIR=glcl_morphos
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidmorphos.o vid_morphos.o in_morphos.o snd_morphos.o cd_null.o sys_morphos.o
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidmorphos.o vid_morphos.o in_morphos.o snd_morphos.o cd_null.o sys_morphos.o
M_EXE_NAME=../morphos_fteqw
MCL_EXE_NAME=../morphos_fteqwcl
M_LDFLAGS=$(GLLDFLAGS)
@ -822,7 +814,7 @@ ifeq ($(FTE_TARGET),cygwin)
SV_DIR=sv_cygwin
SV_LDFLAGS=-lz
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
GL_EXE_NAME=../fteqwglcyg.exe
GLCL_EXE_NAME=../fteqwclglcyg.exe
GL_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS)
@ -830,7 +822,7 @@ ifeq ($(FTE_TARGET),cygwin)
GLB_DIR=gl_cygwin
GLCL_DIR=glcl_cygwin
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o
M_EXE_NAME=../fteqwcyg.exe
MCL_EXE_NAME=../fteqwclcyg.exe
M_LDFLAGS=$(GLLDFLAGS) $(GLXLDFLAGS)
@ -854,7 +846,7 @@ ifeq ($(FTE_TARGET),droid)
SV_LDFLAGS=
GLCL_OBJS=$(GL_OBJS) $(GLQUAKE_OBJS) gl_viddroid.o sys_droid.o cd_null.o snd_droid.o
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_viddroid.o sys_droid.o cd_null.o snd_droid.o
GL_LDFLAGS=$(GLLDFLAGS)
GLB_DIR=gl_droid
GL_EXE_NAME=../libftedroid.so

View file

@ -120,6 +120,9 @@ static void CL_ClearDlight(dlight_t *dl, int key)
dl->color[2] = 1;
dl->corona = r_flashblend.value * 0.25;
dl->coronascale = r_flashblendscale.value;
dl->lightcolourscales[0] = 0;
dl->lightcolourscales[1] = 1;
dl->lightcolourscales[2] = 4;
// if (r_shadow_realtime_dlight_shadowmap.value)
// dl->flags |= LFLAG_SHADOWMAP;
}

View file

@ -263,9 +263,7 @@ typedef struct dlight_s
float minlight; // don't add when contributing less
float color[3];
float channelfade[3];
float ambientscale;
float diffusescale;
float specularscale;
vec3_t lightcolourscales; //ambient, diffuse, specular
float corona;
float coronascale;

View file

@ -801,6 +801,10 @@ typedef struct {
#define ACM_STREAMCONVERTF_BLOCKALIGN 0x00000004
#endif
//mingw workarounds
#define LPWAVEFILTER void *
#include <objbase.h>
MMRESULT (WINAPI *qacmStreamUnprepareHeader) (HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwUnprepare);
MMRESULT (WINAPI *qacmStreamConvert) (HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwConvert);
MMRESULT (WINAPI *qacmStreamPrepareHeader) (HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwPrepare);
@ -892,7 +896,7 @@ HRESULT (WINAPI *qAVIFileOpenA) (PAVIFILE FAR *ppfile, LPCSTR szFile, UINT uM
void (WINAPI *qAVIFileInit) (void);
HRESULT (WINAPI *qAVIStreamWrite) (PAVISTREAM pavi, LONG lStart, LONG lSamples, LPVOID lpBuffer, LONG cbBuffer, DWORD dwFlags, LONG FAR *plSampWritten, LONG FAR *plBytesWritten);
HRESULT (WINAPI *qAVIStreamSetFormat) (PAVISTREAM pavi, LONG lPos,LPVOID lpFormat,LONG cbFormat);
HRESULT (WINAPI *qAVIMakeCompressedStream) (PAVISTREAM FAR * ppsCompressed, PAVISTREAM ppsSource, AVICOMPRESSOPTIONS FAR * lpOptions, CLSID FAR *pclsidHandler);
HRESULT (WINAPI *qAVIMakeCompressedStream) (PAVISTREAM FAR * ppsCompressed, PAVISTREAM ppsSource, AVICOMPRESSOPTIONS FAR * lpOptions, CLSID FAR *pclsidHandler);
HRESULT (WINAPI *qAVIFileCreateStreamA) (PAVIFILE pfile, PAVISTREAM FAR *ppavi, AVISTREAMINFOA FAR * psi);
static qboolean qAVIStartup(void)

View file

@ -764,6 +764,15 @@ static void QCBUILTIN PF_R_DynamicLight_Set(progfuncs_t *prinst, struct globalva
else
l->cubetexture = r_nulltex;
break;
case lfield_ambientscale:
l->lightcolourscales[0] = G_FLOAT(OFS_PARM2);
break;
case lfield_diffusescale:
l->lightcolourscales[1] = G_FLOAT(OFS_PARM2);
break;
case lfield_specularscale:
l->lightcolourscales[2] = G_FLOAT(OFS_PARM2);
break;
default:
break;
}
@ -814,6 +823,15 @@ static void QCBUILTIN PF_R_DynamicLight_Get(progfuncs_t *prinst, struct globalva
case lfield_cubemapname:
RETURN_TSTRING(l->cubemapname);
break;
case lfield_ambientscale:
G_FLOAT(OFS_RETURN) = l->lightcolourscales[0];
break;
case lfield_diffusescale:
G_FLOAT(OFS_RETURN) = l->lightcolourscales[1];
break;
case lfield_specularscale:
G_FLOAT(OFS_RETURN) = l->lightcolourscales[2];
break;
default:
G_INT(OFS_RETURN) = 0;
break;
@ -2024,9 +2042,10 @@ static void QCBUILTIN PF_cs_getinputstate (progfuncs_t *prinst, struct globalvar
{
int f;
usercmd_t *cmd;
extern usercmd_t independantphysics[MAX_SPLITS];
f = G_FLOAT(OFS_PARM0);
if (f >= cls.netchan.outgoing_sequence)
if (f > cls.netchan.outgoing_sequence)
{
G_FLOAT(OFS_RETURN) = false;
return;
@ -2036,9 +2055,11 @@ static void QCBUILTIN PF_cs_getinputstate (progfuncs_t *prinst, struct globalvar
G_FLOAT(OFS_RETURN) = false;
return;
}
// save this command off for prediction
cmd = &cl.frames[f&UPDATE_MASK].cmd[csqc_lplayernum];
/*outgoing_sequence says how many packets have actually been sent, but there's an extra pending packet which has not been sent yet - be warned though, its data will change in the coming frames*/
if (f == cls.netchan.outgoing_sequence)
cmd = &independantphysics[csqc_lplayernum];
else
cmd = &cl.frames[f&UPDATE_MASK].cmd[csqc_lplayernum];
cs_set_input_state(cmd);

View file

@ -454,5 +454,8 @@ enum lightfield_e
lfield_fov=6,
lfield_corona=7,
lfield_coronascale=8,
lfield_cubemapname=9
lfield_cubemapname=9,
lfield_ambientscale=10,
lfield_diffusescale=11,
lfield_specularscale=12
};

View file

@ -2828,7 +2828,7 @@ void D3DBE_SubmitMeshes (qboolean drawworld, batch_t **blist, int first, int sto
}
#ifdef RTLIGHTS
void BE_BaseEntTextures(void)
void D3DBE_BaseEntTextures(void)
{
batch_t *batches[SHADER_SORT_COUNT];
BE_GenModelBatches(batches);

View file

@ -171,6 +171,7 @@ struct {
vec3_t lightorg;
vec3_t lightcolours;
vec3_t lightcolourscale;
float lightradius;
texid_t lighttexture;
texid_t lightcubemap;
@ -2328,7 +2329,9 @@ static unsigned int BE_Program_Set_Attribute(const shaderprogparm_t *p, unsigned
break;
case SP_E_LMSCALE:
if (shaderstate.curentity->model && shaderstate.curentity->model->engineflags & MDLF_NEEDOVERBRIGHT)
if (shaderstate.mode == BEM_DEPTHDARK)
qglUniform1fARB(p->handle[perm], 0.0f);
else if (shaderstate.curentity->model && shaderstate.curentity->model->engineflags & MDLF_NEEDOVERBRIGHT)
qglUniform1fARB(p->handle[perm], 1<<bound(0, gl_overbright.ival, 2));
else
qglUniform1fARB(p->handle[perm], 1.0f);
@ -2437,6 +2440,9 @@ static unsigned int BE_Program_Set_Attribute(const shaderprogparm_t *p, unsigned
qglUniform3fvARB(p->handle[perm], 1, t2);
}
break;
case SP_LIGHTCOLOURSCALE:
qglUniform3fvARB(p->handle[perm], 1, shaderstate.lightcolourscale);
break;
case SP_LIGHTPROJMATRIX:
/*light's texture projection matrix*/
{
@ -2789,6 +2795,7 @@ void GLBE_SelectDLight(dlight_t *dl, vec3_t colour)
/*simple info*/
shaderstate.lightradius = dl->radius;
VectorCopy(dl->origin, shaderstate.lightorg);
VectorCopy(dl->lightcolourscales, shaderstate.lightcolourscale);
VectorCopy(colour, shaderstate.lightcolours);
#ifdef RTLIGHTS
shaderstate.curshadowmap = dl->stexture;
@ -2936,7 +2943,7 @@ static void DrawMeshes(void)
break;
case BEM_DEPTHDARK:
if (shaderstate.curshader->flags & SHADER_HASLIGHTMAP)
if ((shaderstate.curshader->flags & SHADER_HASLIGHTMAP) && !TEXVALID(shaderstate.curtexnums->fullbright))
{
GL_DeSelectProgram();
qglColor3f(0,0,0);
@ -3309,7 +3316,7 @@ batch_t *GLBE_GetTempBatch(void)
/*called from shadowmapping code*/
#ifdef RTLIGHTS
void BE_BaseEntTextures(void)
void GLBE_BaseEntTextures(void)
{
batch_t *batches[SHADER_SORT_COUNT];
BE_GenModelBatches(batches);

View file

@ -1215,9 +1215,9 @@ TRACE(("dbg: RMod_LoadTextures: inittexturedescs\n"));
if (gl_specular.value && gl_load24bit.value)
{
snprintf(altname, sizeof(altname)-1, "%s_gloss", mt->name);
tn.specular = R_LoadHiResTexture(altname, loadname, IF_NOALPHA|IF_NOGAMMA|IF_SUBDIRONLY|IF_MIPCAP);
tn.specular = R_LoadHiResTexture(altname, loadname, IF_NOGAMMA|IF_SUBDIRONLY|IF_MIPCAP);
if (!TEXVALID(tn.specular))
tn.specular = R_LoadHiResTexture(altname, "bmodels", IF_NOALPHA|IF_NOGAMMA|IF_MIPCAP);
tn.specular = R_LoadHiResTexture(altname, "bmodels", IF_NOGAMMA|IF_MIPCAP);
}
}
}

View file

@ -817,6 +817,9 @@ void R_LoadRTLights(void)
dl->coronascale = coronascale;
dl->die = 0;
dl->flags = flags;
dl->lightcolourscales[0] = ambientscale;
dl->lightcolourscales[1] = diffusescale;
dl->lightcolourscales[2] = specularscale;
AngleVectors(angles, dl->axis[0], dl->axis[1], dl->axis[2]);
Q_strncpyz(dl->cubemapname, cubename, sizeof(dl->cubemapname));
@ -869,7 +872,7 @@ void R_SaveRTLights_f(void)
light->style-1,
light->cubemapname, light->corona,
ang[0], ang[1], ang[2],
light->coronascale, light->ambientscale, light->diffusescale, light->specularscale, light->flags&(LFLAG_NORMALMODE|LFLAG_REALTIMEMODE|LFLAG_CREPUSCULAR)
light->coronascale, light->lightcolourscales[0], light->lightcolourscales[1], light->lightcolourscales[2], light->flags&(LFLAG_NORMALMODE|LFLAG_REALTIMEMODE|LFLAG_CREPUSCULAR)
));
}
VFS_CLOSE(f);

View file

@ -2028,6 +2028,7 @@ struct sbuiltin_s
"uniform float l_lightradius;\n"
"uniform vec3 l_lightcolour;\n"
"uniform vec3 l_lightcolourscale;\n"
"#ifdef OFFSETMAPPING\n"
"uniform float cvar_r_glsl_offsetmapping_scale;\n"
@ -2050,10 +2051,10 @@ struct sbuiltin_s
"vec3 bases = vec3(texture2D(s_t0, tcbase));\n"
"#if defined(BUMP) || defined(SPECULAR)\n"
"vec3 bumps = vec3(texture2D(s_t1, tcbase)) * 2.0 - 1.0;\n"
"vec3 bumps = vec3(texture2D(s_t1, tcbase)) - 0.5;\n"
"#endif\n"
"#ifdef SPECULAR\n"
"vec3 specs = vec3(texture2D(s_t2, tcbase));\n"
"vec4 specs = texture2D(s_t2, tcbase);\n"
"#endif\n"
"vec3 nl = normalize(lightvector);\n"
@ -2061,14 +2062,14 @@ struct sbuiltin_s
"vec3 diff;\n"
"#ifdef BUMP\n"
"diff = bases * max(dot(bumps, nl), 0.0);\n"
"diff = bases * (l_lightcolourscale.x + l_lightcolourscale.y * max(dot(2.0*bumps, nl), 0.0));\n"
"#else\n"
"diff = bases * max(dot(vec3(0.0, 0.0, 1.0), nl), 0.0);\n"
"diff = bases * (l_lightcolourscale.x + l_lightcolourscale.y * max(dot(vec3(0.0, 0.0, 1.0), nl), 0.0));\n"
"#endif\n"
"#ifdef SPECULAR\n"
"vec3 halfdir = (normalize(eyevector) + normalize(lightvector))/2.0;\n"
"float dv = dot(halfdir, bumps);\n"
"diff += pow(dv, 8.0) * specs;\n"
"vec3 halfdir = normalize(lightvector) + normalize(eyevector);\n"
"float spec = pow(max(dot(halfdir, bumps), 0.0), 1.0 + 32.0 * specs.a);\n"
"diff += spec * specs.rgb * l_lightcolourscale.z;\n"
"#endif\n"
"#ifdef CUBE\n"
@ -2488,6 +2489,7 @@ struct shader_field_names_s shader_field_names[] =
{"l_lightradius", SP_LIGHTRADIUS},
{"l_lightcolour", SP_LIGHTCOLOUR},
{"l_lightposition", SP_LIGHTPOSITION},
{"l_lightcolourscale", SP_LIGHTCOLOURSCALE},
{"l_projmatrix", SP_LIGHTPROJMATRIX},
{"e_rendertexturescale", SP_RENDERTEXTURESCALE},
@ -4531,6 +4533,9 @@ done:;
}
Shader_SetBlendmode (pass);
if (pass->blendmode == PBM_ADD)
s->defaulttextures.fullbright = pass->anim_frames[0];
}
if (!(s->flags & SHADER_SKY ) && !s->sort)

View file

@ -1858,7 +1858,19 @@ static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, float p
/*shadow meshes are always drawn as an external view*/
oxv = r_refdef.externalview;
r_refdef.externalview = true;
BE_BaseEntTextures();
switch(qrenderer)
{
#ifdef GLQUAKE
case QR_OPENGL:
GLBE_BaseEntTextures();
break;
#endif
#ifdef D3DQUAKE
case QR_DIRECT3D:
D3DBE_BaseEntTextures();
break;
#endif
}
r_refdef.externalview = oxv;
if (0)
@ -2136,7 +2148,19 @@ static void Sh_DrawEntLighting(dlight_t *light, vec3_t colour)
BE_DrawMesh_List(tex->shader, sm->litsurfs[tno].count, sm->litsurfs[tno].s, &tex->vbo, &tex->shader->defaulttextures, 0);
}
BE_BaseEntTextures();
switch(qrenderer)
{
#ifdef GLQUAKE
case QR_OPENGL:
GLBE_BaseEntTextures();
break;
#endif
#ifdef D3DQUAKE
case QR_DIRECT3D:
D3DBE_BaseEntTextures();
break;
#endif
}
}
}

View file

@ -310,6 +310,7 @@ typedef struct {
SP_LIGHTRADIUS, /*these light values are realtime lighting*/
SP_LIGHTCOLOUR,
SP_LIGHTCOLOURSCALE,
SP_LIGHTPOSITION,
SP_LIGHTSCREEN,
SP_LIGHTPROJMATRIX,
@ -508,7 +509,8 @@ void BE_PushOffsetShadow(qboolean foobar);
//sets up gl for depth-only FIXME
void BE_SetupForShadowMap(void);
//Called from shadowmapping code into backend
void BE_BaseEntTextures(void);
void GLBE_BaseEntTextures(void);
void D3DBE_BaseEntTextures(void);
//prebuilds shadow volumes
void Sh_PreGenerateLights(void);
//Draws lights, called from the backend

View file

@ -9764,6 +9764,7 @@ void PR_DumpPlatform_f(void)
{"FL_ONGROUND", "const float", QW|NQ|CS, FL_ONGROUND},
{"FL_PARTIALGROUND", "const float", QW|NQ|CS, FL_PARTIALGROUND},
{"FL_WATERJUMP", "const float", QW|NQ|CS, FL_WATERJUMP},
{"FL_FINDABLE_NONSOLID","const float", QW|NQ|CS, FL_FINDABLE_NONSOLID},
// {"FL_MOVECHAIN_ANGLE", "const float", QW|NQ, FL_MOVECHAIN_ANGLE},
{"FL_LAGGEDMOVE", "const float", QW|NQ, FL_LAGGEDMOVE},
// {"FL_CLASS_DEPENDENT", "const float", QW|NQ, FL_CLASS_DEPENDENT},
@ -9853,6 +9854,15 @@ void PR_DumpPlatform_f(void)
{"FILE_MMAP_READ", "const float", QW|NQ|CS, FRIK_FILE_MMAP_READ},
{"FILE_MMAP_RW", "const float", QW|NQ|CS, FRIK_FILE_MMAP_RW},
{"MOVE_NORMAL", "const float", QW|NQ|CS, MOVE_NORMAL},
{"MOVE_NOMONSTERS", "const float", QW|NQ|CS, MOVE_NOMONSTERS},
{"MOVE_MISSILE", "const float", QW|NQ|CS, MOVE_MISSILE},
{"MOVE_HITMODEL", "const float", QW|NQ|CS, MOVE_HITMODEL},
{"MOVE_TRIGGERS", "const float", QW|NQ|CS, MOVE_TRIGGERS},
{"MOVE_EVERYTHING", "const float", QW|NQ|CS, MOVE_EVERYTHING},
{"MOVE_LAGGED", "const float", QW|NQ|CS, MOVE_LAGGED},
{"MOVE_ENTCHAIN", "const float", QW|NQ|CS, MOVE_ENTCHAIN},
{"MASK_ENGINE", "const float", CS, MASK_DELTA},
{"MASK_VIEWMODEL", "const float", CS, MASK_STDVIEWMODEL},
@ -9867,6 +9877,9 @@ void PR_DumpPlatform_f(void)
{"LFIELD_CORONA", "const float", CS, lfield_corona},
{"LFIELD_CORONASCALE", "const float", CS, lfield_coronascale},
{"LFIELD_CUBEMAPNAME", "const float", CS, lfield_cubemapname},
{"LFIELD_AMBIENTSCALE", "const float", CS, lfield_ambientscale},
{"LFIELD_DIFFUSESCALE", "const float", CS, lfield_diffusescale},
{"LFIELD_SPECULARSCALE","const float", CS, lfield_specularscale},
{"LFLAG_NORMALMODE", "const float", CS, LFLAG_NORMALMODE},
{"LFLAG_REALTIMEMODE", "const float", CS, LFLAG_REALTIMEMODE},