00001 //============================================================================= 00002 // This file is part of VTKEdge. See vtkedge.org for more information. 00003 // 00004 // Copyright (c) 2010 Kitware, Inc. 00005 // 00006 // VTKEdge may be used under the terms of the BSD License 00007 // Please see the file Copyright.txt in the root directory of 00008 // VTKEdge for further information. 00009 // 00010 // Alternatively, you may see: 00011 // 00012 // http://www.vtkedge.org/vtkedge/project/license.html 00013 // 00014 // 00015 // For custom extensions, consulting services, or training for 00016 // this or any other Kitware supported open source project, please 00017 // contact Kitware at sales@kitware.com. 00018 // 00019 // 00020 //============================================================================= 00021 00065 #ifndef __vtkKWEFunctionToGLSL_h 00066 #define __vtkKWEFunctionToGLSL_h 00067 00068 #include "vtkFunctionParser.h" 00069 #include "VTKEdgeConfigure.h" // include configuration header 00070 00071 class vtkStdString; 00072 class vtkOStrStreamWrapper; 00073 00074 class VTKEdge_COMMON_EXPORT vtkKWEFunctionToGLSL : public vtkFunctionParser 00075 { 00076 public: 00077 vtkTypeRevisionMacro(vtkKWEFunctionToGLSL,vtkFunctionParser); 00078 void PrintSelf(ostream& os, vtkIndent indent); 00079 00080 static vtkKWEFunctionToGLSL *New(); 00081 00083 virtual bool GetParseStatus(); 00084 00086 virtual void GenerateGLSL(); 00087 00091 virtual int GetResultDimension(); 00092 00095 virtual vtkStdString *GetGLSLCode(); 00096 00100 virtual bool GetScalarIsUsed(int index); 00101 00105 virtual bool GetVectorIsUsed(int index); 00106 00111 vtkStdString *GetGLSLScalarName(int index); 00112 00117 vtkStdString *GetGLSLVectorName(int index); 00118 00122 virtual int GetNumberOfUsedScalarVariables(); 00123 00127 virtual int GetNumberOfUsedVectorVariables(); 00128 00129 protected: 00132 vtkKWEFunctionToGLSL(); 00133 00135 ~vtkKWEFunctionToGLSL(); 00136 00140 void AllocateStringStack(); 00141 00143 void DeleteStringStack(); 00144 00147 void BuildGLSLVariableNames(); 00148 00149 bool ParseStatus; 00150 vtkStdString *GLSLCode; 00151 00152 vtkStdString *StringStack; 00153 int *PrecedenceStack; 00154 00155 bool *ScalarIsUsed; 00156 int ScalarIsUsedSize; 00157 vtkStdString *GLSLScalarNames; 00158 int NumberOfUsedScalarVariables; 00159 00160 bool *VectorIsUsed; 00161 int VectorIsUsedSize; 00162 vtkStdString *GLSLVectorNames; 00163 int NumberOfUsedVectorVariables; 00164 00165 int ResultDimension; // 1 or 3 00166 00167 private: 00168 vtkKWEFunctionToGLSL(const vtkKWEFunctionToGLSL&); // Not implemented. 00169 void operator=(const vtkKWEFunctionToGLSL&); // Not implemented. 00170 }; 00171 00172 #endif
1.7.1