VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
bulletUtil.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
14 #include <btBulletCollisionCommon.h>
15 #include <geometry/point.h>
17 #include <matrix/vlVector.h>
18 #include <list>
19 #include <geometry/surface.h>
21 #include "tbb/spin_rw_mutex.h"
22 #include <boost/optional.hpp>
23 
24 class DtChord;
25 class DtSphere;
26 class DtLocalVertexList;
29 class Coordinate_System;
30 
32 
33 inline btVector3 DtPoint2btVector3(const DtPoint& p) { return btVector3(p.x(), p.y(), p.z()); }
34 inline btVector3 DtVector2btVector3(const DtVector& v) { return btVector3(v.x(), v.y(), v.z()); }
35 inline DtPoint btVector32DtPoint(const btVector3& v) { return DtPoint(v.x(), v.y(), v.z()); }
36 inline DtVector btVector32DtVector(const btVector3& v) { return DtVector(v.x(), v.y(), v.z()); }
39 
44  const DtChord& chord,
45  const DtSphere& sphere);
46 
50  const DtSphere& sphere1,
51  const DtSphere& sphere2);
52 
59  const Coordinate_System&,
60  const DtLocalVertexList& shape,
61  const DtSphere& sphere);
62 
67  const Coordinate_System&,
69  const DtSphere& sphere);
70 
73  : public btCollisionWorld::RayResultCallback
74 {
78  {
79  explicit RayResultRecord(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace);
80 
84  const btVector3& rayFromWorld, const btVector3& rayToWorld) const;
85 
86  boost::shared_ptr<const DtCollisionObjectInterface> object;
87  btScalar intersectionTime;
88  btVector3 normal;
89  boost::optional<btTransform> normalTransform;
91  };
92 
94  DtIntersectionRecord::DtIntersectionType irtFlag, short int filterMask);
95 
97  virtual bool needsCollision(btBroadphaseProxy* proxy0) const;
98 
99 protected:
101 };
102 
107 {
109  DtIntersectionRecord::DtIntersectionType irtFlag, short int filterMask);
110 
111  virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace);
112 
113  std::vector<RayResultRecord> myRecords;
114 };
115 
119 {
121  DtIntersectionRecord::DtIntersectionType irtFlag, short int filterMask);
122 
123  virtual btScalar addSingleResult(
124  btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace);
125 
126  boost::optional<RayResultRecord> myResult;
127 };
128 
132 {
133  explicit DtIntersectionExistsCallback(short int filterMask);
134 
135  virtual bool needsCollision(btBroadphaseProxy* proxy0) const;
136 
137  virtual btScalar addSingleResult(
138  btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace);
139 };
140 
145  const DtVector& rayDirectionNonNormalized,
146  const DtSphere& sphere,
147  double& t);
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Builds BVH and checks to see if object is enabled.
Only records whether there was a hit or not, bails out of future calculations once it finds one...
Definition: bulletUtil.h:130
const double & x() const
Definition: point.h:188
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
DtBoost::shared_ptr< DtTerrainPagingGeometry > DtTerrainPagingGeometryPtr
Definition: terrainPagingGeometry.h:46
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords.
Definition: vrfChordIntersectRecordList.h:31
Definition: sphere.h:22
btScalar intersectionTime
Definition: bulletUtil.h:87
btVector3 DtVector2btVector3(const DtVector &v)
Definition: bulletUtil.h:34
bool DT_DLL_vantageTerrainImplementation shapeSphereVolumetricIntersect(const Coordinate_System &, const DtLocalVertexList &shape, const DtSphere &sphere)
Note that this function treats the shape as if it is in two dimensions (all tests ignore height for t...
boost::optional< RayResultRecord > myResult
Definition: bulletUtil.h:126
bool DT_DLL_vantageTerrainImplementation sphereSphereVolumetricIntersect(const DtSphere &sphere1, const DtSphere &sphere2)
boost::optional< btTransform > normalTransform
Definition: bulletUtil.h:89
boost::shared_ptr< const DtCollisionObjectInterface > object
Definition: bulletUtil.h:86
int triangleIndex
Definition: bulletUtil.h:90
bool DT_DLL_vantageTerrainImplementation DtIntersectRaySphere2(const DtPoint &rayStartPoint, const DtVector &rayDirectionNonNormalized, const DtSphere &sphere, double &t)
Almost the same function DtIntersectRaySphere in makTerrainToolkit But removing a few lines of code s...
Only records the closest hit.
Definition: bulletUtil.h:117
Definition: coordSystem.h:54
DtPoint btVector32DtPoint(const btVector3 &v)
Definition: bulletUtil.h:35
DtVector btVector32DtVector(const btVector3 &v)
Definition: bulletUtil.h:36
const double & y() const
Definition: point.h:198
Definition: osgToBullet.h:63
Definition: vrfChordIntersectionRecord.h:19
const DtIntersectionRecord::DtIntersectionType myIrtFlag
Definition: bulletUtil.h:100
Base class for bullet callbacks which implements needsCollision.
Definition: bulletUtil.h:72
Extended version of bullet&#39;s RayResultCallback which records all the hits along the ray instead of on...
Definition: bulletUtil.h:105
bool DT_DLL_vantageTerrainImplementation geometrySphereVolumetricIntersect(const Coordinate_System &, DtTerrainPagingGeometryPtr geometry, const DtSphere &sphere)
Holds hit results so that data we need from them can be computed after mutex has been released...
Definition: bulletUtil.h:77
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
btVector3 normal
Definition: bulletUtil.h:88
bool DT_DLL_vantageTerrainImplementation btVectorIsZero(const btVector3 &v)
bool DT_DLL_vantageTerrainImplementation chordSphereVolumetricIntersect(const DtChord &chord, const DtSphere &sphere)
const double & z() const
Definition: point.h:208
std::vector< RayResultRecord > myRecords
Definition: bulletUtil.h:113
class DtLocalVertexList:
Definition: localVertexList.h:20
btVector3 DtPoint2btVector3(const DtPoint &p)
Utilities for using Bullet in MAK products.
Definition: bulletUtil.h:33
Definition: point.h:34
DtIntersectionType
Definition: intersectionRecord.h:41

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)