DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
CCloth Class Reference

#include <cloth.hpp>

Inheritance diagram for CCloth:
CVisualVu1 CVisual

Public Member Functions

void Draw ()
 
void Clear ()
 
void Step (int step)
 
int CreateVUData (u_int *packet)
 
void InitParam ()
 
 CCloth (int grid_i=16, int grid_j=16, float grid_pitch=1.0f)
 
virtual void Initialize (CDataAlloc2< 1 > *alloc)
 
virtual void Initialize (MDT_HEADER *header, CDataAlloc2< 1 > *alloc)
 
virtual int DrawVu1 (u_int *packet, float(*matrix)[4], RenderInfo *info, VU1_PROGRAM program, u_long128 *draw_state, int unknown1, int unknown2)
 
virtual int DrawVu1 (sceVif1Packet *packet, float(*matrix)[4], RenderInfo *info, VU1_PROGRAM program, u_long128 *draw_state, int unknown1, int unknown2)
 
- Public Member Functions inherited from CVisualVu1
 CVisualVu1 ()
 
int CreateVUdataFromMDT (u_int *block, u_int *data, int unknown0, int unknown1)
 
int CreateVUdataFromMDTRemake (u_int *block, u_int *data, int unknown0)
 
virtual void Initialize ()
 
virtual void SetMDTDataAddress (u_int *data)
 
virtual u_int * GetMDTDataAddress ()
 
virtual int RemakeData (u_int *data)
 
CVisualVu1 & operator= (const CVisualVu1 &src)
 
virtual void Initialize ()
 
virtual void SetMDTDataAddress (unsigned int *data)
 
virtual unsigned int * GetMDTDataAddress ()
 
virtual int RemakeData (unsigned int *data)
 
 CVisualVu1 ()
 
int CreateVUdataFromMDT (unsigned int *block, unsigned int *data, int unknown0, int unknown1)
 
int CreateVUdataFromMDTRemake (unsigned int *block, unsigned int *data, int unknown0)
 
- Public Member Functions inherited from CVisual
CVisual & operator= (const CVisual &other)
 
 CVisual ()
 
CVisual & operator= (const CVisual &other)
 
 CVisual ()
 

Public Attributes

int unk_10
 
int unk_14
 
u_int * vu_data
 
u_int vu_size
 
int init_20
 
u_int * vu_block [2]
 
int num_i
 
int num_j
 
float pitch
 
int stop
 
CFrame * frame
 
int init_40
 
CBound * bound
 
int floor_on
 
float floor_y
 
void * wind
 
float wind_effect
 
float normal_scale
 
MDT_MATERIAL material
 
sceVu0FVECTOR gravity
 
sceVu0FVECTOR follow
 
sceVu0FVECTOR stiffness
 
sceVu0FVECTOR last_position
 
sceVu0FVECTOR position
 
sceVu0FVECTOR home [16][16]
 
sceVu0FVECTOR point [16][16]
 
sceVu0FVECTOR last [16][16]
 
sceVu0FVECTOR rest [16][16]
 
sceVu0FVECTOR speed [16][16]
 
sceVu0FVECTOR normal_grid [16][16]
 
sceVu0FVECTOR texture_coord [16][16]
 
int polygon_divide [16]
 
int mask [16][16]
 
sceVu0FVECTOR world_home [16][16]
 
- Public Attributes inherited from CVisualVu1
int unk_00
 
int unk_04
 
u_int * vu_data
 
u_int vu_size
 
s32 flags
 
s32 unk_04
 
s32 unk_0C
 
- Public Attributes inherited from CVisual
int unk_00
 
int unk_04
 
int unk_0C
 

Detailed Description

Simulates and draws a fixed-capacity grid of cloth vertices.

Definition at line 17 of file cloth.hpp.

Constructor & Destructor Documentation

◆ CCloth()

CCloth::CCloth ( int  grid_i = 16,
int  grid_j = 16,
float  grid_pitch = 1.0f 
)

Constructs a cloth grid with the requested dimensions and spacing.

Mangled name:
__ct__6CClothFiif
Address:
0x13CB70
Size:
0x78

Constructs a cloth grid with the requested dimensions and spacing.

Definition at line 659 of file cloth.cpp.

Member Function Documentation

◆ Draw()

void CCloth::Draw ( )

Draws the simulated cloth through a temporary world-space frame.

Mangled name:
Draw__6CClothFv
Address:
0x13B640
Size:
0x160

Draws the simulated cloth through a temporary world-space frame.

Definition at line 19 of file cloth.cpp.

◆ Clear()

void CCloth::Clear ( )

Puts every cloth vertex back where its frame says it rests.

Mangled name:
Clear__6CClothFv
Address:
0x13B7A0
Size:
0x100

Definition at line 61 of file cloth.cpp.

◆ Step()

void CCloth::Step ( int  step)

Advances the cloth simulation, pushing its vertices out of the exclusion boxes.

Mangled name:
Step__6CClothFi
Address:
0x13B8A0
Size:
0xBCC

Definition at line 144 of file cloth.cpp.

◆ CreateVUData()

int CCloth::CreateVUData ( u_int *  packet)

Definition at line 492 of file cloth.cpp.

◆ InitParam()

void CCloth::InitParam ( )

Gives the cloth its default grid size, stiffness and gravity.

Mangled name:
InitParam__6CClothFv
Address:
0x13C9B0
Size:
0x1C0

Definition at line 608 of file cloth.cpp.

◆ Initialize() [1/2]

void CCloth::Initialize ( CDataAlloc2< 1 > *  alloc)
virtual

Takes the cloth's vertex storage out of an arena.

Mangled name:
Initialize__6CClothFP14CDataAlloc2_1_
Address:
0x13CBF0
Size:
0x458

Definition at line 673 of file cloth.cpp.

◆ Initialize() [2/2]

void CCloth::Initialize ( MDT_HEADER *  header,
CDataAlloc2< 1 > *  alloc 
)
virtual

Builds the cloth's grid from a model's mesh and takes its storage out of an arena.

Mangled name:
Initialize__6CClothFP10MDT_HEADERP14CDataAlloc2_1_
Address:
0x13D050
Size:
0x200

Definition at line 760 of file cloth.cpp.

◆ DrawVu1() [1/2]

int CCloth::DrawVu1 ( u_int *  packet,
float(*)  matrix[4],
RenderInfo *  info,
VU1_PROGRAM  program,
u_long128 *  draw_state,
int  unknown1,
int  unknown2 
)
virtual

Rebuilds the cloth's packet for this frame and draws it through the vector unit.

Mangled name:
DrawVu1__6CClothFPUiPA4_fP10RenderInfo11VU1_PROGRAMP1ii
Address:
0x13C470
Size:
0xC0

Draws the cloth through the vector unit.

Mangled name:
DrawVu1__6CClothFPUiPA4_fP10RenderInfo11VU1_PROGRAMP1ii
Address:
0x13C470
Size:
0xC0

Reimplemented from CVisualVu1.

Definition at line 463 of file cloth.cpp.

◆ DrawVu1() [2/2]

int CCloth::DrawVu1 ( sceVif1Packet *  packet,
float(*)  matrix[4],
RenderInfo *  info,
VU1_PROGRAM  program,
u_long128 *  draw_state,
int  unknown1,
int  unknown2 
)
virtual

Draws the cloth into a VIF packet.

Mangled name:
DrawVu1__6CClothFP13sceVif1PacketPA4_fP10RenderInfo11VU1_PROGRAMP1ii
Address:
0x13C530
Size:
0xC0

Reimplemented from CVisualVu1.

Definition at line 476 of file cloth.cpp.

Member Data Documentation

◆ unk_10

int CCloth::unk_10

Definition at line 19 of file cloth.hpp.

◆ unk_14

int CCloth::unk_14

Definition at line 20 of file cloth.hpp.

◆ vu_data

u_int* CCloth::vu_data

VU packet the base class draws, pointed at this frame's buffer.

Definition at line 21 of file cloth.hpp.

◆ vu_size

u_int CCloth::vu_size

Size of one VU packet buffer in quadwords.

Definition at line 22 of file cloth.hpp.

◆ init_20

int CCloth::init_20

Cleared when the parameters reset and never read.

Definition at line 23 of file cloth.hpp.

◆ vu_block

u_int* CCloth::vu_block[2]

VU packet data for each display buffer.

Definition at line 24 of file cloth.hpp.

◆ num_i

int CCloth::num_i

Number of active grid rows.

Definition at line 25 of file cloth.hpp.

◆ num_j

int CCloth::num_j

Number of active grid columns.

Definition at line 26 of file cloth.hpp.

◆ pitch

float CCloth::pitch

Rest spacing between adjacent vertices.

Definition at line 27 of file cloth.hpp.

◆ stop

int CCloth::stop

Carries the vertices rigidly with the frame, without simulation, while set.

Definition at line 28 of file cloth.hpp.

◆ frame

CFrame* CCloth::frame

Frame from which the cloth hangs.

Definition at line 29 of file cloth.hpp.

◆ init_40

int CCloth::init_40

Cleared when the parameters reset and never read.

Definition at line 30 of file cloth.hpp.

◆ bound

CBound* CCloth::bound

First exclusion box in the chain the vertices are pushed out of.

Definition at line 31 of file cloth.hpp.

◆ floor_on

int CCloth::floor_on

Whether the vertices stop at the floor height.

Definition at line 32 of file cloth.hpp.

◆ floor_y

float CCloth::floor_y

Height of the floor the vertices rest on.

Definition at line 33 of file cloth.hpp.

◆ wind

void* CCloth::wind

Wind whose noise pushes the cloth, or null.

Definition at line 34 of file cloth.hpp.

◆ wind_effect

float CCloth::wind_effect

Scale applied to the wind's push.

Definition at line 35 of file cloth.hpp.

◆ normal_scale

float CCloth::normal_scale

Scale applied to each rebuilt normal before it is normalised.

Definition at line 36 of file cloth.hpp.

◆ material

MDT_MATERIAL CCloth::material

Material the cloth draws with, taken from its model's mesh.

Definition at line 37 of file cloth.hpp.

◆ gravity

sceVu0FVECTOR CCloth::gravity

Pull added to every vertex's speed each step.

Definition at line 38 of file cloth.hpp.

◆ follow

sceVu0FVECTOR CCloth::follow

Share of the frame's movement each axis passes on to the vertices.

Definition at line 39 of file cloth.hpp.

◆ stiffness

sceVu0FVECTOR CCloth::stiffness

Strength of the spring pulling each vertex towards its rest position on the frame.

Definition at line 40 of file cloth.hpp.

◆ last_position

sceVu0FVECTOR CCloth::last_position

World position of the anchor on the previous step.

Definition at line 41 of file cloth.hpp.

◆ position

sceVu0FVECTOR CCloth::position

Anchor point in the frame's space: the average rest position of the first row.

Definition at line 42 of file cloth.hpp.

◆ home

sceVu0FVECTOR CCloth::home[16][16]

Rest position of each vertex in the frame's space.

Definition at line 43 of file cloth.hpp.

◆ point

sceVu0FVECTOR CCloth::point[16][16]

World position of each vertex.

Definition at line 44 of file cloth.hpp.

◆ last

sceVu0FVECTOR CCloth::last[16][16]

World position of each vertex on the previous step.

Definition at line 45 of file cloth.hpp.

◆ rest

sceVu0FVECTOR CCloth::rest[16][16]

Rest lengths to the neighbours in x and y, and in w the friction of the boxes touched, or -1.

Definition at line 46 of file cloth.hpp.

◆ speed

sceVu0FVECTOR CCloth::speed[16][16]

Velocity of each vertex.

Definition at line 47 of file cloth.hpp.

◆ normal_grid

sceVu0FVECTOR CCloth::normal_grid[16][16]

Normal of each vertex.

Definition at line 48 of file cloth.hpp.

◆ texture_coord

sceVu0FVECTOR CCloth::texture_coord[16][16]

Texture coordinate of each vertex.

Definition at line 49 of file cloth.hpp.

◆ polygon_divide

int CCloth::polygon_divide[16]

Whether each row draws its strip from the far side.

Definition at line 50 of file cloth.hpp.

◆ mask

int CCloth::mask[16][16]

Exclusion boxes, by mask bit, that each vertex collides with.

Definition at line 51 of file cloth.hpp.

◆ world_home

sceVu0FVECTOR CCloth::world_home[16][16]

Rest position of each vertex carried into world space by the frame this step.

Definition at line 52 of file cloth.hpp.