generateVertexPositions method Null safety

  1. @override
void generateVertexPositions(
  1. Vector3List positions,
  2. Uint16List indices
)
override

Implementation

@override
void generateVertexPositions(Vector3List positions, Uint16List indices) {
  // Front
  positions[0] = Vector3(_width, _height, _depth);
  positions[1] = Vector3(-_width, _height, _depth);
  positions[2] = Vector3(-_width, -_height, _depth);
  positions[3] = Vector3(_width, -_height, _depth);

  // Back
  positions[4] = Vector3(_width, -_height, -_depth);
  positions[5] = Vector3(-_width, -_height, -_depth);
  positions[6] = Vector3(-_width, _height, -_depth);
  positions[7] = Vector3(_width, _height, -_depth);

  // Right
  positions[8] = Vector3(_width, -_height, _depth);
  positions[9] = Vector3(_width, -_height, -_depth);
  positions[10] = Vector3(_width, _height, -_depth);
  positions[11] = Vector3(_width, _height, _depth);

  // Left
  positions[12] = Vector3(-_width, _height, _depth);
  positions[13] = Vector3(-_width, _height, -_depth);
  positions[14] = Vector3(-_width, -_height, -_depth);
  positions[15] = Vector3(-_width, -_height, _depth);

  // Top
  positions[16] = Vector3(_width, _height, _depth);
  positions[17] = Vector3(_width, _height, -_depth);
  positions[18] = Vector3(-_width, _height, -_depth);
  positions[19] = Vector3(-_width, _height, _depth);

  // Bottom
  positions[20] = Vector3(-_width, -_height, _depth);
  positions[21] = Vector3(-_width, -_height, -_depth);
  positions[22] = Vector3(_width, -_height, -_depth);
  positions[23] = Vector3(_width, -_height, _depth);
}