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-08-17 17:43:49 +02:00
|
|
|
#include "core/io/image.h"
|
2022-06-07 03:41:22 +02:00
|
|
|
#include "core/math/vector2.h"
|
|
|
|
#include "core/math/vector3.h"
|
2022-08-17 13:45:14 +02:00
|
|
|
#include "core/object/reference.h"
|
2022-08-17 13:17:12 +02:00
|
|
|
#include "core/variant/variant.h"
|
2022-08-17 12:53:49 +02:00
|
|
|
#include "core/containers/vector.h"
|
2022-06-07 03:41:22 +02:00
|
|
|
|
2022-08-17 13:45:14 +02:00
|
|
|
#include "core/object/resource.h"
|
2022-06-07 03:41:22 +02:00
|
|
|
|
|
|
|
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
|