@antv/g-webgpu-raytracer
Version:
A simple ray tracer implemented with WebGPU
40 lines (32 loc) • 1.92 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
import { Buffer } from './Buffer';
export var LightBuffer = /*#__PURE__*/function (_Buffer) {
_inherits(LightBuffer, _Buffer);
var _super = _createSuper(LightBuffer);
function LightBuffer(length) {
_classCallCheck(this, LightBuffer);
return _super.call(this, 4, length);
}
_createClass(LightBuffer, [{
key: "append",
value: function append(lightData) {
this.appendF(lightData.position[0]);
this.appendF(lightData.position[1]);
this.appendF(lightData.position[2]);
this.appendF(lightData.radius);
this.appendF(lightData.color[0]);
this.appendF(lightData.color[1]);
this.appendF(lightData.color[2]);
this.appendF(lightData.intensity);
}
}]);
return LightBuffer;
}(Buffer);
LightBuffer.bytes = 8;
//# sourceMappingURL=LightBuffer.js.map