VTK
vtkOSPRayRendererNode.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOSPRayRendererNode.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
25 #ifndef vtkOSPRayRendererNode_h
26 #define vtkOSPRayRendererNode_h
27 
28 #include "vtkRenderingOSPRayModule.h" // For export macro
29 #include "vtkRendererNode.h"
30 #include <vector> // for ivars
31 
32 #include "ospray/ospray.h" // for ospray handle types
33 
39 class vtkMatrix4x4;
40 class vtkOSPRayRendererNodeInternals;
42 class vtkRenderer;
43 
44 class VTKRENDERINGOSPRAY_EXPORT vtkOSPRayRendererNode :
45  public vtkRendererNode
46 {
47 public:
48  static vtkOSPRayRendererNode* New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  virtual void Build(bool prepass) override;
56 
60  virtual void Render(bool prepass) override;
61 
65  virtual void Invalidate(bool prepass) override;
66 
70  virtual void WriteLayer(unsigned char *buffer, float *zbuffer,
71  int buffx, int buffy, int layer);
72 
73  //state beyond rendering core...
74 
80  static vtkInformationIntegerKey* SAMPLES_PER_PIXEL();
81 
83 
86  static void SetSamplesPerPixel(int, vtkRenderer *renderer);
87  static int GetSamplesPerPixel(vtkRenderer *renderer);
89 
91 
96  static vtkInformationIntegerKey* MAX_FRAMES();
97  static void SetMaxFrames(int, vtkRenderer *renderer);
98  static int GetMaxFrames(vtkRenderer *renderer);
100 
102 
106  static vtkInformationStringKey* RENDERER_TYPE();
107  static void SetRendererType(std::string name, vtkRenderer *renderer);
108  static std::string GetRendererType(vtkRenderer *renderer);
110 
116  static vtkInformationIntegerKey* AMBIENT_SAMPLES();
118 
121  static void SetAmbientSamples(int, vtkRenderer *renderer);
122  static int GetAmbientSamples(vtkRenderer *renderer);
124 
129  static vtkInformationIntegerKey* COMPOSITE_ON_GL();
131 
134  static void SetCompositeOnGL(int, vtkRenderer *renderer);
135  static int GetCompositeOnGL(vtkRenderer *renderer);
137 
141  static vtkInformationDoubleVectorKey* NORTH_POLE();
143 
146  static void SetNorthPole(double *, vtkRenderer *renderer);
147  static double * GetNorthPole(vtkRenderer *renderer);
149 
153  static vtkInformationDoubleVectorKey* EAST_POLE();
155 
158  static void SetEastPole(double *, vtkRenderer *renderer);
159  static double * GetEastPole(vtkRenderer *renderer);
161 
165  static vtkInformationObjectBaseKey* MATERIAL_LIBRARY();
166 
168 
171  static void SetMaterialLibrary(vtkOSPRayMaterialLibrary *, vtkRenderer *renderer);
172  static vtkOSPRayMaterialLibrary* GetMaterialLibrary(vtkRenderer *renderer);
174 
178  static vtkInformationDoubleKey* VIEW_TIME();
180 
183  static void SetViewTime(double , vtkRenderer *renderer);
184  static double GetViewTime(vtkRenderer *renderer);
186 
190  static vtkInformationIntegerKey* TIME_CACHE_SIZE();
192 
195  static void SetTimeCacheSize(int , vtkRenderer *renderer);
196  static int GetTimeCacheSize(vtkRenderer *renderer);
198 
202  OSPModel GetOModel() { return this->OModel; }
203  OSPRenderer GetORenderer() { return this->ORenderer; }
204  void AddLight(OSPLight light) {
205  this->Lights.push_back(light); }
206 
210  virtual unsigned char *GetBuffer() {
211  return this->Buffer; }
212 
216  virtual float *GetZBuffer() {
217  return this->ZBuffer; }
218 
219  // if you want to traverse your children in a specific order
220  // or way override this method
221  virtual void Traverse(int operation) override;
222 
226  vtkRenderer *GetRenderer();
227 
228 protected:
231 
232  //internal structures
233  unsigned char *Buffer;
234  float *ZBuffer;
235 
236  OSPModel OModel;
237  OSPRenderer ORenderer;
238  OSPFrameBuffer OFrameBuffer;
239  int ImageX, ImageY;
240  std::vector<OSPLight> Lights;
245  float* ODepthBuffer;
249  vtkOSPRayRendererNodeInternals *Internal;
250 
251 private:
253  void operator=(const vtkOSPRayRendererNode&) = delete;
254 };
255 
256 #endif
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkOSPRayRendererNodeInternals * Internal
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual float * GetZBuffer()
Get the last rendered ZBuffer.
Key for string values in vtkInformation.
a collection of materials for vtk apps to draw from
void AddLight(OSPLight light)
Key for double vector values.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
Key for integer values in vtkInformation.
Key for vtkObjectBase values.
virtual void Build(bool prepass) override
Build containers for our child nodes.
std::vector< OSPLight > Lights
virtual void Render(bool)
Makes calls to make self visible.
Definition: vtkViewNode.h:67
vtkViewNode specialized for vtkRenderers
virtual void Invalidate(bool)
Clear any cached data.
Definition: vtkViewNode.h:72
OSPModel GetOModel()
Methods for other nodes to access.
static vtkRendererNode * New()
Key for double values in vtkInformation.
virtual void Traverse(int operation)
links vtkRenderers to OSPRay
virtual unsigned char * GetBuffer()
Get the last rendered ColorBuffer.