mirror of
https://github.com/Relintai/props.git
synced 2025-02-04 16:05:54 +01:00
Added a material_cache property to PropInstancePropJob.
This commit is contained in:
parent
f526e99239
commit
8805d63f4a
@ -30,10 +30,11 @@ SOFTWARE.
|
||||
#define GET_WORLD get_world
|
||||
#endif
|
||||
|
||||
#include "jobs/prop_mesher_job_step.h"
|
||||
#include "prop_instance.h"
|
||||
#include "prop_instance_merger.h"
|
||||
#include "prop_mesher.h"
|
||||
#include "jobs/prop_mesher_job_step.h"
|
||||
#include "material_cache/prop_material_cache.h"
|
||||
|
||||
#ifdef MESH_DATA_RESOURCE_PRESENT
|
||||
#include "../mesh_data_resource/mesh_data_resource.h"
|
||||
@ -63,6 +64,13 @@ void PropInstancePropJob::set_texture_packer(const Ref<TexturePacker> &packer) {
|
||||
}
|
||||
#endif
|
||||
|
||||
Ref<PropMaterialCache> PropInstancePropJob::get_material_cache() {
|
||||
return _material_cache;
|
||||
}
|
||||
void PropInstancePropJob::set_material_cache(const Ref<PropMaterialCache> &cache) {
|
||||
_material_cache = cache;
|
||||
}
|
||||
|
||||
Ref<PropMesherJobStep> PropInstancePropJob::get_jobs_step(int index) const {
|
||||
ERR_FAIL_INDEX_V(index, _job_steps.size(), Ref<PropMesherJobStep>());
|
||||
|
||||
@ -85,7 +93,6 @@ int PropInstancePropJob::get_jobs_step_count() const {
|
||||
return _job_steps.size();
|
||||
}
|
||||
|
||||
|
||||
PropInstanceMerger *PropInstancePropJob::get_prop_instace() {
|
||||
return _prop_instace;
|
||||
}
|
||||
@ -118,7 +125,6 @@ void PropInstancePropJob::clear_meshes() {
|
||||
#endif
|
||||
|
||||
void PropInstancePropJob::phase_physics_process() {
|
||||
|
||||
//TODO this should only update the differences
|
||||
for (int i = 0; i < _prop_instace->collider_get_num(); ++i) {
|
||||
PhysicsServer::get_singleton()->free(_prop_instace->collider_body_get(i));
|
||||
@ -326,7 +332,6 @@ void PropInstancePropJob::phase_prop() {
|
||||
}
|
||||
|
||||
if (should_do()) {
|
||||
|
||||
RID mesh_rid = _prop_instace->mesh_get(0);
|
||||
|
||||
VS::get_singleton()->mesh_add_surface_from_arrays(mesh_rid, VisualServer::PRIMITIVE_TRIANGLES, temp_mesh_arr);
|
||||
@ -880,6 +885,10 @@ void PropInstancePropJob::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "texture_packer", PROPERTY_HINT_RESOURCE_TYPE, "TexturePacker", 0), "set_texture_packer", "get_texture_packer");
|
||||
#endif
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_material_cache"), &PropInstancePropJob::get_material_cache);
|
||||
ClassDB::bind_method(D_METHOD("set_material_cache", "packer"), &PropInstancePropJob::set_material_cache);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material_cache", PROPERTY_HINT_RESOURCE_TYPE, "PropMaterialCache", 0), "set_material_cache", "get_material_cache");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_jobs_step", "index"), &PropInstancePropJob::get_jobs_step);
|
||||
ClassDB::bind_method(D_METHOD("set_jobs_step", "index", "mesher"), &PropInstancePropJob::set_jobs_step);
|
||||
ClassDB::bind_method(D_METHOD("remove_jobs_step", "index"), &PropInstancePropJob::remove_jobs_step);
|
||||
|
@ -33,6 +33,7 @@ class PropMesher;
|
||||
class PropInstance;
|
||||
class PropInstanceMerger;
|
||||
class PropMesherJobStep;
|
||||
class PropMaterialCache;
|
||||
|
||||
#if MESH_DATA_RESOURCE_PRESENT
|
||||
class PropDataMeshData;
|
||||
@ -47,6 +48,9 @@ public:
|
||||
void set_texture_packer(const Ref<TexturePacker> &packer);
|
||||
#endif
|
||||
|
||||
Ref<PropMaterialCache> get_material_cache();
|
||||
void set_material_cache(const Ref<PropMaterialCache> &cache);
|
||||
|
||||
Ref<PropMesherJobStep> get_jobs_step(const int index) const;
|
||||
void set_jobs_step(const int index, const Ref<PropMesherJobStep> &step);
|
||||
void remove_jobs_step(const int index);
|
||||
@ -102,6 +106,8 @@ protected:
|
||||
Ref<TexturePacker> _texture_packer;
|
||||
#endif
|
||||
|
||||
Ref<PropMaterialCache> _material_cache;
|
||||
|
||||
Vector<Ref<PropMesherJobStep>> _job_steps;
|
||||
int _current_job_step;
|
||||
int _current_mesh;
|
||||
|
Loading…
Reference in New Issue
Block a user