diff --git a/src/dlangui/graphics/scene/drawableobject.d b/src/dlangui/graphics/scene/drawableobject.d new file mode 100644 index 00000000..92a37d8f --- /dev/null +++ b/src/dlangui/graphics/scene/drawableobject.d @@ -0,0 +1,15 @@ +module dlangui.graphics.scene.drawableobject; + +public import dlangui.core.types; +public import dlangui.graphics.scene.node; + +/// Reference counted DrawableObject +alias DrawableObjectRef = Ref!DrawableObject; + +class DrawableObject : RefCountedObject { + this() { + } + void draw(Node3d node, bool wireframe) { + /// override it + } +} diff --git a/src/dlangui/graphics/scene/model.d b/src/dlangui/graphics/scene/model.d new file mode 100644 index 00000000..ce87f827 --- /dev/null +++ b/src/dlangui/graphics/scene/model.d @@ -0,0 +1,28 @@ +module dlangui.graphics.scene.model; + +import dlangui.graphics.scene.drawableobject; +import dlangui.graphics.scene.mesh; +import dlangui.graphics.scene.material; + +class Model : DrawableObject { + protected MaterialRef _material; + protected MeshRef _mesh; + + this() { + } + + this(Material material, Mesh mesh) { + _material = material; + _mesh = mesh; + } + + @property ref MaterialRef material() { return _material; } + @property ref MeshRef mesh() { return _mesh; } + + override void draw(Node3d node, bool wireframe) { + /// override it + _material.bind(node); + _material.drawMesh(_mesh); + _material.unbind(); + } +}