VTK
vtkOptiXRendererNode.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOptiXRendererNode.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 vtkOptiXRendererNode_h
26 #define vtkOptiXRendererNode_h
27 
28 #include "vtkRenderingOptiXModule.h" // For export macro
29 #include "vtkRendererNode.h"
30 
31 #include <vector> // for ivars
32 
33 class vtkRenderer;
35 class vtkOptiXPtxLoader;
36 
37 struct vtkOptiXRendererNodeInternals;
38 
39 namespace vtkopt
40 {
41  struct Light;
42 }
43 
44 namespace optix
45 {
46  class ContextObj;
47  class GeometryGroupObj;
48 }
49 
50 class VTKRENDERINGOPTIX_EXPORT vtkOptiXRendererNode : public vtkRendererNode
51 {
52 public:
53  static vtkOptiXRendererNode* New();
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
60  virtual void Build(bool prepass);
61 
65  virtual void Render(bool prepass);
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 
107  static vtkInformationIntegerKey* AMBIENT_SAMPLES();
108  static void SetAmbientSamples(int, vtkRenderer *renderer);
109  static int GetAmbientSamples(vtkRenderer *renderer);
111 
115  virtual unsigned char *GetBuffer() { return this->Buffer; }
116 
120  virtual float *GetZBuffer() { return this->ZBuffer; }
121 
125  virtual optix::ContextObj* GetOptiXContext();
126 
130  virtual optix::GeometryGroupObj* GetOptiXGeometryGroup();
131 
135  vtkOptiXPtxLoader* GetOptiXPtxLoader();
136 
140  virtual void AddLight(const vtkopt::Light& light);
141 
146  virtual void Traverse(int operation);
147 
151  virtual void Synchronize(bool prepass);
152 
153 protected:
156 
157  //internal structures
158  unsigned char *Buffer;
159  float *ZBuffer;
160 
161  vtkOptiXRendererNodeInternals* Internals;
163 
164  std::vector<vtkopt::Light> Lights;
165 
167 
168 private:
170  void operator=(const vtkOptiXRendererNode&) = delete;
171 
172  int ImageX, ImageY;
173 
174  mutable float Cached_bgColor[3];
175  mutable int Cached_useShadows;
176  mutable int Cached_samplesPerPixel;
177  mutable bool ContextValidated;
178  mutable int Cached_AOSamples;
179 };
180 
181 #endif
Definition: Light.h:34
for loading of OptiX .ptx files
virtual unsigned char * GetBuffer()
Get the last rendered ColorBuffer.
virtual float * GetZBuffer()
Get the last rendered ZBuffer.
abstract specification for renderers
Definition: vtkRenderer.h:63
std::vector< vtkopt::Light > Lights
links vtkRenderers to OptiX
vtkOptiXPtxLoader * OptiXPtxLoader
vtkOptiXRendererNodeInternals * Internals
a simple class to control print indentation
Definition: vtkIndent.h:39
Key for integer values in vtkInformation.
vtkViewNode specialized for vtkRenderers