protected override double SingleNoise(double x, double y, double z) { // Create a unit-length cube aligned along an integer boundary. This cube // surrounds the input point. int x0 = Align(x); int x1 = x0 + 1; int y0 = Align(y); int y1 = y0 + 1; int z0 = Align(z); int z1 = z0 + 1; // Map the difference between the coordinates of the input value and the // coordinates of the cube's outer-lower-left vertex onto an S-curve. double xs = (x - x0); double ys = (y - y0); double zs = (z - z0); // Now calculate the noise values at each vertex of the cube. To generate // the coherent-noise value at the input point, interpolate these eight // noise values using the S-curve value as the interpolant (trilinear // interpolation.) return(MathX.Lerp( Gradient(x, y, z, x0, y0, z0), Gradient(x, y, z, x1, y0, z0), Gradient(x, y, z, x0, y1, z0), Gradient(x, y, z, x1, y1, z0), Gradient(x, y, z, x0, y0, z1), Gradient(x, y, z, x1, y0, z1), Gradient(x, y, z, x0, y1, z1), Gradient(x, y, z, x1, y1, z1), xs, ys, zs)); }
private async Task <Rect> BuildComponentUI(Component targetInstance) { UIBuilder ui = new UIBuilder(VisualSlot, 800, 5000, 0.1f); ui.Style.MinHeight = 30f; ui.Style.ForceExpandHeight = false; ui.Image(new color(141 / 255.0f, 186 / 255.0f, 104 / 255.0f)); ui.VerticalLayout(4f, 0, Alignment.TopLeft); ui.Style.MinHeight = 30f; ui.Style.PreferredHeight = 30f; ui.Style.ForceExpandHeight = true; VerticalLayout content = ui.VerticalLayout(4f, 10f, Alignment.TopLeft); ui.Style.ChildAlignment = Alignment.TopLeft; { ui.HorizontalLayout(4f); ui.Style.FlexibleWidth = 1000f; ui.Button("<b>" + targetInstance.GetType().GetNiceName() + "</b>", color.White); ui.Style.FlexibleWidth = 0.0f; ui.Style.MinWidth = 32f; ui.Button("D", MathX.Lerp(color.Green, color.White, 0.7f)); ui.Button("X", MathX.Lerp(color.Red, color.White, 0.7f)); ui.NestOut(); } if (targetInstance is ICustomInspector customInspector) { ui.Style.MinHeight = 24f; customInspector.BuildInspectorUI(ui); } else { WorkerInspector.BuildInspectorUI(targetInstance, ui); } await new Updates(5); return(content.RectTransform.BoundingRect); }