Texture.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * ***** BEGIN GPL LICENSE BLOCK *****
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software Foundation,
  16. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. *
  18. * Copyright (c) 2006 The Zdeno Ash Miklas
  19. *
  20. * This source file is part of VideoTexture library
  21. *
  22. * Contributor(s):
  23. *
  24. * ***** END GPL LICENSE BLOCK *****
  25. */
  26. /** \file VideoTexture/Texture.h
  27. * \ingroup bgevideotex
  28. */
  29. #ifndef __TEXTURE_H__
  30. #define __TEXTURE_H__
  31. #include "EXP_PyObjectPlus.h"
  32. #include <structmember.h>
  33. #include "DNA_image_types.h"
  34. #include "BL_Texture.h"
  35. #include "KX_BlenderMaterial.h"
  36. #include "ImageBase.h"
  37. #include "BlendType.h"
  38. #include "Exception.h"
  39. struct ImBuf;
  40. // type Texture declaration
  41. struct Texture
  42. {
  43. PyObject_HEAD
  44. // texture is using blender material
  45. bool m_useMatTexture;
  46. // video texture bind code
  47. unsigned int m_actTex;
  48. // original texture bind code
  49. unsigned int m_orgTex;
  50. // original texture saved
  51. bool m_orgSaved;
  52. // kernel image buffer, to make sure the image is loaded before we swap the bindcode
  53. struct ImBuf *m_imgBuf;
  54. // texture image for game materials
  55. Image * m_imgTexture;
  56. // texture for blender materials
  57. BL_Texture * m_matTexture;
  58. // use mipmapping
  59. bool m_mipmap;
  60. // scaled image buffer
  61. ImBuf * m_scaledImBuf;
  62. // last refresh
  63. double m_lastClock;
  64. // image source
  65. PyImage * m_source;
  66. };
  67. // Texture type description
  68. extern PyTypeObject TextureType;
  69. // load texture
  70. void loadTexture(unsigned int texId, unsigned int *texture, short *size,
  71. bool mipmap = false);
  72. // get material
  73. RAS_IPolyMaterial *getMaterial(PyObject *obj, short matID);
  74. // get material ID
  75. short getMaterialID(PyObject *obj, const char *name);
  76. // Exceptions
  77. extern ExceptionID MaterialNotAvail;
  78. #endif