PolyGLSLProgram.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * PolyCGProgram.h
  3. * Poly
  4. *
  5. * Created by Ivan Safrin on 9/20/08.
  6. * Copyright 2008 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. // @package Materials
  10. #pragma once
  11. #include "PolyGlobals.h"
  12. #ifdef COMPILE_CG_SUPPORT
  13. #include "PolyLogger.h"
  14. #include "PolyResource.h"
  15. #include "PolyVector3.h"
  16. #include "PolyUtil.h"
  17. #include <vector>
  18. #include <CG/cg.h>
  19. using std::vector;
  20. class _PolyExport CGProgramParam {
  21. public:
  22. CGparameter cgParam;
  23. string name;
  24. bool isAuto;
  25. int autoID;
  26. void *defaultData;
  27. int paramType;
  28. static void *createParamData(int *retType, string type, string value);
  29. static const int TAU_MODELVIEWPROJ_MATRIX = 0;
  30. static const int TAU_MODELVIEW_MATRIX = 2;
  31. static const int TAU_MODELVIEW_INVERSE_MATRIX = 3;
  32. static const int TAU_EXPOSURE_LEVEL = 7;
  33. static const int TAU_CLEARCOLOR = 10;
  34. static const int TAU_AMBIENTCOLOR = 11;
  35. static const int TAU_AREA_LIGHT_POSITION_0 = 12;
  36. static const int TAU_AREA_LIGHT_COLOR_0 = 13;
  37. static const int TAU_AREA_LIGHT_POSITION_1 = 14;
  38. static const int TAU_AREA_LIGHT_COLOR_1 = 15;
  39. static const int TAU_AREA_LIGHT_POSITION_2 = 16;
  40. static const int TAU_AREA_LIGHT_COLOR_2 = 17;
  41. static const int TAU_AREA_LIGHT_POSITION_3 = 18;
  42. static const int TAU_AREA_LIGHT_COLOR_3 = 19;
  43. static const int TAU_AREA_LIGHT_POSITION_4 = 20;
  44. static const int TAU_AREA_LIGHT_COLOR_4 = 21;
  45. static const int TAU_AREA_LIGHT_POSITION_5 = 22;
  46. static const int TAU_AREA_LIGHT_COLOR_5 = 23;
  47. static const int TAU_AREA_LIGHT_POSITION_6 = 24;
  48. static const int TAU_AREA_LIGHT_COLOR_6 = 25;
  49. static const int TAU_AREA_LIGHT_POSITION_7 = 26;
  50. static const int TAU_AREA_LIGHT_COLOR_7 = 27;
  51. static const int TAU_SPOT_LIGHT_POSITION_0 = 30;
  52. static const int TAU_SPOT_LIGHT_COLOR_0 = 31;
  53. static const int TAU_SPOT_LIGHT_DIRECTION_0 = 32;
  54. static const int TAU_SPOT_LIGHT_POSITION_1 = 33;
  55. static const int TAU_SPOT_LIGHT_COLOR_1 = 34;
  56. static const int TAU_SPOT_LIGHT_DIRECTION_1 = 35;
  57. static const int TAU_SPOT_LIGHT_POSITION_2 = 36;
  58. static const int TAU_SPOT_LIGHT_COLOR_2 = 37;
  59. static const int TAU_SPOT_LIGHT_DIRECTION_2 = 38;
  60. static const int TAU_SPOT_LIGHT_POSITION_3 = 39;
  61. static const int TAU_SPOT_LIGHT_COLOR_3 = 40;
  62. static const int TAU_SPOT_LIGHT_DIRECTION_3 = 41;
  63. static const int TAU_SPOT_LIGHT_TEXTUREMATRIX_0 = 42;
  64. static const int TAU_SPOT_LIGHT_TEXTUREMATRIX_1 = 43;
  65. static const int TAU_SPOT_LIGHT_TEXTUREMATRIX_2 = 44;
  66. static const int TAU_SPOT_LIGHT_TEXTUREMATRIX_3 = 45;
  67. static const int PARAM_UNKNOWN = 0;
  68. static const int PARAM_FLOAT = 1;
  69. static const int PARAM_FLOAT3 = 2;
  70. static const int PARAM_FLOAT4 = 3;
  71. };
  72. namespace Polycode {
  73. class _PolyExport CGProgram : public Resource {
  74. public:
  75. CGProgram(int type);
  76. ~CGProgram();
  77. void addParam(string name, bool isAuto, int autoID, int paramType, void *defaultData);
  78. CGprogram program;
  79. CGparameter modelViewProjection;
  80. static const int TYPE_VERT = 0;
  81. static const int TYPE_FRAG = 1;
  82. int type;
  83. vector<CGProgramParam> params;
  84. };
  85. }
  86. #endif