vtkClientServerCompositePass.h 3.89 KB
Newer Older
1 2 3
/*=========================================================================

  Program:   Visualization Toolkit
4
  Module:    vtkClientServerCompositePass.h
5 6 7 8 9 10 11 12 13 14

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
15 16 17 18 19 20 21
/**
 * @class   vtkClientServerCompositePass
 *
 * vtkClientServerCompositePass is a render-pass that can handle client-server
 * image delivery. This is designed to be used in configurations in
 * two-processes configurations.
*/
22

23 24
#ifndef vtkClientServerCompositePass_h
#define vtkClientServerCompositePass_h
25

26
#include "vtkRenderingParallelModule.h" // For export macro
27 28 29 30
#include "vtkRenderPass.h"

class vtkMultiProcessController;

31
class VTKRENDERINGPARALLEL_EXPORT vtkClientServerCompositePass : public vtkRenderPass
32 33 34
{
public:
  static vtkClientServerCompositePass* New();
35
  vtkTypeMacro(vtkClientServerCompositePass, vtkRenderPass);
36 37
  void PrintSelf(ostream& os, vtkIndent indent);

38 39 40 41
  /**
   * Perform rendering according to a render state \p s.
   * \pre s_exists: s!=0
   */
42
  virtual void Render(const vtkRenderState *s);
43

44 45 46 47 48
  /**
   * Release graphics resources and ask components to release their own
   * resources.
   * \pre w_exists: w!=0
   */
49 50
  void ReleaseGraphicsResources(vtkWindow *w);

51 52 53 54 55 56 57 58
  //@{
  /**
   * Controller
   * If it is NULL, nothing will be rendered and a warning will be emitted.
   * Initial value is a NULL pointer.
   * This must be set to the socket controller used for communicating between
   * the client and the server.
   */
59 60
  vtkGetObjectMacro(Controller,vtkMultiProcessController);
  virtual void SetController(vtkMultiProcessController *controller);
61 62 63 64 65 66 67 68
  //@}

  //@{
  /**
   * Get/Set the render pass used to do the actual rendering.
   * When ServerSideRendering is true, the rendering-pass is called only on the
   * server side.
   */
69 70
  void SetRenderPass(vtkRenderPass*);
  vtkGetObjectMacro(RenderPass, vtkRenderPass);
71 72 73 74 75 76 77 78 79 80 81
  //@}

  //@{
  /**
   * Set/Get the optional post-fetch render pass.
   * On the client-process this is called after the server-side image is fetched
   * (if ServerSideRendering is true). On server-process, this is called after the
   * image rendered by this->RenderPass is delivered to the client (if
   * ServerSideRendering is true). This is optional, so you can set this either on
   * one of the two processes or both or neither.
   */
82 83
  void SetPostProcessingRenderPass(vtkRenderPass*);
  vtkGetObjectMacro(PostProcessingRenderPass, vtkRenderPass);
84 85 86 87 88 89 90 91
  //@}

  //@{
  /**
   * Set the current process type. This is needed since when using the socket
   * communicator there's no easy way of determining which process is the server
   * and which one is the client.
   */
92 93 94
  vtkSetMacro(ProcessIsServer,bool);
  vtkBooleanMacro(ProcessIsServer, bool);
  vtkGetMacro(ProcessIsServer, bool);
95 96 97 98 99 100 101 102
  //@}

  //@{
  /**
   * Enable/Disable fetching of the image from the server side to the client. If
   * this flag is disabled, then this pass just acts as a "pass-through" pass.
   * This flag must be set to the same value on both the processes.
   */
103 104 105
  vtkSetMacro(ServerSideRendering, bool);
  vtkBooleanMacro(ServerSideRendering, bool);
  vtkGetMacro(ServerSideRendering, bool);
106
  //@}
107 108 109 110 111 112 113 114 115 116 117 118

protected:
  vtkClientServerCompositePass();
  ~vtkClientServerCompositePass();

  vtkRenderPass* RenderPass;
  vtkRenderPass* PostProcessingRenderPass;
  vtkMultiProcessController* Controller;

  bool ProcessIsServer;
  bool ServerSideRendering;
private:
119
  vtkClientServerCompositePass(const vtkClientServerCompositePass&) VTK_DELETE_FUNCTION;
120
  void operator=(const vtkClientServerCompositePass&) VTK_DELETE_FUNCTION;
121

122 123 124 125 126
};

#endif