WebGLRenderer constructor

WebGLRenderer(
  1. Map<String, dynamic>? parameters
)

Implementation

WebGLRenderer(Map<String, dynamic>? parameters) {
  this.parameters = parameters ?? <String, dynamic>{};

  _width = this.parameters["width"].toDouble();
  _height = this.parameters["height"].toDouble();

  depth = this.parameters["depth"] ?? true;
  stencil = this.parameters["stencil"] ?? true;
  _antialias = this.parameters["antialias"] ?? false;
  premultipliedAlpha = this.parameters["premultipliedAlpha"] ?? true;
  preserveDrawingBuffer = this.parameters["preserveDrawingBuffer"] ?? false;
  powerPreference = this.parameters["powerPreference"] ?? "default";

  failIfMajorPerformanceCaveat = this.parameters["failIfMajorPerformanceCaveat"] ?? false;

  // 为了跨平台 自己指定alpha ignore web context 属性
  alpha = this.parameters["alpha"] ?? false;

  _viewport = Vector4(0, 0, width, height);
  _scissor = Vector4(0, 0, width, height);

  _gl = this.parameters["gl"];

  if (this.parameters["canvas"] != null) {
    domElement = this.parameters["canvas"];
  }

  initGLContext();
}