public static void Initilize(GraphicsDevice gd) { Cube3D.ConstructCube(); Cube3D.vBuffer = new VertexBuffer(gd, VertexPositionNormalTexture.VertexDeclaration, 36, BufferUsage.WriteOnly); Cube3D.vBuffer.SetData <VertexPositionNormalTexture>(Cube3D.verts); gd.SetVertexBuffer(Cube3D.vBuffer); Cube3D.ib = new IndexBuffer(gd, IndexElementSize.SixteenBits, 14, BufferUsage.WriteOnly); Cube3D.ib.SetData <short>(new short[14] { (short)0, (short)1, (short)2, (short)3, (short)4, (short)5, (short)6, (short)7, (short)8, (short)9, (short)10, (short)11, (short)12, (short)13 }); gd.Indices = Cube3D.ib; Cube3D.wireframeRaster = new RasterizerState(); Cube3D.wireframeRaster.FillMode = FillMode.WireFrame; Cube3D.wireframeRaster.CullMode = CullMode.None; Cube3D.wireframeEfect = new BasicEffect(gd); Cube3D.wireframeEfect.Projection = Matrix.CreatePerspectiveFieldOfView(0.7853982f, Cube3D.wireframeEfect.GraphicsDevice.Viewport.AspectRatio, 0.01f, 3000f); }
public static void RenderWireframe(Vector3 position, float scale, Vector3 rotation, Color color, Vector3 cameraOffset) { scale = Math.Max(1f / 1000f, scale); Cube3D.wireframeEfect.DiffuseColor = Utils.ColorToVec3(color); Cube3D.wireframeEfect.GraphicsDevice.BlendState = BlendState.Opaque; Cube3D.wireframeEfect.GraphicsDevice.DepthStencilState = DepthStencilState.Default; Cube3D.wireframeEfect.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp; Cube3D.ResetBuffers(); RasterizerState rasterizerState = Cube3D.wireframeEfect.GraphicsDevice.RasterizerState; Cube3D.wireframeEfect.GraphicsDevice.RasterizerState = Cube3D.wireframeRaster; Matrix matrix = Matrix.CreateTranslation(-new Vector3(0.0f, 0.0f, 0.0f)) * Matrix.CreateScale(scale) * Matrix.CreateRotationY(rotation.Y) * Matrix.CreateRotationX(rotation.X) * Matrix.CreateRotationZ(rotation.Z) * Matrix.CreateTranslation(position); Cube3D.wireframeEfect.World = matrix; Cube3D.wireframeEfect.View = Matrix.CreateLookAt(cameraOffset, position, Vector3.Up); try { foreach (EffectPass pass in Cube3D.wireframeEfect.CurrentTechnique.Passes) { pass.Apply(); Cube3D.wireframeEfect.GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 36); } } catch (NotSupportedException ex) { Console.WriteLine("Not supported happened"); } Cube3D.wireframeEfect.GraphicsDevice.RasterizerState = rasterizerState; }
public static void RenderWireframe(Vector3 position, float scale, Vector3 rotation, Color color) { Cube3D.RenderWireframe(position, scale, rotation, color, new Vector3(0.0f, 0.0f, 20f)); }
public void DrawSequence(Rectangle dest, float t, float totalTime) { float num1 = 0.6f; float val1_1 = 1f; float val1_2 = this.ShouldCentralSpinInfinitley ? float.MaxValue : totalTime - 1.7f; float maxValue1 = float.MaxValue; float maxValue2 = float.MaxValue; this.elapsedTime += t; Math.Max(0.0f, this.elapsedTime); float num2 = 1f; float num3 = 1f; float num4 = 1f; if ((double)this.startup < (double)num1) { this.startup += t; num2 = 0.0f; num3 = Utils.QuadraticOutCurve(Utils.QuadraticOutCurve(this.startup / num1)); } else if ((double)this.spinup < (double)val1_1) { this.spinup = Math.Min(val1_1, this.spinup + t); num2 = this.spinup / val1_1; this.rotTime += t * num2; } else if ((double)this.runtime < (double)val1_2) { this.runtime = Math.Min(val1_2, this.runtime + t); this.rotTime += t; } else if ((double)this.spindown < (double)maxValue1) { this.spindown += t; float num5 = (float)((double)Math.Min(1f, this.spindown) / 2.29999995231628 / 1.0); num2 = (float)(0.100000001490116 + 0.899999976158142 * (1.0 - (double)num5)); if ((double)num5 >= 0.400000005960464) { num2 = 0.2f; } this.rotTime += t * num2; num4 = 1f - num5; num3 = (float)(0.300000011920929 + 0.699999988079071 * (double)Utils.QuadraticOutCurve(1f - num5)); } else if ((double)this.idle < (double)maxValue2) { this.idle += t; num2 = 0.1f; this.rotTime += t * (num2 * 2f); num4 = 0.0f; num3 = 0.3f; } else { this.spinup = this.startup = this.runtime = this.idle = this.spindown = this.rotTime = 0.0f; } int num6 = 20; for (int index1 = 0; index1 < num6; ++index1) { float num5 = (float)index1 / (float)num6; float num7 = (float)(1.0 + 0.0500000007450581 * (double)num2 * ((double)(num6 - index1) / (double)num6 * 10.0)); float num8 = num4; float num9 = Math.Max(0.0f, (float)((double)this.rotTime * (double)num7 - (double)index1 * 0.100000001490116 * (double)num8)) * 1.5f; float num10 = num3; for (int index2 = 0; index2 < index1; ++index2) { num10 *= num3; } float num11 = num3 * ((float)(num6 - index1) / (float)num6); bool flag = (double)num5 <= (double)num2; Cube3D.RenderWireframe(new Vector3((float)(dest.X / 2), 0.0f, 0.0f), (float)(2.59999990463257 + (double)index1 / 4.0 * (double)num10), new Vector3(MathHelper.ToRadians(35.4f), MathHelper.ToRadians(45f) + num9, MathHelper.ToRadians(0.0f)), Color.White); } }
public void DrawHeartSequence(Rectangle dest, float t, float totalTime) { float num1 = 3f; float num2 = 10f; float num3 = 2f; float num4 = 9f; float maxValue = float.MaxValue; float num5 = 2f; float num6 = 21f; this.elapsedTime += t; Math.Max(0.0f, this.elapsedTime); float num7 = 1f; float num8 = 1f; float num9 = 1f; float num10 = 0.0f; if ((double)this.startup < (double)num1) { this.startup += t; num8 = Utils.QuadraticOutCurve(Utils.QuadraticOutCurve(this.startup / 3f)); } else if ((double)this.spinup < (double)num2) { this.spinup = Math.Min(10f, this.spinup + t); num7 = this.spinup / 10f; this.rotTime += t * num7; } else if ((double)this.runtime < (double)num3) { this.runtime = Math.Min(2f, this.runtime + t); this.rotTime += t; } else if ((double)this.spindown < (double)num4) { this.spindown += t; float num11 = this.spindown / 9f; num7 = (float)(0.100000001490116 + 0.899999976158142 * (1.0 - (double)num11)); this.rotTime += t * num7; num9 = 1f - num11; num8 = (float)(0.300000011920929 + 0.699999988079071 * (double)Utils.QuadraticOutCurve(1f - num11)); } else if ((double)this.idle < (double)maxValue) { this.idle += t; num7 = 0.1f; this.rotTime += t * num7; num9 = 0.0f; num8 = 0.3f; if ((double)this.idle > (double)num5) { num10 = Utils.QuadraticOutCurve(Math.Min(1f, (this.idle - num5) / num6)); this.HeartFadeSequenceComplete = (double)num10 >= 1.0; } } else { this.spinup = this.startup = this.runtime = this.idle = this.spindown = this.rotTime = 0.0f; } int num12 = 20; for (int index1 = 0; index1 < num12; ++index1) { float num11 = (float)index1 / (float)num12; float num13 = (float)(1.0 + 0.0500000007450581 * (double)num7 * ((double)(num12 - index1) / (double)num12 * 10.0)); float num14 = num9; float num15 = Math.Max(0.0f, (float)((double)this.rotTime * (double)num13 - (double)index1 * 0.100000001490116 * (double)num14)) * 1.5f; float num16 = num8; for (int index2 = 0; index2 < index1; ++index2) { num16 *= num8; } float num17 = num8 * ((float)(num12 - index1) / (float)num12); bool flag = (double)num11 <= (double)num7; float num18 = 1f; Color color = Color.White; if ((double)num10 > 0.0) { float num19 = 1f / (float)num12; if ((double)index1 * (double)num19 < (double)num10) { float num20 = (float)(index1 + 1) * num19; if ((double)num10 > (double)num20) { num18 = 0.0f; color = Color.Transparent; } else { float amount = (float)(1.0 - (double)num10 % (double)num19 / (double)num19); color = Color.Lerp(Utils.AddativeRed, Color.Red, amount) * amount; } } } Cube3D.RenderWireframe(new Vector3((float)(dest.X / 2), 0.0f, 0.0f), (float)(2.59999990463257 + (double)index1 / 4.0 * (double)num16), new Vector3(MathHelper.ToRadians(35.4f), MathHelper.ToRadians(45f) + num15, MathHelper.ToRadians(0.0f)), color); } }
public void DrawHeartSequence(Rectangle dest, float t, float totalTime) { var num1 = 3f; var num2 = 10f; var num3 = 2f; var num4 = 9f; var num5 = float.MaxValue; var num6 = 2f; var num7 = 21f; elapsedTime += t; Math.Max(0.0f, elapsedTime); var num8 = 1f; var num9 = 1f; var num10 = 1f; var num11 = 0.0f; if (startup < (double)num1) { startup += t; num9 = Utils.QuadraticOutCurve(Utils.QuadraticOutCurve(startup / 3f)); } else if (spinup < (double)num2) { spinup = Math.Min(10f, spinup + t); num8 = spinup / 10f; rotTime += t * num8; } else if (runtime < (double)num3) { runtime = Math.Min(2f, runtime + t); rotTime += t; } else if (spindown < (double)num4) { spindown += t; var num12 = spindown / 9f; num8 = (float)(0.100000001490116 + 0.899999976158142 * (1.0 - num12)); rotTime += t * num8; num10 = 1f - num12; num9 = (float)(0.300000011920929 + 0.699999988079071 * Utils.QuadraticOutCurve(1f - num12)); } else if (idle < (double)num5) { idle += t; num8 = 0.1f; rotTime += t * num8; num10 = 0.0f; num9 = 0.3f; if (idle > (double)num6) { num11 = Utils.QuadraticOutCurve(Math.Min(1f, (idle - num6) / num7)); HeartFadeSequenceComplete = num11 >= 1.0; } } else { spinup = startup = runtime = idle = spindown = rotTime = 0.0f; } var num13 = 20; for (var index1 = 0; index1 < num13; ++index1) { var num12 = index1 / (float)num13; var num14 = (float)(1.0 + 0.0500000007450581 * num8 * (num13 - index1) / num13 * 10.0); var num15 = num10; var num16 = Math.Max(0.0f, (float)(rotTime * (double)num14 - index1 * 0.100000001490116 * num15)) * 1.5f; var num17 = num9; for (var index2 = 0; index2 < index1; ++index2) { num17 *= num9; } var num18 = (num13 - index1) / (double)num13; var num19 = 1f; var color = Color.White; if (num11 > 0.0) { var num20 = 1f / num13; if (index1 * (double)num20 < num11) { var num21 = (index1 + 1) * num20; if (num11 > (double)num21) { num19 = 0.0f; color = Color.Transparent; } else { var amount = (float)(1.0 - num11 % (double)num20 / num20); color = Color.Lerp(Utils.AddativeRed, Color.Red, amount) * amount; } } } Cube3D.RenderWireframe(new Vector3(dest.X / 2, 0.0f, 0.0f), (float)(2.59999990463257 + index1 / 4.0 * num17), new Vector3(MathHelper.ToRadians(35.4f), MathHelper.ToRadians(45f) + num16, MathHelper.ToRadians(0.0f)), color); } }
public void DrawSequence(Rectangle dest, float t, float totalTime) { var num1 = 0.6f; var val1_1 = 1f; var val1_2 = ShouldCentralSpinInfinitley ? float.MaxValue : totalTime - 1.7f; var num2 = float.MaxValue; var num3 = float.MaxValue; elapsedTime += t; Math.Max(0.0f, elapsedTime); var num4 = 1f; var num5 = 1f; var num6 = 1f; if (startup < (double)num1) { startup += t; num4 = 0.0f; num5 = Utils.QuadraticOutCurve(Utils.QuadraticOutCurve(startup / num1)); } else if (spinup < (double)val1_1) { spinup = Math.Min(val1_1, spinup + t); num4 = spinup / val1_1; rotTime += t * num4; } else if (runtime < (double)val1_2) { runtime = Math.Min(val1_2, runtime + t); rotTime += t; } else if (spindown < (double)num2) { spindown += t; var num7 = (float)(Math.Min(1f, spindown) / 2.29999995231628 / 1.0); num4 = (float)(0.100000001490116 + 0.899999976158142 * (1.0 - num7)); if (num7 >= 0.400000005960464) { num4 = 0.2f; } rotTime += t * num4; num6 = 1f - num7; num5 = (float)(0.300000011920929 + 0.699999988079071 * Utils.QuadraticOutCurve(1f - num7)); } else if (idle < (double)num3) { idle += t; num4 = 0.1f; rotTime += t * (num4 * 2f); num6 = 0.0f; num5 = 0.3f; } else { spinup = startup = runtime = idle = spindown = rotTime = 0.0f; } var num8 = 20; for (var index1 = 0; index1 < num8; ++index1) { var num7 = index1 / (float)num8; var num9 = (float)(1.0 + 0.0500000007450581 * num4 * (num8 - index1) / num8 * 10.0); var num10 = num6; var num11 = Math.Max(0.0f, (float)(rotTime * (double)num9 - index1 * 0.100000001490116 * num10)) * 1.5f; var num12 = num5; for (var index2 = 0; index2 < index1; ++index2) { num12 *= num5; } var num13 = (num8 - index1) / (double)num8; Cube3D.RenderWireframe(new Vector3(dest.X / 2, 0.0f, 0.0f), (float)(2.59999990463257 + index1 / 4.0 * num12), new Vector3(MathHelper.ToRadians(35.4f), MathHelper.ToRadians(45f) + num11, MathHelper.ToRadians(0.0f)), Color.White); } }