//private void AddUserData(ref SurfaceOutput so, SurfaceType st, SurfaceType.SubType subtype) //{ // so.userData = subtype. //} private SurfaceBlends.NormalizedBlend Settingsify(SurfaceBlends.NormalizedBlend blendResult) { Color defaultTint = Color.white; STSettings settings; if (TryGetStringSurfaceType(blendResult.lowerReference, out int stID, out SurfaceType st, out SurfaceType.SubType stst, true)) { blendResult.surfaceTypeID = stID; settings = stst.settings; defaultTint = st.defaultColorTint; }
internal void AddBlend(SurfaceBlends.NormalizedBlend blendResult, bool terrain, float weightMultiplier, ref float totalWeight) { if (!terrain) { blendResult = Settingsify(blendResult); } float weight = blendResult.normalizedWeight * weightMultiplier; bool success = false; for (int outputID = 0; outputID < outputs.Count; outputID++) { var output = outputs[outputID]; if (output.surfaceTypeID == blendResult.surfaceTypeID && output.particleOverrides == blendResult.particleOverrides) { output.weight += weight; output.volumeMultiplier += weight * blendResult.volume; output.pitchMultiplier += weight * blendResult.pitch; output.color += weight * blendResult.color; output.selfParticleMultipliers += blendResult.selfParticleMultipliers * weight; output.otherParticleMultipliers += blendResult.otherParticleMultipliers * weight; outputs[outputID] = output; success = true; break; } } if (!success) { outputs.Add ( new SurfaceOutput() { surfaceTypeID = blendResult.surfaceTypeID, weight = weight, volumeMultiplier = weight * blendResult.volume, pitchMultiplier = weight * blendResult.pitch, color = weight * blendResult.color, selfParticleMultipliers = blendResult.selfParticleMultipliers * weight, otherParticleMultipliers = blendResult.otherParticleMultipliers * weight, particleOverrides = blendResult.particleOverrides, } ); } totalWeight += weight; var st = surfaceTypes[blendResult.surfaceTypeID]; outputs.hardness += weight * blendResult.hardness * st.hardnessMultiplier; }
private void Awake() { FillDictionary(materialBlendOverrides, materialBlendLookup); FillDictionary(terrainBlends, terrainAlbedoBlendLookup); //Default Blend defaultBlend = new SurfaceBlends.NormalizedBlend() { surfaceTypeID = defaultSurfaceType, normalizedWeight = 1, hardness = 1, volume = 1, pitch = 1, color = surfaceTypes[defaultSurfaceType].defaultColorTint * defaultSurfaceTypeSettings.defaultColor, selfParticleMultipliers = ParticleMultipliers.Default(), otherParticleMultipliers = ParticleMultipliers.Default(), }; defaultBlend = Settingsify(defaultBlend); }