public void ApplyPropertiesFromSave(CompoundCloudPlane cloud) { Density = cloud.Density; // Re-init with potentially changed compounds Init(fluidSystem, cloud.Compounds[0], cloud.Compounds[1], cloud.Compounds[2], cloud.Compounds[3]); position = cloud.position; Transform = cloud.Transform; // Recreate the texture if the size changes // TODO: could resample the density data here to allow changing the cloud resolution or size // without starting a new save if (Size != cloud.Size || Resolution != cloud.Resolution) { Size = cloud.Size; Resolution = cloud.Resolution; CreateDensityTexture(); } OldDensity = new System.Numerics.Vector4[Size, Size]; SetMaterialUVForPosition(); }
public Slot(Compound compound, int size, int resolution, FluidSystem fluidSystem, CompoundCloudPlane parent, int index) { this.size = size; this.resolution = resolution; this.fluidSystem = fluidSystem; Compound = compound; parentPlane = parent; this.index = index; if (size <= 0) { return; } // For simplicity all the densities always exist, even on the unused clouds Density = new float[size, size]; // Except the old density can be easily ignored so this saves some memory if (Compound != null) { OldDensity = new float[size, size]; } }