示例#1
0
        public void AddVolume(BoundingVolume vol)
        {
            if (vol.Min.X < this.Min.X) this.Min.X = vol.Min.X;
            if (vol.Min.Y < this.Min.Y) this.Min.Y = vol.Min.Y;
            if (vol.Min.Z < this.Min.Z) this.Min.Z = vol.Min.Z;

            if (vol.Max.X > this.Max.X) this.Max.X = vol.Max.X;
            if (vol.Max.Y > this.Max.Y) this.Max.Y = vol.Max.Y;
            if (vol.Max.Z > this.Max.Z) this.Max.Z = vol.Max.Z;
            Vector3 dist = Max - Min;
            R = dist.Length();
        }
示例#2
0
 public static bool ObjectInFrustum(float x, float y, float z, BoundingVolume bound, Vector3 scale)
 {
     if (bound == null) return true;
     float max = scale.X;
     if (scale.Y > max) max = scale.Y;
     if (scale.Z > max) max = scale.Z;
     if (SphereInFrustum(x, y, z, bound.R * max) == 0) return false;
     return true;
 }
示例#3
0
 public static bool ObjectInFrustum(Vector3 position, BoundingVolume bound, Vector3 scale)
 {
     return ObjectInFrustum(position.X, position.Y, position.Z, bound, scale);
 }
 // Static constructor
 static RenderAvatar()
 {
     AvatarBoundingVolume = new BoundingVolume();
     AvatarBoundingVolume.FromScale(Vector3.One);
 }
示例#5
0
 public static bool ObjectInFrustum(Vector3 position, BoundingVolume bound)
 {
     return(ObjectInFrustum(position.X, position.Y, position.Z, bound));
 }
示例#6
0
 public static bool ObjectInFrustum(float x, float y, float z, BoundingVolume bound)
 {
     if (bound == null) return true;
     if (SphereInFrustum(x, y, z, bound.ScaledR) == 0) return false;
     return true;
 }
 // Static constructor
 static RenderAvatar()
 {
     AvatarBoundingVolume = new BoundingVolume();
     // Bounding sphere for avatar is 1m in diametar
     // Bounding box 1m cube
     // These values get scaled with Avatar.Scale by the time we perform culling
     AvatarBoundingVolume.R = 1f;
     AvatarBoundingVolume.Min = new Vector3(-0.5f, -0.5f, -0.5f);
     AvatarBoundingVolume.Max = new Vector3(0.5f, 0.5f, 0.5f);
 }