bytev-charts-beta
Version:
基于echarts和JavaScript及ES6封装的一个可以直接调用的图表组件库,内置主题设计,简单快捷,且支持用户自定义配置; npm 安装方式: npm install bytev-charts 若启动提示还需额外install插件,则运行 npm install @babel/runtime-corejs2 即可;
86 lines (70 loc) • 2.71 kB
JavaScript
import _classCallCheck from "@babel/runtime-corejs2/helpers/classCallCheck";
import _createClass from "@babel/runtime-corejs2/helpers/createClass";
import { GPULoadOp } from './constants.js';
import { Color } from '../../../../build/three.module.js';
var _clearAlpha;
var _clearColor = new Color();
var WebGPUBackground = /*#__PURE__*/function () {
function WebGPUBackground(renderer) {
_classCallCheck(this, WebGPUBackground);
this.renderer = renderer;
this.forceClear = false;
}
_createClass(WebGPUBackground, [{
key: "clear",
value: function clear() {
this.forceClear = true;
}
}, {
key: "update",
value: function update(scene) {
var renderer = this.renderer;
var background = scene.isScene === true ? scene.background : null;
var forceClear = this.forceClear;
if (background === null) {
// no background settings, use clear color configuration from the renderer
_clearColor.copy(renderer._clearColor);
_clearAlpha = renderer._clearAlpha;
} else if (background.isColor === true) {
// background is an opaque color
_clearColor.copy(background);
_clearAlpha = 1;
forceClear = true;
} else {
console.error('THREE.WebGPURenderer: Unsupported background configuration.', background);
} // configure render pass descriptor
var renderPassDescriptor = renderer._renderPassDescriptor;
var colorAttachment = renderPassDescriptor.colorAttachments[0];
var depthStencilAttachment = renderPassDescriptor.depthStencilAttachment;
if (renderer.autoClear === true || forceClear === true) {
if (renderer.autoClearColor === true) {
colorAttachment.loadValue = {
r: _clearColor.r,
g: _clearColor.g,
b: _clearColor.b,
a: _clearAlpha
};
} else {
colorAttachment.loadValue = GPULoadOp.Load;
}
if (renderer.autoClearDepth === true) {
depthStencilAttachment.depthLoadValue = renderer._clearDepth;
} else {
depthStencilAttachment.depthLoadValue = GPULoadOp.Load;
}
if (renderer.autoClearStencil === true) {
depthStencilAttachment.stencilLoadValue = renderer._clearDepth;
} else {
depthStencilAttachment.stencilLoadValue = GPULoadOp.Load;
}
} else {
colorAttachment.loadValue = GPULoadOp.Load;
depthStencilAttachment.depthLoadValue = GPULoadOp.Load;
depthStencilAttachment.stencilLoadValue = GPULoadOp.Load;
}
this.forceClear = false;
}
}]);
return WebGPUBackground;
}();
export default WebGPUBackground;