//[ReloadMethod]
        public void DrawStretchParams(DoorExpandedDef thingDef, Vector3 drawPos, Rot4 rotation, out Mesh mesh, out Matrix4x4 matrix, float mod = 1, bool flipped = false)
        {
            base.Rotation = Building_Door.DoorRotationAt(base.Position, base.Map);
            bool    verticalRotation = base.Rotation.IsHorizontal;
            Vector3 rotationVector   = default(Vector3);

            if (!flipped)
            {
                rotationVector = new Vector3(0f, 0f, -1f);
                mesh           = MeshPool.plane10;
            }
            else
            {
                rotationVector = new Vector3(0f, 0f, 1f);
                mesh           = MeshPool.plane10Flip;
            }
            rotation.Rotate(RotationDirection.Clockwise);
            rotationVector = rotation.AsQuat * rotationVector;

            Vector3 graphicVector = drawPos;

            graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.DoorMoveable);
            graphicVector  += rotationVector * (mod * 1.15f);

            //Vector3 scaleVector = new Vector3(thingDef.graphicData.drawSize.x, 1f, thingDef.graphicData.drawSize.y);
            float   persMod     = (thingDef.fixedPerspective) ? 2f : 1f;
            Vector3 scaleVector = (verticalRotation) ?
                                  new Vector3((thingDef.graphicData.drawSize.x * persMod) - mod * 1.3f, 1f, thingDef.graphicData.drawSize.y * persMod) :
                                  new Vector3((thingDef.graphicData.drawSize.x) - mod * 1.3f, 1f, thingDef.graphicData.drawSize.y);


            matrix = default(Matrix4x4);
            matrix.SetTRS(graphicVector, base.Rotation.AsQuat, scaleVector);
        }
        public static void DrawParams(DoorExpandedDef thingDef, Vector3 drawPos, Rot4 rotation, out Mesh mesh, out Matrix4x4 matrix, float mod = 1, bool flipped = false)
        {
            bool    verticalRotation = rotation.IsHorizontal;
            Vector3 rotationVector   = default(Vector3);

            if (!flipped)
            {
                rotationVector = new Vector3(-1f, 0f, 0f);
                mesh           = MeshPool.plane10;
            }
            else
            {
                rotationVector = new Vector3(1f, 0f, 0f);
                mesh           = MeshPool.plane10Flip;
            }

            Quaternion rotQuat = rotation.AsQuat;

            rotationVector = rotQuat * rotationVector;

            Vector3 graphicVector = drawPos;

            graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.DoorMoveable);
            graphicVector  += rotationVector * mod;

            //Vector3 scaleVector = new Vector3(thingDef.graphicData.drawSize.x, 1f, thingDef.graphicData.drawSize.y);
            float   persMod     = (thingDef.fixedPerspective) ? 2f : 1f;
            Vector3 scaleVector = (verticalRotation) ?
                                  new Vector3(thingDef.graphicData.drawSize.x * persMod, 1f, thingDef.graphicData.drawSize.y * persMod) :
                                  new Vector3(thingDef.graphicData.drawSize.x, 1f, thingDef.graphicData.drawSize.y);


            matrix = default(Matrix4x4);
            matrix.SetTRS(graphicVector, rotQuat, scaleVector);
        }
        public static void DrawDoubleSwingParams(DoorExpandedDef thingDef, Vector3 drawPos, Rot4 rotation,
                                                 out Mesh mesh, out Matrix4x4 matrix, float mod = 1, bool flipped = false)
        {
            bool verticalRotation = rotation.IsHorizontal;

            rotation = (rotation == Rot4.South) ? Rot4.North : rotation;
            Vector3 rotationVector = default(Vector3);

            mesh = null;
            if (!flipped)
            {
                rotationVector = new Vector3(-1f, 0f, 0f);
                if (verticalRotation)
                {
                    rotationVector = new Vector3(1.4f, 0f, 1.1f);
                }
                mesh = MeshPool.plane10;
            }
            else
            {
                rotationVector = new Vector3(1f, 0f, 0f);
                if (verticalRotation)
                {
                    rotationVector = new Vector3(-1.4f, 0f, 1.1f);
                }
                mesh = MeshPool.plane10Flip;
            }

            Quaternion rotQuat = rotation.AsQuat;

            if (verticalRotation)
            {
                rotQuat = (!flipped)
                    ? Quaternion.AngleAxis(rotation.AsAngle + (mod * -100f), Vector3.up)
                    : Quaternion.AngleAxis(rotation.AsAngle + (mod * 100f), Vector3.up);
            }

            rotationVector = rotQuat * rotationVector;


            Vector3 graphicVector = drawPos;

            graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.DoorMoveable);
            if (verticalRotation)
            {
                if (!flipped && rotation == Rot4.East ||
                    flipped && rotation == Rot4.West)
                {
                    graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.BuildingOnTop);
                }
            }

            //if (!verticalRotation)
            //if (verticalRotation) mod *= 2f;
            graphicVector += rotationVector * mod;

            float   persMod     = (thingDef.fixedPerspective) ? 2f : 1f;
            Vector3 scaleVector = (verticalRotation)
                ? new Vector3(thingDef.graphicData.drawSize.x * persMod, 1f, thingDef.graphicData.drawSize.y * persMod)
                : new Vector3(thingDef.graphicData.drawSize.x, 1f, thingDef.graphicData.drawSize.y);

            matrix = default(Matrix4x4);
            matrix.SetTRS(graphicVector, rotQuat, scaleVector);
        }
        //[ReloadMethod]
        public void DrawFrameParams(DoorExpandedDef thingDef, Vector3 drawPos, Rot4 rotation, bool split, out Mesh mesh,
                                    out Matrix4x4 matrix)
        {
            float   d = (0f + 0.45f * 1) * thingDef.Size.x;
            bool    verticalRotation = rotation.IsHorizontal;
            Vector3 rotationVector   = default(Vector3);

            rotationVector = new Vector3(-1f, 0f, 0f);
            mesh           = MeshPool.plane10;


            if (thingDef.doorFrameSplit != null)
            {
                if (rotation == Rot4.West)
                {
                    //;
                    rotationVector.x = 1f;
                    //rotationVector.z *= -1f;
                    //rotationVector.y *= -1f;
                }
            }

            Quaternion rotQuat = rotation.AsQuat;

            rotationVector = rotQuat * rotationVector;


            Vector3 graphicVector = drawPos;

            graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.Blueprint);
            if (rotation == Rot4.North || rotation == Rot4.South)
            {
                graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.PawnState);
            }
            if (!verticalRotation)
            {
                graphicVector.x += d;
            }
            if (rotation == Rot4.East)
            {
                graphicVector.z -= d;
                if (split)
                {
                    graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.DoorMoveable);
                }
            }

            if (rotation == Rot4.West)
            {
                graphicVector.z += d;
                if (split)
                {
                    graphicVector.y = Altitudes.AltitudeFor(AltitudeLayer.DoorMoveable);
                }
            }


            graphicVector += rotationVector * d;


            float   persMod     = (thingDef.fixedPerspective) ? 2f : 1f;
            Vector3 scaleVector = (verticalRotation)
                ? new Vector3(thingDef.doorFrame.drawSize.x * persMod, 1f, thingDef.doorFrame.drawSize.y * persMod)
                : new Vector3(thingDef.doorFrame.drawSize.x, 1f, thingDef.doorFrame.drawSize.y);

            Vector3 offset = thingDef.doorFrameOffset;

            if (thingDef.doorFrameSplit != null)
            {
                if (rotation == Rot4.West)
                {
                    rotQuat          = Quaternion.Euler(0, 270, 0); //new Quaternion(0, 0.7f, 0, -0.7f);// Euler(0, 270, 0);
                    graphicVector.z -= 2.7f;
                    mesh             = MeshPool.plane10Flip;
                    offset           = thingDef.doorFrameSplitOffset;
                }
            }

            graphicVector += offset;


            matrix = default(Matrix4x4);
            matrix.SetTRS(graphicVector, rotQuat, scaleVector);
        }