Beispiel #1
0
        private void RecreateMesh()
        {
            rowsColumns = Mathf.Max(rowsColumns, 1);
            tileSize    = Mathf.Max(1f, scale / rowsColumns);

            mesh = WaterMesh.Create(WaterMesh.Shape.Rectangle, tileSize, Mathf.FloorToInt(tileSize / vertexDistance), tileSize);
        }
Beispiel #2
0
        public static Mesh Create(Shape shape, float size, int subdivisions, float uvTiling = 1f, float noise = 0f)
        {
            WaterMesh waterMesh = new WaterMesh();

            waterMesh.shape        = shape;
            waterMesh.size         = size;
            waterMesh.subdivisions = subdivisions;
            waterMesh.UVTiling     = uvTiling;
            waterMesh.noise        = noise;

            return(waterMesh.Rebuild());
        }
Beispiel #3
0
        public override void OnImportAsset(AssetImportContext context)
        {
            if (waterMesh == null)
            {
                waterMesh = new WaterMesh();
                mesh      = waterMesh.Rebuild();
            }
            else
            {
                mesh = waterMesh.Rebuild();
            }

            context.AddObjectToAsset("mesh", mesh);
            context.SetMainObject(mesh);
        }