mirror of
https://github.com/Relintai/terraman.git
synced 2025-04-25 21:45:00 +02:00
Added a new TerraMaterialCachePCM class to be used with the material cache pcm. Skeleton for now.
This commit is contained in:
parent
4647db8f1e
commit
460f38090b
1
SCsub
1
SCsub
@ -74,6 +74,7 @@ if has_texture_packer:
|
||||
sources.append("library/terraman_library_merger.cpp")
|
||||
sources.append("library/terraman_library_merger_pcm.cpp")
|
||||
sources.append("library/terra_surface_merger.cpp")
|
||||
sources.append("library/terra_material_cache_pcm.cpp")
|
||||
|
||||
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
|
||||
# Shared lib compilation
|
||||
|
@ -27,6 +27,7 @@ def get_doc_classes():
|
||||
"TerramanLibraryMergerPCM",
|
||||
|
||||
"TerraMaterialCache",
|
||||
"TerraMaterialCachePCM",
|
||||
|
||||
"TerraCubePoints",
|
||||
"TerraMesherCubic",
|
||||
|
63
library/terra_material_cache_pcm.cpp
Normal file
63
library/terra_material_cache_pcm.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "terra_material_cache_pcm.h"
|
||||
|
||||
#include "terra_surface.h"
|
||||
|
||||
//Surfaces
|
||||
Ref<TerraSurface> TerraMaterialCachePCM::voxel_surface_get(const int index) {
|
||||
return Ref<TerraSurface>();
|
||||
}
|
||||
void TerraMaterialCachePCM::voxel_surface_add(Ref<TerraSurface> value) {
|
||||
}
|
||||
void TerraMaterialCachePCM::voxel_surface_set(int index, Ref<TerraSurface> value) {
|
||||
}
|
||||
void TerraMaterialCachePCM::voxel_surface_remove(const int index) {
|
||||
}
|
||||
int TerraMaterialCachePCM::voxel_surface_get_num() const {
|
||||
return 0;
|
||||
}
|
||||
void TerraMaterialCachePCM::voxel_surfaces_clear() {
|
||||
}
|
||||
|
||||
void TerraMaterialCachePCM::refresh_rects() {
|
||||
}
|
||||
|
||||
TerraMaterialCachePCM::TerraMaterialCachePCM() {
|
||||
}
|
||||
|
||||
TerraMaterialCachePCM::~TerraMaterialCachePCM() {
|
||||
}
|
||||
|
||||
void TerraMaterialCachePCM::_bind_methods() {
|
||||
BIND_VMETHOD(MethodInfo("_setup_material_albedo", PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("voxel_surface_get", "index"), &TerraMaterialCachePCM::voxel_surface_get);
|
||||
ClassDB::bind_method(D_METHOD("voxel_surface_add", "value"), &TerraMaterialCachePCM::voxel_surface_add);
|
||||
ClassDB::bind_method(D_METHOD("voxel_surface_set", "index", "surface"), &TerraMaterialCachePCM::voxel_surface_set);
|
||||
ClassDB::bind_method(D_METHOD("voxel_surface_remove", "index"), &TerraMaterialCachePCM::voxel_surface_remove);
|
||||
ClassDB::bind_method(D_METHOD("voxel_surface_get_num"), &TerraMaterialCachePCM::voxel_surface_get_num);
|
||||
ClassDB::bind_method(D_METHOD("voxel_surfaces_clear"), &TerraMaterialCachePCM::voxel_surfaces_clear);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("refresh_rects"), &TerraMaterialCachePCM::refresh_rects);
|
||||
}
|
69
library/terra_material_cache_pcm.h
Normal file
69
library/terra_material_cache_pcm.h
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright (c) 2019-2021 Péter Magyar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef TERRA_MATERIAL_CACHE_PCM_H
|
||||
#define TERRA_MATERIAL_CACHE_PCM_H
|
||||
|
||||
#include "terra_material_cache.h"
|
||||
|
||||
#include "core/version.h"
|
||||
|
||||
#if VERSION_MAJOR > 3
|
||||
#include "core/io/resource.h"
|
||||
#include "core/math/color.h"
|
||||
#include "core/templates/vector.h"
|
||||
#else
|
||||
#include "core/color.h"
|
||||
#include "core/resource.h"
|
||||
#include "core/vector.h"
|
||||
#endif
|
||||
|
||||
#include "core/math/rect2.h"
|
||||
#include "scene/resources/material.h"
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
class TerraSurface;
|
||||
|
||||
class TerraMaterialCachePCM : public TerraMaterialCache {
|
||||
GDCLASS(TerraMaterialCachePCM, TerraMaterialCache);
|
||||
|
||||
public:
|
||||
Ref<TerraSurface> voxel_surface_get(const int index);
|
||||
void voxel_surface_add(Ref<TerraSurface> value);
|
||||
void voxel_surface_set(const int index, Ref<TerraSurface> value);
|
||||
void voxel_surface_remove(const int index);
|
||||
int voxel_surface_get_num() const;
|
||||
void voxel_surfaces_clear();
|
||||
|
||||
void refresh_rects();
|
||||
|
||||
TerraMaterialCachePCM();
|
||||
~TerraMaterialCachePCM();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
//Ref<TextureMerger> merger;
|
||||
};
|
||||
|
||||
#endif
|
@ -38,7 +38,7 @@ SOFTWARE.
|
||||
|
||||
//pcm = per chunk material
|
||||
class TerramanLibraryMergerPCM : public TerramanLibraryMerger { //inherit it from the normal library?
|
||||
GDCLASS(TerramanLibraryMergerPCM, TerramanLibraryMerger)
|
||||
GDCLASS(TerramanLibraryMergerPCM, TerramanLibraryMerger);
|
||||
|
||||
public:
|
||||
bool _supports_caching();
|
||||
|
@ -22,26 +22,26 @@ SOFTWARE.
|
||||
|
||||
#include "register_types.h"
|
||||
|
||||
|
||||
#include "library/terra_surface.h"
|
||||
#include "library/terra_surface_simple.h"
|
||||
|
||||
#include "library/terra_material_cache.h"
|
||||
#include "library/terraman_library.h"
|
||||
#include "library/terraman_library_simple.h"
|
||||
#include "library/terra_material_cache.h"
|
||||
|
||||
#ifdef TEXTURE_PACKER_PRESENT
|
||||
#include "library/terra_surface_merger.h"
|
||||
#include "library/terraman_library_merger.h"
|
||||
#include "library/terraman_library_merger_pcm.h"
|
||||
#include "library/terra_material_cache_pcm.h"
|
||||
#endif
|
||||
|
||||
#include "data/terra_light.h"
|
||||
#include "meshers/terra_mesher.h"
|
||||
|
||||
#include "world/block_terra_structure.h"
|
||||
#include "world/terra_environment_data.h"
|
||||
#include "world/terra_chunk.h"
|
||||
#include "world/terra_environment_data.h"
|
||||
#include "world/terra_structure.h"
|
||||
#include "world/terra_world.h"
|
||||
|
||||
@ -65,9 +65,9 @@ SOFTWARE.
|
||||
|
||||
#include "world/jobs/terra_job.h"
|
||||
#include "world/jobs/terra_light_job.h"
|
||||
#include "world/jobs/terra_mesher_job_step.h"
|
||||
#include "world/jobs/terra_prop_job.h"
|
||||
#include "world/jobs/terra_terrarin_job.h"
|
||||
#include "world/jobs/terra_mesher_job_step.h"
|
||||
|
||||
void register_terraman_types() {
|
||||
ClassDB::register_class<TerraMesher>();
|
||||
@ -85,6 +85,7 @@ void register_terraman_types() {
|
||||
ClassDB::register_class<TerraSurfaceMerger>();
|
||||
ClassDB::register_class<TerramanLibraryMerger>();
|
||||
ClassDB::register_class<TerramanLibraryMergerPCM>();
|
||||
ClassDB::register_class<TerraMaterialCachePCM>();
|
||||
#endif
|
||||
|
||||
ClassDB::register_class<TerraLight>();
|
||||
|
Loading…
Reference in New Issue
Block a user