2022-06-07 03:41:22 +02:00
|
|
|
#ifndef MAT_MAKER_MATERIAL_H
|
|
|
|
#define MAT_MAKER_MATERIAL_H
|
2022-06-06 22:04:36 +02:00
|
|
|
|
2022-06-07 03:41:22 +02:00
|
|
|
#include "core/image.h"
|
|
|
|
#include "core/math/vector2.h"
|
|
|
|
#include "core/math/vector3.h"
|
|
|
|
#include "core/reference.h"
|
|
|
|
#include "core/variant.h"
|
|
|
|
#include "core/vector.h"
|
|
|
|
|
|
|
|
#include "core/resource.h"
|
|
|
|
|
|
|
|
class MMNode;
|
|
|
|
class ThreadPoolExecuteJob;
|
|
|
|
|
|
|
|
class MMMaterial : public Resource {
|
|
|
|
GDCLASS(MMMaterial, Resource);
|
2022-06-06 22:04:36 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Vector2 get_image_size();
|
|
|
|
void set_image_size(const Vector2 &val);
|
|
|
|
|
2022-06-07 09:43:42 +02:00
|
|
|
Vector<Variant> get_nodes();
|
|
|
|
void set_nodes(const Vector<Variant> &val);
|
2022-06-06 22:04:36 +02:00
|
|
|
|
|
|
|
bool get_initialized() const;
|
|
|
|
void set_initialized(const bool val);
|
|
|
|
|
|
|
|
bool get_rendering() const;
|
|
|
|
void set_rendering(const bool val);
|
|
|
|
|
|
|
|
bool get_queued_render() const;
|
|
|
|
void set_queued_render(const bool val);
|
|
|
|
|
|
|
|
void initialize();
|
2022-06-07 03:41:22 +02:00
|
|
|
|
|
|
|
void add_node(const Ref<MMNode> &node);
|
|
|
|
void remove_node(const Ref<MMNode> &node);
|
|
|
|
|
2022-06-06 22:04:36 +02:00
|
|
|
void render();
|
|
|
|
void render_non_threaded();
|
|
|
|
void render_threaded();
|
2022-06-07 03:41:22 +02:00
|
|
|
|
2022-06-06 22:04:36 +02:00
|
|
|
void _thread_func();
|
|
|
|
void cancel_render_and_wait();
|
|
|
|
void on_node_changed();
|
|
|
|
|
2022-06-07 03:41:22 +02:00
|
|
|
MMMaterial();
|
|
|
|
~MMMaterial();
|
|
|
|
|
|
|
|
Vector2 image_size;
|
|
|
|
Vector<Ref<MMNode>> nodes;
|
2022-06-06 22:04:36 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2022-06-07 03:41:22 +02:00
|
|
|
//TODO detect if threadpool is enabled.
|
|
|
|
bool USE_THREADS;
|
|
|
|
bool initialized;
|
|
|
|
bool rendering;
|
|
|
|
bool queued_render;
|
|
|
|
Ref<ThreadPoolExecuteJob> job;
|
2022-06-06 22:04:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|