Beispiel #1
0
 public override void Initialize()
 {
     _jellyData = OwnerNode.GetComponent <JellyData>();
     _jellyData.OnDataModified += UpdateLines;
     SetupMeshData();
     base.Initialize();
 }
Beispiel #2
0
 public JellyMesh(JellyData data, Vector3[] positions, Vector3[] normals)
 {
     _data     = data;
     _UVWs     = positions.Select((x) => GetVertexUVW(x)).ToArray();
     _normals  = normals;
     _vertices = new float[_UVWs.Length * VertexLayout.Stride(VertexLayout.Type.PositionNormal)];
 }
Beispiel #3
0
        public override void Initialize()
        {
            _jellyData             = OwnerNode.GetComponent <JellyData>();
            _initialData           = new CubeArray <Vector3d>(_jellyData.DataPoints);
            _displacementVectors   = new CubeArray <Vector3d>(_initialData.xSize, _initialData.ySize, _initialData.zSize);
            _displacementFrequency = new CubeArray <double>(_initialData.xSize, _initialData.ySize, _initialData.zSize);
            var gen = new Random();

            for (int y = 0; y < _initialData.ySize; y++)
            {
                for (int z = 0; z < _initialData.zSize; z++)
                {
                    for (int x = 0; x < _initialData.xSize; x++)
                    {
                        _displacementVectors[x, y, z]   = new Vector3d(gen.NextDouble() * 2.0 - 1.0, gen.NextDouble() * 2.0 - 1.0, gen.NextDouble() * 2.0 - 1.0).Normalized();
                        _displacementFrequency[x, y, z] = gen.NextDouble() * _frequencyMult;
                    }
                }
            }
            base.Initialize();
        }