コード例 #1
0
 protected void TransformAttributes(ref Dictionary <string, AttributeAccessor> attributeAccessors)
 {
     // Flip vectors and triangles to the Unity coordinate system.
     if (attributeAccessors.ContainsKey(SemanticProperties.POSITION))
     {
         AttributeAccessor attributeAccessor = attributeAccessors[SemanticProperties.POSITION];
         SchemaExtensions.ConvertVector3CoordinateSpace(ref attributeAccessor, SchemaExtensions.CoordinateSpaceConversionScale);
     }
     if (attributeAccessors.ContainsKey(SemanticProperties.INDICES))
     {
         AttributeAccessor attributeAccessor = attributeAccessors[SemanticProperties.INDICES];
         SchemaExtensions.FlipFaces(ref attributeAccessor);
     }
     if (attributeAccessors.ContainsKey(SemanticProperties.NORMAL))
     {
         AttributeAccessor attributeAccessor = attributeAccessors[SemanticProperties.NORMAL];
         SchemaExtensions.ConvertVector3CoordinateSpace(ref attributeAccessor, SchemaExtensions.CoordinateSpaceConversionScale);
     }
     // TexCoord goes from 0 to 3 to match GLTFHelpers.BuildMeshAttributes
     for (int i = 0; i < 4; i++)
     {
         if (attributeAccessors.ContainsKey(SemanticProperties.TexCoord(i)))
         {
             AttributeAccessor attributeAccessor = attributeAccessors[SemanticProperties.TexCoord(i)];
             SchemaExtensions.FlipTexCoordArrayV(ref attributeAccessor);
         }
     }
     if (attributeAccessors.ContainsKey(SemanticProperties.TANGENT))
     {
         AttributeAccessor attributeAccessor = attributeAccessors[SemanticProperties.TANGENT];
         SchemaExtensions.ConvertVector4CoordinateSpace(ref attributeAccessor, SchemaExtensions.TangentSpaceConversionScale);
     }
 }