RwBinaryStream

From GTAMods Wiki
Revision as of 03:35, 29 May 2007 by Shrew (talk | contribs)
Jump to navigation Jump to search

RwGeometry section RwData

VersionNumber(s) 0, 2048, 3074
  • Gauranteed, first and only data in the RwGeometryList
abc def ghi
jkl mno pqr
stu vwx yz
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();
	}
}