MLRSortByOrder.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #pragma once
  5. #define MLR_MLRSORTBYORDER_HPP
  6. #if !defined(MLR_MLR_HPP)
  7. #include <MLR\MLR.hpp>
  8. #endif
  9. #if !defined(MLR_MLRSTATE_HPP)
  10. #include <MLR\MLRState.hpp>
  11. #endif
  12. namespace MidLevelRenderer {
  13. struct SortAlpha {
  14. Stuff::Scalar distance;
  15. MLRState *state;
  16. GOSVertex triangle[3];
  17. };
  18. //##########################################################################
  19. //###################### MLRSortByOrder ##############################
  20. //##########################################################################
  21. class MLRSortByOrder :
  22. public MLRSorter
  23. {
  24. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  25. // Initialization
  26. //
  27. public:
  28. static void
  29. InitializeClass();
  30. static void
  31. TerminateClass();
  32. static ClassData
  33. *DefaultData;
  34. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35. // Constructors/Destructors
  36. //
  37. public:
  38. MLRSortByOrder(MLRTexturePool*);
  39. ~MLRSortByOrder();
  40. void AddPrimitive(MLRPrimitiveBase*, int=0);
  41. void AddEffect(MLREffect*, const MLRState&);
  42. void AddScreenQuads(GOSVertex*, const DrawScreenQuadsInformation*);
  43. virtual void AddSortRawData(SortData*);
  44. // starts the action
  45. void RenderNow ();
  46. // resets the sorting
  47. void Reset ();
  48. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49. // Testing
  50. //
  51. public:
  52. void
  53. TestInstance() const;
  54. protected:
  55. int
  56. lastUsedInBucket[MLRState::PriorityCount];
  57. Stuff::DynamicArrayOf<SortData*> //, Max_Number_Primitives_Per_Frame + Max_Number_ScreenQuads_Per_Frame
  58. priorityBuckets[MLRState::PriorityCount];
  59. Stuff::DynamicArrayOf<SortAlpha*> //, Max_Number_Primitives_Per_Frame + Max_Number_ScreenQuads_Per_Frame
  60. alphaSort;
  61. };
  62. }