Skip to content

Commit

Permalink
Merge pull request #202 from OGSR/dev [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
xrSimpodin authored Jul 1, 2020
2 parents 4f0c88a + 4044018 commit 37d0720
Show file tree
Hide file tree
Showing 100 changed files with 1,036 additions and 410 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,8 @@
<text>Ðàçðåøåíèå êàðò òåíåé</text>
</string>

<string id="ui_mm_rs_mt_texload">
<text>Ìíîãîïîòî÷íàÿ çàãðóçêà òåñòóð</text>
<string id="r_sslr_enable">
<text>Îòðàæåíèÿ â ëóæàõ</text>
</string>

<string id="ui_mm_fov">
Expand Down
7 changes: 7 additions & 0 deletions Game/Resources_SoC_1.0006/gamedata/config/ui/ui_mm_opt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,13 @@
<options_item entry="r__actor_shadow" group="mm_opt_video_adv"/>
</check_r2_actor_shadow>

<cap_r_sslr_enable x="5" y="5" width="143" height="21">
<text font="letterica16" r="215" g="195" b="170">r_sslr_enable</text>
</cap_r_sslr_enable>
<check_r_sslr_enable x="249" y="0" width="30" height="21">
<options_item entry="r_sslr_enable" group="mm_opt_video_adv"/>
</check_r_sslr_enable>

<btn_to_simply x="342" y="325" width="111" height="29">
<text align="c" font="letterica16" r="227" g="199" b="178">ui_mm_simply</text>
<texture>ui_button_ordinary</texture>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ local function only_2a_and_more_mode() return get_current_renderer() >=
local function only_2_and_more_mode() return get_current_renderer() >= 2 end
local function only_25_and_more_mode() return get_current_renderer() >= 3 end
local function only_3_and_more_mode() return get_current_renderer() >= 4 end
local function only_3_mode() return get_current_renderer() == 4 end
local function only_3_and_more_mode_invisible() return not only_3_and_more_mode() end
local function only_4_and_more_mode() return get_current_renderer() >= 5 end

Expand All @@ -32,7 +33,7 @@ local adv_vid_opt_params = {
{ "aniso", "track", 0, hint_colors.yellow, "video_settings_name_8" , "video_settings_desc_8" },
--
{ "aa", "list", 0, hint_colors.green , "video_settings_name_19", "video_settings_desc_19", only_2a_and_more_mode },
{ "msaa", "list", 1, hint_colors.red , "", "" , only_3_and_more_mode },
{ "msaa", "list", 1, hint_colors.red , "", "" , only_3_mode }, --мсаа норм работает только на р3, пока.
{ "ssample", "track", 0, hint_colors.green , "", "" , only_1_mode },
--
{ "detail_density", "track", 0, hint_colors.red , "video_settings_name_4" , "video_settings_desc_4" },
Expand Down Expand Up @@ -67,15 +68,16 @@ local adv_vid_opt_params = {
{ "fov", "track", 0, hint_colors.green , "video_settings_name_61", "video_settings_desc_61" },
{ "hud_fov", "track", 0, hint_colors.green , "video_settings_name_62", "video_settings_desc_62" },
{ "cam_inert", "track", 0, hint_colors.green , "video_settings_name_1" , "video_settings_desc_1" },
-- { "r2_sun_lumscale", "track", 0, hint_colors.green , "video_settings_name_27", "video_settings_desc_27" }, --В огсе настройка была отключена. Устанавливалась в биндере принудительно в 1
{ "r2_sun_lumscale_amb", "track", 0, hint_colors.green , "video_settings_name_28", "video_settings_desc_28", only_2_and_more_mode },
{ "r2_sun_lumscale", "track", 0, hint_colors.green , "video_settings_name_27", "video_settings_desc_27" },
-- { "r2_sun_lumscale_amb", "track", 0, hint_colors.green , "video_settings_name_28", "video_settings_desc_28", only_2_and_more_mode },
-- { "r2_sun_lumscale_hemi", "track", 0, hint_colors.green , "video_settings_name_63", "video_settings_desc_63", only_2_and_more_mode }, --Это более не нужно.
{ "r2_tf_mipbias", "track", 0, hint_colors.green , "video_settings_name_20", "video_settings_desc_20" },
-- { "r2_sun_near_border", "track", 0, hint_colors.green , "video_settings_name_23", "video_settings_desc_23", only_2_and_more_mode }, --теперь эта команда ни на что не влияет, т.ч. выключаю.
{ "r2_tonemap", "check", 0, hint_colors.green , "video_settings_name_25", "video_settings_desc_25", only_2_and_more_mode },
{ "r2_tonemap_middlegray", "track", 0, hint_colors.green , "video_settings_name_26", "video_settings_desc_26", only_2_and_more_mode },
{ "r2_rain_drops", "check", 0, hint_colors.green , "video_settings_name_47", "video_settings_desc_47", only_2a_and_more_mode },
{ "r2_actor_shadow", "check", 0, hint_colors.green , "video_settings_name_56", "", only_2a_and_more_mode },
{ "r_sslr_enable", "check", 1, hint_colors.yellow, "", "", only_4_and_more_mode },
}

local control_init_funs = {
Expand Down
Binary file modified Game/Resources_SoC_1.0006/gamedata/shaders/r3/combine_2_naa.ps
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ float gbuf_unpack_mtl( float mtl_hemi )
}

#ifndef EXTEND_F_DEFFER
f_deffer pack_gbuffer( float4 norm, float4 pos, float4 col )
f_deffer pack_gbuffer( float4 norm, float4 pos, float4 col, float4 wet )
#else
f_deffer pack_gbuffer( float4 norm, float4 pos, float4 col, uint imask )
f_deffer pack_gbuffer( float4 norm, float4 pos, float4 col, float4 wet, uint imask )
#endif
{
f_deffer res;
Expand All @@ -213,6 +213,10 @@ f_deffer pack_gbuffer( float4 norm, float4 pos, float4 col, uint imask )
res.C = col;
#endif

#ifdef SSLR_ENABLED
res.Wetness = wet;
#endif

#ifdef EXTEND_F_DEFFER
res.mask = imask;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ struct f_deffer
float4 position: SV_Target0; // px,py,pz, m-id
float4 Ne : SV_Target1; // nx,ny,nz, hemi
float4 C : SV_Target2; // r, g, b, gloss
#ifdef SSLR_ENABLED
float4 Wetness : SV_Target3; // r - puddles, gba - null
#endif

#ifdef EXTEND_F_DEFFER
uint mask : SV_COVERAGE;
#endif
Expand All @@ -313,6 +317,10 @@ struct f_deffer
{
float4 position: SV_Target0; // xy=encoded normal, z = pz, w = encoded(m-id,hemi)
float4 C : SV_Target1; // r, g, b, gloss
#ifdef SSLR_ENABLED
float4 Wetness : SV_Target2; // r - puddles, gba - null
#endif

#ifdef EXTEND_F_DEFFER
uint mask : SV_COVERAGE;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
#define GLD_P( _tc, _pos2d, _iSample ) _tc, _iSample
#endif // GBUFFER_OPTIMIZATION

// GLDO_P - gbuffer_load_data_offset
#ifdef GBUFFER_OPTIMIZATION
#define GLDO_P( _tc, _tc2, _pos2d, _iSample ) _tc, _tc2, _pos2d, _iSample
#else
#define GLDO_P( _tc, _tc2, _pos2d, _iSample ) _tc, _tc2, _iSample
#endif

/////////////////////////////////////////////////////////////////////////////
// CS_P
#ifdef USE_MSAA
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Game/Resources_SoC_1.0006/gamedata/shaders/r3/deffer_base_flat.ps
Binary file not shown.
Binary file modified Game/Resources_SoC_1.0006/gamedata/shaders/r3/deffer_impl_flat.ps
Binary file not shown.
Binary file modified Game/Resources_SoC_1.0006/gamedata/shaders/r3/deffer_particle.ps
Binary file not shown.
Binary file modified Game/Resources_SoC_1.0006/gamedata/shaders/r3/lod.ps
Binary file not shown.
Binary file not shown.
24 changes: 24 additions & 0 deletions Game/Resources_SoC_1.0006/gamedata/shaders/r3/ogsr_sslr.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function element_0(shader, t_base, t_second, t_detail)
shader:begin("stub_screen_space", "ogsr_sslr")
:fog(false)
:zb(false, false)
shader:dx10texture("s_position", "$user$position")
shader:dx10texture("s_image", "$user$generic0")
shader:dx10texture("s_normal", "$user$normal")
shader:dx10texture("s_env0", "$user$env_s0")
shader:dx10texture("s_env1", "$user$env_s1")
end

function element_1(shader, t_base, t_second, t_detail)
shader:begin("stub_screen_space", "ogsr_sslr_gauss")
:fog(false)
:zb(false, false)
shader:dx10texture("s_image", "$user$SSLR0")
end

function element_2(shader, t_base, t_second, t_detail)
shader:begin("stub_screen_space", "ogsr_sslr_gauss")
:fog(false)
:zb(false, false)
shader:dx10texture("s_image", "$user$SSLR1")
end
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions ogsr_engine/Layers/xrRender/Blender_BmmD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ void CBlender_BmmD::Compile (CBlender_Compile& C)
C.r_dx10Texture ("s_dn_b", strconcat(sizeof(mask),mask,oB_Name,"_bump") );
C.r_dx10Texture ("s_dn_a", strconcat(sizeof(mask),mask,oA_Name,"_bump") );

#if RENDER==R_R4
C.r_dx10Texture("s_puddles", "shaders\\puddles");
#endif
C.r_dx10Sampler ("smp_base");
C.r_dx10Sampler ("smp_linear");

Expand Down
89 changes: 89 additions & 0 deletions ogsr_engine/Layers/xrRender/RenderTargetPhaseSSLR.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#include "stdafx.h"

void CRenderTarget::phase_SSLR()
{
u32 Offset = 0;
constexpr float d_Z = EPS_S;
constexpr float d_W = 1.0f;
constexpr u32 C = color_rgba(0, 0, 0, 255);

// Half-pixel offset (DX9 only)
#if defined(USE_DX10) || defined(USE_DX11)
constexpr Fvector2 p0{ 0.0f, 0.0f }, p1{ 1.0f, 1.0f };
#else
Fvector2 p0, p1;
p0.set(0.5f / w, 0.5f / h);
p1.set((w + 0.5f) / w, (h + 0.5f) / h);
#endif

const u32 w = Device.dwWidth, h = Device.dwHeight;

/////////////////////////////////////////////////////////////////////////////////////
// phase SSLR
u_setrt(rt_SSLR_0, nullptr, nullptr, HW.pBaseZB);

RCache.set_CullMode(CULL_NONE);
RCache.set_Stencil(FALSE);

FVF::TL* pv = (FVF::TL*)RCache.Vertex.Lock(4, g_combine->vb_stride, Offset);
pv->set(0, float(h), d_Z, d_W, C, p0.x, p1.y); pv++;
pv->set(0, 0, d_Z, d_W, C, p0.x, p0.y); pv++;
pv->set(float(w), float(h), d_Z, d_W, C, p1.x, p1.y); pv++;
pv->set(float(w), 0, d_Z, d_W, C, p1.x, p0.y); pv++;
RCache.Vertex.Unlock(4, g_combine->vb_stride);

RCache.set_Element(s_SSLR->E[0]);

Fmatrix m_inv_v;
m_inv_v.invert(Device.mView);
RCache.set_c("m_inv_v", m_inv_v);
RCache.set_c("SSLR_params", ps_ext_SSLR_L, 1.f, 1.f, 1.f);

RCache.set_Geometry(g_combine);
RCache.Render(D3DPT_TRIANGLELIST, Offset, 0, 4, 0, 2);

if (fis_zero(ps_ext_SSLR_blur))
return;

/////////////////////////////////////////////////////////////////////////////////////
// hblur
u_setrt(rt_SSLR_1, nullptr, nullptr, HW.pBaseZB);

RCache.set_CullMode(CULL_NONE);
RCache.set_Stencil(FALSE);

pv = (FVF::TL*)RCache.Vertex.Lock(4, g_combine->vb_stride, Offset);
pv->set(0, float(h), d_Z, d_W, C, p0.x, p1.y); pv++;
pv->set(0, 0, d_Z, d_W, C, p0.x, p0.y); pv++;
pv->set(float(w), float(h), d_Z, d_W, C, p1.x, p1.y); pv++;
pv->set(float(w), 0, d_Z, d_W, C, p1.x, p0.y); pv++;
RCache.Vertex.Unlock(4, g_combine->vb_stride);

RCache.set_Element(s_SSLR->E[1]);

RCache.set_c("blur_params", ps_ext_SSLR_blur, 0.f, float(w), float(h));

RCache.set_Geometry(g_combine);
RCache.Render(D3DPT_TRIANGLELIST, Offset, 0, 4, 0, 2);

/////////////////////////////////////////////////////////////////////////////////////
// vblur
u_setrt(rt_SSLR_0, nullptr, nullptr, HW.pBaseZB);

RCache.set_CullMode(CULL_NONE);
RCache.set_Stencil(FALSE);

pv = (FVF::TL*)RCache.Vertex.Lock(4, g_combine->vb_stride, Offset);
pv->set(0, float(h), d_Z, d_W, C, p0.x, p1.y); pv++;
pv->set(0, 0, d_Z, d_W, C, p0.x, p0.y); pv++;
pv->set(float(w), float(h), d_Z, d_W, C, p1.x, p1.y); pv++;
pv->set(float(w), 0, d_Z, d_W, C, p1.x, p0.y); pv++;
RCache.Vertex.Unlock(4, g_combine->vb_stride);

RCache.set_Element(s_SSLR->E[2]);

RCache.set_c("blur_params", 0.f, ps_ext_SSLR_blur, float(w), float(h));

RCache.set_Geometry(g_combine);
RCache.Render(D3DPT_TRIANGLELIST, Offset, 0, 4, 0, 2);
}
135 changes: 58 additions & 77 deletions ogsr_engine/Layers/xrRender/SkeletonAnimated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,86 +684,67 @@ void CKinematicsAnimated::Load(const char* N, IReader *data, u32 dwFlags)
Update_LastTime = 0;

// Load animation
if (data->find_chunk(OGF_S_MOTION_REFS))
{
string_path items_nm;
data->r_stringZ (items_nm,sizeof(items_nm));
u32 set_cnt = _GetItemCount(items_nm);
R_ASSERT (set_cnt<MAX_ANIM_SLOT);
m_Motions.reserve(set_cnt);
string_path nm;
for (u32 k=0; k<set_cnt; ++k)
{
_GetItem (items_nm,k,nm);
xr_strcat (nm,".omf");
string_path fn;
if (!FS.exist(fn, "$level$", nm))
{
if (!FS.exist(fn, "$game_meshes$", nm))
{
#ifdef _EDITOR
Msg ("!Can't find motion file '%s'.",nm);
return;
#else
Debug.fatal (DEBUG_INFO,"Can't find motion file '%s'.",nm);
#endif
}
}
// Check compatibility
m_Motions.push_back (SMotionsSlot());
bool create_res = true;
if( !g_pMotionsContainer->has(nm) ) //optimize fs operations
{
IReader* MS = FS.r_open(fn);
create_res = m_Motions.back().motions.create (nm,MS,bones);
FS.r_close (MS);
}
if(create_res)
m_Motions.back().motions.create (nm,NULL,bones);
else{
m_Motions.pop_back ();
Msg ("! error in model [%s]. Unable to load motion file '%s'.", N, nm);
}
}
}else
if (data->find_chunk(OGF_S_MOTION_REFS2))
{
u32 set_cnt = data->r_u32();
m_Motions.reserve(set_cnt);
string_path nm;
for (u32 k=0; k<set_cnt; ++k)
{
data->r_stringZ (nm,sizeof(nm));
xr_strcat (nm,".omf");
string_path fn;
if (!FS.exist(fn, "$level$", nm))
{
if (!FS.exist(fn, "$game_meshes$", nm))
{
std::vector<std::string> omfs;
if ( pUserData && pUserData->section_exist( "omf_override" ) ) {
LPCSTR nm, val;
for ( u32 i = 0; pUserData->r_line( "omf_override", i ,&nm, &val ); ++i ) {
std::string s = nm;
s += ".omf";
omfs.push_back( s );
}
}
else if ( data->find_chunk( OGF_S_MOTION_REFS ) ) {
string_path items_nm;
data->r_stringZ( items_nm, sizeof( items_nm ) );
u32 set_cnt = _GetItemCount( items_nm );
for ( u32 k = 0; k < set_cnt; ++k ) {
string_path nm;
_GetItem( items_nm, k, nm );
xr_strcat( nm, ".omf" );
omfs.push_back( nm );
}
}
else if ( data->find_chunk( OGF_S_MOTION_REFS2 ) ) {
u32 set_cnt = data->r_u32();
for ( u32 k =0; k < set_cnt; ++k ) {
string_path nm;
data->r_stringZ( nm, sizeof( nm ) );
xr_strcat( nm, ".omf" );
omfs.push_back( nm );
}
}

if ( omfs.size() ) {
R_ASSERT( omfs.size() < MAX_ANIM_SLOT );
m_Motions.reserve( omfs.size() );
for ( const auto& s : omfs ) {
auto nm = s.c_str();
string_path fn;
if ( !FS.exist( fn, "$level$", nm ) ) {
if ( !FS.exist( fn, "$game_meshes$", nm ) ) {
#ifdef _EDITOR
Msg ("!Can't find motion file '%s'.",nm);
return;
Msg( "!Can't find motion file '%s'.", nm );
return;
#else
Debug.fatal (DEBUG_INFO,"Can't find motion file '%s'.",nm);
Debug.fatal( DEBUG_INFO, "Can't find motion file '%s'.", nm );
#endif
}
}
// Check compatibility
m_Motions.push_back (SMotionsSlot());
bool create_res = true;
if( !g_pMotionsContainer->has(nm) ) //optimize fs operations
{
IReader* MS = FS.r_open(fn);
create_res = m_Motions.back().motions.create (nm,MS,bones);
FS.r_close (MS);
}
if(create_res)
m_Motions.back().motions.create (nm,NULL,bones);
else{
m_Motions.pop_back ();
Msg ("! error in model [%s]. Unable to load motion file '%s'.", N, nm);
}
}
}
}
// Check compatibility
m_Motions.push_back( SMotionsSlot() );
bool create_res = true;
if ( !g_pMotionsContainer->has( nm ) ) { //optimize fs operations
IReader* MS = FS.r_open( fn );
create_res = m_Motions.back().motions.create( nm, MS, bones );
FS.r_close( MS );
}
if ( create_res )
m_Motions.back().motions.create( nm, NULL, bones );
else {
m_Motions.pop_back();
Msg( "! error in model [%s]. Unable to load motion file '%s'.", N, nm );
}
}
}else
{
string_path nm;
Expand Down
Loading

0 comments on commit 37d0720

Please sign in to comment.