1#ifndef BT_GIMPACT_QUANTIZATION_H_INCLUDED
2#define BT_GIMPACT_QUANTIZATION_H_INCLUDED
31 btVector3& outMinBound,
32 btVector3& outMaxBound,
33 btVector3& bvhQuantization,
34 const btVector3& srcMinBound,
const btVector3& srcMaxBound,
38 btVector3 clampValue(quantizationMargin, quantizationMargin, quantizationMargin);
39 outMinBound = srcMinBound - clampValue;
40 outMaxBound = srcMaxBound + clampValue;
41 btVector3 aabbSize = outMaxBound - outMinBound;
50 const btVector3& point,
51 const btVector3& min_bound,
52 const btVector3& max_bound,
53 const btVector3& bvhQuantization)
55 btVector3 clampedPoint(point);
56 clampedPoint.setMax(min_bound);
57 clampedPoint.setMin(max_bound);
59 btVector3
v = (clampedPoint - min_bound) * bvhQuantization;
60 out[0] = (
unsigned short)(
v.getX() + 0.5f);
61 out[1] = (
unsigned short)(
v.getY() + 0.5f);
62 out[2] = (
unsigned short)(
v.getZ() + 0.5f);
66 const unsigned short* vecIn,
67 const btVector3& offset,
68 const btVector3& bvhQuantization)
72 (
btScalar)(vecIn[0]) / (bvhQuantization.getX()),
73 (
btScalar)(vecIn[1]) / (bvhQuantization.getY()),
74 (
btScalar)(vecIn[2]) / (bvhQuantization.getZ()));
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE void bt_calc_quantization_parameters(btVector3 &outMinBound, btVector3 &outMaxBound, btVector3 &bvhQuantization, const btVector3 &srcMinBound, const btVector3 &srcMaxBound, btScalar quantizationMargin)
SIMD_FORCE_INLINE void bt_quantize_clamp(unsigned short *out, const btVector3 &point, const btVector3 &min_bound, const btVector3 &max_bound, const btVector3 &bvhQuantization)
SIMD_FORCE_INLINE btVector3 bt_unquantize(const unsigned short *vecIn, const btVector3 &offset, const btVector3 &bvhQuantization)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define SIMD_FORCE_INLINE
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...