// Determine whether this box contains, intersects, or is disjoint from
        // the given frustum.
        public ContainmentType Contains(BoundingFrustum frustum)
        {
            // Convert this bounding box to an equivalent BoundingFrustum, so we can rely on BoundingFrustum's
            // implementation. Note that this is very slow, since BoundingFrustum builds various data structures
            // for this test that it caches internally. To speed it up, you could convert the box to a frustum
            // just once and re-use that frustum for repeated tests.
            BoundingFrustum temp = ConvertToFrustum();

            return(temp.Contains(frustum));
        }
Example #2
0
        internal static void Render()
        {
            m_instance.ViewProjection = MyEnvironment.ViewProjectionAt0;
            m_instance.Viewport       = new MyViewport(MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y);
            //m_instance.DepthBuffer = MyRender.MainGbuffer.DepthBuffer.DepthStencil;
            //m_instance.RTs = MyRender.MainGbuffer.GbufferTargets;

            m_instance.PerFrame();
            m_instance.Begin();

            var viewFrustum = new BoundingFrustum(MyEnvironment.ViewProjection);

            foreach (var f in MyComponentFactory <MyFoliageComponent> .GetAll())
            {
                if (f.m_owner.CalculateCameraDistance() < MyRender11.RenderSettings.FoliageDetails.GrassDrawDistance() &&
                    viewFrustum.Contains(f.m_owner.Aabb) != VRageMath.ContainmentType.Disjoint)
                {
                    f.Render(m_instance);
                }
            }

            m_instance.End();
        }
        internal static void Render()
        {
            m_instance.ViewProjection = MyEnvironment.ViewProjectionAt0;
            m_instance.Viewport = new MyViewport(MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y);
            //m_instance.DepthBuffer = MyRender.MainGbuffer.DepthBuffer.DepthStencil;
            //m_instance.RTs = MyRender.MainGbuffer.GbufferTargets;

            m_instance.PerFrame();
            m_instance.Begin();

            var viewFrustum = new BoundingFrustum(MyEnvironment.ViewProjection);
            foreach(var f in MyComponentFactory<MyFoliageComponent>.GetAll())
            {
                if (f.m_owner.CalculateCameraDistance() < MyRender11.RenderSettings.FoliageDetails.GrassDrawDistance()
                    && viewFrustum.Contains(f.m_owner.Aabb) != VRageMath.ContainmentType.Disjoint)
                {
                    f.Render(m_instance);
                }
            }

            m_instance.End();
        }
 // Determine whether the given frustum contains, intersects, or is disjoint from
 // the given oriented box.
 public static ContainmentType Contains(BoundingFrustum frustum, ref MyOrientedBoundingBox obox)
 {
     return(frustum.Contains(obox.ConvertToFrustum()));
 }