mirror of
https://github.com/Relintai/terraman_2d.git
synced 2024-11-12 10:15:18 +01:00
Fix placing meshes. Y sorting still doesn't work with them though.
This commit is contained in:
parent
4549f7d0a6
commit
6f3eb79f32
@ -481,7 +481,7 @@ void Terrain2DMesherIsometric::mesh_walls(Ref<Terrain2DChunkDefault> chunk) {
|
||||
continue;
|
||||
}
|
||||
|
||||
_mesh_transform = Transform2D(0, Vector2(x * cell_size_x, y * cell_size_y));
|
||||
_mesh_transform = Transform2D(0, mesh_transform_terrain.xform(Vector2(x * cell_size_x, y * cell_size_y)));
|
||||
|
||||
if ((flags & Terrain2DChunkDefault::FLAG_CHANNEL_WALL_NORTH) != 0) {
|
||||
Vector2 vert_start_offset = mesh_transform_terrain.xform(Vector2(cell_size_x, cell_size_y));
|
||||
@ -579,15 +579,16 @@ void Terrain2DMesherIsometric::mesh_walls(Ref<Terrain2DChunkDefault> chunk) {
|
||||
|
||||
vc += 4;
|
||||
}
|
||||
|
||||
|
||||
if (_vertices.size() > 0) {
|
||||
if ((chunk->get_build_flags() & Terrain2DChunkDefault::BUILD_FLAG_USE_LIGHTING) != 0) {
|
||||
bake_colors(chunk);
|
||||
}
|
||||
|
||||
store_mesh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((chunk->get_build_flags() & Terrain2DChunkDefault::BUILD_FLAG_USE_LIGHTING) != 0) {
|
||||
bake_colors(chunk);
|
||||
}
|
||||
|
||||
store_mesh();
|
||||
}
|
||||
|
||||
Terrain2DMesherIsometric::Terrain2DMesherIsometric() {
|
||||
|
@ -694,12 +694,10 @@ void Terrain2DChunkDefault::_draw() {
|
||||
if (terrain_mesh_rid != RID()) {
|
||||
RID terrain_texture_rid = mesh_rid_get(MESH_INDEX_TERRAIN, MESH_TYPE_INDEX_TEXTURE_RID);
|
||||
|
||||
//VisualServer::get_singleton()->canvas_item_add_set_transform(get_canvas_item(), _mesh_transforms[i]);
|
||||
VisualServer::get_singleton()->canvas_item_add_set_transform(get_canvas_item(), _mesh_transforms[i]);
|
||||
|
||||
//Note: the transform parameter is not implemented in gles2
|
||||
VisualServer::get_singleton()->canvas_item_add_mesh(get_canvas_item(), terrain_mesh_rid, _mesh_transforms[i], Color(1, 1, 1, 1), terrain_texture_rid, RID());
|
||||
|
||||
//VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), Transform2D());
|
||||
VisualServer::get_singleton()->canvas_item_add_mesh(get_canvas_item(), terrain_mesh_rid, Transform2D(), Color(1, 1, 1, 1), terrain_texture_rid, RID());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user