@@ -16,6 +16,7 @@ class World
1616 @cellTerrain = new CellTerrain {cellSize : @cellSize }
1717 @ATA = new AnimatedTextureAtlas {al : @al }
1818 @material = @ATA .material
19+ @material2 = @ATA .material2
1920 @neighbours = [[- 1 , 0 , 0 ],[1 , 0 , 0 ],[0 , - 1 , 0 ],[0 , 1 , 0 ],[0 , 0 , - 1 ],[0 , 0 , 1 ]]
2021 @chunkWorker = new Worker " /module/World/ChunkWorker.js" , {type : ' module' }
2122 @chunkWorker .onmessage = (message )->
@@ -39,10 +40,11 @@ class World
3940 result = data .data .result
4041 for i in result
4142 if i isnt null
42- _this .setCell i .x ,i .y ,i .z ,i .data
43- setCell : (cellX ,cellY ,cellZ ,buffer )->
44- @ _setCell cellX,cellY,cellZ,buffer
45- @cellTerrain .cells [@cellTerrain .vec3 (cellX,cellY,cellZ)]= buffer
43+ _this .setCell i .x ,i .y ,i .z ,i .cell ,i .biome
44+ setCell : (cellX ,cellY ,cellZ ,buffer ,biome )->
45+ @ _setCell cellX,cellY,cellZ,buffer,biome
46+ @cellTerrain .setCell cellX,cellY,cellZ,buffer
47+ @cellTerrain .setBiome cellX,cellY,cellZ,biome
4648 @cellNeedsUpdate [@cellTerrain .vec3 (cellX,cellY,cellZ)]= true
4749 for nei in @neighbours
4850 neiCellId = @cellTerrain .vec3 (cellX+ nei[0 ],cellY+ nei[1 ],cellZ+ nei[2 ])
@@ -172,10 +174,10 @@ class World
172174 return {posPlace,posBreak}
173175 else
174176 return false
175- _setCell : (cellX ,cellY ,cellZ ,buffer )->
177+ _setCell : (cellX ,cellY ,cellZ ,buffer , biome )->
176178 @chunkWorker .postMessage {
177179 type : " setCell"
178- data : [cellX,cellY,cellZ,buffer]
180+ data : [cellX,cellY,cellZ,buffer,biome ]
179181 }
180182 _setVoxel : (voxelX ,voxelY ,voxelZ ,value )->
181183 @chunkWorker .postMessage {
@@ -190,11 +192,11 @@ class World
190192 type : " genCellGeo"
191193 data : [cellX,cellY,cellZ]
192194 }
193- _computeSections : (sections ,x ,z )->
195+ _computeSections : (sections ,x ,z , biomes )->
194196 @sectionsWorker .postMessage {
195197 type : " computeSections"
196198 data : {
197- sections,x,z
199+ sections,x,z,biomes
198200 }
199201 }
200202export {World}
0 commit comments