@antv/g-lite 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Canvas.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="webxr" />
1
2
  import type { IRenderer } from './AbstractRenderer';
2
3
  import { DisplayObject } from './display-objects/DisplayObject';
3
4
  import type { CanvasContext, IChildNode } from './dom';
@@ -124,7 +125,7 @@ export declare class Canvas extends EventTarget implements ICanvas {
124
125
  * But the canvas remains running which means display objects can be appended later.
125
126
  */
126
127
  destroyChildren(): void;
127
- render(): void;
128
+ render(frame?: XRFrame): void;
128
129
  private run;
129
130
  private initRenderer;
130
131
  private initRenderingService;
@@ -169,6 +169,10 @@ export declare class Camera implements ICamera {
169
169
  * 设置相机矩阵
170
170
  */
171
171
  setMatrix(matrix: mat4): this;
172
+ /**
173
+ * Set projection matrix manually.
174
+ */
175
+ setProjectionMatrix(matrix: mat4): void;
172
176
  setFov(fov: number): this;
173
177
  setAspect(aspect: number): this;
174
178
  setNear(near: number): this;
package/dist/index.esm.js CHANGED
@@ -1699,6 +1699,12 @@ var Camera = /** @class */ (function () {
1699
1699
  this._update();
1700
1700
  return this;
1701
1701
  };
1702
+ /**
1703
+ * Set projection matrix manually.
1704
+ */
1705
+ Camera.prototype.setProjectionMatrix = function (matrix) {
1706
+ this.projectionMatrix = matrix;
1707
+ };
1702
1708
  Camera.prototype.setFov = function (fov) {
1703
1709
  this.setPerspective(this.near, this.far, fov, this.aspect);
1704
1710
  return this;
@@ -10078,7 +10084,7 @@ var RenderingService = /** @class */ (function () {
10078
10084
  return (!enableDirtyRectangleRendering ||
10079
10085
  this.context.renderingContext.renderReasons.has(RenderReason.CAMERA_CHANGED));
10080
10086
  };
10081
- RenderingService.prototype.render = function (canvasConfig, rerenderCallback) {
10087
+ RenderingService.prototype.render = function (canvasConfig, frame, rerenderCallback) {
10082
10088
  var _this = this;
10083
10089
  this.stats.total = 0;
10084
10090
  this.stats.rendered = 0;
@@ -10097,7 +10103,7 @@ var RenderingService = /** @class */ (function () {
10097
10103
  if (shouldTriggerRenderHooks) {
10098
10104
  this.renderDisplayObject(renderingContext.root, canvasConfig, renderingContext);
10099
10105
  }
10100
- this.hooks.beginFrame.call();
10106
+ this.hooks.beginFrame.call(frame);
10101
10107
  if (shouldTriggerRenderHooks) {
10102
10108
  renderingContext.renderListCurrentFrame.forEach(function (object) {
10103
10109
  _this.hooks.beforeRender.call(object);
@@ -10105,7 +10111,7 @@ var RenderingService = /** @class */ (function () {
10105
10111
  _this.hooks.afterRender.call(object);
10106
10112
  });
10107
10113
  }
10108
- this.hooks.endFrame.call();
10114
+ this.hooks.endFrame.call(frame);
10109
10115
  renderingContext.renderListCurrentFrame = [];
10110
10116
  renderingContext.renderReasons.clear();
10111
10117
  rerenderCallback();
@@ -15175,11 +15181,11 @@ var Canvas = /** @class */ (function (_super) {
15175
15181
  Canvas.prototype.destroyChildren = function () {
15176
15182
  this.document.documentElement.destroyChildren();
15177
15183
  };
15178
- Canvas.prototype.render = function () {
15184
+ Canvas.prototype.render = function (frame) {
15179
15185
  var _this = this;
15180
15186
  this.dispatchEvent(beforeRenderEvent);
15181
15187
  var renderingService = this.getRenderingService();
15182
- renderingService.render(this.getConfig(), function () {
15188
+ renderingService.render(this.getConfig(), frame, function () {
15183
15189
  // trigger actual rerender event
15184
15190
  // @see https://github.com/antvis/G/issues/1268
15185
15191
  _this.dispatchEvent(rerenderEvent);
@@ -15188,8 +15194,8 @@ var Canvas = /** @class */ (function (_super) {
15188
15194
  };
15189
15195
  Canvas.prototype.run = function () {
15190
15196
  var _this = this;
15191
- var tick = function () {
15192
- _this.render();
15197
+ var tick = function (time, frame) {
15198
+ _this.render(frame);
15193
15199
  _this.frameId = _this.requestAnimationFrame(tick);
15194
15200
  };
15195
15201
  tick();