CFx SDK Documentation  2020SP3
GsCullingVolume.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef _ODGSCULLINGVOLUME_H_INCLUDED_
25 #define _ODGSCULLINGVOLUME_H_INCLUDED_
26 
27 #include "OdaCommon.h"
28 #include "RxObject.h"
29 #include "Gs/GsExport.h"
30 #include "Ge/GeBoundBlock3d.h"
31 #include "Ge/GeExtents3d.h"
32 #include "Ge/GePoint3d.h"
33 #include "Ge/GeSphere.h"
34 #include "Ge/GeVector3d.h"
35 
36 #include "TD_PackPush.h"
37 
38 // Culling primitives:
39 // BBox (AABB - Axis Aligned Bounding Box)
40 // BSphere (Bounding Sphere)
41 // OBBox (OBB - Oriented Bounding Box)
42 
51 {
52  public:
65  {
68  kPrimOBBox
69  };
70  public:
72  {
73  }
74 
76  {
77  }
78 
90  virtual PrimitiveType primitiveType() const = 0;
91 };
92 
101 {
102  public:
105  , OdGeExtents3d()
106  {
107  }
108 
111  , OdGeExtents3d(min, max)
112  {
113  }
114 
117  , OdGeExtents3d(ext.minPoint(), ext.maxPoint())
118  {
119  }
120 
123  , OdGeExtents3d(aabb.minPoint(), aabb.maxPoint())
124  {
125  }
126 
128  {
129  }
130 
131  OdGsCullingBBox &operator =(const OdGeExtents3d &ext)
132  {
133  set(ext.minPoint(), ext.maxPoint());
134  return *this;
135  }
136 
137  OdGsCullingBBox &operator =(const OdGsCullingBBox &aabb)
138  {
139  set(aabb.minPoint(), aabb.maxPoint());
140  return *this;
141  }
142 
143  // OdGsCullingPrimitive overrides
144 
149  {
150  return kPrimBBox;
151  }
152 };
153 
161 class GS_TOOLKIT_EXPORT OdGsCullingBSphere : public OdGsCullingPrimitive, public OdGeSphere // GeSphere has many unnecessary data for culling
162 {
163  public:
166  , OdGeSphere()
167  {
168  }
169 
170  OdGsCullingBSphere(double radius, const OdGePoint3d &center)
172  , OdGeSphere(radius, center)
173  {
174  }
175 
178  , OdGeSphere(sphere)
179  {
180  }
181 
184  , OdGeSphere(bsphere)
185  {
186  }
187 
189  {
190  }
191 
193  {
194  set(sphere.radius(), sphere.center());
195  return *this;
196  }
197 
199  {
200  set(bsphere.radius(), bsphere.center());
201  return *this;
202  }
203 
204  // OdGsCullingPrimitive overrides
205 
210  {
211  return kPrimBSphere;
212  }
213 };
214 
223 {
224  public:
227  , OdGeBoundBlock3d()
228  {
229  }
230 
231  OdGsCullingOBBox(const OdGePoint3d &base, const OdGeVector3d &xAxis, const OdGeVector3d &yAxis, const OdGeVector3d &zAxis)
233  , OdGeBoundBlock3d(base, xAxis, yAxis, zAxis)
234  {
235  }
236 
239  , OdGeBoundBlock3d(bb)
240  {
241  }
242 
245  , OdGeBoundBlock3d(obb)
246  {
247  }
248 
250  {
251  }
252 
254  {
255  OdGePoint3d base; OdGeVector3d side1, side2, side3;
256  bb.get(base, side1, side2, side3);
257  set(base, side1, side2, side3);
258  return *this;
259  }
260 
262  {
263  OdGePoint3d base; OdGeVector3d side1, side2, side3;
264  obb.get(base, side1, side2, side3);
265  set(base, side1, side2, side3);
266  return *this;
267  }
268 
269  // OdGsCullingPrimitive overrides
270 
275  {
276  return kPrimOBBox;
277  }
278 };
279 
280 // Projection culling primitives:
281 // Ortho (Orthogonal culling box merged with optimization for 2d mode)
282 // Frustum (Perspective culling box without near and far culling planes)
283 
292 {
293  public:
295  {
297  kProjPerspective
298  };
300  {
301  kIntersectNot, // No intersection detected
302  kIntersectOk, // Intersects with projection boundary
303  kIntersectIn // Primitive completely inside projection boundary
304  };
305  public:
307 
318  virtual ProjectionType projectionType() const = 0;
319 
324  virtual bool intersectWithOpt(const OdGsCullingPrimitive &prim) const = 0;
340  virtual IntersectionStatus intersectWith(const OdGsCullingPrimitive &prim) const = 0;
341 
346  virtual void transformBy(const OdGeMatrix3d& xfm) = 0;
347 };
348 
353 
362 {
363  public:
365 
374  virtual void init(const OdGePoint3d &position, const OdGeVector3d &direction, const OdGeVector3d &upVector,
375  double volumeWidth, double volumeHeight) = 0;
376 };
377 
382 
391 {
392  public:
394 
406  virtual void init(const OdGePoint3d &position, const OdGeVector3d &direction, const OdGeVector3d &upVector,
407  double fovY, double aspect, OdUInt32 nPlanes = 4, double nearZ = 1.0, double farZ = 1e20) = 0;
420  virtual void init(const OdGePoint3d &position, const OdGeVector3d &direction, const OdGeVector3d &upVector,
421  double fovX, bool aspect, double fovY, OdUInt32 nPlanes = 4, double nearZ = 1.0, double farZ = 1e20) = 0;
422 };
423 
428 
429 #include "TD_PackPop.h"
430 
431 #endif // _ODGSCULLINGVOLUME_H_INCLUDED_
OdGsCullingBSphere::primitiveType
PrimitiveType primitiveType() const
Definition: GsCullingVolume.h:209
OdGsCullingPrimitive::kPrimOBBox
@ kPrimOBBox
Definition: GsCullingVolume.h:68
OdGeVector3d
Definition: GeVector3d.h:54
OdGsCullingBSphere::OdGsCullingBSphere
OdGsCullingBSphere()
Definition: GsCullingVolume.h:164
GeSphere.h
OdGsCullingOBBox::OdGsCullingOBBox
OdGsCullingOBBox(const OdGeBoundBlock3d &bb)
Definition: GsCullingVolume.h:237
OdGsCullingPrimitive::primitiveType
virtual PrimitiveType primitiveType() const =0
OdGsCullingOBBox
Definition: GsCullingVolume.h:223
OdGeSphere::center
OdGePoint3d center() const
OdRxObject
Definition: RxObject.h:564
OdGsCullingVolume::intersectWithOpt
virtual bool intersectWithOpt(const OdGsCullingPrimitive &prim) const =0
GeExtents3d.h
OdGsCullingOBBox::OdGsCullingOBBox
OdGsCullingOBBox()
Definition: GsCullingVolume.h:225
OdGsCullingPrimitive::~OdGsCullingPrimitive
virtual ~OdGsCullingPrimitive()
Definition: GsCullingVolume.h:75
OdGsCullingVolume::IntersectionStatus
IntersectionStatus
Definition: GsCullingVolume.h:300
FacetModelerProfile2DBool::min
const T & min(const T &x, const T &y)
Definition: FMImpProfile2DBool.h:98
OdGsCullingVolume::intersectWith
virtual IntersectionStatus intersectWith(const OdGsCullingPrimitive &prim) const =0
OdGsCullingPrimitive::OdGsCullingPrimitive
OdGsCullingPrimitive()
Definition: GsCullingVolume.h:71
TD_PackPop.h
GeBoundBlock3d.h
OdGsCullingPrimitive::kPrimBBox
@ kPrimBBox
Definition: GsCullingVolume.h:66
RxObject.h
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdGeMatrix3d
Definition: GeMatrix3d.h:73
OdGsCullingVolume::projectionType
virtual ProjectionType projectionType() const =0
OdGeExtents3d::minPoint
const OdGePoint3d & minPoint() const
Definition: GeExtents3d.h:237
OdGsOrthoCullingVolume::init
virtual void init(const OdGePoint3d &position, const OdGeVector3d &direction, const OdGeVector3d &upVector, double volumeWidth, double volumeHeight)=0
OdGsCullingOBBox::primitiveType
PrimitiveType primitiveType() const
Definition: GsCullingVolume.h:274
OdGsCullingBSphere
Definition: GsCullingVolume.h:162
OdGsOrthoCullingVolume::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdGsOrthoCullingVolume)
OdGsFrustumCullingVolume::init
virtual void init(const OdGePoint3d &position, const OdGeVector3d &direction, const OdGeVector3d &upVector, double fovX, bool aspect, double fovY, OdUInt32 nPlanes=4, double nearZ=1.0, double farZ=1e20)=0
OdGsFrustumCullingVolume::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdGsFrustumCullingVolume)
OdGsFrustumCullingVolume
Definition: GsCullingVolume.h:391
OdGeSphere::set
OdGeSphere & set(double radius, const OdGePoint3d &center)
OdSmartPtr< OdGsCullingVolume >
OdGsCullingPrimitive::kPrimBSphere
@ kPrimBSphere
Definition: GsCullingVolume.h:67
OdGePoint3d
Definition: GePoint3d.h:55
GePoint3d.h
OdGsCullingVolume::kProjOrtho
@ kProjOrtho
Definition: GsCullingVolume.h:296
OdGsCullingBBox
Definition: GsCullingVolume.h:101
OdGeSphere::operator=
OdGeSphere & operator=(const OdGeSphere &sphere)
OdGeSphere
Definition: GeSphere.h:72
OdGsCullingVolume::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdGsCullingVolume)
FacetModelerProfile2DBool::max
const T & max(const T &x, const T &y)
Definition: FMImpProfile2DBool.h:105
OdGsCullingVolume::kIntersectNot
@ kIntersectNot
Definition: GsCullingVolume.h:301
OdGeExtents3d::set
void set(const OdGePoint3d &min, const OdGePoint3d &max)
Definition: GeExtents3d.h:247
OdaCommon.h
OdGsCullingBSphere::~OdGsCullingBSphere
~OdGsCullingBSphere()
Definition: GsCullingVolume.h:188
OdGsOrthoCullingVolume
Definition: GsCullingVolume.h:362
OdGsCullingVolume
Definition: GsCullingVolume.h:292
OdGsCullingPrimitive::PrimitiveType
PrimitiveType
Definition: GsCullingVolume.h:65
TD_PackPush.h
GsExport.h
GeVector3d.h
OdGsFrustumCullingVolumePtr
OdSmartPtr< OdGsFrustumCullingVolume > OdGsFrustumCullingVolumePtr
Definition: GsCullingVolume.h:427
OdGeBoundBlock3d
Definition: GeBoundBlock3d.h:43
OdGsCullingPrimitive
Definition: GsCullingVolume.h:51
OdGeExtents3d::maxPoint
const OdGePoint3d & maxPoint() const
Definition: GeExtents3d.h:242
OdGsCullingBSphere::OdGsCullingBSphere
OdGsCullingBSphere(double radius, const OdGePoint3d &center)
Definition: GsCullingVolume.h:170
OdGsCullingBBox::OdGsCullingBBox
OdGsCullingBBox(const OdGsCullingBBox &aabb)
Definition: GsCullingVolume.h:121
OdGsCullingBBox::OdGsCullingBBox
OdGsCullingBBox(const OdGeExtents3d &ext)
Definition: GsCullingVolume.h:115
OdGsCullingBBox::OdGsCullingBBox
OdGsCullingBBox(const OdGePoint3d &min, const OdGePoint3d &max)
Definition: GsCullingVolume.h:109
OdGsCullingBBox::OdGsCullingBBox
OdGsCullingBBox()
Definition: GsCullingVolume.h:103
OdGsCullingOBBox::OdGsCullingOBBox
OdGsCullingOBBox(const OdGePoint3d &base, const OdGeVector3d &xAxis, const OdGeVector3d &yAxis, const OdGeVector3d &zAxis)
Definition: GsCullingVolume.h:231
OdGeBoundBlock3d::set
OdGeBoundBlock3d & set(const OdGePoint3d &p1, const OdGePoint3d &p2)
OdGsCullingVolumePtr
OdSmartPtr< OdGsCullingVolume > OdGsCullingVolumePtr
Definition: GsCullingVolume.h:352
OdGeExtents3d
Definition: GeExtents3d.h:45
GS_TOOLKIT_EXPORT
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
OdGeBoundBlock3d::get
void get(OdGePoint3d &base, OdGeVector3d &side1, OdGeVector3d &side2, OdGeVector3d &side3) const
OdGsOrthoCullingVolumePtr
OdSmartPtr< OdGsOrthoCullingVolume > OdGsOrthoCullingVolumePtr
Definition: GsCullingVolume.h:381
OdGsCullingVolume::ProjectionType
ProjectionType
Definition: GsCullingVolume.h:295
OdGsCullingBBox::~OdGsCullingBBox
~OdGsCullingBBox()
Definition: GsCullingVolume.h:127
OdGsCullingBSphere::OdGsCullingBSphere
OdGsCullingBSphere(const OdGsCullingBSphere &bsphere)
Definition: GsCullingVolume.h:182
OdGsCullingBSphere::OdGsCullingBSphere
OdGsCullingBSphere(const OdGeSphere &sphere)
Definition: GsCullingVolume.h:176
OdGsCullingVolume::kIntersectOk
@ kIntersectOk
Definition: GsCullingVolume.h:302
OdGsCullingVolume::transformBy
virtual void transformBy(const OdGeMatrix3d &xfm)=0
OdGsFrustumCullingVolume::init
virtual void init(const OdGePoint3d &position, const OdGeVector3d &direction, const OdGeVector3d &upVector, double fovY, double aspect, OdUInt32 nPlanes=4, double nearZ=1.0, double farZ=1e20)=0
OdGsCullingOBBox::~OdGsCullingOBBox
~OdGsCullingOBBox()
Definition: GsCullingVolume.h:249
OdGsCullingOBBox::OdGsCullingOBBox
OdGsCullingOBBox(const OdGsCullingOBBox &obb)
Definition: GsCullingVolume.h:243
OdGeBoundBlock3d::operator=
OdGeBoundBlock3d & operator=(const OdGeBoundBlock3d &block)
OdGeSphere::radius
double radius() const
OdGsCullingBBox::primitiveType
PrimitiveType primitiveType() const
Definition: GsCullingVolume.h:148