public static FirstPerson FromGltf(this VrmProtobuf.FirstPerson fp, List <Node> nodes) { var self = new FirstPerson(); // self.m_offset = fp.FirstPersonBoneOffset.ToVector3(); self.Annotations.AddRange(fp.MeshAnnotations .Select(x => new FirstPersonMeshAnnotation(nodes[x.Node.Value], x.FirstPersonType.FromGltf()))); return(self); }
public static VrmProtobuf.FirstPerson ToGltf(this FirstPerson self, List <Node> nodes) { if (self == null) { return(null); } var firstPerson = new VrmProtobuf.FirstPerson { }; foreach (var x in self.Annotations) { firstPerson.MeshAnnotations.Add(new VrmProtobuf.MeshAnnotation { Node = nodes.IndexOfThrow(x.Node), FirstPersonType = EnumUtil.Cast <VrmProtobuf.MeshAnnotation.Types.FirstPersonType>(x.FirstPersonFlag), }); } return(firstPerson); }
public static VrmProtobuf.FirstPerson ToGltf(this FirstPerson self, List <Node> nodes, List <MeshGroup> meshes) { if (self == null) { return(null); } var firstPerson = new VrmProtobuf.FirstPerson { }; foreach (var x in self.Annotations) { firstPerson.MeshAnnotations.Add(new VrmProtobuf.FirstPerson.Types.MeshAnnotation { Mesh = meshes.IndexOfThrow(x.Mesh), FirstPersonType = (VrmProtobuf.FirstPerson.Types.MeshAnnotation.Types.FirstPersonType)x.FirstPersonFlag, }); } return(firstPerson); }