getBindingState method

dynamic getBindingState(
  1. BufferGeometry geometry,
  2. dynamic program,
  3. Material material
)

Implementation

getBindingState(
  BufferGeometry geometry,
  program,
  Material material,
) {
  final wireframe = (material.wireframe == true);

  Map<int, dynamic>? programMap = bindingStates[geometry.id];

  if (programMap == null) {
    programMap = {};
    bindingStates[geometry.id] = programMap;
  }

  Map? stateMap = programMap[program.id];

  if (stateMap == null) {
    stateMap = {};
    programMap[program.id] = stateMap;
  }

   Map? state = stateMap[wireframe];

  if (state == null) {
    state = createBindingState(createVertexArrayObject());
    stateMap[wireframe] = state;
  }

  return state;
}