public SpriteVertex Clone() { SpriteVertex clone = new SpriteVertex(); clone.pos = pos; return(clone); }
public void LoadFrom(Stream stream) { BinaryReader reader = new BinaryReader(stream); texture = new PPtr <Texture2D>(stream, file); int numVertices = reader.ReadInt32(); vertices = new SpriteVertex[numVertices]; for (int i = 0; i < numVertices; i++) { vertices[i] = new SpriteVertex(stream); } int numIndices = reader.ReadInt32(); indices = reader.ReadUInt16Array(numIndices); if ((numIndices & 1) > 0) { reader.ReadBytes(2); } textureRect = new Rectf(stream); textureRectOffset = reader.ReadVector2(); settingsRaw = reader.ReadUInt32(); uvTransform = reader.ReadVector4(); }
public void LoadFrom(Stream stream) { BinaryReader reader = new BinaryReader(stream); texture = new PPtr <Texture2D>(stream, file); if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0) { alphaTexture = new PPtr <Texture2D>(stream, file); } if (file.VersionNumber < AssetCabinet.VERSION_5_6_2) { int numVertices = reader.ReadInt32(); vertices = new SpriteVertex[numVertices]; for (int i = 0; i < numVertices; i++) { vertices[i] = new SpriteVertex(stream); } int numIndices = reader.ReadInt32(); indices = reader.ReadUInt16Array(numIndices); if ((numIndices & 1) > 0) { stream.Position += 2; } } else { int numSubmeshes = reader.ReadInt32(); m_SubMeshes = new List <SubMesh>(numSubmeshes); for (int i = 0; i < numSubmeshes; i++) { m_SubMeshes.Add(new SubMesh(stream)); } int indexBufferSize = reader.ReadInt32(); m_IndexBuffer = reader.ReadBytes(indexBufferSize); if ((indexBufferSize & 3) > 0) { stream.Position += 4 - (indexBufferSize & 3); } m_VertexData = new VertexData(stream, true); } textureRect = new Rectf(stream); textureRectOffset = reader.ReadVector2(); if (file.VersionNumber >= AssetCabinet.VERSION_5_5_0) { atlasRectOffset = reader.ReadVector2(); } settingsRaw = reader.ReadUInt32(); uvTransform = reader.ReadVector4(); }
public SpriteVertex Clone() { SpriteVertex clone = new SpriteVertex(); clone.pos = pos; return clone; }
public void LoadFrom(Stream stream) { BinaryReader reader = new BinaryReader(stream); texture = new PPtr<Texture2D>(stream, file); int numVertices = reader.ReadInt32(); vertices = new SpriteVertex[numVertices]; for (int i = 0; i < numVertices; i++) { vertices[i] = new SpriteVertex(stream); } int numIndices = reader.ReadInt32(); indices = reader.ReadUInt16Array(numIndices); if ((numIndices & 1) > 0) { reader.ReadBytes(2); } textureRect = new Rectf(stream); textureRectOffset = reader.ReadVector2(); settingsRaw = reader.ReadUInt32(); uvTransform = reader.ReadVector4(); }