You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.7 KiB

8 years ago
​
​
​
​
​
​
6 years ago
8 years ago
​
​
​
​
​
​
​
​
​
​
​
​
8 years ago
​
8 years ago
​
​
8 years ago
​
8 years ago
8 years ago
​
8 years ago
8 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
8 years ago
​
​
​
​
​
8 years ago
​
​
​
​
​
​
​
​
​
​
​
​
8 years ago
​
8 years ago
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __SHADOW_MASKS_HEADER__
  2. #define __SHADOW_MASKS_HEADER__
  3. #include "../../components/base/basicTypes.h"
  4. #include "../../hardware/soc/general/3DLRF.h"
  5. #include "../../components/base/basicLogCollection.h"
  6. #if ( defined( __linux__ ) && !defined( __GUI__ ) ) || defined( _MEKOROT_ )
  7. typedef struct{
  8. private:
  9. int16_t m_x;
  10. int16_t m_y;
  11. public:
  12. void setX( int a ){
  13. m_x = a;
  14. };
  15. void setY( int a ){
  16. m_y = a;
  17. };
  18. int16_t x( void ){ return m_x; };
  19. int16_t y( void ){ return m_y; };
  20. } simplePoint;
  21. typedef struct{
  22. uint8_t color[3];
  23. simplePoint *points;
  24. uint16_t count;
  25. } simplePolygone;
  26. typedef std::vector<simplePolygone *> vectorMasking;
  27. typedef std::vector<simplePolygone *> vectorQPoly;
  28. #else
  29. #include "../../gui/gui.h"
  30. typedef QPoint simplePoint;
  31. //typedef QPolygon simplePolygone;
  32. typedef struct{
  33. uint8_t color[3];
  34. QPoint *points;
  35. uint16_t count;
  36. } simplePolygone;
  37. typedef std::vector<simplePolygone *> vectorMasking;
  38. typedef std::vector<QPolygon *> vectorQPoly;
  39. #endif
  40. typedef struct{
  41. uint16_t start;
  42. uint16_t stop;
  43. } raySegment;
  44. typedef struct{
  45. uint16_t column;
  46. uint16_t count;
  47. raySegment *zones;
  48. } rawRay;
  49. typedef std::vector<rawRay *> vectorZoneMask;
  50. class ShadowMask{
  51. private:
  52. basicLogCollection *m_pLog;
  53. vectorZoneMask m_vZoneMask;
  54. bool m_bActive;
  55. vectorMasking m_vVectorMask;
  56. bool m_bRasterized;
  57. #if defined( __linux__ ) && !defined( __GUI__ )
  58. CSTR m_pRasterFileName;
  59. CSTR m_pVertexFileName;
  60. #endif
  61. public:
  62. ShadowMask();
  63. ~ShadowMask();
  64. #if defined( __linux__ ) && !defined( __GUI__ )
  65. bool loadRastered(CSTR fName = NULL);
  66. bool saveRastered(CSTR fName = NULL);
  67. bool saveVertexes(CSTR fName = NULL);
  68. bool loadVertexes(CSTR fName = NULL);
  69. #endif
  70. bool getMPoly( vectorMasking &VM );
  71. bool getZoneMask(vectorZoneMask &ZM);
  72. simplePolygone *getPoly(int id);
  73. bool addPoly( simplePolygone *SP );
  74. bool clear( void );
  75. bool deletePoly( int ID );
  76. uint8_t getPolyCount( void ){ return ( m_vVectorMask.size() & 0xFF ); };
  77. uint16_t getRayCount( void ){ return ( m_vZoneMask.size() & 0xFFFF ); };
  78. #if defined( WIN32 ) || defined( __GUI__ )
  79. bool rasterizeVertexes( void );
  80. bool getQPoly( vectorQPoly &VM );
  81. bool addVertex( uint16_t polyID, simplePoint SP );
  82. bool addVertex( uint16_t polyID, uint32_t SP ); // Binary Data to Vertex
  83. #endif
  84. bool isOutside( uint16_t x, uint16_t y );
  85. bool isOutside( simplePoint );
  86. bool isActive( void ){ return m_bActive; };
  87. void setActive( bool tVal );
  88. bool addRay( uint16_t column, raySegment RS );
  89. bool addRay( uint16_t column, uint32_t RS ); // Binary Data to RaySegment
  90. };
  91. #endif