MLRTexture.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #pragma once
  5. #define MLR_MLRTEXTURE_HPP
  6. #if !defined(MLR_MLR_HPP)
  7. #include <MLR\MLR.hpp>
  8. #endif
  9. #if !defined(MLR_GOSIMAGE_HPP)
  10. #include <MLR\GOSImage.hpp>
  11. #endif
  12. namespace MidLevelRenderer {
  13. class MLRTexturePool;
  14. class MLRTexture
  15. #if defined(_ARMOR)
  16. : public Stuff::Signature
  17. #endif
  18. {
  19. friend class MLRTexturePool;
  20. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  21. // Constructors/Destructors
  22. //
  23. protected:
  24. MLRTexture(Stuff::MemoryStream *stream);
  25. public:
  26. MLRTexture(
  27. MLRTexturePool *pool,
  28. const char* name,
  29. int instance,
  30. int handle,
  31. int hint=0
  32. );
  33. MLRTexture(
  34. MLRTexturePool *pool,
  35. GOSImage* image,
  36. int handle,
  37. int hint=0
  38. );
  39. MLRTexture(const MLRTexture&);
  40. ~MLRTexture();
  41. static MLRTexture*
  42. Make(Stuff::MemoryStream *stream);
  43. void
  44. Save(Stuff::MemoryStream *stream);
  45. GOSImage*
  46. GetImage(int *h=NULL)
  47. { Check_Object(this); if(h) { *h = hint; } return image; }
  48. const char*
  49. GetTextureName()
  50. {Check_Object(this); return textureName;}
  51. int
  52. GetTextureHandle()
  53. {Check_Object(this); return textureHandle;}
  54. int
  55. GetImageNumber();
  56. int
  57. GetInstanceNumber();
  58. int
  59. GetTextureInstance()
  60. {Check_Object(this); return instance;}
  61. bool
  62. GetAnimateTexture()
  63. {Check_Object(this); return !textureMatrixIsIdentity;}
  64. void
  65. SetAnimateTexture(bool yesNo)
  66. {
  67. Check_Object(this);
  68. if(yesNo==true)
  69. {
  70. textureMatrixIsIdentity = false;
  71. }
  72. else
  73. {
  74. textureMatrixIsIdentity = true;
  75. textureMatrix = Stuff::AffineMatrix4D::Identity;
  76. }
  77. }
  78. Stuff::AffineMatrix4D&
  79. GetTextureMatrix()
  80. { Check_Object(this); return textureMatrix; }
  81. void
  82. SetHint(int h)
  83. { Check_Object(this); hint = h; }
  84. int
  85. GetHint()
  86. { Check_Object(this); return hint; }
  87. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  88. // Testing
  89. //
  90. public:
  91. void
  92. TestInstance() const;
  93. protected:
  94. Stuff::MString textureName;
  95. int textureNameHashValue;
  96. int instance;
  97. int textureHandle;
  98. int hint;
  99. bool textureMatrixIsIdentity;
  100. Stuff::AffineMatrix4D textureMatrix;
  101. GOSImage *image;
  102. MLRTexturePool *thePool;
  103. };
  104. }