.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "RTC_GEOMETRY_TYPE_TRIANGLE" "3" "" "" "Embree Ray Tracing Kernels 4" .hy .SS NAME .IP .nf \f[C] RTC_GEOMETRY_TYPE_TRIANGLE - triangle geometry type \f[R] .fi .SS SYNOPSIS .IP .nf \f[C] #include RTCGeometry geometry = rtcNewGeometry(device, RTC_GEOMETRY_TYPE_TRIANGLE); \f[R] .fi .SS DESCRIPTION .PP Triangle meshes are created by passing \f[C]RTC_GEOMETRY_TYPE_TRIANGLE\f[R] to the \f[C]rtcNewGeometry\f[R] function call. The triangle indices can be specified by setting an index buffer (\f[C]RTC_BUFFER_TYPE_INDEX\f[R] type) and the triangle vertices by setting a vertex buffer (\f[C]RTC_BUFFER_TYPE_VERTEX\f[R] type). See \f[C]rtcSetGeometryBuffer\f[R] and \f[C]rtcSetSharedGeometryBuffer\f[R] for more details on how to set buffers. The index buffer must contain an array of three 32-bit indices per triangle (\f[C]RTC_FORMAT_UINT3\f[R] format) and the number of primitives is inferred from the size of that buffer. The vertex buffer must contain an array of single precision \f[C]x\f[R], \f[C]y\f[R], \f[C]z\f[R] floating point coordinates (\f[C]RTC_FORMAT_FLOAT3\f[R] format), and the number of vertices are inferred from the size of that buffer. The vertex buffer can be at most 16 GB large. .PP The parametrization of a triangle uses the first vertex \f[C]p0\f[R] as base point, the vector \f[C]p1 - p0\f[R] as u-direction and the vector \f[C]p2 - p0\f[R] as v-direction. Thus vertex attributes \f[C]t0,t1,t2\f[R] can be linearly interpolated over the triangle the following way: .IP .nf \f[C] t_uv = (1-u-v)*t0 + u*t1 + v*t2 = t0 + u*(t1-t0) + v*(t2-t0) \f[R] .fi .PP A triangle whose vertices are laid out counter-clockwise has its geometry normal pointing upwards outside the front face, like illustrated in the following picture: .IP .nf \f[C] \f[R] .fi .PP For multi-segment motion blur, the number of time steps must be first specified using the \f[C]rtcSetGeometryTimeStepCount\f[R] call. Then a vertex buffer for each time step can be set using different buffer slots, and all these buffers have to have the same stride and size. .PP Also see tutorial [Triangle Geometry] for an example of how to create triangle meshes. .SS EXIT STATUS .PP On failure \f[C]NULL\f[R] is returned and an error code is set that be get queried using \f[C]rtcGetDeviceError\f[R]. .SS SEE ALSO .PP [rtcNewGeometry]