PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: GeometryShader.h * 00003 * 00004 * Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLRENDERER_GEOMETRYSHADER_H__ 00024 #define __PLRENDERER_GEOMETRYSHADER_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLRenderer/Renderer/Shader.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Namespace ] 00036 //[-------------------------------------------------------] 00037 namespace PLRenderer { 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Classes ] 00042 //[-------------------------------------------------------] 00043 /** 00044 * @brief 00045 * Abstract renderer geometry shader resource 00046 */ 00047 class GeometryShader : public Shader { 00048 00049 00050 //[-------------------------------------------------------] 00051 //[ Public definitions ] 00052 //[-------------------------------------------------------] 00053 public: 00054 /** 00055 * @brief 00056 * Input primitive type 00057 */ 00058 enum EInputPrimitiveType { 00059 InputPoints = 0, /**< List of point primitives */ 00060 InputLines = 1, /**< List of line or line strip primitives */ 00061 InputLinesAdjacency = 2, /**< List of line with adjacency or line strip with adjacency primitives */ 00062 InputTriangles = 3, /**< List of triangle or triangle strip primitives */ 00063 InputTrianglesAdjacency = 4 /**< List of triangle with adjacency or triangle strip with adjacency primitives */ 00064 }; 00065 00066 /** 00067 * @brief 00068 * Output primitive type 00069 */ 00070 enum EOutputPrimitiveType { 00071 OutputPoints = 0, /**< A list of of point primitives */ 00072 OutputLines = 1, /**< A list of line primitives */ 00073 OutputTriangles = 2 /**< A list of triangle primitives */ 00074 }; 00075 00076 00077 //[-------------------------------------------------------] 00078 //[ Public functions ] 00079 //[-------------------------------------------------------] 00080 public: 00081 /** 00082 * @brief 00083 * Destructor 00084 */ 00085 PLRENDERER_API virtual ~GeometryShader(); 00086 00087 00088 //[-------------------------------------------------------] 00089 //[ Public virtual GeometryShader functions ] 00090 //[-------------------------------------------------------] 00091 public: 00092 /** 00093 * @brief 00094 * Returns the input primitive type 00095 * 00096 * @return 00097 * The input primitive type 00098 */ 00099 virtual EInputPrimitiveType GetInputPrimitiveType() const = 0; 00100 00101 /** 00102 * @brief 00103 * Returns the output primitive type 00104 * 00105 * @return 00106 * The output primitive type 00107 */ 00108 virtual EOutputPrimitiveType GetOutputPrimitiveType() const = 0; 00109 00110 /** 00111 * @brief 00112 * Returns the number of output vertices 00113 * 00114 * @return 00115 * The number of output vertices, 0 if the maximum possible number of output vertices should be used 00116 */ 00117 virtual PLCore::uint32 GetNumOfOutputVertices() const = 0; 00118 00119 /** 00120 * @brief 00121 * Sets the geometry shader source code 00122 * 00123 * @param[in] sSourceCode 00124 * Geometry shader source code, usually blank ASCII code 00125 * @param[in] nInputPrimitiveType 00126 * Input primitive type, for "Shader::SetSourceCode()" "InputTriangles" is used as default 00127 * @param[in] nOutputPrimitiveType 00128 * Output primitive type, for "Shader::SetSourceCode()" "OutputTriangles" is used as default 00129 * @param[in] nNumOfOutputVertices 00130 * Number of output vertices, 0 if the maximum possible number of output vertices should be used, for "Shader::SetSourceCode()" "0" is used as default 00131 * @param[in] sProfile 00132 * Geometry shader profile to use, if empty string, a default profile will be used which usually 00133 * tries to use the best available profile that runs on most hardware 00134 * @param[in] sEntry 00135 * Entry point, if empty string, "main" is used as default 00136 * 00137 * @return 00138 * 'true' if all went fine, else 'false' 00139 * 00140 * @remarks 00141 * Extended version of "Shader::SetSourceCode()" for geometry shaders allowing also to specify 00142 * the input/output primitives and the number of generated vertices. Please note that not each 00143 * internal implementation may actually need this information, but it's highly recommended to 00144 * provide this information anyway to be able to switch the internal implementation (e.g. using 00145 * OpenGL instead of DirectX and/or Cg instead of HLSL/GLSL). 00146 * 00147 * @see 00148 * - "Shader::SetSourceCode()" for additional information 00149 */ 00150 virtual bool SetSourceCode(const PLCore::String &sSourceCode, EInputPrimitiveType nInputPrimitiveType, EOutputPrimitiveType nOutputPrimitiveType, PLCore::uint32 nNumOfOutputVertices, const PLCore::String &sProfile = "", const PLCore::String &sEntry = "") = 0; 00151 00152 00153 //[-------------------------------------------------------] 00154 //[ Protected functions ] 00155 //[-------------------------------------------------------] 00156 protected: 00157 /** 00158 * @brief 00159 * Constructor 00160 * 00161 * @param[in] cRenderer 00162 * Owner renderer 00163 */ 00164 PLRENDERER_API GeometryShader(Renderer &cRenderer); 00165 00166 00167 //[-------------------------------------------------------] 00168 //[ Private functions ] 00169 //[-------------------------------------------------------] 00170 private: 00171 /** 00172 * @brief 00173 * Copy constructor 00174 * 00175 * @param[in] cSource 00176 * Source to copy from 00177 */ 00178 GeometryShader(const GeometryShader &cSource); 00179 00180 /** 00181 * @brief 00182 * Copy operator 00183 * 00184 * @param[in] cSource 00185 * Source to copy from 00186 * 00187 * @return 00188 * Reference to this instance 00189 */ 00190 GeometryShader &operator =(const GeometryShader &cSource); 00191 00192 00193 }; 00194 00195 00196 //[-------------------------------------------------------] 00197 //[ Namespace ] 00198 //[-------------------------------------------------------] 00199 } // PLRenderer 00200 00201 00202 #endif // __PLRENDERER_GEOMETRYSHADER_H__
|