public override void Draw() { string mote = "OG_Mote_FlameGlow"; if (this.def.projectile.damageDef == AdeptusDamageDefOf.OG_Chaos_Deamon_Warpfire) { mote = "OG_Mote_WarpFireGlow"; } ThingDef moteDef = DefDatabase <ThingDef> .GetNamed(mote); Graphic glow = moteDef.graphic; Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize * traveled); Mesh mesh2 = MeshPool.GridPlane(moteDef.graphicData.drawSize * (traveled * 7)); Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, Graphic.MatSingle, 0); Graphics.DrawMesh(mesh2, this.DrawPos, this.ExactRotation, glow.MatSingle, 0); /* * Rand.PushState(); * Rand.Seed = this.thingIDNumber; * for (int i = 0; i < 180; i++) * { * * * this.DrawPart(Rand.Range(0f, distancetraveled), Rand.Range(0f, 9f), Rand.Range(0.9f, 1.1f), Rand.Range(0.52f, 0.88f)); * } * Rand.PopState(); */ base.Comps_PostDraw(); }
// Token: 0x060052CD RID: 21197 RVA: 0x001BF0C4 File Offset: 0x001BD2C4 public override void DrawAt(Vector3 drawLoc, bool flip = false) { float num = 0f; if (this.def.skyfaller.rotateGraphicTowardsDirection) { num = -this.angle; } if (this.def.skyfaller.angleCurve != null) { this.angle = this.def.skyfaller.angleCurve.Evaluate(this.TimeInAnimation); } if (this.def.skyfaller.rotationCurve != null) { num += this.def.skyfaller.rotationCurve.Evaluate(this.TimeInAnimation); } if (this.def.skyfaller.xPositionCurve != null) { drawLoc.x += this.def.skyfaller.xPositionCurve.Evaluate(this.TimeInAnimation); } if (this.def.skyfaller.zPositionCurve != null) { drawLoc.z += this.def.skyfaller.zPositionCurve.Evaluate(this.TimeInAnimation); } // this.Graphic.Draw(drawLoc, flip ? this.Rotation.Opposite : this.Rotation, this, (base.Position.ToVector3Shifted() - drawLoc).ToAngleFlat()); Graphics.DrawMesh(MeshPool.GridPlane(this.def.graphicData.drawSize), drawLoc, Quaternion.LookRotation((base.Position.ToVector3Shifted() - drawLoc).Yto0()), this.def.DrawMatSingle, 0); }
public override void Draw() { Vector3 targetVector; if (parentPawn != null && parentPawn.stances != null && parentPawn.stances.curStance != null) { Stance_Busy stance_Busy = parentPawn.stances.curStance as Stance_Busy; if (stance_Busy != null) { if (stance_Busy.focusTarg.HasThing) { targetVector = stance_Busy.focusTarg.Thing.DrawPos; } else { targetVector = stance_Busy.focusTarg.Cell.ToVector3Shifted(); } if (swap) { currentGraphic = graphics[0]; } else { currentGraphic = graphics[1]; } currentGraphic.MatSingle.color = FireColor; float angle = (targetVector - parent.TrueCenter()).AngleFlat(); Graphics.DrawMesh(MeshPool.GridPlane(new Vector2(2 - currentPower, 1)), parent.TrueCenter() + posFix + new Vector3(Mathf.Sin(angle * Mathf.Deg2Rad) * 1.1f, 1, Mathf.Cos(angle * Mathf.Deg2Rad)) * 1.1f, Quaternion.AngleAxis(angle, Vector3.up), currentGraphic.MatSingle, 0); } } }
/// <summary> /// Draws projectile if at least a tick away from caster (or always if no caster) /// </summary> public override void Draw() { if (FlightTicks == 0 && launcher != null && launcher is Pawn) { //TODO: Draw at the end of the barrel on the pawn } else { //Projectile //Graphics.DrawMesh(MeshPool.plane10, DrawPos, DrawRotation, def.DrawMatSingle, 0); Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), DrawPos, DrawRotation, def.DrawMatSingle, 0); //Shadow if (castShadow) { //TODO : EXPERIMENTAL Add edifice height var shadowPos = new Vector3(ExactPosition.x, def.Altitude - 0.01f, ExactPosition.z - Mathf.Lerp(shotHeight, 0f, fTicks / StartingTicksToImpact)); //EXPERIMENTAL: + (new CollisionVertical(ExactPosition.ToIntVec3().GetEdifice(Map))).Max); //TODO : Vary ShadowMat plane //Graphics.DrawMesh(MeshPool.plane08, shadowPos, ExactRotation, ShadowMaterial, 0); Graphics.DrawMesh(MeshPool.GridPlane(def.graphicData.drawSize), shadowPos, ExactRotation, ShadowMaterial, 0); } Comps_PostDraw(); } }
public void ClearAndSetup(string name = "New Mesh", Mesh recycleMesh = null) { if (recycleMesh == null) { if (!Application.isPlaying) { mesh = new Mesh(); } else { mesh = MeshPool.Get(); } } else { mesh = recycleMesh; } //mesh = new Mesh(); mesh.name = name; vertices = ListPool <Vector3> .Get(); triangles = ListPool <int> .Get(); colors = ListPool <Color> .Get(); uvs = ListPool <Vector2> .Get(); uvs2 = ListPool <Vector2> .Get(); readyToBuild = true; }
public override void Draw() { if (spinCheck) { if (this.launcher is Pawn) { Pawn pawn = this.launcher as Pawn; if (pawn.equipment != null && pawn.equipment.Primary != null) { ThingWithComps weaponComp = pawn.equipment.Primary; if (weaponComp.def.IsRangedWeapon) { shouldSpin = false; } } spinCheck = false; } } if (shouldSpin) { this.rotationOffset += 49; } if (this.rotationOffset > 360) { this.rotationOffset = this.rotationOffset - 360; } Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize); Graphics.DrawMesh(mesh, DrawPos, Quaternion.AngleAxis(rotationOffset, Vector3.up) * ExactRotation, def.DrawMatSingle, 0); Comps_PostDraw(); }
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 override void Draw() { Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize * traveled); Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, Graphic.MatSingle, 0); base.Comps_PostDraw(); }
RasterCacheResult _rasterizePicture(Picture picture, Matrix3 transform, float devicePixelRatio, int antiAliasing, MeshPool meshPool) { var boundRect = transform.mapRect(picture.paintBounds); var bounds = boundRect.withDevicePixelRatio(devicePixelRatio); var boundsInPixel = boundRect.roundOutScale(devicePixelRatio); var desc = new RenderTextureDescriptor( Mathf.CeilToInt(boundsInPixel.width), Mathf.CeilToInt(boundsInPixel.height), RenderTextureFormat.Default, 24) { useMipMap = false, autoGenerateMips = false, }; if (antiAliasing != 0) { desc.msaaSamples = antiAliasing; } var renderTexture = new RenderTexture(desc); renderTexture.hideFlags = HideFlags.HideAndDontSave; var canvas = new CommandBufferCanvas(renderTexture, devicePixelRatio, meshPool); canvas.translate(-bounds.left, -bounds.top); canvas.concat(transform); canvas.drawPicture(picture); canvas.flush(); canvas.dispose(); return(new RasterCacheResult(new Image(renderTexture), picture.paintBounds, devicePixelRatio)); }
public override void DrawWorker(Vector3 loc, Rot4 rot, ThingDef thingDef, Thing thing, float extraRotation) { if (baseData == null) { base.DrawWorker(loc, rot, thingDef, thing, extraRotation); return; } var useFrontBase = !thing.Rotation.IsHorizontal; var baseOffset = new Vector3(baseData.baseOffset.x, 0, baseData.baseOffset.y - (thing.RotatedSize.z - 1) / 2f); var baseMat = useFrontBase ? baseMatFront : baseMatSide; var baseMesh = MeshPool.GridPlane(new Vector2(thing.RotatedSize.x, 1)); Graphics.DrawMesh(baseMesh, loc + baseOffset, Quaternion.identity, baseMat, 0); var mesh = MeshAt(rot); var rotation = QuatFromRot(rot); var material = MatAt(rot, thing); Graphics.DrawMesh(mesh, loc, rotation, material, 0); if (ShadowGraphic != null) { ShadowGraphic.DrawWorker(loc, rot, thingDef, thing, extraRotation); } }
RasterCacheResult _rasterizePicture(Picture picture, Matrix3 transform, float devicePixelRatio, MeshPool meshPool) { var bounds = transform.mapRect(picture.paintBounds); var desc = new RenderTextureDescriptor( Mathf.CeilToInt((float)(bounds.width * devicePixelRatio)), Mathf.CeilToInt((float)(bounds.height * devicePixelRatio)), RenderTextureFormat.Default, 24) { useMipMap = false, autoGenerateMips = false, }; if (QualitySettings.antiAliasing != 0) { desc.msaaSamples = QualitySettings.antiAliasing; } var renderTexture = new RenderTexture(desc); renderTexture.hideFlags = HideFlags.HideAndDontSave; var canvas = new CommandBufferCanvas(renderTexture, devicePixelRatio, meshPool); canvas.translate((float)-bounds.left, (float)-bounds.top); canvas.concat(transform); canvas.drawPicture(picture); canvas.flush(); return(new RasterCacheResult(new Image(renderTexture), picture.paintBounds, devicePixelRatio)); }
// Update the meshes to correct UVs depending on the property lookingAt (direction from human.movement) public void UpdateLookingAt(Direction dir) { this.bodyGraphic = GraphicInstance.GetNew( this.human.def.graphics, Defs.colorPallets["human_body"].colors[this.skinData.bodyColorID], Res.textures["Body_" + (this.skinData.bodyID).ToString()], 0, MeshPool.GetHumanPlaneMesh(this.size, dir) ); this.headGraphic = GraphicInstance.GetNew( this.human.def.graphics, Defs.colorPallets["human_body"].colors[this.skinData.bodyColorID], Res.textures["Head_" + (this.skinData.headID).ToString()], 1, MeshPool.GetHumanPlaneMesh(this.size, dir) ); this.eyesGraphic = GraphicInstance.GetNew( this.human.def.graphics, Color.white, Res.textures["Eye_" + (this.skinData.eyeID).ToString()], 2, MeshPool.GetHumanPlaneMesh(this.size, dir) ); this.hairGraphic = GraphicInstance.GetNew( this.human.def.graphics, Defs.colorPallets["human_hair"].colors[this.skinData.hairColorID], Res.textures["Hair_" + (this.skinData.hairID).ToString()], 3, MeshPool.GetHumanPlaneMesh(this.size, dir) ); }
void OnEnable() { this._windowAdapter = new EditorWindowAdapter(this); this._windowAdapter.OnEnable(); this._meshPool = new MeshPool(); texture6 = Resources.Load <Texture2D>("6"); }
public override void Draw() { var rotat = Find.TickManager.TicksGame * 25f % 360; var mesh = MeshPool.GridPlane(def.graphicData.drawSize); Graphics.DrawMesh(mesh, DrawPos, rotat.ToQuat(), def.DrawMatSingle, 0); Comps_PostDraw(); }
public static void ReturnMeshMaybe(GameObject gameObject) { MeshFilter meshFilter = gameObject.GetComponent <MeshFilter>(); if (meshFilter != null) { MeshPool.Add(gameObject.GetComponent <MeshFilter>().sharedMesh); } }
public override void Draw() { Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize * traveled); Mesh mesh2 = MeshPool.GridPlane(DefDatabase <ThingDef> .GetNamed("Mote_FlameGlow").graphicData.drawSize *(traveled * 7)); Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, Graphic.MatSingle, 0); Graphics.DrawMesh(mesh2, this.DrawPos, this.ExactRotation, DefDatabase <ThingDef> .GetNamed("Mote_FlameGlow").graphic.MatSingle, 0); base.Comps_PostDraw(); }
public override void Draw() { if (Props.drawGlow) { string motename = !Props.drawGlowMote.NullOrEmpty() ? Props.drawGlowMote : "Mote_FireGlow"; Mesh mesh2 = MeshPool.GridPlane(DefDatabase <ThingDef> .GetNamed(motename).graphicData.drawSize *(Drawsize * Props.drawGlowSizeFactor)); Graphics.DrawMesh(mesh2, this.DrawPos, this.ExactRotation, DefDatabase <ThingDef> .GetNamed(motename).graphic.MatSingle, 0); } base.Draw(); }
public override void Draw() { Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize); //Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, this.def.DrawMatSingle, 0); base.Comps_PostDraw(); Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, next_draw, 0); //Graphic.Draw(GenThing.TrueCenter(Position, ExactRotation, this.def.graphicData.drawSize, AltitudeLayer.MoteOverhead.AltitudeFor()), ExactRotation, 0f); }
public PictureFlusher(RenderTexture renderTexture, float devicePixelRatio, MeshPool meshPool) { D.assert(renderTexture); D.assert(devicePixelRatio > 0); D.assert(meshPool != null); this._renderTexture = renderTexture; this._fringeWidth = 1.0f / devicePixelRatio; this._devicePixelRatio = devicePixelRatio; this._meshPool = meshPool; }
public CommandBufferCanvas(RenderTexture renderTexture, float devicePixelRatio, MeshPool meshPool) { D.assert(renderTexture); this._renderTexture = renderTexture; this._fringeWidth = 1.0f / devicePixelRatio; this._devicePixelRatio = devicePixelRatio; this._meshPool = meshPool; this.reset(); }
/// Get a plane mesh of the size "size" public static Mesh GetHumanPlaneMesh(Vector2 size, Direction direction) { float id = (size.x + size.y * 666f) + (int)direction * 333f; if (MeshPool.humanPlanes.ContainsKey(id)) { return(MeshPool.humanPlanes[id].mesh); } MeshPool.humanPlanes.Add(id, MeshPool.GenHumanMesh(size, direction)); return(MeshPool.humanPlanes[id].mesh); }
public VertigoMesh(MeshPool origin, bool isDynamic) { this.origin = origin; this.mesh = new Mesh(); this.isDynamic = isDynamic; this.isActive = false; if (isDynamic) { this.mesh.MarkDynamic(); } }
/// Get a plane mesh of the size "size" public static Mesh GetPlaneMesh(Vector2 size) { float id = (size.x + size.y * 666f); if (MeshPool.planes.ContainsKey(id)) { return(MeshPool.planes[id].mesh); } MeshPool.planes.Add(id, MeshPool.GenPlaneMesh(size)); return(MeshPool.planes[id].mesh); }
public override void Draw() { this.rotationOffset += Rand.Range(20, 36); if (this.rotationOffset > 360) { this.rotationOffset = 0; } Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize); Graphics.DrawMesh(mesh, DrawPos, (Quaternion.AngleAxis(rotationOffset, Vector3.up) * ExactRotation), def.DrawMatSingle, 0); Comps_PostDraw(); }
public override void Draw() { bool flag = this.DefaultGraphic != null; bool flag2 = flag; if (flag2) { Graphics.DrawMesh(MeshPool.GridPlane(this.def.graphicData.drawSize), this.DrawPos, this.ExactRotation, this.Graphic.MatSingle, 0); this.DrawDropSpotShadow(ExactPosition); } base.Comps_PostDraw(); }
public override void PostDraw() { base.PostDraw(); Vector3 drawPos = this.parent.DrawPos + Props.offset; if (graphic == null) { graphic = Props.graphicData.Graphic; } Mesh mesh2 = MeshPool.GridPlane(Graphic.drawSize * Props.graphicData.drawSize); Graphics.DrawMesh(mesh2, drawPos, Quaternion.AngleAxis(0, Vector3.up), Graphic.MatSingle, 0); }
public void Dispose() { if (this._surface != null) { this._surface.Dispose(); this._surface = null; } if (this._meshPool != null) { this._meshPool.Dispose(); this._meshPool = null; } }
static void AlienRacesPatch(ref PawnRenderer __instance, Vector3 rootLoc, float angle, bool renderBody, Rot4 bodyFacing, Rot4 headFacing, out Mesh mesh, RotDrawMode bodyDrawType = RotDrawMode.Fresh, bool portrait = false, bool headStump = false) { mesh = null; Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>(); AlienRace.ThingDef_AlienRace alienDef = pawn.def as AlienRace.ThingDef_AlienRace; if (alienDef != null) { Mesh mesh2; if (bodyDrawType == RotDrawMode.Rotting) { if (__instance.graphics.dessicatedGraphic.ShouldDrawRotated) { mesh2 = MeshPool.GridPlane(portrait ? alienDef.alienRace.generalSettings.alienPartGenerator.customPortraitDrawSize : alienDef.alienRace.generalSettings.alienPartGenerator.customDrawSize); } else { Vector2 size = portrait ? alienDef.alienRace.generalSettings.alienPartGenerator.customPortraitDrawSize : alienDef.alienRace.generalSettings.alienPartGenerator.customDrawSize; if (bodyFacing.IsHorizontal) { size = size.Rotated(); } if (bodyFacing == Rot4.West && (__instance.graphics.dessicatedGraphic.data == null || __instance.graphics.dessicatedGraphic.data.allowFlip)) { mesh = MeshPool.GridPlaneFlip(size); } mesh = MeshPool.GridPlane(size); } } else { AlienRace.AlienPartGenerator.AlienComp comp = pawn.TryGetComp <AlienRace.AlienPartGenerator.AlienComp>(); if (comp != null) { mesh = (portrait ? comp.alienPortraitGraphics.bodySet.MeshAt(bodyFacing) : comp.alienGraphics.bodySet.MeshAt(bodyFacing)); } } } else { if (pawn.RaceProps.Humanlike) { mesh = MeshPool.humanlikeBodySet.MeshAt(bodyFacing); } else { mesh = __instance.graphics.nakedGraphic.MeshAt(bodyFacing); } } }
public override void Draw() { string mote = "Mote_FlameGlow"; if (this.def.projectile.damageDef == AdeptusDamageDefOf.OG_Chaos_Deamon_Warpfire) { mote = "OG_Mote_WarpFireGlow"; } Mesh mesh = MeshPool.GridPlane(this.def.graphicData.drawSize * traveled); Mesh mesh2 = MeshPool.GridPlane(DefDatabase <ThingDef> .GetNamed(mote).graphicData.drawSize *(traveled * 5)); Graphics.DrawMesh(mesh, this.DrawPos, this.ExactRotation, Graphic.MatSingle, 0); Graphics.DrawMesh(mesh2, this.DrawPos, this.ExactRotation, DefDatabase <ThingDef> .GetNamed(mote).graphic.MatSingle, 0); base.Comps_PostDraw(); }
public PictureFlusher(RenderTexture renderTexture, float devicePixelRatio, MeshPool meshPool) { D.assert(renderTexture); D.assert(devicePixelRatio > 0); D.assert(meshPool != null); this._renderTexture = renderTexture; this._fringeWidth = 1.0f / devicePixelRatio; this._devicePixelRatio = devicePixelRatio; this._meshPool = meshPool; this.___drawTextDrawMeshCallback = this._drawTextDrawMeshCallback; this.___drawPathDrawMeshCallback2 = this._drawPathDrawMeshCallback2; this.___drawPathDrawMeshCallback = this._drawPathDrawMeshCallback; }