MLR_I_DT_PMesh.hpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #pragma once
  5. #define MLR_MLR_I_DT_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 no color no lighting two texture layer #####
  15. //##########################################################################
  16. class MLR_I_DT_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_DT_PMesh(
  32. ClassData *class_data,
  33. Stuff::MemoryStream *stream,
  34. int version
  35. );
  36. ~MLR_I_DT_PMesh();
  37. public:
  38. MLR_I_DT_PMesh(ClassData *class_data=MLR_I_DT_PMesh::DefaultData);
  39. static MLR_I_DT_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. virtual int TransformAndClip(Stuff::Matrix4D *, MLRClippingState, GOSVertexPool*,bool=false);
  49. virtual void
  50. TransformNoClip(Stuff::Matrix4D*, GOSVertexPool*,bool=false);
  51. void
  52. SetTexCoordData(const Vector2DScalar*, int);
  53. virtual void
  54. SetReferenceState(const MLRState& _state, int pass=0)
  55. {
  56. Check_Object(this);
  57. Verify(pass>=0 && pass<2);
  58. if(pass==0)
  59. {
  60. referenceState = _state;
  61. }
  62. else
  63. {
  64. passes = 2;
  65. referenceState2 = _state;
  66. }
  67. }
  68. virtual const MLRState&
  69. GetReferenceState(int pass=0) const
  70. {
  71. Check_Object(this);
  72. if(pass==0)
  73. return referenceState;
  74. else
  75. return referenceState2;
  76. }
  77. virtual const MLRState&
  78. GetCurrentState(int pass=0) const
  79. {
  80. Check_Object(this);
  81. if(pass==0)
  82. return state;
  83. else
  84. return state2;
  85. }
  86. virtual void
  87. CombineStates (const MLRState& master)
  88. {
  89. Check_Object(this);
  90. state.Combine(master, referenceState);
  91. state2.Combine(master, referenceState2);
  92. };
  93. virtual GOSVertex*
  94. GetGOSVertices(int pass=0)
  95. {
  96. Check_Object(this);
  97. if(pass==0)
  98. return gos_vertices;
  99. else
  100. return gos_vertices+numGOSVertices;
  101. }
  102. #if 0
  103. virtual unsigned short*
  104. GetGOSIndices(int pass=0)
  105. {
  106. Check_Object(this);
  107. if(pass==0)
  108. return gos_indices;
  109. else
  110. return gos_indices2;
  111. }
  112. #endif
  113. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  114. // Class Data Support
  115. //
  116. public:
  117. static ClassData
  118. *DefaultData;
  119. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  120. // Testing
  121. //
  122. public:
  123. void
  124. TestInstance() const;
  125. virtual int
  126. GetSize()
  127. {
  128. Check_Object(this);
  129. int ret = MLR_I_PMesh::GetSize();
  130. return ret;
  131. }
  132. protected:
  133. MLRState state2, referenceState2;
  134. static Stuff::DynamicArrayOf<Vector2DScalar> *texCoords2; // Max_Number_Vertices_Per_Mesh
  135. static Stuff::DynamicArrayOf<Vector2DScalar> *clipExtraTexCoords2; // Max_Number_Vertices_Per_Mesh
  136. };
  137. MLR_I_DT_PMesh*
  138. CreateIndexedCube_NoColor_NoLit_2Tex(Stuff::Scalar, MLRState*, MLRState*);
  139. MLRShape*
  140. CreateIndexedIcosahedron_NoColor_NoLit_2Tex(
  141. IcoInfo&,
  142. MLRState*,
  143. MLRState*
  144. );
  145. }