Exemple #1
0
        public float GetScreenPhysicalHeight()
        {
            Vector3 forward = GetScreenSpaceFowardVector();

            forward = Vector3.TransformNormal(forward, WorldMatrixMOD) * new Vector3(1, 1, -1);

            var plane     = new Plane(Vector3.Normalize(new Vector3(forward.X, 0, forward.Z)), 0);
            var topRay    = GetScreenRay(new Vector2(GFX.Device.Viewport.Width * 0.5f, GFX.Device.Viewport.Height * 0.333333f));
            var iTop      = topRay.Intersects(plane);
            var bottomRay = GetScreenRay(new Vector2(GFX.Device.Viewport.Width * 0.5f, GFX.Device.Viewport.Height * 0.666666f));
            var iBottom   = bottomRay.Intersects(plane);

            if (iTop.HasValue)
            {
                LastScreenTop = topRay.Position + (topRay.Direction * iTop.Value);
            }

            if (iBottom.HasValue)
            {
                LastScreenBottom = bottomRay.Position + (bottomRay.Direction * iBottom.Value);
            }

            DbgPrintA.Clear();
            DbgPrintA.AppendLine("SCREEN TOP");
            DbgPrintA.Position3D = LastScreenTop;


            DbgPrintB.Clear();
            DbgPrintB.AppendLine("SCREEN BOTTOM");
            DbgPrintB.Position3D = LastScreenBottom;

            float result = (LastScreenTop - LastScreenBottom).Length();

            return(result);
        }
Exemple #2
0
            public void DrawPrimText(Matrix world, bool isForce, int globalIDOffset)
            {
                if (DisableTextDraw && !isForce)
                {
                    return;
                }

                SpawnPrinter.Clear();

                bool hasSpawnStuff = !(SFXSpawnIDs.Count == 0 && BulletSpawnIDs.Count == 0 && MiscSpawnTexts.Count == 0);

                //string dmyIDTxt = (ReferenceID == 200) ? $"[{ReferenceID} (All Over Body)]" : $"[{ReferenceID}]";
                string dmyIDTxt = $"{(ReferenceID + globalIDOffset)}";

                if (hasSpawnStuff && !isForce)
                {
                    SpawnPrinter.AppendLine(dmyIDTxt, GetCurrentSpawnColor());
                }
                else if (DBG.CategoryEnableNameDraw[DbgPrimCategory.DummyPoly] || isForce)
                {
                    SpawnPrinter.AppendLine(dmyIDTxt, DBG.COLOR_DUMMY_POLY);
                }


                Vector3 currentPos = Vector3.Transform(Vector3.Zero, CurrentMatrix * world);

                if (hasSpawnStuff && !isForce)
                {
                    foreach (var sfx in SFXSpawnIDs)
                    {
                        SpawnPrinter.AppendLine($"SFX {sfx}", ColorSpawnSFX);
                    }

                    foreach (var bullet in BulletSpawnIDs)
                    {
                        SpawnPrinter.AppendLine($"Bullet {bullet}", ColorSpawnBulletsMisc);
                    }

                    foreach (var misc in MiscSpawnTexts)
                    {
                        SpawnPrinter.AppendLine(misc, ColorSpawnBulletsMisc);
                    }
                }

                if (ShowAttack != null && !isForce)
                {
                    string atkName = ShowAttack.Name;
                    if (!string.IsNullOrWhiteSpace(atkName) && atkName.Length > 64)
                    {
                        atkName = atkName.Substring(0, 64) + "...";
                    }
                    SpawnPrinter.AppendLine($"ATK {ShowAttack.ID}"
                                            + (!string.IsNullOrWhiteSpace(atkName) ? $" {atkName}" : ""),
                                            ShowAttack.Hits[0].GetColor());
                }

                if (SpawnPrinter.LineCount > 0)
                {
                    SpawnPrinter.Position3D = currentPos;
                    SpawnPrinter.Draw();
                }
            }