1 /* 2 ----------------------------------------------------------------------------- 3 This source file is part of OGRE 4 (Object-oriented Graphics Rendering Engine) 5 For the latest info, see http://www.ogre3d.org 6 7 Copyright (c) 2000-2013 Torus Knot Software Ltd 8 Permission is hereby granted, free of charge, to any person obtaining a copy 9 of this software and associated documentation files (the "Software"), to deal 10 in the Software without restriction, including without limitation the rights 11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 copies of the Software, and to permit persons to whom the Software is 13 furnished to do so, subject to the following conditions: 14 15 The above copyright notice and this permission notice shall be included in 16 all copies or substantial portions of the Software. 17 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 THE SOFTWARE. 25 ----------------------------------------------------------------------------- 26 */ 27 #ifndef _ShaderParameter_ 28 #define _ShaderParameter_ 29 30 #include "OgreShaderPrerequisites.h" 31 #include "OgreGpuProgram.h" 32 #include "OgreVector2.h" 33 #include "OgreVector3.h" 34 #include "OgreVector4.h" 35 #include "OgreMatrix4.h" 36 37 namespace Ogre { 38 namespace RTShader { 39 40 /** \addtogroup Core 41 * @{ 42 */ 43 /** \addtogroup RTShader 44 * @{ 45 */ 46 47 /** A class that represents a shader based program parameter. 48 */ 49 class _OgreRTSSExport Parameter : public RTShaderSystemAlloc 50 { 51 public: 52 // Shader parameter semantic. 53 enum Semantic 54 { 55 /// Unknown semantic 56 SPS_UNKNOWN = 0, 57 /// Position 58 SPS_POSITION = 1, 59 /// Blending weights 60 SPS_BLEND_WEIGHTS = 2, 61 /// Blending indices 62 SPS_BLEND_INDICES = 3, 63 /// Normal, 3 reals per vertex 64 SPS_NORMAL = 4, 65 /// General floating point color. 66 SPS_COLOR = 5, 67 /// Texture coordinates 68 SPS_TEXTURE_COORDINATES = 7, 69 /// Binormal (Y axis if normal is Z) 70 SPS_BINORMAL = 8, 71 /// Tangent (X axis if normal is Z) 72 SPS_TANGENT = 9 73 }; 74 75 // Shader parameter content. 76 enum Content 77 { 78 /// Unknown content 79 SPC_UNKNOWN, 80 81 /// Position in object space 82 SPC_POSITION_OBJECT_SPACE, 83 84 /// Position in world space 85 SPC_POSITION_WORLD_SPACE, 86 87 /// Position in view space 88 SPC_POSITION_VIEW_SPACE, 89 90 /// Position in projective space 91 SPC_POSITION_PROJECTIVE_SPACE, 92 93 /// Position in light space index 0-7 94 SPC_POSITION_LIGHT_SPACE0, 95 SPC_POSITION_LIGHT_SPACE1, 96 SPC_POSITION_LIGHT_SPACE2, 97 SPC_POSITION_LIGHT_SPACE3, 98 SPC_POSITION_LIGHT_SPACE4, 99 SPC_POSITION_LIGHT_SPACE5, 100 SPC_POSITION_LIGHT_SPACE6, 101 SPC_POSITION_LIGHT_SPACE7, 102 103 /// Normal in object space 104 SPC_NORMAL_OBJECT_SPACE, 105 106 /// Normal in world space 107 SPC_NORMAL_WORLD_SPACE, 108 109 /// Normal in view space 110 SPC_NORMAL_VIEW_SPACE, 111 112 /// Normal in tangent space 113 SPC_NORMAL_TANGENT_SPACE, 114 115 /// View vector in object space 116 SPC_POSTOCAMERA_OBJECT_SPACE, 117 118 /// View vector in world space 119 SPC_POSTOCAMERA_WORLD_SPACE, 120 121 /// View vector in view space 122 SPC_POSTOCAMERA_VIEW_SPACE, 123 124 /// View vector in tangent space 125 SPC_POSTOCAMERA_TANGENT_SPACE, 126 127 /// Light vector in object space index 0-7 128 SPC_POSTOLIGHT_OBJECT_SPACE0, 129 SPC_POSTOLIGHT_OBJECT_SPACE1, 130 SPC_POSTOLIGHT_OBJECT_SPACE2, 131 SPC_POSTOLIGHT_OBJECT_SPACE3, 132 SPC_POSTOLIGHT_OBJECT_SPACE4, 133 SPC_POSTOLIGHT_OBJECT_SPACE5, 134 SPC_POSTOLIGHT_OBJECT_SPACE6, 135 SPC_POSTOLIGHT_OBJECT_SPACE7, 136 137 /// Light vector in world space index 0-7 138 SPC_POSTOLIGHT_WORLD_SPACE0, 139 SPC_POSTOLIGHT_WORLD_SPACE1, 140 SPC_POSTOLIGHT_WORLD_SPACE2, 141 SPC_POSTOLIGHT_WORLD_SPACE3, 142 SPC_POSTOLIGHT_WORLD_SPACE4, 143 SPC_POSTOLIGHT_WORLD_SPACE5, 144 SPC_POSTOLIGHT_WORLD_SPACE6, 145 SPC_POSTOLIGHT_WORLD_SPACE7, 146 147 /// Light vector in view space index 0-7 148 SPC_POSTOLIGHT_VIEW_SPACE0, 149 SPC_POSTOLIGHT_VIEW_SPACE1, 150 SPC_POSTOLIGHT_VIEW_SPACE2, 151 SPC_POSTOLIGHT_VIEW_SPACE3, 152 SPC_POSTOLIGHT_VIEW_SPACE4, 153 SPC_POSTOLIGHT_VIEW_SPACE5, 154 SPC_POSTOLIGHT_VIEW_SPACE6, 155 SPC_POSTOLIGHT_VIEW_SPACE7, 156 157 /// Light vector in tangent space index 0-7 158 SPC_POSTOLIGHT_TANGENT_SPACE0, 159 SPC_POSTOLIGHT_TANGENT_SPACE1, 160 SPC_POSTOLIGHT_TANGENT_SPACE2, 161 SPC_POSTOLIGHT_TANGENT_SPACE3, 162 SPC_POSTOLIGHT_TANGENT_SPACE4, 163 SPC_POSTOLIGHT_TANGENT_SPACE5, 164 SPC_POSTOLIGHT_TANGENT_SPACE6, 165 SPC_POSTOLIGHT_TANGENT_SPACE7, 166 167 /// Light direction in object space index 0-7 168 SPC_LIGHTDIRECTION_OBJECT_SPACE0, 169 SPC_LIGHTDIRECTION_OBJECT_SPACE1, 170 SPC_LIGHTDIRECTION_OBJECT_SPACE2, 171 SPC_LIGHTDIRECTION_OBJECT_SPACE3, 172 SPC_LIGHTDIRECTION_OBJECT_SPACE4, 173 SPC_LIGHTDIRECTION_OBJECT_SPACE5, 174 SPC_LIGHTDIRECTION_OBJECT_SPACE6, 175 SPC_LIGHTDIRECTION_OBJECT_SPACE7, 176 177 /// Light direction in world space index 0-7 178 SPC_LIGHTDIRECTION_WORLD_SPACE0, 179 SPC_LIGHTDIRECTION_WORLD_SPACE1, 180 SPC_LIGHTDIRECTION_WORLD_SPACE2, 181 SPC_LIGHTDIRECTION_WORLD_SPACE3, 182 SPC_LIGHTDIRECTION_WORLD_SPACE4, 183 SPC_LIGHTDIRECTION_WORLD_SPACE5, 184 SPC_LIGHTDIRECTION_WORLD_SPACE6, 185 SPC_LIGHTDIRECTION_WORLD_SPACE7, 186 187 /// Light direction in view space index 0-7 188 SPC_LIGHTDIRECTION_VIEW_SPACE0, 189 SPC_LIGHTDIRECTION_VIEW_SPACE1, 190 SPC_LIGHTDIRECTION_VIEW_SPACE2, 191 SPC_LIGHTDIRECTION_VIEW_SPACE3, 192 SPC_LIGHTDIRECTION_VIEW_SPACE4, 193 SPC_LIGHTDIRECTION_VIEW_SPACE5, 194 SPC_LIGHTDIRECTION_VIEW_SPACE6, 195 SPC_LIGHTDIRECTION_VIEW_SPACE7, 196 197 /// Light direction in tangent space index 0-7 198 SPC_LIGHTDIRECTION_TANGENT_SPACE0, 199 SPC_LIGHTDIRECTION_TANGENT_SPACE1, 200 SPC_LIGHTDIRECTION_TANGENT_SPACE2, 201 SPC_LIGHTDIRECTION_TANGENT_SPACE3, 202 SPC_LIGHTDIRECTION_TANGENT_SPACE4, 203 SPC_LIGHTDIRECTION_TANGENT_SPACE5, 204 SPC_LIGHTDIRECTION_TANGENT_SPACE6, 205 SPC_LIGHTDIRECTION_TANGENT_SPACE7, 206 207 /// Light position in object space index 0-7 208 SPC_LIGHTPOSITION_OBJECT_SPACE0, 209 SPC_LIGHTPOSITION_OBJECT_SPACE1, 210 SPC_LIGHTPOSITION_OBJECT_SPACE2, 211 SPC_LIGHTPOSITION_OBJECT_SPACE3, 212 SPC_LIGHTPOSITION_OBJECT_SPACE4, 213 SPC_LIGHTPOSITION_OBJECT_SPACE5, 214 SPC_LIGHTPOSITION_OBJECT_SPACE6, 215 SPC_LIGHTPOSITION_OBJECT_SPACE7, 216 217 /// Light position in world space index 0-7 218 SPC_LIGHTPOSITION_WORLD_SPACE0, 219 SPC_LIGHTPOSITION_WORLD_SPACE1, 220 SPC_LIGHTPOSITION_WORLD_SPACE2, 221 SPC_LIGHTPOSITION_WORLD_SPACE3, 222 SPC_LIGHTPOSITION_WORLD_SPACE4, 223 SPC_LIGHTPOSITION_WORLD_SPACE5, 224 SPC_LIGHTPOSITION_WORLD_SPACE6, 225 SPC_LIGHTPOSITION_WORLD_SPACE7, 226 227 /// Light position in view space index 0-7 228 SPC_LIGHTPOSITIONVIEW_SPACE0, 229 SPC_LIGHTPOSITIONVIEW_SPACE1, 230 SPC_LIGHTPOSITIONVIEW_SPACE2, 231 SPC_LIGHTPOSITIONVIEW_SPACE3, 232 SPC_LIGHTPOSITIONVIEW_SPACE4, 233 SPC_LIGHTPOSITIONVIEW_SPACE5, 234 SPC_LIGHTPOSITIONVIEW_SPACE6, 235 SPC_LIGHTPOSITIONVIEW_SPACE7, 236 237 /// Light position in tangent space index 0-7 238 SPC_LIGHTPOSITION_TANGENT_SPACE, 239 240 /// Blending weights 241 SPC_BLEND_WEIGHTS, 242 243 /// Blending indices 244 SPC_BLEND_INDICES, 245 246 /// Tangent in object space 247 SPC_TANGENT_OBJECT_SPACE, 248 249 /// Tangent in world space 250 SPC_TANGENT_WORLD_SPACE, 251 252 /// Tangent in view space 253 SPC_TANGENT_VIEW_SPACE, 254 255 /// Tangent in tangent space 256 SPC_TANGENT_TANGENT_SPACE, 257 258 /// Binormal in object space 259 SPC_BINORMAL_OBJECT_SPACE, 260 261 /// Binormal in world space 262 SPC_BINORMAL_WORLD_SPACE, 263 264 /// Binormal in view space 265 SPC_BINORMAL_VIEW_SPACE, 266 267 /// Binormal in tangent space 268 SPC_BINORMAL_TANGENT_SPACE, 269 270 /// Diffuse color 271 SPC_COLOR_DIFFUSE, 272 273 /// Specular color 274 SPC_COLOR_SPECULAR, 275 276 /// Depth in object space 277 SPC_DEPTH_OBJECT_SPACE, 278 279 /// Depth in world space 280 SPC_DEPTH_WORLD_SPACE, 281 282 /// Depth in view space 283 SPC_DEPTH_VIEW_SPACE, 284 285 /// Depth in projective space 286 SPC_DEPTH_PROJECTIVE_SPACE, 287 288 /// Texture coordinate set index 0-7 289 SPC_TEXTURE_COORDINATE0, 290 SPC_TEXTURE_COORDINATE1, 291 SPC_TEXTURE_COORDINATE2, 292 SPC_TEXTURE_COORDINATE3, 293 SPC_TEXTURE_COORDINATE4, 294 SPC_TEXTURE_COORDINATE5, 295 SPC_TEXTURE_COORDINATE6, 296 SPC_TEXTURE_COORDINATE7, 297 298 /// Reserved custom content range to be used by user custom shader extensions. 299 SPC_CUSTOM_CONTENT_BEGIN = 1000, 300 SPC_CUSTOM_CONTENT_END = 2000 301 }; 302 303 // Interface. 304 public: 305 /** */ 306 Parameter(); 307 308 /** Class constructor. 309 @param type The type of this parameter. 310 @param name The name of this parameter. 311 @param semantic The semantic of this parameter. 312 @param index The index of this parameter. 313 @param content The content of this parameter. 314 */ 315 Parameter(GpuConstantType type, const String& name, 316 const Semantic& semantic, int index, 317 const Content& content, size_t size = 0); 318 319 /** Class destructor */ ~Parameter()320 virtual ~Parameter() {}; 321 322 /** Get the name of this parameter. */ getName()323 const String& getName() const { return mName; } 324 325 /** Get the type of this parameter. */ getType()326 GpuConstantType getType() const { return mType; } 327 328 /** Get the semantic of this parameter. */ getSemantic()329 const Semantic& getSemantic() const { return mSemantic; } 330 331 /** Get the index of this parameter. */ getIndex()332 int getIndex() const { return mIndex; } 333 334 /** Return the content of this parameter. */ getContent()335 Content getContent() const { return mContent; } 336 337 /** Returns true if this instance is a ConstParameter otherwise false. */ isConstParameter()338 virtual bool isConstParameter() const { return false; } 339 340 /** Returns the string representation of this parameter. */ toString()341 virtual String toString() const { return mName; } 342 343 /** Returns Whether this parameter is an array. */ isArray()344 bool isArray() const { return mSize > 0; } 345 346 /** Returns the number of elements in the parameter (for arrays). */ getSize()347 size_t getSize() const { return mSize; } 348 349 /** Sets the number of elements in the parameter (for arrays). */ setSize(size_t size)350 void setSize(size_t size) { mSize = size; } 351 352 // Attributes. 353 protected: 354 // Name of this parameter. 355 String mName; 356 // Type of this parameter. 357 GpuConstantType mType; 358 // Semantic of this parameter. 359 Semantic mSemantic; 360 // Index of this parameter. 361 int mIndex; 362 // The content of this parameter. 363 Content mContent; 364 // Number of elements in the parameter (for arrays) 365 size_t mSize; 366 367 }; 368 369 typedef SharedPtr<Parameter> ParameterPtr; 370 typedef vector<ParameterPtr>::type ShaderParameterList; 371 typedef ShaderParameterList::iterator ShaderParameterIterator; 372 typedef ShaderParameterList::const_iterator ShaderParameterConstIterator; 373 374 /** Uniform parameter class. Allow fast access to GPU parameter updates. 375 */ 376 class _OgreRTSSExport UniformParameter : public Parameter 377 { 378 public: 379 380 /** Class constructor. 381 @param type The type of this parameter. 382 @param name The name of this parameter. 383 @param semantic The semantic of this parameter. 384 @param index The index of this parameter. 385 @param content The content of this parameter. 386 @param variability How this parameter varies (bitwise combination of GpuProgramVariability). 387 @param size number of elements in the parameter. 388 */ 389 UniformParameter(GpuConstantType type, const String& name, 390 const Semantic& semantic, int index, 391 const Content& content, 392 uint16 variability, size_t size); 393 394 /** Class constructor. 395 @param autoType The auto type of this parameter. 396 @param fAutoConstantData The real data for this auto constant parameter. 397 @param size number of elements in the parameter. 398 */ 399 UniformParameter(GpuProgramParameters::AutoConstantType autoType, Real fAutoConstantData, size_t size); 400 401 /** Class constructor. 402 @param autoType The auto type of this parameter. 403 @param fAutoConstantData The real data for this auto constant parameter. 404 @param size number of elements in the parameter. 405 @param type The desired data type of this auto constant parameter. 406 */ 407 UniformParameter(GpuProgramParameters::AutoConstantType autoType, Real fAutoConstantData, size_t size, GpuConstantType type); 408 409 /** Class constructor. 410 @param autoType The auto type of this parameter. 411 @param nAutoConstantData The int data for this auto constant parameter. 412 @param size number of elements in the parameter. 413 */ 414 UniformParameter(GpuProgramParameters::AutoConstantType autoType, size_t nAutoConstantData, size_t size); 415 416 /** Class constructor. 417 @param autoType The auto type of this parameter. 418 @param nAutoConstantData The int data for this auto constant parameter. 419 @param size number of elements in the parameter. 420 @param type The desired data type of this auto constant parameter. 421 */ 422 UniformParameter(GpuProgramParameters::AutoConstantType autoType, size_t nAutoConstantData, size_t size, GpuConstantType type); 423 424 425 /** Get auto constant int data of this parameter, in case it is auto constant parameter. */ getAutoConstantIntData()426 size_t getAutoConstantIntData() const { return mAutoConstantIntData; } 427 428 /** Get auto constant real data of this parameter, in case it is auto constant parameter. */ getAutoConstantRealData()429 Real getAutoConstantRealData() const { return mAutoConstantRealData; } 430 431 /** Return true if this parameter is a floating point type, false otherwise. */ 432 bool isFloat() const; 433 434 /** Return true if this parameter is a texture sampler type, false otherwise. */ 435 bool isSampler() const; 436 437 /** Return true if this parameter is an auto constant parameter, false otherwise. */ isAutoConstantParameter()438 bool isAutoConstantParameter() const { return mIsAutoConstantReal || mIsAutoConstantInt; } 439 440 /** Return true if this parameter an auto constant with int data type, false otherwise. */ isAutoConstantIntParameter()441 bool isAutoConstantIntParameter() const { return mIsAutoConstantInt; } 442 443 /** Return true if this parameter an auto constant with real data type, false otherwise. */ isAutoConstantRealParameter()444 bool isAutoConstantRealParameter() const { return mIsAutoConstantReal; } 445 446 /** Return the auto constant type of this parameter. */ getAutoConstantType()447 GpuProgramParameters::AutoConstantType getAutoConstantType () const { return mAutoConstantType; } 448 449 /** Return the variability of this parameter. */ getVariability()450 uint16 getVariability() const { return mVariability; } 451 452 /** Bind this parameter to the corresponding GPU parameter. */ 453 void bind(GpuProgramParametersSharedPtr paramsPtr); 454 455 public: 456 457 /** Update the GPU parameter with the given value. */ setGpuParameter(int val)458 void setGpuParameter(int val) 459 { 460 if (mParamsPtr != NULL) 461 { 462 mParamsPtr->_writeRawConstant(mPhysicalIndex, val); 463 } 464 } 465 466 /** Update the GPU parameter with the given value. */ setGpuParameter(Real val)467 void setGpuParameter(Real val) 468 { 469 if (mParamsPtr != NULL) 470 { 471 mParamsPtr->_writeRawConstant(mPhysicalIndex, val); 472 } 473 } 474 475 /** Update the GPU parameter with the given value. */ setGpuParameter(const ColourValue & val)476 void setGpuParameter(const ColourValue& val) 477 { 478 if (mParamsPtr != NULL) 479 { 480 mParamsPtr->_writeRawConstant(mPhysicalIndex, val); 481 } 482 } 483 484 /** Update the GPU parameter with the given value. */ setGpuParameter(const Vector2 & val)485 void setGpuParameter(const Vector2& val) 486 { 487 if (mParamsPtr != NULL) 488 { 489 mParamsPtr->_writeRawConstants(mPhysicalIndex, val.ptr(), 2); 490 } 491 } 492 493 /** Update the GPU parameter with the given value. */ setGpuParameter(const Vector3 & val)494 void setGpuParameter(const Vector3& val) 495 { 496 if (mParamsPtr != NULL) 497 { 498 mParamsPtr->_writeRawConstant(mPhysicalIndex, val); 499 } 500 } 501 502 /** Update the GPU parameter with the given value. */ setGpuParameter(const Vector4 & val)503 void setGpuParameter(const Vector4& val) 504 { 505 if (mParamsPtr != NULL) 506 { 507 mParamsPtr->_writeRawConstant(mPhysicalIndex, val); 508 } 509 } 510 511 /** Update the GPU parameter with the given value. */ setGpuParameter(const Matrix4 & val)512 void setGpuParameter(const Matrix4& val) 513 { 514 if (mParamsPtr != NULL) 515 { 516 mParamsPtr->_writeRawConstant(mPhysicalIndex, val, 16); 517 } 518 } 519 520 /** Update the GPU parameter with the given value. */ 521 void setGpuParameter(const float *val, size_t count, size_t multiple = 4) 522 { 523 if (mParamsPtr != NULL) 524 { 525 mParamsPtr->_writeRawConstants(mPhysicalIndex, val, count * multiple); 526 } 527 } 528 529 /** Update the GPU parameter with the given value. */ 530 void setGpuParameter(const double *val, size_t count, size_t multiple = 4) 531 { 532 if (mParamsPtr != NULL) 533 { 534 mParamsPtr->_writeRawConstants(mPhysicalIndex, val, count * multiple); 535 } 536 } 537 538 /** Update the GPU parameter with the given value. */ 539 void setGpuParameter(const int *val, size_t count, size_t multiple = 4) 540 { 541 if (mParamsPtr != NULL) 542 { 543 mParamsPtr->_writeRawConstants(mPhysicalIndex, val, count * multiple); 544 } 545 } 546 547 protected: 548 // Is it auto constant real based parameter. 549 bool mIsAutoConstantReal; 550 // Is it auto constant int based parameter. 551 bool mIsAutoConstantInt; 552 GpuProgramParameters::AutoConstantType mAutoConstantType; // The auto constant type of this parameter. 553 union 554 { 555 // Auto constant int data. 556 size_t mAutoConstantIntData; 557 // Auto constant real data. 558 Real mAutoConstantRealData; 559 }; 560 // How this parameter varies (bitwise combination of GpuProgramVariability). 561 uint16 mVariability; 562 // The actual GPU parameters pointer. 563 GpuProgramParameters* mParamsPtr; 564 // The physical index of this parameter in the GPU program. 565 size_t mPhysicalIndex; 566 }; 567 568 typedef SharedPtr<UniformParameter> UniformParameterPtr; 569 typedef vector<UniformParameterPtr>::type UniformParameterList; 570 typedef UniformParameterList::iterator UniformParameterIterator; 571 typedef UniformParameterList::const_iterator UniformParameterConstIterator; 572 573 /** Helper template which is the base for our ConstParameters 574 */ 575 template <class valueType> 576 class ConstParameter : public Parameter 577 { 578 public: 579 ConstParameter(valueType val,GpuConstantType type,const Semantic & semantic,const Content & content)580 ConstParameter( valueType val, 581 GpuConstantType type, 582 const Semantic& semantic, 583 const Content& content) 584 : Parameter(type, "Constant", semantic, 0, content) 585 { 586 mValue = val; 587 } 588 ~ConstParameter()589 virtual ~ConstParameter () {} 590 591 /** Returns the native value of this parameter. (for example a Vector3) */ getValue()592 const valueType& getValue() const { return mValue; } 593 594 /** 595 @see Parameter::isConstParameter. 596 */ isConstParameter()597 virtual bool isConstParameter() const { return true; } 598 599 /** 600 @see Parameter::toString. 601 */ 602 virtual String toString() const = 0; 603 604 protected: 605 valueType mValue; 606 }; 607 608 /** Helper utility class that creates common parameters. 609 */ 610 class _OgreRTSSExport ParameterFactory 611 { 612 613 // Interface. 614 public: 615 616 static ParameterPtr createInPosition(int index); 617 static ParameterPtr createOutPosition(int index); 618 619 static ParameterPtr createInNormal(int index); 620 static ParameterPtr createInWeights(int index); 621 static ParameterPtr createInIndices(int index); 622 static ParameterPtr createOutNormal(int index); 623 static ParameterPtr createInBiNormal(int index); 624 static ParameterPtr createOutBiNormal(int index); 625 static ParameterPtr createInTangent(int index); 626 static ParameterPtr createOutTangent(int index); 627 static ParameterPtr createInColor(int index); 628 static ParameterPtr createOutColor(int index); 629 630 static ParameterPtr createInTexcoord(GpuConstantType type, int index, Parameter::Content content); 631 static ParameterPtr createOutTexcoord(GpuConstantType type, int index, Parameter::Content content); 632 static ParameterPtr createInTexcoord1(int index, Parameter::Content content); 633 static ParameterPtr createOutTexcoord1(int index, Parameter::Content content); 634 static ParameterPtr createInTexcoord2(int index, Parameter::Content content); 635 static ParameterPtr createOutTexcoord2(int index, Parameter::Content content); 636 static ParameterPtr createInTexcoord3(int index, Parameter::Content content); 637 static ParameterPtr createOutTexcoord3(int index, Parameter::Content content); 638 static ParameterPtr createInTexcoord4(int index, Parameter::Content content); 639 static ParameterPtr createOutTexcoord4(int index, Parameter::Content content); 640 641 static ParameterPtr createConstParamVector2(Vector2 val); 642 static ParameterPtr createConstParamVector3(Vector3 val); 643 static ParameterPtr createConstParamVector4(Vector4 val); 644 static ParameterPtr createConstParamFloat(float val); 645 646 static UniformParameterPtr createSampler(GpuConstantType type, int index); 647 static UniformParameterPtr createSampler1D(int index); 648 static UniformParameterPtr createSampler2D(int index); 649 static UniformParameterPtr createSampler2DArray(int index); 650 static UniformParameterPtr createSampler3D(int index); 651 static UniformParameterPtr createSamplerCUBE(int index); 652 653 static UniformParameterPtr createUniform(GpuConstantType type, int index, uint16 variability, const String& suggestedName, size_t size); 654 }; 655 656 657 658 /** @} */ 659 /** @} */ 660 661 } 662 } 663 664 #endif 665