Definition in file mesh_mrm_skin_template.cpp.
Go to the source code of this file.
Defines | |
| #define | NL3D_RAWSKIN_NORMAL_OFF 12 |
| #define | NL3D_RAWSKIN_NORMAL_OFF 12 |
| #define | NL3D_RAWSKIN_UV_OFF 24 |
| #define | NL3D_RAWSKIN_UV_OFF 24 |
| #define | NL3D_RAWSKIN_VERTEX_SIZE 32 |
| #define | NL3D_RAWSKIN_VERTEX_SIZE 32 |
Functions | |
| void | applyArraySkinNormalT (uint numMatrixes, uint32 *infPtr, CMesh::CSkinWeight *srcSkinPtr, CVector *srcVertexPtr, CVector *srcNormalPtr, uint normalOff, uint8 *destVertexPtr, vector< CMatrix3x4 > &boneMat3x4, uint vertexSize, uint nInf) |
| void | applyArraySkinTangentSpaceT (uint numMatrixes, uint32 *infPtr, CMesh::CSkinWeight *srcSkinPtr, CVector *srcVertexPtr, CVector *srcNormalPtr, CVector *tgSpacePtr, uint normalOff, uint tgSpaceOff, uint8 *destVertexPtr, vector< CMatrix3x4 > &boneMat3x4, uint vertexSize, uint nInf) |
|
|
Definition at line 482 of file mesh_mrm_skin_template.cpp. |
|
|
Definition at line 482 of file mesh_mrm_skin_template.cpp. |
|
|
Definition at line 483 of file mesh_mrm_skin_template.cpp. |
|
|
Definition at line 483 of file mesh_mrm_skin_template.cpp. |
|
|
Definition at line 484 of file mesh_mrm_skin_template.cpp. |
|
|
Definition at line 484 of file mesh_mrm_skin_template.cpp. |
|
||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 36 of file mesh_mrm_skin_template.cpp. References index, uint, uint32, and uint8.
00039 {
00040 /* Prefetch all vertex/normal before, it is to be faster.
00041 */
00042 #ifdef NL_OS_WINDOWS
00043 {
00044 uint nInfTmp= nInf;
00045 uint32 *infTmpPtr= infPtr;
00046 for(;nInfTmp>0;nInfTmp--, infTmpPtr++)
00047 {
00048 uint index= *infTmpPtr;
00049 CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
00050 CVector *srcVertex= srcVertexPtr + index;
00051 CVector *srcNormal= srcNormalPtr + index;
00052
00053 __asm
00054 {
00055 mov eax, srcSkin
00056 mov ebx, srcVertex
00057 mov ecx, srcNormal
00058 mov edx, [eax]
00059 mov edx, [ebx]
00060 mov edx, [ecx]
00061 }
00062
00063 }
00064 }
00065 #endif
00066
00067 // Process vertices.
00068 switch(numMatrixes)
00069 {
00070 //=========
00071 case 0:
00072 // Special case for Vertices influenced by one matrix. Just copy result of mul.
00073 // for all InfluencedVertices only.
00074 for(;nInf>0;nInf--, infPtr++)
00075 {
00076 uint index= *infPtr;
00077 CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
00078 CVector *srcVertex= srcVertexPtr + index;
00079 CVector *srcNormal= srcNormalPtr + index;
00080 uint8 *dstVertexVB= destVertexPtr + index * vertexSize;
00081 CVector *dstVertex= (CVector*)(dstVertexVB);
00082 CVector *dstNormal= (CVector*)(dstVertexVB + normalOff);
00083
00084
00085 // Vertex.
00086 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetPoint( *srcVertex, *dstVertex);
00087 // Normal.
00088 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcNormal, *dstNormal);
00089 }
00090 break;
00091
00092 //=========
00093 case 1:
00094 // for all InfluencedVertices only.
00095 for(;nInf>0;nInf--, infPtr++)
00096 {
00097 uint index= *infPtr;
00098 CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
00099 CVector *srcVertex= srcVertexPtr + index;
00100 CVector *srcNormal= srcNormalPtr + index;
00101 uint8 *dstVertexVB= destVertexPtr + index * vertexSize;
00102 CVector *dstVertex= (CVector*)(dstVertexVB);
00103 CVector *dstNormal= (CVector*)(dstVertexVB + normalOff);
00104
00105
00106 // Vertex.
00107 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetPoint( *srcVertex, srcSkin->Weights[0], *dstVertex);
00108 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddPoint( *srcVertex, srcSkin->Weights[1], *dstVertex);
00109 // Normal.
00110 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcNormal, srcSkin->Weights[0], *dstNormal);
00111 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddVector( *srcNormal, srcSkin->Weights[1], *dstNormal);
00112 }
00113 break;
00114
00115 //=========
00116 case 2:
00117 // for all InfluencedVertices only.
00118 for(;nInf>0;nInf--, infPtr++)
00119 {
00120 uint index= *infPtr;
00121 CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
00122 CVector *srcVertex= srcVertexPtr + index;
00123 CVector *srcNormal= srcNormalPtr + index;
00124 uint8 *dstVertexVB= destVertexPtr + index * vertexSize;
00125 CVector *dstVertex= (CVector*)(dstVertexVB);
00126 CVector *dstNormal= (CVector*)(dstVertexVB + normalOff);
00127
00128
00129 // Vertex.
00130 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetPoint( *srcVertex, srcSkin->Weights[0], *dstVertex);
00131 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddPoint( *srcVertex, srcSkin->Weights[1], *dstVertex);
00132 boneMat3x4[ srcSkin->MatrixId[2] ].mulAddPoint( *srcVertex, srcSkin->Weights[2], *dstVertex);
00133 // Normal.
00134 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcNormal, srcSkin->Weights[0], *dstNormal);
00135 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddVector( *srcNormal, srcSkin->Weights[1], *dstNormal);
00136 boneMat3x4[ srcSkin->MatrixId[2] ].mulAddVector( *srcNormal, srcSkin->Weights[2], *dstNormal);
00137 }
00138 break;
00139
00140 //=========
00141 case 3:
00142 // for all InfluencedVertices only.
00143 for(;nInf>0;nInf--, infPtr++)
00144 {
00145 uint index= *infPtr;
00146 CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
00147 CVector *srcVertex= srcVertexPtr + index;
00148 CVector *srcNormal= srcNormalPtr + index;
00149 uint8 *dstVertexVB= destVertexPtr + index * vertexSize;
00150 CVector *dstVertex= (CVector*)(dstVertexVB);
00151 CVector *dstNormal= (CVector*)(dstVertexVB + normalOff);
00152
00153
00154 // Vertex.
00155 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetPoint( *srcVertex, srcSkin->Weights[0], *dstVertex);
00156 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddPoint( *srcVertex, srcSkin->Weights[1], *dstVertex);
00157 boneMat3x4[ srcSkin->MatrixId[2] ].mulAddPoint( *srcVertex, srcSkin->Weights[2], *dstVertex);
00158 boneMat3x4[ srcSkin->MatrixId[3] ].mulAddPoint( *srcVertex, srcSkin->Weights[3], *dstVertex);
00159 // Normal.
00160 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcNormal, srcSkin->Weights[0], *dstNormal);
00161 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddVector( *srcNormal, srcSkin->Weights[1], *dstNormal);
00162 boneMat3x4[ srcSkin->MatrixId[2] ].mulAddVector( *srcNormal, srcSkin->Weights[2], *dstNormal);
00163 boneMat3x4[ srcSkin->MatrixId[3] ].mulAddVector( *srcNormal, srcSkin->Weights[3], *dstNormal);
00164 }
00165 break;
00166
00167 }
00168 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 173 of file mesh_mrm_skin_template.cpp. References index, uint, uint32, and uint8.
00176 {
00177 /* Prefetch all vertex/normal/tgSpace before, it is faster.
00178 */
00179 #ifdef NL_OS_WINDOWS
00180 {
00181 uint nInfTmp= nInf;
00182 uint32 *infTmpPtr= infPtr;
00183 for(;nInfTmp>0;nInfTmp--, infTmpPtr++)
00184 {
00185 uint index= *infTmpPtr;
00186 CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
00187 CVector *srcVertex= srcVertexPtr + index;
00188 CVector *srcNormal= srcNormalPtr + index;
00189 CVector *srcTgSpace= tgSpacePtr + index;
00190
00191 __asm
00192 {
00193 mov eax, srcSkin
00194 mov ebx, srcVertex
00195 mov ecx, srcNormal
00196 mov esi, srcTgSpace
00197 mov edx, [eax]
00198 mov edx, [ebx]
00199 mov edx, [ecx]
00200 mov edx, [esi]
00201 }
00202
00203 }
00204 }
00205 #endif
00206
00207 // Process vertices.
00208 switch(numMatrixes)
00209 {
00210 //=========
00211 case 0:
00212 // Special case for Vertices influenced by one matrix. Just copy result of mul.
00213 // for all InfluencedVertices only.
00214 for(;nInf>0;nInf--, infPtr++)
00215 {
00216 uint index= *infPtr;
00217 CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
00218 CVector *srcVertex= srcVertexPtr + index;
00219 CVector *srcNormal= srcNormalPtr + index;
00220 CVector *srcTgSpace= tgSpacePtr + index;
00221 //
00222 uint8 *dstVertexVB= destVertexPtr + index * vertexSize;
00223 CVector *dstVertex= (CVector*)(dstVertexVB);
00224 CVector *dstNormal= (CVector*)(dstVertexVB + normalOff);
00225 CVector *dstTgSpace= (CVector*)(dstVertexVB + tgSpaceOff);
00226
00227
00228
00229 // Vertex.
00230 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetPoint( *srcVertex, *dstVertex);
00231 // Normal.
00232 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcNormal, *dstNormal);
00233 // Tg space
00234 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcTgSpace, *dstTgSpace);
00235
00236 }
00237 break;
00238
00239 //=========
00240 case 1:
00241 // for all InfluencedVertices only.
00242 for(;nInf>0;nInf--, infPtr++)
00243 {
00244 uint index= *infPtr;
00245 CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
00246 CVector *srcVertex= srcVertexPtr + index;
00247 CVector *srcNormal= srcNormalPtr + index;
00248 CVector *srcTgSpace= tgSpacePtr + index;
00249 //
00250 uint8 *dstVertexVB= destVertexPtr + index * vertexSize;
00251 CVector *dstVertex= (CVector*)(dstVertexVB);
00252 CVector *dstNormal= (CVector*)(dstVertexVB + normalOff);
00253 CVector *dstTgSpace= (CVector*)(dstVertexVB + tgSpaceOff);
00254
00255 // Vertex.
00256 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetPoint( *srcVertex, srcSkin->Weights[0], *dstVertex);
00257 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddPoint( *srcVertex, srcSkin->Weights[1], *dstVertex);
00258 // Normal.
00259 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcNormal, srcSkin->Weights[0], *dstNormal);
00260 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddVector( *srcNormal, srcSkin->Weights[1], *dstNormal);
00261 // Tg space
00262 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcTgSpace, srcSkin->Weights[0], *dstTgSpace);
00263 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddVector( *srcTgSpace, srcSkin->Weights[1], *dstTgSpace);
00264 }
00265 break;
00266
00267 //=========
00268 case 2:
00269 // for all InfluencedVertices only.
00270 for(;nInf>0;nInf--, infPtr++)
00271 {
00272 uint index= *infPtr;
00273 CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
00274 CVector *srcVertex= srcVertexPtr + index;
00275 CVector *srcNormal= srcNormalPtr + index;
00276 CVector *srcTgSpace= tgSpacePtr + index;
00277 //
00278 uint8 *dstVertexVB= destVertexPtr + index * vertexSize;
00279 CVector *dstVertex= (CVector*)(dstVertexVB);
00280 CVector *dstNormal= (CVector*)(dstVertexVB + normalOff);
00281 CVector *dstTgSpace= (CVector*)(dstVertexVB + tgSpaceOff);
00282
00283 // Vertex.
00284 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetPoint( *srcVertex, srcSkin->Weights[0], *dstVertex);
00285 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddPoint( *srcVertex, srcSkin->Weights[1], *dstVertex);
00286 boneMat3x4[ srcSkin->MatrixId[2] ].mulAddPoint( *srcVertex, srcSkin->Weights[2], *dstVertex);
00287 // Normal.
00288 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcNormal, srcSkin->Weights[0], *dstNormal);
00289 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddVector( *srcNormal, srcSkin->Weights[1], *dstNormal);
00290 boneMat3x4[ srcSkin->MatrixId[2] ].mulAddVector( *srcNormal, srcSkin->Weights[2], *dstNormal);
00291 // Tg space
00292 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcTgSpace, srcSkin->Weights[0], *dstTgSpace);
00293 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddVector( *srcTgSpace, srcSkin->Weights[1], *dstTgSpace);
00294 boneMat3x4[ srcSkin->MatrixId[2] ].mulAddVector( *srcTgSpace, srcSkin->Weights[2], *dstTgSpace);
00295 }
00296 break;
00297
00298 //=========
00299 case 3:
00300 // for all InfluencedVertices only.
00301 for(;nInf>0;nInf--, infPtr++)
00302 {
00303 uint index= *infPtr;
00304 CMesh::CSkinWeight *srcSkin= srcSkinPtr + index;
00305 CVector *srcVertex= srcVertexPtr + index;
00306 CVector *srcNormal= srcNormalPtr + index;
00307 CVector *srcTgSpace= tgSpacePtr + index;
00308 //
00309 uint8 *dstVertexVB= destVertexPtr + index * vertexSize;
00310 CVector *dstVertex= (CVector*)(dstVertexVB);
00311 CVector *dstNormal= (CVector*)(dstVertexVB + normalOff);
00312 CVector *dstTgSpace= (CVector*)(dstVertexVB + tgSpaceOff);
00313
00314 // Vertex.
00315 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetPoint( *srcVertex, srcSkin->Weights[0], *dstVertex);
00316 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddPoint( *srcVertex, srcSkin->Weights[1], *dstVertex);
00317 boneMat3x4[ srcSkin->MatrixId[2] ].mulAddPoint( *srcVertex, srcSkin->Weights[2], *dstVertex);
00318 boneMat3x4[ srcSkin->MatrixId[3] ].mulAddPoint( *srcVertex, srcSkin->Weights[3], *dstVertex);
00319 // Normal.
00320 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcNormal, srcSkin->Weights[0], *dstNormal);
00321 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddVector( *srcNormal, srcSkin->Weights[1], *dstNormal);
00322 boneMat3x4[ srcSkin->MatrixId[2] ].mulAddVector( *srcNormal, srcSkin->Weights[2], *dstNormal);
00323 boneMat3x4[ srcSkin->MatrixId[3] ].mulAddVector( *srcNormal, srcSkin->Weights[3], *dstNormal);
00324 // Tg space
00325 boneMat3x4[ srcSkin->MatrixId[0] ].mulSetVector( *srcTgSpace, srcSkin->Weights[0], *dstTgSpace);
00326 boneMat3x4[ srcSkin->MatrixId[1] ].mulAddVector( *srcTgSpace, srcSkin->Weights[1], *dstTgSpace);
00327 boneMat3x4[ srcSkin->MatrixId[2] ].mulAddVector( *srcTgSpace, srcSkin->Weights[2], *dstTgSpace);
00328 boneMat3x4[ srcSkin->MatrixId[3] ].mulAddVector( *srcTgSpace, srcSkin->Weights[3], *dstTgSpace);
00329 }
00330 break;
00331
00332 }
00333
00334 }
|
1.3.6