Difference between revisions of "NewtonTreeCollisionGetVertexListTriangleListInAABB"
Line 10: | Line 10: | ||
* const NewtonCollision* const treeCollision | * const NewtonCollision* const treeCollision | ||
− | * const dFloat* const p0 | + | * const dFloat* const p0 - Pointer to start of the bounding box (collision AABB - untransformed space) |
− | * const dFloat* const p1 | + | * const dFloat* const p1 - Pointer to end of the bounding box (collision AABB - untransformed space) |
* const dFloat** const vertexArray | * const dFloat** const vertexArray | ||
* int* const vertexCount | * int* const vertexCount | ||
* int* const vertexStrideInBytes | * int* const vertexStrideInBytes | ||
* const int* const indexList | * const int* const indexList | ||
− | * int maxIndexCount | + | * int maxIndexCount - tells newton maximum amout of availible memory for indexList and faceAttribute that it can write to |
* const int* const faceAttribute | * const int* const faceAttribute | ||
== Return == | == Return == | ||
− | * int - number of faces | + | * int - number of faces returned |
* vertexStrideInBytes - gets filled with a value telling you the stride between vertexarray vertices (12 bytes) | * vertexStrideInBytes - gets filled with a value telling you the stride between vertexarray vertices (12 bytes) | ||
* vertexArray - here you receive a pointer to array of vertexes in newton memory (data is not copied to your buffer, here you receive pointer to newton's data) | * vertexArray - here you receive a pointer to array of vertexes in newton memory (data is not copied to your buffer, here you receive pointer to newton's data) | ||
Line 26: | Line 26: | ||
== Description == | == Description == | ||
+ | * vertexCount returns amout of actual vertexes | ||
* indexList should be a list 3 * maxIndexCount the number of elements. | * indexList should be a list 3 * maxIndexCount the number of elements. | ||
− | * | + | * faceAttribute should be a list maxIndexCount the number of elements. |
* this function could be used by the application for many purposes. For example it can be used to draw the collision geometry intersecting a collision primitive instead of drawing the entire collision tree in debug mode. Another use for this function is to to efficient draw projective texture shadows. | * this function could be used by the application for many purposes. For example it can be used to draw the collision geometry intersecting a collision primitive instead of drawing the entire collision tree in debug mode. Another use for this function is to to efficient draw projective texture shadows. | ||
+ | * Stride might not be always 12 bytes, for example in user mesh implementations, this could be anything. | ||
+ | |||
+ | == Functionality == | ||
+ | |||
+ | Instruction on what newton does internally (from https://github.com/MADEAPPS/newton-dynamics/blob/69d773bd41f6aa8b6a955b7fa21515e22040e05a/applications/demosSandbox/sdkDemos/toolBox/UserHeightFieldCollision.cpp#L51 ) | ||
+ | * The application must find all that Faces intersecting BBox p0-p1 and copy then in to the passed parameters. | ||
+ | * copy the pointer vertexArray | ||
+ | * copy the vertex count into vertexCount | ||
+ | * copy the vertex stride into vertexStrideInBytes | ||
+ | * copy each index of the triangle list into indexList, do no copy more indices than maxIndexCount | ||
+ | * for each face copy the face attribute into pointer userDataList | ||
== See also == | == See also == |
Latest revision as of 08:01, 13 April 2020
Contents
NewtonTreeCollisionGetVertexListTriangleListInAABB
int NewtonTreeCollisionGetVertexListTriangleListInAABB (const NewtonCollision* const treeCollision, const dFloat* const p0, const dFloat* const p1, const dFloat** const vertexArray, int* const vertexCount, int* const vertexStrideInBytes, const int* const indexList, int maxIndexCount, const int* const faceAttribute)
Usage
collect the vertex list index list mesh intersecting the AABB in collision mesh.
Parameters
- const NewtonCollision* const treeCollision
- const dFloat* const p0 - Pointer to start of the bounding box (collision AABB - untransformed space)
- const dFloat* const p1 - Pointer to end of the bounding box (collision AABB - untransformed space)
- const dFloat** const vertexArray
- int* const vertexCount
- int* const vertexStrideInBytes
- const int* const indexList
- int maxIndexCount - tells newton maximum amout of availible memory for indexList and faceAttribute that it can write to
- const int* const faceAttribute
Return
- int - number of faces returned
- vertexStrideInBytes - gets filled with a value telling you the stride between vertexarray vertices (12 bytes)
- vertexArray - here you receive a pointer to array of vertexes in newton memory (data is not copied to your buffer, here you receive pointer to newton's data)
- faceAttribute and indexList get filled with data constructing the faces, returned geometry is always returned as triangles (3 indexes per face, and 1 faceattribute per face).
Description
- vertexCount returns amout of actual vertexes
- indexList should be a list 3 * maxIndexCount the number of elements.
- faceAttribute should be a list maxIndexCount the number of elements.
- this function could be used by the application for many purposes. For example it can be used to draw the collision geometry intersecting a collision primitive instead of drawing the entire collision tree in debug mode. Another use for this function is to to efficient draw projective texture shadows.
- Stride might not be always 12 bytes, for example in user mesh implementations, this could be anything.
Functionality
Instruction on what newton does internally (from https://github.com/MADEAPPS/newton-dynamics/blob/69d773bd41f6aa8b6a955b7fa21515e22040e05a/applications/demosSandbox/sdkDemos/toolBox/UserHeightFieldCollision.cpp#L51 )
- The application must find all that Faces intersecting BBox p0-p1 and copy then in to the passed parameters.
- copy the pointer vertexArray
- copy the vertex count into vertexCount
- copy the vertex stride into vertexStrideInBytes
- copy each index of the triangle list into indexList, do no copy more indices than maxIndexCount
- for each face copy the face attribute into pointer userDataList