From Newton Wiki
Jump to: navigation, search


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)


collect the vertex list index list mesh intersecting the AABB in collision mesh.


  • 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


  • 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).


  • 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.


Instruction on what newton does internally (from )

  • 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