public override void Paint(int layer, float x, float y) { LayerTexture layerTexture = GameManager.ActiveGameManager.LayerManager.Layers[layer].LayerTexture; float xPixelsPerUnit = layerTexture.Size.x / layerTexture.GetComponent <Renderer>().bounds.extents.x; float yPixelPerUnit = layerTexture.Size.y / layerTexture.GetComponent <Renderer>().bounds.extents.y; //get the physical size of the layer panel //Why does x need tex.width/2 added to it, //but y doesnt: the center of the render texture is at 0,1 float xPixel = (layerTexture.Size.x / 2) + (x * xPixelsPerUnit * 0.5f); float yPixel = (y * yPixelPerUnit * 0.5f); //if (emission.GetValue < GameManager.ActiveGameManager.RenderManager.RenderTime) { int drawCount = GameManager.ActiveGameManager.OrbManager.DrawPerFrame; int i = 0; const float pixelCoef = 56; while (i++ < drawCount) { float r = Mathf.Pow(Mathf.Sin(SineCoefficient.GetValue * Theta.GetValue), SineExponent.GetValue) + Mathf.Pow(Mathf.Cos(CosineCoefficient.GetValue * Theta.GetValue), CosineExponent.GetValue) * pixelCoef; int xPos = (int)(xPixel + Mathf.Cos(Theta.GetValue) * Mathf.Clamp(r * XRadius.GetValue, XRadius.Min * pixelCoef, XRadius.Max * pixelCoef)); int yPos = (int)(yPixel + Mathf.Sin(Theta.GetValue) * Mathf.Clamp(r * YRadius.GetValue, YRadius.Min * pixelCoef, YRadius.Max * pixelCoef)); HSL_Color h = new HSL_Color(Mathf.Clamp(Theta.GetValue * Hue.Rate * (Hue.Max - Hue.Min), Hue.Min, Hue.Max), Mathf.Clamp(Theta.GetValue * Saturation.Rate, Saturation.Min, Saturation.Max), Brightness.GetValue); Color col = h.ToRGB(); col.a = Alpha.GetValue; Hue.Update(); Saturation.Update(); Brightness.Update(); Alpha.Update(); Theta.Update(); layerTexture.WriteToTexture(xPos, yPos, col); } } }