public void DoFieldUpdate() { var proj = SpanAPI.Example_SetupProjection(mColorBuffer.Size.X, mColorBuffer.Size.Y, mColorBuffer.Size.Z); var curColor = Color.white; for (int i = 0; i < this.mColorBuffer.Length; i++) { var ndx = this.mColorBuffer.UnprojectIndex(i); bool actMe; var rgb = ndx.Select2(this.mColorBuffer.Size, (di, sz) => ((float)di) / ((float)(sz - 1))); curColor = new Color(rgb.X, rgb.Y, rgb.Z); if (this.mColorBuffer.IsEdge(ndx)) { actMe = false; } else { if (this.ChakraPetals > 0) { Debug.Log("Doing chakra test 1..."); var qpos = SpanAPI.spanProjCubicInt(proj, ndx); var pct = this.ChakraFieldFromSignedUnit(qpos); //var pct = SpanAPI.Example_EvaluateFieldChakraV1(proj, ndx, this.ChakraPetals, this.ChakraOneWay); actMe = true; // = SpanAPI.Example_SpanToColor(pct); curColor = ColorFromChakraField(pct); } else if (IsSphereMode) { actMe = SpanAPI.Example_EvaluateField1(proj, ndx); } else { var dv = SpanAPI.Example_EvaluateField3(proj, ndx); actMe = true; curColor = SpanAPI.Example_SpanToColor(dv); //bool isZero = SpanAPI.spanContains(dv, 0.0); //var avg = (float)((dv.From + dv.To)*0.5f); //curColor.a = avg; //actMe = SpanAPI.spanContains(dv,0.5);// SpanAPI.Example_EvaluateField2(proj, ndx); } } var clr = ((actMe) ? curColor : Color.clear); this.mColorBuffer.Array[i] = clr; } this.UpdateTextureFromBuffer(); this.TrySaveToCache(); }