diff --git a/cocos/renderer/terrain/terrain-editor-paint.ts b/cocos/renderer/terrain/terrain-editor-paint.ts index e2e8858bea..ca8461adb3 100644 --- a/cocos/renderer/terrain/terrain-editor-paint.ts +++ b/cocos/renderer/terrain/terrain-editor-paint.ts @@ -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; diff --git a/cocos/renderer/terrain/terrain-editor-sculpt.ts b/cocos/renderer/terrain/terrain-editor-sculpt.ts index 647de3823c..cc0d5f0a6c 100644 --- a/cocos/renderer/terrain/terrain-editor-sculpt.ts +++ b/cocos/renderer/terrain/terrain-editor-sculpt.ts @@ -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; diff --git a/cocos/renderer/terrain/terrain.ts b/cocos/renderer/terrain/terrain.ts index b8e0952f46..30f984b442 100644 --- a/cocos/renderer/terrain/terrain.ts +++ b/cocos/renderer/terrain/terrain.ts @@ -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('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')