1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 17:26:41 +00:00

fix bone with spline deform not deforming (forgot tp update VBO)

also fix SplineGrid to actually deform own texture
(note to self: GRID_WAVY resets deform in update(). oops)
This commit is contained in:
fgenesis 2024-02-06 01:36:38 +01:00
parent cd46cc24fa
commit 063c270e6a
3 changed files with 7 additions and 4 deletions

View file

@ -51,7 +51,7 @@ public:
size_t height() const { return grid.height(); } size_t height() const { return grid.height(); }
size_t linearsize() const { return grid.linearsize(); } size_t linearsize() const { return grid.linearsize(); }
const Vector *data() const { return grid.data(); } const Vector *data() const { return grid.data(); }
Vector *data() { return grid.data(); } Vector *dataRW() { this->needVBOUpdate = true; return grid.data(); }
Array2d<Vector>& array2d() { return grid; } Array2d<Vector>& array2d() { return grid; }
const Array2d<Vector>& array2d() const { return grid; } const Array2d<Vector>& array2d() const { return grid; }
const DynamicGPUBuffer& getVBO() const { return vbo; } const DynamicGPUBuffer& getVBO() const { return vbo; }

View file

@ -2056,7 +2056,7 @@ void AnimationLayer::updateBones()
DynamicRenderGrid::ResetWithAlpha(&bkey2->grid[0], grid->width(), grid->height(), 1.0f); DynamicRenderGrid::ResetWithAlpha(&bkey2->grid[0], grid->width(), grid->height(), 1.0f);
} }
Vector *dst = grid->data(); Vector *dst = grid->dataRW();
for(size_t i = 0; i < N; ++i) for(size_t i = 0; i < N; ++i)
{ {
dst[i].x = lerp(bkey1->grid[i].x, bkey2->grid[i].x, dt, lerpType); dst[i].x = lerp(bkey1->grid[i].x, bkey2->grid[i].x, dt, lerpType);
@ -2196,6 +2196,8 @@ void BoneGridInterpolator::updateGridOnly(BoneKeyframe& bk, const Bone *bone)
void BoneGridInterpolator::updateGridAndBone(BoneKeyframe& bk, Bone *bone) void BoneGridInterpolator::updateGridAndBone(BoneKeyframe& bk, Bone *bone)
{ {
updateGridOnly(bk, bone); updateGridOnly(bk, bone);
Vector *dst = bone->getGrid()->data(); DynamicRenderGrid *g = bone->getGrid();
Vector *dst = g->dataRW();
std::copy(bk.grid.begin(), bk.grid.end(), dst); std::copy(bk.grid.begin(), bk.grid.end(), dst);
} }

View file

@ -91,6 +91,7 @@ DynamicRenderGrid *SplineGrid::resize(size_t w, size_t h, size_t xres, size_t yr
size_t oldcpy = bsp.ctrlY(); size_t oldcpy = bsp.ctrlY();
DynamicRenderGrid *ret = this->createGrid(xres, yres); DynamicRenderGrid *ret = this->createGrid(xres, yres);
ret->gridType = GRID_INTERP;
std::vector<SplineGridCtrlPoint*> oldp; std::vector<SplineGridCtrlPoint*> oldp;
ctrlp.swap(oldp); ctrlp.swap(oldp);
@ -135,7 +136,7 @@ void SplineGrid::recalc()
exportControlPoints(&bsp.controlpoints[0]); exportControlPoints(&bsp.controlpoints[0]);
if(grid) if(grid)
{ {
bsp.recalc(grid->data(), grid->width(), grid->height()); bsp.recalc(grid->dataRW(), grid->width(), grid->height());
wasModified = true; wasModified = true;
} }
} }