Engines/FlatRedBallXNA/FlatRedBall.Content/ModelAnimation/X File/XMeshImporter.cs
/// <summary>
/// Adds all the buffered channels to the mesh and merges duplicate positions/verts
/// </summary>
Adds all the buffered channels to the mesh and merges duplicate positions/verts
Adds all the buffered channels to the mesh and merges duplicate positions / verts
private void AddAllChannels()
            {
                bool recalcNormal = false;
               if (model.AnimationOptions.Contains("RecalcNormals") || (normals == null && !hasNormals))
                   recalcNormal=true;
               else
                    AddChannel<Vector3>(VertexElementUsage.Normal.ToString() + "0", normals);
                if (texCoords != null)
                    AddChannel<Vector2>("TextureCoordinate0", texCoords);
                bool isSkinned = false;
                foreach (BoneWeightCollection bwc in skinInfo)
                {
                    if (bwc.Count > 0)
                    {
                        isSkinned = true;
                        break;
                    }
                }
                if (isSkinned)
                {
                    AddChannel<BoneWeightCollection>(VertexChannelNames.Weights(), skinInfo.ToArray());
                }
                MeshHelper.MergeDuplicatePositions(mesh, 0);
                MeshHelper.MergeDuplicateVertices(mesh);
                if (recalcNormal)
                    MeshHelper.CalculateNormals(mesh, true);
                MeshHelper.OptimizeForCache(mesh);
            }
private void AddAllChannels ( ) { bool recalcNormal = false ; if ( model . AnimationOptions . Contains ( " " ) || ( normals == null && ! hasNormals ) ) recalcNormal = true ; else AddChannel < Vector3 > ( VertexElementUsage . Normal . ToString ( ) + " " , normals ) ; if ( texCoords != null ) AddChannel < Vector2 > ( " " , texCoords ) ; bool isSkinned = false ; foreach ( BoneWeightCollection bwc in skinInfo ) { if ( bwc . Count > 0 ) { isSkinned = true ; break ; } } if ( isSkinned ) { AddChannel < BoneWeightCollection > ( VertexChannelNames . Weights ( ) , skinInfo . ToArray ( ) ) ; } MeshHelper . MergeDuplicatePositions ( mesh , 0 ) ; MeshHelper . MergeDuplicateVertices ( mesh ) ; if ( recalcNormal ) MeshHelper . CalculateNormals ( mesh , true ) ; MeshHelper . OptimizeForCache ( mesh ) ; }
Adds all the buffered channels to the mesh and merges duplicate positions/verts
Adds all the buffered channels to the mesh and merges duplicate positions / verts
//for (int i = 0; i < weightIndices.Count; i++) //{ //    AddChannel<Byte4>(VertexElementUsage.BlendIndices.ToString() + i.ToString(), //        weightIndices[i]); //} //for (int i = 0; i < weights.Count; i++) //{ //    AddChannel<Vector4>(VertexElementUsage.BlendWeight.ToString() + i.ToString(), //        weights[i]); //}