| 13 | } |
| 14 | |
| 15 | void SkinnedMeshDrawData::Setup(int32 bonesCount) |
| 16 | { |
| 17 | if (BoneMatrices == nullptr) |
| 18 | { |
| 19 | BoneMatrices = GPUDevice::Instance->CreateBuffer(TEXT("BoneMatrices")); |
| 20 | } |
| 21 | |
| 22 | const int32 elementsCount = bonesCount * 3; // 3 * float4 per bone |
| 23 | if (BoneMatrices->Init(GPUBufferDescription::Typed(elementsCount, PixelFormat::R32G32B32A32_Float, false, GPUResourceUsage::Dynamic))) |
| 24 | { |
| 25 | LOG(Error, "Failed to initialize the skinned mesh bones buffer"); |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | BonesCount = bonesCount; |
| 30 | _hasValidData = false; |
| 31 | _isDirty = true; |
| 32 | Data.Resize(BoneMatrices->GetSize()); |
| 33 | SAFE_DELETE_GPU_RESOURCE(PrevBoneMatrices); |
| 34 | } |
| 35 | |
| 36 | void SkinnedMeshDrawData::OnDataChanged(bool dropHistory) |
| 37 | { |
nothing calls this directly
no test coverage detected