Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/engine/RefAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ struct refexport_t {
void ( *ClearScene )( );
void ( *AddRefEntityToScene )( const refEntity_t* re );

int ( *LightForPoint )( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir );

void ( *AddPolyToScene )( qhandle_t hShader, int numVerts, const polyVert_t* verts );
void ( *AddPolysToScene )( qhandle_t hShader, int numVerts, const polyVert_t* verts, int numPolys );

Expand Down
5 changes: 0 additions & 5 deletions src/engine/client/cg_msgdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ enum cgameImport_t
CG_R_LERPTAG,
CG_R_REMAP_SHADER,
CG_R_BATCHINPVS,
CG_R_LIGHTFORPOINT,
CG_R_REGISTERANIMATION,
CG_R_BUILDSKELETON,
CG_R_BONEINDEX,
Expand Down Expand Up @@ -332,10 +331,6 @@ namespace Render {
std::vector<std::array<float, 3>>>,
IPC::Reply<std::vector<bool>>
>;
using LightForPointMsg = IPC::SyncMessage<
IPC::Message<IPC::Id<VM::QVM, CG_R_LIGHTFORPOINT>, std::array<float, 3>>,
IPC::Reply<std::array<float, 3>, std::array<float, 3>, std::array<float, 3>, int>
>;
using RegisterAnimationMsg = IPC::SyncMessage<
IPC::Message<IPC::Id<VM::QVM, CG_R_REGISTERANIMATION>, std::string>,
IPC::Reply<int>
Expand Down
6 changes: 0 additions & 6 deletions src/engine/client/cl_cgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1243,12 +1243,6 @@ void CGameVM::QVMSyscall(int syscallNum, Util::Reader& reader, IPC::Channel& cha
});
break;

case CG_R_LIGHTFORPOINT:
IPC::HandleMsg<Render::LightForPointMsg>(channel, std::move(reader), [this] (std::array<float, 3> point, std::array<float, 3>& ambient, std::array<float, 3>& directed, std::array<float, 3>& dir, int& res) {
res = re.LightForPoint(point.data(), ambient.data(), directed.data(), dir.data());
});
break;

case CG_R_REGISTERANIMATION:
IPC::HandleMsg<Render::RegisterAnimationMsg>(channel, std::move(reader), [this] (const std::string& name, int& handle) {
handle = re.RegisterAnimation(name.c_str());
Expand Down
5 changes: 0 additions & 5 deletions src/engine/null/null_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ void RE_SetWorldVisData( const byte * ) { }
void RE_EndRegistration() { }
void RE_ClearScene() { }
void RE_AddRefEntityToScene( const refEntity_t * ) { }
int R_LightForPoint( vec3_t, vec3_t, vec3_t, vec3_t )
{
return 0;
}
void RE_AddPolyToScene( qhandle_t, int, const polyVert_t* ) { }
void RE_AddPolysToScene( qhandle_t, int, const polyVert_t*, int ) { }
void RE_AddLightToScene( const vec3_t, float, float, float, float, int ) { }
Expand Down Expand Up @@ -207,7 +203,6 @@ refexport_t *GetRefAPI( int, refimport_t* )

re.ClearScene = RE_ClearScene;
re.AddRefEntityToScene = RE_AddRefEntityToScene;
re.LightForPoint = R_LightForPoint;

re.AddPolyToScene = RE_AddPolyToScene;
// Ridah
Expand Down
1 change: 0 additions & 1 deletion src/engine/renderer/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,6 @@ ScreenshotCmd screenshotPNGRegistration("screenshotPNG", ssFormat_t::SSF_PNG, "p

re.AddPolyToScene = RE_AddPolyToSceneET;
re.AddPolysToScene = RE_AddPolysToScene;
re.LightForPoint = R_LightForPoint;

re.AddLightToScene = RE_AddDynamicLightToScene;

Expand Down
81 changes: 0 additions & 81 deletions src/engine/renderer/tr_light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,84 +95,3 @@ float R_InterpolateLightGrid( world_t *w, int from[3], int to[3],

return totalFactor;
}

/*
=================
R_LightForPoint
=================
*/
int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir )
{
int i;
int from[ 3 ], to[ 3 ];
float frac[ 3 ][ 2 ];
float *factors[ 3 ] = { frac[ 0 ], frac[ 1 ], frac[ 2 ] };
float totalFactor;

// bk010103 - this segfaults with -nolight maps
if ( tr.world->lightGridData1 == nullptr ||
tr.world->lightGridData2 == nullptr )
{
return false;
}

for ( i = 0; i < 3; i++ )
{
float v;

v = point[ i ] - tr.world->lightGridOrigin[ i ];
v *= tr.world->lightGridInverseSize[ i ];
from[ i ] = floor( v );
frac[ i ][ 0 ] = v - from[ i ];

if ( from[ i ] < 0 )
{
from[ i ] = 0;
frac[ i ][ 0 ] = 0.0f;
}
else if ( from[ i ] >= tr.world->lightGridBounds[ i ] - 1 )
{
from[ i ] = tr.world->lightGridBounds[ i ] - 2;
frac[ i ][ 0 ] = 1.0f;
}

to[ i ] = from[ i ] + 1;
frac[ i ][ 1 ] = 1.0f - frac[ i ][ 0 ];
}

totalFactor = R_InterpolateLightGrid( tr.world, from, to, factors,
ambientLight, directedLight,
lightDir );

if ( totalFactor > 0 && totalFactor < 0.99 )
{
totalFactor = 1.0f / totalFactor;

VectorScale( lightDir, totalFactor, lightDir );
VectorScale( ambientLight, totalFactor, ambientLight );
VectorScale( directedLight, totalFactor, directedLight );
}

// compute z-component of direction
lightDir[ 2 ] = 1.0f - fabsf( lightDir[ 0 ] ) - fabsf( lightDir[ 1 ] );
if( lightDir[ 2 ] < 0.0f ) {
float X = lightDir[ 0 ];
float Y = lightDir[ 1 ];
lightDir[ 0 ] = copysignf( 1.0f - fabsf( Y ), X );
lightDir[ 1 ] = copysignf( 1.0f - fabsf( X ), Y );
}

VectorNormalize( lightDir );

if ( ambientLight[ 0 ] < r_forceAmbient.Get() &&
ambientLight[ 1 ] < r_forceAmbient.Get() &&
ambientLight[ 2 ] < r_forceAmbient.Get() )
{
ambientLight[ 0 ] = r_forceAmbient.Get();
ambientLight[ 1 ] = r_forceAmbient.Get();
ambientLight[ 2 ] = r_forceAmbient.Get();
}

return true;
}

1 change: 0 additions & 1 deletion src/engine/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -3266,7 +3266,6 @@ void GLimp_LogComment_( std::string comment );
float R_InterpolateLightGrid( world_t *w, int from[3], int to[3],
float *factors[3], vec3_t ambientLight,
vec3_t directedLight, vec3_t lightDir );
int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir );

/*
============================================================
Expand Down
12 changes: 0 additions & 12 deletions src/shared/client/cg_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,18 +414,6 @@ std::vector<bool> trap_R_BatchInPVS(
return inPVS;
}

int trap_R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir )
{
int result;
std::array<float, 3> mypoint, myambient, mydirected, mydir;
VectorCopy(point, mypoint);
VM::SendMsg<Render::LightForPointMsg>(mypoint, myambient, mydirected, mydir, result);
VectorCopy(myambient, ambientLight);
VectorCopy(mydirected, directedLight);
VectorCopy(mydir, lightDir);
return result;
}

qhandle_t trap_R_RegisterAnimation( const char *name )
{
int handle;
Expand Down
1 change: 0 additions & 1 deletion src/shared/client/cg_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ std::vector<bool> trap_R_BatchInPVS(
const vec3_t origin,
const std::vector<std::array<float, 3>>& posEntities );

int trap_R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir );
qhandle_t trap_R_RegisterAnimation( const char *name );
int trap_R_BuildSkeleton( refSkeleton_t *skel, qhandle_t anim, int startFrame, int endFrame, float frac, bool clearOrigin );
int trap_R_BlendSkeleton( refSkeleton_t *skel, const refSkeleton_t *blend, float frac );
Expand Down
Loading