Maps from a triangle of the simulated mesh to a vertex of the rendered mesh. The barycentric coordinates describe the position of a point in space relative to a simulated triangle. The actual z-coordinate is computed by bary.z = 1 - bary.x - bary.y. The z part of the vector contains the height of the skinned vertex along the normal of the simulated triangle. More...
#include <ClothingAsset.h>
Public Attributes | |
PxVec3 | positionBary |
Barycentric coordinates of the graphical vertex relative to the simulated triangle. | |
uint32_t | vertexIndex0 |
First vertex of the simulated triangle. | |
PxVec3 | normalBary |
Barycentric coordinates of a point that represents the normal. The actual normal can be extracted by subtracting the skinned position from this point. | |
uint32_t | vertexIndex1 |
Second vertex of the simulated triangle. | |
PxVec3 | tangentBary |
Barycentric coordinates of a point that represents the tangent. The actual tangent can be extracted by subtracting the skinned position from this point. | |
uint32_t | vertexIndex2 |
Third vertex of the simulated triangle. |
Maps from a triangle of the simulated mesh to a vertex of the rendered mesh. The barycentric coordinates describe the position of a point in space relative to a simulated triangle. The actual z-coordinate is computed by bary.z = 1 - bary.x - bary.y. The z part of the vector contains the height of the skinned vertex along the normal of the simulated triangle.
So, the following computes the new skinned position:
uint32_t i0 = map[mapId].vertexIndex0; uint32_t i1 = map[mapId].vertexIndex1; uint32_t i2 = map[mapId].vertexIndex2;
PxVec3 bary = map[mapId].positionBary; float heightOffset = bary.z * actorScale; bary.z = (1 - bary.x - bary.y);
PxVec3 posOnTriangle = physPositions[i0] * bary.x + physPositions[i1] * bary.y + physPositions[i2] * bary.z;
offsetFromTriangle = (physNormals[i0] * bary.x + physNormals[i1] * bary.y + physNormals[i2] * bary.z) heightOffset;
skinnedPos = posOnTriangle + offsetFromTriangle;
Barycentric coordinates of a point that represents the normal. The actual normal can be extracted by subtracting the skinned position from this point.
Barycentric coordinates of the graphical vertex relative to the simulated triangle.
Barycentric coordinates of a point that represents the tangent. The actual tangent can be extracted by subtracting the skinned position from this point.