mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-25 09:33:50 +00:00
Hardware Skinning Support
- Supports GL, D3D9 & D3D11 - Extends vertex formats & shadergen to support blend indices and weights - Adds basic support for using 4x3 matrices for shader constants - Supports software fallback
This commit is contained in:
parent
507c239a87
commit
3496c549b5
72 changed files with 2533 additions and 1327 deletions
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
|
||||
void (*zero_vert_normal_bulk)(const dsize_t count, U8 * __restrict const outPtr, const dsize_t outStride) = NULL;
|
||||
void (*m_matF_x_BatchedVertWeightList)(const MatrixF &mat, const dsize_t count, const TSSkinMesh::BatchData::BatchedVertWeight * __restrict batch, U8 * const __restrict outPtr, const dsize_t outStride) = NULL;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Default C++ Implementations (pretty slow)
|
||||
|
|
@ -47,33 +46,6 @@ void zero_vert_normal_bulk_C(const dsize_t count, U8 * __restrict const outPtr,
|
|||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void m_matF_x_BatchedVertWeightList_C(const MatrixF &mat,
|
||||
const dsize_t count,
|
||||
const TSSkinMesh::BatchData::BatchedVertWeight * __restrict batch,
|
||||
U8 * const __restrict outPtr,
|
||||
const dsize_t outStride)
|
||||
{
|
||||
const register MatrixF m = mat;
|
||||
|
||||
register Point3F tempPt;
|
||||
register Point3F tempNrm;
|
||||
|
||||
for(register S32 i = 0; i < count; i++)
|
||||
{
|
||||
const TSSkinMesh::BatchData::BatchedVertWeight &inElem = batch[i];
|
||||
|
||||
TSMesh::__TSMeshVertexBase *outElem = reinterpret_cast<TSMesh::__TSMeshVertexBase *>(outPtr + inElem.vidx * outStride);
|
||||
|
||||
m.mulP( inElem.vert, &tempPt );
|
||||
m.mulV( inElem.normal, &tempNrm );
|
||||
|
||||
outElem->_vert += ( tempPt * inElem.weight );
|
||||
outElem->_normal += ( tempNrm * inElem.weight );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Initializer.
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -86,11 +58,9 @@ MODULE_BEGIN( TSMeshIntrinsics )
|
|||
{
|
||||
// Assign defaults (C++ versions)
|
||||
zero_vert_normal_bulk = zero_vert_normal_bulk_C;
|
||||
m_matF_x_BatchedVertWeightList = m_matF_x_BatchedVertWeightList_C;
|
||||
|
||||
#if defined(TORQUE_OS_XENON)
|
||||
zero_vert_normal_bulk = zero_vert_normal_bulk_X360;
|
||||
m_matF_x_BatchedVertWeightList = m_matF_x_BatchedVertWeightList_X360;
|
||||
#else
|
||||
// Find the best implementation for the current CPU
|
||||
if(Platform::SystemInfo.processor.properties & CPU_PROP_SSE)
|
||||
|
|
@ -98,21 +68,12 @@ MODULE_BEGIN( TSMeshIntrinsics )
|
|||
#if defined(TORQUE_CPU_X86)
|
||||
|
||||
zero_vert_normal_bulk = zero_vert_normal_bulk_SSE;
|
||||
m_matF_x_BatchedVertWeightList = m_matF_x_BatchedVertWeightList_SSE;
|
||||
|
||||
/* This code still has a bug left in it
|
||||
#if (_MSC_VER >= 1500)
|
||||
if(Platform::SystemInfo.processor.properties & CPU_PROP_SSE4_1)
|
||||
m_matF_x_BatchedVertWeightList = m_matF_x_BatchedVertWeightList_SSE4;
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
else if(Platform::SystemInfo.processor.properties & CPU_PROP_ALTIVEC)
|
||||
{
|
||||
#if !defined(TORQUE_OS_XENON) && defined(TORQUE_CPU_PPC)
|
||||
zero_vert_normal_bulk = zero_vert_normal_bulk_gccvec;
|
||||
m_matF_x_BatchedVertWeightList = m_matF_x_BatchedVertWeightList_gccvec;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue