Esempio n. 1
0
// Dump a micro polygon
void CqMPDump::dump(const CqMicroPolygon& mp)
{
	CqColor c;
	short id = 1;

	if (m_outFile==NULL)
	{
		Aqsis::log() << error << "Attempted to write to unopened mpdump file." << std::endl;
		return;
	}

	m_mpcount++;
	size_t len_written = fwrite((void*)&id, sizeof(short), 1, m_outFile);
	if(len_written != 1)
		AQSIS_THROW_XQERROR(XqInvalidFile, EqE_System,
				"Error writing mpdump file");

	// Dump vertices in a funny circular order for backward-compatibility
	// rather than in the usual bilinear patch type order.
	CqVector3D P[4];
	mp.GetVertices(P);
	dumpVec3(P[0]);
	dumpVec3(P[1]);
	dumpVec3(P[3]);
	dumpVec3(P[2]);
	if (mp.pGrid()->pVar(EnvVars_Ci)!=NULL)
		c = *mp.colColor();
	else
		c = CqColor(0.9,0.9,1);
	dumpCol(c);
	if (mp.pGrid()->pVar(EnvVars_Oi)!=NULL)
		c = *mp.colOpacity();
	else
		c = CqColor(0.9,0.9,1);
	dumpCol(c);
}
Esempio n. 2
0
int
main( void )
{
	Mat3 a, b, c;
	float f = 2.0f;
	Vec3 v(1,0,-1);
	
	a.set(1,2,3, 4,5,6, 7,8,9);
	b.set(1,2,3, 4,5,6, 7,8,9);
	
	dumpMat3(a, "a");
	dumpMat3(b, "b");

	fprintf(stdout,"\n");
	
	dumpMat3(a+b, "a+b");
	dumpMat3(a-b, "a-b");
	dumpMat3(a*b, "a*b");
	dumpMat3(a*f, "a*f");
	dumpMat3(a/f, "a/f");
	dumpMat3(a/0.0f, "a/0.0f");

	fprintf(stdout,"\n");

	dumpMat3(c.toZero(), "c=zero");	
	dumpMat3(c.toIdentity(), "c=identity");

	fprintf(stdout,"\n");

	a=c;
	dumpMat3(a, "a=c");

	fprintf(stdout,"\n");

	dumpVec3(b*v, "b*v");
	
	if(a==b) fprintf(stdout,"a==b\n");
	if(a!=b) fprintf(stdout,"a!=b\n");
	if(a<=b) fprintf(stdout,"a<=b\n");

	fprintf(stdout,"\n");

	dumpMat3(b.transpose(), "b transpose");
	
	return 0;
}