Beispiel #1
0
///=====================================================
/// 
///=====================================================
const Matrix4 MatrixStack::PopMatrix(){
	if (m_stack.empty()) return Matrix4();

	const Matrix4 temp(m_stack.top());
	m_totalTransformation.TransformByMatrix(temp.GetInverse());
	m_stack.pop();

	return temp;
}
void PolygonGroup::ApplyMatrix(const Matrix4 & matrix)
{
    aabbox = AABBox3(); // reset bbox
    
    Matrix4 normalMatrix4;
    matrix.GetInverse(normalMatrix4);
    normalMatrix4.Transpose();
    Matrix3 normalMatrix3;
    normalMatrix3 = normalMatrix4;

    for (int32 vi = 0; vi < vertexCount; ++vi)
    {
        Vector3 vertex;
        GetCoord(vi, vertex);
        vertex = vertex * matrix;
        SetCoord(vi, vertex);
        
        Vector3 normal;
        GetNormal(vi, normal);
        normal = normal * normalMatrix3;
        SetNormal(vi, normal);
    }    
}