Created
May 3, 2020 12:53
-
-
Save ronjunevaldoz/4b14336a9a26d98a71f40194565fe7ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CObject3D::ReadGMObject(CFile& file, GMObject& obj) | |
{ | |
file.Read(obj.bounds); | |
int temp; | |
file.Read(temp); | |
obj.opacity = temp != 0; | |
file.Read(temp); | |
obj.bump = temp != 0; | |
file.Read(temp); | |
obj.rigid = temp != 0; | |
file.Skip(28); | |
file.Read(obj.vertexListCount); | |
file.Read(obj.vertexCount); | |
file.Read(obj.faceListCount); | |
file.Read(obj.indexCount); | |
obj.vertexList = new D3DXVECTOR3[obj.vertexListCount]; | |
file.Read(obj.vertexList, obj.vertexListCount); | |
if (obj.type == GMT_SKIN) | |
{ | |
obj.vertices = new SkinVertex[obj.vertexCount]; | |
file.Read((SkinVertex*)obj.vertices, obj.vertexCount); | |
} | |
else | |
{ | |
obj.vertices = new NormalVertex[obj.vertexCount]; | |
file.Read((NormalVertex*)obj.vertices, obj.vertexCount); | |
} | |
obj.indices = new ushort[obj.indexCount + obj.vertexCount]; | |
obj.IIB = obj.indices + obj.indexCount; | |
file.Read(obj.indices, obj.indexCount); | |
file.Read(obj.IIB, obj.vertexCount); | |
file.Read(temp); | |
if (temp) | |
{ | |
obj.physiqueVertices = new int[obj.vertexListCount]; | |
file.Read(obj.physiqueVertices, obj.vertexListCount); | |
} | |
file.Read(temp); | |
obj.material = temp != 0; | |
if (obj.material) | |
{ | |
file.Read(obj.materialCount); | |
if (obj.materialCount == 0) | |
obj.materialCount = 1; | |
Material* mat; | |
int len; | |
obj.materials = new Material[obj.materialCount]; | |
memset(obj.materials, 0, sizeof(Material) * obj.materialCount); | |
for (int i = 0; i < obj.materialCount; i++) | |
{ | |
mat = &obj.materials[i]; | |
file.Read(mat->material); | |
file.Read(len); | |
file.Read(mat->textureName, len); | |
} | |
} | |
file.Read(obj.materialBlockCount); | |
if (obj.materialBlockCount > 0) | |
{ | |
obj.materialBlocks = new MaterialBlock[obj.materialBlockCount]; | |
file.Read(obj.materialBlocks, obj.materialBlockCount); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment