예제 #1
0
 public int GetNormalIndex(CIwVec3 v)
 {
     int i;
     if (normals.TryGetValue(v, out i))
         return i;
     i = TargetMesh.VertNorms.Normals.Count;
     TargetMesh.VertNorms.Normals.Add(v);
     normals[v] = i;
     return i;
 }
예제 #2
0
        public int GetPositionIndex(CIwVec3 v, CIwAnimSkinSetKey bonesKey, IList<float> w)
        {
            int i;
            if (positions.TryGetValue(v, out i))
                return i;
            i = TargetMesh.Verts.Positions.Count;
            TargetMesh.Verts.Positions.Add(v);
            positions[v] = i;

            if (modelMesh.Skin != null)
            {
                int animSetId = 0;
                if (!animSets.TryGetValue(bonesKey, out animSetId))
                {
                    animSetId = modelMesh.Skin.SkinSets.Count;
                    animSets[bonesKey] = animSetId;
                    modelMesh.Skin.SkinSets.Add(new CIwAnimSkinSet() { useBones = bonesKey });
                }
                modelMesh.Skin.SkinSets[animSetId].vertWeights.Add(GetSortedWeights(i, modelMesh.Skin.SkinSets[animSetId].useBones, bonesKey, w));
            }

            return i;
        }
예제 #3
0
 public int GetPositionIndex(CIwVec3 v)
 {
     return GetPositionIndex(v, new CIwAnimSkinSetKey(), null);
 }
예제 #4
0
        public CTrisVertex GetVertex(CIwVec3 p, CIwAnimSkinSetKey bonesKey, IList<float> w, CIwVec3 n, CIwVec2 uv0, CIwVec2 uv1, CIwColour col)
        {
            int vertexIndex = GetPositionIndex(p,bonesKey,w);

            return new CTrisVertex(vertexIndex, GetNormalIndex(n), GetUV0Index(uv0), GetUV1Index(uv1), GetColorIndex(col));
        }