protected override void OnUpdate() { var surface = surfaceOutputSlot.GetAsset <SphericalSurface>(); if (surface == null) { surface = surfaceOutputSlot.SetAsset(CreateInstance <SphericalSurface>(), false); } surface.Reset(Vector3.up, Vector3.right, 1f, false); }
private void CreateQuadGridManifold(bool generate = true) { var surface = surfaceOutputSlot.GetAsset <RectangularQuadGrid>(); if (surface == null || !generate && ReferenceEquals(surface, surfaceOutputSlot.persistedAsset)) { surface = surfaceOutputSlot.SetAsset(CreateInstance <RectangularQuadGrid>(), false); } ResetSurface(surface, origin, Quaternion.Euler(rotation), false, size); if (generate) { Vector3[] vertexPositionsArray; var topology = surface.CreateManifold(out vertexPositionsArray); topologyOutputSlot.SetAsset(topology); surface.topology = topologyOutputSlot.GetAsset <Topology>(); surfaceOutputSlot.Persist(); vertexPositionsOutputSlot.SetAsset(PositionalVertexAttribute.Create(surfaceOutputSlot.GetAsset <Surface>(), vertexPositionsArray)); } }
private void GenerateRandomPerGroup() { var faceGroupCollection = faceGroupCollectionInputSlot.GetAsset <FaceGroupCollection>(); var faceGroups = faceGroupCollection.faceGroups; var faceGroupColorsArray = new Color[faceGroups.Length]; var random = randomness.GetRandom(); for (int i = 0; i < faceGroups.Length; ++i) { #if MAKEIT_COLORFUL_2_0_OR_NEWER faceGroupColorsArray[i] = random.ColorRGB(); #else faceGroupColorsArray[i] = new Color(random.FloatCC(), random.FloatCC(), random.FloatCC()); #endif } faceGroupColorsOutputSlot.SetAsset(ColorFaceGroupAttribute.Create(faceGroupColorsArray).SetName((faceGroupCollection.name + " Colors").TrimStart())); faceColorsOutputSlot.SetAsset(ColorFaceGroupLookupFaceAttribute.Create( faceGroupIndicesInputSlot.GetAsset <IntFaceAttribute>(), faceGroupColorsOutputSlot.GetAsset <ColorFaceGroupAttribute>()).SetName("Face Colors")); }