当前位置: 首页>>代码示例>>C#>>正文


C# BoundingBox.CreateInvalid方法代码示例

本文整理汇总了C#中BoundingBox.CreateInvalid方法的典型用法代码示例。如果您正苦于以下问题:C# BoundingBox.CreateInvalid方法的具体用法?C# BoundingBox.CreateInvalid怎么用?C# BoundingBox.CreateInvalid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoundingBox的用法示例。


在下文中一共展示了BoundingBox.CreateInvalid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateInvalidAABB

 /// <summary>
 /// CreateInvalidAABB
 /// </summary>
 /// <returns></returns>
 public static BoundingBox CreateInvalidAABB()
 {
     BoundingBox aabb = new BoundingBox();
     aabb = aabb.CreateInvalid();
     return aabb;
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:10,代码来源:MyMath.cs

示例2: CalculateAABB

        //private bool TestAABB(ref BoundingBox bbox)
        //{
        //    return (bbox.Max - bbox.Min).Length() < MyLightsConstants.MAX_SPOTLIGHT_AABB_DIAGONAL;
        //}

        private static void CalculateAABB(ref BoundingBox bbox, out float scaleZ, out float scaleXY, ref Vector3 position, ref Vector3 direction, ref Vector3 up, float reflectorConeMaxAngleCos, float reflectorRange)
        {
            float cosAngle = 1 - reflectorConeMaxAngleCos;
            scaleZ = reflectorRange;
            // Calculate cone side (hypotenuse of triangle)
            float side = reflectorRange / cosAngle;
            // Calculate cone bottom scale (Pythagoras theorem)
            scaleXY = (float)System.Math.Sqrt(side * side - reflectorRange * reflectorRange) * 2;

            up = MyMwcUtils.Normalize(up);
            Vector3 coneSideDirection = Vector3.Cross(up, direction);
            coneSideDirection = MyMwcUtils.Normalize(coneSideDirection);
            Vector3 coneCenter = position + direction * scaleZ;
            Vector3 pt1 = coneCenter + coneSideDirection * scaleXY / 2 + up * scaleXY / 2;
            Vector3 pt2 = coneCenter - coneSideDirection * scaleXY / 2 + up * scaleXY / 2;
            Vector3 pt3 = coneCenter + coneSideDirection * scaleXY / 2 - up * scaleXY / 2;
            Vector3 pt4 = coneCenter - coneSideDirection * scaleXY / 2 - up * scaleXY / 2;

            bbox = bbox.CreateInvalid();
            bbox = bbox.Include(ref position);
            //bbox = bbox.Include(ref coneCenter);
            bbox = bbox.Include(ref pt1);
            bbox = bbox.Include(ref pt2);
            bbox = bbox.Include(ref pt3);
            bbox = bbox.Include(ref pt4);
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:31,代码来源:MyLight.cs

示例3: DebugDraw

        public void DebugDraw()
        {        
            return;
            MyStateObjects.WireframeRasterizerState.Apply();
            for (int i = 0; i < NumSplits; i++)
            {
                cameraFrustum.Matrix = m_lightCameras[i].CameraSubfrustum;
                cameraFrustum.GetCorners(frustum);

                var tmp = frustum[3];
                frustum[3] = frustum[2];
                frustum[2] = tmp;

                //MyDebugDraw.DrawBoundingFrustum(cameraFrustum, frustumColors[i]);
                MySimpleObjectDraw.OcclusionPlaneDraw(frustum);
                //MyDebugDraw.DrawTriangle(frustum[0], frustum[1], frustum[2], frustumColors[i], frustumColors[i], frustumColors[i]);
                //MyDebugDraw.DrawTriangle(frustum[1], frustum[2], frustum[3], frustumColors[i], frustumColors[i], frustumColors[i]);
            }

            return;
                   
            bool update = false;

            if (MyRender.CurrentRenderSetup.CallerID.Value == MyRenderCallerEnum.Main)
            {
                if (update)
                {
                    mainCamera = MyCamera.GetBoundingFrustum().Matrix;
                }

                for (int i = 0; i < NumSplits; i++)
                {
                    if (update)
                    {
                        Vector4 c = frustumColors[i].ToVector4();

                        //MyDebugDraw.DrawAABBLowRes(ref box, ref c, 1);
                        //BoundingFrustum bf = new BoundingFrustum();

                        //frustumMatrices[i] = m_lightCameras[i].CameraSubfrustum;
                        frustumMatrices[i] = m_lightCameras[i].BoundingFrustum.Matrix;
                    }

                    DebugDrawFrustum(frustumMatrices[i], frustumColors[i]);


                    Vector4 cc = frustumColors[i].ToVector4();

                    BoundingFrustum frma = new BoundingFrustum(frustumMatrices[i]);
                    MyRender.PrepareEntitiesForDraw(ref frma, Vector3.Zero, 0, (MyOcclusionQueryID)(i + 1), m_castingRenderObjects, m_castingCullObjects, m_occlusionQueriesLists[i], ref MyPerformanceCounter.PerCameraDraw.ShadowEntitiesOccluded[i]);
                    BoundingBox aabbFr = new BoundingBox();
                    aabbFr = aabbFr.CreateInvalid();
                    foreach (MyRenderObject ro in m_castingRenderObjects)
                    {
                        BoundingBox vv = ro.GetWorldSpaceAABB();
                        //MyDebugDraw.DrawAABBLowRes(ref vv, ref cc, 1);
                        aabbFr = aabbFr.Include(ref vv);
                    }


                    //MyDebugDraw.DrawAABBLowRes(ref aabbFr, ref cc, 1);
                }

                // DebugDrawFrustum(mainCamera, new Color(1.0f, 1.0f, 1.0f));
            }

        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:67,代码来源:MyShadowRenderer.cs


注:本文中的BoundingBox.CreateInvalid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。