// Copyright (C) 2017 Jérôme Leclercq // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_SERVER #ifndef NDK_COMPONENTS_DEBUGCOMPONENT_HPP #define NDK_COMPONENTS_DEBUGCOMPONENT_HPP #include #include #include namespace Ndk { enum class DebugDraw { Collider2D, Collider3D, GraphicsAABB, GraphicsOBB, Max = GraphicsOBB }; } namespace Nz { template<> struct EnumAsFlags { static constexpr Ndk::DebugDraw max = Ndk::DebugDraw::GraphicsOBB; }; } namespace Ndk { using DebugDrawFlags = Nz::Flags; constexpr DebugDrawFlags DebugDraw_None = 0; class DebugComponent; using DebugComponentHandle = Nz::ObjectHandle; class NDK_API DebugComponent : public Component { friend class DebugSystem; public: inline DebugComponent(DebugDrawFlags flags = DebugDraw_None); inline DebugComponent(const DebugComponent& debug); ~DebugComponent() = default; inline void Disable(DebugDrawFlags flags); inline void Enable(DebugDrawFlags flags); inline DebugDrawFlags GetFlags() const; inline bool IsEnabled(DebugDrawFlags flags) const; inline DebugComponent& operator=(const DebugComponent& debug); static ComponentIndex componentIndex; private: inline const Nz::InstancedRenderableRef& GetDebugRenderable(DebugDraw option) const; inline DebugDrawFlags GetEnabledFlags() const; inline void UpdateDebugRenderable(DebugDraw option, Nz::InstancedRenderableRef renderable); inline void UpdateEnabledFlags(DebugDrawFlags flags); static constexpr std::size_t DebugModeCount = static_cast(DebugDraw::Max) + 1; std::array m_debugRenderables; DebugDrawFlags m_enabledFlags; DebugDrawFlags m_flags; }; } #include #endif // NDK_COMPONENTS_DEBUGCOMPONENT_HPP #endif // NDK_SERVER