void DrawDebugStuff() { #if RETROPIXEL_DEBUG if (_target.paletteTexture != null && _target.colormap != null) { EditorGUILayout.LabelField("DEBUG PROPERTIES", EditorStyles.boldLabel); ++EditorGUI.indentLevel; debugPaletteChecker = EditorGUILayout.Slider("Palette Checker", debugPaletteChecker, 0, 1); int palettePixel = Mathf.RoundToInt(debugPaletteChecker * (_target.numberOfColors - 1)); EditorGUILayout.LabelField("Palette Pixel", "" + palettePixel); EditorGUILayout.ColorField("Palette Color", _target.paletteTexture.GetPixel(palettePixel, 0)); debugColormapChecker = EditorGUILayout.Vector3Field("ColormapChecker", debugColormapChecker); debugColormapChecker = new Vector3(Mathf.Clamp01(debugColormapChecker.x), Mathf.Clamp01(debugColormapChecker.y), Mathf.Clamp01(debugColormapChecker.z)); int colorsteps = ColormapUtils.GetPrecisionColorsteps(_target.colormapPrecision); Vector3 colormapPixel = new Vector3(Mathf.RoundToInt(debugColormapChecker.x * (colorsteps - 1)), Mathf.RoundToInt(debugColormapChecker.y * (colorsteps - 1)), Mathf.RoundToInt(debugColormapChecker.z * (colorsteps - 1))); int pixelInArray = Mathf.FloorToInt(colormapPixel.x + colormapPixel.y * colorsteps + colormapPixel.z * colorsteps * colorsteps); EditorGUILayout.LabelField("Colormap Pixel", "" + colormapPixel + " :: " + pixelInArray); int alpha = _target.colormap.GetPixels32()[pixelInArray].a; EditorGUILayout.LabelField("Palette Index (Alpha)", "" + alpha); EditorGUILayout.ColorField("Final Color", _target.paletteTexture.GetPixel(alpha, 1)); --EditorGUI.indentLevel; } #endif }
public void ApplyMap() { int colorsteps = ColormapUtils.GetPrecisionColorsteps(colormap.colormapPrecision); colormapTexture = new Texture3D(colorsteps, colorsteps, colorsteps, TextureFormat.Alpha8, false); colormapTexture.filterMode = FilterMode.Point; colormapTexture.wrapMode = TextureWrapMode.Clamp; colormapTexture.SetPixels32(colormap.texture3Dpixels); colormapTexture.Apply(); material.SetTexture("_ColorMap", colormapTexture); }
void SetupPixelBuffer() { colorsteps = ColormapUtils.GetPrecisionColorsteps(precision); totalPixels = colorsteps * colorsteps * colorsteps; pixelBuffer = new Color32[totalPixels]; }