pandemonium_engine/modules/material_maker/nodes/mm_material.h

66 lines
1.3 KiB
C++
Raw Normal View History

2022-06-07 03:41:22 +02:00
#ifndef MAT_MAKER_MATERIAL_H
#define MAT_MAKER_MATERIAL_H
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/containers/vector.h"
2022-06-07 03:41:22 +02:00
#include "core/resource.h"
class MMNode;
class ThreadPoolExecuteJob;
class MMMaterial : public Resource {
GDCLASS(MMMaterial, Resource);
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);
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);
void render();
void render_non_threaded();
void render_threaded();
2022-06-07 03:41:22 +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;
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;
};
#endif