public static ActorImage Read(Actor actor, BinaryReader reader, ActorImage node = null) { if (node == null) { node = new ActorImage(); } ActorNode.Read(actor, reader, node); bool isVisible = reader.ReadByte() != 0; if (isVisible) { node.m_BlendMode = (BlendModes)reader.ReadByte(); node.m_DrawOrder = (int)reader.ReadUInt16(); node.m_TextureIndex = (int)reader.ReadByte(); int numConnectedBones = (int)reader.ReadByte(); if (numConnectedBones != 0) { node.m_BoneConnections = new BoneConnection[numConnectedBones]; for (int i = 0; i < numConnectedBones; i++) { BoneConnection bc = new BoneConnection(); bc.m_BoneIdx = reader.ReadUInt16(); Actor.ReadFloat32Array(reader, bc.m_Bind.Values); Mat2D.Invert(bc.m_InverseBind, bc.m_Bind); node.m_BoneConnections[i] = bc; } Mat2D worldOverride = new Mat2D(); Actor.ReadFloat32Array(reader, worldOverride.Values); node.WorldTransformOverride = worldOverride; } uint numVertices = reader.ReadUInt32(); int vertexStride = numConnectedBones > 0 ? 12 : 4; node.m_VertexCount = (int)numVertices; node.m_Vertices = new float[numVertices * vertexStride]; Actor.ReadFloat32Array(reader, node.m_Vertices); uint numTris = reader.ReadUInt32(); node.m_Triangles = new ushort[numTris * 3]; node.m_TriangleCount = (int)numTris; Actor.ReadUInt16Array(reader, node.m_Triangles); } return(node); }
public static ActorColliderLine Read(Actor actor, BinaryReader reader, ActorColliderLine property = null) { if (property == null) { property = new ActorColliderLine(); } ActorCollider.Read(actor, reader, property); int numVertices = (int)reader.ReadUInt32(); property.m_Vertices = new float[numVertices * 2]; Actor.ReadFloat32Array(reader, property.m_Vertices); return(property); }
public static ActorNode Read(Actor actor, BinaryReader reader, ActorNode node = null) { if (node == null) { node = new ActorNode(); } ActorComponent.Read(actor, reader, node); Actor.ReadFloat32Array(reader, node.m_Translation.Values); node.m_Rotation = reader.ReadSingle(); Actor.ReadFloat32Array(reader, node.m_Scale.Values); node.m_Opacity = reader.ReadSingle(); if (actor.Version >= 13) { node.m_IsCollapsedVisibility = reader.ReadByte() == 1; } return(node); }