EvilEngine/JSP: Difference between revisions

Battlepedia>Igorseabra4
No edit summary
Battlepedia>Seil
Line 7:
 
===Format (Visibility/Collision JSP)===
====Section header format====
// SECTION 1 (COLLISION)
This is the standard intformat 0x00BEEF01for //RenderWare section typeheaders.
 
int sectionSize // section size
<source lang=cpp>
int 0x1400FFFF // renderware version
struct __rwMark
char[4] CCOL
{
unsigned int type; // section type
int amount1
unsigned int length; // section size
int amount2
unsigned int libraryID; // renderware version
unknown1[amount1]
};
unknown2[amount2]
</source>
 
struct unknown1 {
====Section 1 (BSP Tree)====
int[2] unknown
This section contains a k-d tree, used for collision checking.
float[2] unknown
 
}
<source lang=cpp>
__rwMark mark; // type = 0xBEEF01
struct unknown2 {
 
short[2] unknown
unsigned int magic = 'CCOL'; // 'LOCC' on GameCube
byte[2] unknown
unsigned int numBranchNodes;
short unknown
unsigned int numTriangles;
}
 
xClumpCollBSPBranchNode branchNodes[numBranchNodes];
// SECTION 2 (VISIBILITY)
xClumpCollBSPTriangle triangles[numTriangles];
int 0x00BEEF02 // section type
</source>
int sectionSize // section size
 
int 0x1400FFFF // renderware version
<source lang=cpp>
struct xClumpCollBSPBranchNode
// big endian
{
char[4] "JSP "
unsigned int leftInfo;
int unknownAmount1 // usually 3
unsigned int unknownAmount2rightInfo;
float leftValue;
int unknown1usually0
float rightValue;
int unknown2usually0
};
int unknown3usually0
 
unknown3[unknownAmount2]
struct xClumpCollBSPTriangle
{
struct unknown3{
unsigned short atomIndex; // atomic index in all JSPs combined
int[2] unknown
unsigned short meshVertIndex; // vertex index in atomic's mesh
}
unsigned char flags;
unsigned char platData;
// SECTION 3 // GCN ONLY
unsigned short matIndex;
int 0x00BEEF03 // section type
};
int sectionSize // section size
</source>
int 0x1400FFFF // renderware version
 
====Section 2 (JSP Info)====
int vertexCount
This section contains rendering info for all of the RW Atomics ("nodes") in the other JSPs.
float[vertexCount][3] vertices
 
<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==
Anonymous user