public Mesh(RenderModelSectionBlock sectionBlock) { if (sectionBlock.sectionData.Length == 0) sectionBlock.LoadSectionData(); this.sectionBlock = sectionBlock; BufferMeshResources(sectionBlock); }
public virtual RenderModelSectionBlock[] ReadSections(BinaryReader binaryReader) { var elementSize = Marshal.SizeOf(typeof(RenderModelSectionBlock)); var blamPointer = binaryReader.ReadBlamPointer(elementSize); var sections = new RenderModelSectionBlock[blamPointer.Count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < blamPointer.Count; ++i) { binaryReader.BaseStream.Position = blamPointer[i]; sections[i] = new RenderModelSectionBlock(binaryReader); } } return sections; }
private void BufferMeshResources(RenderModelSectionBlock section) { if (section.sectionData.Count() > 0) { mVBO_ids = new List<int>(); mVAO_id = GL.GenVertexArray(); GL.BindVertexArray(mVAO_id); BufferElementArrayData(section.sectionData[0].section.stripIndices.Select(x => x.index).ToArray()); BufferVertexAttributeData(section.sectionData[0].section.vertexBuffers.Select(x => x.vertexBuffer).ToArray()); GL.BindVertexArray(0); } }