public void ApplyMap() { int colorsteps = ColormapUtils.GetColormapSize3D(colormap.preview); colormapTexture = new Texture3D(colorsteps, colorsteps, colorsteps, TextureFormat.RGB24, false) { filterMode = FilterMode.Point, wrapMode = TextureWrapMode.Clamp }; colormapTexture.SetPixels32(colormap.pixels); colormapTexture.Apply(); material.SetTexture("_Colormap", colormapTexture); }
public ColormapCalculator(bool preview, Color32[] palette, bool[] usedColors, int numColors, System.Action doneCallback) { this.palette = palette; this.usedColors = usedColors; this.doneCallback = doneCallback; this.numColors = numColors; progress = 0; colorsteps = ColormapUtils.GetColormapSize3D(preview); calculatorProgress = new ColormapCalculatorProgress(colorsteps); totalPixels = colorsteps * colorsteps * colorsteps; pixelBuffer = new Color32[totalPixels]; paletteRGBCoordinates = new Vector3[palette.Length]; for (int i = 0; i < palette.Length; ++i) { if (usedColors[i]) { Color32 paletteColor = palette[i]; paletteRGBCoordinates[i] = ColormapUtils.ColorToVector(paletteColor); } } }