Beispiel #1
0
void
Projector::SetWorldspaceClipPlane(Vec3& normal, Plane& plane)
{
    // Rotate the plane normal into worldspace
    ViewToWorld(normal, plane.normal);
    plane.distance = (float) (camera->Pos() * plane.normal + CLIP_PLANE_EPSILON);
}
void CCamera::BuildRay( const Vector2D &vView, Vector& vStart, Vector& vEnd )
{
	// Find the point they clicked on in world coordinates. It lies on the near
	// clipping plane.
	Vector vClickPoint;
	ViewToWorld(vView, vClickPoint );

	// Build a ray from the viewpoint through the point on the near clipping plane.
	Vector vRay = vClickPoint - m_ViewPoint;
	VectorNormalize( vRay );
	
	vStart = m_ViewPoint;
	vEnd = vStart + vRay * 99999;
}