7 #ifndef PXR_BASE_GF_FRUSTUM_H 
    8 #define PXR_BASE_GF_FRUSTUM_H 
   92         : _position(o._position)
 
   93         , _rotation(o._rotation)
 
   95         , _nearFar(o._nearFar)
 
   96         , _viewDistance(o._viewDistance)
 
   97         , _projectionType(o._projectionType)
 
   99         if (
auto *planes = o._planes.load()) {
 
  100             _planes = 
new std::array<GfPlane, 6>(*planes);
 
  106         : _position(o._position)
 
  107         , _rotation(o._rotation)
 
  109         , _nearFar(o._nearFar)
 
  110         , _viewDistance(o._viewDistance)
 
  111         , _projectionType(o._projectionType)
 
  114             o._planes.exchange(
nullptr, std::memory_order_relaxed)) {
 
  124               double viewDistance = 5.0);
 
  132               double viewDistance = 5.0);
 
  139         _position = o._position;
 
  140         _rotation = o._rotation;
 
  142         _nearFar = o._nearFar;
 
  143         _viewDistance = o._viewDistance;
 
  144         _projectionType = o._projectionType;
 
  145         delete _planes.load(std::memory_order_relaxed);
 
  146         if (
auto *planes = o._planes.load(std::memory_order_relaxed)) {
 
  147             _planes.store(
new std::array<GfPlane, 6>(*planes),
 
  148                           std::memory_order_relaxed);
 
  151             _planes.store(
nullptr, std::memory_order_relaxed);
 
  161         _position = o._position;
 
  162         _rotation = o._rotation;
 
  164         _nearFar = o._nearFar;
 
  165         _viewDistance = o._viewDistance;
 
  166         _projectionType = o._projectionType;
 
  167         delete _planes.load(std::memory_order_relaxed);
 
  168         _planes.store(o._planes.load(std::memory_order_relaxed),
 
  169                       std::memory_order_relaxed);
 
  170         o._planes.store(
nullptr, std::memory_order_relaxed);
 
  187         if (_position       != f._position)        
return false;
 
  188         if (_rotation       != f._rotation)        
return false;
 
  189         if (_window         != f._window)          
return false;
 
  190         if (_nearFar        != f._nearFar)         
return false;
 
  191         if (_viewDistance   != f._viewDistance)    
return false;
 
  192         if (_projectionType != f._projectionType)  
return false;
 
  199         return !(*
this == 
f);
 
  213         _DirtyFrustumPlanes();
 
  226         _DirtyFrustumPlanes();
 
  246         _DirtyFrustumPlanes();
 
  262         _DirtyFrustumPlanes();
 
  272         _viewDistance = viewDistance;
 
  277         return _viewDistance;
 
  282         _projectionType = projectionType;
 
  283         _DirtyFrustumPlanes();
 
  288         return _projectionType;
 
  320                                        double nearDistance, 
double farDistance);
 
  352                                        double nearDistance, 
double farDistance);
 
  359                                        double *nearDistance,
 
  360                                        double *farDistance) 
const;
 
  368                                        double *nearDistance,
 
  369                                        double *farDistance) 
const;
 
  391                                         double nearPlane, 
double farPlane);
 
  398                                         double *nearPlane, 
double *farPlane)
 
  615       GF_API void _DirtyFrustumPlanes();
 
  618       GF_API void       _CalculateFrustumPlanes() 
const;
 
  625                                     const GfVec3d &camSpaceDir) 
const;
 
  646     bool _SegmentIntersects(
GfVec3d const &p0, uint32_t p0Mask,
 
  647                             GfVec3d const &p1, uint32_t p1Mask) 
const;
 
  663     double                      _viewDistance;
 
  670     mutable std::atomic<std::array<GfPlane, 6> *> _planes;
 
  684 #endif // PXR_BASE_GF_FRUSTUM_H  
bool operator==(const GfFrustum &f) const 
 
void SetRotation(const GfRotation &rotation)
 
GfFrustum(GfFrustum const &o)
Copy constructor. 
 
void SetViewDistance(double viewDistance)
Sets the view distance. 
 
friend size_t hash_value(const GfFrustum &f)
 
GfFrustum & operator=(GfFrustum const &o) noexcept
Copy assignment. 
 
static double GetReferencePlaneDepth()
Returns the depth of the reference plane. 
 
GF_API std::vector< GfVec3d > ComputeCorners() const 
 
GF_API std::ostream & operator<<(std::ostream &out, const GfFrustum &f)
 
GF_API bool Intersects(const GfBBox3d &bbox) const 
 
GF_API GfVec3d ComputeViewDirection() const 
 
GF_API bool GetOrthographic(double *left, double *right, double *bottom, double *top, double *nearPlane, double *farPlane) const 
 
GF_API double ComputeAspectRatio() const 
 
GF_API GfFrustum & Transform(const GfMatrix4d &matrix)
 
GF_API GfRay ComputePickRay(const GfVec2d &windowPos) const 
 
GF_API void FitToSphere(const GfVec3d ¢er, double radius, double slack=0.0)
 
const GfVec3d & GetPosition() const 
Returns the position of the frustum in world space. 
 
GF_API void SetPositionAndRotationFromMatrix(const GfMatrix4d &camToWorldXf)
 
GF_API double GetFOV(bool isFovVertical=false) const 
 
GF_API GfVec3d ComputeLookAtPoint() const 
 
GfFrustum(GfFrustum &&o) noexcept
Move constructor. 
 
const GfRange1d & GetNearFar() const 
Returns the near/far interval. 
 
GF_API GfMatrix4d ComputeViewMatrix() const 
 
GF_API GfMatrix4d ComputeViewInverse() const 
 
GF_API void SetOrthographic(double left, double right, double bottom, double top, double nearPlane, double farPlane)
 
GF_API GfMatrix4d ComputeProjectionMatrix() const 
 
void SetWindow(const GfRange2d &window)
 
GfFrustum::ProjectionType GetProjectionType() const 
Returns the projection type. 
 
static GF_API bool IntersectsViewVolume(const GfBBox3d &bbox, const GfMatrix4d &vpMat)
 
SIM_API const UT_StringHolder rotation
 
double GetViewDistance() const 
Returns the view distance. 
 
GF_API bool GetPerspective(double *fieldOfViewHeight, double *aspectRatio, double *nearDistance, double *farDistance) const 
 
bool operator!=(const GfFrustum &f) const 
 
GF_API std::vector< GfVec3d > ComputeCornersAtDistance(double d) const 
 
const GfRange2d & GetWindow() const 
Returns the window rectangle in the reference plane. 
 
const GfRotation & GetRotation() const 
 
void SetProjectionType(GfFrustum::ProjectionType projectionType)
Sets the projection type. 
 
GF_API GfRay ComputeRay(const GfVec2d &windowPos) const 
 
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects. 
 
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
 
GF_API GfFrustum ComputeNarrowedFrustum(const GfVec2d &windowPos, const GfVec2d &size) const 
 
SIM_API const UT_StringHolder position
 
#define PXR_NAMESPACE_CLOSE_SCOPE
 
GF_API ~GfFrustum()
Destructor. 
 
GLdouble GLdouble GLdouble top
 
GF_API void SetPerspective(double fieldOfViewHeight, double aspectRatio, double nearDistance, double farDistance)
 
void SetNearFar(const GfRange1d &nearFar)
Sets the near/far interval. 
 
GF_API GfVec3d ComputeUpVector() const 
 
GfFrustum & operator=(GfFrustum &&o) noexcept
Move assignment. 
 
void SetPosition(const GfVec3d &position)
Sets the position of the frustum in world space. 
 
GF_API void ComputeViewFrame(GfVec3d *side, GfVec3d *up, GfVec3d *view) const