1 #ifndef GIM_TRI_COLLISION_H_INCLUDED
2 #define GIM_TRI_COLLISION_H_INCLUDED
39 #ifndef MAX_TRI_CLIPPING
40 #define MAX_TRI_CLIPPING 16
73 template <
typename DISTANCE_FUNC,
typename CLASS_PLANE>
84 for (_k = 0; _k < point_count; _k++)
86 GREAL _dist = -distance_func(plane, points[_k]) + margin;
93 point_indices[0] = _k;
106 m_points[_k] = points[point_indices[_k]];
169 btMatrix3x3 &matrix = triangle_transform.getBasis();
180 xaxis = zaxis.cross(xaxis);
250 GUINT _i1 = (tri_plane.closestAxis() + 1) % 3;
251 GUINT _i2 = (_i1 + 1) % 3;
254 u = (_vecproj[_i2] * _axe2[_i1] - _vecproj[_i1] * _axe2[_i2]) / (_axe1[_i2] * _axe2[_i1] - _axe1[_i1] * _axe2[_i2]);
255 v = (_vecproj[_i1] - u * _axe1[_i1]) / _axe2[_i1];
259 u = (_vecproj[_i1] * _axe2[_i2] - _vecproj[_i2] * _axe2[_i1]) / (_axe1[_i1] * _axe2[_i2] - _axe1[_i2] * _axe2[_i1]);
260 v = (_vecproj[_i2] - u * _axe1[_i2]) / _axe2[_i2];
297 if (dist -
m_margin > 0.0f)
return false;
301 if (dist -
m_margin > 0.0f)
return false;
305 if (dist -
m_margin > 0.0f)
return false;
324 if (res == 0)
return false;
356 if (res != 1)
return false;
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
btMatrix3x3
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
SIMD_FORCE_INLINE btScalar btFabs(btScalar x)
#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...
This function calcs the distance from a 3D plane.
SIMD_FORCE_INLINE bool has_collision(const GIM_AABB &other) const
Class for colliding triangles.
SIMD_FORCE_INLINE bool ray_collision(const btVector3 &vPoint, const btVector3 &vDir, btVector3 &pout, btVector3 &triangle_normal, GREAL &tparam, GREAL tmax=G_REAL_INFINITY)
Bidireccional ray collision.
SIMD_FORCE_INLINE bool ray_collision_front_side(const btVector3 &vPoint, const btVector3 &vDir, btVector3 &pout, btVector3 &triangle_normal, GREAL &tparam, GREAL tmax=G_REAL_INFINITY)
one direccion ray collision
SIMD_FORCE_INLINE void get_triangle_transform(btTransform &triangle_transform) const
Gets the relative transformation of this triangle.
SIMD_FORCE_INLINE void get_plane(btVector4 &plane) const
bool collide_triangle_hard_test(const GIM_TRIANGLE &other, GIM_TRIANGLE_CONTACT_DATA &contact_data) const
Test triangles by finding separating axis.
SIMD_FORCE_INLINE void get_edge_plane(GUINT edge_index, const btVector3 &triangle_normal, btVector4 &plane) const
SIMD_FORCE_INLINE void get_normal(btVector3 &normal) const
SIMD_FORCE_INLINE bool get_uv_parameters(const btVector3 &point, const btVector3 &tri_plane, GREAL &u, GREAL &v) const
SIMD_FORCE_INLINE void apply_transform(const btTransform &trans)
SIMD_FORCE_INLINE bool is_point_inside(const btVector3 &point, const btVector3 &tri_normal) const
is point in triangle beam?
SIMD_FORCE_INLINE bool collide_triangle(const GIM_TRIANGLE &other, GIM_TRIANGLE_CONTACT_DATA &contact_data) const
Test boxes before doing hard test.
SIMD_FORCE_INLINE GIM_AABB get_box() const
#define DISTANCE_PLANE_POINT(plane, point)
#define TRIANGLE_PLANE(v1, v2, v3, plane)
plane is a vec4f
#define EDGE_PLANE(e1, e2, n, plane)
Calc a plane from an edge an a normal. plane is a vec4f.
#define TRIANGLE_NORMAL(v1, v2, v3, n)
SIMD_FORCE_INLINE GUINT LINE_PLANE_COLLISION(const CLASS_PLANE &plane, const CLASS_POINT &vDir, const CLASS_POINT &vPoint, CLASS_POINT &pout, T &tparam, T tmin, T tmax)
line collision
#define MAT_SET_X(mat, vec3)
Get the triple(3) col of a transform matrix.
#define MAT_SET_Z(mat, vec3)
Get the triple(3) col of a transform matrix.
#define VEC_CROSS(c, a, b)
Vector cross.
#define VEC_NORMALIZE(a)
Vector length.
#define MAT_SET_Y(mat, vec3)
Get the triple(3) col of a transform matrix.
IconTextureDrawCall normal
CCL_NAMESPACE_BEGIN ccl_device_inline float3 triangle_normal(KernelGlobals kg, ccl_private ShaderData *sd)