Ejemplo n.º 1
0
 /// <summary>
 /// Mark an instantaneous event. PIX can use this event to trigger an action.
 /// </summary>
 /// <param name="color">The color.</param>
 /// <param name="name">The name.</param>
 /// <unmanaged>D3DPERF_SetMarker</unmanaged>
 public static void SetMarker(Color color, string name)
 {
     D3DPERF_SetMarker(color.ToBgra(), name);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Mark an instantaneous event. PIX can use this event to trigger an action.
 /// </summary>
 /// <param name="color">The color.</param>
 /// <param name="name">The name to format.</param>
 /// <param name="parameters">The parameters to use to format the name.</param>
 /// <unmanaged>D3DPERF_SetMarker</unmanaged>
 public static void SetMarker(Color color, string name, params object[] parameters)
 {
     D3DPERF_SetMarker(color.ToBgra(), string.Format(name, parameters));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Marks the beginning of a user-defined event. PIX can use this event to trigger an action.
 /// </summary>
 /// <param name="color">The Event color.</param>
 /// <param name="name">The Event formatted Name.</param>
 /// <param name="parameters">The parameters to use for the formatted name.</param>
 /// <returns>
 /// The zero-based level of the hierarchy that this event is starting in. If an error occurs, the return value will be negative.
 /// </returns>
 /// <unmanaged>D3DPERF_BeginEvent</unmanaged>
 public static int BeginEvent(Color color, string name, params object[] parameters)
 {
     return D3DPERF_BeginEvent(color.ToBgra(), string.Format(name, parameters));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Marks the beginning of a user-defined event. PIX can use this event to trigger an action.
 /// </summary>
 /// <param name="color">The Event color.</param>
 /// <param name="name">The Event Name.</param>
 /// <returns>The zero-based level of the hierarchy that this event is starting in. If an error occurs, the return value will be negative.</returns>
 /// <unmanaged>D3DPERF_BeginEvent</unmanaged>
 public static int BeginEvent(Color color, string name)
 {
     return D3DPERF_BeginEvent(color.ToBgra(), name);
 }
Ejemplo n.º 5
0
    protected override bool StartRender(RenderContext renderContext, Color borderColor, Vector4 frameData)
    {
      if (_effect == null || _lastTexture == null)
        return false;

      // Apply effect parameters
      _effect.Parameters[PARAM_OPACITY] = (float) renderContext.Opacity;
      _effect.Parameters[PARAM_FRAME_DATA] = frameData;
      _effect.Parameters[PARAM_RELATIVE_TRANSFORM] = _inverseRelativeTransformCache;
      _effect.Parameters[PARAM_BRUSH_TRANSFORM] = _imageTransform;

      if (_extraParameters != null)
        foreach (KeyValuePair<string, object> pair in _extraParameters)
          _effect.Parameters[pair.Key] = pair.Value;

      // Disable antialiasing for image rendering.
      GraphicsDevice.Device.SetRenderState(RenderState.MultisampleAntialias, false);

      // Set border colour for area outside of texture boundaries
      GraphicsDevice.Device.SetSamplerState(0, SamplerState.BorderColor, borderColor.ToBgra());
      
      // Render
      _effect.StartRender(_lastTexture, renderContext.Transform);
      return true;
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Starts a rendering operation where two images are mixed together using a transition effect.
    /// </summary>
    /// <param name="renderContext">The current rendering context.</param>
    /// <param name="mixValue">A value between 0.0 and 1.0 that governs how much each image contributes to the final rendering.</param>
    /// <param name="startContext">The <see cref="ImageContext"/> data for the starting position of the transition
    /// (this context is the end point).</param>
    /// <param name="targetEndImageSize">The size, the final end image should take within the frame. This size is given in the same
    /// orientation as the <paramref name="endTexture"/>, i.e. it is not rotated.</param>
    /// <param name="endTexture">A texture object containing the end image.</param>
    /// <param name="endTextureClip">The section of the end texture that should be rendered. Values are between 0 and 1.</param>
    /// <param name="borderColor">The color to use outside the image's boundaries.</param>
    /// <param name="startFrameData">Additional data to be used by the starting image shaders.</param>
    /// <param name="endFrameData">Additional data to be used by the ending image shaders.</param>
    /// <returns><c>true</c> if the rendering operation was started.</returns>
    public bool StartRenderTransition(RenderContext renderContext, float mixValue, ImageContext startContext,
        SizeF targetEndImageSize, Texture endTexture, RectangleF endTextureClip, Color borderColor, Vector4 startFrameData, Vector4 endFrameData)
    {
      RefreshParameters(targetEndImageSize, endTexture, endTextureClip);
      if (_effectTransition == null)
        _effectTransition = ContentManager.Instance.GetEffect(GetTransitionEffectName());
      if (_lastTexture == null || _effectTransition == null)
        return false;

      // Apply effect parameters    
      _effectTransition.Parameters[PARAM_OPACITY] = (float) renderContext.Opacity;
      _effectTransition.Parameters[PARAM_RELATIVE_TRANSFORM] = _inverseRelativeTransformCache;
      _effectTransition.Parameters[PARAM_BRUSH_TRANSFORM] = _imageTransform;
      _effectTransition.Parameters[PARAM_FRAME_DATA] = endFrameData;
      _effectTransition.Parameters[PARAM_MIX_AB] = mixValue;

      startContext.ApplyTransitionParametersAsStartingSource(_effectTransition, startFrameData);

      // Disable antialiasing for image rendering.
      GraphicsDevice.Device.SetRenderState(RenderState.MultisampleAntialias, false);

      // Set border colour for area outside of texture boundaries
      GraphicsDevice.Device.SetSamplerState(0, SamplerState.BorderColor, borderColor.ToBgra());
      GraphicsDevice.Device.SetSamplerState(1, SamplerState.BorderColor, borderColor.ToBgra());
          
      // Render
      _effectTransition.StartRender(_lastTexture, renderContext.Transform);
      return true;
    }
Ejemplo n.º 7
0
 /// <summary>
 /// Marks the beginning of a user-defined event. PIX can use this event to trigger an action.
 /// </summary>
 /// <param name="color">The Event color.</param>
 /// <param name="name">The Event Name.</param>
 /// <returns>The zero-based level of the hierarchy that this event is starting in. If an error occurs, the return value will be negative.</returns>
 /// <unmanaged>D3DPERF_BeginEvent</unmanaged>
 public static int BeginEvent(Color color, string name)
 {
     return(D3DPERF_BeginEvent(color.ToBgra(), name));
 }