Exemplo n.º 1
0
        //  Checks if specified box intersects bounding box of this this voxel map.
        public bool IsBoxIntersectingBoundingBoxOfThisVoxelMap(ref BoundingBox boundingBox)
        {
            bool outRet;

            WorldAABB.Intersects(ref boundingBox, out outRet);
            return(outRet);
        }
Exemplo n.º 2
0
        //  Return true if voxel map intersects specified sphere.
        //  This method doesn't return exact point of intersection or any additional data.
        //  We don't look for closest intersection - so we stop on first intersection found.
        public override bool GetIntersectionWithSphere(ref BoundingSphere sphere)
        {
            Profiler.Begin("MyVoxelMap.GetIntersectionWithSphere()");
            try
            {
                if (!WorldAABB.Intersects(ref sphere))
                {
                    return(false);
                }

                return(Geometry.Intersects(ref sphere));
            }
            finally
            {
                Profiler.End();
            }
        }
Exemplo n.º 3
0
 public Vector3 GetPosition()
 {
     return(WorldAABB.GetCenter());
 }
Exemplo n.º 4
0
 public unsafe virtual void GetCorners(Vector3D *corners)
 {
     WorldAABB.GetCornersUnsafe(corners);
 }
Exemplo n.º 5
0
        public override bool Draw(MyRenderObject renderObject)
        {
            if (Render.MyRender.GetCurrentLodDrawPass() == MyLodTypeEnum.LOD0)
            {
                if (IsDummyVisible())
                {
                    base.Draw(renderObject);

                    Vector4 color;
                    switch (DummyFlags)
                    {
                    case MyDummyPointFlags.NONE: color = new Vector4(0.5f, 0.7f, 0.1f, 0.3f); break;

                    case MyDummyPointFlags.SAFE_AREA: color = new Vector4(0.2f, 0.3f, 0.22f, 0.1f); break;

                    case MyDummyPointFlags.DETECTOR: color = new Vector4(0.12f, 0.1f, 0.7f, 0.3f); break;

                    case MyDummyPointFlags.PARTICLE: color = new Vector4(0.6f, 0.05f, 0.1f, 0.3f); break;

                    default: color = new Vector4(0.6f, 0.6f, 0.7f, 0.3f); break;
                    }
                    if ((DummyFlags & MyDummyPointFlags.COLOR_AREA) != 0)
                    {
                        color = Color;  // color Color areas with their area color (overriding the default color). I like to write "color".
                    }
                    Matrix worldMatrix = WorldMatrix;

                    if ((int)(DummyFlags & MyDummyPointFlags.TEXTURE_QUAD) > 0)
                    {
                        BoundingBox localAABB = LocalAABB;
                        MySimpleObjectDraw.DrawWireFramedBox(ref worldMatrix, ref localAABB, ref color, 0.01f, 1, LineMaterial);

                        if (!string.IsNullOrEmpty(Name))
                        {
                            //var tex = MinerWars.AppCode.Game.Textures.MyTextureManager.GetTexture<MinerWars.AppCode.Game.Textures.MyTexture2D>(Name);
                            int i = 0;
                            foreach (MyTransparentMaterialEnum trEnum in Enum.GetValues(typeof(MyTransparentMaterialEnum)))
                            {
                                if (MyTransparentMaterialConstants.MyTransparentMaterialStrings[i] == Name)
                                {
                                    Vector4 quadColor = Vector4.One;
                                    MyQuad  quad;
                                    Vector3 position     = GetPosition();
                                    Vector3 zeroPosition = Vector3.Zero;

                                    var   texture = MyTransparentGeometry.GetTexture(trEnum);
                                    float ratio   = texture.Height / (float)texture.Width;

                                    MyUtils.GenerateQuad(out quad, ref position, WorldAABB.Size().X *ratio, WorldAABB.Size().X, ref worldMatrix);
                                    MyTransparentGeometry.AddQuad(trEnum, ref quad, ref quadColor, ref position);
                                }
                                i++;
                            }
                        }
                    }
                    else
                    {
                        if (Type == MyDummyPointType.Box)
                        {
                            BoundingBox localAABB = LocalAABB;
                            MySimpleObjectDraw.DrawTransparentBox(ref worldMatrix, ref localAABB, ref color, true, 1, FaceMaterial, LineMaterial);
                        }
                        else
                        {
                            BoundingSphere localSphere = new BoundingSphere(worldMatrix.Translation, Radius);
                            MySimpleObjectDraw.DrawTransparentSphere(ref worldMatrix, localSphere.Radius, ref color, true, 12, FaceMaterial, LineMaterial);
                        }
                    }
                }

                if (ParticleEffect != null && IsVisible() && Enabled)
                {
                    Vector4 particleColor = Color == Vector4.Zero ? Vector4.One : Color;
                    ParticleEffect.UserColorMultiplier = particleColor;
                    ParticleEffect.UserScale           = UserScale;

                    UpdateWorldVolume();

                    MyParticlesManager.CustomDraw(ParticleEffect);
                }
            }

            return(false);
        }