diff --git a/code/cgame/cg_public.h b/code/cgame/cg_public.h index 08dbae94d..bb41119f0 100644 --- a/code/cgame/cg_public.h +++ b/code/cgame/cg_public.h @@ -36,7 +36,7 @@ Suite 120, Rockville, Maryland 20850 USA. // major 0 means each minor is an API break. // major > 0 means each major is an API break and each minor extends API. #define CG_API_MAJOR_VERSION 0 -#define CG_API_MINOR_VERSION 33 +#define CG_API_MINOR_VERSION 34 #define CMD_BACKUP 64 @@ -294,6 +294,8 @@ typedef enum { CG_R_ADDPOLYTOSCENE, CG_R_ADDLIGHTTOSCENE, CG_R_ADDADDITIVELIGHTTOSCENE, + CG_R_ADDVERTEXLIGHTTOSCENE, + CG_R_ADDJUNIORLIGHTTOSCENE, CG_R_ADDCORONATOSCENE, CG_R_RENDERSCENE, CG_R_SETCOLOR, diff --git a/code/client/cl_cgame.c b/code/client/cl_cgame.c index 4711f81d6..02f436fcb 100644 --- a/code/client/cl_cgame.c +++ b/code/client/cl_cgame.c @@ -1363,10 +1363,10 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) { re.AddRefEntityToScene( VMA(1), args[2], args[3], VMA(4), args[5] ); return 0; case CG_R_ADDPOLYTOSCENE: - re.AddPolyToScene( args[1], args[2], VMA(3), 1, args[4] ); + re.AddPolyToScene( args[1], args[2], VMA(3), 1, args[4], args[5] ); return 0; case CG_R_ADDPOLYSTOSCENE: - re.AddPolyToScene( args[1], args[2], VMA(3), args[4], args[5] ); + re.AddPolyToScene( args[1], args[2], VMA(3), args[4], args[5], args[6] ); return 0; case CG_R_ADDPOLYBUFFERTOSCENE: re.AddPolyBufferToScene( VMA( 1 ) ); @@ -1374,11 +1374,17 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) { case CG_R_LIGHTFORPOINT: return re.LightForPoint( VMA(1), VMA(2), VMA(3), VMA(4) ); case CG_R_ADDLIGHTTOSCENE: - re.AddLightToScene( VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6) ); + re.AddLightToScene( VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), args[7] ); return 0; case CG_R_ADDADDITIVELIGHTTOSCENE: re.AddAdditiveLightToScene( VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6) ); return 0; + case CG_R_ADDVERTEXLIGHTTOSCENE: + re.AddVertexLightToScene( VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6) ); + return 0; + case CG_R_ADDJUNIORLIGHTTOSCENE: + re.AddJuniorLightToScene( VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6) ); + return 0; case CG_R_ADDCORONATOSCENE: re.AddCoronaToScene( VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), args[6], args[7], args[8] ); return 0; diff --git a/code/renderercommon/tr_public.h b/code/renderercommon/tr_public.h index bd0c27956..197d4f7b6 100644 --- a/code/renderercommon/tr_public.h +++ b/code/renderercommon/tr_public.h @@ -82,11 +82,13 @@ typedef struct { // Nothing is drawn until R_RenderScene is called. void (*ClearScene)( void ); void (*AddRefEntityToScene)( const refEntity_t *re, int bufsize, int numVerts, const polyVert_t *verts, int numPolys ); - void (*AddPolyToScene)( qhandle_t hShader , int numVerts, const polyVert_t *verts, int numPolys, int bmodelNum ); + void (*AddPolyToScene)( qhandle_t hShader , int numVerts, const polyVert_t *verts, int numPolys, int bmodelNum, int sortLevel ); void (*AddPolyBufferToScene)( polyBuffer_t* pPolyBuffer ); int (*LightForPoint)( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir ); - void (*AddLightToScene)( const vec3_t org, float radius, float intensity, float r, float g, float b ); + void (*AddLightToScene)( const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader ); void (*AddAdditiveLightToScene)( const vec3_t org, float radius, float intensity, float r, float g, float b ); + void (*AddVertexLightToScene)( const vec3_t org, float radius, float intensity, float r, float g, float b ); + void (*AddJuniorLightToScene)( const vec3_t org, float radius, float intensity, float r, float g, float b ); void (*AddCoronaToScene)( const vec3_t org, float r, float g, float b, float scale, int id, qboolean visible, qhandle_t hShader ); void (*RenderScene)( const refdef_t *fd, int bufsize ); diff --git a/code/renderergl1/tr_init.c b/code/renderergl1/tr_init.c index a91b243c6..6abd44adb 100644 --- a/code/renderergl1/tr_init.c +++ b/code/renderergl1/tr_init.c @@ -1475,6 +1475,8 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp, qboolean headless ) re.LightForPoint = R_LightForPoint; re.AddLightToScene = RE_AddLightToScene; re.AddAdditiveLightToScene = RE_AddAdditiveLightToScene; + re.AddVertexLightToScene = RE_AddVertexLightToScene; + re.AddJuniorLightToScene = RE_AddJuniorLightToScene; re.AddCoronaToScene = RE_AddCoronaToScene; re.RenderScene = RE_RenderScene; diff --git a/code/renderergl1/tr_local.h b/code/renderergl1/tr_local.h index 3ad37a5e5..c7a4c9388 100644 --- a/code/renderergl1/tr_local.h +++ b/code/renderergl1/tr_local.h @@ -1571,10 +1571,12 @@ qhandle_t RE_AddSkinToFrame( int numSurfaces, const qhandle_t *surfaces ); void RE_ClearScene( void ); void RE_AddRefEntityToScene( const refEntity_t *ent, int entBufSize, int numVerts, const polyVert_t *verts, int numPolys ); -void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys, int bmodelNum ); +void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys, int bmodelNum, int sortLevel ); void RE_AddPolyBufferToScene( polyBuffer_t* pPolyBuffer ); -void RE_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ); +void RE_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader ); void RE_AddAdditiveLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ); +void RE_AddVertexLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ); +void RE_AddJuniorLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ); void RE_AddCoronaToScene( const vec3_t org, float r, float g, float b, float scale, int id, qboolean visible, qhandle_t hShader ); void RE_RenderScene( const refdef_t *fd, int fdSize ); diff --git a/code/renderergl1/tr_scene.c b/code/renderergl1/tr_scene.c index b99cbb993..090f0ca21 100644 --- a/code/renderergl1/tr_scene.c +++ b/code/renderergl1/tr_scene.c @@ -246,10 +246,9 @@ RE_AddPolyToScene ===================== */ -void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys, int bmodelNum ) { +void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys, int bmodelNum, int sortLevel ) { srfPoly_t *poly; int j; - int sortLevel = 0; // ZTM: TODO: make this an argument, breaks renderer API compatibility if ( !tr.registered ) { return; @@ -473,8 +472,8 @@ RE_AddLightToScene ===================== */ -void RE_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ) { - RE_AddDynamicLightToScene( org, radius, intensity, r, g, b, REF_GRID_DLIGHT | REF_SURFACE_DLIGHT, 0 ); +void RE_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader ) { + RE_AddDynamicLightToScene( org, radius, intensity, r, g, b, REF_GRID_DLIGHT | REF_SURFACE_DLIGHT, hShader ); } /* @@ -487,6 +486,26 @@ void RE_AddAdditiveLightToScene( const vec3_t org, float radius, float intensity RE_AddDynamicLightToScene( org, radius, intensity, r, g, b, REF_GRID_DLIGHT | REF_SURFACE_DLIGHT | REF_ADDITIVE_DLIGHT, 0 ); } +/* +===================== +RE_AddVertexLightToScene + +===================== +*/ +void RE_AddVertexLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ) { + RE_AddDynamicLightToScene( org, radius, intensity, r, g, b, REF_GRID_DLIGHT | REF_SURFACE_DLIGHT | REF_VERTEX_DLIGHT, 0 ); +} + +/* +===================== +RE_AddJuniorLightToScene + +===================== +*/ +void RE_AddJuniorLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ) { + RE_AddDynamicLightToScene( org, radius, intensity, r, g, b, REF_GRID_DLIGHT, 0 ); +} + /* ============== RE_AddCoronaToScene diff --git a/code/renderergl2/tr_init.c b/code/renderergl2/tr_init.c index f714b1271..e82ee6e97 100644 --- a/code/renderergl2/tr_init.c +++ b/code/renderergl2/tr_init.c @@ -1706,6 +1706,8 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp, qboolean headless ) re.LightForPoint = R_LightForPoint; re.AddLightToScene = RE_AddLightToScene; re.AddAdditiveLightToScene = RE_AddAdditiveLightToScene; + re.AddVertexLightToScene = RE_AddVertexLightToScene; + re.AddJuniorLightToScene = RE_AddJuniorLightToScene; re.AddCoronaToScene = RE_AddCoronaToScene; re.RenderScene = RE_RenderScene; diff --git a/code/renderergl2/tr_local.h b/code/renderergl2/tr_local.h index bfacfa561..5524f5ad0 100644 --- a/code/renderergl2/tr_local.h +++ b/code/renderergl2/tr_local.h @@ -2448,10 +2448,12 @@ qhandle_t RE_AddSkinToFrame( int numSurfaces, const qhandle_t *surfaces ); void RE_ClearScene( void ); void RE_AddRefEntityToScene( const refEntity_t *ent, int entBufSize, int numVerts, const polyVert_t *verts, int numPolys ); -void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys, int bmodelNum ); +void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys, int bmodelNum, int sortLevel ); void RE_AddPolyBufferToScene( polyBuffer_t* pPolyBuffer ); -void RE_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ); +void RE_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader ); void RE_AddAdditiveLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ); +void RE_AddVertexLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ); +void RE_AddJuniorLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ); void RE_AddCoronaToScene( const vec3_t org, float r, float g, float b, float scale, int id, qboolean visible, qhandle_t hShader ); void RE_BeginScene( const refdef_t *fd ); void RE_RenderScene( const refdef_t *fd, int fdSize ); diff --git a/code/renderergl2/tr_scene.c b/code/renderergl2/tr_scene.c index 81b7dd86a..218973d21 100644 --- a/code/renderergl2/tr_scene.c +++ b/code/renderergl2/tr_scene.c @@ -246,10 +246,9 @@ RE_AddPolyToScene ===================== */ -void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys, int bmodelNum ) { +void RE_AddPolyToScene( qhandle_t hShader, int numVerts, const polyVert_t *verts, int numPolys, int bmodelNum, int sortLevel ) { srfPoly_t *poly; int j; - int sortLevel = 0; // ZTM: TODO: make this an argument, breaks renderer API compatibility if ( !tr.registered ) { return; @@ -478,8 +477,8 @@ RE_AddLightToScene ===================== */ -void RE_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ) { - RE_AddDynamicLightToScene( org, radius, intensity, r, g, b, REF_GRID_DLIGHT | REF_SURFACE_DLIGHT, 0 ); +void RE_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader ) { + RE_AddDynamicLightToScene( org, radius, intensity, r, g, b, REF_GRID_DLIGHT | REF_SURFACE_DLIGHT, hShader ); } /* @@ -492,6 +491,26 @@ void RE_AddAdditiveLightToScene( const vec3_t org, float radius, float intensity RE_AddDynamicLightToScene( org, radius, intensity, r, g, b, REF_GRID_DLIGHT | REF_SURFACE_DLIGHT | REF_ADDITIVE_DLIGHT, 0 ); } +/* +===================== +RE_AddVertexLightToScene + +===================== +*/ +void RE_AddVertexLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ) { + RE_AddDynamicLightToScene( org, radius, intensity, r, g, b, REF_GRID_DLIGHT | REF_SURFACE_DLIGHT | REF_VERTEX_DLIGHT, 0 ); +} + +/* +===================== +RE_AddJuniorLightToScene + +===================== +*/ +void RE_AddJuniorLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b ) { + RE_AddDynamicLightToScene( org, radius, intensity, r, g, b, REF_GRID_DLIGHT, 0 ); +} + /* ============== RE_AddCoronaToScene