Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HGlobals.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2000 by Tech Soft 3D, LLC.
3 // The information contained herein is confidential and proprietary to
4 // Tech Soft 3D, LLC., and considered a trade secret as defined under
5 // civil and criminal statutes. Tech Soft 3D shall pursue its civil
6 // and criminal remedies in the event of unauthorized use or misappropriation
7 // of its trade secrets. Use of this information by anyone other than
8 // authorized employees of Tech Soft 3D, LLC. is granted only under a
9 // written non-disclosure agreement, expressly prescribing the scope and
10 // manner of such use.
11 //
12 // $Id: f695bc0b2e4e32d2d1fec34de917c49a8a673c14 $
13 //
14 
18 #ifndef _H_GLOBALS_H
19 #define _H_GLOBALS_H
20 
21 #ifdef H_PACK_8
22 #pragma pack(push)
23 #pragma pack(8)
24 #endif
25 
30 {
31  HIO_OK = 1,
33  HIO_Fail = 3,
39 };
40 
41 #define HFileInputResult HFileIOResult
42 #define InputOK HIO_OK
43 #define InputVersionMismatch HIO_VersionMismatch
44 #define InputFail HIO_Fail
45 #define InputNotHandled HIO_NotHandled
46 #define InputBadFileName HIO_BadFileName
47 #define InputBadOptions HIO_BadOptions
48 #define InputBadLicense HIO_BadLicense
49 #define InputLibraryNotFound HIO_LibraryNotFound
50 
51 
52 #define HFileOutputResult HFileIOResult
53 #define OutputOK HIO_OK
54 #define OutputVersionMismatch HIO_VersionMismatch
55 #define OutputFail HIO_Fail
56 #define OutputNotHandled HIO_NotHandled
57 #define OutputBadFileName HIO_BadFileName
58 #define OutputBadOptions HIO_BadOptions
59 #define OutputBadLicense HIO_BadLicense
60 #define OutputLibraryNotFound HIO_LibraryNotFound
61 
65 #define LAST_HFileInputResult InputBadOptions
66 
69 #define LAST_HFileOutputResult OutputBadOptions
70 
75 enum HSignal
76 {
86 };
87 
91 #define LAST_HSignal HSignalClash
92 
93 
98 {
102 };
103 
108 {
113 };
114 
118 #define LAST_HShadowMode HShadowHard
119 
121 
126 class MVO_API HPoint
127 {
128 public:
129  float x;
130  float y;
131  float z;
132 
134  HPoint() : x(0), y(0), z(0) {};
135 
137  HPoint(float X, float Y, float Z=0.0f) : x(X), y(Y), z(Z) {};
138 
140  HPoint(HPoint const * p) : x(p->x), y(p->y), z(p->z) {};
141 
143  HPoint(HPoint const & p) : x(p.x), y(p.y), z(p.z) {};
144 
146  void Set(float X, float Y, float Z=0.0f) { x=X; y=Y; z=Z; };
147 
149  void Set(HPoint *p) { x=p->x; y=p->y; z=p->z; };
150 
152  void Set(HPoint const *p) { x=p->x; y=p->y; z=p->z; };
153 
155  void Set(HPoint &p) { x=p.x; y=p.y; z=p.z; };
156 
158  void Set(const HPoint &p) { x=p.x; y=p.y; z=p.z; };
159 
165  void Add(float X, float Y, float Z=0.0){ x+=X; y+=Y; z+=Z; };
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 +(const HPoint &p2) const
173  {
174  return HPoint(x+p2.x, y+p2.y, z+p2.z);
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 /(float const rhs) const
183  {
184  return HPoint(x/rhs, y/rhs, z/rhs);
185  }
186 
187  HPoint const & operator += (HPoint const & rhs)
188  {
189  x += rhs.x;
190  y += rhs.y;
191  z += rhs.z;
192  return *this;
193  }
194 
195  HPoint const & operator -= (HPoint const & rhs)
196  {
197  x -= rhs.x;
198  y -= rhs.y;
199  z -= rhs.z;
200  return *this;
201  }
202 
203  HPoint const & operator *= (float const rhs)
204  {
205  x *= rhs;
206  y *= rhs;
207  z *= rhs;
208  return *this;
209  }
210 
211  HPoint const & operator /= (float const rhs)
212  {
213  x /= rhs;
214  y /= rhs;
215  z /= rhs;
216  return *this;
217  }
218 
219  bool operator ==(HPoint const & rhs) const
220  {
221  return Equal(&rhs);
222  }
223 
224  bool operator !=(HPoint const & rhs) const
225  {
226  return !Equal(&rhs);
227  }
228 
229 
231 #define HPOINT_EPSILON (1e-5f)
232 
233 
235  bool Equal(HPoint const *p, float epsi = HPOINT_EPSILON) const {
236  return (bool)(
237  (x - p->x < epsi) && (x - p->x > -epsi) &&
238  (y - p->y < epsi) && (y - p->y > -epsi) &&
239  (z - p->z < epsi) && (z - p->z > -epsi));
240  };
241 
243  bool Equal(HPoint const &p, float epsi = HPOINT_EPSILON) const {
244  return Equal(&p, epsi);
245  };
246 };
247 
254 class MVO_API HPointKey : public HPoint
255 {
256 public:
258  HPointKey() : HPoint(0, 0, 0) {};
259 
261  HPointKey(float X, float Y, float Z=0.0f) : HPoint(X, Y, Z) {};
262 
264  HPointKey(HPoint const * p) : HPoint(p->x, p->y, p->z) {};
265 
267  HPointKey(HPoint const & p) : HPoint(p.x, p.y, p.z) {};
268 
269  /* Define comparison operators so points can be used as keys in container classes. */
270  bool const operator < (HPointKey const & rhs) const
271  {
272  if(x < rhs.x)
273  return true;
274  else if(x == rhs.x){
275  if(y < rhs.y)
276  return true;
277  else if(y == rhs.y){
278  if(z < rhs.z)
279  return true;
280  }
281  }
282  return false;
283  }
284 
285  bool const operator > (HPointKey const & rhs) const
286  {
287  return !(*this < rhs);
288  }
289 
290  bool const operator <= (HPointKey const & rhs) const
291  {
292  if( (*this) < rhs ){
293  return true;
294  }
295  else if( (*this) == rhs ){
296  return true;
297  }
298  return false;
299  }
300 
301  bool const operator >= (HPointKey const & rhs) const
302  {
303  if( (*this) > rhs ){
304  return true;
305  }
306  else if( (*this) == rhs ){
307  return true;
308  }
309  return false;
310  }
311 };
312 
313 
316 class MVO_API HIntRectangle
317 {
318 public:
319  int left;
320  int right;
321  int bottom;
322  int top;
323 };
324 
325 
327 
332 typedef class HPoint HVector;
333 
334 
336 
339 class MVO_API HPlane
340 {
341 private:
342  float m_a;
343  float m_b;
344  float m_c;
345  float m_d;
346 
347 public:
348  HPlane(float const A = 0, float const B = 1, float const C = 0, float const D = 0) :
349  m_a(A), m_b(B), m_c(C), m_d(D){
350  };
351 
352  HPlane(HVector const & normal, float const D) :
353  m_a(normal.x), m_b(normal.y), m_c(normal.z), m_d(D){
354  };
355 
356  HPlane(HPlane const & p) :
357  m_a(p.a()), m_b(p.b()), m_c(p.c()), m_d(p.d()){
358  };
359 
361  inline void Set(float A, float B, float C, float D) { a(A); b(B); c(C); d(D); }
362 
366  inline double ClassifyPoint(HPoint const & p) const { return (a() * p.x + b() * p.y + c() * p.z + d()); };
367 
371  inline void CalculateNormal(HPoint &normal) const
372  {
373  normal.Set(a(), b(), c());
374  HC_Compute_Normalized_Vector(&normal, &normal);
375  };
376 
378  bool Equal(HPlane const *p, float epsi1 = HPOINT_EPSILON, float epsi2 = HPOINT_EPSILON) const {
379  return (bool)(
380  (m_a - p->m_a < epsi1) && (m_a - p->m_a > -epsi1) &&
381  (m_b - p->m_b < epsi1) && (m_b - p->m_b > -epsi1) &&
382  (m_c - p->m_c < epsi1) && (m_c - p->m_c > -epsi1) &&
383  (m_d - p->m_d < epsi2) && (m_d - p->m_d > -epsi2));
384  };
385 
386 
387  inline float a() const {return m_a;};
388  inline float b() const {return m_b;};
389  inline float c() const {return m_c;};
390  inline float d() const {return m_d;};
391 
392  inline void a(float A) {m_a = A;};
393  inline void b(float B) {m_b = B;};
394  inline void c(float C) {m_c = C;};
395  inline void d(float D) {m_d = D;};
396 };
397 
399 
402 class MVO_API HPlaneKey : public HPlane
403 {
404 public:
405  HPlaneKey(float const A = 0, float const B = 1, float const C = 0, float const D = 0) :
406  HPlane(A, B, C, D) {
407  };
408 
409  HPlaneKey(HVector const & normal, float const D) : HPlane(normal, D) {
410  };
411 
412  HPlaneKey(HPlane const & p) : HPlane(p) {
413  };
414 
415  bool operator < (HPlane const & rhs) const {
416  HVector n;
417 
418  CalculateNormal(n);
419  HPlane p1(n, d());
420 
421  rhs.CalculateNormal(n);
422  HPlane p2(n, rhs.d());
423 
424  if(p1.a() < p2.a())
425  return true;
426  else if(p1.a() == p2.a()){
427  if(p1.b() < p2.b())
428  return true;
429  else if(p1.b() == p2.b()){
430  if(p1.c() < p2.c())
431  return true;
432  else if(p1.c() == p2.c()){
433  if(p1.d() < p2.d())
434  return true;
435  }
436  }
437  }
438  return false;
439  };
440 
441  bool operator == (HPlane const & rhs) const {
442  HVector n;
443 
444  CalculateNormal(n);
445  HPlane p1(n, d());
446 
447  rhs.CalculateNormal(n);
448  HPlane p2(n, rhs.d());
449 
450  if( p1.a() == p2.a() &&
451  p1.b() == p2.b() &&
452  p1.c() == p2.c() &&
453  p1.d() == p2.d())
454  return true;
455 
456  return false;
457  };
458 
459  bool operator >= (HPlane const & rhs) const {
460  return !(*this < rhs);
461  };
462 
463  bool operator > (HPlane const & rhs) const {
464  return !(*this < rhs) && !(*this == rhs);
465  };
466 
467  bool operator <= (HPlane const & rhs) const {
468  return (*this < rhs) || (*this == rhs);
469  };
470 
471  bool operator != (HPlane const & rhs) const {
472  return !(*this == rhs);
473  };
474 };
475 
476 
478 class MVO_API HPixelRGB
479 {
480 private:
481  unsigned char m_r;
482  unsigned char m_g;
483  unsigned char m_b;
484 
485 public:
486  HPixelRGB(unsigned char R = 0,unsigned char G = 0, unsigned char B = 0) : m_r(R), m_g(G), m_b(B) {
487  };
488 
489  HPixelRGB(HPixelRGB const & p) : m_r(p.r()), m_g(p.g()), m_b(p.b()) {
490  };
491 
492  inline unsigned char r() const {return m_r;};
493  inline unsigned char g() const {return m_g;};
494  inline unsigned char b() const {return m_b;};
495 
496  inline void r(unsigned char const R) {m_r = R;};
497  inline void g(unsigned char const G) {m_g = G;};
498  inline void b(unsigned char const B) {m_b = B;};
499 
501  inline void Set(unsigned char R, unsigned char G, unsigned char B){
502  r(R);
503  g(G);
504  b(B);
505  };
506 
508  inline void Setf(float R, float G, float B){
509  r((unsigned char)(R*255.99f));
510  g((unsigned char)(G*255.99f));
511  b((unsigned char)(B*255.99f));
512  };
513 };
514 
516 class MVO_API HPixelRGBA : public HPixelRGB
517 {
518 private:
519  unsigned char m_a;
520 
521 public:
522  HPixelRGBA(
523  unsigned char const R = 0,
524  unsigned char const G = 0,
525  unsigned char const B = 0,
526  unsigned char const A = 0)
527  :HPixelRGB(R, G, B), m_a(A){
528  };
529 
530  HPixelRGBA(HPixelRGBA const & p):HPixelRGB(p.r(), p.g(), p.b()),m_a(p.a()){
531  };
533  inline void Set(unsigned char R, unsigned char G, unsigned char B, unsigned char A=0){
534  HPixelRGB::Set(R, G, B);
535  a(A);
536  };
537 
539  inline void Setf(float R, float G, float B, float A=0.0f){
540  HPixelRGB::Setf(R, G, B);
541  a((unsigned char)(A*255.99f));
542  };
543 
544  inline unsigned char a() const {return m_a;};
545  inline void a(unsigned char const A) {m_a = A;};
546 };
547 
559 };
569 {
570  NoEdges = 0,
571  AllEdges,
572  PerimeterEdges
573 };
574 
575 enum HRegionFaceHighlightMode
576 {
577  FacesUnmodified = 0,
578  FacesForcedOn,
579  FacesForcedOff
580 };
585 {
588 };
589 
590 
591 
592 #ifdef H_PACK_8
593 #pragma pack(pop)
594 #endif
595 
596 #endif
597 
598 
599 
600 
601 
602 
603 
self-explantory
Definition: HGlobals.h:84
self-explanatory
Definition: HGlobals.h:38
The HPlaneKey class is the data type of a plane that can be used as a key in STL containers.
Definition: HGlobals.h:402
void CalculateNormal(HPoint &normal) const
Definition: HGlobals.h:371
The HPixelRGB class is the data type of a rgb pixel.
Definition: HGlobals.h:478
void Setf(float R, float G, float B, float A=0.0f)
Definition: HGlobals.h:539
color the selected item and make the rest of the model transparent.
Definition: HGlobals.h:558
HPoint(HPoint const *p)
Definition: HGlobals.h:140
self-explanatory
Definition: HGlobals.h:36
float z
The z-coordinate of a 3-dimensional point.
Definition: HGlobals.h:131
Faces will be visible for cut geometry.
Definition: HGlobals.h:110
#define HPOINT_EPSILON
HPOINT_EPSILON.
Definition: HGlobals.h:231
void Set(HPoint *p)
Definition: HGlobals.h:149
a paint (screen update) has occurred; signal_data is pointer to HRectangle containing window size ...
Definition: HGlobals.h:82
self-explanatory
Definition: HGlobals.h:32
objects have clashed; signal_data is pointer to StencilProbe object that detected a clash; StencilPro...
Definition: HGlobals.h:83
HPointKey(HPoint const *p)
Definition: HGlobals.h:264
void Set(HPoint &p)
Definition: HGlobals.h:155
void Set(HPoint const *p)
Definition: HGlobals.h:152
bool Equal(HPoint const &p, float epsi=HPOINT_EPSILON) const
Definition: HGlobals.h:243
HRefSelType
Definition: HGlobals.h:584
HPointKey(float X, float Y, float Z=0.0f)
Definition: HGlobals.h:261
The HPixelRGBA class is the data type of a rgba pixel.
Definition: HGlobals.h:516
No cut geometry will be visible.
Definition: HGlobals.h:109
float x
The x-coordinate of a 3-dimensional point.
Definition: HGlobals.h:129
HSelectionHighlightMode
Definition: HGlobals.h:554
Definition: HGlobals.h:316
self-explantory
Definition: HGlobals.h:79
self-explantory
Definition: HGlobals.h:80
self-explanatory
Definition: HGlobals.h:33
soft shadow
Definition: HGlobals.h:100
class HPoint HVector
The HVector class is the data type of a three-dimensional vector.
Definition: HGlobals.h:332
hard shadow
Definition: HGlobals.h:101
HPointKey(HPoint const &p)
Definition: HGlobals.h:267
HRegionEdgeHighlightMode
Definition: HGlobals.h:568
void Set(float A, float B, float C, float D)
Definition: HGlobals.h:361
use default conditional highlighting
Definition: HGlobals.h:555
void Setf(float R, float G, float B)
Definition: HGlobals.h:508
HCutGeometryVisibility
Definition: HGlobals.h:107
void Set(unsigned char R, unsigned char G, unsigned char B)
Definition: HGlobals.h:501
self-explantory
Definition: HGlobals.h:78
void Set(unsigned char R, unsigned char G, unsigned char B, unsigned char A=0)
Definition: HGlobals.h:533
no shadow
Definition: HGlobals.h:99
self-explanatory
Definition: HGlobals.h:34
use quick move reference highlighting
Definition: HGlobals.h:556
HPoint()
Definition: HGlobals.h:134
HPointKey()
Definition: HGlobals.h:258
float y
The y-coordinate of a 3-dimensional point.
Definition: HGlobals.h:130
self-explanatory
Definition: HGlobals.h:35
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:126
Edges will be visible for cut geometry.
Definition: HGlobals.h:111
int right
The right position.
Definition: HGlobals.h:320
HPoint(HPoint const &p)
Definition: HGlobals.h:143
bool Equal(HPlane const *p, float epsi1=HPOINT_EPSILON, float epsi2=HPOINT_EPSILON) const
Definition: HGlobals.h:378
self-explantory
Definition: HGlobals.h:85
HPoint(float X, float Y, float Z=0.0f)
Definition: HGlobals.h:137
int left
The left position.
Definition: HGlobals.h:319
do nothing to the selected item, but make the rest of the model transparent.
Definition: HGlobals.h:557
self-explantory
Definition: HGlobals.h:81
Definition: HGlobals.h:254
self-explanatory
Definition: HGlobals.h:37
HShadowMode
Definition: HGlobals.h:97
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:587
void Add(float X, float Y, float Z=0.0)
Definition: HGlobals.h:165
int bottom
The bottom position.
Definition: HGlobals.h:321
use spriting for reference selection
Definition: HGlobals.h:586
The HPlane class is the data type of a plane.
Definition: HGlobals.h:339
void Set(const HPoint &p)
Definition: HGlobals.h:158
self-explantory
Definition: HGlobals.h:77
void Set(float X, float Y, float Z=0.0f)
Definition: HGlobals.h:146
bool Equal(HPoint const *p, float epsi=HPOINT_EPSILON) const
Definition: HGlobals.h:235
HSignal
Definition: HGlobals.h:75
self-explanatory
Definition: HGlobals.h:31
int top
The top position.
Definition: HGlobals.h:322
Both Faces and Edges will be visible.
Definition: HGlobals.h:112
HFileIOResult
Definition: HGlobals.h:29
double ClassifyPoint(HPoint const &p) const
Definition: HGlobals.h:366