Files
armorpaint/armorlab/Sources/nodes/BrushOutputNode.ts
T

71 lines
1.8 KiB
TypeScript
Raw Normal View History

2023-02-08 14:51:54 +01:00
class BrushOutputNode extends LogicNode {
2024-01-17 18:53:31 +01:00
id = 0;
2024-02-05 20:57:20 +01:00
texpaint: image_t = null;
texpaint_nor: image_t = null;
texpaint_pack: image_t = null;
texpaint_nor_empty: image_t = null;
texpaint_pack_empty: image_t = null;
2023-02-08 14:51:54 +01:00
2024-01-17 18:53:31 +01:00
static inst: BrushOutputNode = null;
2023-02-08 14:51:54 +01:00
2024-01-17 18:53:31 +01:00
constructor() {
2023-12-12 14:57:44 +01:00
super();
2023-02-08 14:51:54 +01:00
2024-01-26 22:09:49 +01:00
if (BrushOutputNode.inst == null) {
2023-02-08 14:51:54 +01:00
{
2024-02-05 20:57:20 +01:00
let t = render_target_create();
2023-02-08 14:51:54 +01:00
t.name = "texpaint";
t.width = Config.getTextureResX();
t.height = Config.getTextureResY();
t.format = "RGBA32";
2024-02-05 20:57:20 +01:00
this.texpaint = render_path_create_render_target(t).image;
2023-02-08 14:51:54 +01:00
}
{
2024-02-05 20:57:20 +01:00
let t = render_target_create();
2023-02-08 14:51:54 +01:00
t.name = "texpaint_nor";
t.width = Config.getTextureResX();
t.height = Config.getTextureResY();
t.format = "RGBA32";
2024-02-05 20:57:20 +01:00
this.texpaint_nor = render_path_create_render_target(t).image;
2023-02-08 14:51:54 +01:00
}
{
2024-02-05 20:57:20 +01:00
let t = render_target_create();
2023-02-08 14:51:54 +01:00
t.name = "texpaint_pack";
t.width = Config.getTextureResX();
t.height = Config.getTextureResY();
t.format = "RGBA32";
2024-02-05 20:57:20 +01:00
this.texpaint_pack = render_path_create_render_target(t).image;
2023-02-08 14:51:54 +01:00
}
{
2024-02-05 20:57:20 +01:00
let t = render_target_create();
2023-02-08 14:51:54 +01:00
t.name = "texpaint_nor_empty";
t.width = 1;
t.height = 1;
t.format = "RGBA32";
2024-02-05 20:57:20 +01:00
this.texpaint_nor_empty = render_path_create_render_target(t).image;
2023-02-08 14:51:54 +01:00
}
{
2024-02-05 20:57:20 +01:00
let t = render_target_create();
2023-02-08 14:51:54 +01:00
t.name = "texpaint_pack_empty";
t.width = 1;
t.height = 1;
t.format = "RGBA32";
2024-02-05 20:57:20 +01:00
this.texpaint_pack_empty = render_path_create_render_target(t).image;
2023-02-08 14:51:54 +01:00
}
}
else {
2024-01-26 22:09:49 +01:00
this.texpaint = BrushOutputNode.inst.texpaint;
this.texpaint_nor = BrushOutputNode.inst.texpaint_nor;
this.texpaint_pack = BrushOutputNode.inst.texpaint_pack;
2023-02-08 14:51:54 +01:00
}
2024-01-26 22:09:49 +01:00
BrushOutputNode.inst = this;
2023-02-08 14:51:54 +01:00
}
2024-02-05 20:57:20 +01:00
override getAsImage = (from: i32, done: (img: image_t)=>void) => {
2024-01-26 22:09:49 +01:00
this.inputs[from].getAsImage(done);
2023-02-08 14:51:54 +01:00
}
}