Clustered Mesh: Difference between revisions

no edit summary
m (Remove base class names generated by Ghidra.)
No edit summary
Line 18:
==== 32-bit ====
{| class="wikitable"
! Offset !! LengthfLength !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || [[#rw::collision::VolRef::Volume|Volume]]* || mpCollisionVolume || ||
Line 187:
| 0xB || 0x1 || uint8_t || normalCount || ||
|-
| 0xC || 0x1 || uint8_t || compressionMode || VERTICES_UNCOMPRESSED ||= 0,<br>VERTICES_16BIT_COMPRESSED = 1<br>VERTICES_32BIT_COMPRESSED or= 2 ||
|-
| 0xD || 0x3 || uint8_t[3] || Padding || ||
Line 195:
 
==== Vertex data ====
 
 
{| class="wikitable"
|+ VERTICES_UNCOMPRESSED
|+ Compression mode 0 (uncompressed)
|-
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0<br>(repeating) || 0x10 || [[Vector3|vpu::Vector3]] || ? || || Raw vector (mVertexCompressionGranularity unused)
|}
 
{| class="wikitable"
|+ VERTICES_16BIT_COMPRESSED
|+ Compression mode 1
|-
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0xC || int32_t[3] || ?vertexOffsetData || Component base ||
|-
| 0xC<br>(repeating) || 0x6 || uint16_t[[#rw::collision::ClusteredMeshCluster::Vertex16|Vertex16]][3] || ? || vertData || Add to initial int32_t components and then multiply components by mVertexCompressionGranularity to get coordinate
|}
 
{| class="wikitable"
|+ VERTICES_32BIT_COMPRESSED
|+ Compression mode 2
|-
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0<br>(repeating) || 0xC || int32_t[[#rw::collision::ClusteredMeshCluster::Vertex32|Vertex32]][3] || ? || vertData || Multiply components by mVertexCompressionGranularity to get coordinate
|}
 
===== rw::collision::ClusteredMeshCluster::Vertex16 =====
 
{| class="wikitable"
! Offset !! Length !! Type !! Name
|-
| 0x0 || 0x2 || uint16_t || x
|-
| 0x2 || 0x2 || uint16_t || y
|-
| 0x4 || 0x2 || uint16_t || z
|}
 
===== rw::collision::ClusteredMeshCluster::Vertex32 =====
 
{| class="wikitable"
! Offset !! Length !! Type !! Name
|-
| 0x0 || 0x4 || int32_t || x
|-
| 0x4 || 0x4 || int32_t || y
|-
| 0x8 || 0x4 || int32_t || z
|}
 
Line 228 ⟶ 253:
! Length !! Type !! Description !! Comments
|-
| 0x1 || uint8_t || '''Lower nibble''' (type)<br>1''[unused]'' -UNITTYPE_OLDTRIANGLE Triangles= 0<br>2UNITTYPE_TRIANGLE -= Quads1<br>3UNITTYPE_QUAD -= Variable?2<br>UNITTYPE_TRILIST = 3<br>'''Upper nibble'''<br>FlagUNITFLAG_NORMAL = 1<br>UNITFLAG_EDGEANGLE -= ?2<br>FlagUNITFLAG_GROUPID 2= - Has edge cosine? data4<br>FlagUNITFLAG_SURFACEID 4 - Has= a group ID8<br>Flag''[unused]'' 8UNITFLAG_USEOLDTRI = -all Hasbits aset surface(including IDtype) ||
|-
| 0x1 || uint8_t || '''Only present if type == UNITTYPE_TRILIST'''<br>Triangle count || For UNITTYPE_OLDTRIANGLE/UNITTYPE_TRIANGLE this is implicitly 1 and for UNITTYPE_QUAD this is implicitly 2
|-
| Vertex count<br>(triangle count + 2) || uint8_t || Vertex index ||
| 0x1 || uint8_t || '''Only present if type == 3'''<br>The number of points minus two ||
|-
| 0x1 || uint8_t || '''Only present ifwith type == 3UNITFLAG_NORMAL'''<br>TheNormal numberindex ofprobably points|| minusNo twoknown ||samples
| Point count || uint8_t || Vertex index ||rowspan=2|3 points for type 1, 4 points for type 2, and specified by the previous byte plus 2 for type 3
|-
| PointEdge count<br>(triangle count + 2) || uint8_t || '''Only present with flag 2UNITFLAG_EDGEANGLE''' Edge cosines? Mask with 0x1F and flags above that? rw::colison::UnitEdgeFlags is likely relevant ||
|-
| Group ID size (see [[#rw::collision::ClusterParams|ClusterParams]]) || uint8_t or uint16_t || '''Only present with flag 4UNITFLAG_GROUPID'''<br>Group ID || This is always little endian.
|-
| Surface ID size (see [[#rw::collision::ClusterParams|ClusterParams]]) || uint8_t or uint16_t || '''Only present with flag 8UNITFLAG_SURFACEID'''<br>Surface ID || This is always little endian.
|}
117

edits