Skip to content

DrawBillboardStrategy improvements#137

Open
codewriter3000 wants to merge 6 commits into
doldecomp:masterfrom
codewriter3000:master
Open

DrawBillboardStrategy improvements#137
codewriter3000 wants to merge 6 commits into
doldecomp:masterfrom
codewriter3000:master

Conversation

@codewriter3000
Copy link
Copy Markdown

@codewriter3000 codewriter3000 commented May 10, 2026

I made improvements to DrawBillboardStrategy methods.

@codewriter3000 codewriter3000 changed the title DrawStrategy improvements DrawBillboardStrategy improvements May 10, 2026
@decomp-dev
Copy link
Copy Markdown

decomp-dev Bot commented May 14, 2026

Report for RSPE01_01 (167f5f6 - 6644d7a)

📈 2 improvements in unmatched items
Unit Item Bytes Before After
main/nw4r/ef/drawstrategy/ef_drawbillboardstrategy nw4r::ef::DrawBillboardStrategy::DrawYBillboard(const nw4r::ef::DrawInfo&, nw4r::ef::ParticleManager*) +1501 0.00% 79.88%
main/nw4r/ef/drawstrategy/ef_drawbillboardstrategy nw4r::ef::DrawBillboardStrategy::DrawDirectionalBillboard(const nw4r::ef::DrawInfo&, nw4r::ef::ParticleManager*) +1294 0.00% 77.03%
📉 2 regressions in unmatched items
Unit Item Bytes Before After
main/nw4r/ef/drawstrategy/ef_drawbillboardstrategy nw4r::ef::DrawBillboardStrategy::DrawNormalBillboard(const nw4r::ef::DrawInfo&, nw4r::ef::ParticleManager*) -52 88.29% 85.62%
main/nw4r/ef/drawstrategy/ef_drawbillboardstrategy .sdata2 -16 90.91% 58.33%

f32 dx0 = sx * px;
f32 dy0 = sy * py;

float exp0 = px - dx0;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float exp0 = px - dx0;
f32 exp0 = px - dx0;

f32 dy0 = sy * py;

float exp0 = px - dx0;
float exp1 = py - dy0;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
float exp1 = py - dy0;
f32 exp1 = py - dy0;

const EmitterDrawSetting& rSetting =
*pManager->mResource->GetEmitterDrawSetting();

int flags = mNumTexmap != 0;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DrawNormalBillboard does mNumTexmap > 0 ? 1 : 0, does that work here too?

pIt = pGetNextFunc(pManager, pIt)) {

if (pIt->GetLifeStatus() != 1)
continue;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we put the continue in brackets? just a style thing.
like this:

if (pIt->GetLifeStatus() != NW4R_EF_LS_ACTIVE) {
    continue;
}


f32 sx = pIt->Draw_GetSizeX();
if (sx < std::numeric_limits<f32>::epsilon())
continue;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (sx < std::numeric_limits<f32>::epsilon()) {
    continue;
}


f32 sy = pIt->Draw_GetSizeY();
if (sy < std::numeric_limits<f32>::epsilon())
continue;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (sy < std::numeric_limits<f32>::epsilon()) {
    continue;
}


f32 dirScale = 1.0f;
if (rSetting.typeDir != 0) {
const math::VEC3& v0 = *reinterpret_cast<const math::VEC3*>(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pIt is a ef::Particle*, so this access is doing pIt->mParameter.mPosition.

some functions use GetParticleParameter() to access mParameter, and store that in a temp variable for re-use, so that may also help here.

if (rSetting.typeDir != 0) {
const math::VEC3& v0 = *reinterpret_cast<const math::VEC3*>(
reinterpret_cast<const u8*>(pIt) + 0xAC);
const math::VEC3& v1 = *reinterpret_cast<const math::VEC3*>(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pIt is a ef::Particle*, so this access is doing pIt->mParameter.mPrevPosition.

for (Particle* pIt = pGetFirstFunc(pManager); pIt != NULL;
pIt = pGetNextFunc(pManager, pIt)) {

if (pIt->GetLifeStatus() != 1)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the value 1 here is NW4R_EF_LS_ACTIVE

}

f32 dirScale = 1.0f;
if (rSetting.typeDir != 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 is EmitterDrawSetting::AHEAD_BB_SPEED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants