fix wrong merge
parent
c33d647019
commit
5804ca009a
|
@ -24,7 +24,7 @@
|
||||||
The following functions take a glTF input model loaded via tinyglTF and convert all required data into our own structure
|
The following functions take a glTF input model loaded via tinyglTF and convert all required data into our own structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void loadImages(tinygltf::Model& input)
|
void VulkanglTFModel::loadImages(tinygltf::Model& input)
|
||||||
{
|
{
|
||||||
// Images can be stored inside the glTF (which is the case for the sample model), so instead of directly
|
// Images can be stored inside the glTF (which is the case for the sample model), so instead of directly
|
||||||
// loading them from disk, we fetch them from the glTF loader and upload the buffers
|
// loading them from disk, we fetch them from the glTF loader and upload the buffers
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadTextures(tinygltf::Model& input)
|
void VulkanglTFModel::loadTextures(tinygltf::Model& input)
|
||||||
{
|
{
|
||||||
textures.resize(input.textures.size());
|
textures.resize(input.textures.size());
|
||||||
for (size_t i = 0; i < input.textures.size(); i++) {
|
for (size_t i = 0; i < input.textures.size(); i++) {
|
||||||
|
@ -507,14 +507,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class VulkanExample : public VulkanExampleBase
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
bool wireframe = false;
|
|
||||||
|
|
||||||
VulkanglTFModel glTFModel;
|
|
||||||
|
|
||||||
|
|
||||||
VulkanExample::VulkanExample():
|
VulkanExample::VulkanExample():
|
||||||
|
@ -648,7 +640,7 @@ public:
|
||||||
pbrFrameBuffer.bCreate = true;
|
pbrFrameBuffer.bCreate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildCommandBuffers()
|
void VulkanExample::buildCommandBuffers()
|
||||||
{
|
{
|
||||||
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
||||||
|
|
||||||
|
@ -817,14 +809,14 @@ public:
|
||||||
vkFreeMemory(device, indexStaging.memory, nullptr);
|
vkFreeMemory(device, indexStaging.memory, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadAssets()
|
void VulkanExample::loadAssets()
|
||||||
{
|
{
|
||||||
loadglTFFile(getAssetPath() + "buster_drone/busterDrone.gltf", glTFModel);
|
loadglTFFile(getAssetPath() + "buster_drone/busterDrone.gltf", glTFModel);
|
||||||
loadglTFFile(getAssetPath() + "models/cube.gltf", skyboxModel, true);
|
loadglTFFile(getAssetPath() + "models/cube.gltf", skyboxModel, true);
|
||||||
ibltextures.skyboxCube.loadFromFile(getAssetPath() + "textures/hdr/pisa_cube.ktx", VK_FORMAT_R16G16B16A16_SFLOAT, vulkanDevice, queue);
|
ibltextures.skyboxCube.loadFromFile(getAssetPath() + "textures/hdr/pisa_cube.ktx", VK_FORMAT_R16G16B16A16_SFLOAT, vulkanDevice, queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupDescriptors()
|
void VulkanExample::setupDescriptors()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This sample uses separate descriptor sets (and layouts) for the matrices and materials (textures)
|
This sample uses separate descriptor sets (and layouts) for the matrices and materials (textures)
|
||||||
|
@ -931,7 +923,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void preparePipelines()
|
void VulkanExample::preparePipelines()
|
||||||
{
|
{
|
||||||
VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCI = vks::initializers::pipelineInputAssemblyStateCreateInfo(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0, VK_FALSE);
|
VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCI = vks::initializers::pipelineInputAssemblyStateCreateInfo(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 0, VK_FALSE);
|
||||||
VkPipelineRasterizationStateCreateInfo rasterizationStateCI = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_BACK_BIT, VK_FRONT_FACE_COUNTER_CLOCKWISE, 0);
|
VkPipelineRasterizationStateCreateInfo rasterizationStateCI = vks::initializers::pipelineRasterizationStateCreateInfo(VK_POLYGON_MODE_FILL, VK_CULL_MODE_BACK_BIT, VK_FRONT_FACE_COUNTER_CLOCKWISE, 0);
|
||||||
|
@ -2041,7 +2033,7 @@ public:
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
// Prepare and initialize uniform buffer containing shader uniforms
|
// Prepare and initialize uniform buffer containing shader uniforms
|
||||||
void prepareUniformBuffers()
|
void VulkanExample::prepareUniformBuffers()
|
||||||
{
|
{
|
||||||
// Vertex shader uniform buffer block
|
// Vertex shader uniform buffer block
|
||||||
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
||||||
|
@ -2073,7 +2065,7 @@ public:
|
||||||
updateUniformBuffers();
|
updateUniformBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateUniformBuffers()
|
void VulkanExample::updateUniformBuffers()
|
||||||
{
|
{
|
||||||
shaderData.values.projection = camera.matrices.perspective;
|
shaderData.values.projection = camera.matrices.perspective;
|
||||||
shaderData.values.model = camera.matrices.view;
|
shaderData.values.model = camera.matrices.view;
|
||||||
|
@ -2083,7 +2075,7 @@ public:
|
||||||
memcpy(shaderData.buffer.mapped, &shaderData.values, sizeof(shaderData.values));
|
memcpy(shaderData.buffer.mapped, &shaderData.values, sizeof(shaderData.values));
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepare()
|
void VulkanExample::prepare()
|
||||||
{
|
{
|
||||||
VulkanExampleBase::prepare();
|
VulkanExampleBase::prepare();
|
||||||
loadAssets();
|
loadAssets();
|
||||||
|
@ -2097,7 +2089,7 @@ public:
|
||||||
prepared = true;
|
prepared = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void render()
|
void VulkanExample::render()
|
||||||
{
|
{
|
||||||
renderFrame();
|
renderFrame();
|
||||||
if (camera.updated) {
|
if (camera.updated) {
|
||||||
|
@ -2107,12 +2099,12 @@ public:
|
||||||
glTFModel.updateAnimation(frameTimer, shaderData.skinSSBO);
|
glTFModel.updateAnimation(frameTimer, shaderData.skinSSBO);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void viewChanged()
|
void VulkanExample::viewChanged()
|
||||||
{
|
{
|
||||||
updateUniformBuffers();
|
updateUniformBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
void VulkanExample::OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
||||||
{
|
{
|
||||||
if (overlay->header("Settings")) {
|
if (overlay->header("Settings")) {
|
||||||
if (overlay->checkBox("Wireframe", &wireframe)) {
|
if (overlay->checkBox("Wireframe", &wireframe)) {
|
||||||
|
@ -2134,6 +2126,6 @@ public:
|
||||||
overlay->checkBox("Pause", &paused);
|
overlay->checkBox("Pause", &paused);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
VULKAN_EXAMPLE_MAIN()
|
VULKAN_EXAMPLE_MAIN()
|
||||||
|
|
Loading…
Reference in New Issue