3d v1.0.0 terrain (#5037)

* 上传地形系统

* 上传地形系统

* 新增地形导出

* 新增Terrain Shader

* vmath相关修改

* 修复TerrainSample启动崩溃问题

* 修改规范问题及生命周期问题

* 增加地形类型导出

* 修改Terrain部分序列化问题

* 暴露属性

* 解决画刷在Manage模式还会残留的问题

* 更新代码

* 解决画刷位置渲染错误,修改terrain材质的更新逻辑
This commit is contained in:
Myway
2019-08-01 15:16:03 +08:00
committed by Weiliang Wang
parent 600540cefb
commit 03ae98db98
3 changed files with 9 additions and 15 deletions
@@ -32,8 +32,8 @@ export class TerrainEditorPaint extends TerrainEditorMode {
const index = i.getIndex();
const bound = new Rect();
bound.x = index[0] * terrain.info.tileSize;
bound.y = index[1] * terrain.info.tileSize;
bound.x = index[0] * TERRAIN_BLOCK_TILE_COMPLEXITY * terrain.info.tileSize;
bound.y = index[1] * TERRAIN_BLOCK_TILE_COMPLEXITY * terrain.info.tileSize;
bound.width = TERRAIN_BLOCK_TILE_COMPLEXITY * terrain.info.tileSize;
bound.height = TERRAIN_BLOCK_TILE_COMPLEXITY * terrain.info.tileSize;
@@ -22,8 +22,8 @@ export class TerrainEditorSculpt extends TerrainEditorMode {
const index = block.getIndex();
const bound = new Rect();
bound.x = index[0] * terrain.info.tileSize;
bound.y = index[1] * terrain.info.tileSize;
bound.x = index[0] * TERRAIN_BLOCK_TILE_COMPLEXITY * terrain.info.tileSize;
bound.y = index[1] * TERRAIN_BLOCK_TILE_COMPLEXITY * terrain.info.tileSize;
bound.width = TERRAIN_BLOCK_TILE_COMPLEXITY * terrain.info.tileSize;
bound.height = TERRAIN_BLOCK_TILE_COMPLEXITY * terrain.info.tileSize;
+5 -11
View File
@@ -135,7 +135,11 @@ export class TerrainRenderable extends RenderableComponent {
defines: block._getMaterialDefines(nlayers),
});
this._updateBrushMaterial();
if (this._brushMaterial !== null) {
const passes = this._currentMaterial.passes;
passes.push(this._brushMaterial.passes[0]);
}
if (init) {
this._model.initSubModel(0, this._meshData, this._currentMaterial);
@@ -172,16 +176,6 @@ export class TerrainRenderable extends RenderableComponent {
private _getBuiltinMaterial () {
return builtinResMgr.get<Material>('missing-material');
}
private _updateBrushMaterial () {
if (this._currentMaterial == null || this._brushMaterial == null) {
return;
}
const passes = this._currentMaterial.passes;
passes.push(this._brushMaterial.passes[0]);
}
}
@ccclass('cc.TerrainBlockInfo')