mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-11 18:40:06 +01:00
Clear meshes as needed in TerrainPropJob.
This commit is contained in:
parent
ac6be71368
commit
4a2d4af692
@ -457,18 +457,6 @@ void TerrainPropJob::phase_steps() {
|
||||
if (count > 0) {
|
||||
chunk->meshes_create(TerrainChunkDefault::MESH_INDEX_PROP, count);
|
||||
}
|
||||
|
||||
} else {
|
||||
//we have the meshes, just clear
|
||||
int count = chunk->mesh_rid_get_count(TerrainChunkDefault::MESH_INDEX_PROP, TerrainChunkDefault::MESH_TYPE_INDEX_MESH);
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
mesh_rid = chunk->mesh_rid_get_index(TerrainChunkDefault::MESH_INDEX_PROP, TerrainChunkDefault::MESH_TYPE_INDEX_MESH, i);
|
||||
|
||||
if (RS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) {
|
||||
RS::get_singleton()->mesh_remove_surface(mesh_rid, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -524,6 +512,10 @@ void TerrainPropJob::step_type_normal() {
|
||||
|
||||
RID mesh_rid = chunk->mesh_rid_get_index(TerrainChunkDefault::MESH_INDEX_PROP, TerrainChunkDefault::MESH_TYPE_INDEX_MESH, _current_mesh);
|
||||
|
||||
if (RS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) {
|
||||
RS::get_singleton()->mesh_clear(mesh_rid);
|
||||
}
|
||||
|
||||
RS::get_singleton()->mesh_add_surface_from_arrays(mesh_rid, RenderingServer::PRIMITIVE_TRIANGLES, temp_mesh_arr);
|
||||
|
||||
Ref<Material> lmat;
|
||||
@ -554,6 +546,10 @@ void TerrainPropJob::step_type_drop_uv2() {
|
||||
|
||||
temp_mesh_arr[RenderingServer::ARRAY_TEX_UV2] = Variant();
|
||||
|
||||
if (RS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) {
|
||||
RS::get_singleton()->mesh_clear(mesh_rid);
|
||||
}
|
||||
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(mesh_rid, RenderingServer::PRIMITIVE_TRIANGLES, temp_mesh_arr);
|
||||
|
||||
Ref<Material> lmat;
|
||||
@ -578,6 +574,10 @@ void TerrainPropJob::step_type_merge_verts() {
|
||||
Ref<TerrainChunkDefault> chunk = _chunk;
|
||||
RID mesh_rid = chunk->mesh_rid_get_index(TerrainChunkDefault::MESH_INDEX_PROP, TerrainChunkDefault::MESH_TYPE_INDEX_MESH, _current_mesh);
|
||||
|
||||
if (RS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) {
|
||||
RS::get_singleton()->mesh_clear(mesh_rid);
|
||||
}
|
||||
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(mesh_rid, RenderingServer::PRIMITIVE_TRIANGLES, temp_mesh_arr);
|
||||
|
||||
Ref<Material> lmat;
|
||||
@ -622,6 +622,10 @@ void TerrainPropJob::step_type_bake_texture() {
|
||||
|
||||
RID mesh_rid = chunk->mesh_rid_get_index(TerrainChunkDefault::MESH_INDEX_PROP, TerrainChunkDefault::MESH_TYPE_INDEX_MESH, _current_mesh);
|
||||
|
||||
if (RS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) {
|
||||
RS::get_singleton()->mesh_clear(mesh_rid);
|
||||
}
|
||||
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(mesh_rid, RenderingServer::PRIMITIVE_TRIANGLES, temp_mesh_arr);
|
||||
|
||||
if (lmat.is_valid()) {
|
||||
@ -649,6 +653,10 @@ void TerrainPropJob::step_type_simplify_mesh() {
|
||||
|
||||
RID mesh_rid = chunk->mesh_rid_get_index(TerrainChunkDefault::MESH_INDEX_PROP, TerrainChunkDefault::MESH_TYPE_INDEX_MESH, _current_mesh);
|
||||
|
||||
if (RS::get_singleton()->mesh_get_surface_count(mesh_rid) > 0) {
|
||||
RS::get_singleton()->mesh_clear(mesh_rid);
|
||||
}
|
||||
|
||||
RenderingServer::get_singleton()->mesh_add_surface_from_arrays(mesh_rid, RenderingServer::PRIMITIVE_TRIANGLES, temp_mesh_arr);
|
||||
|
||||
Ref<Material> lmat;
|
||||
|
Loading…
Reference in New Issue
Block a user