Difference between revisions of "RwBinaryStream"

From GTAMods Wiki
Jump to navigation Jump to search
m
m
Line 2: Line 2:
 
=====VersionNumber(s) 0, 2048, 3074=====
 
=====VersionNumber(s) 0, 2048, 3074=====
 
* Gauranteed, first and only data in the RwGeometryList
 
* Gauranteed, first and only data in the RwGeometryList
{|
+
{| border="1" cellpadding="2" cellspacing="0"
 +
! Data type !! Name !! Version number !! Condition !! Notes
 
|-  
 
|-  
| abc || def || ghi
+
| u16 || flags || all || ||
|- style="background:red; color:white"
+
|- style="background:cyan"
| jkl || mno || pqr
+
| u8[2]|| unknown || all || ||
 
|-
 
|-
| stu || style="background:silver" | vwx || yz
+
| u32 || triangleCount || all || ||
 +
|-
 +
| u32 || vertexCount || all || ||
 +
|-
 +
| u32 || morphTargetCount || all || ||
 +
|-
 +
| u32 || ambientRgba || style="background:silver" | 0, 2048, 3074 || ||
 +
|-
 +
| u32 || diffuseRgba || style="background:silver" | 0, 2048, 3074 || ||
 +
|-
 +
| u32 || specularRgba || style="background:silver" | 0, 2048, 3074 || ||
 +
|-
 +
| u32[vertexCount] || vertexRgba || all || style="background:silver" | only if( flags & flags.COLOUR) ||
 +
|-
 +
| f32[vertexCount*2] || uvs || all || style="background:silver" | only if( flags & flags.TEXTURE) ||
 +
|-
 +
| f32[vertexCount*2] || uvs || all || style="background:silver" | only if( flags & flags.TEXTURE) ||
 
|}
 
|}
 
u16 flags = stream->ReadU16();
 
stream->SkipUnknownU8s(2);
 
 
s32 triangleCount = stream->ReadS32();
 
s32 vertexCount = stream->ReadS32();
 
s32 morphTargetCount = stream->ReadS32();
 
 
if(versionNumber == 0 || versionNumber == 2048 || versionNumber == 3074)
 
{
 
u32 ambientRgba = stream->ReadU32();
 
u32 diffuseRgba = stream->ReadU32();
 
u32 specularRgba = stream->ReadU32();
 
}
 
 
if(flags & rwGEOM_COLOR)
 
u32 colorsRgba[vertexCount] = stream->readU32(vertexCount);
 
 
if(flags & rwGEOM_TEXTURE)
 
{
 
f32 uvs[vertexCount * 2];
 
for(int idx = 0; idx < vertexCount; ++idx)
 
{
 
uvs[idx * 2 + 0] = stream->readF32();
 
uvs[idx * 2 + 1] = stream->readF32();
 
}
 
}
 

Revision as of 03:49, 29 May 2007

RwGeometry section RwData

VersionNumber(s) 0, 2048, 3074
  • Gauranteed, first and only data in the RwGeometryList
Data type Name Version number Condition Notes
u16 flags all
u8[2] unknown all
u32 triangleCount all
u32 vertexCount all
u32 morphTargetCount all
u32 ambientRgba 0, 2048, 3074
u32 diffuseRgba 0, 2048, 3074
u32 specularRgba 0, 2048, 3074
u32[vertexCount] vertexRgba all only if( flags & flags.COLOUR)
f32[vertexCount*2] uvs all only if( flags & flags.TEXTURE)
f32[vertexCount*2] uvs all only if( flags & flags.TEXTURE)