Exemplo n.º 1
0
        public void CastRay(Vector3D from, Vector3D to, List <MyClusterQueryResult> results)
        {
            // If m_clusterTree doesn't exist, or the results array is null, don't perform function
            if (m_clusterTree == null || results == null)
            {
                return;
            }

            LineD line = new LineD(from, to);

            m_clusterTree.OverlapAllLineSegment(ref line, m_lineResultList);

            foreach (var res in m_lineResultList)
            {
                // Skip results without an element
                if (res.Element == null)
                {
                    continue;
                }

                results.Add(new MyClusterQueryResult()
                {
                    AABB     = res.Element.AABB,
                    UserData = res.Element.UserData
                });
            }
        }
Exemplo n.º 2
0
        public static void GetAllEntitiesInRay(ref LineD ray, List <MyLineSegmentOverlapResult <MyEntity> > result, MyEntityQueryType qtype = MyEntityQueryType.Both)
        {
            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyGamePruningStructure::GetAllEntitiesInRay");
            if (qtype.HasDynamic())
            {
                m_dynamicObjectsTree.OverlapAllLineSegment <MyEntity>(ref ray, result);
            }
            if (qtype.HasStatic())
            {
                m_staticObjectsTree.OverlapAllLineSegment <MyEntity>(ref ray, result, false);
            }
            int topmostCount = result.Count;

            for (int i = 0; i < topmostCount; i++)
            {
                if (result[i].Element.Hierarchy != null)
                {
                    result[i].Element.Hierarchy.QueryLine(ref ray, result);
                }
            }
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
        }
        public static void GetAllEntitiesInRay(ref LineD ray, List <MyLineSegmentOverlapResult <MyEntity> > result)
        {
            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyGamePruningStructure::GetAllEntitiesInRay");
            m_topMostEntitiesTree.OverlapAllLineSegment <MyEntity>(ref ray, result);
            int topmostCount = result.Count;

            for (int i = 0; i < topmostCount; i++)
            {
                if (result[i].Element.Hierarchy != null)
                {
                    result[i].Element.Hierarchy.QueryLine(ref ray, result);
                }
            }
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
        }
Exemplo n.º 4
0
        public void CastRay(Vector3D from, Vector3D to, List <MyClusterQueryResult> results)
        {
            LineD line = new LineD(from, to);

            m_clusterTree.OverlapAllLineSegment(ref line, m_lineResultList);

            foreach (var res in m_lineResultList)
            {
                results.Add(new MyClusterQueryResult()
                {
                    AABB     = res.Element.AABB,
                    UserData = res.Element.UserData
                });
            }
        }
Exemplo n.º 5
0
 private void Hierarchy_QueryLine(LineD query, List <MyLineSegmentOverlapResult <MyEntity> > results)
 {
     m_sectors.OverlapAllLineSegment <MyEntity>(ref query, results, clear: false);
 }
        public static MyRenderObject GetAnyIntersectionWithLine(MyDynamicAABBTreeD tree, ref VRageMath.LineD line, MyRenderObject ignoreObject0, MyRenderObject ignoreObject, List<MyLineSegmentOverlapResult<MyElement>> elementList)
        {
            tree.OverlapAllLineSegment(ref line, elementList);

            foreach (MyLineSegmentOverlapResult<MyElement> element in elementList)
            {
                MyRenderObject renderObject = ((MyRenderObject)element.Element);

                Debug.Assert(!renderObject.NearFlag);
                //Debug.Assert(renderObject.Visible);

                //  Objects to ignore
                if ((renderObject == ignoreObject0) || (renderObject == ignoreObject))
                    continue;

                //Vector3? testResultEx;
                if (renderObject.GetIntersectionWithLine(ref line))
                {
                    return renderObject;
                }


                /*
 if (testResultEx != null)
 {
     Vector3 dir = line.Direction;

     if (Vector3.Dot((testResultEx.Value - line.From), dir) > 0)
     {
         if (ret == null)
         {
             ret = testResultEx;
             currentObject = renderObject;
         }

         if ((testResultEx.Value - line.From).Length() < (ret.Value - line.From).Length())
         {
             ret = testResultEx;
             currentObject = renderObject;
         }
     }
 }    */
            }

            return null;
        }
Exemplo n.º 7
0
 public static void GetVoxelMapsOverlappingRay(ref LineD ray, List <MyLineSegmentOverlapResult <MyVoxelBase> > result)
 {
     ProfilerShort.Begin("MyGamePruningStructure::GetVoxelMapsOverlappingRay");
     m_voxelMapsTree.OverlapAllLineSegment <MyVoxelBase>(ref ray, result);
     ProfilerShort.End();
 }
 public static void GetAllEntitiesInRay <T>(ref LineD ray, List <MyLineSegmentOverlapResult <T> > result)
 {
     VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("MyGamePruningStructure::GetAllEntitiesInRay");
     m_aabbTree.OverlapAllLineSegment <T>(ref ray, result);
     VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
 }
Exemplo n.º 9
0
 public void GetAllAlongLine(List <MyLineSegmentOverlapResult <T> > result, ref LineD line, uint flags = 0)
 {
     tree.OverlapAllLineSegment(ref line, result, flags, false);
 }
Exemplo n.º 10
0
 public void GetAllEntitiesInRay <T>(ref LineD ray, List <MyLineSegmentOverlapResult <T> > result)
 {
     MathTree.OverlapAllLineSegment <T>(ref ray, result);
 }