GOSImage.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #pragma once
  5. #define MLR_GOSIMAGE_HPP
  6. #if !defined(MLR_MLR_HPP)
  7. #include <MLR\MLR.hpp>
  8. #endif
  9. #if !defined(GAMEOS_HPP)
  10. #include <GameOS.hpp>
  11. #endif
  12. #ifndef TXMMGR_H
  13. #include "txmmgr.h"
  14. #endif
  15. namespace MidLevelRenderer {
  16. class GOSImage:
  17. public Stuff::Plug
  18. {
  19. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. // Constructors/Destructors
  21. //
  22. public:
  23. GOSImage(const char* imageName);
  24. GOSImage(DWORD imageHandle);
  25. GOSImage(const char*, gos_TextureHints);
  26. ~GOSImage();
  27. int
  28. GetWidth();
  29. int
  30. GetHeight();
  31. const char*
  32. GetName()
  33. { Check_Object(this); return imageName; }
  34. int
  35. Ref()
  36. { Check_Object(this); instance++; return instance; }
  37. int
  38. DeRef()
  39. { Check_Object(this); instance--; return instance; }
  40. int
  41. GetRef()
  42. { Check_Object(this); return instance; }
  43. bool
  44. IsLoaded()
  45. { Check_Object(this); return ( (flags & Loaded) != 0); }
  46. DWORD GetHandle()
  47. {
  48. Check_Object(this);
  49. DWORD imageHandle = mcTextureManager->get_gosTextureHandle(mcTextureNodeIndex);
  50. if (imageHandle == 0xffffffff)
  51. imageHandle = 0;
  52. return imageHandle;
  53. }
  54. void SetHandle (DWORD handle)
  55. {
  56. //EVERY call to this must change from gos_load to our load
  57. Check_Object(this);
  58. mcTextureNodeIndex = handle;
  59. }
  60. enum {
  61. Loaded = 1,
  62. Locked = 2
  63. };
  64. void
  65. LockImage();
  66. void
  67. UnlockImage();
  68. unsigned char*
  69. GetImagePtr();
  70. int
  71. GetPitch()
  72. { return ptr.Pitch; }
  73. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  74. // Testing
  75. //
  76. public:
  77. void
  78. TestInstance() const
  79. {}
  80. Stuff::MString imageName;
  81. int flags;
  82. protected:
  83. gos_TextureHints ipHints;
  84. int instance;
  85. DWORD mcTextureNodeIndex;
  86. TEXTUREPTR ptr;
  87. };
  88. }