Skip to content

Commit

Permalink
xrRenderGL: support for SHOC lightmaps (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyLoaderr authored and Xottab-DUTY committed Nov 17, 2019
1 parent 51ca92e commit e048edf
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions res/gamedata/shaders/gl/common_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,35 @@ float4 unpack_color( float4 c ) { return c.bgra; }
float4 unpack_D3DCOLOR( float4 c ) { return c.bgra; }
float3 unpack_D3DCOLOR( float3 c ) { return c.bgr; }

float3 p_hemi( float2 tc )
float3 p_hemi(float2 tc)
{
// float3 t_lmh = tex2D (s_hemi, tc);
// float3 t_lmh = s_hemi.Sample( smp_rtlinear, tc);
// return dot(t_lmh,1.0/4.0);
float4 t_lmh = tex2D (s_hemi, tc);
return float3(t_lmh.a);
float4 t_lmh = tex2D(s_hemi, tc);

#ifdef USE_SHOC_RESOURCES
float r_lmh = (1.0/3.0);
return float3(dot(t_lmh.rgb, float3(r_lmh, r_lmh, r_lmh)));
#else // USE_SHOC_RESOURCES
return float3(t_lmh.a);
#endif // USE_SHOC_RESOURCES
}

float get_hemi( float4 lmh)
float get_hemi(float4 lmh)
{
#ifdef USE_SHOC_RESOURCES
float r_lmh = (1.0/3.0);
return dot(lmh.rgb, float3(r_lmh, r_lmh, r_lmh));
#else // USE_SHOC_RESOURCES
return lmh.a;
#endif // USE_SHOC_RESOURCES
}

float get_sun( float4 lmh)
float get_sun(float4 lmh)
{
#ifdef USE_SHOC_RESOURCES
return lmh.a;
#else // USE_SHOC_RESOURCES
return lmh.g;
#endif // USE_SHOC_RESOURCES
}

float3 v_hemi(float3 n)
Expand Down

0 comments on commit e048edf

Please sign in to comment.