mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-23 13:25:36 +00:00
Merge pull request #1554 from Azaezel/alpha41/decalAtlasWipWork
decal atlas and decal editor corrections
This commit is contained in:
commit
eb380e58a3
6 changed files with 68 additions and 24 deletions
|
|
@ -406,12 +406,15 @@ void DecalData::reloadRects()
|
|||
bool canRenderColsByFrame = false;
|
||||
S32 id = 0;
|
||||
|
||||
texRect[id].point.x = 0.f;
|
||||
texRect[id].extent.x = 1.f;
|
||||
texRect[id].point.y = 0.f;
|
||||
texRect[id].extent.y = 1.f;
|
||||
|
||||
texCoordCount = (texRows * texCols) - 1;
|
||||
|
||||
if (texRows > 1 || texCols > 1)
|
||||
{
|
||||
texCoordCount = (texRows * texCols) - 1;
|
||||
texRect[id].point.x = 0.f;
|
||||
texRect[id].extent.x = 1.f;
|
||||
texRect[id].point.y = 0.f;
|
||||
texRect[id].extent.y = 1.f;
|
||||
}
|
||||
|
||||
if( texCoordCount > 16 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -294,12 +294,12 @@ bool DecalManager::clipDecal( DecalInstance *decal, Vector<Point3F> *edgeVerts,
|
|||
// Free old verts and indices.
|
||||
_freeBuffers( decal );
|
||||
|
||||
F32 halfSize = decal->mSize * 0.5f;
|
||||
|
||||
const Point2F& halfSize = decal->mSize * 0.5f * decal->mDataBlock->texRect[decal->mTextureRectIdx].extent;
|
||||
|
||||
// Ugly hack for ProjectedShadow!
|
||||
F32 halfSizeZ = clipDepth ? clipDepth->x : halfSize;
|
||||
F32 negHalfSize = clipDepth ? clipDepth->y : halfSize;
|
||||
Point3F decalHalfSize( halfSize, halfSize, halfSize );
|
||||
F32 halfSizeZ = clipDepth ? clipDepth->x : halfSize.x;
|
||||
F32 negHalfSize = clipDepth ? clipDepth->y : halfSize.y;
|
||||
Point3F decalHalfSize( halfSize.x, halfSize.y, halfSize.x );
|
||||
Point3F decalHalfSizeZ( halfSizeZ, halfSizeZ, halfSizeZ );
|
||||
|
||||
MatrixF projMat( true );
|
||||
|
|
@ -319,11 +319,11 @@ bool DecalManager::clipDecal( DecalInstance *decal, Vector<Point3F> *edgeVerts,
|
|||
// See above re: decalHalfSizeZ hack.
|
||||
mClipper.clear();
|
||||
mClipper.mPlaneList.setSize(6);
|
||||
mClipper.mPlaneList[0].set( ( decalPos + ( -newRight * halfSize ) ), -newRight );
|
||||
mClipper.mPlaneList[1].set( ( decalPos + ( -newFwd * halfSize ) ), -newFwd );
|
||||
mClipper.mPlaneList[0].set( ( decalPos + ( -newRight * halfSize.x ) ), -newRight );
|
||||
mClipper.mPlaneList[1].set( ( decalPos + ( -newFwd * halfSize.y ) ), -newFwd );
|
||||
mClipper.mPlaneList[2].set( ( decalPos + ( -crossVec * decalHalfSizeZ ) ), -crossVec );
|
||||
mClipper.mPlaneList[3].set( ( decalPos + ( newRight * halfSize ) ), newRight );
|
||||
mClipper.mPlaneList[4].set( ( decalPos + ( newFwd * halfSize ) ), newFwd );
|
||||
mClipper.mPlaneList[3].set( ( decalPos + ( newRight * halfSize.x ) ), newRight );
|
||||
mClipper.mPlaneList[4].set( ( decalPos + ( newFwd * halfSize.y ) ), newFwd );
|
||||
mClipper.mPlaneList[5].set( ( decalPos + ( crossVec * negHalfSize ) ), crossVec );
|
||||
|
||||
mClipper.mNormal = decal->mNormal;
|
||||
|
|
|
|||
|
|
@ -854,7 +854,7 @@ DefineEngineMethod( GuiDecalEditorCtrl, selectDecal, void, ( U32 id ), , "select
|
|||
object->selectDecal( decalInstance );
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point3F pos, Point3F tan,F32 size ), , "editDecalDetails( S32 )()" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point3F pos, Point3F tan, F32 size, S32 uvID), , "editDecalDetails( S32,Point3F,Point3F,F32,S32 )()" )
|
||||
{
|
||||
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
|
||||
if( decalInstance == NULL )
|
||||
|
|
@ -864,7 +864,8 @@ DefineEngineMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point3
|
|||
decalInstance->mPosition = pos;
|
||||
decalInstance->mTangent = tan;
|
||||
decalInstance->mSize = size;
|
||||
|
||||
decalInstance->mTextureRectIdx = uvID;
|
||||
|
||||
if ( decalInstance == object->mSELDecal )
|
||||
object->setGizmoFocus( decalInstance );
|
||||
|
||||
|
|
@ -873,6 +874,11 @@ DefineEngineMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point3
|
|||
gDecalManager->notifyDecalModified( decalInstance );
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiDecalEditorCtrl, getDecalFrame, S32, (U32 id), , "")
|
||||
{
|
||||
return gDecalManager->mDecalInstanceVec[id]->mTextureRectIdx;
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, getSelectionCount, S32, (), , "" )
|
||||
{
|
||||
if ( object->mSELDecal != NULL )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue