PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: GeometryShader.h * 00003 * 00004 * Copyright (C) 2002-2012 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] sArguments 00135 * Optional shader compiler arguments, e.g. "version=150" when using Cg and a "glslg" profile 00136 * @param[in] sEntry 00137 * Entry point, if empty string, "main" is used as default 00138 * 00139 * @return 00140 * 'true' if all went fine, else 'false' 00141 * 00142 * @remarks 00143 * Extended version of "Shader::SetSourceCode()" for geometry shaders allowing also to specify 00144 * the input/output primitives and the number of generated vertices. Please note that not each 00145 * internal implementation may actually need this information, but it's highly recommended to 00146 * provide this information anyway to be able to switch the internal implementation (e.g. using 00147 * OpenGL instead of DirectX and/or Cg instead of HLSL/GLSL). 00148 * 00149 * @see 00150 * - "Shader::SetSourceCode()" for additional information 00151 */ 00152 virtual bool SetSourceCode(const PLCore::String &sSourceCode, EInputPrimitiveType nInputPrimitiveType, EOutputPrimitiveType nOutputPrimitiveType, PLCore::uint32 nNumOfOutputVertices, const PLCore::String &sProfile = "", const PLCore::String &sArguments = "", const PLCore::String &sEntry = "") = 0; 00153 00154 00155 //[-------------------------------------------------------] 00156 //[ Protected functions ] 00157 //[-------------------------------------------------------] 00158 protected: 00159 /** 00160 * @brief 00161 * Constructor 00162 * 00163 * @param[in] cRenderer 00164 * Owner renderer 00165 */ 00166 PLRENDERER_API GeometryShader(Renderer &cRenderer); 00167 00168 00169 //[-------------------------------------------------------] 00170 //[ Private functions ] 00171 //[-------------------------------------------------------] 00172 private: 00173 /** 00174 * @brief 00175 * Copy constructor 00176 * 00177 * @param[in] cSource 00178 * Source to copy from 00179 */ 00180 GeometryShader(const GeometryShader &cSource); 00181 00182 /** 00183 * @brief 00184 * Copy operator 00185 * 00186 * @param[in] cSource 00187 * Source to copy from 00188 * 00189 * @return 00190 * Reference to this instance 00191 */ 00192 GeometryShader &operator =(const GeometryShader &cSource); 00193 00194 00195 }; 00196 00197 00198 //[-------------------------------------------------------] 00199 //[ Namespace ] 00200 //[-------------------------------------------------------] 00201 } // PLRenderer 00202 00203 00204 #endif // __PLRENDERER_GEOMETRYSHADER_H__
|