public static void EndGame(PieceColor won) { PieceController[] controllers = GameObject.FindObjectsOfType <PieceController>(); for (int i = 0; i < controllers.Length; i++) { Glow glow = controllers[i].gameObject.GetComponent <Glow>(); PlaceholderManager pcm = controllers[i].transform.parent.GetComponent <PlaceholderManager>(); Destroy(glow); if (pcm != null) { Destroy(pcm); } Destroy(controllers[i]); } string color = won == PieceColor.Red ? "Красный" : "Белый"; instance.winText.text = color + " победил!"; instance.winText.transform.parent.gameObject.SetActive(true); instance.StartCoroutine(FadeColor(instance.winText, instance.winText.color)); for (int i = 0; i < instance.image.Length; i++) { instance.StartCoroutine(FadeColor(instance.image[i], instance.image[i].color)); } }
internal A.EffectList ToEffectList() { var el = new A.EffectList(); if (Glow.HasGlow) { el.Glow = Glow.ToGlow(); } if (Shadow.IsInnerShadow != null) { if (Shadow.IsInnerShadow.Value) { el.InnerShadow = Shadow.ToInnerShadow(); } else { el.OuterShadow = Shadow.ToOuterShadow(); } } if (Reflection.HasReflection) { el.Reflection = Reflection.ToReflection(); } if (SoftEdge.HasSoftEdge) { el.SoftEdge = SoftEdge.ToSoftEdge(); } return(el); }
private void Start() { _glow = GetComponentInChildren <Glow>(); _rndr = GetComponent <SpriteRenderer>(); StartCoroutine(nameof(CoSwitchLoop)); }
/// <summary>Gets the current intensity glow intensity, using the glow attenuation factor</summary> /// <param name="Vertices">The verticies to which the glow is to be applied</param> /// <param name="Face">The face which these vertices make up</param> /// <param name="GlowAttenuationData">The current glow attenuation</param> /// <param name="CameraX">The X-position of the camera</param> /// <param name="CameraY">The Y-position of the camera</param> /// <param name="CameraZ">The Z-position of the camera</param> /// <returns></returns> private static double GetDistanceFactor(VertexTemplate[] Vertices, ref MeshFace Face, ushort GlowAttenuationData, double CameraX, double CameraY, double CameraZ) { if (Face.Vertices.Length == 0) { return(1.0); } GlowAttenuationMode mode; double halfdistance; Glow.SplitAttenuationData(GlowAttenuationData, out mode, out halfdistance); int i = (int)Face.Vertices[0].Index; double dx = Vertices[i].Coordinates.X - CameraX; double dy = Vertices[i].Coordinates.Y - CameraY; double dz = Vertices[i].Coordinates.Z - CameraZ; switch (mode) { case GlowAttenuationMode.DivisionExponent2: { double t = dx * dx + dy * dy + dz * dz; return(t / (t + halfdistance * halfdistance)); } case GlowAttenuationMode.DivisionExponent4: { double t = dx * dx + dy * dy + dz * dz; t *= t; halfdistance *= halfdistance; return(t / (t + halfdistance * halfdistance)); } default: return(1.0); } }
// ///////////// // GLOW THREAD// // ///////////// public static void GlowCall() { var Glow = new Glow(); var GlowThread = new Thread(Glow.Run); GlowThread.Start(); }
private static void ESPThread() { while (true) { Glow.Render(); Thread.Sleep(1); } }
void Start() { timeLeftInInterval = INTERVAL; dtMsg = 0.0f; glow = new Glow(gameObject.GetComponent <Renderer>()); _messageTimes = new List <DateTime>(); size = transform.localScale.x; targetSize = size; }
private void UserControl_MouseEnter(object sender, MouseEventArgs e) { //rootBorder.RenderTransform.BeginAnimation(TranslateTransform.YProperty, scaleUp); //rootBorder.Effect.BeginAnimation(DropShadowEffect.BlurRadiusProperty, moveUp); Glow.BeginAnimation(OpacityProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(50)) { EasingFunction = new QuadraticEase() }); }
public void SetGlow(Glow glow) { if(this.glow != null) { Destroy(this.glow.gameObject); this.glow = null; } this.glow = tileController.GetComponentInChildren<Glow>(); this.glow.transform.localPosition = Vector3.zero; }
internal SLEffectList Clone() { var el = new SLEffectList(listThemeColors); el.Glow = Glow.Clone(); el.Shadow = Shadow.Clone(); el.Reflection = Reflection.Clone(); el.SoftEdge = SoftEdge.Clone(); return(el); }
IEnumerator UnfadeToNormal(GameObject road) { yield return(new WaitForSeconds(2f)); Glow glow = GetRoadFromAngle(transform.rotation.eulerAngles.y).GetComponent <Glow> (); if (glow.GetColor() == commandColor) { glow.SetColor(glow.originalColor); Roads.Remove(road); } }
void Start() { startingPosition = transform.localPosition; inventory = GameObject.FindObjectOfType <Inventory>(); player = FindObjectOfType <GvrHead>(); glow = GetComponent <Glow> (); displayCanvas = FindObjectOfType <DisplayCanvas> (); if (glow == null) { glow = GetComponentInChildren <Glow> (); } }
void Start() { startingPosition = transform.localPosition; inventory = GameObject.FindObjectOfType <Inventory>(); player = FindObjectOfType <GvrHead>(); healthManagement = FindObjectOfType <HealthManagement> (); glow = GetComponent <Glow> (); if (glow == null) { glow = GetComponentInChildren <Glow> (); } }
public FixedPointLight(Rectangle tileRectangle, bool isShaky, Color color, float? scale, float glowIntensity) { this.IsShaky = isShaky; this.Color = color; if (scale.HasValue) Size = (int)(DefaultSize * scale); SetPosition(tileRectangle); this.GlowIntensity = glowIntensity; Glow = new Glow(this); LightHere = true; }
public static void Attach(System.Diagnostics.Process process, bool isInjected = false) { if (_isAttached) { return; } if (isInjected) { Memory = new LocalProcessMemory(process); } else { Memory = new ExternalProcessMemory(process); } Thread.Sleep(2000); Renderer = new Renderer(process); ClientBase = Memory.GetModule("client.dll").BaseAddress; EngineBase = Memory.GetModule("engine.dll").BaseAddress; Offsets.Initialize(); ClientState = Memory.Read <int>(EngineBase + Offsets.ClientState.Base); Objects = new ObjectManager(ClientBase + Offsets.Misc.EntityList); Box = new Box(); HeadHelper = new HeadHelper(); SkinChanger = new SkinChanger(); ControlRecoil = new Rcs(); TriggerBot = new TriggerBot(); KeyUtils = new KeyUtils(); BunnyJump = new BunnyJump(); SoundEsp = new SoundEsp(); Radar = new Radar(); NoFlash = new NoFlash(); AutoPistol = new AutoPistol(); Glow = new Glow(); AimAssist = new AimAssist(); var enginePtr = Memory.Read <IntPtr>(EngineBase + Offsets.ClientState.Base); if (enginePtr == IntPtr.Zero) { throw new Exception("Couldn't find Engine Ptr - are you sure your offsets are up to date?"); } Client = new GameClient(enginePtr); _isAttached = true; }
public Glow CreateGlow(Vector3 pos, int maxParticles, Color color) { Transform parent = container.Find("Fx"); GameObject obj = (GameObject)Instantiate(glowPrefab); obj.transform.SetParent(parent, false); obj.name = "Glow"; Glow glow = obj.GetComponent <Glow>(); glow.Init(pos, maxParticles, color); return(glow); }
public DynamicPointLight(Entity source, float? scale, bool isShaky, Color? color, float glowIntensity) { if (scale.HasValue) Size = (int)(DefaultSize * scale); if (color.HasValue) this.Color = color.Value; this.GlowIntensity = glowIntensity; this.IsShaky = isShaky; SetPosition(source.GetCollRectangle()); Glow = new Glow(this); this.source = source; LightHere = true; }
/// <summary> /// Set a predefined glow matching the preset types in Excel /// </summary> /// <param name="glowType">The preset type</param> public void SetPresetGlow(ePresetExcelGlowType glowType) { Glow.Delete(); if (glowType == ePresetExcelGlowType.None) { return; } var glowTypeString = glowType.ToString(); var font = glowTypeString.Substring(0, glowTypeString.IndexOf('_')); var schemeColor = (eSchemeColor)Enum.Parse(typeof(eSchemeColor), font); Glow.Color.SetSchemeColor(schemeColor); Glow.Color.Transforms.AddAlpha(40); Glow.Color.Transforms.AddSaturationModulation(175); Glow.Radius = int.Parse(glowTypeString.Substring(font.Length + 1, glowTypeString.Length - font.Length - 3)); }
public override int GetHashCode() { return (RGBA.GetHashCode() ^ RepeatU.GetHashCode() ^ RepeatV.GetHashCode() ^ OffsetU.GetHashCode() ^ OffsetV.GetHashCode() ^ Rotation.GetHashCode() ^ Glow.GetHashCode() ^ Bump.GetHashCode() ^ Shiny.GetHashCode() ^ Fullbright.GetHashCode() ^ MediaFlags.GetHashCode() ^ TexMapType.GetHashCode() ^ TextureID.GetHashCode()); }
Glow readGlow(BinaryReader reader) { Glow newGlow = new Glow(); var glowCount = reader.ReadByte(); newGlow.glowData = new List <GlowData>(); for (var i = 0; i < glowCount; i++) { GlowData newGlowData = new GlowData(); newGlowData.position = reader.ReadSingle(); newGlowData.materialID = reader.ReadUInt16(); newGlow.glowData.Add(newGlowData); } return(newGlow); }
private void UserControl_MouseLeave(object sender, MouseEventArgs e) { //if (_animDown) //{ // rootBorder.RenderTransform.BeginAnimation(TranslateTransform.YProperty, scaleDown); // rootBorder.Effect.BeginAnimation(DropShadowEffect.BlurRadiusProperty, moveDown); //} //else //{ // rootBorder.RenderTransform = new TranslateTransform(0, 0); // (rootBorder.Effect as DropShadowEffect).BlurRadius = 3; //} Glow.BeginAnimation(OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(250)) { EasingFunction = new QuadraticEase() }); }
// Use this for initialization void Start() { fleche = Instantiate(flechePrefab).GetComponentInChildren <Glow>(); fleche.LinkedPerson = this; fleche.transform.parent.parent = transform; points = new Glow[numPoints]; for (int i = 0; i < numPoints; i++) { points[i] = Instantiate(pointPrefab).GetComponent <Glow>(); points[i].transform.parent = transform; points[i].LinkedPerson = this; } splineIndex = getClosestSplineIndex(); if (splineIndex % 2 == 0) { CameFromLeft = true; } }
public void RenderFace(Shader Shader, ObjectState State, MeshFace Face, Matrix4D modelMatrix, Matrix4D modelViewMatrix, bool IsDebugTouchMode = false) { if (State.Prototype.Mesh.Vertices.Length < 1) { return; } MeshMaterial material = State.Prototype.Mesh.Materials[Face.Material]; VertexArrayObject VAO = (VertexArrayObject)State.Prototype.Mesh.VAO; if (lastVAO != VAO.handle) { VAO.Bind(); lastVAO = VAO.handle; } if (!OptionBackFaceCulling || (Face.Flags & MeshFace.Face2Mask) != 0) { GL.Disable(EnableCap.CullFace); } else if (OptionBackFaceCulling) { if ((Face.Flags & MeshFace.Face2Mask) == 0) { GL.Enable(EnableCap.CullFace); } } // matrix Shader.SetCurrentModelViewMatrix(modelViewMatrix); Shader.SetCurrentTextureMatrix(State.TextureTranslation); if (OptionWireFrame || IsDebugTouchMode) { if (material.Color != lastColor) { Shader.SetMaterialAmbient(material.Color); lastColor = material.Color; } Shader.SetOpacity(1.0f); Shader.SetBrightness(1.0f); VAO.Draw(PrimitiveType.LineLoop, Face.IboStartIndex, Face.Vertices.Length); return; } // lighting if (OptionLighting) { if (material.Color != lastColor) { Shader.SetMaterialAmbient(material.Color); Shader.SetMaterialDiffuse(material.Color); Shader.SetMaterialSpecular(material.Color); //TODO: Ambient and specular colors are not set by any current parsers } if ((material.Flags & MeshMaterial.EmissiveColorMask) != 0) { Shader.SetMaterialEmission(material.EmissiveColor); Shader.SetMaterialEmissive(true); } else { Shader.SetMaterialEmissive(false); } Shader.SetMaterialShininess(1.0f); } else { if (material.Color != lastColor) { Shader.SetMaterialAmbient(material.Color); } //As lighting is disabled, the face cannot be emitting light.... Shader.SetMaterialEmissive(false); } lastColor = material.Color; PrimitiveType DrawMode; switch (Face.Flags & MeshFace.FaceTypeMask) { case MeshFace.FaceTypeTriangles: DrawMode = PrimitiveType.Triangles; break; case MeshFace.FaceTypeTriangleStrip: DrawMode = PrimitiveType.TriangleStrip; break; case MeshFace.FaceTypeQuads: DrawMode = PrimitiveType.Quads; break; case MeshFace.FaceTypeQuadStrip: DrawMode = PrimitiveType.QuadStrip; break; default: DrawMode = PrimitiveType.Polygon; break; } // daytime polygon { // texture if (material.DaytimeTexture != null && currentHost.LoadTexture(material.DaytimeTexture, (OpenGlTextureWrapMode)material.WrapMode)) { Shader.SetIsTexture(true); if (LastBoundTexture != material.DaytimeTexture.OpenGlTextures[(int)material.WrapMode]) { GL.BindTexture(TextureTarget.Texture2D, material.DaytimeTexture.OpenGlTextures[(int)material.WrapMode].Name); LastBoundTexture = material.DaytimeTexture.OpenGlTextures[(int)material.WrapMode]; } } else { Shader.SetIsTexture(false); } // Calculate the brightness of the poly to render float factor; if (material.BlendMode == MeshMaterialBlendMode.Additive) { //Additive blending- Full brightness factor = 1.0f; GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.One); Shader.SetIsFog(false); } else if ((material.Flags & MeshMaterial.EmissiveColorMask) != 0) { //As material is emitting light, it must be at full brightness factor = 1.0f; } else if (material.NighttimeTexture == null || material.NighttimeTexture == material.DaytimeTexture) { //No nighttime texture or both are identical- Darken the polygon to match the light conditions float blend = inv255 * material.DaytimeNighttimeBlend + 1.0f - Lighting.OptionLightingResultingAmount; if (blend > 1.0f) { blend = 1.0f; } factor = 1.0f - 0.7f * blend; } else { //Valid nighttime texture- Blend the two textures by DNB at max brightness factor = 1.0f; } Shader.SetBrightness(factor); float alphaFactor; GlowAttenuationMode mode = GlowAttenuationMode.None; if (material.GlowAttenuationData != 0) { alphaFactor = (float)Glow.GetDistanceFactor(modelMatrix, State.Prototype.Mesh.Vertices, ref Face, material.GlowAttenuationData, out mode); } else { alphaFactor = 1.0f; } if (material.BlendMode == MeshMaterialBlendMode.Additive) { Shader.SetMaterialAdditive(1 + (int)mode); } else { Shader.SetMaterialAdditive(0); } Shader.SetOpacity(inv255 * material.Color.A * alphaFactor); // render polygon VAO.Draw(DrawMode, Face.IboStartIndex, Face.Vertices.Length); } // nighttime polygon if (material.NighttimeTexture != null && material.NighttimeTexture != material.DaytimeTexture && currentHost.LoadTexture(material.NighttimeTexture, (OpenGlTextureWrapMode)material.WrapMode)) { // texture Shader.SetIsTexture(true); if (LastBoundTexture != material.NighttimeTexture.OpenGlTextures[(int)material.WrapMode]) { GL.BindTexture(TextureTarget.Texture2D, material.NighttimeTexture.OpenGlTextures[(int)material.WrapMode].Name); LastBoundTexture = material.NighttimeTexture.OpenGlTextures[(int)material.WrapMode]; } GL.Enable(EnableCap.Blend); // alpha test GL.Enable(EnableCap.AlphaTest); GL.AlphaFunc(AlphaFunction.Greater, 0.0f); // blend mode float alphaFactor; if (material.GlowAttenuationData != 0) { alphaFactor = (float)Glow.GetDistanceFactor(modelMatrix, State.Prototype.Mesh.Vertices, ref Face, material.GlowAttenuationData); float blend = inv255 * material.DaytimeNighttimeBlend + 1.0f - Lighting.OptionLightingResultingAmount; if (blend > 1.0f) { blend = 1.0f; } alphaFactor *= blend; } else { alphaFactor = inv255 * material.DaytimeNighttimeBlend + 1.0f - Lighting.OptionLightingResultingAmount; if (alphaFactor > 1.0f) { alphaFactor = 1.0f; } } Shader.SetOpacity(inv255 * material.Color.A * alphaFactor); // render polygon VAO.Draw(DrawMode, Face.IboStartIndex, Face.Vertices.Length); RestoreBlendFunc(); RestoreAlphaFunc(); } // normals if (OptionNormals) { Shader.SetIsTexture(false); Shader.SetBrightness(1.0f); Shader.SetOpacity(1.0f); VertexArrayObject NormalsVAO = (VertexArrayObject)State.Prototype.Mesh.NormalsVAO; NormalsVAO.Bind(); lastVAO = NormalsVAO.handle; NormalsVAO.Draw(PrimitiveType.Lines, Face.NormalsIboStartIndex, Face.Vertices.Length * 2); } // finalize if (material.BlendMode == MeshMaterialBlendMode.Additive) { RestoreBlendFunc(); Shader.SetIsFog(OptionFog); } }
public void RenderFace(Shader Shader, ObjectState State, MeshFace Face, Vector3 EyePosition, bool IsDebugTouchMode = false) { if (State.Prototype.Mesh.Vertices.Length < 1) { return; } VertexTemplate[] vertices = State.Prototype.Mesh.Vertices; MeshMaterial material = State.Prototype.Mesh.Materials[Face.Material]; VertexArrayObject VAO = (VertexArrayObject)State.Prototype.Mesh.VAO; VertexArrayObject NormalsVAO = (VertexArrayObject)State.Prototype.Mesh.NormalsVAO; if (!OptionBackFaceCulling || (Face.Flags & MeshFace.Face2Mask) != 0) { GL.Disable(EnableCap.CullFace); } else if (OptionBackFaceCulling) { if ((Face.Flags & MeshFace.Face2Mask) == 0) { GL.Enable(EnableCap.CullFace); } } // matrix Matrix4D modelMatrix = State.Scale * State.Rotate * State.Translation * Matrix4D.CreateTranslation(-EyePosition); Matrix4D modelViewMatrix = modelMatrix * CurrentViewMatrix; Shader.SetCurrentProjectionMatrix(CurrentProjectionMatrix); Shader.SetCurrentModelViewMatrix(modelViewMatrix); Shader.SetCurrentNormalMatrix(Matrix4D.Transpose(Matrix4D.Invert(modelViewMatrix))); Shader.SetCurrentTextureMatrix(State.TextureTranslation); if (OptionWireFrame || IsDebugTouchMode) { VAO.Bind(); VAO.Draw(Shader.VertexLayout, PrimitiveType.LineLoop, Face.IboStartIndex, Face.Vertices.Length); VAO.UnBind(); return; } // lighting if (material.NighttimeTexture == null) { if (OptionLighting) { Shader.SetIsLight(true); Shader.SetLightPosition(new Vector3(Lighting.OptionLightPosition.X, Lighting.OptionLightPosition.Y, -Lighting.OptionLightPosition.Z)); Shader.SetLightAmbient(new Color4(Lighting.OptionAmbientColor.R, Lighting.OptionAmbientColor.G, Lighting.OptionAmbientColor.B, 255)); Shader.SetLightDiffuse(new Color4(Lighting.OptionDiffuseColor.R, Lighting.OptionDiffuseColor.G, Lighting.OptionDiffuseColor.B, 255)); Shader.SetLightSpecular(new Color4(Lighting.OptionSpecularColor.R, Lighting.OptionSpecularColor.G, Lighting.OptionSpecularColor.B, 255)); Shader.SetMaterialAmbient(new Color4(material.Color.R, material.Color.G, material.Color.B, material.Color.A)); // TODO Shader.SetMaterialDiffuse(new Color4(material.Color.R, material.Color.G, material.Color.B, material.Color.A)); Shader.SetMaterialSpecular(new Color4(material.Color.R, material.Color.G, material.Color.B, material.Color.A)); // TODO if ((material.Flags & MeshMaterial.EmissiveColorMask) != 0) { Shader.SetMaterialEmission(new Color4(material.EmissiveColor.R, material.EmissiveColor.G, material.EmissiveColor.B, 255)); } else { Shader.SetMaterialEmission(new Color4(0.0f, 0.0f, 0.0f, 1.0f)); } Shader.SetMaterialShininess(1.0f); Lighting.OptionLightingResultingAmount = (Lighting.OptionAmbientColor.R + Lighting.OptionAmbientColor.G + Lighting.OptionAmbientColor.B) / 480.0f; if (Lighting.OptionLightingResultingAmount > 1.0f) { Lighting.OptionLightingResultingAmount = 1.0f; } } else { Shader.SetMaterialAmbient(new Color4(material.Color.R, material.Color.G, material.Color.B, material.Color.A)); // TODO } } else { Shader.SetMaterialAmbient(new Color4(material.Color.R, material.Color.G, material.Color.B, material.Color.A)); // TODO } // fog if (OptionFog) { Shader.SetIsFog(true); Shader.SetFogStart(Fog.Start); Shader.SetFogEnd(Fog.End); Shader.SetFogColor(new Color4(Fog.Color.R, Fog.Color.G, Fog.Color.B, 255)); } PrimitiveType DrawMode; switch (Face.Flags & MeshFace.FaceTypeMask) { case MeshFace.FaceTypeTriangles: DrawMode = PrimitiveType.Triangles; break; case MeshFace.FaceTypeTriangleStrip: DrawMode = PrimitiveType.TriangleStrip; break; case MeshFace.FaceTypeQuads: DrawMode = PrimitiveType.Quads; break; case MeshFace.FaceTypeQuadStrip: DrawMode = PrimitiveType.QuadStrip; break; default: DrawMode = PrimitiveType.Polygon; break; } // daytime polygon { // texture if (material.DaytimeTexture != null) { if (currentHost.LoadTexture(material.DaytimeTexture, (OpenGlTextureWrapMode)material.WrapMode)) { GL.Enable(EnableCap.Texture2D); Shader.SetIsTexture(true); Shader.SetTexture(0); GL.BindTexture(TextureTarget.Texture2D, material.DaytimeTexture.OpenGlTextures[(int)material.WrapMode].Name); } } // blend mode float factor; if (material.BlendMode == MeshMaterialBlendMode.Additive) { factor = 1.0f; GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.One); Shader.SetIsFog(false); } else if (material.NighttimeTexture == null) { float blend = inv255 * material.DaytimeNighttimeBlend + 1.0f - Lighting.OptionLightingResultingAmount; if (blend > 1.0f) { blend = 1.0f; } factor = 1.0f - 0.7f * blend; } else { factor = 1.0f; } Shader.SetBrightness(factor); float alphaFactor; if (material.GlowAttenuationData != 0) { alphaFactor = (float)Glow.GetDistanceFactor(modelMatrix, vertices, ref Face, material.GlowAttenuationData); } else { alphaFactor = 1.0f; } Shader.SetOpacity(inv255 * material.Color.A * alphaFactor); // render polygon VAO.Bind(); VAO.Draw(Shader.VertexLayout, DrawMode, Face.IboStartIndex, Face.Vertices.Length); VAO.UnBind(); GL.BindTexture(TextureTarget.Texture2D, 0); } // nighttime polygon if (material.NighttimeTexture != null && currentHost.LoadTexture(material.NighttimeTexture, (OpenGlTextureWrapMode)material.WrapMode)) { // texture GL.Enable(EnableCap.Texture2D); Shader.SetIsTexture(true); Shader.SetTexture(0); GL.BindTexture(TextureTarget.Texture2D, material.NighttimeTexture.OpenGlTextures[(int)material.WrapMode].Name); GL.Enable(EnableCap.Blend); // alpha test GL.Enable(EnableCap.AlphaTest); GL.AlphaFunc(AlphaFunction.Greater, 0.0f); // blend mode float alphaFactor; if (material.GlowAttenuationData != 0) { alphaFactor = (float)Glow.GetDistanceFactor(modelMatrix, vertices, ref Face, material.GlowAttenuationData); float blend = inv255 * material.DaytimeNighttimeBlend + 1.0f - Lighting.OptionLightingResultingAmount; if (blend > 1.0f) { blend = 1.0f; } alphaFactor *= blend; } else { alphaFactor = inv255 * material.DaytimeNighttimeBlend + 1.0f - Lighting.OptionLightingResultingAmount; if (alphaFactor > 1.0f) { alphaFactor = 1.0f; } } Shader.SetOpacity(alphaFactor); // render polygon VAO.Bind(); VAO.Draw(Shader.VertexLayout, DrawMode, Face.IboStartIndex, Face.Vertices.Length); VAO.UnBind(); GL.BindTexture(TextureTarget.Texture2D, 0); RestoreBlendFunc(); RestoreAlphaFunc(); } GL.Disable(EnableCap.Texture2D); // normals if (OptionNormals) { Shader.SetIsTexture(false); Shader.SetBrightness(1.0f); Shader.SetOpacity(1.0f); NormalsVAO.Bind(); NormalsVAO.Draw(Shader.VertexLayout, PrimitiveType.Lines, Face.NormalsIboStartIndex, Face.Vertices.Length * 2); NormalsVAO.UnBind(); } // finalize if (material.BlendMode == MeshMaterialBlendMode.Additive) { RestoreBlendFunc(); } }
private void ParseSignalCommand(string Command, string[] Arguments, int Index, Encoding Encoding, Expression Expression, ref RouteData Data, bool PreviewOnly) { switch (Command) { case "signal": if (!PreviewOnly) { if (Arguments.Length < 1) { Plugin.CurrentHost.AddMessage(MessageType.Error, false, Command + " is expected to have between 1 and 2 arguments at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } else { if (Arguments[0].EndsWith(".animated", StringComparison.OrdinalIgnoreCase)) { if (Path.ContainsInvalidChars(Arguments[0])) { Plugin.CurrentHost.AddMessage(MessageType.Error, false, "AnimatedObjectFile contains illegal characters in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } else { if (Arguments.Length > 1) { Plugin.CurrentHost.AddMessage(MessageType.Warning, false, Command + " is expected to have exactly 1 argument when using animated objects at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } string f = Path.CombineFile(ObjectPath, Arguments[0]); if (!System.IO.File.Exists(f)) { Plugin.CurrentHost.AddMessage(MessageType.Error, true, "SignalFileWithoutExtension " + f + " not found in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } else { UnifiedObject obj; Plugin.CurrentHost.LoadObject(f, Encoding, out obj); if (obj is AnimatedObjectCollection) { AnimatedObjectSignalData Signal = new AnimatedObjectSignalData(obj); Data.Signals[Index] = Signal; } else { Plugin.CurrentHost.AddMessage(MessageType.Error, true, "GlowFileWithoutExtension " + f + " is not a valid animated object in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } } } } else { if (Path.ContainsInvalidChars(Arguments[0])) { Plugin.CurrentHost.AddMessage(MessageType.Error, false, "SignalFileWithoutExtension contains illegal characters in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } else { if (Arguments.Length > 2) { Plugin.CurrentHost.AddMessage(MessageType.Warning, false, Command + " is expected to have between 1 and 2 arguments at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } string f = Arguments[0]; try { if (!LocateObject(ref f, ObjectPath)) { string testPath = Path.CombineFile(ObjectPath, f); if (Plugin.CurrentHost.DetermineStaticObjectExtension(ref testPath)) { f = testPath; } else { Plugin.CurrentHost.AddMessage(MessageType.Error, false, "SignalFileWithoutExtension does not exist in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); break; } } } catch { //NYCT-1 line has a comment containing SIGNAL, which is then misinterpreted by the parser here //Really needs commenting fixing, rather than hacks like this..... Plugin.CurrentHost.AddMessage(MessageType.Error, false, "SignalFileWithoutExtension does not contain a valid path in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); break; } Bve4SignalData Signal = new Bve4SignalData { BaseObject = LoadStaticObject(f, Encoding, false), GlowObject = null }; string Folder = System.IO.Path.GetDirectoryName(f); if (!System.IO.Directory.Exists(Folder)) { Plugin.CurrentHost.AddMessage(MessageType.Error, true, "The folder " + Folder + " could not be found in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } else { Signal.SignalTextures = LoadAllTextures(f, false); Signal.GlowTextures = new OpenBveApi.Textures.Texture[] { }; if (Arguments.Length >= 2 && Arguments[1].Length != 0) { if (Path.ContainsInvalidChars(Arguments[1])) { Plugin.CurrentHost.AddMessage(MessageType.Error, false, "GlowFileWithoutExtension contains illegal characters in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } else { f = Arguments[1]; bool glowFileFound = false; if (!System.IO.File.Exists(f) && System.IO.Path.HasExtension(f)) { string ext = System.IO.Path.GetExtension(f); if (Plugin.CurrentHost.SupportedStaticObjectExtensions.Contains(ext.ToLowerInvariant())) { Plugin.CurrentHost.AddMessage(MessageType.Warning, false, "GlowFileWithoutExtension should not supply a file extension in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); f = Path.CombineFile(ObjectPath, f); glowFileFound = true; } else if (Plugin.CurrentHost.SupportedAnimatedObjectExtensions.Contains(ext.ToLowerInvariant())) { Plugin.CurrentHost.AddMessage(MessageType.Error, false, "GlowFileWithoutExtension must be a static object in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } else { Plugin.CurrentHost.AddMessage(MessageType.Error, false, "GlowFileWithoutExtension is invalid in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); } } if (!System.IO.File.Exists(f) && !System.IO.Path.HasExtension(f)) { string testPath = Path.CombineFile(ObjectPath, f); if (Plugin.CurrentHost.DetermineStaticObjectExtension(ref testPath)) { f = testPath; glowFileFound = true; } else { Plugin.CurrentHost.AddMessage(MessageType.Error, false, "GlowFileWithoutExtension does not exist in " + Command + " at line " + Expression.Line.ToString(Culture) + ", column " + Expression.Column.ToString(Culture) + " in file " + Expression.File); break; } } if (glowFileFound) { Plugin.CurrentHost.LoadStaticObject(f, Encoding, false, out Signal.GlowObject); if (Signal.GlowObject != null) { Signal.GlowTextures = LoadAllTextures(f, true); for (int p = 0; p < Signal.GlowObject.Mesh.Materials.Length; p++) { Signal.GlowObject.Mesh.Materials[p].BlendMode = MeshMaterialBlendMode.Additive; Signal.GlowObject.Mesh.Materials[p].GlowAttenuationData = Glow.GetAttenuationData(200.0, GlowAttenuationMode.DivisionExponent4); } } } } } Data.Signals.Add(Index, Signal); } } } } } break; } }
static void Main(string[] args) { Console.Title = "ExternalBase.C0re"; if (!Memory.StartProcess()) { Environment.Exit(0); } ClientPointer = Memory.DllImageAddress("client.dll"); EnginePointer = Memory.DllImageAddress("engine.dll"); DLLImports.SetHook(); for (var i = 0; i < 64; i++) { Arrays.Entity[i] = new Entity(); } Console.WriteLine(@" _______ _______ _______ _______ "); Console.WriteLine(@" ( ____ \( __ )( ____ )( ____ \"); Console.WriteLine(@" | ( \/| ( ) || ( )|| ( \/"); Console.WriteLine(@" | | | | / || (____)|| (__ "); Console.WriteLine(@" | | | (/ /) || __)| __) "); Console.WriteLine(@" | | | / | || (\ ( | ( "); Console.WriteLine(@" | (____/\| (__) || ) \ \__| (____/\"); Console.WriteLine(@" (_______/(_______)|/ \__/(_______/"); Console.WriteLine(@""); Console.ForegroundColor = ConsoleColor.Green; AdressReader AdressReader = new AdressReader(); Thread DataReaderThread = new Thread(AdressReader.ReadData); DataReaderThread.Start(); Console.WriteLine("Thread: 'AdressReader' started."); Glow Glow = new Glow(); Thread GlowThread = new Thread(Glow.GlowESP); GlowThread.Start(); Console.WriteLine("Thread: 'Glow-ESP' started."); Triggerbot Triggerbot = new Triggerbot(); Thread TriggerbotThread = new Thread(Triggerbot.Trigger); TriggerbotThread.Start(); Console.WriteLine("Thread: 'Triggerbot' started."); Misc Misc = new Misc(); Thread MiscThread = new Thread(Misc.Miscellaneous); MiscThread.Start(); Console.WriteLine("Thread: 'Misc' started."); SkinChanger SkinChanger = new SkinChanger(); Thread SkinChangerThread = new Thread(SkinChanger.IterateThroughWeapons); SkinChangerThread.Start(); Console.WriteLine("Thread: 'SkinChanger' started."); Application.Run(); }
private IEnumerator FadeGlowInOut(Glow glow, float timeDelay, bool shouldStartOver) { return new <FadeGlowInOut>c__Iterator1D2 { timeDelay = timeDelay, glow = glow, shouldStartOver = shouldStartOver, <$>timeDelay = timeDelay, <$>glow = glow, <$>shouldStartOver = shouldStartOver, <>f__this = this }; }
DEFINE_STANDARD_OP(Glow, GLOW)
private void TickEntityHints() { if (CameraMode is ThirdPersonSpectateCamera) { DeleteHint(); return; } IEntityHint hint = IsLookingAtHintableEntity(MAX_HINT_DISTANCE); Entity target = hint as Entity; if (hint == null) { IUse use = IsLookingAtUsableEntity(87.5f); if (use == null || !use.IsUsable(this)) { DeleteHint(); return; } target = use as Entity; } else if (!hint.CanHint(this)) { DeleteHint(); return; } if (target != null && target == _currentTarget) { if (hint != null) { hint.HintTick(this); if (IsClient) { _currentHintPanel.UpdateHintPanel(hint.TextOnTick); } } else if (target is DoorEntity doorEntity) { if (IsClient) { TranslationData translationData; if (doorEntity.State == DoorEntity.DoorState.Closed) { translationData = new("DOOR.OPEN"); } else { translationData = new("DOOR.CLOSE"); } if (doorEntity.Locked) { translationData = new("DOOR.LOCKED"); if (_currentHintPanel is GlyphHint glyphHint && glyphHint.Data[0].InputButtons.Contains(InputButton.Use)) { glyphHint.Data[0].InputButtons.Remove(InputButton.Use); } } else if (_currentHintPanel is GlyphHint glyphHint && !glyphHint.Data[0].InputButtons.Contains(InputButton.Use)) { glyphHint.Data[0].InputButtons.Add(InputButton.Use); } _currentHintPanel.UpdateHintPanel(translationData); } } return; } DeleteHint(); if (IsClient) { if ((hint == null || hint.ShowGlow) && target is ModelEntity model && model.IsValid()) { Glow glow = model.Components.GetOrCreate <Glow>(); glow.Color = Color.White; // TODO: Let's let people change this in their settings. glow.Active = true; } if (hint != null) { _currentHintPanel = hint.DisplayHint(this); _currentHintPanel.Parent = HintDisplay.Instance; _currentHintPanel.Enabled(true); } else if (target != null) { TranslationData translationData = new("ENTITY.USE", new TranslationData($"ENTITY.{Utils.GetLibraryName(target.GetType()).ToUpper()}")); List <InputButton> inputButtons = new() { InputButton.Use }; if (target is DoorEntity doorEntity) { translationData = doorEntity.State == DoorEntity.DoorState.Open ? new("DOOR.CLOSE") : new("DOOR.OPEN"); if (doorEntity.Locked) { translationData = new("DOOR.LOCKED"); inputButtons.Clear(); } } _currentHintPanel = new GlyphHint(new GlyphHintData[] { new(translationData, inputButtons.ToArray()) })
static void PrintFFmpegOverlayEffectsCommand() { const double firstBeatAudioPos = 16.483; //Different as this is using the synced & edited video const double beatInterval = 0.46875; const int barLength = 4; var beats = new BeatPositioner( firstBeat: firstBeatAudioPos, interval: beatInterval, barLength: barLength ); const string mainFolder = @"C:\Users\Alex\Pictures\Meme Templates\Meme Making\Mum Headbanging"; var GlowWhiteCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-white.png"))); var GlowLargeWhiteCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-white-2x.png"))); var GlowTransparentRedCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-red-opacity130.png"))); var GlowTransparentBlueCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-blue-opacity130.png"))); var GlowTransparentGreenCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-green-opacity130.png"))); var GlowTransparentYellowCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-yellow-opacity170.png"))); var GlowTransparentPurpleCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-purple-opacity150.png"))); var GlowTransparentOrangeCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-orange-opacity170.png"))); var GlowTransparentLightblueCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-lightblue-opacity180.png"))); var GlowTransparentDarkgreenCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-darkgreen-opacity170.png"))); var GlowRedCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-red.png"))); var GlowBlueCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-blue.png"))); var GlowGreenCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-green.png"))); var GlowYellowCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-yellow.png"))); var GlowPurpleCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-purple.png"))); var GlowOrangeCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-orange.png"))); var GlowLightblueCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-lightblue.png"))); var GlowDarkgreenCircle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-darkgreen.png"))); var GlowSemitransparentWhiteRectangle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-white-rectangle-opacity230.png"))); var GlowTransparentWhiteRectangle = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-circlular-white-rectangle-opacity200.png"))); //var GlowDiamond = new GlowType(new FileInfo(Path.Combine(mainFolder, "glow-diamond-white.png"))); // colorMixer: new FFmpegColorChannelMixer( // redPart: (1, 1, 1, 0), // greenPart: (0, 0, 0, 0), // bluePart: (0, 0, 0, 0), // alphaPart: (0, 0, 0, 0.5) // ), //Note: // 1 third of a beat = 0.15625 // To prevent a continuous overlap in the section with repeated beats 1 third of a beat apart, // set the synth beat glow durations to, at most, 0.156 seconds (in total, ie. fade in + fade out) //Note: // If a fade in or out time is zero - even just one, not both - the fade doesn't show at all. // I've modified Glow() to handle this. Glow fullBeatEven = new Glow(GlowSemitransparentWhiteRectangle, 0.001, 0.2, x: 0.5, y: 0.5); Glow fullBeatOdd = new Glow(GlowSemitransparentWhiteRectangle, 0.001, 0.2, x: 0.5, y: 0.5); Glow leftSynthBeatRed = new Glow(GlowRedCircle, 0.001, 0.15, x: 0, y: 0); Glow leftSynthBeatBlue = new Glow(GlowBlueCircle, 0.001, 0.15, x: 0, y: 0); Glow leftSynthBeatGreen = new Glow(GlowGreenCircle, 0.001, 0.15, x: 0, y: 0); Glow leftSynthBeatYellow = new Glow(GlowYellowCircle, 0.001, 0.15, x: 0, y: 0); Glow leftSynthBeatPurple = new Glow(GlowPurpleCircle, 0.001, 0.15, x: 0, y: 0); Glow leftSynthBeatOrange = new Glow(GlowOrangeCircle, 0.001, 0.15, x: 0, y: 0); Glow leftSynthBeatLightblue = new Glow(GlowLightblueCircle, 0.001, 0.15, x: 0, y: 0); Glow leftSynthBeatDarkgreen = new Glow(GlowDarkgreenCircle, 0.001, 0.15, x: 0, y: 0); Glow rightSynthBeatRed = new Glow(GlowRedCircle, 0.001, 0.15, x: 1, y: 0); Glow rightSynthBeatBlue = new Glow(GlowBlueCircle, 0.001, 0.15, x: 1, y: 0); Glow rightSynthBeatGreen = new Glow(GlowGreenCircle, 0.001, 0.15, x: 1, y: 0); Glow rightSynthBeatYellow = new Glow(GlowYellowCircle, 0.001, 0.15, x: 1, y: 0); Glow rightSynthBeatPurple = new Glow(GlowPurpleCircle, 0.001, 0.15, x: 1, y: 0); Glow rightSynthBeatOrange = new Glow(GlowOrangeCircle, 0.001, 0.15, x: 1, y: 0); Glow rightSynthBeatLightblue = new Glow(GlowLightblueCircle, 0.001, 0.15, x: 1, y: 0); Glow rightSynthBeatDarkgreen = new Glow(GlowDarkgreenCircle, 0.001, 0.15, x: 1, y: 0); var taggedBeats = new BeatTagSequence( beatPositioner: beats, firstBeatTags: ImmutableList.Create <object>(fullBeatEven, leftSynthBeatRed, rightSynthBeatRed) ) .SkipByBeats(2.5 / 3.0).TagAndAdd(leftSynthBeatBlue) .SkipByBeats(0.25 / 3.0).TagAndAdd(rightSynthBeatBlue) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatBlue) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatGreen) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatGreen) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatBlue) //Prev: duhh, drrruhh du du duhh //Next: duhh, duh boof, duh boof, duh boof, duh boof .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatYellow, rightSynthBeatYellow) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatPurple) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven) .SkipByBeats(2.0 / 3.0).TagAndAdd(rightSynthBeatGreen) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatBlue) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven) .SkipByBeats(2.0 / 3.0).TagAndAdd(rightSynthBeatRed) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd) //Prev: duhh, duh boof, duh boof, duh boof, duh boof //Next: duh duhh, drrruh du du duhh du du duhh .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatLightblue) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, rightSynthBeatLightblue) .SkipByBeats(2.5 / 3.0).TagAndAdd(leftSynthBeatGreen) .SkipByBeats(0.25 / 3.0).TagAndAdd(rightSynthBeatGreen) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatGreen) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatPurple) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatPurple) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatGreen) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatPurple) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatPurple) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatGreen) //Prev: duh duhh, drrruh du du duhh du du duhh //Next: duhh, boof, duh duhh, duh duhh-- .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatRed, rightSynthBeatRed) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatYellow, rightSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatGreen, rightSynthBeatGreen) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatYellow, rightSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatGreen, rightSynthBeatGreen) //Prev: duhh, boof, duh duhh, duh duhh-- //Next: --duh duhh, drrruh du du duhh .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatYellow, rightSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatGreen, rightSynthBeatGreen) .SkipByBeats(2.5 / 3.0).TagAndAdd(leftSynthBeatRed) .SkipByBeats(0.25 / 3.0).TagAndAdd(rightSynthBeatRed) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatBlue) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatBlue) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatRed) //Prev: --duh duhh, drrruh du du duhh //Next: duhh, duh boof, duh boof, duh boof, duh boof .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatLightblue, rightSynthBeatLightblue) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatPurple) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatBlue) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatGreen) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd) //Prev: duhh, duh boof, duh boof, duh boof, duh boof //Next: duh duhh, drrruh du du duhh du du duhh .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatRed) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatRed, rightSynthBeatRed) .SkipByBeats(2.5 / 3.0).TagAndAdd(leftSynthBeatLightblue) .SkipByBeats(0.25 / 3.0).TagAndAdd(rightSynthBeatLightblue) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatLightblue) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatYellow) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatBlue) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatYellow) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatPurple) //Prev: duh duhh, drrruh du du duhh du du duhh //Next: duhh, boof, duh duhh, duh duhh, duh-- (iighiahhh iighiahhh iighiahhh iighiahhh iighiahhh) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatRed.With(fadeOutTime: 0.6), rightSynthBeatRed.With(fadeOutTime: 0.6)) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatRed.With(fadeOutTime: 0.6), rightSynthBeatRed.With(fadeOutTime: 0.6)) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatRed, rightSynthBeatRed) //looks better with //leave these out for extra emphasis of the other beats .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatRed.With(fadeOutTime: 0.6), rightSynthBeatRed.With(fadeOutTime: 0.6)) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatRed, rightSynthBeatRed) //looks better with //leave these out for extra emphasis of the other beats .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatRed.With(fadeOutTime: 0.6), rightSynthBeatRed.With(fadeOutTime: 0.6)) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatRed, rightSynthBeatRed) //looks better with //leave these out for extra emphasis of the other beats //Prev: duhh, boof, duh duhh, duh duhh, duh (iighiahhh iighiahhh iighiahhh iighiahhh iighiahhh) //Next: duhh du du duhh du du duhh du du duhh du du (#1) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatOrange) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, rightSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatOrange) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatOrange) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, rightSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatOrange) //Prev: duhh du du duhh du du duhh du du duhh du du (#1) //Next: duhh du du duhh du du duhh du du duhh du du (#2) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatOrange) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, rightSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatOrange) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatOrange) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, rightSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatOrange) //Prev: duhh du du duhh du du duhh du du duhh du du (#2) //Next: duhh du du duhh du du duhh du du duhh du du (#3) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatYellow) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatYellow) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, rightSynthBeatYellow) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatYellow) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatGreen) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatGreen) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatGreen) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, rightSynthBeatGreen) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatGreen) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatGreen) //Prev: duhh du du duhh du du duhh du du duhh du du (#3) //Next: duhh du du duhh du du duhh du du duhh du du (#4) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatBlue) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatBlue) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatBlue) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, rightSynthBeatBlue) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatBlue) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatBlue) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatRed) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, rightSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(rightSynthBeatRed) //Prev: duhh du du duhh du du duhh du du duhh du du (#4) //Next: duhh du du duhh du du duhh du du duhh du du (#5) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatLightblue, rightSynthBeatLightblue) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatBlue, rightSynthBeatBlue) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatBlue, rightSynthBeatBlue) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatYellow, rightSynthBeatYellow) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatOrange, rightSynthBeatOrange) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatOrange, rightSynthBeatOrange) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatGreen, rightSynthBeatGreen) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatDarkgreen, rightSynthBeatDarkgreen) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatDarkgreen, rightSynthBeatDarkgreen) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatRed, rightSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatRed, rightSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatRed, rightSynthBeatRed) //Prev: duhh du du duhh du du duhh du du duhh du du (#5) //Next: duhh du du duhh du du duhh du du duhh du du (#6) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatBlue, rightSynthBeatYellow) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatYellow, rightSynthBeatBlue) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatBlue, rightSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatYellow, rightSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatRed, rightSynthBeatYellow) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatYellow, rightSynthBeatRed) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatRed, rightSynthBeatPurple) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatPurple, rightSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatRed, rightSynthBeatPurple) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatLightblue, rightSynthBeatGreen) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatGreen, rightSynthBeatLightblue) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatLightblue, rightSynthBeatGreen) //Prev: duhh du du duhh du du duhh du du duhh du du (#6) //Next: duhh du du duhh du du duhh, duhh du du duhh, duhh boof, mu fa, sa boof, duh BOOF. .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatRed, leftSynthBeatRed, rightSynthBeatPurple, rightSynthBeatPurple) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatPurple, rightSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatPurple, rightSynthBeatRed) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatYellow, rightSynthBeatRed) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatRed, rightSynthBeatYellow) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatRed, rightSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatYellow, rightSynthBeatRed) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd, leftSynthBeatBlue, rightSynthBeatPurple) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatPurple, rightSynthBeatBlue) .SkipByBeats(1.0 / 3.0).TagAndAdd(leftSynthBeatPurple, rightSynthBeatBlue) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatBlue, rightSynthBeatPurple) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatRed, leftSynthBeatRed, rightSynthBeatRed, rightSynthBeatRed) .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd) .SkipByBeats(2.0 / 3.0).TagAndAdd(fullBeatEven, leftSynthBeatLightblue, rightSynthBeatGreen) //mu .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatEven, leftSynthBeatGreen, rightSynthBeatLightblue) //fa .SkipByBeats(2.0 / 3.0).TagAndAdd(fullBeatEven, leftSynthBeatLightblue, rightSynthBeatGreen) //sa .SkipToBeat(Beat.NextBeat).TagAndAdd(fullBeatOdd) .SkipByBeats(2.0 / 3.0).TagAndAdd(leftSynthBeatYellow, rightSynthBeatYellow) .SkipToBeat(Beat.NextBeat).TagAndAdd( fullBeatEven, leftSynthBeatRed.With(fadeOutTime: 0.6), rightSynthBeatRed.With(fadeOutTime: 0.6), leftSynthBeatRed.With(fadeOutTime: 0.6), rightSynthBeatRed.With(fadeOutTime: 0.6), leftSynthBeatYellow.With(fadeOutTime: 0.6), rightSynthBeatPurple.With(fadeOutTime: 0.6) ); //Prev: duhh du du duhh du du duhh, duhh du du duhh, duhh boof, mu fa, sa boof, duh BOOF. Console.WriteLine("Tagged beat timings:"); Console.WriteLine(); foreach (var b in taggedBeats.TaggedBeats) { Console.WriteLine(beats.BeatToTime(b.Beat).ToString(".0000") + " [" + string.Join(", ", b.Tags) + "]"); } Console.WriteLine(); Console.WriteLine("FFmpeg input:"); Console.WriteLine(); Console.WriteLine( // GlowOverlayCommandBuilder.BuildFFmpegCommand( // inputVideo: new FFmpegInput( // new FileInfo( // Path.Combine(mainFolder, "Meme Video 1.2.1.mp4") // ) // ), // outputFile: new FFOutput( // new FileInfo( // Path.Combine(mainFolder, "Meme Video 5.3 - " + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".mp4") // ) // ), // taggedBeats: taggedBeats.TaggedBeats, // beatPositioner: beats // ).ToString() // StaggeredGlowOverlayCommandBuilder.BuildBatchCommand( // inputVideo: new FFmpegInput( // new FileInfo( // Path.Combine(mainFolder, "Meme Video 1.2.1.mp4") // ) // ), // outputFile: new FFOutput( // new FileInfo( // Path.Combine(mainFolder, "Meme Video 5.3 - " + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".mp4") // ) // ), // taggedBeats: taggedBeats.TaggedBeats, // beatPositioner: beats, // approxGlowsPerStage: 2 // ) CuttingGlowOverlayCommandBuilder.BuildBatchCommand( inputVideo: new FFmpegInput( new FileInfo( Path.Combine(mainFolder, "Meme Video 1.2.1.mp4") ) ), outputFile: new FFmpegOutput( new FileInfo( Path.Combine(mainFolder, "Meme Video 5.3 - " + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".mp4") ) ), taggedBeats: taggedBeats.TaggedBeats, beatPositioner: beats, approxGlowsPerCut: 7, approxGlowsPerSubstage: 5 ) ); Console.ReadLine(); }
public void RenderFaceImmediateMode(ObjectState State, MeshFace Face, bool IsDebugTouchMode = false) { if (State.Prototype.Mesh.Vertices.Length < 1) { return; } VertexTemplate[] vertices = State.Prototype.Mesh.Vertices; MeshMaterial material = State.Prototype.Mesh.Materials[Face.Material]; if (!OptionBackFaceCulling || (Face.Flags & MeshFace.Face2Mask) != 0) { GL.Disable(EnableCap.CullFace); } else if (OptionBackFaceCulling) { if ((Face.Flags & MeshFace.Face2Mask) == 0) { GL.Enable(EnableCap.CullFace); } } Matrix4D modelMatrix = State.ModelMatrix * Camera.TranslationMatrix; // matrix unsafe { GL.MatrixMode(MatrixMode.Projection); GL.PushMatrix(); fixed(double *matrixPointer = &CurrentProjectionMatrix.Row0.X) { GL.LoadMatrix(matrixPointer); } GL.MatrixMode(MatrixMode.Modelview); GL.PushMatrix(); fixed(double *matrixPointer = &CurrentViewMatrix.Row0.X) { GL.LoadMatrix(matrixPointer); } double *matrixPointer2 = &modelMatrix.Row0.X; { GL.MultMatrix(matrixPointer2); } GL.MatrixMode(MatrixMode.Texture); GL.PushMatrix(); fixed(double *matrixPointer = &State.TextureTranslation.Row0.X) { GL.LoadMatrix(matrixPointer); } } if (OptionWireFrame) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); } // lighting if (material.NighttimeTexture == null) { if (OptionLighting) { GL.Enable(EnableCap.Lighting); } } if ((material.Flags & MeshMaterial.EmissiveColorMask) != 0) { GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Emission, new Color4(material.EmissiveColor.R, material.EmissiveColor.G, material.EmissiveColor.B, 255)); } else { GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Emission, new Color4(0.0f, 0.0f, 0.0f, 1.0f)); } // fog if (OptionFog) { GL.Enable(EnableCap.Fog); } PrimitiveType DrawMode; switch (Face.Flags & MeshFace.FaceTypeMask) { case MeshFace.FaceTypeTriangles: DrawMode = PrimitiveType.Triangles; break; case MeshFace.FaceTypeTriangleStrip: DrawMode = PrimitiveType.TriangleStrip; break; case MeshFace.FaceTypeQuads: DrawMode = PrimitiveType.Quads; break; case MeshFace.FaceTypeQuadStrip: DrawMode = PrimitiveType.QuadStrip; break; default: DrawMode = PrimitiveType.Polygon; break; } // daytime polygon { // texture if (material.DaytimeTexture != null) { if (currentHost.LoadTexture(material.DaytimeTexture, (OpenGlTextureWrapMode)material.WrapMode)) { GL.Enable(EnableCap.Texture2D); if (LastBoundTexture != material.DaytimeTexture.OpenGlTextures[(int)material.WrapMode]) { GL.BindTexture(TextureTarget.Texture2D, material.DaytimeTexture.OpenGlTextures[(int)material.WrapMode].Name); LastBoundTexture = material.DaytimeTexture.OpenGlTextures[(int)material.WrapMode]; } } } // blend mode float factor; if (material.BlendMode == MeshMaterialBlendMode.Additive) { factor = 1.0f; GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.One); GL.Disable(EnableCap.Fog); } else if (material.NighttimeTexture == null) { float blend = inv255 * material.DaytimeNighttimeBlend + 1.0f - Lighting.OptionLightingResultingAmount; if (blend > 1.0f) { blend = 1.0f; } factor = 1.0f - 0.7f * blend; } else { factor = 1.0f; } float alphaFactor; if (material.GlowAttenuationData != 0) { alphaFactor = (float)Glow.GetDistanceFactor(modelMatrix, vertices, ref Face, material.GlowAttenuationData); } else { alphaFactor = 1.0f; } GL.Begin(DrawMode); if (OptionWireFrame) { GL.Color4(inv255 * material.Color.R * factor, inv255 * material.Color.G * factor, inv255 * material.Color.B * factor, 1.0f); } else { GL.Color4(inv255 * material.Color.R * factor, inv255 * material.Color.G * factor, inv255 * material.Color.B * factor, inv255 * material.Color.A * alphaFactor); } for (int i = 0; i < Face.Vertices.Length; i++) { GL.Normal3(Face.Vertices[i].Normal.X, Face.Vertices[i].Normal.Y, -Face.Vertices[i].Normal.Z); GL.TexCoord2(vertices[Face.Vertices[i].Index].TextureCoordinates.X, vertices[Face.Vertices[i].Index].TextureCoordinates.Y); if (vertices[Face.Vertices[i].Index] is ColoredVertex) { ColoredVertex v = (ColoredVertex)vertices[Face.Vertices[i].Index]; GL.Color3(v.Color.R, v.Color.G, v.Color.B); } GL.Vertex3(vertices[Face.Vertices[i].Index].Coordinates.X, vertices[Face.Vertices[i].Index].Coordinates.Y, -vertices[Face.Vertices[i].Index].Coordinates.Z); } GL.End(); } // nighttime polygon if (material.NighttimeTexture != null && currentHost.LoadTexture(material.NighttimeTexture, (OpenGlTextureWrapMode)material.WrapMode)) { // texture GL.Enable(EnableCap.Texture2D); if (LastBoundTexture != material.NighttimeTexture.OpenGlTextures[(int)material.WrapMode]) { GL.BindTexture(TextureTarget.Texture2D, material.NighttimeTexture.OpenGlTextures[(int)material.WrapMode].Name); LastBoundTexture = material.NighttimeTexture.OpenGlTextures[(int)material.WrapMode]; } GL.Enable(EnableCap.Blend); // alpha test GL.Enable(EnableCap.AlphaTest); GL.AlphaFunc(AlphaFunction.Greater, 0.0f); // blend mode float alphaFactor; if (material.GlowAttenuationData != 0) { alphaFactor = (float)Glow.GetDistanceFactor(modelMatrix, vertices, ref Face, material.GlowAttenuationData); float blend = inv255 * material.DaytimeNighttimeBlend + 1.0f - Lighting.OptionLightingResultingAmount; if (blend > 1.0f) { blend = 1.0f; } alphaFactor *= blend; } else { alphaFactor = inv255 * material.DaytimeNighttimeBlend + 1.0f - Lighting.OptionLightingResultingAmount; if (alphaFactor > 1.0f) { alphaFactor = 1.0f; } } GL.Begin(DrawMode); if (OptionWireFrame) { GL.Color4(inv255 * material.Color.R, inv255 * material.Color.G, inv255 * material.Color.B, 1.0f); } else { GL.Color4(inv255 * material.Color.R, inv255 * material.Color.G, inv255 * material.Color.B, inv255 * material.Color.A * alphaFactor); } for (int i = 0; i < Face.Vertices.Length; i++) { GL.Normal3(Face.Vertices[i].Normal.X, Face.Vertices[i].Normal.Y, -Face.Vertices[i].Normal.Z); GL.TexCoord2(vertices[Face.Vertices[i].Index].TextureCoordinates.X, vertices[Face.Vertices[i].Index].TextureCoordinates.Y); if (vertices[Face.Vertices[i].Index] is ColoredVertex) { ColoredVertex v = (ColoredVertex)vertices[Face.Vertices[i].Index]; GL.Color3(v.Color.R, v.Color.G, v.Color.B); } GL.Vertex3(vertices[Face.Vertices[i].Index].Coordinates.X, vertices[Face.Vertices[i].Index].Coordinates.Y, -vertices[Face.Vertices[i].Index].Coordinates.Z); } GL.End(); RestoreBlendFunc(); RestoreAlphaFunc(); } GL.Disable(EnableCap.Texture2D); // normals if (OptionNormals) { for (int i = 0; i < Face.Vertices.Length; i++) { GL.Begin(PrimitiveType.Lines); GL.Color4(new Color4(material.Color.R, material.Color.G, material.Color.B, 255)); GL.Vertex3(vertices[Face.Vertices[i].Index].Coordinates.X, vertices[Face.Vertices[i].Index].Coordinates.Y, -vertices[Face.Vertices[i].Index].Coordinates.Z); GL.Vertex3(vertices[Face.Vertices[i].Index].Coordinates.X + Face.Vertices[i].Normal.X, vertices[Face.Vertices[i].Index].Coordinates.Y + +Face.Vertices[i].Normal.Z, -(vertices[Face.Vertices[i].Index].Coordinates.Z + Face.Vertices[i].Normal.Z)); GL.End(); } } // finalize if (OptionWireFrame) { GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); } if (material.BlendMode == MeshMaterialBlendMode.Additive) { RestoreBlendFunc(); } GL.PopMatrix(); GL.MatrixMode(MatrixMode.Modelview); GL.PopMatrix(); GL.MatrixMode(MatrixMode.Projection); GL.PopMatrix(); }
private static void RenderFace(ref MeshMaterial Material, VertexTemplate[] Vertices, OpenGlTextureWrapMode wrap, ref MeshFace Face, Vector3 Camera, bool IsDebugTouchMode = false) { // texture if (Material.DaytimeTexture != null) { if (Textures.LoadTexture(Material.DaytimeTexture, wrap)) { if (!TexturingEnabled) { GL.Enable(EnableCap.Texture2D); TexturingEnabled = true; } if (Material.DaytimeTexture.OpenGlTextures[(int)wrap] != LastBoundTexture) { GL.BindTexture(TextureTarget.Texture2D, Material.DaytimeTexture.OpenGlTextures[(int)wrap].Name); LastBoundTexture = Material.DaytimeTexture.OpenGlTextures[(int)wrap]; } } else { if (TexturingEnabled) { GL.Disable(EnableCap.Texture2D); TexturingEnabled = false; LastBoundTexture = null; } } } else { if (TexturingEnabled) { GL.Disable(EnableCap.Texture2D); TexturingEnabled = false; LastBoundTexture = null; } } // blend mode float factor; if (Material.BlendMode == MeshMaterialBlendMode.Additive) { factor = 1.0f; if (!BlendEnabled) { GL.Enable(EnableCap.Blend); } GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.One); if (FogEnabled) { GL.Disable(EnableCap.Fog); } } else if (Material.NighttimeTexture == null) { float blend = inv255 * (float)Material.DaytimeNighttimeBlend + 1.0f - OptionLightingResultingAmount; if (blend > 1.0f) { blend = 1.0f; } factor = 1.0f - 0.7f * blend; } else { factor = 1.0f; } if (Material.NighttimeTexture != null) { if (LightingEnabled) { GL.Disable(EnableCap.Lighting); LightingEnabled = false; } } else { if (OptionLighting & !LightingEnabled) { GL.Enable(EnableCap.Lighting); LightingEnabled = true; } } // render daytime polygon int FaceType = Face.Flags & MeshFace.FaceTypeMask; if (!IsDebugTouchMode) { switch (FaceType) { case MeshFace.FaceTypeTriangles: GL.Begin(PrimitiveType.Triangles); break; case MeshFace.FaceTypeTriangleStrip: GL.Begin(PrimitiveType.TriangleStrip); break; case MeshFace.FaceTypeQuads: GL.Begin(PrimitiveType.Quads); break; case MeshFace.FaceTypeQuadStrip: GL.Begin(PrimitiveType.QuadStrip); break; default: GL.Begin(PrimitiveType.Polygon); break; } } else { GL.Begin(PrimitiveType.LineLoop); } if (Material.GlowAttenuationData != 0) { float alphafactor = (float)Glow.GetDistanceFactor(Vertices, ref Face, Material.GlowAttenuationData, World.AbsoluteCameraPosition); if (OptionWireframe) { GL.Color4(inv255 * (float)Material.Color.R * factor, inv255 * Material.Color.G * factor, inv255 * (float)Material.Color.B * factor, 1.0f); } else { GL.Color4(inv255 * (float)Material.Color.R * factor, inv255 * Material.Color.G * factor, inv255 * (float)Material.Color.B * factor, inv255 * (float)Material.Color.A * alphafactor); } } else { if (OptionWireframe) { GL.Color4(inv255 * (float)Material.Color.R * factor, inv255 * Material.Color.G * factor, inv255 * (float)Material.Color.B * factor, 1.0f); } else { GL.Color4(inv255 * (float)Material.Color.R * factor, inv255 * Material.Color.G * factor, inv255 * (float)Material.Color.B * factor, inv255 * (float)Material.Color.A); } } if ((Material.Flags & MeshMaterial.EmissiveColorMask) != 0) { GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Emission, new float[] { inv255 *(float)Material.EmissiveColor.R, inv255 * (float)Material.EmissiveColor.G, inv255 * (float)Material.EmissiveColor.B, 1.0f }); } else { GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Emission, new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); } if (Material.DaytimeTexture != null) { if (LightingEnabled) { for (int j = 0; j < Face.Vertices.Length; j++) { GL.Normal3(Face.Vertices[j].Normal.X, Face.Vertices[j].Normal.Y, Face.Vertices[j].Normal.Z); GL.TexCoord2(Vertices[Face.Vertices[j].Index].TextureCoordinates.X, Vertices[Face.Vertices[j].Index].TextureCoordinates.Y); if (Vertices[Face.Vertices[j].Index] is ColoredVertex) { ColoredVertex v = (ColoredVertex)Vertices[Face.Vertices[j].Index]; GL.Color3(v.Color.R, v.Color.G, v.Color.B); } GL.Vertex3((float)(Vertices[Face.Vertices[j].Index].Coordinates.X - Camera.X), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Y - Camera.Y), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Z - Camera.Z)); } } else { for (int j = 0; j < Face.Vertices.Length; j++) { GL.TexCoord2(Vertices[Face.Vertices[j].Index].TextureCoordinates.X, Vertices[Face.Vertices[j].Index].TextureCoordinates.Y); if (Vertices[Face.Vertices[j].Index] is ColoredVertex) { ColoredVertex v = (ColoredVertex)Vertices[Face.Vertices[j].Index]; GL.Color3(v.Color.R, v.Color.G, v.Color.B); } GL.Vertex3((float)(Vertices[Face.Vertices[j].Index].Coordinates.X - Camera.X), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Y - Camera.Y), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Z - Camera.Z)); } } } else { if (LightingEnabled) { for (int j = 0; j < Face.Vertices.Length; j++) { GL.Normal3(Face.Vertices[j].Normal.X, Face.Vertices[j].Normal.Y, Face.Vertices[j].Normal.Z); if (Vertices[Face.Vertices[j].Index] is ColoredVertex) { ColoredVertex v = (ColoredVertex)Vertices[Face.Vertices[j].Index]; GL.Color3(v.Color.R, v.Color.G, v.Color.B); } GL.Vertex3((float)(Vertices[Face.Vertices[j].Index].Coordinates.X - Camera.X), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Y - Camera.Y), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Z - Camera.Z)); } } else { for (int j = 0; j < Face.Vertices.Length; j++) { if (Vertices[Face.Vertices[j].Index] is ColoredVertex) { ColoredVertex v = (ColoredVertex)Vertices[Face.Vertices[j].Index]; GL.Color3(v.Color.R, v.Color.G, v.Color.B); } GL.Vertex3((float)(Vertices[Face.Vertices[j].Index].Coordinates.X - Camera.X), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Y - Camera.Y), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Z - Camera.Z)); } } } GL.End(); // render nighttime polygon if (Material.NighttimeTexture != null && Textures.LoadTexture(Material.NighttimeTexture, wrap)) { if (!TexturingEnabled) { GL.Enable(EnableCap.Texture2D); TexturingEnabled = true; } if (!BlendEnabled) { GL.Enable(EnableCap.Blend); } GL.BindTexture(TextureTarget.Texture2D, Material.NighttimeTexture.OpenGlTextures[(int)wrap].Name); LastBoundTexture = null; GL.AlphaFunc(AlphaFunction.Greater, 0.0f); GL.Enable(EnableCap.AlphaTest); switch (FaceType) { case MeshFace.FaceTypeTriangles: GL.Begin(PrimitiveType.Triangles); break; case MeshFace.FaceTypeTriangleStrip: GL.Begin(PrimitiveType.TriangleStrip); break; case MeshFace.FaceTypeQuads: GL.Begin(PrimitiveType.Quads); break; case MeshFace.FaceTypeQuadStrip: GL.Begin(PrimitiveType.QuadStrip); break; default: GL.Begin(PrimitiveType.Polygon); break; } float alphafactor; if (Material.GlowAttenuationData != 0) { alphafactor = (float)Glow.GetDistanceFactor(Vertices, ref Face, Material.GlowAttenuationData, Camera); float blend = inv255 * (float)Material.DaytimeNighttimeBlend + 1.0f - OptionLightingResultingAmount; if (blend > 1.0f) { blend = 1.0f; } alphafactor *= blend; } else { alphafactor = inv255 * (float)Material.DaytimeNighttimeBlend + 1.0f - OptionLightingResultingAmount; if (alphafactor > 1.0f) { alphafactor = 1.0f; } } if (OptionWireframe) { GL.Color4(inv255 * (float)Material.Color.R * factor, inv255 * Material.Color.G * factor, inv255 * (float)Material.Color.B * factor, 1.0f); } else { GL.Color4(inv255 * (float)Material.Color.R * factor, inv255 * Material.Color.G * factor, inv255 * (float)Material.Color.B * factor, inv255 * (float)Material.Color.A * alphafactor); } if ((Material.Flags & MeshMaterial.EmissiveColorMask) != 0) { GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Emission, new float[] { inv255 *(float)Material.EmissiveColor.R, inv255 * (float)Material.EmissiveColor.G, inv255 * (float)Material.EmissiveColor.B, 1.0f }); } else { GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Emission, new float[] { 0.0f, 0.0f, 0.0f, 1.0f }); } for (int j = 0; j < Face.Vertices.Length; j++) { GL.TexCoord2(Vertices[Face.Vertices[j].Index].TextureCoordinates.X, Vertices[Face.Vertices[j].Index].TextureCoordinates.Y); if (Vertices[Face.Vertices[j].Index] is ColoredVertex) { ColoredVertex v = (ColoredVertex)Vertices[Face.Vertices[j].Index]; GL.Color3(v.Color.R, v.Color.G, v.Color.B); } GL.Vertex3((float)(Vertices[Face.Vertices[j].Index].Coordinates.X - Camera.X), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Y - Camera.Y), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Z - Camera.Z)); } GL.End(); RestoreAlphaFunc(); if (!BlendEnabled) { GL.Disable(EnableCap.Blend); } } // normals if (OptionNormals) { if (TexturingEnabled) { GL.Disable(EnableCap.Texture2D); TexturingEnabled = false; } for (int j = 0; j < Face.Vertices.Length; j++) { GL.Begin(PrimitiveType.Lines); GL.Color4(inv255 * (float)Material.Color.R, inv255 * (float)Material.Color.G, inv255 * (float)Material.Color.B, 1.0f); GL.Vertex3((float)(Vertices[Face.Vertices[j].Index].Coordinates.X - Camera.X), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Y - Camera.Y), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Z - Camera.Z)); GL.Vertex3((float)(Vertices[Face.Vertices[j].Index].Coordinates.X + Face.Vertices[j].Normal.X - Camera.X), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Y + Face.Vertices[j].Normal.Y - Camera.Y), (float)(Vertices[Face.Vertices[j].Index].Coordinates.Z + Face.Vertices[j].Normal.Z - Camera.Z)); GL.End(); } } // finalize if (Material.BlendMode == MeshMaterialBlendMode.Additive) { GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); if (!BlendEnabled) { GL.Disable(EnableCap.Blend); } if (FogEnabled) { GL.Enable(EnableCap.Fog); } } }