Fixed image usage (validation), code cleanup
Moved model to asset pack
This commit is contained in:
parent
92b724e000
commit
047f9faeec
6 changed files with 7 additions and 527 deletions
|
|
@ -1 +0,0 @@
|
||||||
Model by NASA (http://nasa3d.arc.nasa.gov/models)
|
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -356,18 +356,7 @@ public:
|
||||||
void loadAssets()
|
void loadAssets()
|
||||||
{
|
{
|
||||||
loadModel(getAssetPath() + "models/voyager/voyager.dae");
|
loadModel(getAssetPath() + "models/voyager/voyager.dae");
|
||||||
if (deviceFeatures.textureCompressionBC) {
|
textures.colorMap.loadFromFile(getAssetPath() + "models/voyager/voyager_rgba_unorm.ktx", VK_FORMAT_R8G8B8A8_UNORM, vulkanDevice, queue);
|
||||||
textures.colorMap.loadFromFile(getAssetPath() + "models/voyager/voyager_bc3_unorm.ktx", VK_FORMAT_BC3_UNORM_BLOCK, vulkanDevice, queue);
|
|
||||||
}
|
|
||||||
else if (deviceFeatures.textureCompressionASTC_LDR) {
|
|
||||||
textures.colorMap.loadFromFile(getAssetPath() + "models/voyager/voyager_astc_8x8_unorm.ktx", VK_FORMAT_ASTC_8x8_UNORM_BLOCK, vulkanDevice, queue);
|
|
||||||
}
|
|
||||||
else if (deviceFeatures.textureCompressionETC2) {
|
|
||||||
textures.colorMap.loadFromFile(getAssetPath() + "models/voyager/voyager_etc2_unorm.ktx", VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK, vulkanDevice, queue);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
vks::tools::exitFatal("Device does not support any compressed texture format!", VK_ERROR_FEATURE_NOT_PRESENT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupVertexDescriptions()
|
void setupVertexDescriptions()
|
||||||
|
|
@ -470,36 +459,15 @@ public:
|
||||||
|
|
||||||
void setupDescriptorSet()
|
void setupDescriptorSet()
|
||||||
{
|
{
|
||||||
VkDescriptorSetAllocateInfo allocInfo =
|
VkDescriptorSetAllocateInfo allocInfo = vks::initializers::descriptorSetAllocateInfo(descriptorPool, &descriptorSetLayout, 1);
|
||||||
vks::initializers::descriptorSetAllocateInfo(
|
|
||||||
descriptorPool,
|
|
||||||
&descriptorSetLayout,
|
|
||||||
1);
|
|
||||||
|
|
||||||
VK_CHECK_RESULT(vkAllocateDescriptorSets(device, &allocInfo, &descriptorSet));
|
VK_CHECK_RESULT(vkAllocateDescriptorSets(device, &allocInfo, &descriptorSet));
|
||||||
|
|
||||||
VkDescriptorImageInfo texDescriptor =
|
std::vector<VkWriteDescriptorSet> writeDescriptorSets = {
|
||||||
vks::initializers::descriptorImageInfo(
|
|
||||||
textures.colorMap.sampler,
|
|
||||||
textures.colorMap.view,
|
|
||||||
VK_IMAGE_LAYOUT_GENERAL);
|
|
||||||
|
|
||||||
std::vector<VkWriteDescriptorSet> writeDescriptorSets =
|
|
||||||
{
|
|
||||||
// Binding 0 : Vertex shader uniform buffer
|
// Binding 0 : Vertex shader uniform buffer
|
||||||
vks::initializers::writeDescriptorSet(
|
vks::initializers::writeDescriptorSet(descriptorSet, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0, &uniformBuffers.scene.descriptor),
|
||||||
descriptorSet,
|
|
||||||
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
|
|
||||||
0,
|
|
||||||
&uniformBuffers.scene.descriptor),
|
|
||||||
// Binding 1 : Color map
|
// Binding 1 : Color map
|
||||||
vks::initializers::writeDescriptorSet(
|
vks::initializers::writeDescriptorSet(descriptorSet, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, &textures.colorMap.descriptor)
|
||||||
descriptorSet,
|
|
||||||
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
|
||||||
1,
|
|
||||||
&texDescriptor)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
vkUpdateDescriptorSets(device, static_cast<uint32_t>(writeDescriptorSets.size()), writeDescriptorSets.data(), 0, NULL);
|
vkUpdateDescriptorSets(device, static_cast<uint32_t>(writeDescriptorSets.size()), writeDescriptorSets.data(), 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -648,11 +616,8 @@ public:
|
||||||
if (!prepared)
|
if (!prepared)
|
||||||
return;
|
return;
|
||||||
draw();
|
draw();
|
||||||
}
|
if (camera.updated)
|
||||||
|
updateUniformBuffers();
|
||||||
virtual void viewChanged()
|
|
||||||
{
|
|
||||||
updateUniformBuffers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue