Skip to content

Commit

Permalink
Merge branch 'dev' into reserve2
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY authored Nov 4, 2023
2 parents 7947c7b + d9e484c commit 4f33510
Show file tree
Hide file tree
Showing 99 changed files with 2,606 additions and 125 deletions.
24 changes: 12 additions & 12 deletions res/gamedata/shaders/.gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
*.ps -binary

# DirectX renderer shader extension names
r*/*.ps text diff=cpp linguist-language=HLSL
r*/*.vs text diff=cpp linguist-language=HLSL
r*/*.gs text diff=cpp linguist-language=HLSL
r*/*.cs text diff=cpp linguist-language=HLSL
r*/*.hs text diff=cpp linguist-language=HLSL
r*/*.ds text diff=cpp linguist-language=HLSL
r*/*.ps text diff=cpp linguist-language=HLSL linguist-detectable=true linguist-documentation=false
r*/*.vs text diff=cpp linguist-language=HLSL linguist-detectable=true linguist-documentation=false
r*/*.gs text diff=cpp linguist-language=HLSL linguist-detectable=true linguist-documentation=false
r*/*.cs text diff=cpp linguist-language=HLSL linguist-detectable=true linguist-documentation=false
r*/*.hs text diff=cpp linguist-language=HLSL linguist-detectable=true linguist-documentation=false
r*/*.ds text diff=cpp linguist-language=HLSL linguist-detectable=true linguist-documentation=false

# OpenGL renderer uses the same extensions
gl/*.ps text diff=cpp linguist-language=GLSL
gl/*.vs text diff=cpp linguist-language=GLSL
gl/*.gs text diff=cpp linguist-language=GLSL
gl/*.cs text diff=cpp linguist-language=GLSL
gl/*.hs text diff=cpp linguist-language=GLSL
gl/*.ds text diff=cpp linguist-language=GLSL
gl/*.ps text diff=cpp linguist-language=GLSL linguist-detectable=true linguist-documentation=false
gl/*.vs text diff=cpp linguist-language=GLSL linguist-detectable=true linguist-documentation=false
gl/*.gs text diff=cpp linguist-language=GLSL linguist-detectable=true linguist-documentation=false
gl/*.cs text diff=cpp linguist-language=GLSL linguist-detectable=true linguist-documentation=false
gl/*.hs text diff=cpp linguist-language=GLSL linguist-detectable=true linguist-documentation=false
gl/*.ds text diff=cpp linguist-language=GLSL linguist-detectable=true linguist-documentation=false
1 change: 1 addition & 0 deletions src/Layers/xrRender/Blender_Recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CBlender_Compile
bool bDetail_Bump;
BOOL bUseSteepParallax;
int iElement;
bool HudElement = false;

public:
CSimulator RS;
Expand Down
210 changes: 208 additions & 2 deletions src/Layers/xrRender/Blender_Recorder_StandartBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class cl_fog_params : public R_constant_setup
float n = g_pGamePersistent->Environment().CurrentEnv.fog_near;
float f = g_pGamePersistent->Environment().CurrentEnv.fog_far;
float r = 1 / (f - n);
result.set(-n * r, r, r, r);
result.set(-n * r, n, f, r);
}
cmd_list.set_c(C, result);
}
Expand All @@ -208,7 +208,7 @@ class cl_fog_color : public R_constant_setup
if (marker != Device.dwFrame)
{
const auto& desc = g_pGamePersistent->Environment().CurrentEnv;
result.set(desc.fog_color.x, desc.fog_color.y, desc.fog_color.z, 0);
result.set(desc.fog_color.x, desc.fog_color.y, desc.fog_color.z, desc.fog_density);
}
cmd_list.set_c(C, result);
}
Expand Down Expand Up @@ -387,6 +387,189 @@ class cl_entity_data : public R_constant_setup //--#SM+#--
};
static cl_entity_data binder_entity_data;

// Ascii1457's Screen Space Shaders
extern ENGINE_API Fvector4 ps_ssfx_hud_drops_1;
extern ENGINE_API Fvector4 ps_ssfx_hud_drops_2;
extern ENGINE_API Fvector4 ps_ssfx_blood_decals;
extern ENGINE_API Fvector4 ps_ssfx_wpn_dof_1;
extern ENGINE_API float ps_ssfx_wpn_dof_2;

class cl_inv_v : public R_constant_setup
{
Fmatrix result;
void setup(CBackend& cmd_list, R_constant* C) override
{
result.invert(Device.mView);
cmd_list.set_c(C, result);
}
};
static cl_inv_v binder_inv_v;

class cl_rain_params : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
float rainDensity = g_pGamePersistent->Environment().CurrentEnv.rain_density;
float rainWetness = g_pGamePersistent->Environment().wetness_factor;
cmd_list.set_c(C, rainDensity, rainWetness, 0.0f, 0.0f);
}
};
static cl_rain_params binder_rain_params;

class pp_image_corrections : public R_constant_setup
{
virtual void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_r2_img_exposure, ps_r2_img_gamma, ps_r2_img_saturation, 1.f);
}
};
static pp_image_corrections binder_image_corrections;

class pp_color_grading : public R_constant_setup
{
virtual void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_r2_img_cg.x, ps_r2_img_cg.y, ps_r2_img_cg.z, 1.f);
}
};
static pp_color_grading binder_color_grading;

class cl_sky_color : public R_constant_setup
{
u32 marker;
Fvector4 result;

void setup(CBackend& cmd_list, R_constant* C) override
{
if (marker != Device.dwFrame)
{
CEnvDescriptor& desc = g_pGamePersistent->Environment().CurrentEnv;
result.set(desc.sky_color.x, desc.sky_color.y, desc.sky_color.z, desc.sky_rotation);
}
cmd_list.set_c(C, result);
}
};
static cl_sky_color binder_sky_color;

//Sneaky debug stuff
extern ENGINE_API Fvector4 ps_dev_param_1;
extern ENGINE_API Fvector4 ps_dev_param_2;
extern ENGINE_API Fvector4 ps_dev_param_3;
extern ENGINE_API Fvector4 ps_dev_param_4;
extern ENGINE_API Fvector4 ps_dev_param_5;
extern ENGINE_API Fvector4 ps_dev_param_6;
extern ENGINE_API Fvector4 ps_dev_param_7;
extern ENGINE_API Fvector4 ps_dev_param_8;

static class dev_param_1 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_dev_param_1.x, ps_dev_param_1.y, ps_dev_param_1.z, ps_dev_param_1.w);
}
} dev_param_1;

static class dev_param_2 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_dev_param_2.x, ps_dev_param_2.y, ps_dev_param_2.z, ps_dev_param_2.w);
}
} dev_param_2;

static class dev_param_3 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_dev_param_3.x, ps_dev_param_3.y, ps_dev_param_3.z, ps_dev_param_3.w);
}
} dev_param_3;

static class dev_param_4 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_dev_param_4.x, ps_dev_param_4.y, ps_dev_param_4.z, ps_dev_param_4.w);
}
} dev_param_4;

static class dev_param_5 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_dev_param_5.x, ps_dev_param_5.y, ps_dev_param_5.z, ps_dev_param_5.w);
}
} dev_param_5;

static class dev_param_6 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_dev_param_6.x, ps_dev_param_6.y, ps_dev_param_6.z, ps_dev_param_6.w);
}
} dev_param_6;

static class dev_param_7 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_dev_param_7.x, ps_dev_param_7.y, ps_dev_param_7.z, ps_dev_param_7.w);
}
} dev_param_7;

static class dev_param_8 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_dev_param_8.x, ps_dev_param_8.y, ps_dev_param_8.z, ps_dev_param_8.w);
}
} dev_param_8;

class ssfx_wpn_dof_1 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_ssfx_wpn_dof_1.x, ps_ssfx_wpn_dof_1.y, ps_ssfx_wpn_dof_1.z, ps_ssfx_wpn_dof_1.w);
}
};
static ssfx_wpn_dof_1 binder_ssfx_wpn_dof_1;

class ssfx_wpn_dof_2 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_ssfx_wpn_dof_2, 0.f, 0.f, 0.f);
}
};
static ssfx_wpn_dof_2 binder_ssfx_wpn_dof_2;

class ssfx_blood_decals : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_ssfx_blood_decals);
}
};
static ssfx_blood_decals binder_ssfx_blood_decals;

class ssfx_hud_drops_1 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_ssfx_hud_drops_1);
}
};
static ssfx_hud_drops_1 binder_ssfx_hud_drops_1;

class ssfx_hud_drops_2 : public R_constant_setup
{
void setup(CBackend& cmd_list, R_constant* C) override
{
cmd_list.set_c(C, ps_ssfx_hud_drops_2);
}
};
static ssfx_hud_drops_2 binder_ssfx_hud_drops_2;

// Standart constant-binding
void CBlender_Compile::SetMapping()
{
Expand Down Expand Up @@ -466,4 +649,27 @@ void CBlender_Compile::SetMapping()
std::pair<shared_str, R_constant_setup*> cs = RImplementation.Resources->v_constant_setup[it];
r_Constant(*cs.first, cs.second);
}

// Anomaly
r_Constant("rain_params", &binder_rain_params);
r_Constant("pp_img_corrections", &binder_image_corrections);
r_Constant("pp_img_cg", &binder_color_grading);
r_Constant("m_inv_V", &binder_inv_v);

r_Constant("shader_param_1", &dev_param_1);
r_Constant("shader_param_2", &dev_param_2);
r_Constant("shader_param_3", &dev_param_3);
r_Constant("shader_param_4", &dev_param_4);
r_Constant("shader_param_5", &dev_param_5);
r_Constant("shader_param_6", &dev_param_6);
r_Constant("shader_param_7", &dev_param_7);
r_Constant("shader_param_8", &dev_param_8);

// Ascii1457's Screen Space Shaders
r_Constant("sky_color", &binder_sky_color);
r_Constant("ssfx_wpn_dof_1", &binder_ssfx_wpn_dof_1);
r_Constant("ssfx_wpn_dof_2", &binder_ssfx_wpn_dof_2);
r_Constant("ssfx_blood_decals", &binder_ssfx_blood_decals);
r_Constant("ssfx_hud_drops_1", &binder_ssfx_hud_drops_1);
r_Constant("ssfx_hud_drops_2", &binder_ssfx_hud_drops_2);
}
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ColorMapManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void ColorMapManager::UpdateTexture(const shared_str& strTexName, int iTex)
ref_texture tmp;
tmp.create(strTexName.c_str());

m_TexCache.insert(std::make_pair(strTexName, tmp));
m_TexCache.emplace(strTexName, tmp);

#if defined(USE_DX9) || defined(USE_DX11)
ID3DBaseTexture* e0 = tmp->surface_get();
Expand Down
31 changes: 29 additions & 2 deletions src/Layers/xrRender/DetailManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ void CDetailManager::UpdateVisibleM()
continue;
}
u32 mask = 0xff;
u32 res = View.testSAABB(MS.vis.sphere.P, MS.vis.sphere.R, MS.vis.box.data(), mask);

u32 res = View.testSphere(MS.vis.sphere.P, MS.vis.sphere.R, mask);

if (fcvNone == res)
{
continue; // invisible-view frustum
Expand All @@ -295,7 +297,7 @@ void CDetailManager::UpdateVisibleM()
if (fcvPartial == res)
{
u32 _mask = mask;
u32 _res = View.testSAABB(S.vis.sphere.P, S.vis.sphere.R, S.vis.box.data(), _mask);
u32 _res = View.testSphere(S.vis.sphere.P, S.vis.sphere.R, _mask);
if (fcvNone == _res)
{
continue; // invisible-view frustum
Expand Down Expand Up @@ -347,6 +349,8 @@ void CDetailManager::UpdateVisibleM()

sp.r_items[vis_id].push_back(siIT);

Item.distance = dist_sq;
Item.position = S.vis.sphere.P;
// 2 visible[vis_id][sp.id].push_back(&Item);
}
}
Expand Down Expand Up @@ -444,3 +448,26 @@ void CDetailManager::MT_CALC()
}
MT.Leave();
}

void CDetailManager::details_clear()
{
// Disable fade, next render will be scene
fade_distance = 99999;

if (ps_ssfx_grass_shadows.x <= 0)
return;

for (u32 x = 0; x < 3; x++)
{
vis_list& list = m_visibles[x];
for (u32 O = 0; O < objects.size(); O++)
{
CDetail & Object = *objects[O];
xr_vector<SlotItemVec*>&vis = list[O];
if (!vis.empty())
{
vis.erase(vis.begin(), vis.end());
}
}
}
}
6 changes: 6 additions & 0 deletions src/Layers/xrRender/DetailManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ extern float ps_current_detail_height;
class ECORE_API CDetailManager
{
public:
float fade_distance = 99999;
Fvector light_position;
void details_clear();

struct SlotItem
{ // один кустик
float scale;
Expand All @@ -61,6 +65,8 @@ class ECORE_API CDetailManager
u32 vis_ID; // индекс в visibility списке он же тип [не качается, качается1, качается2]
float c_hemi;
float c_sun;
float distance;
Fvector position;
#if RENDER == R_R1
Fvector c_rgb;
#endif
Expand Down
Loading

0 comments on commit 4f33510

Please sign in to comment.