introduce intersectable interface
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Base/ICloseable.hpp"
|
||||
#include "Scene/IRayIntersectable.hpp"
|
||||
#include "DrawEncoder.hpp"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -26,13 +27,14 @@ namespace OpenVulkano::Scene
|
||||
BACKGROUND = 0, MAIN, TRANSPARENT, POST
|
||||
};
|
||||
|
||||
class Drawable : public ICloseable
|
||||
class Drawable : public ICloseable, public IRayIntersectable
|
||||
{
|
||||
std::vector<Node*> m_nodes;
|
||||
Scene* m_scene = nullptr;
|
||||
Shader* m_shader = nullptr;
|
||||
const DrawEncoder m_encoder;
|
||||
const DrawPhase m_drawPhase;
|
||||
bool m_isHittable = false;
|
||||
|
||||
public:
|
||||
explicit Drawable(const DrawEncoder& encoder,
|
||||
@@ -45,6 +47,12 @@ namespace OpenVulkano::Scene
|
||||
|
||||
void SetShader(Shader* shader) { m_shader = shader; }
|
||||
|
||||
std::optional<RayHit> Intersect(const Ray& ray) const override { return {}; }
|
||||
|
||||
void SetIsHittable(bool hittable) { m_isHittable = hittable; }
|
||||
|
||||
bool IsHittable() const { return m_isHittable; }
|
||||
|
||||
[[nodiscard]] Scene* GetScene() const { return m_scene; }
|
||||
|
||||
[[nodiscard]] const auto& GetNodes() const { return m_nodes; }
|
||||
|
||||
Reference in New Issue
Block a user