Example #1
0
        public void Initialise(Terrain terrain)
        {
            this.terrain       = terrain;
            meshJobManager     = new TerrainMeshRendererJobManager();
            bakeMeshJobManager = new TerrainBakeMeshJobManager();

            PrepareTerrainMaterial();
        }
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);
        }