EnableAttribute method

void EnableAttribute(
  1. String canonical
)

Implementation

void EnableAttribute(String canonical) {
  assert(!attributes.containsKey(canonical),
      "attribute ${canonical} already exists");
  assert(canonical.startsWith("a"), "${canonical} is not an attribute");
  ShaderVarDesc desc = RetrieveShaderVarDesc(canonical);
  switch (desc.type) {
    case VarTypeVec2:
      attributes[canonical] = <VM.Vector2>[];
      break;
    case VarTypeVec3:
      attributes[canonical] = <VM.Vector3>[];
      break;
    case VarTypeVec4:
      attributes[canonical] = <VM.Vector4>[];
      break;
    case VarTypeFloat:
      attributes[canonical] = <double>[];
      break;
    case VarTypeUvec4:
      attributes[canonical] = <List<int>>[];
      break;
    default:
      assert(false, "unknown type for ${canonical}");
  }
}