CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GsCullingVolume.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 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 {
71 kPrimOBBox
72 };
73 public:
78 {
79 }
80
85 {
86 }
87
99 virtual PrimitiveType primitiveType() const = 0;
100};
101
110{
111 public:
117 , OdGeExtents3d()
118 {
119 }
120
129 , OdGeExtents3d(min, max)
130 {
131 }
132
140 , OdGeExtents3d(ext.minPoint(), ext.maxPoint())
141 {
142 }
143
151 , OdGeExtents3d(aabb.minPoint(), aabb.maxPoint())
152 {
153 }
154
159 {
160 }
161
167 OdGsCullingBBox &operator =(const OdGeExtents3d &ext)
168 {
169 set(ext.minPoint(), ext.maxPoint());
170 return *this;
171 }
172
178 OdGsCullingBBox &operator =(const OdGsCullingBBox &aabb)
179 {
180 set(aabb.minPoint(), aabb.maxPoint());
181 return *this;
182 }
183
184 // OdGsCullingPrimitive overrides
185
190 {
191 return kPrimBBox;
192 }
193};
194
202class GS_TOOLKIT_EXPORT OdGsCullingBSphere : public OdGsCullingPrimitive, public OdGeSphere // GeSphere has many unnecessary data for culling
203{
204 public:
210 , OdGeSphere()
211 {
212 }
213
220 OdGsCullingBSphere(double radius, const OdGePoint3d &center)
222 , OdGeSphere(radius, center)
223 {
224 }
225
233 , OdGeSphere(sphere)
234 {
235 }
236
244 , OdGeSphere(bsphere)
245 {
246 }
247
252 {
253 }
254
260 OdGsCullingBSphere &operator =(const OdGeSphere &sphere)
261 {
262 set(sphere.radius(), sphere.center());
263 return *this;
264 }
265
271 OdGsCullingBSphere &operator =(const OdGsCullingBSphere &bsphere)
272 {
273 set(bsphere.radius(), bsphere.center());
274 return *this;
275 }
276
277 // OdGsCullingPrimitive overrides
278
283 {
284 return kPrimBSphere;
285 }
286};
287
296{
297 public:
304 {
305 }
306
315 OdGsCullingOBBox(const OdGePoint3d &base, const OdGeVector3d &xAxis, const OdGeVector3d &yAxis, const OdGeVector3d &zAxis)
317 , OdGeBoundBlock3d(base, xAxis, yAxis, zAxis)
318 {
319 }
320
328 , OdGeBoundBlock3d(bb)
329 {
330 }
331
339 , OdGeBoundBlock3d(obb)
340 {
341 }
342
347 {
348 }
349
355 OdGsCullingOBBox &operator =(const OdGeBoundBlock3d &bb)
356 {
357 OdGePoint3d base; OdGeVector3d side1, side2, side3;
358 bb.get(base, side1, side2, side3);
359 set(base, side1, side2, side3);
360 return *this;
361 }
362
368 OdGsCullingOBBox &operator =(const OdGsCullingOBBox &obb)
369 {
370 OdGePoint3d base; OdGeVector3d side1, side2, side3;
371 obb.get(base, side1, side2, side3);
372 set(base, side1, side2, side3);
373 return *this;
374 }
375
376 // OdGsCullingPrimitive overrides
377
382 {
383 return kPrimOBBox;
384 }
385};
386
387// Projection culling primitives:
388// Ortho (Orthogonal culling box merged with optimization for 2d mode)
389// Frustum (Perspective culling box without near and far culling planes)
390
399{
400 public:
405 {
409 kProjPerspective
410 };
415 {
421 kIntersectIn
422 };
423 public:
425
436 virtual ProjectionType projectionType() const = 0;
437
444 virtual bool intersectWithOpt(const OdGsCullingPrimitive &prim) const = 0;
460
465 virtual void transformBy(const OdGeMatrix3d& xfm) = 0;
466};
467
472
481{
482 public:
484
493 virtual void init(const OdGePoint3d &position, const OdGeVector3d &direction, const OdGeVector3d &upVector,
494 double volumeWidth, double volumeHeight) = 0;
495};
496
501
510{
511 public:
513
525 virtual void init(const OdGePoint3d &position, const OdGeVector3d &direction, const OdGeVector3d &upVector,
526 double fovY, double aspect, OdUInt32 nPlanes = 4, double nearZ = 1.0, double farZ = 1e20) = 0;
539 virtual void init(const OdGePoint3d &position, const OdGeVector3d &direction, const OdGeVector3d &upVector,
540 double fovX, bool aspect, double fovY, OdUInt32 nPlanes = 4, double nearZ = 1.0, double farZ = 1e20) = 0;
541};
542
547
548#include "TD_PackPop.h"
549
550#endif // _ODGSCULLINGVOLUME_H_INCLUDED_
OdSmartPtr< OdGsOrthoCullingVolume > OdGsOrthoCullingVolumePtr
OdSmartPtr< OdGsFrustumCullingVolume > OdGsFrustumCullingVolumePtr
OdSmartPtr< OdGsCullingVolume > OdGsCullingVolumePtr
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
unsigned int OdUInt32
void get(OdGePoint3d &base, OdGeVector3d &side1, OdGeVector3d &side2, OdGeVector3d &side3) const
const OdGePoint3d & maxPoint() const
Definition: GeExtents3d.h:443
const OdGePoint3d & minPoint() const
Definition: GeExtents3d.h:438
OdGePoint3d center() const
double radius() const
OdGsCullingBBox(const OdGePoint3d &min, const OdGePoint3d &max)
OdGsCullingBBox(const OdGeExtents3d &ext)
OdGsCullingBBox(const OdGsCullingBBox &aabb)
PrimitiveType primitiveType() const
OdGsCullingBSphere(const OdGsCullingBSphere &bsphere)
OdGsCullingBSphere(double radius, const OdGePoint3d &center)
PrimitiveType primitiveType() const
OdGsCullingBSphere(const OdGeSphere &sphere)
PrimitiveType primitiveType() const
OdGsCullingOBBox(const OdGePoint3d &base, const OdGeVector3d &xAxis, const OdGeVector3d &yAxis, const OdGeVector3d &zAxis)
OdGsCullingOBBox(const OdGeBoundBlock3d &bb)
OdGsCullingOBBox(const OdGsCullingOBBox &obb)
virtual ~OdGsCullingPrimitive()
virtual PrimitiveType primitiveType() const =0
virtual void transformBy(const OdGeMatrix3d &xfm)=0
virtual bool intersectWithOpt(const OdGsCullingPrimitive &prim) const =0
virtual IntersectionStatus intersectWith(const OdGsCullingPrimitive &prim) const =0
virtual ProjectionType projectionType() const =0
ODRX_DECLARE_MEMBERS(OdGsCullingVolume)
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
ODRX_DECLARE_MEMBERS(OdGsFrustumCullingVolume)
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
virtual void init(const OdGePoint3d &position, const OdGeVector3d &direction, const OdGeVector3d &upVector, double volumeWidth, double volumeHeight)=0
ODRX_DECLARE_MEMBERS(OdGsOrthoCullingVolume)