mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-27 06:07:45 +00:00
Actually fill the whole Dawntrail bone buffer
This commit is contained in:
parent
8535fec7aa
commit
a3f3437742
4 changed files with 9 additions and 13 deletions
|
@ -35,7 +35,7 @@ struct DrawObject {
|
|||
|
||||
physis_MDL model;
|
||||
std::vector<RenderPart> parts;
|
||||
std::array<glm::mat4, 128> boneData;
|
||||
std::array<glm::mat4, 768> boneData; // JOINT_MATRIX_SIZE_DAWNTRAIL
|
||||
std::vector<RenderMaterial> materials;
|
||||
glm::vec3 position;
|
||||
bool skinned = false;
|
||||
|
|
|
@ -16,13 +16,8 @@ struct CameraParameter {
|
|||
glm::vec4 m_LookAtVector;
|
||||
};
|
||||
|
||||
struct JointMatrixArrayARR {
|
||||
glm::mat3x4 g_JointMatrixArray[64];
|
||||
};
|
||||
|
||||
struct JointMatrixArrayDawntrail {
|
||||
glm::mat3x4 g_JointMatrixArray[768];
|
||||
};
|
||||
const int JOINT_MATRIX_SIZE_ARR = 64;
|
||||
const int JOINT_MATRIX_SIZE_DAWNTRAIL = 768;
|
||||
|
||||
struct CameraLight {
|
||||
glm::vec4 m_DiffuseSpecular;
|
||||
|
|
|
@ -291,12 +291,13 @@ void GameRenderer::render(VkCommandBuffer commandBuffer, Camera &camera, Scene &
|
|||
|
||||
// copy bone data
|
||||
{
|
||||
const size_t bufferSize = sizeof(glm::mat3x4) * 64;
|
||||
const int jointMatrixSize = m_dawntrailMode ? JOINT_MATRIX_SIZE_DAWNTRAIL : JOINT_MATRIX_SIZE_ARR;
|
||||
const size_t bufferSize = sizeof(glm::mat3x4) * jointMatrixSize;
|
||||
void *mapped_data = nullptr;
|
||||
vkMapMemory(m_device.device, model.boneInfoBuffer.memory, 0, bufferSize, 0, &mapped_data);
|
||||
|
||||
std::vector<glm::mat3x4> newBoneData(model.boneData.size());
|
||||
for (int i = 0; i < 64; i++) {
|
||||
for (int i = 0; i < jointMatrixSize; i++) {
|
||||
newBoneData[i] = glm::transpose(model.boneData[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -531,7 +531,7 @@ void RenderManager::reloadDrawObject(DrawObject &DrawObject, uint32_t lod)
|
|||
DrawObject.parts.push_back(renderPart);
|
||||
}
|
||||
|
||||
const size_t bufferSize = sizeof(glm::mat4) * 128;
|
||||
const size_t bufferSize = sizeof(glm::mat4) * JOINT_MATRIX_SIZE_DAWNTRAIL;
|
||||
DrawObject.boneInfoBuffer = m_device->createBuffer(bufferSize, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue