EvilEngine/JSP: Difference between revisions

Restructure and flags
(Begin version 5 jsp)
(Restructure and flags)
Line 12:
JSP is an asset type which defines a 3D model. It's a RenderWare binary stream file. There are two types of JSP: the normal (model) has a format much similar to a DFF and is stored in the BSP layer. They can be opened by RWAnalyze and other tools that work with RenderWare models. [https://gtamods.com/wiki/RenderWare_binary_stream_file GTAModding] has a lot of useful information regarding this format. The other format is used for visibility and collision data and is very different from a normal JSP/DFF, but still follows the layout of a RenderWare binary stream file with four custom sections and is stored in the JSP Info layer.
 
====Section header format====
===Format (Visibility/Collision JSP)===
====Section header format====
This is the standard format for RenderWare section headers.
 
Line 25 ⟶ 24:
</source>
 
====Section 1 (BSP Tree)====
This section contains a k-d tree, used for collision checking.
 
Line 66 ⟶ 65:
! Offset !! Type !! Variable !! Description
|-
| 0x00 || u32 || '''leftInfo''' || rowspan="2" |
* (this & 0x3) = NodeType
** 1 = Triangle
** 2 = Branch
* (this & 0xC) = Axis
** 0 = X
** 4 = Y
** 8 = Z
* (this >> 12) = Index
|-
| 0x04 || u32 || '''rightInfo''' ||
|-
| 0x08 || f32 || '''leftValue''' ||
Line 94 ⟶ 101:
| 0x02 || u16 || '''meshVertIndex''' || Vertex index in atomic's mesh
|-
| 0x04 || u8 || '''flags''' || BFBB:
* 0x1 = Has sibling (There is another triangle after this one in memory. If not set means this is the last triangle in its chain)
* 0x2 = Counter-clockwise (This triangle is in reverse orientation (every other triangle in a tristrip mesh))
* 0x4 = Solid (This triangle has collision enabled)
* 0x8 = Visible (This triangle is visible in the world)
* 0x10 = No stand (Force the player to slide off this triangle instead of stand on it)
* 0x20 = Force receive shadows (Force this triangle to receive shadows in the world)
|-
| 0x05 || u8 || '''platData''' / '''detailed_info_cache_index''' ||
|-
| 0x06 || u16 || '''matIndex''' || Material index into the geometry's material list
|}
 
====Section 2 (JSP Info)====
 
====Section 2 (JSP Info)====
This section contains rendering info for all of the RW Atomics ("nodes") in the other JSPs.
 
=====Version 3 (BFBB)=====
<source lang=cpp>
__rwMark mark; // type = 0xBEEF02
Line 150 ⟶ 162:
|}
 
----
 
=====Version 5 (TSSM - RatProto)=====
<source lang=cpp>
__rwMark mark; // type = 0xBEEF02
Line 183 ⟶ 196:
</source>
{| class="wikitable"
! OffsetSize(h) !! Type !! Variable !! Description
|-
| 0x004h || char[4] || '''idtag''' || "JSP\0"
|-
| 0x044h || u32 || '''version''' || Always 5
|-
| 0x084h || u32 || '''jspNodeCount''' || Amount of xJSPNodeInfo entries
|-
| 0x0C4h || RpClump* || '''clump''' || Always null
|-
| 0x104h || xClumpCollBSPTree* || '''colltree''' || Always null
|-
| 0x144h || xJSPNodeInfo* || '''jspNodeList''' || Always null
|-
| 0x184h || u32 || '''stripVecCount''' || Always null
|-
| 0x1C4h || RwV3d* || '''stripVecList''' || Always null
|-
| 0x202h || u16 || '''vertDataFlags''' || Always null
|-
| 0x222h || u16 || '''vertDataStride''' || Always null
|-
| 0x244h || xJSPNodeTree* || '''nodetree''' || Always null
|-
| 0x284h || xJSPNodeLight* || '''nodelight''' || Always null
|-
| 0x2C8h * jspNodeCount || xJSPNodeInfo[] || '''jspNodeList''' || Array of xJSPNodeInfo entries
|-
| 4h || s32 || '''numBranchNodes''' || Amount of xJSPNodeTreeBranch entries
|-
| 4h || xJSPNodeTreeBranch* || '''branchNodes''' || Always null
|-
| 4h || s32 || '''numLeafNodes''' || Amount of xJSPTreeLeaf entries
|-
| 4h || xJSPNodeTreeLeaf* || '''leafNodes''' || Always null
|-
| 10h * numBranchNodes || xJSPNodeTreeBranch[] || '''branchNodes''' || Array of xJSPNodeTreeBranch entries
|-
| 20h * numLeafNodes || xJSPNodeTreeLeaf[] || '''leafNodes''' || Array of xJSPNodeTreeLeaf entries
|-
| 4h || u32 || '''stripVecCount''' || Amount of array entries
|-
| Ch * stripVecCount || RwV3d[] || '''stripVecList''' || Vector3 array of pre-calculated vertices
|}
 
Line 246 ⟶ 259:
| 0x06 || s16 || '''sortOrder''' ||
|}
 
 
<source lang=cpp>
Line 276 ⟶ 290:
| 0x0C || f32 || '''rightValue''' ||
|}
 
 
<source lang=cpp>
struct xJSPNodeTreeLeaf
Line 300 ⟶ 316:
|}
 
====Section 3 (Pre-calculated Vertices, BFBB GCN only)====
 
====Section 3 (Pre-calculated Vertices, BFBB 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 BFBB GameCube only.
<source lang=cpp>
Line 317 ⟶ 332:
</source>
 
====Section 4 (Extra Info)====
 
====Section 4 (Extra Info)====
Not present in BFBB.
 
Line 335 ⟶ 349:
};
</source>
 
 
 
2,079

edits