PolyGLSLShader.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * PolyCGShader.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 "PolyShader.h"
  15. #include "PolyCGProgram.h"
  16. #include "PolyTexture.h"
  17. #include "PolyCubemap.h"
  18. #include <vector>
  19. #include <CG/cg.h>
  20. using std::vector;
  21. namespace Polycode {
  22. typedef struct {
  23. Texture *texture;
  24. string name;
  25. CGparameter vpParam;
  26. } CGTextureBinding;
  27. typedef struct {
  28. Cubemap *cubemap;
  29. string name;
  30. CGparameter vpParam;
  31. } CGCubemapBinding;
  32. class _PolyExport CGShader : public Shader {
  33. public:
  34. CGShader(CGProgram *vp, CGProgram *fp);
  35. virtual ~CGShader();
  36. ShaderBinding *createBinding();
  37. CGProgram *vp;
  38. CGProgram *fp;
  39. protected:
  40. };
  41. class _PolyExport CGShaderBinding : public ShaderBinding {
  42. public:
  43. CGShaderBinding(CGShader *shader);
  44. virtual ~CGShaderBinding();
  45. void addTexture(string name, Texture *texture);
  46. void addCubemap(string name, Cubemap *cubemap);
  47. void clearTexture(string name);
  48. void addParam(string type, string name, string value);
  49. vector<CGTextureBinding> textures;
  50. vector<CGCubemapBinding> cubemaps;
  51. CGShader *cgShader;
  52. };
  53. }
  54. #endif