mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-10 04:49:28 -05:00
No access to mesh.vertices and mesh.normals and use the arrays around
This commit is contained in:
@@ -166,10 +166,13 @@ namespace UniGLTF
|
||||
var targetNames = new List<string>();
|
||||
|
||||
int exportBlendShapes = 0;
|
||||
Vector3[] blendShapePositions = new Vector3[mesh.vertexCount];
|
||||
Vector3[] blendShapeNormals = new Vector3[mesh.vertexCount];
|
||||
for (int j = 0; j < unityMesh.Mesh.blendShapeCount; ++j)
|
||||
{
|
||||
var morphTarget = ExportMorphTarget(data,
|
||||
unityMesh.Mesh, j,
|
||||
blendShapePositions, blendShapeNormals,
|
||||
settings.UseSparseAccessorForMorphTarget,
|
||||
settings.ExportOnlyBlendShapePosition, axisInverter);
|
||||
if (morphTarget.POSITION < 0)
|
||||
@@ -214,14 +217,13 @@ namespace UniGLTF
|
||||
|
||||
static gltfMorphTarget ExportMorphTarget(ExportingGltfData data,
|
||||
Mesh mesh, int blendShapeIndex,
|
||||
Vector3[] blendShapeVertices, Vector3[] blendShapeNormals,
|
||||
bool useSparseAccessorForMorphTarget,
|
||||
bool exportOnlyBlendShapePosition,
|
||||
IAxisInverter axisInverter)
|
||||
{
|
||||
var blendShapeVertices = mesh.vertices;
|
||||
var usePosition = blendShapeVertices != null && blendShapeVertices.Length > 0;
|
||||
|
||||
var blendShapeNormals = mesh.normals;
|
||||
var useNormal = usePosition && blendShapeNormals != null && blendShapeNormals.Length == blendShapeVertices.Length;
|
||||
// var useNormal = usePosition && blendShapeNormals != null && blendShapeNormals.Length == blendShapeVertices.Length && !exportOnlyBlendShapePosition;
|
||||
|
||||
@@ -244,18 +246,6 @@ namespace UniGLTF
|
||||
blendShapeNormals[i] = axisInverter.InvertVector3(blendShapeNormals[i]);
|
||||
}
|
||||
|
||||
var positions = mesh.vertices;
|
||||
for (int i = 0; i < positions.Length; ++i)
|
||||
{
|
||||
positions[i] = axisInverter.InvertVector3(positions[i]);
|
||||
}
|
||||
|
||||
var normals = mesh.normals;
|
||||
for (int i = 0; i < normals.Length; ++i)
|
||||
{
|
||||
normals[i] = axisInverter.InvertVector3(normals[i]);
|
||||
}
|
||||
|
||||
return BlendShapeExporter.Export(data,
|
||||
blendShapeVertices,
|
||||
exportOnlyBlendShapePosition && useNormal ? null : blendShapeNormals,
|
||||
|
||||
Reference in New Issue
Block a user