public void SetValues( SizingConfig sizingConfig, NoiseConfig noiseConfig, FalloffConfig falloffConfig, ColorConfig colorConfig, BackgroundColorConfig backgroundColorConfig, OutlineConfig outlineConfig, SymmetryConfig symmetryConfig, SymmetryConfig3D symmetryConfig3D, ScalingConfig scalingConfig, AnimationConfig animationConfig, ShadingConfig shadingConfig, CleanupConfig cleanupConfig, NormalsConfig normalsConfig ) { this.sizingConfig = sizingConfig; this.noiseConfig = noiseConfig; this.falloffConfig = falloffConfig; this.colorConfig = colorConfig; this.backgroundColorConfig = backgroundColorConfig; this.outlineConfig = outlineConfig; this.symmetryConfig = symmetryConfig; this.symmetryConfig3D = symmetryConfig3D; this.scalingConfig = scalingConfig; this.animationConfig = animationConfig; this.shadingConfig = shadingConfig; this.cleanupConfig = cleanupConfig; this.normalsConfig = normalsConfig; }
Color OutlineColor(OutlineConfig outlineConfig, int frame, IReadOnlyList <Color> generatedColors) { if (outlineConfig.overrideOutlineColor) { return(outlineConfig.outlineColorOverride); } if (outlineConfig.randomPaletteColorForOutline && frame == 0) { return(generatedColors[Random.Range(0, generatedColors.Count - 1)]); } return(generatedColors[outlineConfig.paletteColorIndexForOutline]); }
public ColorOutcome Recolor( ref Texture2D tex, int frame, ColorConfig colorConfig, BackgroundColorConfig backgroundColorConfig, OutlineConfig outlineConfig, ColorOutcome colorOutcome) { if (colorOutcome == ColorOutcome.None || colorOutcome == null) { colorOutcome = new ColorOutcome(); if (frame == 0) { colorOutcome.generatedColors = cachedGeneratedColors = GenerateColors(colorConfig, backgroundColorConfig); } else { colorOutcome.generatedColors = cachedGeneratedColors; } colorOutcome.backgroundColor = SetBackgroundColor(); colorOutcome.outlineColor = OutlineColor(outlineConfig, frame, colorOutcome.generatedColors); } var colors = tex.GetPixels(); var increment = 1f / colorConfig.colorCountPerSprite; var newColors = new Color[colors.Length]; for (var index = 0; index < colors.Length; index++) { var gray = colors[index].grayscale; for (var i = 0; i < colorConfig.colorCountPerSprite; i++) { if (gray >= i * increment && gray <= (i + 1) * increment) { newColors[index] = colorOutcome.generatedColors[i]; } } } tex.SetPixels(newColors); return(colorOutcome); Color SetBackgroundColor() { if (!cam) { cam = Camera.main; } var backgroundColor = BackgroundColor(backgroundColorConfig, colorConfig, frame, colorOutcome.generatedColors); cam.backgroundColor = backgroundColor; return(backgroundColor); } }
public void Copy(ConfigurationAsset source) { sizingConfig = source.sizingConfig; noiseConfig = source.noiseConfig; falloffConfig = source.falloffConfig; colorConfig = source.colorConfig; backgroundColorConfig = source.backgroundColorConfig; outlineConfig = source.outlineConfig; symmetryConfig = source.symmetryConfig; symmetryConfig3D = source.symmetryConfig3D; scalingConfig = source.scalingConfig; animationConfig = source.animationConfig; shadingConfig = source.shadingConfig; cleanupConfig = source.cleanupConfig; normalsConfig = source.normalsConfig; }
public ColorOutcome Recolor( ref GeneratedVoxelModel generatedVoxel, ColorConfig configurationColorConfig, BackgroundColorConfig configurationBackgroundColorConfig, OutlineConfig configurationOutlineConfig) { // generate the colors to use for the model var colorOutcome = new ColorOutcome(); colorOutcome.generatedColors = GenerateColors(configurationColorConfig); // get the current (grayscale) colors of the model var colors = generatedVoxel.modelData.GetPixels(); // determine how many different colors we will have in the final model var increment = 1f / configurationColorConfig.colorCountPerSprite; // create a new list to hold the new colors for the voxels var newColors = new Color[colors.Length]; // loop through each grayscale color and re-assign it to the new color according to the grayscale range for (var index = 0; index < colors.Length; index++) { var color = colors[index]; var gray = color.grayscale; for (var i = 0; i < configurationColorConfig.colorCountPerSprite; i++) { if (gray >= i * increment && gray <= (i + 1) * increment) { newColors[index] = colorOutcome.generatedColors[i]; } } } // set the values generatedVoxel.modelData.SetPixels(newColors); generatedVoxel.modelData.Apply(); return(colorOutcome); }