mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-26 07:39:27 +00:00
fix decal editor bounds and decalmanager raycast
we weren't accounting for texRects for decal atlases
This commit is contained in:
parent
58632d0d73
commit
215830ca55
2 changed files with 14 additions and 9 deletions
|
|
@ -660,12 +660,14 @@ DecalInstance* DecalManager::raycast( const Point3F &start, const Point3F &end,
|
|||
RayInfo ri;
|
||||
bool containsPoint = false;
|
||||
if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) )
|
||||
{
|
||||
{
|
||||
RectF rect = inst->mDataBlock->texRect[inst->mTextureRectIdx];
|
||||
rect.extent *= inst->mSize * 0.5f;
|
||||
Point2F poly[4];
|
||||
poly[0].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2));
|
||||
poly[1].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2));
|
||||
poly[2].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2));
|
||||
poly[3].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2));
|
||||
poly[0].set(inst->mPosition.x - rect.extent.x, inst->mPosition.y + rect.extent.y);
|
||||
poly[1].set( inst->mPosition.x - rect.extent.x, inst->mPosition.y - rect.extent.y);
|
||||
poly[2].set( inst->mPosition.x + rect.extent.x, inst->mPosition.y - rect.extent.y);
|
||||
poly[3].set( inst->mPosition.x + rect.extent.x, inst->mPosition.y + rect.extent.y);
|
||||
|
||||
if ( MathUtils::pointInPolygon( poly, 4, Point2F(ri.point.x, ri.point.y) ) )
|
||||
containsPoint = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue