Example #1
0
        public void RenderCartInternal(Vector3 loc, Quaternion quat, Rot4 rotation, Graphic graphic, int layer = 0)
        {
            Mesh     mesh = graphic.MeshAt(rotation);
            Material mat  = graphic.MatSingle;

            Graphics.DrawMesh(mesh, loc, quat, mat, layer);
        }
Example #2
0
        // Token: 0x06000037 RID: 55 RVA: 0x0000320C File Offset: 0x0000140C
        public override void DrawWorker(Vector3 loc, Rot4 rot, ThingDef thingDef, Thing thing, float extraRotation)
        {
            foreach (var thing2 in Find.CurrentMap.thingGrid.ThingsAt(loc.ToIntVec3()))
            {
                if (thing2.def.thingClass != typeof(Building_GachaponCollection))
                {
                    continue;
                }

                loc.z += 0.1f;
                break;
            }

            base.DrawWorker(loc, rot, thingDef, thing, extraRotation);
            var mesh       = baseGraphic.MeshAt(rot);
            var quaternion = QuatFromRot(rot);

            if (extraRotation != 0f)
            {
                quaternion *= Quaternion.Euler(Vector3.up * extraRotation);
            }

            var unused = new Vector3(loc.x, loc.y - 0.05f, loc.z);

            Graphics.DrawMesh(mesh, loc, quaternion, baseGraphic.MatSingle, 0);
        }
        public override void Draw()
        {
            base.Draw();
            if (DisabledGraphicOn || !ManuallyOperated)
            {
                return;
            }

            if (graphic != null)
            {
                Graphic  obj  = GraphicColoredFor(this, graphic);
                Mesh     val2 = obj.MeshAt(Rotation);
                Material val3 = obj.MatAt(Rotation, null);
                if (base.def.graphic is Graphic_Single)
                {
                    Mesh    obj2     = val2;
                    Vector3 val4     = this.DrawPos + Altitudes.AltIncVect;
                    Rot4    rotation = this.Rotation;
                    Graphics.DrawMesh(obj2, val4, rotation.AsQuat, val3, 0);
                }
                if (base.def.graphic is Graphic_Multi)
                {
                    Graphics.DrawMesh(val2, this.DrawPos + Altitudes.AltIncVect, Quaternion.identity, val3, 0);
                }
            }
        }
Example #4
0
        public static void DrawShadow(Graphic graphic, Vector3 loc, Rot4 rot, ThingDef def)
        {
            Mesh       mesh = graphic.MeshAt(rot);
            Quaternion quat = graphic.QuatFromRot(rot);

            //if (graphic.extraRotation != 0f)
            //{
            //	quat *= Quaternion.Euler(Vector3.up * graphic.extraRotation);
            //}
            loc += graphic.DrawOffset(rot);
            Material mat = graphic.MatAt(rot, null);

            graphic.DrawMeshInt(mesh, loc, quat, mat);

            var shadowInfo = Traverse.Create(graphic.ShadowGraphic).Field("shadowInfo").GetValue <ShadowData>();
            var shadowMesh = Traverse.Create(graphic.ShadowGraphic).Field("shadowMesh").GetValue <Mesh>();

            if (shadowMesh != null && shadowInfo != null && (Find.CurrentMap == null || !loc.ToIntVec3().InBounds(Find.CurrentMap) ||
                                                             !Find.CurrentMap.roofGrid.Roofed(loc.ToIntVec3())) && DebugViewSettings.drawShadows)
            {
                Vector3 position = loc + shadowInfo.offset;
                position.y = AltitudeLayer.Shadows.AltitudeFor();
                Graphics.DrawMesh(shadowMesh, position, rot.AsQuat, MatBases.SunShadowFade, 0);
            }
        }
Example #5
0
        public override void PostDraw()
        {
            base.PostDraw();

            Graphic gantryGlow = GraphicDatabase.Get <Graphic_Multi>("FX/MedPod_gantryGlow", ShaderDatabase.MoteGlow, new Vector2(3f, 3f), Color.white);

            Building_BedMedPod building_medpod = parent as Building_BedMedPod;
            float gantryGlowAlpha = building_medpod.GantryMoving() ? 1f : 0f;

            Mesh gantryMesh     = Props.gantryGraphicData.Graphic.MeshAt(parent.Rotation);
            Mesh gantryGlowMesh = gantryGlow.MeshAt(parent.Rotation);
            Mesh machineLidMesh = Props.machineLidGraphicData.Graphic.MeshAt(parent.Rotation);

            Vector3 gantryDrawPos     = parent.DrawPos;
            Vector3 gantryGlowDrawPos = parent.DrawPos;
            Vector3 machineLidDrawPos = parent.DrawPos;

            float drawAltitude = AltitudeLayer.Pawn.AltitudeFor();

            gantryDrawPos.y     = drawAltitude + 0.03f;
            gantryGlowDrawPos.y = drawAltitude + 0.06f;
            machineLidDrawPos.y = drawAltitude + 0.09f;

            // GetColoredVersion() ensures that the gantry and machine lid get tinted correctly with the material color if the parent MedPod furniture is stuffed

            Graphics.DrawMesh(gantryMesh, gantryDrawPos + Props.gantryGraphicData.drawOffset.RotatedBy(parent.Rotation) + GantryPositionOffset().RotatedBy(parent.Rotation), Quaternion.identity, Props.gantryGraphicData.Graphic.GetColoredVersion(Props.gantryGraphicData.Graphic.Shader, parent.DrawColor, parent.DrawColorTwo).MatAt(parent.Rotation, null), 0);

            Graphics.DrawMesh(gantryGlowMesh, gantryGlowDrawPos + Props.gantryGraphicData.drawOffset.RotatedBy(parent.Rotation) + GantryPositionOffset().RotatedBy(parent.Rotation), Quaternion.identity, FadedMaterialPool.FadedVersionOf(gantryGlow.MatAt(parent.Rotation, null), gantryGlowAlpha), 0);

            Graphics.DrawMesh(machineLidMesh, machineLidDrawPos + Props.machineLidGraphicData.drawOffset.RotatedBy(parent.Rotation), Quaternion.identity, Props.machineLidGraphicData.Graphic.GetColoredVersion(Props.machineLidGraphicData.Graphic.Shader, parent.DrawColor, parent.DrawColorTwo).MatAt(parent.Rotation), 0);
        }
Example #6
0
        public override void Draw()
        {
            var scale  = HeightDrawScale;
            var matrix = new Matrix4x4();
            var rot    = Rotation;

            matrix.SetTRS(DrawPos + Graphic.DrawOffset(rot), Graphic.QuatFromRot(rot), new Vector3(scale, 0, scale));
            Graphics.DrawMesh(Graphic.MeshAt(rot), matrix, Graphic.MatAt(rot), 0);
        }
        public static void DrawSheath(Pawn pawn, Thing eq, Vector3 drawLoc, float aimAngle, Graphic graphic)
        {
            float num = aimAngle;

            num %= 360f;
            CompSheath comp = eq.TryGetComp <CompSheath>();

            if (comp != null)
            {
                Graphics.DrawMesh(graphic.MeshAt(pawn.Rotation), drawLoc, Quaternion.AngleAxis(num, Vector3.up), graphic.MatAt(pawn.Rotation), 0);
            }
        }
Example #8
0
        public static void DrawAdvanced(this Graphic graphic, Vector3 loc, Rot4 rot, float rotY, ThingDef thingDef, Thing thing)
        {
            Mesh       mesh     = graphic.MeshAt(rot);
            Quaternion rotation = graphic.GetQuatFromRot(rot) * Quaternion.AngleAxis(rotY, Vector3.up);
            Material   material = graphic.MatAt(rot, thing);

            Graphics.DrawMesh(mesh, loc, rotation, material, 0);
            if (graphic.ShadowGraphic != null)
            {
                //graphic.ShadowGraphic.DrawWorker(loc, rot, thingDef, thing);
            }
        }
Example #9
0
        public static void DrawRuneAttachments(Thing eq, ref Vector3 drawLoc, float aimAngle, bool useAimingRotation = true, Graphic graphic = null, Rot4 rot = new Rot4())
        {
            SocketComp socketable = eq.TryGetComp <SocketComp>();

            if (socketable == null)
            {
                return;
            }

            //Vanilla routines.
            Mesh  mesh = null;
            float num  = aimAngle;

            if (useAimingRotation)
            {
                num = aimAngle - 90f;

                if (aimAngle > 20f && aimAngle < 160f)
                {
                    mesh = MeshPool.plane10;
                    num += eq.def.equippedAngleOffset;
                }
                else if (aimAngle > 200f && aimAngle < 340f)
                {
                    mesh = MeshPool.plane10Flip;
                    num -= 180f;
                    num -= eq.def.equippedAngleOffset;
                }
                else
                {
                    mesh = MeshPool.plane10;
                    num += eq.def.equippedAngleOffset;
                }
                num %= 360f;
            }
            else
            {
                mesh = graphic.MeshAt(rot);
            }

            //Custom drawing.
            Vector3 runeDrawLoc = drawLoc + new Vector3(0f, 0.01f, 0f);

            foreach (RuneComp rune in socketable.SocketedRunes)
            {
                if (rune.OverlayGraphic != null)
                {
                    Material matSingle = rune.OverlayGraphic.MatSingle;
                    Graphics.DrawMesh(mesh, runeDrawLoc, Quaternion.AngleAxis(num, Vector3.up), matSingle, 0);
                }
            }
        }
Example #10
0
        public static void DrawHeadOverlay(Pawn pawn, string patronName)
        {
            Graphic    headmark = AfflictionDrawerUtility.GetHeadGraphic(pawn, patronName);
            Rot4       rot      = pawn.Rotation;
            Quaternion quat     = pawn.Rotation.AsQuat;
            Vector3    b        = quat * pawn.Drawer.renderer.BaseHeadOffsetAt(rot);

            b.y += 0.01f;
            Mesh     mesh4 = headmark.MeshAt(rot);
            Material mat2  = headmark.MatAt(rot);

            GenDraw.DrawMeshNowOrLater(mesh4, pawn.DrawPos + b, quat, mat2, false);
        }
Example #11
0
        public override void Draw()
        {
            base.Draw();

            if (powerComp.PowerOn && (Rotation == Rot4.South))
            {
                Graphic screenGlow        = GraphicDatabase.Get <Graphic_Single>("FX/MedPod_screenGlow_south", ShaderDatabase.MoteGlow, new Vector2(4f, 5f), Color.white);
                Mesh    screenGlowMesh    = screenGlow.MeshAt(Rotation);
                Vector3 screenGlowDrawPos = DrawPos;
                screenGlowDrawPos.y = AltitudeLayer.Building.AltitudeFor() + 0.03f;

                Graphics.DrawMesh(screenGlowMesh, screenGlowDrawPos, Quaternion.identity, FadedMaterialPool.FadedVersionOf(screenGlow.MatAt(Rotation, null), 1), 0);
            }
        }
        public static void Postfix(PawnRenderer __instance, Pawn ___pawn, Vector3 rootLoc, float angle, bool renderBody, Rot4 bodyFacing, Rot4 headFacing, RotDrawMode bodyDrawType, bool portrait, bool headStump, bool invisible)
        {
            Pawn p = ___pawn;

            if (!Genital_Helper.has_penis_fertile(p) && !Genital_Helper.has_penis_infertile(p) && !Genital_Helper.has_multipenis(p))
            {
                return;
            }

            string originalPath = __instance.graphics.nakedGraphic.path;
            string modifiedPath = originalPath + "_Lewd";

            if (ContentFinder <Texture2D> .Get(modifiedPath + "_north", false) != null)
            {
                if (p?.jobs?.curDriver != null && p.jobs.curDriver is JobDriver_Sex ||
                    (timeSinceSex.ContainsKey(p)))
                {
                    GraphicData originalGraphicData = p.ageTracker.CurKindLifeStage.bodyGraphicData;
                    Graphic     lewdGraphic         = CachedGraphics.LewdGraphics.TryGetValue(modifiedPath);

                    if (lewdGraphic != null)
                    {
                        Mesh lewdMesh = lewdGraphic.MeshAt(bodyFacing);
                        rootLoc.y = (AltitudeLayer.LayingPawn - 1).AltitudeFor();
                        GenDraw.DrawMeshNowOrLater(lewdMesh, rootLoc, Quaternion.AngleAxis(angle, Vector3.up), lewdGraphic.MatAt(bodyFacing), portrait);
                    }
                }

                if (p?.jobs?.curDriver != null && p.jobs.curDriver is JobDriver_Sex)
                {
                    if (p.jobs.curDriver.ticksLeftThisToil <= 30f)
                    {
                        if (timeSinceSex.ContainsKey(p))
                        {
                            timeSinceSex[p] = GenTicks.TicksGame - Rand.Range(0, 180);
                        }
                        else
                        {
                            timeSinceSex.Add(p, GenTicks.TicksGame);
                        }
                    }
                }
                else if (timeSinceSex.ContainsKey(p) && timeSinceSex[p] + 1000 < GenTicks.TicksGame) //time delay to disappearing texture on job end
                {
                    timeSinceSex.Remove(p);
                }
            }
        }
Example #13
0
        public override void Draw()
        {
            base.Draw();
            if (!started)
            {
                return;
            }

            if (graphic != null)
            {
                Graphic  obj  = GraphicColoredFor(this, graphic);
                Mesh     val2 = obj.MeshAt(Rotation);
                Material val3 = obj.MatAt(Rotation, null);
                if (base.def.graphic is Graphic_Multi)
                {
                    Graphics.DrawMesh(val2, this.DrawPos + Altitudes.AltIncVect, Quaternion.identity, val3, 0);
                }
            }
        }
Example #14
0
        public static void DrawGhostCannonTextures(this VehicleDef vehicleDef, Vector3 loc, Rot8 rot, Color ghostCol)
        {
            if (vehicleDef.GetSortedCompProperties <CompProperties_Cannons>() is CompProperties_Cannons props)
            {
                foreach (VehicleTurret cannon in props.turrets)
                {
                    if (cannon.NoGraphic)
                    {
                        continue;
                    }

                    cannon.ResolveCannonGraphics(vehicleDef);

                    try
                    {
                        Graphic graphic = vehicleDef.GhostGraphicFor(cannon, ghostCol);

                        Vector3 topVectorRotation = new Vector3(loc.x, 1f, loc.y).RotatedBy(0f);
                        float   locationRotation  = cannon.defaultAngleRotated + rot.AsAngle;
                        if (cannon.attachedTo != null)
                        {
                            locationRotation += cannon.attachedTo.defaultAngleRotated + rot.AsAngle;
                        }
                        Pair <float, float> drawOffset = RenderHelper.ShipDrawOffset(Rot8.North, cannon.turretRenderLocation.x, cannon.turretRenderLocation.y, out Pair <float, float> rotOffset1, locationRotation, cannon.attachedTo);

                        Vector3 topVectorLocation = new Vector3(loc.x + drawOffset.First + rotOffset1.First, loc.y + cannon.drawLayer, loc.z + drawOffset.Second + rotOffset1.Second);
                        Mesh    cannonMesh        = graphic.MeshAt(Rot4.North);

                        Graphics.DrawMesh(cannonMesh, topVectorLocation, locationRotation.ToQuat(), graphic.MatAt(Rot4.North), 0);
                    }
                    catch (Exception ex)
                    {
                        Log.Error($"Failed to render Cannon=\"{cannon.turretDef.defName}\" for VehicleDef=\"{vehicleDef.defName}\", Exception: {ex.Message}");
                    }
                }
            }
        }
 public void RenderCartInternal(Vector3 loc, Quaternion quat, Rot4 rotation, Graphic graphic, int layer = 0)
 {
     Mesh mesh = graphic.MeshAt(rotation);
     Material mat = graphic.MatSingle;
     Graphics.DrawMesh(mesh, loc, quat, mat, layer);
 }