public override void Draw() { Vector3 position = MyPosition; position.y = def.altitudeLayer.AltitudeFor(); if (IsFlying) { if (HasFlyingShadow) { DrawFlyingShadow(DrawPos, ArcRatio); } else if (IsGroundShadowOnly) { GroundShadowGraphic.Draw(position, Rot4.North, this); } } else if (IsGrounded) { if (HasGroundShadow) { GroundShadowGraphic.Draw(position, Rot4.North, this); //Log.Warning("ShadownMote Position:" + position + " - shadow layer:" + AltitudeLayer.Shadows.AltitudeFor()); } else if (HasGroundShadowData) { Log.Warning("should be drawing ground shadow, but not found"); } } Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), position, ExactRotation, def.DrawMatSingle, 0); //Comps_PostDraw(); }
public void RenderPawnAt(Vector3 drawLoc, float angle, bool northSouthRotation) { if (!graphics.AllResolved) { graphics.ResolveAllGraphics(); } RenderPawnInternal(drawLoc, angle, northSouthRotation); if (vehicle.def.race.specialShadowData != null) { if (shadowGraphic == null) { shadowGraphic = new Graphic_Shadow(vehicle.def.race.specialShadowData); } shadowGraphic.Draw(drawLoc, Rot4.North, vehicle, 0f); } if (graphics.vehicle.VehicleGraphic != null && graphics.vehicle.VehicleGraphic.ShadowGraphic != null) { graphics.vehicle.VehicleGraphic.ShadowGraphic.Draw(drawLoc, Rot4.North, vehicle, 0f); } if (vehicle.Spawned && !vehicle.Dead) { //vehicle.stances.StanceTrackerDraw(); vehicle.vPather.PatherDraw(); } }
public override void DrawAt(Vector3 drawLoc) { if (!Spawned) { base.DrawAt(drawLoc); return; } wheelLoc = drawLoc; bodyLoc = drawLoc; //Vertical if (Rotation.AsInt % 2 == 0) { wheelLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Item) + 0.02f; } //horizontal if (axlesComp.HasAxles() && Rotation.AsInt % 2 == 1) { wheelLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn) + 0.04f; bodyLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn) + 0.03f; Vector2 drawSize = def.graphic.drawSize; int num = Rotation == Rot4.West ? -1 : 1; Vector3 vector3 = new Vector3(1f * drawSize.x, 1f, 1f * drawSize.y); Quaternion asQuat = Rotation.AsQuat; float x = 1f * Mathf.Sin(num * (wheelRotation * 0.05f) % (2 * Mathf.PI)); float z = 1f * Mathf.Cos(num * (wheelRotation * 0.05f) % (2 * Mathf.PI)); asQuat.SetLookRotation(new Vector3(x, 0f, z), Vector3.up); wheel_shake = (float)((Math.Sin(tick_time) + Math.Abs(Math.Sin(tick_time))) / 40.0); wheelLoc.z = wheelLoc.z + wheel_shake; Vector3 mountThingLoc = drawLoc; mountThingLoc.y = Altitudes.AltitudeFor(AltitudeLayer.Pawn) + 0.06f; Vector3 mountThingOffset = new Vector3(0, 0, 1).RotatedBy(Rotation.AsAngle); List <Vector3> list; if (axlesComp.GetAxleLocations(drawSize, num, out list)) { foreach (Vector3 current in list) { Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(wheelLoc + current, asQuat, vector3); Graphics.DrawMesh(MeshPool.plane10, matrix, graphic_Wheel_Single.MatAt(Rotation), 0); } } } base.DrawAt(bodyLoc); if (vehicleComp.compProps.specialShadowData != null) { if (shadowGraphic == null) { shadowGraphic = new Graphic_Shadow(vehicleComp.compProps.specialShadowData); } shadowGraphic.Draw(drawLoc, Rot4.North, this); } }