All pastes #539961 Raw Edit

Stuff

public text v1 · immutable
·published 2007-06-05 12:35 UTC
rendered paste body
// Vertex Components
printf("Reading vertex components...\n");
unsigned long iVertexComponentCount;
if(fread(&iVertexComponentCount, sizeof(unsigned long), 1, m_fChunkyFile) != 1)
	throw new CRainmanException(__FILE__, __LINE__, "Read error");
for(unsigned long iCurrentComponent = 0; iCurrentComponent < iVertexComponentCount; ++iCurrentComponent)
{
	unsigned long iWhat = 0,iUnknown = 0,iSize = 0;

	if(fread(&iWhat, sizeof(unsigned long), 1, m_fChunkyFile) != 1)
		throw new CRainmanException(__FILE__, __LINE__, "Read error");
	if(fread(&iUnknown, sizeof(unsigned long), 1, m_fChunkyFile) != 1)
		throw new CRainmanException(__FILE__, __LINE__, "Read error");
	if(fread(&iSize, sizeof(unsigned long), 1, m_fChunkyFile) != 1)
		throw new CRainmanException(__FILE__, __LINE__, "Read error");

	printf("[%lu,%lu,%lu] ", iWhat, iUnknown, iSize);
}
printf("\n");

// Verticies
printf("Reading verticies...\n");
if(fread(&pData->iVertexCount, sizeof(unsigned long), 1, m_fChunkyFile) != 1)
	throw new CRainmanException(__FILE__, __LINE__, "Read error");
if(fread(&pData->iVertexSize, sizeof(unsigned long), 1, m_fChunkyFile) != 1)
	throw new CRainmanException(__FILE__, __LINE__, "Read error");
printf("%lu verticies of size %lu\n", pData->iVertexCount, pData->iVertexSize);

/* Output :
Reading vertex components...
[0,3,4] [1,3,2] [2,3,2] [3,3,2] [4,3,2] [5,3,2] [8,3,2] [9,3,2] [10,3,2]
Reading verticies...
8283 verticies of size 44
*/