@@ -16,6 +16,7 @@ class DrawAABB final : public core::IReferenceCounted
16
16
{
17
17
public:
18
18
static constexpr inline uint32_t IndicesCount = 24u ;
19
+ static constexpr inline uint32_t VerticesCount = 8u ;
19
20
20
21
struct SCachedCreationParameters
21
22
{
@@ -35,53 +36,55 @@ class DrawAABB final : public core::IReferenceCounted
35
36
video::IQueue* transfer = nullptr ;
36
37
core::smart_refctd_ptr<asset::IAssetManager> assetManager = nullptr ;
37
38
38
- core::smart_refctd_ptr<video::IGPUPipelineLayout> pipelineLayout;
39
+ core::smart_refctd_ptr<video::IGPUPipelineLayout> singlePipelineLayout;
40
+ core::smart_refctd_ptr<video::IGPUPipelineLayout> batchPipelineLayout;
39
41
core::smart_refctd_ptr<video::IGPURenderpass> renderpass = nullptr ;
40
42
};
41
43
42
44
// creates an instance that can draw one AABB via push constant or multiple using streaming buffer
43
45
static core::smart_refctd_ptr<DrawAABB> create (SCreationParameters&& params);
44
46
45
- // creates default pipeline layout for push constant version
46
- static core::smart_refctd_ptr<video::IGPUPipelineLayout> createDefaultPipelineLayout (video::ILogicalDevice* device, const asset::SPushConstantRange& pcRange);
47
+ // creates pipeline layout from push constant range
48
+ static core::smart_refctd_ptr<video::IGPUPipelineLayout> createPipelineLayoutFromPCRange (video::ILogicalDevice* device, const asset::SPushConstantRange& pcRange);
47
49
48
50
// creates default pipeline layout for streaming version
49
51
static core::smart_refctd_ptr<video::IGPUPipelineLayout> createDefaultPipelineLayout (video::ILogicalDevice* device);
50
52
51
- static core::smart_refctd_ptr<video::IGPUGraphicsPipeline> createDefaultPipeline (video::ILogicalDevice* device, video::IGPUPipelineLayout* layout, video::IGPURenderpass* renderpass, video::IGPUGraphicsPipeline::SShaderSpecInfo& vertex, video::IGPUGraphicsPipeline::SShaderSpecInfo& fragment);
52
-
53
53
// ! mounts the extension's archive to given system - useful if you want to create your own shaders with common header included
54
54
static const core::smart_refctd_ptr<system::IFileArchive> mount (core::smart_refctd_ptr<system::ILogger> logger, system::ISystem* system, const std::string_view archiveAlias = " " );
55
55
56
56
inline const SCachedCreationParameters& getCreationParameters () const { return m_cachedCreationParams; }
57
57
58
58
// records draw command for single AABB, user has to set pipeline outside
59
- bool renderSingle (video::IGPUCommandBuffer* commandBuffer);
59
+ bool renderSingle (video::IGPUCommandBuffer* commandBuffer, const hlsl::shapes::AABB< 3 , float >& aabb, const hlsl::float32_t4& color, const hlsl::float32_t4x4& cameraMat );
60
60
61
61
bool render (video::IGPUCommandBuffer* commandBuffer, video::ISemaphore::SWaitInfo waitInfo, const hlsl::float32_t4x4& cameraMat);
62
62
63
- // static std::array< hlsl::float32_t3, 24> getVerticesFromAABB (const core::aabbox3d< float>& aabb);
63
+ static hlsl::float32_t4x4 getTransformFromAABB (const hlsl::shapes::AABB< 3 , float >& aabb);
64
64
65
65
void addAABB (const hlsl::shapes::AABB<3 ,float >& aabb, const hlsl::float32_t4& color = { 1 ,0 ,0 ,1 });
66
66
void addOBB (const hlsl::shapes::AABB<3 , float >& aabb, const hlsl::float32_t4x4& transform, const hlsl::float32_t4& color = { 1 ,0 ,0 ,1 });
67
67
void clearAABBs ();
68
68
69
69
protected:
70
- DrawAABB (SCreationParameters&& _params, core::smart_refctd_ptr<video::IGPUGraphicsPipeline> pipeline, core::smart_refctd_ptr<video::IGPUBuffer> indicesBuffer);
70
+ DrawAABB (SCreationParameters&& _params, core::smart_refctd_ptr<video::IGPUGraphicsPipeline> singlePipeline, core::smart_refctd_ptr<video::IGPUGraphicsPipeline> batchPipeline,
71
+ core::smart_refctd_ptr<video::IGPUBuffer> indicesBuffer, core::smart_refctd_ptr<video::IGPUBuffer> verticesBuffer);
71
72
~DrawAABB () override ;
72
73
73
74
private:
74
- static core::smart_refctd_ptr<video::IGPUGraphicsPipeline> createPipeline (SCreationParameters& params);
75
+ static core::smart_refctd_ptr<video::IGPUGraphicsPipeline> createPipeline (SCreationParameters& params, const video::IGPUPipelineLayout* pipelineLayout, const std::string& vsPath, const std::string& fsPath );
75
76
static bool createStreamingBuffer (SCreationParameters& params);
76
77
static core::smart_refctd_ptr<video::IGPUBuffer> createIndicesBuffer (SCreationParameters& params);
78
+ static core::smart_refctd_ptr<video::IGPUBuffer> createVerticesBuffer (SCreationParameters& params);
77
79
78
80
std::vector<debug_draw::InstanceData> m_instances;
79
- std::array<hlsl::float32_t3, 8 > m_unitAABBVertices;
80
81
core::smart_refctd_ptr<video::IGPUBuffer> m_indicesBuffer;
82
+ core::smart_refctd_ptr<video::IGPUBuffer> m_verticesBuffer;
81
83
82
84
SCachedCreationParameters m_cachedCreationParams;
83
85
84
- core::smart_refctd_ptr<video::IGPUGraphicsPipeline> m_pipeline;
86
+ core::smart_refctd_ptr<video::IGPUGraphicsPipeline> m_singlePipeline;
87
+ core::smart_refctd_ptr<video::IGPUGraphicsPipeline> m_batchPipeline;
85
88
};
86
89
}
87
90
0 commit comments