/// <summary>Tests whether another draw context is identical to this one</summary>
 /// <param name="otherContext">Other context to check for equality</param>
 /// <returns>True if the other context is identical to this one</returns>
 public override bool Equals(DrawContext otherContext) {
   return ReferenceEquals(this, otherContext);
 }
    /// <summary>Tests whether another draw context is identical to this one</summary>
    /// <param name="otherContext">Other context to check for equality</param>
    /// <returns>True if the other context is identical to this one</returns>
    /// <remarks>
    ///   Classes deriving from the EffectDrawContext should override this method
    ///   and do their own comparison - for example, two drawing contexts might
    ///   use the same effect instance, but apply different effect parameters before
    ///   rendering - in that case, an additional comparison of the draw context's
    ///   own settings needs to be performed here.
    /// </remarks>
    public override bool Equals(DrawContext otherContext) {
      EffectDrawContext other = otherContext as EffectDrawContext;
      if(other == null)
        return false;

      Effect thisEffect = this.effect;
      Effect otherEffect = other.effect;

      // If the same effect instance is behind the other class, we can be sure that
      // the effects are identical. Derived clases should override this method,
      // otherwise, instance using the same effect but with different effect parameters
      // would be compared as equal in this line. If on the other hand, the effect
      // draw context is used directly, this comparison is what we want!
      if(ReferenceEquals(thisEffect, otherEffect))
        return true;

      // Short cut didn't work, compare the effects member by member
      return CompareEffectParameters(otherEffect);
    }
Example #3
0
 /// <summary>Tests whether another draw context is identical to this one</summary>
 /// <param name="otherContext">Other context to check for equality</param>
 /// <returns>True if the other context is identical to this one</returns>
 public abstract bool Equals(DrawContext otherContext);
    /// <summary>Tests whether another draw context is identical to this one</summary>
    /// <param name="otherContext">Other context to check for equality</param>
    /// <returns>True if the other context is identical to this one</returns>
    public override bool Equals(DrawContext otherContext) {
      TextDrawContext other = otherContext as TextDrawContext;
      if(other == null)
        return false;

      Effect thisEffect = this.effect;
      Effect otherEffect = other.effect;

      // If the same effect instances are different, we stop comparing right here.
      // This context is specialized to run the same effect in multiple configurations,
      // different effects with identical settings will not happen due to its usage.
      if(!ReferenceEquals(thisEffect, otherEffect))
        return false;

      // It's the same effect instance, so compare the configuration we're assigning
      // to the effect before each drawing cycle
      return
        (this.textColor == other.textColor) &&
        (this.transform == other.transform);
    }
 /// <summary>Tests whether another draw context is identical to this one</summary>
 /// <param name="otherContext">Other context to check for equality</param>
 /// <returns>True if the other context is identical to this one</returns>
 public override bool Equals(DrawContext otherContext)
 {
     return(ReferenceEquals(this, otherContext));
 }
Example #6
0
 /// <summary>Queues a series of primitives</summary>
 /// <param name="vertices">Primitive vertices</param>
 /// <param name="startVertex">Index of vertex to begin drawing with</param>
 /// <param name="vertexCount">Number of vertices to draw</param>
 /// <param name="type">Type of primitives to draw</param>
 /// <param name="context">Desired graphics device settings for the primitives</param>
 public abstract void Queue(
     VertexType[] vertices, int startVertex, int vertexCount,
     PrimitiveType type, DrawContext context
     );
Example #7
0
 /// <summary>Tests whether another draw context is identical to this one</summary>
 /// <param name="otherContext">Other context to check for equality</param>
 /// <returns>True if the other context is identical to this one</returns>
 public abstract bool Equals(DrawContext otherContext);
Example #8
0
 /// <summary>Queues a series of primitives</summary>
 /// <param name="vertices">Primitive vertices</param>
 /// <param name="startVertex">Index of vertex to begin drawing with</param>
 /// <param name="vertexCount">Number of vertices to draw</param>
 /// <param name="type">Type of primitives to draw</param>
 /// <param name="context">Desired graphics device settings for the primitives</param>
 public override void Queue(
     VertexType[] vertices, int startVertex, int vertexCount,
     PrimitiveType type, DrawContext context
     )
 {
 }