2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 20:27:43 +00:00

Implement tessellation shader for HLSL

This commit is contained in:
Jack Andersen
2018-06-07 15:15:46 -10:00
parent 1456026875
commit 8f9d7da3ee
17 changed files with 403 additions and 59 deletions

View File

@@ -60,6 +60,15 @@ bool CIEKeyframeEmitter::GetValue(int frame, int& valOut) const
return false;
}
int CIEKeyframeEmitter::GetMaxValue() const
{
int maxVal = INT_MIN;
for (int k : x18_keys)
if (k > maxVal)
maxVal = k;
return maxVal;
}
bool CIEDeath::GetValue(int frame, int &valOut) const
{
x4_a->GetValue(frame, valOut);
@@ -69,6 +78,11 @@ bool CIEDeath::GetValue(int frame, int &valOut) const
return frame > b;
}
int CIEDeath::GetMaxValue() const
{
return x4_a->GetMaxValue();
}
bool CIEClamp::GetValue(int frame, int& valOut) const
{
int a, b;
@@ -82,6 +96,19 @@ bool CIEClamp::GetValue(int frame, int& valOut) const
return false;
}
int CIEClamp::GetMaxValue() const
{
int a, b, valOut;
a = x4_min->GetMaxValue();
b = x8_max->GetMaxValue();
valOut = xc_val->GetMaxValue();
if (valOut > b)
valOut = b;
if (valOut < a)
valOut = a;
return valOut;
}
bool CIETimeChain::GetValue(int frame, int& valOut) const
{
int v;
@@ -92,6 +119,11 @@ bool CIETimeChain::GetValue(int frame, int& valOut) const
return x4_a->GetValue(frame, valOut);
}
int CIETimeChain::GetMaxValue() const
{
return std::max(x8_b->GetMaxValue(), x4_a->GetMaxValue());
}
bool CIEAdd::GetValue(int frame, int& valOut) const
{
int a, b;
@@ -101,12 +133,25 @@ bool CIEAdd::GetValue(int frame, int& valOut) const
return false;
}
int CIEAdd::GetMaxValue() const
{
int a, b;
a = x4_a->GetMaxValue();
b = x8_b->GetMaxValue();
return a + b;
}
bool CIEConstant::GetValue(int frame, int& valOut) const
{
valOut = x4_val;
return false;
}
int CIEConstant::GetMaxValue() const
{
return x4_val;
}
bool CIEImpulse::GetValue(int frame, int& valOut) const
{
if (frame == 0)
@@ -116,15 +161,28 @@ bool CIEImpulse::GetValue(int frame, int& valOut) const
return false;
}
int CIEImpulse::GetMaxValue() const
{
return x4_a->GetMaxValue();
}
bool CIELifetimePercent::GetValue(int frame, int& valOut) const
{
int a;
x4_percentVal->GetValue(frame, a);
a = std::max(0, a);
valOut = (a / 100.0f) * CParticleGlobals::g_ParticleLifetimeReal;
valOut = (a / 100.0f) * CParticleGlobals::g_ParticleLifetimeReal + 0.5f;
return false;
}
int CIELifetimePercent::GetMaxValue() const
{
int a;
a = x4_percentVal->GetMaxValue();
a = std::max(0, a);
return (a / 100.0f) * 10000 + 0.5f; /* Assume 10000 frames max (not ideal estimate) */
}
bool CIEInitialRandom::GetValue(int frame, int& valOut) const
{
if (frame == 0)
@@ -137,6 +195,11 @@ bool CIEInitialRandom::GetValue(int frame, int& valOut) const
return false;
}
int CIEInitialRandom::GetMaxValue() const
{
return x8_b->GetMaxValue();
}
bool CIEPulse::GetValue(int frame, int& valOut) const
{
int a, b;
@@ -158,6 +221,10 @@ bool CIEPulse::GetValue(int frame, int& valOut) const
return false;
}
int CIEPulse::GetMaxValue() const
{
return std::max(xc_aVal->GetMaxValue(), x10_bVal->GetMaxValue());
}
bool CIEMultiply::GetValue(int frame, int& valOut) const
{
@@ -168,6 +235,11 @@ bool CIEMultiply::GetValue(int frame, int& valOut) const
return false;
}
int CIEMultiply::GetMaxValue() const
{
return x4_a->GetMaxValue() * x8_b->GetMaxValue();
}
bool CIESampleAndHold::GetValue(int frame, int& valOut) const
{
if (x8_nextSampleFrame < frame)
@@ -185,6 +257,11 @@ bool CIESampleAndHold::GetValue(int frame, int& valOut) const
return false;
}
int CIESampleAndHold::GetMaxValue() const
{
return x4_sampleSource->GetMaxValue();
}
bool CIERandom::GetValue(int frame, int& valOut) const
{
int a, b;
@@ -197,6 +274,14 @@ bool CIERandom::GetValue(int frame, int& valOut) const
return false;
}
int CIERandom::GetMaxValue() const
{
if (x4_min->GetMaxValue() > 0)
return x8_max->GetMaxValue();
else
return 65535;
}
bool CIETimeScale::GetValue(int frame, int& valOut) const
{
float a;
@@ -205,24 +290,44 @@ bool CIETimeScale::GetValue(int frame, int& valOut) const
return false;
}
int CIETimeScale::GetMaxValue() const
{
return 10000; /* Assume 10000 frames max (not ideal estimate) */
}
bool CIEGetCumulativeParticleCount::GetValue(int frame, int& valOut) const
{
valOut = CParticleGlobals::g_currentParticleSystem->x4_system->GetCumulativeParticleCount();
return false;
}
int CIEGetCumulativeParticleCount::GetMaxValue() const
{
return 256;
}
bool CIEGetActiveParticleCount::GetValue(int frame, int &valOut) const
{
valOut = CParticleGlobals::g_currentParticleSystem->x4_system->GetParticleCount();
return false;
}
int CIEGetActiveParticleCount::GetMaxValue() const
{
return 256;
}
bool CIEGetEmitterTime::GetValue(int frame, int &valOut) const
{
valOut = CParticleGlobals::g_currentParticleSystem->x4_system->GetEmitterTime();
return false;
}
int CIEGetEmitterTime::GetMaxValue() const
{
return 10000; /* Assume 10000 frames max (not ideal estimate) */
}
bool CIEModulo::GetValue(int frame, int& valOut) const
{
int a, b;
@@ -235,6 +340,17 @@ bool CIEModulo::GetValue(int frame, int& valOut) const
return false;
}
int CIEModulo::GetMaxValue() const
{
int a, b;
a = x4_a->GetMaxValue();
b = x8_b->GetMaxValue();
if (b != 0)
return b - 1;
else
return a;
}
bool CIESubtract::GetValue(int frame, int& valOut) const
{
int a, b;
@@ -244,4 +360,12 @@ bool CIESubtract::GetValue(int frame, int& valOut) const
return false;
}
int CIESubtract::GetMaxValue() const
{
int a, b;
a = x4_a->GetMaxValue();
b = x8_b->GetMaxValue();
return a - b;
}
}