@@ -69,6 +69,13 @@ namespace nbl::ext::debug_draw
6969 }
7070 };
7171
72+ struct DrawParameters
73+ {
74+ video::IGPUCommandBuffer* commandBuffer = nullptr ;
75+ hlsl::float32_t4x4 cameraMat = hlsl::float32_t4x4(1 );
76+ float lineWidth = 1 .f;
77+ };
78+
7279 // creates an instance that can draw one AABB via push constant or multiple using streaming buffer
7380 static core::smart_refctd_ptr<DrawAABB> create (SCreationParameters&& params);
7481
@@ -84,11 +91,11 @@ namespace nbl::ext::debug_draw
8491 inline const SCachedCreationParameters& getCreationParameters () const { return m_cachedCreationParams; }
8592
8693 // records draw command for single AABB, user has to set pipeline outside
87- bool renderSingle (video::IGPUCommandBuffer* commandBuffer , const hlsl::shapes::AABB<3 , float >& aabb, const hlsl::float32_t4& color, const hlsl::float32_t4x4& cameraMat );
94+ bool renderSingle (const DrawParameters& params , const hlsl::shapes::AABB<3 , float >& aabb, const hlsl::float32_t4& color);
8895
8996 // records draw command for rendering batch of AABB instances as InstanceData
9097 // user has to set span of filled-in InstanceData; camera matrix used in push constant
91- inline bool render (video::IGPUCommandBuffer* commandBuffer , video::ISemaphore::SWaitInfo waitInfo, std::span<const InstanceData> aabbInstances, const hlsl::float32_t4x4& cameraMat )
98+ inline bool render (const DrawParameters& params , video::ISemaphore::SWaitInfo waitInfo, std::span<const InstanceData> aabbInstances)
9299 {
93100 if (!(m_cachedCreationParams.drawMode & ADM_DRAW_BATCH))
94101 {
@@ -108,8 +115,9 @@ namespace nbl::ext::debug_draw
108115 auto * const streamingPtr = reinterpret_cast <uint8_t *>(streaming->getBufferPointer ());
109116 assert (streamingPtr);
110117
118+ auto & commandBuffer = params.commandBuffer ;
111119 commandBuffer->bindGraphicsPipeline (m_batchPipeline.get ());
112- commandBuffer->setLineWidth (1 . f );
120+ commandBuffer->setLineWidth (params. lineWidth );
113121 asset::SBufferBinding<video::IGPUBuffer> indexBinding = { .offset = 0 , .buffer = m_indicesBuffer };
114122 commandBuffer->bindIndexBuffer (indexBinding, asset::EIT_32BIT);
115123
@@ -118,7 +126,7 @@ namespace nbl::ext::debug_draw
118126 {
119127 auto & inst = instances[i];
120128 inst = aabbInstances[i];
121- inst.transform = hlsl::mul (cameraMat, inst.transform );
129+ inst.transform = hlsl::mul (params. cameraMat , inst.transform );
122130 }
123131
124132 auto instancesIt = instances.begin ();
@@ -154,7 +162,7 @@ namespace nbl::ext::debug_draw
154162 return true ;
155163 }
156164
157- static hlsl::float32_t4x4 getTransformFromAABB (const hlsl::shapes::AABB<3 , float >& aabb);
165+ static hlsl::float32_t3x4 getTransformFromAABB (const hlsl::shapes::AABB<3 , float >& aabb);
158166
159167 protected:
160168 DrawAABB (SCreationParameters&& _params, core::smart_refctd_ptr<video::IGPUGraphicsPipeline> singlePipeline, core::smart_refctd_ptr<video::IGPUGraphicsPipeline> batchPipeline,
0 commit comments