Skip to content

Commit

Permalink
JPAParticle work
Browse files Browse the repository at this point in the history
  • Loading branch information
magcius committed Jul 14, 2024
1 parent 506f199 commit cf07fee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/JSystem/JParticle/JPADrawVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,13 @@ void JPADrawExecRotBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* p
MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, pt, &pt);

GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXPosition3f32((x0 * cos - y0 * sin) + pt.x, x0 + y0 + pt.y, pt.z);
GXPosition3f32((x0 * cos - y0 * sin) + pt.x, (x0 * sin + y0 * cos) + pt.y, pt.z);
GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[0].x, JPADrawContext::pcb->mTexCoordPt[0].y);
GXPosition3f32((x1 * cos - y0 * sin) + pt.x, y0 + x1 + pt.y, pt.z);
GXPosition3f32((x1 * cos - y0 * sin) + pt.x, (x1 * sin + y0 * cos) + pt.y, pt.z);
GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[1].x, JPADrawContext::pcb->mTexCoordPt[1].y);
GXPosition3f32((x1 * cos - y1 * sin) + pt.x, y1 + x1 + pt.y, pt.z);
GXPosition3f32((x1 * cos - y1 * sin) + pt.x, (x1 * sin + y1 * cos) + pt.y, pt.z);
GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[2].x, JPADrawContext::pcb->mTexCoordPt[2].y);
GXPosition3f32((x0 * cos - y1 * sin) + pt.x, y1 + x0 + pt.y, pt.z);
GXPosition3f32((x0 * cos - y1 * sin) + pt.x, (x0 * sin + y1 * cos) + pt.y, pt.z);
GXTexCoord2f32(JPADrawContext::pcb->mTexCoordPt[3].x, JPADrawContext::pcb->mTexCoordPt[3].y);
GXEnd();
}
Expand Down
15 changes: 10 additions & 5 deletions src/JSystem/JParticle/JPAParticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,24 @@ void JPABaseParticle::initParticle() {
else
velAxis.zero();

velDir.zero();
if (emtr->mInitialVelDir != 0.0f) {
Mtx mtx;
JPAGetYZRotateMtx(emtr->mSpread * emtr->getRandomSS(), emtr->getRandomSS(), mtx);
JPAGetYZRotateMtx(emtr->mSpread * emtr->getRandomRF() * 32768.0f, emtr->getRandomSS(), mtx);
MTXConcat(emtrInfo.mEmitterDirMtx, mtx, mtx);
velDir.set(mtx[0][2], mtx[1][2], mtx[2][2]);
velDir.scale(emtr->mInitialVelDir);
} else {
velDir.zero();
}

velRndm.zero();
if (emtr->mInitialVelRndm != 0.0f) {
velRndm.set(emtr->getRandomSF(), emtr->getRandomSF(), emtr->getRandomSF());
velRndm.scale(emtr->mInitialVelRndm);
velRndm.set(
emtr->mInitialVelRndm * emtr->getRandomSF(),
emtr->mInitialVelRndm * emtr->getRandomSF(),
emtr->mInitialVelRndm * emtr->getRandomSF()
);
} else {
velRndm.zero();
}

f32 velRatio = 1.0f + emtr->getRandomRF() * emtr->mInitialVelRatio;
Expand Down

0 comments on commit cf07fee

Please sign in to comment.