MLR_I_C_PMesh.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #pragma once
  5. #define MLR_MLR_I_C_PMESH_HPP
  6. #if !defined(MLR_MLR_HPP)
  7. #include <MLR\MLR.hpp>
  8. #endif
  9. #if !defined(MLR_MLR_I_PMESH_HPP)
  10. #include <MLR\MLR_I_PMesh.hpp>
  11. #endif
  12. namespace MidLevelRenderer {
  13. //##########################################################################
  14. //#### MLRIndexedPolyMesh with color but no lighting one texture layer ####
  15. //##########################################################################
  16. class MLR_I_C_PMesh:
  17. public MLR_I_PMesh
  18. {
  19. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. // Initialization
  21. //
  22. public:
  23. static void
  24. InitializeClass();
  25. static void
  26. TerminateClass();
  27. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  28. // Constructors/Destructors
  29. //
  30. protected:
  31. MLR_I_C_PMesh(
  32. ClassData *class_data,
  33. Stuff::MemoryStream *stream,
  34. int version
  35. );
  36. ~MLR_I_C_PMesh();
  37. public:
  38. MLR_I_C_PMesh(ClassData *class_data=MLR_I_C_PMesh::DefaultData);
  39. static MLR_I_C_PMesh*
  40. Make(
  41. Stuff::MemoryStream *stream,
  42. int version
  43. );
  44. void
  45. Save(Stuff::MemoryStream *stream);
  46. public:
  47. // void Copy(MLRIndexedPolyMesh*);
  48. #if COLOR_AS_DWORD
  49. virtual void
  50. SetColorData(
  51. const DWORD *array,
  52. int point_count
  53. );
  54. virtual void
  55. GetColorData(
  56. DWORD **array,
  57. int *point_count
  58. );
  59. #else
  60. virtual void
  61. SetColorData(
  62. const Stuff::RGBAColor *array,
  63. int point_count
  64. );
  65. virtual void
  66. GetColorData(
  67. Stuff::RGBAColor **array,
  68. int *point_count
  69. );
  70. #endif
  71. virtual void
  72. #if COLOR_AS_DWORD
  73. PaintMe(const DWORD *paintMe);
  74. #else
  75. PaintMe(const Stuff::RGBAColor *paintMe);
  76. #endif
  77. virtual int TransformAndClip(Stuff::Matrix4D *, MLRClippingState, GOSVertexPool*,bool=false);
  78. virtual void
  79. TransformNoClip(Stuff::Matrix4D*, GOSVertexPool*,bool=false);
  80. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  81. // Class Data Support
  82. //
  83. public:
  84. static ClassData
  85. *DefaultData;
  86. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  87. // Testing
  88. //
  89. public:
  90. void
  91. TestInstance() const;
  92. virtual int
  93. GetSize()
  94. {
  95. Check_Object(this);
  96. int ret = MLR_I_PMesh::GetSize();
  97. ret += colors.GetSize();
  98. return ret;
  99. }
  100. protected:
  101. #if COLOR_AS_DWORD
  102. Stuff::DynamicArrayOf<DWORD> colors; // Base address of color list
  103. #else
  104. Stuff::DynamicArrayOf<Stuff::RGBAColor> colors; // Base address of color list
  105. #endif
  106. };
  107. MLR_I_C_PMesh*
  108. CreateIndexedCube_Color_NoLit(Stuff::Scalar, Stuff::RGBAColor*, MLRState*);
  109. MLR_I_PMesh*
  110. CreateIndexedViewFrustrum_Color_NoLit(
  111. Stuff::Scalar near_clip,
  112. Stuff::Scalar far_clip,
  113. Stuff::Scalar left_clip,
  114. Stuff::Scalar right_clip,
  115. Stuff::Scalar top_clip,
  116. Stuff::Scalar bottom_clip,
  117. Stuff::RGBAColor&,
  118. MLRState*
  119. );
  120. MLRShape*
  121. CreateIndexedIcosahedron_Color_NoLit(
  122. IcoInfo&,
  123. MLRState*
  124. );
  125. }