MLR_I_MT_PMesh.hpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #pragma once
  5. #define MLR_MLR_I_MT_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 multi texture layer ####
  15. //##########################################################################
  16. class MLR_I_MT_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_MT_PMesh(
  32. ClassData *class_data,
  33. Stuff::MemoryStream *stream,
  34. int version
  35. );
  36. ~MLR_I_MT_PMesh();
  37. public:
  38. MLR_I_MT_PMesh(ClassData *class_data=MLR_I_MT_PMesh::DefaultData);
  39. static MLR_I_MT_PMesh*
  40. Make(
  41. Stuff::MemoryStream *stream,
  42. int version
  43. );
  44. void
  45. Save(Stuff::MemoryStream *stream);
  46. public:
  47. void Copy(MLR_I_PMesh*);
  48. virtual int
  49. TransformAndClip(Stuff::Matrix4D *, MLRClippingState, GOSVertexPool*,bool=false);
  50. virtual void
  51. TransformNoClip(Stuff::Matrix4D*, GOSVertexPool*,bool=false);
  52. void
  53. SetTexCoordData(const Vector2DScalar*, int, int pass=0);
  54. void
  55. GetTexCoordData(const Vector2DScalar **data, int *dataSize, int pass);
  56. virtual void
  57. SetReferenceState(const MLRState& _state, int pass=0)
  58. {
  59. Check_Object(this);
  60. Verify(pass>=0 && pass<Limits::Max_Number_Of_Multitextures);
  61. if(pass==0)
  62. {
  63. referenceState = _state;
  64. }
  65. multiReferenceState[pass] = _state;
  66. }
  67. virtual const MLRState&
  68. GetReferenceState(int pass=0) const
  69. {
  70. Check_Object(this);
  71. Verify(pass>=0 && pass<Limits::Max_Number_Of_Multitextures);
  72. return multiReferenceState[pass];
  73. }
  74. virtual const MLRState&
  75. GetCurrentState(int pass=0) const
  76. {
  77. Check_Object(this);
  78. Verify(pass>=0 && pass<Limits::Max_Number_Of_Multitextures);
  79. return multiState[pass];
  80. }
  81. virtual void
  82. CombineStates (const MLRState& master)
  83. {
  84. Check_Object(this);
  85. state.Combine(master, referenceState);
  86. for(int i=0;i<currentNrOfPasses;i++)
  87. {
  88. multiState[i].Combine(master, multiReferenceState[i]);
  89. }
  90. };
  91. virtual GOSVertex*
  92. GetGOSVertices(int pass=0)
  93. {
  94. Check_Object(this);
  95. Verify(pass>=0 && pass<Limits::Max_Number_Of_Multitextures);
  96. return gos_vertices + pass*numGOSVertices;
  97. }
  98. virtual void
  99. InitializeDrawPrimitive(unsigned char, int=0);
  100. int
  101. GetNumPasses()
  102. { Check_Object(this); return currentNrOfPasses; }
  103. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  104. // Class Data Support
  105. //
  106. public:
  107. static ClassData
  108. *DefaultData;
  109. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  110. // Testing
  111. //
  112. public:
  113. void
  114. TestInstance() const;
  115. virtual int
  116. GetSize()
  117. {
  118. Check_Object(this);
  119. int ret = MLR_I_PMesh::GetSize();
  120. return ret;
  121. }
  122. protected:
  123. void
  124. SetTexCoordDataPointer(const Vector2DScalar*);
  125. unsigned char currentNrOfPasses;
  126. Stuff::DynamicArrayOf<MLRState> multiState, multiReferenceState;
  127. Stuff::DynamicArrayOf<Stuff::DynamicArrayOf<Vector2DScalar>* > multiTexCoords; // Max_Number_Vertices_Per_Mesh
  128. Stuff::DynamicArrayOf<const Vector2DScalar*> multiTexCoordsPointers;
  129. static Stuff::DynamicArrayOf<Stuff::DynamicArrayOf<Vector2DScalar> > *clipExtraMultiTexCoords; // Max_Number_Vertices_Per_Mesh
  130. static Stuff::DynamicArrayOf<Stuff::DynamicArrayOf<Vector2DScalar> > *extraMultiTexCoords; // Max_Number_Vertices_Per_Mesh
  131. };
  132. MLRShape*
  133. CreateIndexedIcosahedron_NoColor_NoLit_MultiTexture(
  134. IcoInfo&,
  135. Stuff::DynamicArrayOf<MLRState>*
  136. );
  137. }