mirror of https://github.com/PrimeDecomp/prime.git
Add several particle classes; link CParticleGlobals
Adds CModVectorElement, CParticleDataFactory, CParticleGlobals, CRealElement
CRealElement & CModVectorElement are very close to matching
Former-commit-id: bb99d88d3b
This commit is contained in:
parent
d00cfae24e
commit
8af6095198
|
@ -30,8 +30,8 @@ __dl__8IElementFPvUl:
|
|||
/* 8036CA7C 003699DC 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 8036CA80 003699E0 4E 80 00 20 */ blr
|
||||
|
||||
.global __nw__8IElementFUl
|
||||
__nw__8IElementFUl:
|
||||
.global __nw__8IElementFUlPCcPCc
|
||||
__nw__8IElementFUlPCcPCc:
|
||||
/* 8036CA84 003699E4 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 8036CA88 003699E8 7C 08 02 A6 */ mflr r0
|
||||
/* 8036CA8C 003699EC 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
|
|
|
@ -187,7 +187,7 @@ lbl_80316420:
|
|||
|
||||
.global GetValue__16CCEParticleColor
|
||||
GetValue__16CCEParticleColor:
|
||||
/* 80316438 00313398 80 8D A8 EC */ lwz r4, lbl_805A94AC@sda21(r13)
|
||||
/* 80316438 00313398 80 8D A8 EC */ lwz r4, mCurrentParticle__16CParticleGlobals@sda21(r13)
|
||||
/* 8031643C 0031339C 38 60 00 00 */ li r3, 0
|
||||
/* 80316440 003133A0 80 04 00 34 */ lwz r0, 0x34(r4)
|
||||
/* 80316444 003133A4 90 05 00 00 */ stw r0, 0(r5)
|
||||
|
|
|
@ -146,8 +146,8 @@ IsIndirectTextured__11CElementGenCFv:
|
|||
/* 80317664 003145C4 38 60 00 01 */ li r3, 1
|
||||
/* 80317668 003145C8 4E 80 00 20 */ blr
|
||||
|
||||
.global GetCEXTValue__11CElementGenCFi
|
||||
GetCEXTValue__11CElementGenCFi:
|
||||
.global GetExternalVar__11CElementGenCFi
|
||||
GetExternalVar__11CElementGenCFi:
|
||||
/* 8031766C 003145CC 54 80 10 3A */ slwi r0, r4, 2
|
||||
/* 80317670 003145D0 7C 63 02 14 */ add r3, r3, r0
|
||||
/* 80317674 003145D4 C0 23 00 9C */ lfs f1, 0x9c(r3)
|
||||
|
@ -797,7 +797,7 @@ RenderModels__11CElementGenFv:
|
|||
/* 80317F18 00314E78 BE 81 04 E0 */ stmw r20, 0x4e0(r1)
|
||||
/* 80317F1C 00314E7C 38 00 00 00 */ li r0, 0
|
||||
/* 80317F20 00314E80 7C 7E 1B 78 */ mr r30, r3
|
||||
/* 80317F24 00314E84 90 0D A8 F0 */ stw r0, lbl_805A94B0@sda21(r13)
|
||||
/* 80317F24 00314E84 90 0D A8 F0 */ stw r0, mParticleAccessParameters__16CParticleGlobals@sda21(r13)
|
||||
/* 80317F28 00314E88 88 03 02 6D */ lbz r0, 0x26d(r3)
|
||||
/* 80317F2C 00314E8C 54 00 DF FF */ rlwinm. r0, r0, 0x1b, 0x1f, 0x1f
|
||||
/* 80317F30 00314E90 41 82 00 10 */ beq lbl_80317F40
|
||||
|
@ -1122,13 +1122,13 @@ lbl_803183CC:
|
|||
/* 803183F4 00315354 48 01 23 85 */ bl SetParticleLifetime__16CParticleGlobalsFi
|
||||
/* 803183F8 00315358 7E 83 A3 78 */ mr r3, r20
|
||||
/* 803183FC 0031535C 48 01 22 81 */ bl UpdateParticleLifetimeTweenValues__16CParticleGlobalsFi
|
||||
/* 80318400 00315360 93 8D A8 EC */ stw r28, lbl_805A94AC@sda21(r13)
|
||||
/* 80318400 00315360 93 8D A8 EC */ stw r28, mCurrentParticle__16CParticleGlobals@sda21(r13)
|
||||
/* 80318404 00315364 88 1E 02 6D */ lbz r0, 0x26d(r30)
|
||||
/* 80318408 00315368 54 00 EF FF */ rlwinm. r0, r0, 0x1d, 0x1f, 0x1f
|
||||
/* 8031840C 0031536C 41 82 00 10 */ beq lbl_8031841C
|
||||
/* 80318410 00315370 80 1E 00 6C */ lwz r0, 0x6c(r30)
|
||||
/* 80318414 00315374 7C 00 D2 14 */ add r0, r0, r26
|
||||
/* 80318418 00315378 90 0D A8 F0 */ stw r0, lbl_805A94B0@sda21(r13)
|
||||
/* 80318418 00315378 90 0D A8 F0 */ stw r0, mParticleAccessParameters__16CParticleGlobals@sda21(r13)
|
||||
lbl_8031841C:
|
||||
/* 8031841C 0031537C 80 7E 00 28 */ lwz r3, 0x28(r30)
|
||||
/* 80318420 00315380 80 63 00 58 */ lwz r3, 0x58(r3)
|
||||
|
@ -6849,7 +6849,7 @@ lbl_8031D880:
|
|||
lbl_8031D890:
|
||||
/* 8031D890 0031A7F0 38 00 00 00 */ li r0, 0
|
||||
/* 8031D894 0031A7F4 3C 60 80 5A */ lis r3, sZeroVector__9CVector3f@ha
|
||||
/* 8031D898 0031A7F8 90 0D A8 F0 */ stw r0, lbl_805A94B0@sda21(r13)
|
||||
/* 8031D898 0031A7F8 90 0D A8 F0 */ stw r0, mParticleAccessParameters__16CParticleGlobals@sda21(r13)
|
||||
/* 8031D89C 0031A7FC 3B E3 66 A0 */ addi r31, r3, sZeroVector__9CVector3f@l
|
||||
/* 8031D8A0 0031A800 3B 80 00 00 */ li r28, 0
|
||||
/* 8031D8A4 0031A804 48 00 03 B8 */ b lbl_8031DC5C
|
||||
|
@ -6922,7 +6922,7 @@ lbl_8031D9A0:
|
|||
/* 8031D9A4 0031A904 48 00 CD D5 */ bl SetParticleLifetime__16CParticleGlobalsFi
|
||||
/* 8031D9A8 0031A908 38 60 00 00 */ li r3, 0
|
||||
/* 8031D9AC 0031A90C 48 00 CC D1 */ bl UpdateParticleLifetimeTweenValues__16CParticleGlobalsFi
|
||||
/* 8031D9B0 0031A910 93 CD A8 EC */ stw r30, lbl_805A94AC@sda21(r13)
|
||||
/* 8031D9B0 0031A910 93 CD A8 EC */ stw r30, mCurrentParticle__16CParticleGlobals@sda21(r13)
|
||||
/* 8031D9B4 0031A914 88 1A 02 6D */ lbz r0, 0x26d(r26)
|
||||
/* 8031D9B8 0031A918 54 00 EF FF */ rlwinm. r0, r0, 0x1d, 0x1f, 0x1f
|
||||
/* 8031D9BC 0031A91C 41 82 00 14 */ beq lbl_8031D9D0
|
||||
|
@ -7198,7 +7198,7 @@ UpdateExistingParticles__11CElementGenFv:
|
|||
/* 8031DD94 0031ACF4 80 63 00 74 */ lwz r3, 0x74(r3)
|
||||
/* 8031DD98 0031ACF8 48 00 C9 B1 */ bl SetEmitterTime__16CParticleGlobalsFi
|
||||
/* 8031DD9C 0031ACFC 38 00 00 00 */ li r0, 0
|
||||
/* 8031DDA0 0031AD00 90 0D A8 F0 */ stw r0, lbl_805A94B0@sda21(r13)
|
||||
/* 8031DDA0 0031AD00 90 0D A8 F0 */ stw r0, mParticleAccessParameters__16CParticleGlobals@sda21(r13)
|
||||
/* 8031DDA4 0031AD04 48 00 03 98 */ b lbl_8031E13C
|
||||
lbl_8031DDA8:
|
||||
/* 8031DDA8 0031AD08 80 7F 00 00 */ lwz r3, 0(r31)
|
||||
|
@ -7325,7 +7325,7 @@ lbl_8031DF38:
|
|||
/* 8031DF7C 0031AEDC D0 1F 00 0C */ stfs f0, 0xc(r31)
|
||||
/* 8031DF80 0031AEE0 80 7F 00 28 */ lwz r3, 0x28(r31)
|
||||
/* 8031DF84 0031AEE4 80 1D 00 74 */ lwz r0, 0x74(r29)
|
||||
/* 8031DF88 0031AEE8 93 ED A8 EC */ stw r31, lbl_805A94AC@sda21(r13)
|
||||
/* 8031DF88 0031AEE8 93 ED A8 EC */ stw r31, mCurrentParticle__16CParticleGlobals@sda21(r13)
|
||||
/* 8031DF8C 0031AEEC 7F C3 00 50 */ subf r30, r3, r0
|
||||
/* 8031DF90 0031AEF0 80 7F 00 28 */ lwz r3, 0x28(r31)
|
||||
/* 8031DF94 0031AEF4 80 1F 00 00 */ lwz r0, 0(r31)
|
||||
|
@ -7625,7 +7625,7 @@ UpdateAdvanceAccessParameters__11CElementGenFii:
|
|||
/* 8031E3D0 0031B330 7C 7D 1B 78 */ mr r29, r3
|
||||
/* 8031E3D4 0031B334 80 63 00 6C */ lwz r3, 0x6c(r3)
|
||||
/* 8031E3D8 0031B338 7F E3 02 14 */ add r31, r3, r0
|
||||
/* 8031E3DC 0031B33C 93 ED A8 F0 */ stw r31, lbl_805A94B0@sda21(r13)
|
||||
/* 8031E3DC 0031B33C 93 ED A8 F0 */ stw r31, mParticleAccessParameters__16CParticleGlobals@sda21(r13)
|
||||
/* 8031E3E0 0031B340 80 7D 00 28 */ lwz r3, 0x28(r29)
|
||||
/* 8031E3E4 0031B344 80 63 01 0C */ lwz r3, 0x10c(r3)
|
||||
/* 8031E3E8 0031B348 28 03 00 00 */ cmplwi r3, 0
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,15 +24,12 @@ mParticleLifetimePercentageReal__16CParticleGlobals:
|
|||
.global mParticleLifetimePercentageRemainder__16CParticleGlobals
|
||||
mParticleLifetimePercentageRemainder__16CParticleGlobals:
|
||||
.skip 0x4
|
||||
# mCurrentParticle
|
||||
.global lbl_805A94AC
|
||||
lbl_805A94AC:
|
||||
.global mCurrentParticle__16CParticleGlobals
|
||||
mCurrentParticle__16CParticleGlobals:
|
||||
.skip 0x4
|
||||
# mParticleAccessParameters
|
||||
.global lbl_805A94B0
|
||||
lbl_805A94B0:
|
||||
.global mParticleAccessParameters__16CParticleGlobals
|
||||
mParticleAccessParameters__16CParticleGlobals:
|
||||
.skip 0x4
|
||||
# mCurrentParticleSystem
|
||||
.global mCurrentParticleSystem__16CParticleGlobals
|
||||
mCurrentParticleSystem__16CParticleGlobals:
|
||||
.skip 0x4
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -536,7 +536,7 @@ GetValue__33CVEParticleSystemOrientationFrontCFiR9CVector3f:
|
|||
|
||||
.global GetValue__19CVEParticleVelocityCFiR9CVector3f
|
||||
GetValue__19CVEParticleVelocityCFiR9CVector3f:
|
||||
/* 80334D0C 00331C6C 80 8D A8 EC */ lwz r4, lbl_805A94AC@sda21(r13)
|
||||
/* 80334D0C 00331C6C 80 8D A8 EC */ lwz r4, mCurrentParticle__16CParticleGlobals@sda21(r13)
|
||||
/* 80334D10 00331C70 38 60 00 00 */ li r3, 0
|
||||
/* 80334D14 00331C74 C0 04 00 1C */ lfs f0, 0x1c(r4)
|
||||
/* 80334D18 00331C78 D0 05 00 00 */ stfs f0, 0(r5)
|
||||
|
@ -548,7 +548,7 @@ GetValue__19CVEParticleVelocityCFiR9CVector3f:
|
|||
|
||||
.global GetValue__16CVEParticleColorCFiR9CVector3f
|
||||
GetValue__16CVEParticleColorCFiR9CVector3f:
|
||||
/* 80334D30 00331C90 80 8D A8 EC */ lwz r4, lbl_805A94AC@sda21(r13)
|
||||
/* 80334D30 00331C90 80 8D A8 EC */ lwz r4, mCurrentParticle__16CParticleGlobals@sda21(r13)
|
||||
/* 80334D34 00331C94 38 60 00 00 */ li r3, 0
|
||||
/* 80334D38 00331C98 C0 04 00 10 */ lfs f0, 0x10(r4)
|
||||
/* 80334D3C 00331C9C D0 05 00 00 */ stfs f0, 0(r5)
|
||||
|
@ -560,7 +560,7 @@ GetValue__16CVEParticleColorCFiR9CVector3f:
|
|||
|
||||
.global GetValue__19CVEParticleLocationCFiR9CVector3f
|
||||
GetValue__19CVEParticleLocationCFiR9CVector3f:
|
||||
/* 80334D54 00331CB4 80 8D A8 EC */ lwz r4, lbl_805A94AC@sda21(r13)
|
||||
/* 80334D54 00331CB4 80 8D A8 EC */ lwz r4, mCurrentParticle__16CParticleGlobals@sda21(r13)
|
||||
/* 80334D58 00331CB8 38 60 00 00 */ li r3, 0
|
||||
/* 80334D5C 00331CBC C0 04 00 04 */ lfs f0, 4(r4)
|
||||
/* 80334D60 00331CC0 D0 05 00 00 */ stfs f0, 0(r5)
|
||||
|
|
|
@ -597,13 +597,13 @@ LIBS = [
|
|||
"Kyoto/Particles/CColorElement",
|
||||
"Kyoto/Particles/CElementGen",
|
||||
["Kyoto/Particles/CIntElement", True],
|
||||
"Kyoto/Particles/CModVectorElement",
|
||||
"Kyoto/Particles/CParticleDataFactory",
|
||||
["Kyoto/Particles/CModVectorElement", False],
|
||||
["Kyoto/Particles/CParticleDataFactory", False],
|
||||
"Kyoto/Particles/CParticleGen",
|
||||
"Kyoto/Particles/CParticleGlobals",
|
||||
["Kyoto/Particles/CParticleGlobals", True],
|
||||
"Kyoto/Particles/CParticleSwoosh",
|
||||
"Kyoto/Particles/CParticleSwooshDataFactory",
|
||||
"Kyoto/Particles/CRealElement",
|
||||
["Kyoto/Particles/CRealElement", False],
|
||||
"Kyoto/Particles/CSpawnSystemKeyframeData",
|
||||
"Kyoto/Particles/CUVElement",
|
||||
"Kyoto/Particles/CVectorElement",
|
||||
|
|
|
@ -6,11 +6,22 @@
|
|||
namespace CBasics {
|
||||
void Init();
|
||||
char* Stringize(const char* fmt, ...);
|
||||
inline void SwapBytes(uchar* v) {}
|
||||
inline float SwapBytes(float f) {
|
||||
u8* tmp = reinterpret_cast<u8*>(&f);
|
||||
SwapBytes(tmp);
|
||||
return *reinterpret_cast<float*>(tmp);
|
||||
inline uint SwapBytes(uint x) {
|
||||
#if 0
|
||||
x = ((x << 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x >> 24));
|
||||
#endif
|
||||
return x;
|
||||
}
|
||||
inline float SwapBytes(float x) {
|
||||
union {
|
||||
float f;
|
||||
uint u;
|
||||
};
|
||||
f = x;
|
||||
#if 0
|
||||
u = SwapBytes(u);
|
||||
#endif
|
||||
return f;
|
||||
}
|
||||
}; // namespace CBasics
|
||||
|
||||
|
|
|
@ -32,10 +32,10 @@ public:
|
|||
static uint Lerp(uint a, uint b, float t);
|
||||
static CColor Modulate(const CColor& a, const CColor& b);
|
||||
static CColor Add(const CColor& a, const CColor& b);
|
||||
float GetRed() const { return CCast::ToReal32(mR) * (1 / 255.f); }
|
||||
float GetGreen() const { return CCast::ToReal32(mG) * (1 / 255.f); }
|
||||
float GetBlue() const { return CCast::ToReal32(mB) * (1 / 255.f); }
|
||||
float GetAlpha() const { return CCast::ToReal32(mA) * (1 / 255.f); }
|
||||
float GetRed() const { return CCast::ToReal32(mR) * (1.f / 255.f); }
|
||||
float GetGreen() const { return CCast::ToReal32(mG) * (1.f / 255.f); }
|
||||
float GetBlue() const { return CCast::ToReal32(mB) * (1.f / 255.f); }
|
||||
float GetAlpha() const { return CCast::ToReal32(mA) * (1.f / 255.f); }
|
||||
uchar GetRedu8() const { return mR; }
|
||||
uchar GetGreenu8() const { return mG; }
|
||||
uchar GetBlueu8() const { return mB; }
|
||||
|
|
|
@ -75,13 +75,13 @@ public:
|
|||
mZ -= other.mZ;
|
||||
return *this;
|
||||
}
|
||||
CVector3f& operator*=(float v) {
|
||||
CVector3f& operator*=(const float v) {
|
||||
mX *= v;
|
||||
mY *= v;
|
||||
mZ *= v;
|
||||
return *this;
|
||||
}
|
||||
CVector3f& operator/=(float v) {
|
||||
CVector3f& operator/=(const float v) {
|
||||
mX /= v;
|
||||
mY /= v;
|
||||
mZ /= v;
|
||||
|
@ -137,21 +137,21 @@ inline CVector3f operator+(const CVector3f& lhs, const CVector3f& rhs) {
|
|||
float z = lhs.GetZ() + rhs.GetZ();
|
||||
return CVector3f(x, y, z);
|
||||
}
|
||||
inline CVector3f operator*(const CVector3f& vec, float f) {
|
||||
inline CVector3f operator*(const CVector3f& vec, const float f) {
|
||||
float x = vec.GetX() * f;
|
||||
float y = vec.GetY() * f;
|
||||
float z = vec.GetZ() * f;
|
||||
return CVector3f(x, y, z);
|
||||
}
|
||||
|
||||
inline CVector3f operator*(float f, const CVector3f& vec) {
|
||||
inline CVector3f operator*(const float f, const CVector3f& vec) {
|
||||
float x = f * vec.GetX();
|
||||
float y = f * vec.GetY();
|
||||
float z = f * vec.GetZ();
|
||||
return CVector3f(x, y, z);
|
||||
}
|
||||
|
||||
inline CVector3f operator/(const CVector3f& vec, float f) {
|
||||
inline CVector3f operator/(const CVector3f& vec, const float f) {
|
||||
float x = vec.GetX() / f;
|
||||
float y = vec.GetY() / f;
|
||||
float z = vec.GetZ() / f;
|
||||
|
|
|
@ -3,16 +3,15 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
#include "Kyoto/CRandom16.hpp"
|
||||
#include "Kyoto/Math/CMatrix3f.hpp"
|
||||
#include "Kyoto/Math/CTransform4f.hpp"
|
||||
#include "Kyoto/Math/CVector3f.hpp"
|
||||
#include "Kyoto/Particles/CParticleGen.hpp"
|
||||
#include "Kyoto/TToken.hpp"
|
||||
#include "Kyoto/CRandom16.hpp"
|
||||
|
||||
class CGenDescription;
|
||||
class CModVectorElement;
|
||||
class CParticle;
|
||||
|
||||
class CElementGen : public CParticleGen {
|
||||
public:
|
||||
|
@ -31,6 +30,16 @@ public:
|
|||
kLT_Directional = 2,
|
||||
kLT_Spot = 3,
|
||||
};
|
||||
struct CParticle {
|
||||
int x0_endFrame;
|
||||
CVector3f x4_pos;
|
||||
CVector3f x10_prevPos;
|
||||
CVector3f x1c_vel;
|
||||
int x28_startFrame;
|
||||
float x2c_lineLengthOrSize;
|
||||
float x30_lineWidthOrRota;
|
||||
CColor x34_color;
|
||||
};
|
||||
|
||||
CElementGen(TToken< CGenDescription >, EModelOrientationType = kMOT_Normal,
|
||||
EOptionalSystemFlags = kOSF_One);
|
||||
|
@ -66,6 +75,7 @@ public:
|
|||
int GetEmitterTime() const;
|
||||
|
||||
int GetCumulativeParticleCount() const { return x260_cumulativeParticles; }
|
||||
float GetExternalVar(int index) const;
|
||||
|
||||
static void Initialize();
|
||||
static void ShutDown();
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include "Kyoto/Particles/IElement.hpp"
|
||||
|
||||
#include "rstl/single_ptr.hpp"
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
class CInputStream;
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
#ifndef _CMODVECTORELEMENT
|
||||
#define _CMODVECTORELEMENT
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "Kyoto/Math/CVector3f.hpp"
|
||||
#include "Kyoto/Particles/IElement.hpp"
|
||||
|
||||
class CMVEConstant : public CModVectorElement {
|
||||
CRealElement* x4_x;
|
||||
CRealElement* x8_y;
|
||||
CRealElement* xc_z;
|
||||
|
||||
public:
|
||||
CMVEConstant(CRealElement* a, CRealElement* b, CRealElement* c);
|
||||
~CMVEConstant() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVEFastConstant : public CModVectorElement {
|
||||
CVector3f x4_val;
|
||||
|
||||
public:
|
||||
CMVEFastConstant(float a, float b, float c);
|
||||
~CMVEFastConstant() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVEGravity : public CModVectorElement {
|
||||
CVectorElement* x4_a;
|
||||
|
||||
public:
|
||||
CMVEGravity(CVectorElement* a);
|
||||
~CMVEGravity() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVEWind : public CModVectorElement {
|
||||
CVectorElement* x4_velocity;
|
||||
CRealElement* x8_factor;
|
||||
|
||||
public:
|
||||
CMVEWind(CVectorElement* velocity, CRealElement* factor);
|
||||
~CMVEWind() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVEExplode : public CModVectorElement {
|
||||
CRealElement* x4_a;
|
||||
CRealElement* x8_b;
|
||||
|
||||
public:
|
||||
CMVEExplode(CRealElement* a, CRealElement* b);
|
||||
~CMVEExplode() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVETimeChain : public CModVectorElement {
|
||||
CModVectorElement* x4_a;
|
||||
CModVectorElement* x8_b;
|
||||
CIntElement* xc_swFrame;
|
||||
|
||||
public:
|
||||
CMVETimeChain(CModVectorElement* a, CModVectorElement* b, CIntElement* c);
|
||||
~CMVETimeChain() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVEPulse : public CModVectorElement {
|
||||
CIntElement* x4_aDuration;
|
||||
CIntElement* x8_bDuration;
|
||||
CModVectorElement* xc_aVal;
|
||||
CModVectorElement* x10_bVal;
|
||||
|
||||
public:
|
||||
CMVEPulse(CIntElement* a, CIntElement* b, CModVectorElement* c, CModVectorElement* d);
|
||||
~CMVEPulse() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVEImplosion : public CModVectorElement {
|
||||
CVectorElement* x4_implPoint;
|
||||
CRealElement* x8_magScale;
|
||||
CRealElement* xc_maxMag;
|
||||
CRealElement* x10_minMag;
|
||||
bool x14_enableMinMag;
|
||||
|
||||
public:
|
||||
CMVEImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d, bool e);
|
||||
~CMVEImplosion() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVELinearImplosion : public CModVectorElement {
|
||||
CVectorElement* x4_implPoint;
|
||||
CRealElement* x8_magScale;
|
||||
CRealElement* xc_maxMag;
|
||||
CRealElement* x10_minMag;
|
||||
bool x14_enableMinMag;
|
||||
|
||||
public:
|
||||
CMVELinearImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d, bool e);
|
||||
~CMVELinearImplosion() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVEExponentialImplosion : public CModVectorElement {
|
||||
CVectorElement* x4_implPoint;
|
||||
CRealElement* x8_magScale;
|
||||
CRealElement* xc_maxMag;
|
||||
CRealElement* x10_minMag;
|
||||
bool x14_enableMinMag;
|
||||
|
||||
public:
|
||||
CMVEExponentialImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d,
|
||||
bool e);
|
||||
~CMVEExponentialImplosion() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVESwirl : public CModVectorElement {
|
||||
CVectorElement* x4_helixPoint;
|
||||
CVectorElement* x8_curveBinormal;
|
||||
CRealElement* xc_filterGain;
|
||||
CRealElement* x10_tangentialVelocity;
|
||||
|
||||
public:
|
||||
CMVESwirl(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d);
|
||||
~CMVESwirl() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVEBounce : public CModVectorElement {
|
||||
CVectorElement* x4_planePoint;
|
||||
CVectorElement* x8_planeNormal;
|
||||
CRealElement* xc_friction;
|
||||
CRealElement* x10_restitution;
|
||||
bool x14_planePrecomputed;
|
||||
bool x15_dieOnPenetrate;
|
||||
mutable CVector3f x18_planeValidatedNormal;
|
||||
mutable float x24_planeD;
|
||||
|
||||
public:
|
||||
CMVEBounce(CVectorElement* planePoint, CVectorElement* planeNormal, CRealElement* friction,
|
||||
CRealElement* restitution, bool e);
|
||||
~CMVEBounce() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
class CMVESetPosition : public CModVectorElement {
|
||||
CVectorElement* x4_a;
|
||||
|
||||
public:
|
||||
CMVESetPosition(CVectorElement* a);
|
||||
~CMVESetPosition() override;
|
||||
bool GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const override;
|
||||
};
|
||||
|
||||
#endif // _CMODVECTORELEMENT
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef _CPARTICLEDATAFACTORY
|
||||
#define _CPARTICLEDATAFACTORY
|
||||
|
||||
#include "Kyoto/Particles/IElement.hpp"
|
||||
#include "Kyoto/SObjectTag.hpp"
|
||||
|
||||
class CInputStream;
|
||||
|
||||
class CParticleDataFactory {
|
||||
static CUVElement* GetTextureElement(CInputStream& in, CSimplePool* resPool);
|
||||
static CColorElement* GetColorElement(CInputStream& in);
|
||||
static CModVectorElement* GetModVectorElement(CInputStream& in);
|
||||
static CEmitterElement* GetEmitterElement(CInputStream& in);
|
||||
static CVectorElement* GetVectorElement(CInputStream& in);
|
||||
static CRealElement* GetRealElement(CInputStream& in);
|
||||
static CIntElement* GetIntElement(CInputStream& in);
|
||||
|
||||
static float GetReal(CInputStream& in);
|
||||
static int GetInt(CInputStream& in);
|
||||
static bool GetBool(CInputStream& in);
|
||||
static FourCC GetClassID(CInputStream& in);
|
||||
};
|
||||
|
||||
#endif // _CPARTICLEDATAFACTORY
|
|
@ -4,8 +4,7 @@
|
|||
#include "types.h"
|
||||
|
||||
#include "Kyoto/SObjectTag.hpp"
|
||||
|
||||
class CElementGen;
|
||||
#include "Kyoto/Particles/CElementGen.hpp"
|
||||
|
||||
class CParticleGlobals {
|
||||
public:
|
||||
|
@ -27,6 +26,8 @@ public:
|
|||
static float GetParticleLifetimePercentageRemainder() {
|
||||
return mParticleLifetimePercentageRemainder;
|
||||
}
|
||||
static CElementGen::CParticle* GetCurrentParticle() { return mCurrentParticle; }
|
||||
static float* GetParticleAccessParameters() { return mParticleAccessParameters; }
|
||||
static SParticleSystem* GetCurrentParticleSystem() { return mCurrentParticleSystem; }
|
||||
|
||||
private:
|
||||
|
@ -37,6 +38,8 @@ private:
|
|||
static int mParticleLifetimePercentage;
|
||||
static float mParticleLifetimePercentageReal;
|
||||
static float mParticleLifetimePercentageRemainder;
|
||||
static CElementGen::CParticle* mCurrentParticle;
|
||||
static float* mParticleAccessParameters;
|
||||
static SParticleSystem* mCurrentParticleSystem;
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,368 @@
|
|||
#ifndef _CREALELEMENT
|
||||
#define _CREALELEMENT
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include "Kyoto/Particles/IElement.hpp"
|
||||
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
class CREConstant : public CRealElement {
|
||||
float x4_val;
|
||||
|
||||
public:
|
||||
CREConstant(float val);
|
||||
~CREConstant() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
bool IsConstant() const override { return true; }
|
||||
};
|
||||
|
||||
class CRESineWave : public CRealElement {
|
||||
CRealElement* x4_frequency;
|
||||
CRealElement* x8_amplitude;
|
||||
CRealElement* xc_phase;
|
||||
|
||||
public:
|
||||
CRESineWave(CRealElement* a, CRealElement* b, CRealElement* c);
|
||||
~CRESineWave() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CRETimeScale : public CRealElement {
|
||||
CRealElement* x4_a;
|
||||
|
||||
public:
|
||||
CRETimeScale(CRealElement* a);
|
||||
~CRETimeScale() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREAdd : public CRealElement {
|
||||
CRealElement* x4_a;
|
||||
CRealElement* x8_b;
|
||||
|
||||
public:
|
||||
CREAdd(CRealElement* a, CRealElement* b);
|
||||
~CREAdd() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREMultiply : public CRealElement {
|
||||
CRealElement* x4_a;
|
||||
CRealElement* x8_b;
|
||||
|
||||
public:
|
||||
CREMultiply(CRealElement* a, CRealElement* b);
|
||||
~CREMultiply() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREDotProduct : public CRealElement {
|
||||
CVectorElement* x4_a;
|
||||
CVectorElement* x8_b;
|
||||
|
||||
public:
|
||||
CREDotProduct(CVectorElement* a, CVectorElement* b);
|
||||
~CREDotProduct() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CRERandom : public CRealElement {
|
||||
CRealElement* x4_min;
|
||||
CRealElement* x8_max;
|
||||
|
||||
public:
|
||||
CRERandom(CRealElement* min, CRealElement* max);
|
||||
~CRERandom() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREInitialRandom : public CRealElement {
|
||||
CRealElement* x4_min;
|
||||
CRealElement* x8_max;
|
||||
|
||||
public:
|
||||
CREInitialRandom(CRealElement* min, CRealElement* max);
|
||||
~CREInitialRandom() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
bool IsConstant() const override { return true; }
|
||||
};
|
||||
|
||||
class CRETimeChain : public CRealElement {
|
||||
CRealElement* x4_a;
|
||||
CRealElement* x8_b;
|
||||
CIntElement* xc_swFrame;
|
||||
|
||||
public:
|
||||
CRETimeChain(CRealElement* a, CRealElement* b, CIntElement* c);
|
||||
~CRETimeChain() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREClamp : public CRealElement {
|
||||
CRealElement* x4_min;
|
||||
CRealElement* x8_max;
|
||||
CRealElement* xc_val;
|
||||
|
||||
public:
|
||||
CREClamp(CRealElement* a, CRealElement* b, CRealElement* c);
|
||||
~CREClamp() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREPulse : public CRealElement {
|
||||
CIntElement* x4_aDuration;
|
||||
CIntElement* x8_bDuration;
|
||||
CRealElement* xc_valA;
|
||||
CRealElement* x10_valB;
|
||||
|
||||
public:
|
||||
CREPulse(CIntElement* a, CIntElement* b, CRealElement* c, CRealElement* d);
|
||||
~CREPulse() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CRELifetimePercent : public CRealElement {
|
||||
CRealElement* x4_percentVal;
|
||||
|
||||
public:
|
||||
CRELifetimePercent(CRealElement* a); // : x4_percentVal(a) {}
|
||||
~CRELifetimePercent() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CRELifetimeTween : public CRealElement {
|
||||
CRealElement* x4_a;
|
||||
CRealElement* x8_b;
|
||||
|
||||
public:
|
||||
CRELifetimeTween(CRealElement* a, CRealElement* b);
|
||||
~CRELifetimeTween() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREKeyframeEmitter : public CRealElement {
|
||||
int x4_percent;
|
||||
int x8_unk1;
|
||||
bool xc_loop;
|
||||
bool xd_unk2;
|
||||
int x10_loopEnd;
|
||||
int x14_loopStart;
|
||||
rstl::vector< float > x18_keys;
|
||||
|
||||
public:
|
||||
CREKeyframeEmitter(CInputStream& in);
|
||||
~CREKeyframeEmitter() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREParticleAccessParameter1 : public CRealElement {
|
||||
public:
|
||||
~CREParticleAccessParameter1() override {}
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREParticleAccessParameter2 : public CRealElement {
|
||||
public:
|
||||
~CREParticleAccessParameter2() override {}
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREParticleAccessParameter3 : public CRealElement {
|
||||
public:
|
||||
~CREParticleAccessParameter3() override {}
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREParticleAccessParameter4 : public CRealElement {
|
||||
public:
|
||||
~CREParticleAccessParameter4() override {}
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREParticleAccessParameter5 : public CRealElement {
|
||||
public:
|
||||
~CREParticleAccessParameter5() override {}
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREParticleAccessParameter6 : public CRealElement {
|
||||
public:
|
||||
~CREParticleAccessParameter6() override {}
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREParticleAccessParameter7 : public CRealElement {
|
||||
public:
|
||||
~CREParticleAccessParameter7() override {}
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREParticleAccessParameter8 : public CRealElement {
|
||||
public:
|
||||
~CREParticleAccessParameter8() override {}
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREParticleSizeOrLineLength : public CRealElement {
|
||||
public:
|
||||
~CREParticleSizeOrLineLength() override {}
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREParticleRotationOrLineWidth : public CRealElement {
|
||||
public:
|
||||
~CREParticleRotationOrLineWidth() override {}
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREVectorXToReal : public CRealElement {
|
||||
CVectorElement* x4_a;
|
||||
|
||||
public:
|
||||
CREVectorXToReal(CVectorElement* a);
|
||||
~CREVectorXToReal() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREVectorYToReal : public CRealElement {
|
||||
CVectorElement* x4_a;
|
||||
|
||||
public:
|
||||
CREVectorYToReal(CVectorElement* a);
|
||||
~CREVectorYToReal() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREVectorZToReal : public CRealElement {
|
||||
CVectorElement* x4_a;
|
||||
|
||||
public:
|
||||
CREVectorZToReal(CVectorElement* a);
|
||||
~CREVectorZToReal() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREVectorMagnitude : public CRealElement {
|
||||
CVectorElement* x4_a;
|
||||
|
||||
public:
|
||||
CREVectorMagnitude(CVectorElement* a);
|
||||
~CREVectorMagnitude() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREInitialSwitch : public CRealElement {
|
||||
CRealElement* x4_a;
|
||||
CRealElement* x8_b;
|
||||
|
||||
public:
|
||||
CREInitialSwitch(CRealElement* a, CRealElement* b);
|
||||
~CREInitialSwitch() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CRECompareLessThan : public CRealElement {
|
||||
CRealElement* x4_a;
|
||||
CRealElement* x8_b;
|
||||
CRealElement* xc_c;
|
||||
CRealElement* x10_d;
|
||||
|
||||
public:
|
||||
CRECompareLessThan(CRealElement* a, CRealElement* b, CRealElement* c, CRealElement* d);
|
||||
~CRECompareLessThan() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CRECompareEqual : public CRealElement {
|
||||
CRealElement* x4_a;
|
||||
CRealElement* x8_b;
|
||||
CRealElement* xc_c;
|
||||
CRealElement* x10_d;
|
||||
|
||||
public:
|
||||
CRECompareEqual(CRealElement* a, CRealElement* b, CRealElement* c, CRealElement* d);
|
||||
~CRECompareEqual() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREConstantRange : public CRealElement {
|
||||
CRealElement* x4_val;
|
||||
CRealElement* x8_min;
|
||||
CRealElement* xc_max;
|
||||
CRealElement* x10_inRange;
|
||||
CRealElement* x14_outOfRange;
|
||||
|
||||
public:
|
||||
CREConstantRange(CRealElement* a, CRealElement* b, CRealElement* c, CRealElement* d,
|
||||
CRealElement* e);
|
||||
~CREConstantRange() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREExternalVar : public CRealElement {
|
||||
CIntElement* x4_a;
|
||||
|
||||
public:
|
||||
CREExternalVar(CIntElement* a);
|
||||
~CREExternalVar() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CRESubtract : public CRealElement {
|
||||
CRealElement* x4_a;
|
||||
CRealElement* x8_b;
|
||||
|
||||
public:
|
||||
CRESubtract(CRealElement* a, CRealElement* b);
|
||||
~CRESubtract() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREGetComponentRed : public CRealElement {
|
||||
CColorElement* x4_a;
|
||||
|
||||
public:
|
||||
CREGetComponentRed(CColorElement* a);
|
||||
~CREGetComponentRed() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREGetComponentGreen : public CRealElement {
|
||||
CColorElement* x4_a;
|
||||
|
||||
public:
|
||||
CREGetComponentGreen(CColorElement* a);
|
||||
~CREGetComponentGreen() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREGetComponentBlue : public CRealElement {
|
||||
CColorElement* x4_a;
|
||||
|
||||
public:
|
||||
CREGetComponentBlue(CColorElement* a);
|
||||
~CREGetComponentBlue() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREGetComponentAlpha : public CRealElement {
|
||||
CColorElement* x4_a;
|
||||
|
||||
public:
|
||||
CREGetComponentAlpha(CColorElement* a);
|
||||
~CREGetComponentAlpha() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
class CREIntTimesReal : public CRealElement {
|
||||
CIntElement* x4_a;
|
||||
CRealElement* x8_b;
|
||||
|
||||
public:
|
||||
CREIntTimesReal(CIntElement* a, CRealElement* b);
|
||||
~CREIntTimesReal() override;
|
||||
bool GetValue(int frame, float& valOut) const override;
|
||||
};
|
||||
|
||||
#endif // _CREALELEMENT
|
|
@ -14,7 +14,8 @@ public:
|
|||
virtual ~IElement(){};
|
||||
|
||||
// -> CFrameDelayedKiller
|
||||
void* operator new(unsigned long sz);
|
||||
void* operator new(unsigned long sz, const char*, const char*);
|
||||
void* operator new(unsigned long sz) { return operator new(sz, "??(??)", nullptr); }
|
||||
void operator delete(void* ptr, size_t sz);
|
||||
};
|
||||
|
||||
|
|
|
@ -539,7 +539,7 @@ KYOTO_1 :=\
|
|||
$(BUILD_DIR)/asm/Kyoto/Particles/CModVectorElement.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Particles/CParticleDataFactory.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Particles/CParticleGen.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Particles/CParticleGlobals.o\
|
||||
$(BUILD_DIR)/src/Kyoto/Particles/CParticleGlobals.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Particles/CParticleSwoosh.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Particles/CParticleSwooshDataFactory.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Particles/CRealElement.o\
|
||||
|
|
|
@ -0,0 +1,371 @@
|
|||
#include "Kyoto/Particles/CModVectorElement.hpp"
|
||||
|
||||
#include "Kyoto/CRandom16.hpp"
|
||||
|
||||
CMVEConstant::CMVEConstant(CRealElement* a, CRealElement* b, CRealElement* c)
|
||||
: x4_x(a), x8_y(b), xc_z(c) {}
|
||||
|
||||
CMVEConstant::~CMVEConstant() {
|
||||
delete x4_x;
|
||||
delete x8_y;
|
||||
delete xc_z;
|
||||
}
|
||||
|
||||
bool CMVEConstant::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
float x, y, z;
|
||||
x4_x->GetValue(frame, x);
|
||||
x8_y->GetValue(frame, y);
|
||||
xc_z->GetValue(frame, z);
|
||||
pVel = CVector3f(x, y, z);
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVEFastConstant::CMVEFastConstant(float a, float b, float c) : x4_val(a, b, c) {}
|
||||
|
||||
CMVEFastConstant::~CMVEFastConstant() {}
|
||||
|
||||
bool CMVEFastConstant::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
pVel = x4_val;
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVEGravity::CMVEGravity(CVectorElement* a) : x4_a(a) {}
|
||||
|
||||
CMVEGravity::~CMVEGravity() { delete x4_a; }
|
||||
|
||||
bool CMVEGravity::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
CVector3f grav(0.f, 0.f, 0.f);
|
||||
x4_a->GetValue(frame, grav);
|
||||
pVel += grav;
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVEWind::CMVEWind(CVectorElement* velocity, CRealElement* factor)
|
||||
: x4_velocity(velocity), x8_factor(factor) {}
|
||||
|
||||
CMVEWind::~CMVEWind() {
|
||||
delete x4_velocity;
|
||||
delete x8_factor;
|
||||
}
|
||||
|
||||
bool CMVEWind::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
CVector3f wVel(0.f, 0.f, 0.f);
|
||||
x4_velocity->GetValue(frame, wVel);
|
||||
CVector3f diff = wVel - pVel;
|
||||
float factor;
|
||||
x8_factor->GetValue(frame, factor);
|
||||
diff *= factor;
|
||||
pVel += diff;
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVEExplode::CMVEExplode(CRealElement* a, CRealElement* b) : x4_a(a), x8_b(b) {}
|
||||
|
||||
CMVEExplode::~CMVEExplode() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
}
|
||||
|
||||
bool CMVEExplode::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
if (frame == 0) {
|
||||
float x, y, z;
|
||||
do {
|
||||
x = CRandom16::GetRandomNumber()->Float() - 0.5f;
|
||||
y = CRandom16::GetRandomNumber()->Float() - 0.5f;
|
||||
z = CRandom16::GetRandomNumber()->Float() - 0.5f;
|
||||
} while (x * x + y * y + z * z > 1.f);
|
||||
float a;
|
||||
x4_a->GetValue(frame, a);
|
||||
CVector3f vec(x, y, z);
|
||||
vec.Normalize();
|
||||
vec *= a;
|
||||
pVel = vec;
|
||||
} else {
|
||||
float b;
|
||||
x8_b->GetValue(frame, b);
|
||||
pVel *= b;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVETimeChain::CMVETimeChain(CModVectorElement* a, CModVectorElement* b, CIntElement* c)
|
||||
: x4_a(a), x8_b(b), xc_swFrame(c) {}
|
||||
|
||||
CMVETimeChain::~CMVETimeChain() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
delete xc_swFrame;
|
||||
}
|
||||
|
||||
bool CMVETimeChain::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
int v;
|
||||
xc_swFrame->GetValue(frame, v);
|
||||
if (frame < v) {
|
||||
return x4_a->GetValue(frame, pVel, pPos);
|
||||
} else {
|
||||
return x8_b->GetValue(frame - v, pVel, pPos);
|
||||
}
|
||||
}
|
||||
|
||||
CMVEPulse::CMVEPulse(CIntElement* a, CIntElement* b, CModVectorElement* c, CModVectorElement* d)
|
||||
: x4_aDuration(a), x8_bDuration(b), xc_aVal(c), x10_bVal(d) {}
|
||||
|
||||
CMVEPulse::~CMVEPulse() {
|
||||
delete x4_aDuration;
|
||||
delete x8_bDuration;
|
||||
delete xc_aVal;
|
||||
delete x10_bVal;
|
||||
}
|
||||
|
||||
bool CMVEPulse::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
int a, b;
|
||||
x4_aDuration->GetValue(frame, a);
|
||||
x8_bDuration->GetValue(frame, b);
|
||||
int cv = a + b + 1;
|
||||
if (cv < 0) {
|
||||
cv = 1;
|
||||
}
|
||||
|
||||
if (b >= 1) {
|
||||
if (frame % cv > a) {
|
||||
x10_bVal->GetValue(frame, pVel, pPos);
|
||||
} else {
|
||||
xc_aVal->GetValue(frame, pVel, pPos);
|
||||
}
|
||||
} else {
|
||||
xc_aVal->GetValue(frame, pVel, pPos);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVEImplosion::CMVEImplosion(CVectorElement* a, CRealElement* b, CRealElement* c, CRealElement* d,
|
||||
bool e)
|
||||
: x4_implPoint(a), x8_magScale(b), xc_maxMag(c), x10_minMag(d), x14_enableMinMag(e) {}
|
||||
|
||||
CMVEImplosion::~CMVEImplosion() {
|
||||
delete x4_implPoint;
|
||||
delete x8_magScale;
|
||||
delete xc_maxMag;
|
||||
delete x10_minMag;
|
||||
}
|
||||
|
||||
bool CMVEImplosion::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
CVector3f av(0.f, 0.f, 0.f);
|
||||
x4_implPoint->GetValue(frame, av);
|
||||
|
||||
CVector3f dv = av - pPos;
|
||||
float dvm = dv.Magnitude();
|
||||
|
||||
float c;
|
||||
xc_maxMag->GetValue(frame, c);
|
||||
if (dvm > c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float d;
|
||||
x10_minMag->GetValue(frame, d);
|
||||
if (x14_enableMinMag && dvm < d) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dvm == 0.f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CVector3f dvs = (1.f / dvm) * dv;
|
||||
float b;
|
||||
x8_magScale->GetValue(frame, b);
|
||||
pVel += b * dvs;
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVELinearImplosion::CMVELinearImplosion(CVectorElement* a, CRealElement* b, CRealElement* c,
|
||||
CRealElement* d, bool e)
|
||||
: x4_implPoint(a), x8_magScale(b), xc_maxMag(c), x10_minMag(d), x14_enableMinMag(e) {}
|
||||
|
||||
CMVELinearImplosion::~CMVELinearImplosion() {
|
||||
delete x4_implPoint;
|
||||
delete x8_magScale;
|
||||
delete xc_maxMag;
|
||||
delete x10_minMag;
|
||||
}
|
||||
|
||||
bool CMVELinearImplosion::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
CVector3f av(0.f, 0.f, 0.f);
|
||||
x4_implPoint->GetValue(frame, av);
|
||||
|
||||
CVector3f dv = av - pPos;
|
||||
float dvm = dv.Magnitude();
|
||||
|
||||
float c;
|
||||
xc_maxMag->GetValue(frame, c);
|
||||
if (dvm > c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float d;
|
||||
x10_minMag->GetValue(frame, d);
|
||||
if (x14_enableMinMag && dvm < d) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dvm == 0.f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CVector3f dvs = (1.f / dvm) * dv;
|
||||
float b;
|
||||
x8_magScale->GetValue(frame, b);
|
||||
pVel = b * dvs;
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVEExponentialImplosion::CMVEExponentialImplosion(CVectorElement* a, CRealElement* b,
|
||||
CRealElement* c, CRealElement* d, bool e)
|
||||
: x4_implPoint(a), x8_magScale(b), xc_maxMag(c), x10_minMag(d), x14_enableMinMag(e) {}
|
||||
|
||||
CMVEExponentialImplosion::~CMVEExponentialImplosion() {
|
||||
delete x4_implPoint;
|
||||
delete x8_magScale;
|
||||
delete xc_maxMag;
|
||||
delete x10_minMag;
|
||||
}
|
||||
|
||||
bool CMVEExponentialImplosion::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
CVector3f av(0.f, 0.f, 0.f);
|
||||
x4_implPoint->GetValue(frame, av);
|
||||
|
||||
CVector3f dv = av - pPos;
|
||||
float dvm = dv.Magnitude();
|
||||
|
||||
float c;
|
||||
xc_maxMag->GetValue(frame, c);
|
||||
if (dvm > c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float d;
|
||||
x10_minMag->GetValue(frame, d);
|
||||
if (x14_enableMinMag && dvm < d) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dvm == 0.f) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CVector3f dvs = (1.f / dvm) * dv;
|
||||
float b;
|
||||
x8_magScale->GetValue(frame, b);
|
||||
pVel += dvm * (b * dvs);
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVESwirl::CMVESwirl(CVectorElement* a, CVectorElement* b, CRealElement* c, CRealElement* d)
|
||||
: x4_helixPoint(a), x8_curveBinormal(b), xc_filterGain(c), x10_tangentialVelocity(d) {}
|
||||
|
||||
CMVESwirl::~CMVESwirl() {
|
||||
delete x4_helixPoint;
|
||||
delete x8_curveBinormal;
|
||||
delete xc_filterGain;
|
||||
delete x10_tangentialVelocity;
|
||||
}
|
||||
|
||||
bool CMVESwirl::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
CVector3f a(0.f, 0.f, 0.f);
|
||||
CVector3f b(0.f, 0.f, 0.f);
|
||||
x4_helixPoint->GetValue(frame, a);
|
||||
x8_curveBinormal->GetValue(frame, b);
|
||||
|
||||
CVector3f posToOrigin = a - pPos;
|
||||
CVector3f posToHelix = posToOrigin - CVector3f::Dot(posToOrigin, b) * b;
|
||||
|
||||
float c = 0.f;
|
||||
float d = 0.f;
|
||||
xc_filterGain->GetValue(frame, c);
|
||||
x10_tangentialVelocity->GetValue(frame, d);
|
||||
|
||||
CVector3f cross = CVector3f::Cross(b, posToHelix);
|
||||
pVel = c * (
|
||||
b * CVector3f::Dot(b, pVel) +
|
||||
d * cross
|
||||
) + (1.f - c) * pVel;
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVEBounce::CMVEBounce(CVectorElement* planePoint, CVectorElement* planeNormal,
|
||||
CRealElement* friction, CRealElement* restitution, bool e)
|
||||
: x4_planePoint(planePoint)
|
||||
, x8_planeNormal(planeNormal)
|
||||
, xc_friction(friction)
|
||||
, x10_restitution(restitution)
|
||||
, x14_planePrecomputed(false)
|
||||
, x15_dieOnPenetrate(e)
|
||||
, x18_planeValidatedNormal(0.f, 0.f, 0.f)
|
||||
, x24_planeD(0.f) {
|
||||
if (planePoint && planeNormal && planePoint->IsFastConstant() && planeNormal->IsFastConstant()) {
|
||||
// Precompute Hesse normal form of plane (for penetration testing)
|
||||
// https://en.wikipedia.org/wiki/Hesse_normal_form
|
||||
x14_planePrecomputed = true;
|
||||
planeNormal->GetValue(0, x18_planeValidatedNormal);
|
||||
|
||||
if (x18_planeValidatedNormal.MagSquared() > 0.f) {
|
||||
x18_planeValidatedNormal.Normalize();
|
||||
}
|
||||
CVector3f a(0.f, 0.f, 0.f);
|
||||
planePoint->GetValue(0, a);
|
||||
x24_planeD = CVector3f::Dot(x18_planeValidatedNormal, a);
|
||||
}
|
||||
}
|
||||
|
||||
CMVEBounce::~CMVEBounce() {
|
||||
delete x4_planePoint;
|
||||
delete x8_planeNormal;
|
||||
delete xc_friction;
|
||||
delete x10_restitution;
|
||||
}
|
||||
|
||||
bool CMVEBounce::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
if (!x14_planePrecomputed) {
|
||||
// Compute Hesse normal form of plane (for penetration testing)
|
||||
x8_planeNormal->GetValue(frame, x18_planeValidatedNormal);
|
||||
x18_planeValidatedNormal.Normalize();
|
||||
|
||||
CVector3f a(0.f, 0.f, 0.f);
|
||||
x4_planePoint->GetValue(frame, a);
|
||||
|
||||
x24_planeD = CVector3f::Dot(x18_planeValidatedNormal, a);
|
||||
}
|
||||
|
||||
float dot = CVector3f::Dot(x18_planeValidatedNormal, pPos);
|
||||
if (dot - x24_planeD > 0.f) {
|
||||
return false;
|
||||
} else if (x15_dieOnPenetrate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Deflection event
|
||||
if (CVector3f::Dot(x18_planeValidatedNormal, pVel) < 0.f) {
|
||||
float pd = CVector3f::Dot(pPos - pVel, x18_planeValidatedNormal) - x24_planeD;
|
||||
float pn = CVector3f::Dot(pVel, x18_planeValidatedNormal);
|
||||
pPos = pPos + pVel * (-pd / pn - 1.f);
|
||||
|
||||
float d = 0.f;
|
||||
x10_restitution->GetValue(frame, d);
|
||||
pVel -= d * pVel;
|
||||
|
||||
float c = 0.f;
|
||||
xc_friction->GetValue(frame, c);
|
||||
pVel -= (c + 1.f) * CVector3f::Dot(x18_planeValidatedNormal, pVel) * x18_planeValidatedNormal;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CMVESetPosition::CMVESetPosition(CVectorElement* a) : x4_a(a) {}
|
||||
|
||||
CMVESetPosition::~CMVESetPosition() { delete x4_a; }
|
||||
|
||||
bool CMVESetPosition::GetValue(int frame, CVector3f& pVel, CVector3f& pPos) const {
|
||||
x4_a->GetValue(frame, pPos);
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
#include "Kyoto/Particles/CParticleDataFactory.hpp"
|
||||
|
||||
#include "Kyoto/Particles/CIntElement.hpp"
|
||||
#include "Kyoto/Particles/CModVectorElement.hpp"
|
||||
#include "Kyoto/Streams/CInputStream.hpp"
|
||||
|
||||
#define SBIG(v) v
|
||||
|
||||
FourCC CParticleDataFactory::GetClassID(CInputStream& in) { return in.ReadLong(); }
|
||||
|
||||
bool CParticleDataFactory::GetBool(CInputStream& in) {
|
||||
GetClassID(in);
|
||||
return in.ReadBool();
|
||||
}
|
||||
|
||||
int CParticleDataFactory::GetInt(CInputStream& in) { return in.ReadInt32(); }
|
||||
|
||||
float CParticleDataFactory::GetReal(CInputStream& in) { return in.ReadFloat(); }
|
||||
|
||||
CIntElement* CParticleDataFactory::GetIntElement(CInputStream& in) {
|
||||
FourCC clsId = GetClassID(in);
|
||||
switch (clsId) {
|
||||
case SBIG('CNST'): {
|
||||
return new CIEConstant(GetInt(in));
|
||||
}
|
||||
case SBIG('KEYE'):
|
||||
case SBIG('KEYP'): {
|
||||
return new CIEKeyframeEmitter(in);
|
||||
}
|
||||
case SBIG('TSCL'): {
|
||||
return new CIETimescale(GetRealElement(in));
|
||||
}
|
||||
case SBIG('DETH'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
return new CIEDeath(a, b);
|
||||
}
|
||||
case SBIG('CHAN'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
CIntElement* c = GetIntElement(in);
|
||||
return new CIETimeChain(a, b, c);
|
||||
}
|
||||
case SBIG('ADD_'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
return new CIEAdd(a, b);
|
||||
}
|
||||
case SBIG('MULT'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
return new CIEMultiply(a, b);
|
||||
}
|
||||
case SBIG('MODU'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
return new CIEModulo(a, b);
|
||||
}
|
||||
case SBIG('RAND'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
return new CIERandom(a, b);
|
||||
}
|
||||
case SBIG('IMPL'): {
|
||||
return new CIEImpulse(GetIntElement(in));
|
||||
}
|
||||
case SBIG('ILPT'): {
|
||||
return new CIELifetimePercent(GetIntElement(in));
|
||||
}
|
||||
case SBIG('SPAH'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
CIntElement* c = GetIntElement(in);
|
||||
return new CIESampleAndHold(c, a, b);
|
||||
}
|
||||
case SBIG('IRND'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
return new CIEInitialRandom(a, b);
|
||||
}
|
||||
case SBIG('CLMP'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
CIntElement* c = GetIntElement(in);
|
||||
return new CIEClamp(a, b, c);
|
||||
}
|
||||
case SBIG('PULS'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
CIntElement* c = GetIntElement(in);
|
||||
CIntElement* d = GetIntElement(in);
|
||||
return new CIEPulse(a, b, c, d);
|
||||
}
|
||||
case SBIG('NONE'): {
|
||||
return nullptr;
|
||||
}
|
||||
case SBIG('RTOI'): {
|
||||
CRealElement* a = GetRealElement(in);
|
||||
CRealElement* b = GetRealElement(in);
|
||||
return new CIERealToInt(a, b);
|
||||
}
|
||||
case SBIG('SUB_'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
return new CIESubtract(a, b);
|
||||
}
|
||||
case SBIG('GTCP'): {
|
||||
return new CIEGetCumulativeParticleCount();
|
||||
}
|
||||
case SBIG('GAPC'): {
|
||||
return new CIEGetActiveParticleCount();
|
||||
}
|
||||
case SBIG('GEMT'): {
|
||||
return new CIEGetEmitterTime();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CModVectorElement* CParticleDataFactory::GetModVectorElement(CInputStream& in) {
|
||||
FourCC clsId = GetClassID(in);
|
||||
switch (clsId) {
|
||||
case SBIG('NONE'): {
|
||||
return nullptr;
|
||||
}
|
||||
case SBIG('CNST'): {
|
||||
CRealElement* a = GetRealElement(in);
|
||||
CRealElement* b = GetRealElement(in);
|
||||
CRealElement* c = GetRealElement(in);
|
||||
if (a && b && c && a->IsConstant() && b->IsConstant() && c->IsConstant()) {
|
||||
float af, bf, cf;
|
||||
#if NONMATCHING
|
||||
a->GetValue(0, af);
|
||||
b->GetValue(0, bf);
|
||||
c->GetValue(0, cf);
|
||||
#else
|
||||
// BUG: Fetching from the same element for each
|
||||
a->GetValue(0, af);
|
||||
a->GetValue(0, bf);
|
||||
a->GetValue(0, cf);
|
||||
#endif
|
||||
CModVectorElement* result = new CMVEFastConstant(af, bf, cf);
|
||||
delete a;
|
||||
delete b;
|
||||
delete c;
|
||||
return result;
|
||||
} else {
|
||||
return new CMVEConstant(a, b, c);
|
||||
}
|
||||
}
|
||||
case SBIG('GRAV'): {
|
||||
return new CMVEGravity(GetVectorElement(in));
|
||||
}
|
||||
case SBIG('WIND'): {
|
||||
CVectorElement* a = GetVectorElement(in);
|
||||
CRealElement* b = GetRealElement(in);
|
||||
return new CMVEWind(a, b);
|
||||
}
|
||||
case SBIG('EXPL'): {
|
||||
CRealElement* a = GetRealElement(in);
|
||||
CRealElement* b = GetRealElement(in);
|
||||
return new CMVEExplode(a, b);
|
||||
}
|
||||
case SBIG('CHAN'): {
|
||||
CModVectorElement* a = GetModVectorElement(in);
|
||||
CModVectorElement* b = GetModVectorElement(in);
|
||||
CIntElement* c = GetIntElement(in);
|
||||
return new CMVETimeChain(a, b, c);
|
||||
}
|
||||
case SBIG('PULS'): {
|
||||
CIntElement* a = GetIntElement(in);
|
||||
CIntElement* b = GetIntElement(in);
|
||||
CModVectorElement* c = GetModVectorElement(in);
|
||||
CModVectorElement* d = GetModVectorElement(in);
|
||||
return new CMVEPulse(a, b, c, d);
|
||||
}
|
||||
case SBIG('IMPL'): {
|
||||
CVectorElement* a = GetVectorElement(in);
|
||||
CRealElement* b = GetRealElement(in);
|
||||
CRealElement* c = GetRealElement(in);
|
||||
CRealElement* d = GetRealElement(in);
|
||||
bool e = GetBool(in);
|
||||
return new CMVEImplosion(a, b, c, d, e);
|
||||
}
|
||||
case SBIG('LMPL'): {
|
||||
CVectorElement* a = GetVectorElement(in);
|
||||
CRealElement* b = GetRealElement(in);
|
||||
CRealElement* c = GetRealElement(in);
|
||||
CRealElement* d = GetRealElement(in);
|
||||
bool e = GetBool(in);
|
||||
return new CMVELinearImplosion(a, b, c, d, e);
|
||||
}
|
||||
case SBIG('EMPL'): {
|
||||
CVectorElement* a = GetVectorElement(in);
|
||||
CRealElement* b = GetRealElement(in);
|
||||
CRealElement* c = GetRealElement(in);
|
||||
CRealElement* d = GetRealElement(in);
|
||||
bool e = GetBool(in);
|
||||
return new CMVEExponentialImplosion(a, b, c, d, e);
|
||||
}
|
||||
case SBIG('SWRL'): {
|
||||
CVectorElement* a = GetVectorElement(in);
|
||||
CVectorElement* b = GetVectorElement(in);
|
||||
CRealElement* c = GetRealElement(in);
|
||||
CRealElement* d = GetRealElement(in);
|
||||
return new CMVESwirl(a, b, c, d);
|
||||
}
|
||||
case SBIG('BNCE'): {
|
||||
CVectorElement* a = GetVectorElement(in);
|
||||
CVectorElement* b = GetVectorElement(in);
|
||||
CRealElement* c = GetRealElement(in);
|
||||
CRealElement* d = GetRealElement(in);
|
||||
bool e = GetBool(in);
|
||||
return new CMVEBounce(a, b, c, d, e);
|
||||
}
|
||||
case SBIG('SPOS'): {
|
||||
return new CMVESetPosition(GetVectorElement(in));
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#include "Kyoto/Particles/CParticleGlobals.hpp"
|
||||
|
||||
int CParticleGlobals::mParticleLifetime;
|
||||
float CParticleGlobals::mParticleLifetimeReal;
|
||||
int CParticleGlobals::mEmitterTime;
|
||||
float CParticleGlobals::mEmitterTimeReal;
|
||||
int CParticleGlobals::mParticleLifetimePercentage;
|
||||
float CParticleGlobals::mParticleLifetimePercentageReal;
|
||||
float CParticleGlobals::mParticleLifetimePercentageRemainder;
|
||||
CElementGen::CParticle* CParticleGlobals::mCurrentParticle;
|
||||
float* CParticleGlobals::mParticleAccessParameters;
|
||||
CParticleGlobals::SParticleSystem* CParticleGlobals::mCurrentParticleSystem;
|
||||
|
||||
void CParticleGlobals::SetParticleLifetime(int lifetime) {
|
||||
mParticleLifetime = lifetime;
|
||||
mParticleLifetimeReal = static_cast< float >(lifetime);
|
||||
}
|
||||
|
||||
void CParticleGlobals::SetEmitterTime(int time) {
|
||||
mEmitterTime = time;
|
||||
mEmitterTimeReal = static_cast< float >(time);
|
||||
}
|
||||
|
||||
void CParticleGlobals::UpdateParticleLifetimeTweenValues(int time) {
|
||||
float d = mParticleLifetime != 0.f ? mParticleLifetime : 1.f;
|
||||
mParticleLifetimePercentageReal = time * 100.f / d;
|
||||
mParticleLifetimePercentage = mParticleLifetimePercentageReal;
|
||||
mParticleLifetimePercentageRemainder =
|
||||
mParticleLifetimePercentageReal - mParticleLifetimePercentage;
|
||||
if (mParticleLifetimePercentage < 0) {
|
||||
mParticleLifetimePercentage = 0;
|
||||
} else if (mParticleLifetimePercentage > 100) {
|
||||
mParticleLifetimePercentage = 100;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,546 @@
|
|||
#include "Kyoto/Particles/CRealElement.hpp"
|
||||
|
||||
#include "Kyoto/CRandom16.hpp"
|
||||
#include "Kyoto/Math/CRelAngle.hpp"
|
||||
#include "Kyoto/Math/CVector3f.hpp"
|
||||
#include "Kyoto/Math/CloseEnough.hpp"
|
||||
#include "Kyoto/Particles/CParticleGlobals.hpp"
|
||||
#include "Kyoto/Streams/CInputStream.hpp"
|
||||
|
||||
#include "rstl/math.hpp"
|
||||
|
||||
CREConstant::CREConstant(float val) : x4_val(val) {}
|
||||
|
||||
CREConstant::~CREConstant() {}
|
||||
|
||||
bool CREConstant::GetValue(int frame, float& valOut) const override {
|
||||
valOut = x4_val;
|
||||
return false;
|
||||
}
|
||||
|
||||
CRESineWave::CRESineWave(CRealElement* a, CRealElement* b, CRealElement* c)
|
||||
: x4_frequency(b), x8_amplitude(c), xc_phase(a) {}
|
||||
|
||||
CRESineWave::~CRESineWave() {
|
||||
delete x4_frequency;
|
||||
delete x8_amplitude;
|
||||
delete xc_phase;
|
||||
}
|
||||
|
||||
bool CRESineWave::GetValue(int frame, float& valOut) const {
|
||||
float amp, freq, phase;
|
||||
x8_amplitude->GetValue(frame, amp);
|
||||
x4_frequency->GetValue(frame, freq);
|
||||
xc_phase->GetValue(frame, phase);
|
||||
valOut = sine(CRelAngle::FromDegrees(frame * freq + phase)) * amp;
|
||||
return false;
|
||||
}
|
||||
|
||||
CRETimeScale::CRETimeScale(CRealElement* a) : x4_a(a) {}
|
||||
|
||||
CRETimeScale::~CRETimeScale() { delete x4_a; }
|
||||
|
||||
bool CRETimeScale::GetValue(int frame, float& valOut) const {
|
||||
float a;
|
||||
x4_a->GetValue(frame, a);
|
||||
valOut = static_cast< float >(frame) * a;
|
||||
return false;
|
||||
}
|
||||
|
||||
CREAdd::CREAdd(CRealElement* a, CRealElement* b) : x4_a(a), x8_b(b) {}
|
||||
|
||||
CREAdd::~CREAdd() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
}
|
||||
|
||||
bool CREAdd::GetValue(int frame, float& valOut) const {
|
||||
float a, b;
|
||||
x4_a->GetValue(frame, a);
|
||||
x8_b->GetValue(frame, b);
|
||||
valOut = a + b;
|
||||
return false;
|
||||
}
|
||||
|
||||
CREMultiply::CREMultiply(CRealElement* a, CRealElement* b) : x4_a(a), x8_b(b) {}
|
||||
|
||||
CREMultiply::~CREMultiply() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
}
|
||||
|
||||
bool CREMultiply::GetValue(int frame, float& valOut) const {
|
||||
float a, b;
|
||||
x4_a->GetValue(frame, a);
|
||||
x8_b->GetValue(frame, b);
|
||||
valOut = a * b;
|
||||
return false;
|
||||
}
|
||||
|
||||
CREDotProduct::CREDotProduct(CVectorElement* a, CVectorElement* b) : x4_a(a), x8_b(b) {}
|
||||
|
||||
CREDotProduct::~CREDotProduct() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
}
|
||||
|
||||
bool CREDotProduct::GetValue(int frame, float& valOut) const {
|
||||
CVector3f a = CVector3f::Zero();
|
||||
CVector3f b = CVector3f::Zero();
|
||||
x4_a->GetValue(frame, a);
|
||||
x8_b->GetValue(frame, b);
|
||||
valOut = CVector3f::Dot(a, b);
|
||||
return false;
|
||||
}
|
||||
|
||||
CRERandom::CRERandom(CRealElement* min, CRealElement* max) : x4_min(min), x8_max(max) {}
|
||||
|
||||
CRERandom::~CRERandom() {
|
||||
delete x4_min;
|
||||
delete x8_max;
|
||||
}
|
||||
|
||||
bool CRERandom::GetValue(int frame, float& valOut) const {
|
||||
float min, max;
|
||||
x4_min->GetValue(frame, min);
|
||||
x8_max->GetValue(frame, max);
|
||||
valOut = (max - min) * CRandom16::GetRandomNumber()->Float() + min;
|
||||
return false;
|
||||
}
|
||||
|
||||
CREInitialRandom::CREInitialRandom(CRealElement* min, CRealElement* max)
|
||||
: x4_min(min), x8_max(max) {}
|
||||
|
||||
CREInitialRandom::~CREInitialRandom() {
|
||||
delete x4_min;
|
||||
delete x8_max;
|
||||
}
|
||||
|
||||
bool CREInitialRandom::GetValue(int frame, float& valOut) const {
|
||||
if (frame == 0) {
|
||||
float min, max;
|
||||
x4_min->GetValue(frame, min);
|
||||
x8_max->GetValue(frame, max);
|
||||
valOut = (max - min) * CRandom16::GetRandomNumber()->Float() + min;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CRETimeChain::CRETimeChain(CRealElement* a, CRealElement* b, CIntElement* c)
|
||||
: x4_a(a), x8_b(b), xc_swFrame(c) {}
|
||||
|
||||
CRETimeChain::~CRETimeChain() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
delete xc_swFrame;
|
||||
}
|
||||
|
||||
bool CRETimeChain::GetValue(int frame, float& valOut) const {
|
||||
int v;
|
||||
xc_swFrame->GetValue(frame, v);
|
||||
if (frame < v) {
|
||||
return x4_a->GetValue(frame, valOut);
|
||||
} else {
|
||||
return x8_b->GetValue(frame - v, valOut);
|
||||
}
|
||||
}
|
||||
|
||||
CREClamp::CREClamp(CRealElement* a, CRealElement* b, CRealElement* c)
|
||||
: x4_min(a), x8_max(b), xc_val(c) {}
|
||||
|
||||
CREClamp::~CREClamp() {
|
||||
delete x4_min;
|
||||
delete x8_max;
|
||||
delete xc_val;
|
||||
}
|
||||
|
||||
bool CREClamp::GetValue(int frame, float& valOut) const {
|
||||
float a, b;
|
||||
x4_min->GetValue(frame, a);
|
||||
x8_max->GetValue(frame, b);
|
||||
xc_val->GetValue(frame, valOut);
|
||||
if (valOut > b) {
|
||||
valOut = b;
|
||||
}
|
||||
if (valOut < a) {
|
||||
valOut = a;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CREPulse::CREPulse(CIntElement* a, CIntElement* b, CRealElement* c, CRealElement* d)
|
||||
: x4_aDuration(a), x8_bDuration(b), xc_valA(c), x10_valB(d) {}
|
||||
|
||||
CREPulse::~CREPulse() {
|
||||
delete x4_aDuration;
|
||||
delete x8_bDuration;
|
||||
delete xc_valA;
|
||||
delete x10_valB;
|
||||
}
|
||||
|
||||
bool CREPulse::GetValue(int frame, float& valOut) const {
|
||||
int a, b;
|
||||
x4_aDuration->GetValue(frame, a);
|
||||
x8_bDuration->GetValue(frame, b);
|
||||
int cv = a + b + 1;
|
||||
if (cv < 0) {
|
||||
cv = 1;
|
||||
}
|
||||
|
||||
if (b >= 1) {
|
||||
// CREPulse is an outlier here, the other
|
||||
// IElement classes use > instead of >=.
|
||||
if (frame % cv >= a) {
|
||||
x10_valB->GetValue(frame, valOut);
|
||||
} else {
|
||||
xc_valA->GetValue(frame, valOut);
|
||||
}
|
||||
} else {
|
||||
xc_valA->GetValue(frame, valOut);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CRELifetimePercent::CRELifetimePercent(CRealElement* a) : x4_percentVal(a) {}
|
||||
|
||||
CRELifetimePercent::~CRELifetimePercent() { delete x4_percentVal; }
|
||||
|
||||
bool CRELifetimePercent::GetValue(int frame, float& valOut) const {
|
||||
float a = 0.f;
|
||||
x4_percentVal->GetValue(frame, a);
|
||||
if (a < 0.f) {
|
||||
a = 0.f;
|
||||
}
|
||||
valOut = (a / 100.f) * CParticleGlobals::GetParticleLifetimeReal();
|
||||
return false;
|
||||
}
|
||||
|
||||
CRELifetimeTween::CRELifetimeTween(CRealElement* a, CRealElement* b) : x4_a(a), x8_b(b) {}
|
||||
|
||||
CRELifetimeTween::~CRELifetimeTween() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
}
|
||||
|
||||
// fake but using it to test
|
||||
static inline float Lerp(float a, float b, float c) {
|
||||
return b * c + a * (1.f - c);
|
||||
}
|
||||
|
||||
bool CRELifetimeTween::GetValue(int frame, float& valOut) const {
|
||||
float ltFac = frame / CParticleGlobals::GetParticleLifetimeReal();
|
||||
float a, b;
|
||||
x4_a->GetValue(frame, a);
|
||||
x8_b->GetValue(frame, b);
|
||||
valOut = Lerp(a, b, ltFac);
|
||||
return false;
|
||||
}
|
||||
|
||||
CREKeyframeEmitter::CREKeyframeEmitter(CInputStream& in)
|
||||
: x4_percent(in.ReadLong())
|
||||
, x8_unk1(in.ReadLong())
|
||||
, xc_loop(in.ReadBool())
|
||||
, xd_unk2(in.ReadBool())
|
||||
, x10_loopEnd(in.ReadLong())
|
||||
, x14_loopStart(in.ReadLong())
|
||||
, x18_keys(in) {}
|
||||
|
||||
CREKeyframeEmitter::~CREKeyframeEmitter() {}
|
||||
|
||||
bool CREKeyframeEmitter::GetValue(int frame, float& valOut) const {
|
||||
if (x4_percent == 0) {
|
||||
int emitterTime = CParticleGlobals::GetEmitterTime();
|
||||
if (xc_loop) {
|
||||
if (emitterTime >= x10_loopEnd) {
|
||||
emitterTime -= x14_loopStart;
|
||||
emitterTime = emitterTime % (x10_loopEnd - x14_loopStart);
|
||||
emitterTime += x14_loopStart;
|
||||
}
|
||||
valOut = x18_keys[emitterTime];
|
||||
} else {
|
||||
emitterTime = rstl::min_val(emitterTime, x10_loopEnd - 1);
|
||||
valOut = x18_keys[emitterTime];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int ltPerc = CParticleGlobals::GetParticleLifetimePercentage();
|
||||
if (ltPerc == 100) {
|
||||
valOut = x18_keys[ltPerc];
|
||||
} else {
|
||||
float ltPercRem = CParticleGlobals::GetParticleLifetimePercentageRemainder();
|
||||
float key1 = x18_keys[ltPerc];
|
||||
float key2 = x18_keys[ltPerc + 1];
|
||||
valOut = (1.f - ltPercRem) * key1 + ltPercRem * key2;
|
||||
// valOut = Lerp(key1, key2, ltPercRem);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREParticleAccessParameter1::GetValue(int, float& valOut) const {
|
||||
valOut = CParticleGlobals::GetParticleAccessParameters()[0];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREParticleAccessParameter2::GetValue(int, float& valOut) const {
|
||||
valOut = CParticleGlobals::GetParticleAccessParameters()[1];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREParticleAccessParameter3::GetValue(int, float& valOut) const {
|
||||
valOut = CParticleGlobals::GetParticleAccessParameters()[2];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREParticleAccessParameter4::GetValue(int, float& valOut) const {
|
||||
valOut = CParticleGlobals::GetParticleAccessParameters()[3];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREParticleAccessParameter5::GetValue(int, float& valOut) const {
|
||||
valOut = CParticleGlobals::GetParticleAccessParameters()[4];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREParticleAccessParameter6::GetValue(int, float& valOut) const {
|
||||
valOut = CParticleGlobals::GetParticleAccessParameters()[5];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREParticleAccessParameter7::GetValue(int, float& valOut) const {
|
||||
valOut = CParticleGlobals::GetParticleAccessParameters()[6];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREParticleAccessParameter8::GetValue(int, float& valOut) const {
|
||||
valOut = CParticleGlobals::GetParticleAccessParameters()[7];
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREParticleSizeOrLineLength::GetValue(int, float& valOut) const {
|
||||
valOut = CParticleGlobals::GetCurrentParticle()->x2c_lineLengthOrSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CREParticleRotationOrLineWidth::GetValue(int, float& valOut) const {
|
||||
valOut = CParticleGlobals::GetCurrentParticle()->x30_lineWidthOrRota;
|
||||
return false;
|
||||
}
|
||||
|
||||
CREVectorXToReal::CREVectorXToReal(CVectorElement* a) : x4_a(a) {}
|
||||
|
||||
CREVectorXToReal::~CREVectorXToReal() { delete x4_a; }
|
||||
|
||||
bool CREVectorXToReal::GetValue(int frame, float& valOut) const {
|
||||
CVector3f a = CVector3f::Zero();
|
||||
x4_a->GetValue(frame, a);
|
||||
valOut = a[0];
|
||||
return false;
|
||||
}
|
||||
|
||||
CREVectorYToReal::CREVectorYToReal(CVectorElement* a) : x4_a(a) {}
|
||||
|
||||
CREVectorYToReal::~CREVectorYToReal() { delete x4_a; }
|
||||
|
||||
bool CREVectorYToReal::GetValue(int frame, float& valOut) const {
|
||||
CVector3f a = CVector3f::Zero();
|
||||
x4_a->GetValue(frame, a);
|
||||
valOut = a[1];
|
||||
return false;
|
||||
}
|
||||
|
||||
CREVectorZToReal::CREVectorZToReal(CVectorElement* a) : x4_a(a) {}
|
||||
|
||||
CREVectorZToReal::~CREVectorZToReal() { delete x4_a; }
|
||||
|
||||
bool CREVectorZToReal::GetValue(int frame, float& valOut) const {
|
||||
CVector3f a = CVector3f::Zero();
|
||||
x4_a->GetValue(frame, a);
|
||||
valOut = a[2];
|
||||
return false;
|
||||
}
|
||||
|
||||
CREVectorMagnitude::CREVectorMagnitude(CVectorElement* a) : x4_a(a) {}
|
||||
|
||||
CREVectorMagnitude::~CREVectorMagnitude() { delete x4_a; }
|
||||
|
||||
bool CREVectorMagnitude::GetValue(int frame, float& valOut) const {
|
||||
CVector3f a = CVector3f::Zero();
|
||||
x4_a->GetValue(frame, a);
|
||||
valOut = a.Magnitude();
|
||||
return false;
|
||||
}
|
||||
|
||||
CREInitialSwitch::CREInitialSwitch(CRealElement* a, CRealElement* b) : x4_a(a), x8_b(b) {}
|
||||
|
||||
CREInitialSwitch::~CREInitialSwitch() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
}
|
||||
|
||||
bool CREInitialSwitch::GetValue(int frame, float& valOut) const {
|
||||
if (frame == 0) {
|
||||
x4_a->GetValue(0, valOut);
|
||||
} else {
|
||||
x8_b->GetValue(frame - 1, valOut);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CRECompareLessThan::CRECompareLessThan(CRealElement* a, CRealElement* b, CRealElement* c,
|
||||
CRealElement* d)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
|
||||
|
||||
CRECompareLessThan::~CRECompareLessThan() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
delete xc_c;
|
||||
delete x10_d;
|
||||
}
|
||||
|
||||
bool CRECompareLessThan::GetValue(int frame, float& valOut) const {
|
||||
float a, b;
|
||||
x4_a->GetValue(frame, a);
|
||||
x8_b->GetValue(frame, b);
|
||||
if (a < b) {
|
||||
xc_c->GetValue(frame, valOut);
|
||||
} else {
|
||||
x10_d->GetValue(frame, valOut);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CRECompareEqual::CRECompareEqual(CRealElement* a, CRealElement* b, CRealElement* c, CRealElement* d)
|
||||
: x4_a(a), x8_b(b), xc_c(c), x10_d(d) {}
|
||||
|
||||
CRECompareEqual::~CRECompareEqual() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
delete xc_c;
|
||||
delete x10_d;
|
||||
}
|
||||
|
||||
bool CRECompareEqual::GetValue(int frame, float& valOut) const {
|
||||
float a, b;
|
||||
x4_a->GetValue(frame, a);
|
||||
x8_b->GetValue(frame, b);
|
||||
if (close_enough(a, b)) {
|
||||
xc_c->GetValue(frame, valOut);
|
||||
} else {
|
||||
x10_d->GetValue(frame, valOut);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CREConstantRange::CREConstantRange(CRealElement* a, CRealElement* b, CRealElement* c,
|
||||
CRealElement* d, CRealElement* e)
|
||||
: x4_val(a), x8_min(b), xc_max(c), x10_inRange(d), x14_outOfRange(e) {}
|
||||
|
||||
CREConstantRange::~CREConstantRange() {
|
||||
delete x4_val;
|
||||
delete x8_min;
|
||||
delete xc_max;
|
||||
delete x10_inRange;
|
||||
delete x14_outOfRange;
|
||||
}
|
||||
|
||||
bool CREConstantRange::GetValue(int frame, float& valOut) const {
|
||||
float val, min, max;
|
||||
x4_val->GetValue(frame, val);
|
||||
x8_min->GetValue(frame, min);
|
||||
xc_max->GetValue(frame, max);
|
||||
if (val > min && val < max) {
|
||||
x10_inRange->GetValue(frame, valOut);
|
||||
} else {
|
||||
x14_outOfRange->GetValue(frame, valOut);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CREExternalVar::CREExternalVar(CIntElement* a) : x4_a(a) {}
|
||||
|
||||
CREExternalVar::~CREExternalVar() { delete x4_a; }
|
||||
|
||||
bool CREExternalVar::GetValue(int frame, float& valOut) const {
|
||||
int a = 0;
|
||||
x4_a->GetValue(frame, a);
|
||||
a = rstl::max_val(0, a);
|
||||
a %= 16;
|
||||
valOut = CParticleGlobals::GetCurrentParticleSystem()->x4_system->GetExternalVar(a);
|
||||
return false;
|
||||
}
|
||||
|
||||
CRESubtract::CRESubtract(CRealElement* a, CRealElement* b) : x4_a(a), x8_b(b) {}
|
||||
|
||||
CRESubtract::~CRESubtract() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
}
|
||||
|
||||
bool CRESubtract::GetValue(int frame, float& valOut) const {
|
||||
float a = 0.f, b = 0.f;
|
||||
x4_a->GetValue(frame, a);
|
||||
x8_b->GetValue(frame, b);
|
||||
valOut = a - b;
|
||||
return false;
|
||||
}
|
||||
|
||||
CREGetComponentRed::CREGetComponentRed(CColorElement* a) : x4_a(a) {}
|
||||
|
||||
CREGetComponentRed::~CREGetComponentRed() { delete x4_a; }
|
||||
|
||||
bool CREGetComponentRed::GetValue(int frame, float& valOut) const {
|
||||
CColor color = CColor::Black();
|
||||
x4_a->GetValue(frame, color);
|
||||
valOut = color.GetRed();
|
||||
return false;
|
||||
}
|
||||
|
||||
CREGetComponentGreen::CREGetComponentGreen(CColorElement* a) : x4_a(a) {}
|
||||
|
||||
CREGetComponentGreen::~CREGetComponentGreen() { delete x4_a; }
|
||||
|
||||
bool CREGetComponentGreen::GetValue(int frame, float& valOut) const {
|
||||
CColor color = CColor::Black();
|
||||
x4_a->GetValue(frame, color);
|
||||
valOut = color.GetGreen();
|
||||
return false;
|
||||
}
|
||||
|
||||
CREGetComponentBlue::CREGetComponentBlue(CColorElement* a) : x4_a(a) {}
|
||||
|
||||
CREGetComponentBlue::~CREGetComponentBlue() { delete x4_a; }
|
||||
|
||||
bool CREGetComponentBlue::GetValue(int frame, float& valOut) const {
|
||||
CColor color = CColor::Black();
|
||||
x4_a->GetValue(frame, color);
|
||||
valOut = color.GetBlue();
|
||||
return false;
|
||||
}
|
||||
|
||||
CREGetComponentAlpha::CREGetComponentAlpha(CColorElement* a) : x4_a(a) {}
|
||||
|
||||
CREGetComponentAlpha::~CREGetComponentAlpha() { delete x4_a; }
|
||||
|
||||
bool CREGetComponentAlpha::GetValue(int frame, float& valOut) const {
|
||||
CColor color = CColor::Black();
|
||||
x4_a->GetValue(frame, color);
|
||||
valOut = color.GetAlpha();
|
||||
return false;
|
||||
}
|
||||
|
||||
CREIntTimesReal::CREIntTimesReal(CIntElement* a, CRealElement* b) : x4_a(a), x8_b(b) {}
|
||||
|
||||
CREIntTimesReal::~CREIntTimesReal() {
|
||||
delete x4_a;
|
||||
delete x8_b;
|
||||
}
|
||||
|
||||
bool CREIntTimesReal::GetValue(int frame, float& valOut) const {
|
||||
int a = 0;
|
||||
float b = 0.f;
|
||||
x8_b->GetValue(frame, b);
|
||||
x4_a->GetValue(frame, a);
|
||||
valOut = b * static_cast< float >(a);
|
||||
return false;
|
||||
}
|
|
@ -2,19 +2,20 @@
|
|||
|
||||
#include "Kyoto/Basics/CBasics.hpp"
|
||||
|
||||
const CTransform4f& TransformFromData(const void* ptr) {
|
||||
static const CTransform4f& TransformFromData(const void* ptr) {
|
||||
return *static_cast< const CTransform4f* >(ptr);
|
||||
}
|
||||
|
||||
CAABox BoundingBoxFromData(const void* ptr) {
|
||||
const CAABox* tmp = static_cast< const CAABox* >(ptr);
|
||||
float minX = CBasics::SwapBytes(tmp->GetMinPoint().GetX());
|
||||
float minY = CBasics::SwapBytes(tmp->GetMinPoint().GetY());
|
||||
float minZ = CBasics::SwapBytes(tmp->GetMinPoint().GetZ());
|
||||
float maxX = CBasics::SwapBytes(tmp->GetMaxPoint().GetX());
|
||||
float maxY = CBasics::SwapBytes(tmp->GetMaxPoint().GetY());
|
||||
float maxZ = CBasics::SwapBytes(tmp->GetMaxPoint().GetZ());
|
||||
return CAABox(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
static CAABox BoundingBoxFromData(const void* ptr) {
|
||||
float out[6];
|
||||
const float* tmp = reinterpret_cast< const float* >(ptr);
|
||||
out[0] = CBasics::SwapBytes(tmp[0]);
|
||||
out[1] = CBasics::SwapBytes(tmp[1]);
|
||||
out[2] = CBasics::SwapBytes(tmp[2]);
|
||||
out[3] = CBasics::SwapBytes(tmp[3]);
|
||||
out[4] = CBasics::SwapBytes(tmp[4]);
|
||||
out[5] = CBasics::SwapBytes(tmp[5]);
|
||||
return *reinterpret_cast< const CAABox* >(out);
|
||||
}
|
||||
|
||||
CMetroidModelInstance::CMetroidModelInstance(const void* header, const void* firstGeom,
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#include "WorldFormat/CWorldLight.hpp"
|
||||
|
||||
#include "Kyoto/Streams/CInputStream.hpp"
|
||||
// #include <hacks.h>
|
||||
#include <rstl/math.hpp>
|
||||
|
||||
const CVector3f CWorldLight::kDefaultPosition = CVector3f(0.f, 0.f, 0.f);
|
||||
// FORCEPADDING(sizeof(CVector3f)) kPadding;
|
||||
const CVector3f CWorldLight::kDefaultDirection = CVector3f(0.f, 1.f, 0.f);
|
||||
|
||||
CWorldLight::CWorldLight(CInputStream& in)
|
||||
|
|
Loading…
Reference in New Issue