getTessellatedVerticesForPatch method

Vertices getTessellatedVerticesForPatch({
  1. required List<int> cornerIndices,
  2. required RenderedOMeshRect verticesMesh,
  3. required RenderedOMeshRect textureMesh,
  4. required int tessellation,
})

Returns a Vertices object with the given cornerIndices, verticesMesh, textureMesh, and tessellation.

Implementation

Vertices getTessellatedVerticesForPatch({
  required List<int> cornerIndices,
  required RenderedOMeshRect verticesMesh,
  required RenderedOMeshRect textureMesh,
  required int tessellation,
}) {
  final lengthInF32 = _vertexData.length ~/ 2;
  final offsetInBytes = lengthInF32 * 4;
  final verticesTriangles = Float32List.view(
    _vertexData.buffer,
    0,
    lengthInF32,
  );
  final textureTriangles = Float32List.view(
    _vertexData.buffer,
    offsetInBytes,
    lengthInF32,
  );

  _writeTriangles(
    cornerIndices,
    verticesMesh,
    tessellation,
    verticesTriangles,
  );

  _writeTriangles(
    cornerIndices,
    textureMesh,
    tessellation,
    textureTriangles,
  );

  return Vertices.raw(
    VertexMode.triangles,
    verticesTriangles,
    textureCoordinates: textureTriangles,
  );
}