mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-26 00:40:15 +00:00
Transport hell
This commit is contained in:
parent
2e923311d0
commit
f3f3b62880
12 changed files with 912 additions and 126 deletions
|
|
@ -2505,6 +2505,28 @@ void M2Renderer::setInstancePosition(uint32_t instanceId, const glm::vec3& posit
|
|||
rebuildSpatialIndex();
|
||||
}
|
||||
|
||||
void M2Renderer::setInstanceTransform(uint32_t instanceId, const glm::mat4& transform) {
|
||||
auto idxIt = instanceIndexById.find(instanceId);
|
||||
if (idxIt == instanceIndexById.end()) return;
|
||||
auto& inst = instances[idxIt->second];
|
||||
|
||||
// Update model matrix directly
|
||||
inst.modelMatrix = transform;
|
||||
inst.invModelMatrix = glm::inverse(transform);
|
||||
|
||||
// Extract position from transform for bounds
|
||||
inst.position = glm::vec3(transform[3]);
|
||||
|
||||
// Update bounds
|
||||
auto modelIt = models.find(inst.modelId);
|
||||
if (modelIt != models.end()) {
|
||||
glm::vec3 localMin, localMax;
|
||||
getTightCollisionBounds(modelIt->second, localMin, localMax);
|
||||
transformAABB(inst.modelMatrix, localMin, localMax, inst.worldBoundsMin, inst.worldBoundsMax);
|
||||
}
|
||||
rebuildSpatialIndex();
|
||||
}
|
||||
|
||||
void M2Renderer::removeInstance(uint32_t instanceId) {
|
||||
for (auto it = instances.begin(); it != instances.end(); ++it) {
|
||||
if (it->id == instanceId) {
|
||||
|
|
|
|||
|
|
@ -610,13 +610,29 @@ void WaterRenderer::createWaterMesh(WaterSurface& surface) {
|
|||
bool msbOrder = (maskByte & (1 << (7 - bitIndex))) != 0;
|
||||
renderTile = lsbOrder || msbOrder;
|
||||
|
||||
// If this tile is masked out, check neighbors to fill gaps
|
||||
if (!renderTile && x > 0 && y > 0 && x < gridWidth-2 && y < gridHeight-2) {
|
||||
// If this tile is masked out, check neighbors to fill coastline gaps
|
||||
if (!renderTile) {
|
||||
// Check adjacent tiles - render if any neighbor is water (blend coastline)
|
||||
for (int dy = -1; dy <= 1; dy++) {
|
||||
for (int dx = -1; dx <= 1; dx++) {
|
||||
if (dx == 0 && dy == 0) continue;
|
||||
int neighborIdx = (y + dy) * surface.width + (x + dx);
|
||||
int nx = x + dx;
|
||||
int ny = y + dy;
|
||||
// Bounds check neighbors
|
||||
if (nx < 0 || ny < 0 || nx >= gridWidth-1 || ny >= gridHeight-1) continue;
|
||||
|
||||
// Calculate neighbor mask index (consistent with main tile indexing)
|
||||
int neighborIdx;
|
||||
if (surface.wmoId == 0 && surface.mask.size() >= 8) {
|
||||
// Terrain MH2O: account for xOffset/yOffset
|
||||
int ncx = static_cast<int>(surface.xOffset) + nx;
|
||||
int ncy = static_cast<int>(surface.yOffset) + ny;
|
||||
neighborIdx = ncy * 8 + ncx;
|
||||
} else {
|
||||
// WMO/custom: local indexing
|
||||
neighborIdx = ny * surface.width + nx;
|
||||
}
|
||||
|
||||
int nByteIdx = neighborIdx / 8;
|
||||
int nBitIdx = neighborIdx % 8;
|
||||
if (nByteIdx < static_cast<int>(surface.mask.size())) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue