.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "RTC_GEOMETRY_TYPE_GRID" "3" "" "" "Embree Ray Tracing Kernels 4"
.hy
.SS NAME
.IP
.nf
\f[C]
RTC_GEOMETRY_TYPE_GRID - grid geometry type
\f[R]
.fi
.SS SYNOPSIS
.IP
.nf
\f[C]
#include <embree4/rtcore.h>

RTCGeometry geometry =
  rtcNewGeometry(device, RTC_GEOMETRY_TYPE_GRID);
\f[R]
.fi
.SS DESCRIPTION
.PP
Grid meshes are created by passing \f[C]RTC_GEOMETRY_TYPE_GRID\f[R] to
the \f[C]rtcNewGeometry\f[R] function call, and contain an array of grid
primitives.
This array of grids can be specified by setting up a grid buffer (with
\f[C]RTC_BUFFER_TYPE_GRID\f[R] type and \f[C]RTC_FORMAT_GRID\f[R]
format) and the grid mesh 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 number of grid primitives in the grid mesh is inferred from the size
of the grid buffer.
.PP
The vertex buffer contains 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 is
inferred from the size of that buffer.
.PP
Each grid in the grid buffer is of the type \f[C]RTCGrid\f[R]:
.IP
.nf
\f[C]
struct RTCGrid
{
  unsigned int startVertexID;
  unsigned int stride;
  unsigned short width,height; 
};
\f[R]
.fi
.PP
The \f[C]RTCGrid\f[R] structure describes a 2D grid of vertices (with
respect to the vertex buffer of the grid mesh).
The \f[C]width\f[R] and \f[C]height\f[R] members specify the number of
vertices in u and v direction, e.g.\ setting both \f[C]width\f[R] and
\f[C]height\f[R] to 3 sets up a 3\[tmu]3 vertex grid.
The maximum allowed \f[C]width\f[R] and \f[C]height\f[R] is 32767.
The \f[C]startVertexID\f[R] specifies the ID of the top-left vertex in
the vertex grid, while the \f[C]stride\f[R] parameter specifies a stride
(in number of vertices) used to step to the next row.
.PP
A vertex grid of dimensions \f[C]width\f[R] and \f[C]height\f[R] is
treated as a \f[C](width-1)\f[R] x \f[C](height-1)\f[R] grid of
\f[C]quads\f[R] (triangle-pairs), with the same shared edge handling as
for regular quad meshes.
However, the \f[C]u\f[R]/\f[C]v\f[R] coordinates have the uniform range
\f[C][0..1]\f[R] for an entire vertex grid.
The \f[C]u\f[R] direction follows the \f[C]width\f[R] of the grid while
the \f[C]v\f[R] direction the \f[C]height\f[R].
.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 must have the same stride and size.
.SS EXIT STATUS
.PP
On failure \f[C]NULL\f[R] is returned and an error code is set that can
be queried using \f[C]rtcGetDeviceError\f[R].
.SS SEE ALSO
.PP
[rtcNewGeometry]
