private void AddCommand(string bindingName, Function func) { ISubMesh submesh = this.As <ISubMesh>(); IEnumerable <IDataSet> datasets; if (submesh != null) { datasets = submesh.DataSets; } else { IMesh mesh = TryGetMesh(); datasets = mesh.DataSets; } int bindingIndex = m_primitives.FindBinding(bindingName); if (bindingIndex != -1) { // Find the data Set foreach (IDataSet dataSet in datasets) { if (dataSet.Name == bindingName) { DrawCommand cmd = new DrawCommand(func, bindingIndex, dataSet.Data, dataSet.ElementSize); m_commands.Add(cmd); if (func == Function.glVertex3fv) { m_vxCommand = cmd; } break; } } } }
/// <summary> /// Copy an existing voxel mesh. /// </summary> /// <param name="toCopy"></param> public SubMesh(ISubMesh toCopy) : base() { this._dimensions = new Dimensions3D(toCopy.Width, toCopy.Height, toCopy.Depth); this._parentMesh = toCopy.ParentMesh; this._start = new VoxelLocation(toCopy.Offset); }