Blender  V3.3
btQuantization.h
Go to the documentation of this file.
1 #ifndef BT_GIMPACT_QUANTIZATION_H_INCLUDED
2 #define BT_GIMPACT_QUANTIZATION_H_INCLUDED
3 
8 /*
9 This source file is part of GIMPACT Library.
10 
11 For the latest info, see http://gimpact.sourceforge.net/
12 
13 Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371.
14 email: projectileman@yahoo.com
15 
16 
17 This software is provided 'as-is', without any express or implied warranty.
18 In no event will the authors be held liable for any damages arising from the use of this software.
19 Permission is granted to anyone to use this software for any purpose,
20 including commercial applications, and to alter it and redistribute it freely,
21 subject to the following restrictions:
22 
23 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
24 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
25 3. This notice may not be removed or altered from any source distribution.
26 */
27 
28 #include "LinearMath/btTransform.h"
29 
31  btVector3& outMinBound,
32  btVector3& outMaxBound,
33  btVector3& bvhQuantization,
34  const btVector3& srcMinBound, const btVector3& srcMaxBound,
35  btScalar quantizationMargin)
36 {
37  //enlarge the AABB to avoid division by zero when initializing the quantization values
38  btVector3 clampValue(quantizationMargin, quantizationMargin, quantizationMargin);
39  outMinBound = srcMinBound - clampValue;
40  outMaxBound = srcMaxBound + clampValue;
41  btVector3 aabbSize = outMaxBound - outMinBound;
42  bvhQuantization = btVector3(btScalar(65535.0),
43  btScalar(65535.0),
44  btScalar(65535.0)) /
45  aabbSize;
46 }
47 
49  unsigned short* out,
50  const btVector3& point,
51  const btVector3& min_bound,
52  const btVector3& max_bound,
53  const btVector3& bvhQuantization)
54 {
55  btVector3 clampedPoint(point);
56  clampedPoint.setMax(min_bound);
57  clampedPoint.setMin(max_bound);
58 
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);
63 }
64 
66  const unsigned short* vecIn,
67  const btVector3& offset,
68  const btVector3& bvhQuantization)
69 {
70  btVector3 vecOut;
71  vecOut.setValue(
72  (btScalar)(vecIn[0]) / (bvhQuantization.getX()),
73  (btScalar)(vecIn[1]) / (bvhQuantization.getY()),
74  (btScalar)(vecIn[2]) / (bvhQuantization.getZ()));
75  vecOut += offset;
76  return vecOut;
77 }
78 
79 #endif // BT_GIMPACT_QUANTIZATION_H_INCLUDED
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
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...
Definition: btScalar.h:314
#define SIMD_FORCE_INLINE
Definition: btScalar.h:280
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition: btVector3.h:82
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
static const pxr::TfToken out("out", pxr::TfToken::Immortal)