git.s-ol.nu ~forks/DiligentFX / 20da53e
GLTF PBR renderer: enabled using vertex/index buffers from cache assiduous 10 months ago
1 changed file(s) with 14 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
860860 {
861861 auto TexIndex = material.Textures[TexId].Index;
862862 return (TexIndex >= 0) ?
863 GLTFModel.Textures[TexIndex].UVScaleBias :
863 GLTFModel.GetUVScaleBias(TexIndex) :
864864 float4{1, 1, 0, 0};
865865 };
866866
955955
956956 if (RenderNodeCallback == nullptr)
957957 {
958 IBuffer* pVBs[] = {GLTFModel.pVertexBuffer[0], GLTFModel.pVertexBuffer[1]};
959 Uint32 Offsets[_countof(pVBs)] = {};
960 pCtx->SetVertexBuffers(0, _countof(pVBs), pVBs, Offsets, RESOURCE_STATE_TRANSITION_MODE_TRANSITION, SET_VERTEX_BUFFERS_FLAG_RESET);
961 if (GLTFModel.pIndexBuffer)
962 {
963 pCtx->SetIndexBuffer(GLTFModel.pIndexBuffer, 0, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
958 std::array<Uint32, 2> Offsets;
959 std::array<IBuffer*, 2> pVBs = //
960 {
961 GLTFModel.GetBuffer(GLTF::Model::BUFFER_ID_VERTEX0, Offsets[0]),
962 GLTFModel.GetBuffer(GLTF::Model::BUFFER_ID_VERTEX1, Offsets[1]) //
963 };
964 pCtx->SetVertexBuffers(0, static_cast<Uint32>(pVBs.size()), pVBs.data(), Offsets.data(), RESOURCE_STATE_TRANSITION_MODE_TRANSITION, SET_VERTEX_BUFFERS_FLAG_RESET);
965
966 Uint32 IBOffset = 0;
967 auto* pIndexBuffer = GLTFModel.GetBuffer(GLTF::Model::BUFFER_ID_INDEX, IBOffset);
968 if (pIndexBuffer)
969 {
970 pCtx->SetIndexBuffer(pIndexBuffer, IBOffset, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
964971 }
965972 }
966973 else