mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-18 10:05:24 +00:00
Reimplement CSkinRules/CSkinnedModel; skinning kinda works!
This commit is contained in:
@@ -70,8 +70,7 @@ void CRainSplashGenerator::Draw(const zeus::CTransform& xf) {
|
||||
DoDraw(xf);
|
||||
}
|
||||
|
||||
CRainSplashGenerator::SSplashLine::SSplashLine()
|
||||
: m_renderer(CLineRenderer::EPrimitiveMode::LineStrip, 3, {}, false) {}
|
||||
CRainSplashGenerator::SSplashLine::SSplashLine() : m_renderer(CLineRenderer::EPrimitiveMode::LineStrip, 3, {}, false) {}
|
||||
|
||||
CRainSplashGenerator::SRainSplash::SRainSplash() {
|
||||
for (size_t i = 0; i < x0_lines.capacity(); ++i) {
|
||||
@@ -146,16 +145,16 @@ void CRainSplashGenerator::Update(float dt, CStateManager& mgr) {
|
||||
}
|
||||
}
|
||||
|
||||
u32 CRainSplashGenerator::GetNextBestPt(u32 pt, const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn,
|
||||
CRandom16& rand, float minZ) {
|
||||
const auto& refVert = vn[pt];
|
||||
u32 CRainSplashGenerator::GetNextBestPt(u32 pt, const SSkinningWorkspace& workspace, CRandom16& rand, float minZ) {
|
||||
const auto& refVert = workspace.m_vertexWorkspace[pt];
|
||||
float maxDist = 0.f;
|
||||
u32 nextPt = pt;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
const auto idx = u32(rand.Range(0, int(vn.size() - 1)));
|
||||
const auto& vert = vn[idx];
|
||||
const float distSq = (refVert.first - vert.first).magSquared();
|
||||
if (distSq > maxDist && vert.second.dot(zeus::skUp) >= 0.f && (vert.first.z() <= 0.f || vert.first.z() > minZ)) {
|
||||
const auto idx = u32(rand.Range(0, int(workspace.m_vertexWorkspace.size() - 1)));
|
||||
const auto& vert = workspace.m_vertexWorkspace[idx];
|
||||
const auto& norm = workspace.m_normalWorkspace[idx];
|
||||
const float distSq = (refVert - vert).magSquared();
|
||||
if (distSq > maxDist && norm.dot(zeus::skUp) >= 0.f && (vert.z() <= 0.f || vert.z() > minZ)) {
|
||||
nextPt = idx;
|
||||
maxDist = distSq;
|
||||
}
|
||||
@@ -177,7 +176,7 @@ void CRainSplashGenerator::AddPoint(const zeus::CVector3f& pos) {
|
||||
x38_queueTail += 1;
|
||||
}
|
||||
|
||||
void CRainSplashGenerator::GeneratePoints(const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn) {
|
||||
void CRainSplashGenerator::GeneratePoints(const SSkinningWorkspace& workspace) {
|
||||
if (!x48_25_raining)
|
||||
return;
|
||||
|
||||
@@ -185,8 +184,8 @@ void CRainSplashGenerator::GeneratePoints(const std::vector<std::pair<zeus::CVec
|
||||
for (u32 i = 0; i < x44_genRate; ++i) {
|
||||
if (x40_queueSize >= x0_rainSplashes.size())
|
||||
break;
|
||||
x34_curPoint = GetNextBestPt(x34_curPoint, vn, x10_random, x2c_minZ);
|
||||
AddPoint(x14_scale * vn[x34_curPoint].first);
|
||||
x34_curPoint = GetNextBestPt(x34_curPoint, workspace, x10_random, x2c_minZ);
|
||||
AddPoint(x14_scale * workspace.m_vertexWorkspace[x34_curPoint]);
|
||||
}
|
||||
x20_generateTimer = 0.f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user