VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkGLSLShader.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /* 00016 * Copyright 2003 Sandia Corporation. 00017 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00018 * license for use of this work by or on behalf of the 00019 * U.S. Government. Redistribution and use in source and binary forms, with 00020 * or without modification, are permitted provided that this Notice and any 00021 * statement of authorship are reproduced on all copies. 00022 */ 00023 00073 #ifndef __vtkGLSLShader_h 00074 #define __vtkGLSLShader_h 00075 00076 #include "vtkShader.h" 00077 00078 class vtkActor; 00079 class vtkRenderer; 00080 class vtkProperty; 00081 class vtkLight; 00082 class vtkCamera; 00083 class vtkRenderWindow; 00084 00085 // Manages all shaders defined in the XML file 00086 // especially the part about sending things to the card 00087 class VTK_RENDERING_EXPORT vtkGLSLShader : public vtkShader 00088 { 00089 public: 00090 static vtkGLSLShader *New(); 00091 vtkTypeMacro(vtkGLSLShader, vtkShader); 00092 void PrintSelf(ostream &os, vtkIndent indent); 00093 00098 virtual int Compile(); 00099 00101 unsigned int GetHandle() { return this->Shader; } 00102 00104 00106 vtkSetMacro( Program, unsigned int ); 00107 vtkGetMacro( Program, unsigned int ); 00109 00111 00114 virtual void ReleaseGraphicsResources(vtkWindow *); 00115 protected: 00116 vtkGLSLShader(); 00117 virtual ~vtkGLSLShader(); 00119 00120 // These are GLuints. 00121 unsigned int Program; 00122 unsigned int Shader; 00123 00124 int IsShader(); 00125 int IsCompiled(); 00126 00128 void LoadShader(); 00129 00131 00132 virtual void SetUniformParameter(const char* name, int numValues, const int* value); 00133 virtual void SetUniformParameter(const char* name, int numValues, const float* value); 00134 virtual void SetUniformParameter(const char* name, int numValues, const double* value); 00136 00138 00139 virtual void SetMatrixParameter(const char* name, int numValues, 00140 int order, const float* value); 00141 virtual void SetMatrixParameter(const char* name, int numValues, 00142 int order, const double* value); 00143 virtual void SetMatrixParameter(const char* name, const char* state_matix_type, 00144 const char* transform_type); 00146 00147 virtual void SetSamplerParameter(const char* name, vtkTexture* texture, 00148 int textureIndex); 00149 private: 00150 vtkGLSLShader(const vtkGLSLShader&); // Not Implemented 00151 void operator=(const vtkGLSLShader&); // Not Implemented 00152 00153 int GetUniformLocation( const char* name ); 00154 }; 00155 #endif //__vtkGLSLShader_h