Fix ShotSmoke effect

This commit is contained in:
Jack Andersen 2018-02-12 12:27:40 -10:00
parent 46a4a37cc6
commit e263345b0a
6 changed files with 18 additions and 14 deletions

View File

@ -386,7 +386,7 @@ zeus::CVector2i CGraphics::ProjectPoint(const zeus::CVector3f& point)
{
zeus::CVector3f projPt = GetPerspectiveProjectionMatrix(false).multiplyOneOverW(point);
return {int(projPt.x * g_Viewport.x10_halfWidth) + int(g_Viewport.x10_halfWidth),
int(g_Viewport.x14_halfHeight) - (int(projPt.y * g_Viewport.x14_halfHeight) +
int(g_Viewport.xc_height) - (int(projPt.y * g_Viewport.x14_halfHeight) +
int(g_Viewport.x14_halfHeight))};
}
@ -406,9 +406,9 @@ SClipScreenRect CGraphics::ClipScreenRectFromVS(const zeus::CVector3f& p1,
if (p2.x == 0.f && p2.y == 0.f && p2.z == 0.f)
return {};
if (p1.y < GetProjectionState().x14_near || p2.y < GetProjectionState().x14_near)
if (-p1.z < GetProjectionState().x14_near || -p2.z < GetProjectionState().x14_near)
return {};
if (p1.y > GetProjectionState().x18_far || p2.y > GetProjectionState().x18_far)
if (-p1.z > GetProjectionState().x18_far || -p2.z > GetProjectionState().x18_far)
return {};
zeus::CVector2i sp1 = ProjectPoint(p1);

View File

@ -124,8 +124,7 @@ BOO_GLSL_BINDING_HEAD
" vec2 tindTexel = texture(tindMap, vtf.uvTind).zw;\n"
" vec4 sceneTexel = texture(sceneMap, mix(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));\n"
" vec4 texrTexel = texture(texrMap, vtf.uvTexr);\n"
" colorOut = vtf.color * sceneTexel + texrTexel;\n"
" colorOut.a = vtf.color.a * texrTexel.a;\n"
" colorOut = vtf.color * vec4(sceneTexel.rgb, 1.0) + texrTexel;\n"
"}\n";
static const char* FS_GLSL_CINDTEX =
@ -148,7 +147,7 @@ BOO_GLSL_BINDING_HEAD
"{\n"
" vec2 tindTexel = texture(tindMap, vtf.uvTind).zw;\n"
" vec4 sceneTexel = texture(sceneMap, mix(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));\n"
" colorOut = vtf.color * sceneTexel * texture(texrMap, vtf.uvTexr);\n"
" colorOut = vtf.color * vec4(sceneTexel.rgb, 1.0) * texture(texrMap, vtf.uvTexr);\n"
"}\n";
static const char* VS_GLSL_NOTEX =

View File

@ -96,7 +96,9 @@ static const char* VS_HLSL_INDTEX =
"{\n"
" VertToFrag vtf;\n"
" vtf.color = v.colorIn * moduColor;\n"
" vtf.uvScene = v.uvsInScene * float4(1.0, -1.0, 1.0, -1.0);\n"
" vtf.uvScene = v.uvsInScene;\n"
" vtf.uvScene.y = 1.0 - vtf.uvScene.y;\n"
" vtf.uvScene.w = 1.0 - vtf.uvScene.w;\n"
" vtf.uvTexr = v.uvsInTexrTind[vertId].xy;\n"
" vtf.uvTind = v.uvsInTexrTind[vertId].zw;\n"
" vtf.position = mul(mvp, v.posIn[vertId]);\n"
@ -122,7 +124,7 @@ static const char* FS_HLSL_INDTEX =
" float2 tindTexel = tex2.Sample(samp, vtf.uvTind).zw;\n"
" float4 sceneTexel = tex1.Sample(samp, lerp(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));\n"
" float4 texrTexel = tex0.Sample(samp, vtf.uvTexr);\n"
" float4 colorOut = vtf.color * sceneTexel + texrTexel;\n"
" float4 colorOut = vtf.color * float4(sceneTexel.rgb, 1.0) + texrTexel;\n"
" colorOut.a = vtf.color.a * texrTexel.a;\n"
" return colorOut;\n"
"}\n";
@ -145,7 +147,7 @@ static const char* FS_HLSL_CINDTEX =
"{\n"
" float2 tindTexel = tex2.Sample(samp, vtf.uvTind).ba;\n"
" float4 sceneTexel = tex1.Sample(samp, lerp(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));\n"
" return vtf.color * sceneTexel * tex0.Sample(samp, vtf.uvTexr);\n"
" return vtf.color * float4(sceneTexel.rgb, 1.0) * tex0.Sample(samp, vtf.uvTexr);\n"
"}\n";
static const char* VS_HLSL_NOTEX =

View File

@ -107,7 +107,9 @@ static const char* VS_METAL_INDTEX =
" VertToFrag vtf;\n"
" constant VertData& v = va[instId];\n"
" vtf.color = v.colorIn * particle.moduColor;\n"
" vtf.uvScene = v.uvsInScene * float4(1.0, -1.0, 1.0, -1.0);\n"
" vtf.uvScene = v.uvsInScene;\n"
" vtf.uvScene.y = 1.0 - vtf.uvScene.y;\n"
" vtf.uvScene.w = 1.0 - vtf.uvScene.w;\n"
" vtf.uvTexr = v.uvsInTexrTind[vertId].xy;\n"
" vtf.uvTind = v.uvsInTexrTind[vertId].zw;\n"
" vtf.position = particle.mvp * v.posIn[vertId];\n"
@ -135,7 +137,7 @@ static const char* FS_METAL_INDTEX =
" float2 tindTexel = tex2.sample(samp, vtf.uvTind).ba;\n"
" float4 sceneTexel = tex1.sample(samp, mix(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));\n"
" float4 texrTexel = tex0.sample(samp, vtf.uvTexr);\n"
" float4 colr = vtf.color * sceneTexel + texrTexel;\n"
" float4 colr = vtf.color * float4(sceneTexel.rgb, 1.0) + texrTexel;\n"
" return float4(colr.rgb, vtf.color.a * texrTexel.a);"
"}\n";
@ -159,7 +161,7 @@ static const char* FS_METAL_CINDTEX =
"{\n"
" float2 tindTexel = tex2.sample(samp, vtf.uvTind).ba;\n"
" float4 sceneTexel = tex1.sample(samp, mix(vtf.uvScene.xy, vtf.uvScene.zw, tindTexel));\n"
" return vtf.color * sceneTexel * tex0.sample(samp, vtf.uvTexr);\n"
" return vtf.color * float4(sceneTexel.rgb, 1.0) * tex0.sample(samp, vtf.uvTexr);\n"
"}\n";
static const char* VS_METAL_NOTEX =

View File

@ -117,7 +117,7 @@ void CGunWeapon::AllocResPools(CPlayerState::EBeamId beam)
for (int i=0 ; i<2 ; ++i)
{
x16c_muzzleEffects.push_back(g_SimplePool->GetObj(muzzleNames[i]));
x144_weapons.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('WPSC'), wPair[1]}));
x144_weapons.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('WPSC'), wPair[i]}));
x188_frozenEffects.push_back(g_SimplePool->GetObj(frozenNames[i]));
}
}

View File

@ -59,7 +59,8 @@ void CPowerBeam::UpdateGunFx(bool shotSmoke, float dt, const CStateManager& mgr,
case ESmokeState::Done:
if (x234_shotSmokeGen)
{
x234_shotSmokeGen->SetGlobalTranslation(x10_solidModelData->GetScaledLocatorTransform("LBEAM").origin);
zeus::CTransform locator = x10_solidModelData->GetScaledLocatorTransform("LBEAM");
x234_shotSmokeGen->SetGlobalTranslation(locator.origin);
x234_shotSmokeGen->Update(dt);
if (x240_smokeState == ESmokeState::Done && x234_shotSmokeGen->GetSystemCount() == 0)
x240_smokeState = ESmokeState::Inactive;