Beispiel #1
0
void Frustum::SetWorldMatrix(const float3x4 &worldTransform)
{
	pos = worldTransform.TranslatePart();
	if (handedness == FrustumRightHanded)
		front = -worldTransform.Col(2); // The camera looks towards -Z axis of the given transform.
	else
		front = worldTransform.Col(2); // The camera looks towards +Z axis of the given transform.
	up = worldTransform.Col(1); // The camera up points towards +Y of the given transform.
	assume(pos.IsFinite());
	assume(front.IsNormalized());
	assume(up.IsNormalized());
	assume(worldTransform.IsColOrthogonal3()); // Front and up must be orthogonal to each other.
	assume(EqualAbs(worldTransform.Determinant(), 1.f)); // The matrix cannot contain mirroring.
}
Beispiel #2
0
void Capsule::Transform(const float3x4 &transform)
{
	assume(transform.HasUniformScale());
	assume(transform.IsColOrthogonal());
	l.Transform(transform);
	r *= transform.Col(0).Length(); // Scale the radius.
}
Beispiel #3
0
void Circle::Transform(const float3x4 &transform)
{
	assume(transform.HasUniformScale());
	assume(transform.IsColOrthogonal());
	pos = transform.MulPos(pos);
	normal = transform.MulDir(normal).Normalized();
	r *= transform.Col(0).Length(); // Scale the radius of the circle.
}
Beispiel #4
0
void Sphere::Transform(const float3x4 &transform)
{
	assume(transform.HasUniformScale());
	pos = transform.MulPos(pos);
	r *= transform.Col(0).Length();
}
void GraphicsWorld::DebugDrawFloat3x4(const float3x4 &t, float axisLength, float boxSize, const Color &clr, bool depthTest)
{
    AABB aabb(float3::FromScalar(-boxSize/2.f), float3::FromScalar(boxSize/2.f));
    OBB obb = aabb.Transform(t);
    DebugDrawOBB(obb, clr);
    DebugDrawLineSegment(LineSegment(t.TranslatePart(), t.TranslatePart() + axisLength * t.Col(0)), 1, 0, 0, depthTest);
    DebugDrawLineSegment(LineSegment(t.TranslatePart(), t.TranslatePart() + axisLength * t.Col(1)), 0, 1, 0, depthTest);
    DebugDrawLineSegment(LineSegment(t.TranslatePart(), t.TranslatePart() + axisLength * t.Col(2)), 0, 0, 1, depthTest);
}