1 /**
2     Abstractions for Godot RenderingDevice objects.
3 
4     Copyright © 2025, Inochi2D Project
5     Distributed under the 2-Clause BSD License, see LICENSE file.
6     
7     Authors: Luna Nielsen
8 */
9 module inochi2d.godot.render;
10 import godot.rendering_device;
11 import godot.variant;
12 import numem;
13 
14 public import inochi2d.godot.render.buffer;
15 public import inochi2d.godot.render.texture;
16 public import inochi2d.godot.render.shader;
17 
18 
19 /**
20     An object beloning to a rendering device.
21 */
22 class RDObject : NuObject {
23 private:
24 @nogc:
25     RenderingDevice device_;
26     RID rid_;
27 
28 protected:
29 
30     /**
31         Constructs a new RDObject.
32 
33         Params:
34             device =    The rendering device that owns this object.
35             rid =       The render id of this object.
36     */
37     this(RenderingDevice device, RID rid) {
38         this.device_ = device;
39         this.rid_ = rid;
40     }
41 
42 public:
43 
44     // Destructor.
45     ~this() {
46         device_.freeRid(rid_);
47     }
48 
49     /**
50         The device which owns this object.
51     */
52     final @property RenderingDevice device() => device_;
53 
54     /**
55         The RID of this object.
56     */
57     final @property RID rid() => rid_;
58 }