update
parent
2eda8f2493
commit
104ebaa0a7
|
@ -37,3 +37,4 @@ data/
|
||||||
# vs compile file
|
# vs compile file
|
||||||
out/
|
out/
|
||||||
.vs/
|
.vs/
|
||||||
|
*.zip
|
||||||
|
|
|
@ -234,7 +234,10 @@ VulkanglTFModel::~VulkanglTFModel()
|
||||||
memcpy(skins[i].inverseBindMatrices.data(), &buffer.data[accessor.byteOffset + bufferview.byteOffset], accessor.count * sizeof(glm::mat4));
|
memcpy(skins[i].inverseBindMatrices.data(), &buffer.data[accessor.byteOffset + bufferview.byteOffset], accessor.count * sizeof(glm::mat4));
|
||||||
|
|
||||||
//create a host visible shader buffer to store inverse bind matrices for this skin
|
//create a host visible shader buffer to store inverse bind matrices for this skin
|
||||||
VK_CHECK_RESULT(vulkanDevice->createBuffer(VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
VK_CHECK_RESULT(
|
||||||
|
vulkanDevice->createBuffer(
|
||||||
|
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
|
||||||
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
||||||
&skins[i].ssbo,
|
&skins[i].ssbo,
|
||||||
sizeof(glm::mat4) * skins[i].inverseBindMatrices.size(),
|
sizeof(glm::mat4) * skins[i].inverseBindMatrices.size(),
|
||||||
skins[i].inverseBindMatrices.data()));
|
skins[i].inverseBindMatrices.data()));
|
||||||
|
@ -327,9 +330,12 @@ VulkanglTFModel::~VulkanglTFModel()
|
||||||
uint32_t firstIndex = static_cast<uint32_t>(indexBuffer.size());
|
uint32_t firstIndex = static_cast<uint32_t>(indexBuffer.size());
|
||||||
uint32_t vertexStart = static_cast<uint32_t>(vertexBuffer.size());
|
uint32_t vertexStart = static_cast<uint32_t>(vertexBuffer.size());
|
||||||
uint32_t indexCount = 0;
|
uint32_t indexCount = 0;
|
||||||
|
//vertices
|
||||||
const float* positionBuffer = nullptr;
|
const float* positionBuffer = nullptr;
|
||||||
const float* normalsBuffer = nullptr;
|
const float* normalsBuffer = nullptr;
|
||||||
const float* texcoordsBuffer = nullptr;
|
const float* texcoordsBuffer = nullptr;
|
||||||
|
const float* tangentsBuffer = nullptr;
|
||||||
|
//skin joints
|
||||||
const float* jointWeightsBuffer = nullptr;
|
const float* jointWeightsBuffer = nullptr;
|
||||||
const uint16_t * jointIndicesBuffer = nullptr;
|
const uint16_t * jointIndicesBuffer = nullptr;
|
||||||
size_t vertexCount = 0;
|
size_t vertexCount = 0;
|
||||||
|
@ -377,9 +383,9 @@ VulkanglTFModel::~VulkanglTFModel()
|
||||||
{
|
{
|
||||||
Vertex vert{};
|
Vertex vert{};
|
||||||
vert.pos = glm::vec4(glm::make_vec3(&positionBuffer[v * 3]), 1.0f);
|
vert.pos = glm::vec4(glm::make_vec3(&positionBuffer[v * 3]), 1.0f);
|
||||||
vert.uv = texcoordsBuffer ? glm::make_vec2(&texcoordsBuffer[v*2]):glm::vec4(0.0f);
|
vert.uv = texcoordsBuffer ? glm::make_vec2(&texcoordsBuffer[v*2]) : glm::vec3(0.0f);
|
||||||
vert.normal = glm::normalize(glm::vec3(normalsBuffer ? glm::make_vec3(&normalsBuffer[v * 3]) : glm::vec3(0.0f)));
|
vert.normal = glm::normalize(glm::vec3(normalsBuffer ? glm::make_vec3(&normalsBuffer[v * 3]) : glm::vec3(0.0f)));
|
||||||
vert.color = glm::vec3(1.0f);
|
vert.color = glm::vec3(1.0f,1.0f,nodeIndex);
|
||||||
vert.jointIndices = hasSkin ? glm::vec4(glm::make_vec4(&jointIndicesBuffer[v * 4])) : glm::vec4(0.0f);
|
vert.jointIndices = hasSkin ? glm::vec4(glm::make_vec4(&jointIndicesBuffer[v * 4])) : glm::vec4(0.0f);
|
||||||
vert.jointWeights = hasSkin ? glm::make_vec4(&jointWeightsBuffer[v * 4]) : glm::vec4(0.0f);
|
vert.jointWeights = hasSkin ? glm::make_vec4(&jointWeightsBuffer[v * 4]) : glm::vec4(0.0f);
|
||||||
vertexBuffer.push_back(vert);
|
vertexBuffer.push_back(vert);
|
||||||
|
@ -645,6 +651,7 @@ VulkanExample::~VulkanExample()
|
||||||
|
|
||||||
|
|
||||||
shaderData.buffer.destroy();
|
shaderData.buffer.destroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VulkanExample::getEnabledFeatures()
|
void VulkanExample::getEnabledFeatures()
|
||||||
|
@ -660,7 +667,7 @@ void VulkanExample::getEnabledFeatures()
|
||||||
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
|
||||||
|
|
||||||
VkClearValue clearValues[2];
|
VkClearValue clearValues[2];
|
||||||
|
clearValues[0].color = defaultClearColor;
|
||||||
clearValues[0].color = { { 0.25f, 0.25f, 0.25f, 1.0f } };;
|
clearValues[0].color = { { 0.25f, 0.25f, 0.25f, 1.0f } };;
|
||||||
clearValues[1].depthStencil = { 1.0f, 0 };
|
clearValues[1].depthStencil = { 1.0f, 0 };
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue