Added KRMesh::isReady

Vulkan test code now uses KRMesh and asset ingestion pipeline for vertex and index data.
Updated Vulkan test shader to match KRMesh attribute layout.
This commit is contained in:
2022-07-07 00:23:14 -07:00
parent e976e94da1
commit 88a1ca186b
4 changed files with 26 additions and 17 deletions

View File

@@ -219,22 +219,20 @@ void KRCamera::renderFrame(VkCommandBuffer& commandBuffer, KRSurface& compositeS
GL_POP_GROUP_MARKER;
// ---------- Start: Vulkan Debug Code ----------
KRMeshManager::KRVBOData& testVertices = getContext().getMeshManager()->KRENGINE_VBO_DATA_2D_SQUARE_VERTICES;
bool haveMesh = testVertices.isVBOReady();
if (haveMesh) {
KRMesh* sphereMesh = getContext().getMeshManager()->getMaxLODModel("__sphere");
if (sphereMesh && sphereMesh->isReady()) {
PipelineInfo info{};
std::string shader_name("vulkan_test");
info.shader_name = &shader_name;
info.pCamera = this;
info.renderPass = KRNode::RENDER_PASS_FORWARD_TRANSPARENT;
info.rasterMode = PipelineInfo::RasterMode::kAlphaBlend;
info.vertexAttributes = testVertices.getVertexAttributes();
info.modelFormat = KRMesh::model_format_t::KRENGINE_MODEL_FORMAT_STRIP;
info.vertexAttributes = sphereMesh->getVertexAttributes();
info.modelFormat = sphereMesh->getModelFormat();
KRPipeline* testPipeline = m_pContext->getPipelineManager()->getPipeline(compositeSurface, info);
testPipeline->bind(commandBuffer);
testVertices.bind(commandBuffer);
vkCmdDraw(commandBuffer, 4, 1, 0, 0);
sphereMesh->renderNoMaterials(commandBuffer, info.renderPass, "Vulkan Test", "vulkan_test", 1.0);
}
// ---------- End: Vulkan Debug Code ----------