-Graphics::API::RenderCommand& BuildRenderCommand(
- Graphics::API::Controller& graphics,
- Graphics::API::Frame& frame,
- BufferIndex bufferIndex,
-
- Matrix viewProjection,
- const RenderList& renderItemList,
- Graphics::API::RenderCommand& command
-)
-{
- /*
- // per item/renderer
- //const auto& renderer = renderItemList.GetRenderer(0);
- const auto& item = renderItemList.GetItem(0);
-
- // scenegraph renderer should have complete data
- const auto sgRenderer = item.mNode->GetRendererAt(0);
-
-
- const auto& renderer = *item.mRenderer;
- const auto& dataProviderConst = renderer.GetRenderDataProvider();
- auto& dataProvider = const_cast<RenderDataProvider&>( dataProviderConst );
- const auto& uniformMap = dataProvider.GetUniformMap().GetUniformMap( bufferIndex );
-
- // get resources
- const auto& shader = sgRenderer->GetShader();
- const auto& textures = sgRenderer->GetTextures();
- // todo: samplers
- //const auto& samplers = sgRenderer->Get;
-
-
- // prepare vertex buffers
- const auto& vertexBuffers = sgRenderer->GetGeometry()->GetVertexBuffers();
- std::vector<Graphics::API::RenderCommand::VertexAttributeBufferBinding> vertexAttributeBindings;
- auto attribLocation = 0u;
- auto bindingIndex = 0u;
-
- for( auto&& vertexBuffer : vertexBuffers )
- {
- auto attributeCountInForBuffer = vertexBuffer->GetAttributeCount();
-
- for( auto i = 0u; i < attributeCountInForBuffer; ++i )
- {
- // create binding per attribute
- auto binding = Graphics::API::RenderCommand::VertexAttributeBufferBinding{}
- .SetOffset( (vertexBuffer->GetFormat()->components[i]).offset )
- .SetBinding( bindingIndex )
- .SetBuffer( vertexBuffer->GetGfxObject() )
- .SetInputAttributeRate( Graphics::API::RenderCommand::InputAttributeRate::PER_VERTEX )
- .SetLocation( attribLocation + i )
- .SetStride( vertexBuffer->GetFormat()->size );
-
- vertexAttributeBindings.emplace_back( std::move(binding) );
- }
- }
-
- // prepare uniforms
- auto gfxShader = shader.GetGfxObject();
-
- // find mapped uniforms
-*/
- return command;
-}