[DiscordArchive] a 3 model ?
[DiscordArchive] a 3 model ?
Archived author: Titi • Posted: 2022-11-13T10:06:48.877000+00:00
Original source
You can display bounding box on noggit to be sure
Archived author: Kaev • Posted: 2022-11-13T10:07:33.052000+00:00
Original source
The extents of a M2 seems to be calculated from collision box, bounding box and rotation
Archived author: Kaev • Posted: 2022-11-13T10:07:58.745000+00:00
Original source
```c++
void ModelInstance::recalcExtents()
{
if (!model->finishedLoading())
{
_need_recalc_extents = true;
return;
}
if (model->loading_failed())
{
extents[0] = extents[1] = pos;
_need_recalc_extents = false;
return;
}
updateTransformMatrix();
math::aabb const relative_to_model
( glm::min ( model->header.collision_box_min, model->header.bounding_box_min)
, glm::max ( model->header.collision_box_max, model->header.bounding_box_max)
);
//! \todo If both boxes are {inf, -inf}, or well, if any min.c > max.c,
//! the model is bad itself. We *could* detect that case and explicitly
//! assume {-1, 1} then, to be nice to fuckported models.
auto corners_in_world = std::vector<glm::vec3>();
auto transform = misc::transform_model_box_coords;
auto points = relative_to_model.all_corners();
for (auto& point : points)
{
point = transform(point);
corners_in_world.push_back(point);
}
auto rotated_corners_in_world = std::vector<glm::vec3>();
auto transposedMat = _transform_mat;
for (auto const& point : corners_in_world)
{
rotated_corners_in_world.emplace_back(transposedMat * glm::vec4(point, 1.f));
}
math::aabb const bounding_of_rotated_points (rotated_corners_in_world);
extents[0] = bounding_of_rotated_points.min;
extents[1] = bounding_of_rotated_points.max;
size_cat = glm::distance(bounding_of_rotated_points.max, bounding_of_rotated_points.min);
_need_recalc_extents = false;
}
```
Archived author: Titi • Posted: 2022-11-13T10:11:54.203000+00:00
Original source
Drag selection would be awesome
Archived author: Titi • Posted: 2022-11-13T10:12:03.931000+00:00
Original source
One of the most needed features for sure
Archived author: Kaev • Posted: 2022-11-13T10:12:20.700000+00:00
Original source
It's also possible that my calculation of the selection box is wrong but i kinda doubt that atm. At least i don't see what i could go wrong there. I basically just use mouse pos in world of start drag position to mouse pos in world of end drag position and calculate the box out of that with the min and max values
Archived author: Titi • Posted: 2022-11-13T10:14:21.992000+00:00
Original source
Hm wouldn't that only work properly from being perfectly above ?
Archived author: Kaev • Posted: 2022-11-13T10:14:40.051000+00:00
Original source
I don't have access rights to the repo so i pushed my changes into my fork, maybe someone knows what he's doing unlike me
https://github.com/Kaev/noggit-red/pull/1
[Embed: Started to add drag area selection by Kaev · Pull Request #1 · Kaev...]
Still has minor issues.
flickering due to refreshing the QRubberBand in the main thread (use a new thread for that or replace QRubberBand with rendering a 3d box in the world)
The drag selection d...
https://github.com/Kaev/noggit-red/pull/1
Archived author: Kaev • Posted: 2022-11-13T10:15:16.752000+00:00
Original source
Kinda but i don't really know how you would limit that in a full 3d environment
Archived author: Titi • Posted: 2022-11-13T10:15:55.256000+00:00
Original source
X y cords dont' translate very well from a 3d view, I'm not a graphics specialist but there are other methods for 3d views for sure