getBindingState method

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

Implementation

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

  var programMap = bindingStates[geometry.id];

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

  var stateMap = programMap[program.id];

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

  var state = stateMap[wireframe];

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

  return state;
}