Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HGlobals.h
Go to the documentation of this file.
1 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
13 #ifndef _H_GLOBALS_H
14 #define _H_GLOBALS_H
15 
16 #ifdef H_PACK_8
17 #pragma pack(push)
18 #pragma pack(8)
19 #endif
20 
25 {
26  HIO_OK = 1,
28  HIO_Fail = 3,
34 };
35 
36 #define HFileInputResult HFileIOResult
37 #define InputOK HIO_OK
38 #define InputVersionMismatch HIO_VersionMismatch
39 #define InputFail HIO_Fail
40 #define InputNotHandled HIO_NotHandled
41 #define InputBadFileName HIO_BadFileName
42 #define InputBadOptions HIO_BadOptions
43 #define InputBadLicense HIO_BadLicense
44 #define InputLibraryNotFound HIO_LibraryNotFound
45 
46 
47 #define HFileOutputResult HFileIOResult
48 #define OutputOK HIO_OK
49 #define OutputVersionMismatch HIO_VersionMismatch
50 #define OutputFail HIO_Fail
51 #define OutputNotHandled HIO_NotHandled
52 #define OutputBadFileName HIO_BadFileName
53 #define OutputBadOptions HIO_BadOptions
54 #define OutputBadLicense HIO_BadLicense
55 #define OutputLibraryNotFound HIO_LibraryNotFound
56 
60 #define LAST_HFileInputResult InputBadOptions
61 
64 #define LAST_HFileOutputResult OutputBadOptions
65 
70 enum HSignal
71 {
81 };
82 
86 #define LAST_HSignal HSignalClash
87 
88 
93 {
97 };
98 
103 {
108 };
109 
113 #define LAST_HShadowMode HShadowHard
114 
116 
121 class MVO_API HPoint
122 {
123 public:
124  float x;
125  float y;
126  float z;
127 
129  HPoint() : x(0), y(0), z(0) {};
130 
132  HPoint(float X, float Y, float Z=0.0f) : x(X), y(Y), z(Z) {};
133 
135  HPoint(HPoint const * p) : x(p->x), y(p->y), z(p->z) {};
136 
138  HPoint(HPoint const & p) : x(p.x), y(p.y), z(p.z) {};
139 
141  void Set(float X, float Y, float Z=0.0f) { x=X; y=Y; z=Z; };
142 
144  void Set(HPoint *p) { x=p->x; y=p->y; z=p->z; };
145 
147  void Set(HPoint const *p) { x=p->x; y=p->y; z=p->z; };
148 
150  void Set(HPoint &p) { x=p.x; y=p.y; z=p.z; };
151 
153  void Set(const HPoint &p) { x=p.x; y=p.y; z=p.z; };
154 
160  void Add(float X, float Y, float Z=0.0){ x+=X; y+=Y; z+=Z; };
161 
162  HPoint const operator -(const HPoint &p2) const
163  {
164  return HPoint(x-p2.x, y-p2.y, z-p2.z);
165  }
166 
167  HPoint const operator +(const HPoint &p2) const
168  {
169  return HPoint(x+p2.x, y+p2.y, z+p2.z);
170  }
171 
172  HPoint const operator *(float const rhs) const
173  {
174  return HPoint(x*rhs, y*rhs, z*rhs);
175  }
176 
177  HPoint const operator /(float const rhs) const
178  {
179  return HPoint(x/rhs, y/rhs, z/rhs);
180  }
181 
182  HPoint const & operator += (HPoint const & rhs)
183  {
184  x += rhs.x;
185  y += rhs.y;
186  z += rhs.z;
187  return *this;
188  }
189 
190  HPoint const & operator -= (HPoint const & rhs)
191  {
192  x -= rhs.x;
193  y -= rhs.y;
194  z -= rhs.z;
195  return *this;
196  }
197 
198  HPoint const & operator *= (float const rhs)
199  {
200  x *= rhs;
201  y *= rhs;
202  z *= rhs;
203  return *this;
204  }
205 
206  HPoint const & operator /= (float const rhs)
207  {
208  x /= rhs;
209  y /= rhs;
210  z /= rhs;
211  return *this;
212  }
213 
214  bool operator ==(HPoint const & rhs) const
215  {
216  return Equal(&rhs);
217  }
218 
219  bool operator !=(HPoint const & rhs) const
220  {
221  return !Equal(&rhs);
222  }
223 
224 
226 #define HPOINT_EPSILON (1e-5f)
227 
228 
230  bool Equal(HPoint const *p, float epsi = HPOINT_EPSILON) const {
231  return (x - p->x < epsi) && (x - p->x > -epsi)
232  && (y - p->y < epsi) && (y - p->y > -epsi)
233  && (z - p->z < epsi) && (z - p->z > -epsi);
234  };
235 
237  bool Equal(HPoint const &p, float epsi = HPOINT_EPSILON) const {
238  return Equal(&p, epsi);
239  };
240 };
241 
248 class MVO_API HPointKey : public HPoint
249 {
250 public:
252  HPointKey() : HPoint(0, 0, 0) {};
253 
255  HPointKey(float X, float Y, float Z=0.0f) : HPoint(X, Y, Z) {};
256 
258  HPointKey(HPoint const * p) : HPoint(p->x, p->y, p->z) {};
259 
261  HPointKey(HPoint const & p) : HPoint(p.x, p.y, p.z) {};
262 
263  /* Define comparison operators so points can be used as keys in container classes. */
264  bool operator < (HPointKey const & rhs) const
265  {
266  if(x < rhs.x)
267  return true;
268  else if(x == rhs.x){
269  if(y < rhs.y)
270  return true;
271  else if(y == rhs.y){
272  if(z < rhs.z)
273  return true;
274  }
275  }
276  return false;
277  }
278 
279  bool operator > (HPointKey const & rhs) const
280  {
281  return !(*this < rhs);
282  }
283 
284  bool operator <= (HPointKey const & rhs) const
285  {
286  if( (*this) < rhs ){
287  return true;
288  }
289  else if( (*this) == rhs ){
290  return true;
291  }
292  return false;
293  }
294 
295  bool operator >= (HPointKey const & rhs) const
296  {
297  if( (*this) > rhs ){
298  return true;
299  }
300  else if( (*this) == rhs ){
301  return true;
302  }
303  return false;
304  }
305 };
306 
307 
310 class MVO_API HIntRectangle
311 {
312 public:
313  int left;
314  int right;
315  int bottom;
316  int top;
317 };
318 
319 
321 
326 typedef class HPoint HVector;
327 
328 
330 
333 class MVO_API HPlane
334 {
335 private:
336  float m_a;
337  float m_b;
338  float m_c;
339  float m_d;
340 
341 public:
342  HPlane(float const A = 0, float const B = 1, float const C = 0, float const D = 0) :
343  m_a(A), m_b(B), m_c(C), m_d(D){
344  };
345 
346  HPlane(HVector const & normal, float const D) :
347  m_a(normal.x), m_b(normal.y), m_c(normal.z), m_d(D){
348  };
349 
350  HPlane(HPlane const & p) :
351  m_a(p.a()), m_b(p.b()), m_c(p.c()), m_d(p.d()){
352  };
353 
355  inline void Set(float A, float B, float C, float D) { a(A); b(B); c(C); d(D); }
356 
360  inline double ClassifyPoint(HPoint const & p) const { return a() * p.x + b() * p.y + c() * p.z + d(); };
361 
365  inline void CalculateNormal(HPoint &normal) const
366  {
367  normal.Set(a(), b(), c());
368  HC_Compute_Normalized_Vector(&normal, &normal);
369  };
370 
372  bool Equal(HPlane const *p, float epsi1 = HPOINT_EPSILON, float epsi2 = HPOINT_EPSILON) const {
373  return (m_a - p->m_a < epsi1) && (m_a - p->m_a > -epsi1)
374  && (m_b - p->m_b < epsi1) && (m_b - p->m_b > -epsi1)
375  && (m_c - p->m_c < epsi1) && (m_c - p->m_c > -epsi1)
376  && (m_d - p->m_d < epsi2) && (m_d - p->m_d > -epsi2);
377  };
378 
379 
380  inline float a() const {return m_a;};
381  inline float b() const {return m_b;};
382  inline float c() const {return m_c;};
383  inline float d() const {return m_d;};
384 
385  inline void a(float A) {m_a = A;};
386  inline void b(float B) {m_b = B;};
387  inline void c(float C) {m_c = C;};
388  inline void d(float D) {m_d = D;};
389 };
390 
392 
395 class MVO_API HPlaneKey : public HPlane
396 {
397 public:
398  HPlaneKey(float const A = 0, float const B = 1, float const C = 0, float const D = 0) :
399  HPlane(A, B, C, D) {
400  };
401 
402  HPlaneKey(HVector const & normal, float const D) : HPlane(normal, D) {
403  };
404 
405  HPlaneKey(HPlane const & p) : HPlane(p) {
406  };
407 
408  bool operator < (HPlane const & rhs) const {
409  HVector n;
410 
411  CalculateNormal(n);
412  HPlane p1(n, d());
413 
414  rhs.CalculateNormal(n);
415  HPlane p2(n, rhs.d());
416 
417  if(p1.a() < p2.a())
418  return true;
419  else if(p1.a() == p2.a()){
420  if(p1.b() < p2.b())
421  return true;
422  else if(p1.b() == p2.b()){
423  if(p1.c() < p2.c())
424  return true;
425  else if(p1.c() == p2.c()){
426  if(p1.d() < p2.d())
427  return true;
428  }
429  }
430  }
431  return false;
432  };
433 
434  bool operator == (HPlane const & rhs) const {
435  HVector n;
436 
437  CalculateNormal(n);
438  HPlane p1(n, d());
439 
440  rhs.CalculateNormal(n);
441  HPlane p2(n, rhs.d());
442 
443  if( p1.a() == p2.a() &&
444  p1.b() == p2.b() &&
445  p1.c() == p2.c() &&
446  p1.d() == p2.d())
447  return true;
448 
449  return false;
450  };
451 
452  bool operator >= (HPlane const & rhs) const {
453  return !(*this < rhs);
454  };
455 
456  bool operator > (HPlane const & rhs) const {
457  return !(*this < rhs) && !(*this == rhs);
458  };
459 
460  bool operator <= (HPlane const & rhs) const {
461  return *this < rhs || *this == rhs;
462  };
463 
464  bool operator != (HPlane const & rhs) const {
465  return !(*this == rhs);
466  };
467 };
468 
469 
471 class MVO_API HPixelRGB
472 {
473 private:
474  unsigned char m_r;
475  unsigned char m_g;
476  unsigned char m_b;
477 
478 public:
479  HPixelRGB(unsigned char R = 0,unsigned char G = 0, unsigned char B = 0) : m_r(R), m_g(G), m_b(B) {
480  };
481 
482  HPixelRGB(HPixelRGB const & p) : m_r(p.r()), m_g(p.g()), m_b(p.b()) {
483  };
484 
485  inline unsigned char r() const {return m_r;};
486  inline unsigned char g() const {return m_g;};
487  inline unsigned char b() const {return m_b;};
488 
489  inline void r(unsigned char const R) {m_r = R;};
490  inline void g(unsigned char const G) {m_g = G;};
491  inline void b(unsigned char const B) {m_b = B;};
492 
494  inline void Set(unsigned char R, unsigned char G, unsigned char B){
495  r(R);
496  g(G);
497  b(B);
498  };
499 
501  inline void Setf(float R, float G, float B){
502  r((unsigned char)(R*255.99f));
503  g((unsigned char)(G*255.99f));
504  b((unsigned char)(B*255.99f));
505  };
506 };
507 
509 class MVO_API HPixelRGBA : public HPixelRGB
510 {
511 private:
512  unsigned char m_a;
513 
514 public:
515  HPixelRGBA(
516  unsigned char const R = 0,
517  unsigned char const G = 0,
518  unsigned char const B = 0,
519  unsigned char const A = 0)
520  :HPixelRGB(R, G, B), m_a(A){
521  };
522 
523  HPixelRGBA(HPixelRGBA const & p):HPixelRGB(p.r(), p.g(), p.b()),m_a(p.a()){
524  };
526  inline void Set(unsigned char R, unsigned char G, unsigned char B, unsigned char A=0){
527  HPixelRGB::Set(R, G, B);
528  a(A);
529  };
530 
532  inline void Setf(float R, float G, float B, float A=0.0f){
533  HPixelRGB::Setf(R, G, B);
534  a((unsigned char)(A*255.99f));
535  };
536 
537  inline unsigned char a() const {return m_a;};
538  inline void a(unsigned char const A) {m_a = A;};
539 };
540 
552 };
562 {
563  NoEdges = 0,
564  AllEdges,
565  PerimeterEdges
566 };
567 
568 enum HRegionFaceHighlightMode
569 {
570  FacesUnmodified = 0,
571  FacesForcedOn,
572  FacesForcedOff
573 };
578 {
582 };
583 
584 
585 
586 #ifdef H_PACK_8
587 #pragma pack(pop)
588 #endif
589 
590 #endif
591 
592 
593 
594 
595 
596 
597 
self-explantory
Definition: HGlobals.h:79
self-explanatory
Definition: HGlobals.h:33
The HPlaneKey class is the data type of a plane that can be used as a key in STL containers.
Definition: HGlobals.h:395
void CalculateNormal(HPoint &normal) const
Definition: HGlobals.h:365
The HPixelRGB class is the data type of a rgb pixel.
Definition: HGlobals.h:471
void Setf(float R, float G, float B, float A=0.0f)
Definition: HGlobals.h:532
color the selected item and make the rest of the model transparent.
Definition: HGlobals.h:551
HPoint(HPoint const *p)
Definition: HGlobals.h:135
self-explanatory
Definition: HGlobals.h:31
float z
The z-coordinate of a 3-dimensional point.
Definition: HGlobals.h:126
Faces will be visible for cut geometry.
Definition: HGlobals.h:105
#define HPOINT_EPSILON
HPOINT_EPSILON.
Definition: HGlobals.h:226
void Set(HPoint *p)
Definition: HGlobals.h:144
a paint (screen update) has occurred; signal_data is pointer to HRectangle containing window size ...
Definition: HGlobals.h:77
self-explanatory
Definition: HGlobals.h:27
objects have clashed; signal_data is pointer to StencilProbe object that detected a clash; StencilPro...
Definition: HGlobals.h:78
HPointKey(HPoint const *p)
Definition: HGlobals.h:258
void Set(HPoint &p)
Definition: HGlobals.h:150
void Set(HPoint const *p)
Definition: HGlobals.h:147
bool Equal(HPoint const &p, float epsi=HPOINT_EPSILON) const
Definition: HGlobals.h:237
HRefSelType
Definition: HGlobals.h:577
HPointKey(float X, float Y, float Z=0.0f)
Definition: HGlobals.h:255
The HPixelRGBA class is the data type of a rgba pixel.
Definition: HGlobals.h:509
No cut geometry will be visible.
Definition: HGlobals.h:104
float x
The x-coordinate of a 3-dimensional point.
Definition: HGlobals.h:124
HSelectionHighlightMode
Definition: HGlobals.h:547
Definition: HGlobals.h:310
self-explantory
Definition: HGlobals.h:74
self-explantory
Definition: HGlobals.h:75
self-explanatory
Definition: HGlobals.h:28
soft shadow
Definition: HGlobals.h:95
class HPoint HVector
The HVector class is the data type of a three-dimensional vector.
Definition: HGlobals.h:326
hard shadow
Definition: HGlobals.h:96
HPointKey(HPoint const &p)
Definition: HGlobals.h:261
HRegionEdgeHighlightMode
Definition: HGlobals.h:561
void Set(float A, float B, float C, float D)
Definition: HGlobals.h:355
use default conditional highlighting
Definition: HGlobals.h:548
void Setf(float R, float G, float B)
Definition: HGlobals.h:501
do not use quick moves for reference selection
Definition: HGlobals.h:581
HCutGeometryVisibility
Definition: HGlobals.h:102
void Set(unsigned char R, unsigned char G, unsigned char B)
Definition: HGlobals.h:494
self-explantory
Definition: HGlobals.h:73
void Set(unsigned char R, unsigned char G, unsigned char B, unsigned char A=0)
Definition: HGlobals.h:526
no shadow
Definition: HGlobals.h:94
self-explanatory
Definition: HGlobals.h:29
use quick move reference highlighting
Definition: HGlobals.h:549
HPoint()
Definition: HGlobals.h:129
HPointKey()
Definition: HGlobals.h:252
float y
The y-coordinate of a 3-dimensional point.
Definition: HGlobals.h:125
self-explanatory
Definition: HGlobals.h:30
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:121
Edges will be visible for cut geometry.
Definition: HGlobals.h:106
int right
The right position.
Definition: HGlobals.h:314
HPoint(HPoint const &p)
Definition: HGlobals.h:138
bool Equal(HPlane const *p, float epsi1=HPOINT_EPSILON, float epsi2=HPOINT_EPSILON) const
Definition: HGlobals.h:372
self-explantory
Definition: HGlobals.h:80
HPoint(float X, float Y, float Z=0.0f)
Definition: HGlobals.h:132
int left
The left position.
Definition: HGlobals.h:313
do nothing to the selected item, but make the rest of the model transparent.
Definition: HGlobals.h:550
self-explantory
Definition: HGlobals.h:76
Definition: HGlobals.h:248
self-explanatory
Definition: HGlobals.h:32
HShadowMode
Definition: HGlobals.h:92
HC_BOOLEAN HC_Compute_Normalized_Vector(const HC_POINT *vector, HC_POINT *out_vector)
use whatever the current quick moves preference is
Definition: HGlobals.h:580
void Add(float X, float Y, float Z=0.0)
Definition: HGlobals.h:160
int bottom
The bottom position.
Definition: HGlobals.h:315
use spriting for reference selection
Definition: HGlobals.h:579
The HPlane class is the data type of a plane.
Definition: HGlobals.h:333
void Set(const HPoint &p)
Definition: HGlobals.h:153
self-explantory
Definition: HGlobals.h:72
void Set(float X, float Y, float Z=0.0f)
Definition: HGlobals.h:141
bool Equal(HPoint const *p, float epsi=HPOINT_EPSILON) const
Definition: HGlobals.h:230
HSignal
Definition: HGlobals.h:70
self-explanatory
Definition: HGlobals.h:26
int top
The top position.
Definition: HGlobals.h:316
Both Faces and Edges will be visible.
Definition: HGlobals.h:107
HFileIOResult
Definition: HGlobals.h:24
double ClassifyPoint(HPoint const &p) const
Definition: HGlobals.h:360