mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
3d v1.0.0 terrain (#5037)
* 上传地形系统 * 上传地形系统 * 新增地形导出 * 新增Terrain Shader * vmath相关修改 * 修复TerrainSample启动崩溃问题 * 修改规范问题及生命周期问题 * 增加地形类型导出 * 修改Terrain部分序列化问题 * 暴露属性 * 解决画刷在Manage模式还会残留的问题 * 更新代码 * 解决画刷位置渲染错误,修改terrain材质的更新逻辑
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user