mirror of
https://github.com/Relintai/voxelman.git
synced 2024-11-14 10:17:20 +01:00
Fix potential crash.
This commit is contained in:
parent
b7f3b59f54
commit
d36eff4ed3
@ -1124,8 +1124,16 @@ void VoxelChunkDefault::_build_phase(int phase) {
|
||||
|
||||
if (_lod_num >= 3) {
|
||||
Ref<ShaderMaterial> mat = get_library()->get_material(0);
|
||||
Ref<Texture> tex = mat->get_shader_param("texture_albedo");
|
||||
Ref<SpatialMaterial> spmat = get_library()->get_material(0);
|
||||
Ref<Texture> tex;
|
||||
|
||||
if (mat.is_valid()) {
|
||||
tex = mat->get_shader_param("texture_albedo");
|
||||
} else if (spmat.is_valid()) {
|
||||
tex = spmat->get_texture(SpatialMaterial::TEXTURE_ALBEDO);
|
||||
}
|
||||
|
||||
if (tex.is_valid()) {
|
||||
temp_mesh_arr = bake_mesh_array_uv(temp_mesh_arr, tex);
|
||||
temp_mesh_arr[VisualServer::ARRAY_TEX_UV] = Variant();
|
||||
|
||||
@ -1134,6 +1142,7 @@ void VoxelChunkDefault::_build_phase(int phase) {
|
||||
if (get_library()->get_material(3).is_valid())
|
||||
VisualServer::get_singleton()->mesh_surface_set_material(get_mesh_rid_index(MESH_INDEX_TERRARIN, MESH_TYPE_INDEX_MESH, 3), 0, get_library()->get_material(3)->get_rid());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (_lod_num > 4) {
|
||||
|
Loading…
Reference in New Issue
Block a user