MLRVertex.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #if !defined(MLR_MLRVERTEX_HPP)
  5. #define MLR_MLRVERTEX_HPP
  6. #if !defined(MLR_MLRSTUFF_HPP)
  7. #include <MLR\MLRStuff.hpp>
  8. #endif
  9. //##########################################################################
  10. //########################## MLRVertex ###############################
  11. //##########################################################################
  12. class MLRVertex :
  13. public RegisteredClass
  14. {
  15. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  16. // Initialization
  17. //
  18. public:
  19. static void
  20. InitializeClass();
  21. static void
  22. TerminateClass();
  23. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. // Constructors/Destructors
  25. //
  26. protected:
  27. MLRVertex(
  28. MemoryStream *stream,
  29. int version
  30. );
  31. public:
  32. MLRVertex();
  33. MLRVertex(const Point3D*, const RGBAColor*, const Vector3D*, const Vector2DOf<Scalar>*);
  34. MLRVertex(const Point3D&, const RGBAColor&, const Vector3D&, const Vector2DOf<Scalar>&);
  35. ~MLRVertex();
  36. static MLRVertex*
  37. Make(
  38. MemoryStream *stream,
  39. int version
  40. );
  41. void
  42. Save(MemoryStream *stream);
  43. inline MLRVertex&
  44. operator=(const Point3D& v)
  45. {
  46. Check_Pointer(this);
  47. // Tell_Value(v);
  48. coord = v;
  49. used |= 1;
  50. return *this;
  51. }
  52. inline MLRVertex&
  53. operator=(const RGBAColor& c)
  54. {
  55. Check_Pointer(this);
  56. // DEBUG_STREAM << "c = <" << c.alpha << ", " << c.red << ", ";
  57. // DEBUG_STREAM << c.green << ", " << c.blue << ">" << endl;
  58. color = c;
  59. used |= 2;
  60. return *this;
  61. }
  62. inline MLRVertex&
  63. operator=(const Vector3D& n)
  64. {
  65. Check_Pointer(this);
  66. normal = n;
  67. used |= 4;
  68. return *this;
  69. }
  70. inline MLRVertex&
  71. operator=(const Vector2DOf<Scalar>& uv)
  72. {
  73. Check_Pointer(this);
  74. texCoord[0] = uv[0];
  75. texCoord[1] = uv[1];
  76. used |= 8;
  77. return *this;
  78. }
  79. // Class Data Support
  80. //
  81. public:
  82. static ClassData
  83. *DefaultData;
  84. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  85. // Testing
  86. //
  87. public:
  88. void
  89. TestInstance() const
  90. {};
  91. protected:
  92. int used;
  93. Point3D coord;
  94. RGBAColor color;
  95. Vector3D normal;
  96. Vector2DScalar texCoord;
  97. };
  98. #endif