// 读取3ds对象
UINT C3DSModel::ReadObject(UINT n)
{
	UINT count = 0;
	tChunk chunk = {0};
	// 新的3ds对象
	t3DObject newObject = {0};
	count += ReadString(&newObject.objName);
	m_3DModel.numOfObjects ++;

	while (count < n)
	{
		ReadChunk(&chunk);
		switch (chunk.ID)
		{
		case OBJECT_INFO:
			ReadObjectInfo(&newObject, n-count -6);
			break;
		default:
			fseek(m_FilePtr, chunk.length-6, SEEK_CUR);
			break;
		}
		count += chunk.length;
	}
	// 保存3ds对象
	m_3DModel.pObject.push_back(newObject);
	return count;
}
Beispiel #2
0
Datei: Ase.cpp Projekt: RinM/CGA
void CLoadASE::ReadAseFile(t3DModel *pModel)
{
	tMaterialInfo newMaterial = {0};
	tMaterialInfo newNormalMap = {0};
	t3DObject     newObject   = {0};
				
	int i = 0;	

	pModel->numOfObjects   = GetObjectCount();

	pModel->numOfMaterials = GetMaterialCount();

	for(i = 0; i < pModel->numOfMaterials; i++)
	{
		pModel->pMaterials.push_back(newMaterial);
		GetTextureInfo(&(pModel->pMaterials[i]), i + 1);
	}

	for(i = 0; i < pModel->numOfObjects; i++)
	{	
		pModel->pObject.push_back(newObject);
		pModel->pObject[i].materialID = -1;

		MoveToObject(i + 1);

		ReadObjectInfo(pModel, &(pModel->pObject[i]), i + 1);
		ReadObjectData(pModel, &(pModel->pObject[i]), i + 1);
		
	}

}
Beispiel #3
0
// -----------------------------------------------------------------------------
// Load game 
// Loads all the relevant data for a level.
// If level != -1, it loads the filename with extension changed to .min
// Otherwise it loads the appropriate level mine.
// returns 0=everything ok, 1=old version, -1=error
int LoadMineDataCompiled (CFile& cf, int bFileInfo)
{
	int 	nStartOffset;

nStartOffset = cf.Tell ();
InitGameFileInfo ();
if (ReadGameFileInfo (cf, nStartOffset))
	return -1;
if (ReadLevelInfo (cf))
	return -1;
gameStates.render.bD2XLights = gameStates.app.bD2XLevel && (gameTopFileInfo.fileinfoVersion >= 34);
if (bFileInfo)
	return 0;

gameData.objs.nNextSignature = 0;
gameData.render.lights.nStatic = 0;
nGameSaveOrgRobots = 0;
nGameSavePlayers = 0;
if (ReadObjectInfo (cf))
	return -1;
if (ReadWallInfo (cf))
	return -1;
if (ReadDoorInfo (cf))
	return -1;
if (ReadTriggerInfo (cf))
	return -1;
if (ReadReactorInfo (cf))
	return -1;
if (ReadBotGenInfo (cf))
	return -1;
if (ReadEquipGenInfo (cf))
	return -1;
if (ReadLightDeltaIndexInfo (cf))
	return -1;
if (ReadLightDeltaInfo (cf))
	return -1;
ClearLightSubtracted ();
ResetObjects (gameFileInfo.objects.count);
CheckAndLinkObjects ();
ClearTransientObjects (1);		//1 means clear proximity bombs
CheckAndFixDoors ();
//gameData.walls.nOpenDoors = gameFileInfo.doors.count;
gameData.trigs.m_nTriggers = gameFileInfo.triggers.count;
gameData.walls.nWalls = gameFileInfo.walls.count;
CheckAndFixWalls ();
CheckAndFixTriggers ();
gameData.matCens.nBotCenters = gameFileInfo.botGen.count;
FixObjectSegs ();
#if DBG
dump_mine_info ();
#endif
if ((gameTopFileInfo.fileinfoVersion < GAME_VERSION) && 
	 ((gameTopFileInfo.fileinfoVersion != 25) || (GAME_VERSION != 26)))
	return 1;		//means old version
return 0;
}