VTK
dox/Rendering/Core/vtkXMLShader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkXMLShader.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 =========================================================================*/
00026 #ifndef __vtkXMLShader_h
00027 #define __vtkXMLShader_h
00028 
00029 #include "vtkRenderingCoreModule.h" // For export macro
00030 #include "vtkObject.h"
00031 
00032 class vtkXMLDataElement;
00033 
00034 class VTKRENDERINGCORE_EXPORT vtkXMLShader : public vtkObject
00035 {
00036 public:
00037   static vtkXMLShader* New();
00038   vtkTypeMacro(vtkXMLShader, vtkObject);
00039   void PrintSelf(ostream& os, vtkIndent indent);
00040 
00042 
00043   vtkGetObjectMacro(RootElement, vtkXMLDataElement);
00044   void SetRootElement(vtkXMLDataElement*);
00046 
00048   int GetLanguage();
00049 
00051   int GetScope();
00052 
00054   int GetLocation();
00055 
00064   int GetStyle();
00065 
00067   const char* GetName();
00068 
00070   const char* GetEntry();
00071 
00073   const char* GetCode();
00074 
00077   const char** GetArgs();
00078 
00081   static char* LocateFile(const char* filename);
00082 
00083 //BTX
00084   enum LanguageCodes
00085     {
00086     LANGUAGE_NONE=0,
00087     LANGUAGE_MIXED,
00088     LANGUAGE_CG,
00089     LANGUAGE_GLSL
00090     };
00091 
00092   enum ScopeCodes
00093     {
00094     SCOPE_NONE=0,
00095     SCOPE_MIXED,
00096     SCOPE_VERTEX,
00097     SCOPE_FRAGMENT
00098     };
00099 
00100   enum LocationCodes
00101     {
00102     LOCATION_NONE=0,
00103     LOCATION_INLINE,
00104     LOCATION_FILE,
00105     LOCATION_LIBRARY
00106     };
00107 //ETX
00108 protected:
00109   vtkXMLShader();
00110   ~vtkXMLShader();
00111 
00112   // Reads the file and fills it in this->Code.
00113   void ReadCodeFromFile(const char* fullpath);
00114 
00115   char* Code; // cache for the code.
00116   vtkSetStringMacro(Code);
00117 
00118   vtkXMLDataElement* RootElement;
00119   vtkXMLDataElement* SourceLibraryElement;
00120   void SetSourceLibraryElement(vtkXMLDataElement*);
00121 
00122   char** Args;
00123   void CleanupArgs();
00124 private:
00125   vtkXMLShader(const vtkXMLShader&); // Not implemented.
00126   void operator=(const vtkXMLShader&); // Not implemented.
00127 };
00128 
00129 #endif
00130