mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-20 06:34:23 +01:00
Added material cache support for Voxelman, and Terraman's bake texture mesher step type.
This commit is contained in:
parent
d328372f38
commit
57ffe2211b
@ -524,8 +524,16 @@ void TerrainPropJob::step_type_merge_verts() {
|
||||
void TerrainPropJob::step_type_bake_texture() {
|
||||
Ref<TerrainChunkDefault> chunk = _chunk;
|
||||
|
||||
Ref<ShaderMaterial> mat = chunk->get_library()->material_lod_get(0);
|
||||
Ref<SpatialMaterial> spmat = chunk->get_library()->material_lod_get(0);
|
||||
Ref<Material> lmat;
|
||||
|
||||
if (chunk->material_cache_key_has()) {
|
||||
lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh);
|
||||
} else {
|
||||
lmat = chunk->get_library()->material_lod_get(_current_mesh);
|
||||
}
|
||||
|
||||
Ref<ShaderMaterial> mat = lmat;
|
||||
Ref<SpatialMaterial> spmat = lmat;
|
||||
Ref<Texture> tex;
|
||||
|
||||
if (mat.is_valid()) {
|
||||
|
@ -598,8 +598,16 @@ void TerrainTerrainJob::step_type_merge_verts() {
|
||||
void TerrainTerrainJob::step_type_bake_texture() {
|
||||
Ref<TerrainChunkDefault> chunk = _chunk;
|
||||
|
||||
Ref<ShaderMaterial> mat = chunk->get_library()->material_lod_get(0);
|
||||
Ref<SpatialMaterial> spmat = chunk->get_library()->material_lod_get(0);
|
||||
Ref<Material> lmat;
|
||||
|
||||
if (chunk->material_cache_key_has()) {
|
||||
lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh);
|
||||
} else {
|
||||
lmat = chunk->get_library()->material_lod_get(_current_mesh);
|
||||
}
|
||||
|
||||
Ref<ShaderMaterial> mat = lmat;
|
||||
Ref<SpatialMaterial> spmat = lmat;
|
||||
Ref<Texture> tex;
|
||||
|
||||
if (mat.is_valid()) {
|
||||
|
@ -76,7 +76,7 @@ int VoxelPropJob::get_jobs_step_count() const {
|
||||
|
||||
void VoxelPropJob::phase_physics_process() {
|
||||
ERR_FAIL_COND(!_chunk.is_valid());
|
||||
|
||||
|
||||
Ref<VoxelChunkDefault> chunk = _chunk;
|
||||
|
||||
//TODO this should only update the differences
|
||||
@ -525,8 +525,16 @@ void VoxelPropJob::step_type_merge_verts() {
|
||||
void VoxelPropJob::step_type_bake_texture() {
|
||||
Ref<VoxelChunkDefault> chunk = _chunk;
|
||||
|
||||
Ref<ShaderMaterial> mat = chunk->get_library()->material_lod_get(0);
|
||||
Ref<SpatialMaterial> spmat = chunk->get_library()->material_lod_get(0);
|
||||
Ref<Material> lmat;
|
||||
|
||||
if (chunk->material_cache_key_has()) {
|
||||
lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh);
|
||||
} else {
|
||||
lmat = chunk->get_library()->material_lod_get(_current_mesh);
|
||||
}
|
||||
|
||||
Ref<ShaderMaterial> mat = lmat;
|
||||
Ref<SpatialMaterial> spmat = lmat;
|
||||
Ref<Texture> tex;
|
||||
|
||||
if (mat.is_valid()) {
|
||||
|
@ -283,7 +283,7 @@ void VoxelTerrainJob::phase_collider() {
|
||||
|
||||
void VoxelTerrainJob::phase_physics_process() {
|
||||
ERR_FAIL_COND(!_chunk.is_valid());
|
||||
|
||||
|
||||
Ref<VoxelChunkDefault> chunk = _chunk;
|
||||
|
||||
if (temp_arr_collider.size() != 0) {
|
||||
@ -806,8 +806,16 @@ void VoxelTerrainJob::step_type_merge_verts() {
|
||||
void VoxelTerrainJob::step_type_bake_texture() {
|
||||
Ref<VoxelChunkDefault> chunk = _chunk;
|
||||
|
||||
Ref<ShaderMaterial> mat = chunk->get_library()->material_lod_get(0);
|
||||
Ref<SpatialMaterial> spmat = chunk->get_library()->material_lod_get(0);
|
||||
Ref<Material> lmat;
|
||||
|
||||
if (chunk->material_cache_key_has()) {
|
||||
lmat = chunk->get_library()->material_cache_get(_chunk->material_cache_key_get())->material_lod_get(_current_mesh);
|
||||
} else {
|
||||
lmat = chunk->get_library()->material_lod_get(_current_mesh);
|
||||
}
|
||||
|
||||
Ref<ShaderMaterial> mat = lmat;
|
||||
Ref<SpatialMaterial> spmat = lmat;
|
||||
Ref<Texture> tex;
|
||||
|
||||
if (mat.is_valid()) {
|
||||
|
Loading…
Reference in New Issue
Block a user