Example #1
0
        public void Initialise(Terrain terrain, TerrainRenderer renderer, int x, int z, int size, int textureSize, Material material)
        {
            this.renderer    = renderer;
            this.terrain     = terrain;
            this.chunkX      = x;
            this.chunkZ      = z;
            this.size        = size;
            this.textureSize = textureSize;

            GetComponent <MeshRenderer>().material = material;
        }
Example #2
0
        public void Initialize(int maxJobs, Terrain terrain, TerrainRenderer renderer, TerrainBakeMeshJobManager bakeMeshJobManager)
        {
            this.terrain            = terrain;
            this.renderer           = renderer;
            this.bakeMeshJobManager = bakeMeshJobManager;

            vertexBuffers = new NativeArray <Vector3> [maxJobs];
            indexBuffers  = new NativeArray <int> [maxJobs];
            uv0Buffers    = new NativeArray <Vector2> [maxJobs];
            colorBuffers  = new NativeArray <Color> [maxJobs];

            for (int i = 0; i < maxJobs; i++)
            {
                vertexBuffers[i] = new NativeArray <Vector3>(renderer.chunkSize * terrain.height * renderer.chunkSize * 4, Allocator.Persistent);
                indexBuffers[i]  = new NativeArray <int>(renderer.chunkSize * terrain.height * renderer.chunkSize * 6, Allocator.Persistent);
                uv0Buffers[i]    = new NativeArray <Vector2>(renderer.chunkSize * terrain.height * renderer.chunkSize * 4, Allocator.Persistent);
                colorBuffers[i]  = new NativeArray <Color>(renderer.chunkSize * terrain.height * renderer.chunkSize * 4, Allocator.Persistent);
            }

            base.Initialize(maxJobs);
        }
Example #3
0
File: Main.cs Project: gawlow/SG3D
 void Awake()
 {
     meshFilter      = GetComponent <MeshFilter>();
     terrain         = new SG3D.Terrain();
     terrainRenderer = new SG3D.TerrainRenderer();
 }