public void Read(AssetReader reader) { Vertices.Read(reader); UV.Read(reader); if (IsReadBindPoses(reader.Version)) { BindPoses.Read(reader); } Normals.Read(reader); Tangents.Read(reader); Weight.Read(reader); NormalSigns.Read(reader); TangentSigns.Read(reader); if (IsReadFloatColors(reader.Version)) { FloatColors.Read(reader); } BoneIndices.Read(reader); Triangles.Read(reader); if (IsReadColors(reader.Version)) { Colors.Read(reader); } if (IsReadUVInfo(reader.Version)) { UVInfo = reader.ReadUInt32(); } }
public void Write(AssetWriter writer) { Vertices.Write(writer); UV.Write(writer); if (HasBindPoses(writer.Version)) { BindPoses.Write(writer); } Normals.Write(writer); Tangents.Write(writer); Weights.Write(writer); NormalSigns.Write(writer); TangentSigns.Write(writer); if (HasFloatColors(writer.Version)) { FloatColors.Write(writer); } BoneIndices.Write(writer); Triangles.Write(writer); if (HasColors(writer.Version)) { Colors.Write(writer); } if (HasUVInfo(writer.Version)) { writer.Write(UVInfo); } }
public YAMLNode ExportYAML(IExportContainer container) { YAMLMappingNode node = new YAMLMappingNode(); node.Add(VerticesName, Vertices.ExportYAML(container)); node.Add(UVName, UV.ExportYAML(container)); if (HasBindPoses(container.ExportVersion)) { node.Add(BindPosesName, BindPoses.ExportYAML(container)); } node.Add(NormalsName, Normals.ExportYAML(container)); node.Add(TangentsName, Tangents.ExportYAML(container)); node.Add(WeightsName, Weights.ExportYAML(container)); node.Add(NormalSignsName, NormalSigns.ExportYAML(container)); node.Add(TangentSignsName, TangentSigns.ExportYAML(container)); if (HasFloatColors(container.ExportVersion)) { node.Add(FloatColorsName, FloatColors.ExportYAML(container)); } node.Add(BoneIndicesName, BoneIndices.ExportYAML(container)); node.Add(TrianglesName, Triangles.ExportYAML(container)); if (HasColors(container.ExportVersion)) { node.Add(ColorsName, Colors.ExportYAML(container)); } if (HasUVInfo(container.ExportVersion)) { node.Add(UVInfoName, UVInfo); } return(node); }
public odfVertex Clone() { odfVertex newVert = new odfVertex(); newVert.Position = Position; newVert.Weights = (float[])Weights.Clone(); newVert.Normal = Normal; newVert.BoneIndices = (byte[])BoneIndices.Clone(); newVert.UV = UV; return(newVert); }
public xxVertex Clone() { xxVertex vertex = InitClone(); vertex.Index = Index; vertex.Position = Position; vertex.Weights3 = (float[])Weights3.Clone(); vertex.BoneIndices = (byte[])BoneIndices.Clone(); vertex.Normal = Normal; vertex.UV = (float[])UV.Clone(); vertex.Unknown1 = Unknown1.CloneIfNotNull(); return(vertex); }
// Reorder the weights by their bone indices. // This is so that two weights that are identical except for having the bones in a different order are properly considered duplicates. public void reorderBones() { if (WeightCount < 2) { return; } // Use Array.Sort to simultaneously sort the bone indices and the weights by the same order as the bone indices. var weightsArray = Weights.ToArray(); var boneIndicesArray = BoneIndices.ToArray(); Array.Sort(boneIndicesArray, weightsArray); Weights = weightsArray.ToList(); BoneIndices = boneIndicesArray.ToList(); }
public YAMLNode ExportYAML(IExportContainer container) { YAMLMappingNode node = new YAMLMappingNode(); node.Add("m_Vertices", Vertices.ExportYAML(container)); node.Add("m_UV", UV.ExportYAML(container)); node.Add("m_Normals", Normals.ExportYAML(container)); node.Add("m_Tangents", Tangents.ExportYAML(container)); node.Add("m_Weights", Weight.ExportYAML(container)); node.Add("m_NormalSigns", NormalSigns.ExportYAML(container)); node.Add("m_TangentSigns", TangentSigns.ExportYAML(container)); node.Add("m_FloatColors", IsReadFloatColors(container.Version) ? FloatColors.ExportYAML(container) : default(PackedFloatVector).ExportYAML(container)); node.Add("m_BoneIndices", BoneIndices.ExportYAML(container)); node.Add("m_Triangles", Triangles.ExportYAML(container)); node.Add("m_UVInfo", UVInfo); return(node); }
public YAMLNode ExportYAML(IAssetsExporter exporter) { #warning TODO: values acording to read version (current 2017.3.0f3) YAMLMappingNode node = new YAMLMappingNode(); node.Add("m_Vertices", Vertices.ExportYAML(exporter)); node.Add("m_UV", UV.ExportYAML(exporter)); node.Add("m_Normals", Normals.ExportYAML(exporter)); node.Add("m_Tangents", Tangents.ExportYAML(exporter)); node.Add("m_Weights", Weight.ExportYAML(exporter)); node.Add("m_NormalSigns", NormalSigns.ExportYAML(exporter)); node.Add("m_TangentSigns", TangentSigns.ExportYAML(exporter)); node.Add("m_FloatColors", IsReadFloatColors(exporter.Version) ? FloatColors.ExportYAML(exporter) : default(PackedFloatVector).ExportYAML(exporter)); node.Add("m_BoneIndices", BoneIndices.ExportYAML(exporter)); node.Add("m_Triangles", Triangles.ExportYAML(exporter)); node.Add("m_UVInfo", UVInfo); return(node); }
public void Read(EndianStream stream) { if (IsReadMeshData) { Vertices.Read(stream); UV.Read(stream); if (IsReadBindPoses) { BindPoses.Read(stream); } Normals.Read(stream); Tangents.Read(stream); Weight.Read(stream); NormalSigns.Read(stream); TangentSigns.Read(stream); if (IsReadFloatColors) { FloatColors.Read(stream); } BoneIndices.Read(stream); Triangles.Read(stream); } if (IsReadPlainColors) { LocalAABB.Read(stream); m_plainColors = stream.ReadArray <Color>(); #warning TODO: todo what? m_collisionTriangles = stream.ReadByteArray(); CollisionVertexCount = stream.ReadInt32(); } else { if (IsReadCompressedColors) { Colors.Read(stream); } else { UVInfo = stream.ReadUInt32(); } } }
public sbyte FindOrAddBoneIndex(string boneName) { for (int i = 0; i < BoneIndices.Count; i++) { if (ContainingFlver.Bones[BoneIndices[i]].Name == boneName) { return((sbyte)i); } } for (int i = 0; i < ContainingFlver.Bones.Count; i++) { if (ContainingFlver.Bones[i].Name == boneName) { BoneIndices.Add(i); return((sbyte)(BoneIndices.Count - 1)); } } return(-1); }
public YAMLNode ExportYAML() { #warning TODO: support different versions YAMLMappingNode node = new YAMLMappingNode(); node.Add("m_Vertices", Vertices.ExportYAML()); node.Add("m_UV", UV.ExportYAML()); node.Add("m_Normals", Normals.ExportYAML()); node.Add("m_Tangents", Tangents.ExportYAML()); node.Add("m_Weights", Weight.ExportYAML()); node.Add("m_NormalSigns", NormalSigns.ExportYAML()); node.Add("m_TangentSigns", TangentSigns.ExportYAML()); if (IsReadFloatColors) { node.Add("m_FloatColors", FloatColors.ExportYAML()); } else { node.Add("m_FloatColors", PackedFloatVector.Empty.ExportYAML()); } node.Add("m_BoneIndices", BoneIndices.ExportYAML()); node.Add("m_Triangles", Triangles.ExportYAML()); node.Add("m_UVInfo", UVInfo); return(node); }
public void AddWeight(float weight, int boneIndex) { Weights.Add(weight); BoneIndices.Add(boneIndex); WeightCount++; }
public static Byte4 ToByte4(this BoneIndices boneIndices) => new Byte4(boneIndices.b0, boneIndices.b1, boneIndices.b2, boneIndices.b3);