MLR.hpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. //===========================================================================//
  2. // File: MLRStuff.hpp //
  3. //---------------------------------------------------------------------------//
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. //===========================================================================//
  6. #pragma once
  7. #define MLR_MLR_HPP
  8. #if !defined(STUFF_STUFF_HPP)
  9. #include <Stuff\Stuff.hpp>
  10. #endif
  11. namespace MidLevelRenderer
  12. {
  13. //
  14. //--------------
  15. // Stuff classes
  16. //--------------
  17. //
  18. enum
  19. {
  20. MLRStateClassID = Stuff::FirstMLRClassID,
  21. MLRClippingStateClassID,
  22. MLRClipperClassID,
  23. MLRSorterClassID,
  24. MLRSortByOrderClassID,
  25. MLRLightClassID,
  26. MLRTexturePoolClassID,
  27. MLRPrimitiveClassID,
  28. MLRIndexedPrimitiveClassID,
  29. MLRPolyMeshClassID,
  30. MLRIndexedPolyMeshClassID,
  31. MLRShapeClassID,
  32. MLREffectClassID,
  33. MLRPointCloudClassID,
  34. MLRTriangleCloudClassID,
  35. MLRAmbientLightClassID,
  36. MLRInfiniteLightClassID,
  37. MLRInfiniteLightWithFalloffClassID,
  38. MLRPointLightClassID,
  39. MLRSpotLightClassID,
  40. MLRLightMapClassID,
  41. MLRPrimitiveBaseClassID,
  42. MLRIndexedPrimitiveBaseClassID,
  43. MLR_I_PMeshClassID,
  44. MLR_I_C_PMeshClassID,
  45. MLR_I_L_PMeshClassID,
  46. MLR_I_DT_PMeshClassID,
  47. MLR_I_C_DT_PMeshClassID,
  48. MLR_I_L_DT_PMeshClassID,
  49. MLRNGonCloudClassID,
  50. MLRCardCloudClassID,
  51. MLR_I_MT_PMeshClassID,
  52. MLR_I_DeT_PMeshClassID,
  53. MLR_I_C_DeT_PMeshClassID,
  54. MLR_I_L_DeT_PMeshClassID,
  55. MLR_I_TMeshClassID,
  56. MLR_I_DeT_TMeshClassID,
  57. MLR_I_C_TMeshClassID,
  58. MLR_I_L_TMeshClassID,
  59. MLR_TerrainClassID,
  60. MLR_Terrain2ClassID,
  61. MLRLineCloudClassID,
  62. MLRIndexedTriangleCloudClassID,
  63. MLR_I_DT_TMeshClassID,
  64. MLR_I_C_DT_TMeshClassID,
  65. MLR_I_L_DT_TMeshClassID,
  66. MLR_I_C_DeT_TMeshClassID,
  67. MLR_I_L_DeT_TMeshClassID,
  68. MLRLookUpLightClassID,
  69. FirstFreeMLRClassID
  70. };
  71. enum {
  72. Current_MLR_Version = 9
  73. };
  74. struct Limits {
  75. static unsigned
  76. Max_Number_Vertices_Per_Frame,
  77. Max_Number_Primitives_Per_Frame,
  78. Max_Number_ScreenQuads_Per_Frame,
  79. Max_Size_Of_LightMap_MemoryStream;
  80. enum {
  81. Max_Number_Vertices_Per_Mesh = 1024,
  82. Max_Number_Vertices_Per_Polygon = 32,
  83. Max_Number_Of_Texture_Bits = 14,
  84. Max_Number_Textures = 1 << Max_Number_Of_Texture_Bits,
  85. Max_Number_Of_NGon_Vertices = 9,
  86. Max_Number_Of_Multitextures = 8,
  87. Max_Number_Of_Lights_Per_Primitive = 16,
  88. Max_Number_Of_FogStates = 4
  89. };
  90. };
  91. int
  92. ReadMLRVersion(Stuff::MemoryStream *erf_stream);
  93. void
  94. WriteMLRVersion(Stuff::MemoryStream *erf_stream);
  95. void InitializeClasses(
  96. unsigned Max_Number_Vertices_Per_Frame = 8192,
  97. unsigned Max_Number_Primitives_Per_Frame = 1024,
  98. unsigned Max_Number_ScreenQuads_Per_Frame = 512,
  99. unsigned Max_Size_Of_LightMap_MemoryStream = 32768,
  100. bool Convert_To_Triangle_Meshes = true
  101. );
  102. void TerminateClasses();
  103. extern HGOSHEAP Heap;
  104. extern HGOSHEAP StaticHeap;
  105. extern bool ConvertToTriangleMeshes;
  106. DECLARE_TIMER(extern, Scene_Draw_Time);
  107. DECLARE_TIMER(extern, Transform_Time);
  108. DECLARE_TIMER(extern, Clipping_Time);
  109. DECLARE_TIMER(extern, GOS_Draw_Time);
  110. DECLARE_TIMER(extern, Vertex_Light_Time);
  111. DECLARE_TIMER(extern, LightMap_Light_Time);
  112. DECLARE_TIMER(extern, Texture_Sorting_Time);
  113. DECLARE_TIMER(extern, Alpha_Sorting_Time);
  114. DECLARE_TIMER(extern, Unlock_Texture_Time);
  115. extern DWORD Number_Of_Primitives;
  116. extern DWORD NumAllIndices;
  117. extern DWORD NumAllVertices;
  118. extern float Index_Over_Vertex_Ratio;
  119. extern DWORD TransformedVertices;
  120. extern DWORD NumberOfAlphaSortedTriangles;
  121. extern DWORD LitVertices;
  122. extern DWORD NonClippedVertices;
  123. extern DWORD ClippedVertices;
  124. extern DWORD PolysClippedButOutside;
  125. extern DWORD PolysClippedButInside;
  126. extern DWORD PolysClippedButOnePlane;
  127. extern DWORD PolysClippedButGOnePlane;
  128. extern bool PerspectiveMode;
  129. }
  130. #define COLOR_AS_DWORD 0
  131. #define EFECT_CLIPPED 0
  132. #define FOG_HACK 1
  133. #define TO_DO Abort_Program("Here has work to be done !");
  134. #undef MLR_TRACE
  135. #include <MLR\MLRState.hpp>
  136. #include <MLR\MLRTexture.hpp>
  137. #include <MLR\MLRTexturePool.hpp>
  138. #include <MLR\MLRClippingState.hpp>
  139. #include <MLR\MLRClipper.hpp>
  140. #include <MLR\MLRSorter.hpp>
  141. #include <MLR\MLRSortByOrder.hpp>
  142. #include <MLR\MLRLight.hpp>
  143. #include <MLR\MLRShape.hpp>
  144. #include <MLR\MLREffect.hpp>