Anonymous user
EvilEngine/JSP: Difference between revisions
→Format (Visibility/Collision JSP)
Battlepedia>Igorseabra4 No edit summary |
Battlepedia>Seil |
||
Line 7:
===Format (Visibility/Collision JSP)===
====Section header format====
This is the standard
<source lang=cpp>
struct __rwMark
{
unsigned int type; // section type
unsigned int length; // section size
unsigned int libraryID; // renderware version
};
</source>
====Section 1 (BSP Tree)====
This section contains a k-d tree, used for collision checking.
<source lang=cpp>
__rwMark mark; // type = 0xBEEF01
unsigned int magic = 'CCOL'; // 'LOCC' on GameCube
unsigned int numBranchNodes;
unsigned int numTriangles;
xClumpCollBSPBranchNode branchNodes[numBranchNodes];
xClumpCollBSPTriangle triangles[numTriangles];
</source>
<source lang=cpp>
struct xClumpCollBSPBranchNode
{
unsigned int leftInfo;
float leftValue;
float rightValue;
};
struct xClumpCollBSPTriangle
{
unsigned short atomIndex; // atomic index in all JSPs combined
unsigned short meshVertIndex; // vertex index in atomic's mesh
unsigned char flags;
unsigned char platData;
unsigned short matIndex;
};
</source>
====Section 2 (JSP Info)====
This section contains rendering info for all of the RW Atomics ("nodes") in the other JSPs.
<source lang=cpp>
__rwMark mark; // type = 0xBEEF02
char idtag[4] = "JSP\0";
unsigned int version; // usually 3
unsigned int jspNodeCount;
void* unused[3]; // always null (0), used interally as C++ pointers at runtime
xJSPNodeInfo jspNodeList[jspNodeCount];
</source>
<source lang=cpp>
struct xJSPNodeInfo
{
int originalMatIndex;
int nodeFlags;
};
</source>
<code>xJSPNodeInfo::nodeFlags</code> is used to toggle various rendering states:
* 0x2 - Toggle Z-Buffer write on/off. Starting state is on.
* 0x4 - Toggle Cull Mode between Front/Back face. Starting state is Back.
====Section 3 (Pre-calculated Vertices, GCN only)====
This section contains a list of vertices extracted from every mesh in every JSP's atomic combined. This is used for collision checking on GameCube only.
<source lang=cpp>
__rwMark mark; // type = 0xBEEF03
unsigned int vertCount;
RwV3d verts[vertCount];
</source>
<source lang=cpp>
struct RwV3d
{
float x, y, z;
};
</source>
==Jason Hoerner's information on the custom JSP==
|