public BufferView CreateBufferView(Buffer buffer, int?byteLength = null, int?byteOffset = null, int?byteStride = null, BufferMode?target = null) { Guard.NotNull(buffer, nameof(buffer)); Guard.MustShareLogicalParent(this, buffer, nameof(buffer)); var bv = new BufferView(buffer, byteLength, byteOffset, byteStride, target); this._bufferViews.Add(bv); return(bv); }
internal void SetData(BufferView buffer, int byteOffset, ComponentType encoding, ElementType dimensions, int count) { Guard.NotNull(buffer, nameof(buffer)); Guard.MustShareLogicalParent(this, buffer, nameof(buffer)); Guard.MustBeGreaterThanOrEqualTo(byteOffset, 0, nameof(byteOffset)); Guard.MustBeGreaterThan(count, 0, nameof(count)); this._bufferView = buffer.LogicalIndex; this._componentType = encoding; this._normalized = false; this._type = dimensions; this._byteOffset = byteOffset; this._count = count; _UpdateBounds(this._type.Length()); }
public void SetIndexData(BufferView buffer, int byteOffset, IndexType encoding, int count) { Guard.NotNull(buffer, nameof(buffer)); Guard.MustShareLogicalParent(this, buffer, nameof(buffer)); if (buffer.DeviceBufferTarget.HasValue) { Guard.IsTrue(buffer.DeviceBufferTarget.Value == BufferMode.ELEMENT_ARRAY_BUFFER, nameof(buffer)); } Guard.MustBeGreaterThanOrEqualTo(byteOffset, 0, nameof(byteOffset)); Guard.MustBeGreaterThan(count, 0, nameof(count)); this._bufferView = buffer.LogicalIndex; this._componentType = encoding.ToComponent(); this._type = ElementType.SCALAR; this._normalized = null; this._byteOffset = byteOffset; this._count = count; _UpdateBounds(1); }
public void SetVertexData(BufferView buffer, int byteOffset, ComponentType encoding, ElementType dimensions, bool normalized, int count) { Guard.NotNull(buffer, nameof(buffer)); Guard.MustShareLogicalParent(this, buffer, nameof(buffer)); if (buffer.DeviceBufferTarget.HasValue) { Guard.IsTrue(buffer.DeviceBufferTarget.Value == BufferMode.ARRAY_BUFFER, nameof(buffer)); } Guard.MustBeGreaterThanOrEqualTo(byteOffset, 0, nameof(byteOffset)); Guard.MustBeGreaterThan(count, 0, nameof(count)); this._bufferView = buffer.LogicalIndex; this._componentType = encoding; this._normalized = normalized.AsNullable(false); this._type = dimensions; this._byteOffset = byteOffset; this._count = count; _UpdateBounds(this._type.Length()); }