/// <summary> /// Draws a specified amount of vertices starting at a given offset. /// </summary> /// <remarks> /// DOES NOT BIND THE <see cref="VertexArrayObject"/>, THIS NEEDS TO BE DONE MANUALLY! /// </remarks> /// <param name="offset">The offset to start drawing at.</param> /// <param name="count">The amount of vertices to draw.</param> public void DrawIndexed(int offset, int count) { Contract.Requires<ArgumentOutOfRangeException>(offset >= 0); Contract.Requires<ArgumentOutOfRangeException>(count >= 0); this.VerifyAccess(); using (ParameterEventArgsRaiser raiser = new ParameterEventArgsRaiser(this, this.Drawing, this.Drawn, count, count)) { GL.DrawElements(this.DrawMode, count, this.IndexType, offset); } }
/// <summary> /// Resets the instance to the default values. /// </summary> /// <example> /// <see cref="Transform"/> resets its local position / rotation / scaling to zero / identity / one. /// </example> public void Reset() { lock (this.stateLock) { using (ParameterEventArgsRaiser raiser = new ParameterEventArgsRaiser(this, this.Resetting, this.Resetted)) { this.OnReset(); } } }
/// <summary> /// Loads the instance. /// </summary> /// <remarks>Calls to <see cref="M:Load"/> will be ignored if the instance is already loaded.</remarks> public void Load() { if (!this.IsLoaded) { lock (this.stateLock) { if (!this.IsLoaded) { using (ParameterEventArgsRaiser raiser = new ParameterEventArgsRaiser(this, this.Loading, this.Loaded)) { this.OnLoad(); this.IsLoaded = true; } } } } }
/// <summary> /// Enables the instance. /// </summary> /// <remarks>Calls to <see cref="M:Enable"/> will be ignored if the instance is already enabled.</remarks> public void Enable() { if (this.IsLoaded && !this.IsEnabled) { lock (this.stateLock) { if (this.IsLoaded && !this.IsEnabled) { using (ParameterEventArgsRaiser raiser = new ParameterEventArgsRaiser(this, this.Enabling, this.Enabled)) { this.OnEnable(); this.IsEnabled = true; } } } } }
/// <summary> /// Triggers binding and drawing of the element. /// </summary> public void Draw() { if (this.IsLoaded && this.IsEnabled) { lock (this.stateLock) { if (this.IsLoaded && this.IsEnabled) { using (ParameterEventArgsRaiser raiser = new ParameterEventArgsRaiser(this, this.Drawing, this.Drawn)) { this.OnDraw(); } } } } }
/// <summary> /// Disables the instance /// </summary> /// <remarks>Calls to <see cref="M:Disable"/> will be ignored if the instance is already disabled.</remarks> public void Disable() { if (this.IsLoaded && this.IsEnabled) { lock (this.stateLock) { if (this.IsLoaded && this.IsEnabled) { using (ParameterEventArgsRaiser raiser = new ParameterEventArgsRaiser(this, this.Disabling, this.Disabled)) { this.OnDisable(); this.IsEnabled = false; } } } } }