VTK
vtkCgShader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCgShader.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 =========================================================================*/
15 /*
16  * Copyright 2003 Sandia Corporation.
17  * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
18  * license for use of this work by or on behalf of the
19  * U.S. Government. Redistribution and use in source and binary forms, with
20  * or without modification, are permitted provided that this Notice and any
21  * statement of authorship are reproduced on all copies.
22  */
23 
92 #ifndef __vtkCgShader_h
93 #define __vtkCgShader_h
94 
95 #include "vtkShader.h"
96 
97 class vtkActor;
98 class vtkCamera;
99 class vtkCgShaderInternals;
100 class vtkLight;
101 class vtkProperty;
102 class vtkRenderer;
103 
104 // manages all shaders defined in the XML file
105 // especially the part about sending things to the card
107 {
108 public:
109  static vtkCgShader *New();
110  vtkTypeMacro(vtkCgShader, vtkShader);
111  void PrintSelf(ostream &os, vtkIndent indent);
112 
113  // Called to compile the shader code.
114  // The vtkShaderProgram calls this method only when
115  // vtkShader::IsCompiled() returns false.
116  // The subclasses must only compile the code in this method.
117  // Returns if the compile was successful.
118  virtual int Compile();
119 
123  virtual void Bind();
124 
127  virtual void Unbind();
128 
131  void ReportError();
132 
137 
138 
140 
145  virtual void PassShaderVariables(vtkActor* actor, vtkRenderer* ren);
146 //BTX
147 protected:
148  vtkCgShader();
149  ~vtkCgShader();
151 
153 
154  virtual void SetUniformParameter(const char* name, int numValues, const int* value) ;
155  virtual void SetUniformParameter(const char* name, int numValues, const float* value) ;
156  virtual void SetUniformParameter(const char* name, int numValues, const double* value);
158 
160 
161  virtual void SetMatrixParameter(const char* name, int numValues,
162  int order, const float* value);
163  virtual void SetMatrixParameter(const char* name, int numValues,
164  int order, const double* value);
165  virtual void SetMatrixParameter(const char* name, const char* state_matix_type,
166  const char* transform_type);
168 
169  virtual void SetSamplerParameter(const char* name, vtkTexture* texture,
170  int);
171 
173 private:
174  vtkCgShader(const vtkCgShader&); // Not Implemented
175  void operator=(const vtkCgShader&); // Not Implemented
176 
177  vtkCgShaderInternals* Internals;
178 //ETX
179 };
180 #endif //_vtkCgShader_h
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:49
represent surface properties of a geometric object
Definition: vtkProperty.h:61
virtual void Bind()
Definition: vtkShader.h:78
abstract specification for renderers
Definition: vtkRenderer.h:69
void SetUniformParameter(vtkActor *, vtkRenderer *, vtkXMLDataElement *)
virtual int Compile()=0
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
Cg Shader.
Definition: vtkCgShader.h:106
a simple class to control print indentation
Definition: vtkIndent.h:37
a virtual camera for 3D rendering
Definition: vtkCamera.h:47
a virtual light for 3D rendering
Definition: vtkLight.h:59
void SetSamplerParameter(vtkActor *, vtkRenderer *, vtkXMLDataElement *)
handles properties associated with a texture map
Definition: vtkTexture.h:68
virtual void ReleaseGraphicsResources(vtkWindow *)
Definition: vtkShader.h:87
#define VTK_RENDERING_EXPORT
void SetMatrixParameter(vtkActor *, vtkRenderer *, vtkXMLDataElement *)
virtual void PassShaderVariables(vtkActor *actor, vtkRenderer *ren)
virtual void Unbind()
Definition: vtkShader.h:82
static vtkObject * New()
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkShaderInternals * Internals
Definition: vtkShader.h:138
adapter to pass generic vertex attributes to the rendering pipeline to be used in a Cg shader...