예제 #1
0
void AnimationSequence::calculateFOV(mat4 &mat, float &lxMax, float &lyMax) const
{
	vec3 vert1, vert2;

	vector<Mesh*> s = getFrame();

	// for each mesh
	for(vector<Mesh*>::iterator i=s.begin(); i!=s.end(); ++i)
	{
		const Mesh *mesh = (*i);

		// For each vertex
		for(int i=0; i<mesh->m_numOfVerts; ++i)
		{
			// Transform the vertex by the matrix
			vert1 = mesh->m_pVerts[i];
			vert1.w = 1.0f;
			vert2 = mat.transformVector(vert1);

			// Calculate the spread, keep the max
			lxMax = max(lxMax, fabsf(vert2.x / vert2.z));
			lyMax = max(lyMax, fabsf(vert2.y / vert2.z));
		}
	}
}
예제 #2
0
vec3 ModelLoaderMD3::Surface::transformVertex(const Vertex &v) {
	static const mat4 rot = mat4::fromRotateZ((float)M_PI / 2.0f);
	
	return rot.transformVector(vec3(v.x, v.y, v.z) * MD3_XYZ_SCALE);
}