MLRIndexedPrimitiveBase.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #pragma once
  5. #define MLR_MLRINDEXEDPRIMITIVEBASE_HPP
  6. #if !defined(MLR_MLR_HPP)
  7. #include <MLR\MLR.hpp>
  8. #endif
  9. namespace MidLevelRenderer {
  10. //##########################################################################
  11. //################### MLRIndexedPrimitiveBase ########################
  12. //##########################################################################
  13. class MLRIndexedPrimitiveBase:
  14. public MLRPrimitiveBase
  15. {
  16. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  17. // Initialization
  18. //
  19. public:
  20. static void
  21. InitializeClass();
  22. static void
  23. TerminateClass();
  24. static ClassData
  25. *DefaultData;
  26. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27. // Constructors/Destructors
  28. //
  29. protected:
  30. MLRIndexedPrimitiveBase(
  31. ClassData *class_data,
  32. Stuff::MemoryStream *stream,
  33. int version
  34. );
  35. ~MLRIndexedPrimitiveBase();
  36. public:
  37. MLRIndexedPrimitiveBase(ClassData *class_data);
  38. static MLRIndexedPrimitiveBase*
  39. Make(
  40. Stuff::MemoryStream *stream,
  41. int version
  42. );
  43. virtual void
  44. Save(Stuff::MemoryStream *stream);
  45. virtual void InitializeDrawPrimitive(unsigned char, int=0);
  46. virtual void Lighting(MLRLight* const*, int nrLights) = 0;
  47. virtual void
  48. SetCoordData(
  49. const Stuff::Point3D *array,
  50. int point_count
  51. );
  52. virtual void
  53. SetIndexData(
  54. unsigned short *index_array,
  55. int index_count
  56. );
  57. virtual void
  58. GetIndexData(
  59. unsigned short **index_array,
  60. int *index_count
  61. );
  62. virtual unsigned short*
  63. GetGOSIndices(int=0)
  64. { Check_Object(this); return gos_indices; }
  65. int
  66. GetNumGOSIndices()
  67. { Check_Object(this); return numGOSIndices; }
  68. virtual void
  69. Transform(Stuff::Matrix4D*);
  70. virtual void
  71. TransformNoClip(Stuff::Matrix4D*, GOSVertexPool*,bool=false) = 0;
  72. void
  73. TheIndexer(int num)
  74. {
  75. Check_Object(this);
  76. index.SetLength(num);
  77. for(unsigned short i=0;i<num;i++)
  78. {
  79. index[i] = i;
  80. }
  81. }
  82. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  83. // Testing
  84. //
  85. public:
  86. void
  87. TestInstance() const;
  88. virtual int
  89. GetSize()
  90. {
  91. Check_Object(this);
  92. int ret = MLRPrimitiveBase::GetSize();
  93. ret += visibleIndexedVertices.GetSize();
  94. ret += index.GetSize();
  95. return ret;
  96. }
  97. bool
  98. CheckIndicies();
  99. protected:
  100. bool visibleIndexedVerticesKey;
  101. Stuff::DynamicArrayOf<unsigned char> visibleIndexedVertices;
  102. Stuff::DynamicArrayOf<unsigned short> index; // List of color indexes
  103. static Stuff::DynamicArrayOf<unsigned short> *clipExtraIndex; // , Max_Number_Vertices_Per_Mesh
  104. unsigned short *gos_indices;
  105. unsigned short numGOSIndices;
  106. };
  107. }