8000 Add `xr` module and support `webxr` by cptbtptpbcptdtptp · Pull Request #1787 · galacean/engine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Dismiss alert

Add xr module and support webxr #1787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 168 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
5b77ccd
feat: add xr
cptbtptpbcptdtptp Aug 11, 2023
88d800f
feat: add xr
cptbtptpbcptdtptp Aug 21, 2023
d0fb73a
feat: add xr
cptbtptpbcptdtptp Aug 21, 2023
8d71286
feat: add xr
cptbtptpbcptdtptp Aug 21, 2023
d5de917
feat: add xr
cptbtptpbcptdtptp Aug 23, 2023
3b29d4f
feat: add xr
cptbtptpbcptdtptp Aug 23, 2023
83044b7
feat: add xr
cptbtptpbcptdtptp Aug 25, 2023
4bcaae6
feat: add xr
cptbtptpbcptdtptp Aug 28, 2023
95931ce
feat: add xr
cptbtptpbcptdtptp Aug 29, 2023
d88145c
feat: add xr
cptbtptpbcptdtptp Sep 4, 2023
120b3ec
feat: add xr
cptbtptpbcptdtptp Sep 4, 2023
a7ec554
feat: add xr
cptbtptpbcptdtptp Sep 4, 2023
470f390
feat: add xr
cptbtptpbcptdtptp Sep 5, 2023
71c9b21
feat: add xr
Sep 11, 2023
8493052
feat: add xr
Sep 15, 2023
d02945a
feat: merge code
Sep 19, 2023
e0d9991
feat: add xr
cptbtptpbcptdtptp Sep 20, 2023
cf48b9d
feat: add xr
cptbtptpbcptdtptp Sep 20, 2023
69f44a9
feat: add xr
cptbtptpbcptdtptp Sep 20, 2023
e50cc67
feat: add xr
cptbtptpbcptdtptp Sep 20, 2023
afbffad
feat: add xr
cptbtptpbcptdtptp Sep 21, 2023
debcf11
feat: add xr
cptbtptpbcptdtptp Sep 21, 2023
982042e
feat: add xr
cptbtptpbcptdtptp Sep 21, 2023
69b5fc1
fix: script delete bug when looping
cptbtptpbcptdtptp Sep 21, 2023
142bd30
fix: script delete bug when looping
cptbtptpbcptdtptp Sep 21, 2023
741528d
fix: script delete bug when looping
cptbtptpbcptdtptp Sep 21, 2023
7b42800
feat: merge code
cptbtptpbcptdtptp Sep 25, 2023
1d18748
feat: merge code
cptbtptpbcptdtptp Oct 23, 2023
bf18ab7
fix: webxr add pointer move
cptbtptpbcptdtptp Oct 24, 2023
8d44c21
feat: format code
cptbtptpbcptdtptp Oct 24, 2023
5d41013
feat: update code
cptbtptpbcptdtptp Oct 26, 2023
4f15d55
feat: update code
cptbtptpbcptdtptp Oct 27, 2023
cc1bef2
feat: update code
cptbtptpbcptdtptp Oct 29, 2023
70ea83d
feat: update code
cptbtptpbcptdtptp Oct 29, 2023
9790a16
feat: update code
cptbtptpbcptdtptp Oct 29, 2023
28bf14f
feat: update code
cptbtptpbcptdtptp Oct 29, 2023
ff76ad1
feat: update code
cptbtptpbcptdtptp Oct 29, 2023
e1c4247
feat: merge code
cptbtptpbcptdtptp Oct 30, 2023
8c9800d
feat: update code
cptbtptpbcptdtptp Oct 31, 2023
18dcaa5
feat: update image tracking
cptbtptpbcptdtptp Nov 1, 2023
8832e64
feat: update code
cptbtptpbcptdtptp Nov 2, 2023
915f494
feat: update code
cptbtptpbcptdtptp Nov 2, 2023
dfabfe4
feat: update code
cptbtptpbcptdtptp Nov 5, 2023
def71c2
feat: udpate code
cptbtptpbcptdtptp Nov 6, 2023
590600e
feat: update code
cptbtptpbcptdtptp Nov 6, 2023
a092592
feat: update code
cptbtptpbcptdtptp Nov 6, 2023
260027f
feat: merge code
cptbtptpbcptdtptp Nov 6, 2023
5cc20d9
fix: lint error
cptbtptpbcptdtptp Nov 6, 2023
d49205f
feat: update code
cptbtptpbcptdtptp Nov 6, 2023
1f86357
feat: add comment
cptbtptpbcptdtptp Nov 7, 2023
2b371e8
feat: add comment
cptbtptpbcptdtptp Nov 8, 2023
56a31ae
feat: update code
cptbtptpbcptdtptp Nov 8, 2023
c511a39
feat: update code
cptbtptpbcptdtptp Nov 8, 2023
3df2497
feat: update code
cptbtptpbcptdtptp Nov 8, 2023
a84d626
feat: update code
cptbtptpbcptdtptp Nov 8, 2023
3dc863e
feat: add xr
cptbtptpbcptdtptp Nov 13, 2023
6da48da
feat: update code
cptbtptpbcptdtptp Nov 15, 2023
7f338be
feat: update code
cptbtptpbcptdtptp Nov 15, 2023
6d21eeb
feat: update code
cptbtptpbcptdtptp Nov 15, 2023
7f5fdca
feat: update code
cptbtptpbcptdtptp Nov 15, 2023
1fb6280
feat: update code
cptbtptpbcptdtptp Nov 15, 2023
b6b482b
feat: update code
cptbtptpbcptdtptp Nov 15, 2023
5e2b8c7
feat: update code
cptbtptpbcptdtptp Nov 15, 2023
4838a03
feat: update code
cptbtptpbcptdtptp Nov 15, 2023
e18bb6c
feat: update code
cptbtptpbcptdtptp Nov 15, 2023
5b26544
feat: update code
cptbtptpbcptdtptp Nov 17, 2023
e89146c
feat: update code
cptbtptpbcptdtptp Nov 17, 2023
372d429
feat: update code
cptbtptpbcptdtptp Nov 17, 2023
9734f65
feat: update code
cptbtptpbcptdtptp Nov 17, 2023
a58a2ac
feat: update code
cptbtptpbcptdtptp Nov 17, 2023
ba7f1c6
feat: update code
cptbtptpbcptdtptp Nov 17, 2023
fae007c
feat: update code
cptbtptpbcptdtptp Nov 19, 2023
e569f12
feat: update code
cptbtptpbcptdtptp Nov 20, 2023
b7702af
feat: update code
cptbtptpbcptdtptp Nov 20, 2023
7968063
feat: update code
cptbtptpbcptdtptp Nov 20, 2023
6960977
feat: udpate code
cptbtptpbcptdtptp Nov 20, 2023
cb3e0a5
fix: lint error
cptbtptpbcptdtptp Nov 20, 2023
c7e3a50
feat: merge code
cptbtptpbcptdtptp Nov 20, 2023
9b64d07
feat: update code
cptbtptpbcptdtptp Nov 20, 2023
a38647f
feat: update code
cptbtptpbcptdtptp Nov 20, 2023
d717ecb
feat: udpate code
cptbtptpbcptdtptp Nov 21, 2023
a7ca65e
feat: update code
cptbtptpbcptdtptp Nov 21, 2023
aef3f41
feat: update code
cptbtptpbcptdtptp Nov 21, 2023
03d2434
feat: update code
cptbtptpbcptdtptp Nov 21, 2023
f07e0e1
feat: update code
cptbtptpbcptdtptp Nov 21, 2023
2e6adfa
feat: update code
cptbtptpbcptdtptp Nov 21, 2023
d2d6f97
feat: update code
cptbtptpbcptdtptp Nov 21, 2023
e848d43
feat: update code
cptbtptpbcptdtptp Nov 22, 2023
ef2fda0
feat: update code
cptbtptpbcptdtptp Nov 22, 2023
f7f68b9
feat: update code
cptbtptpbcptdtptp Nov 22, 2023
b4c415b
feat: update code
cptbtptpbcptdtptp Nov 23, 2023
686c20d
feat: update code
cptbtptpbcptdtptp Nov 23, 2023
9c4dd8f
feat: update code
cptbtptpbcptdtptp Nov 23, 2023
794e7f7
feat: update code
cptbtptpbcptdtptp Nov 23, 2023
efe2c49
feat: update code
cptbtptpbcptdtptp Nov 23, 2023
c4f48e9
feat: update code
cptbtptpbcptdtptp Nov 27, 2023
4b959a9
feat: udpate code
cptbtptpbcptdtptp Nov 27, 2023
0541e9a
feat: update code
cptbtptpbcptdtptp Nov 28, 2023
40bb35f
refactor: opt code
GuoLei1990 Nov 28, 2023
5695220
refactor: opt code
GuoLei1990 Nov 28, 2023
ea7575e
refactor: fix lint erroe
GuoLei1990 Nov 28, 2023
a31b808
feat: update code
cptbtptpbcptdtptp Nov 29, 2023
bd9abdd
refator: opt code
GuoLei1990 Nov 29, 2023
405e2b4
refactor: opt code
GuoLei1990 Nov 29, 2023
881c68b
feat: update code
cptbtptpbcptdtptp Nov 29, 2023
5bdd322
feat: update code
cptbtptpbcptdtptp Nov 29, 2023
9cddb8c
refactor: opt code
GuoLei1990 Nov 30, 2023
e1be728
feat: update code
cptbtptpbcptdtptp Nov 30, 2023
73cefcb
feat: update code
cptbtptpbcptdtptp Nov 30, 2023
d9c5166
feat: update code
cptbtptpbcptdtptp Nov 30, 2023
4ed26c9
feat: update code
cptbtptpbcptdtptp Nov 30, 2023
fc9314b
feat: update code
cptbtptpbcptdtptp Nov 30, 2023
6c83569
feat: update code
cptbtptpbcptdtptp Nov 30, 2023
4b99533
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
71cdc35
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
7a5ccfe
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
cd8ae8b
feat:update code
cptbtptpbcptdtptp Dec 1, 2023
93d3657
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
0003a9e
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
3b3e177
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
084080c
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
8746ffb
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
8866db1
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
c1bf210
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
fd6b6fd
feat: update code
cptbtptpbcptdtptp Dec 1, 2023
1abaed1
feat: udpate code
cptbtptpbcptdtptp Dec 5, 2023
909b0e1
feat: udpate code
cptbtptpbcptdtptp Dec 5, 2023
f0bb602
feat: update code
cptbtptpbcptdtptp Dec 5, 2023
21636ff
feat: update code
cptbtptpbcptdtptp Dec 5, 2023
965129e
feat: update code
cptbtptpbcptdtptp Dec 5, 2023
83c91ae
feat: update code
cptbtptpbcptdtptp Dec 5, 2023
1273580
feat: update code
cptbtptpbcptdtptp Dec 5, 2023
f528554
feat: update code
cptbtptpbcptdtptp Dec 5, 2023
676e065
feat: update code
cptbtptpbcptdtptp Dec 6, 2023
e73b120
feat: update code
cptbtptpbcptdtptp Dec 6, 2023
fdda7a0
feat: update code
cptbtptpbcptdtptp Dec 6, 2023
c6cf65b
feat: update code
cptbtptpbcptdtptp Dec 6, 2023
2095593
feat: update code
cptbtptpbcptdtptp Dec 6, 2023
e75b4de
feat: update code
cptbtptpbcptdtptp Dec 6, 2023
cc5369e
feat: update code
cptbtptpbcptdtptp Dec 7, 2023
5bdeeb7
feat: update code
cptbtptpbcptdtptp Dec 7, 2023
4ba2be0
feat: update code
cptbtptpbcptdtptp Dec 7, 2023
0bb1e88
feat: update code
cptbtptpbcptdtptp Dec 7, 2023
b0d7dae
feat: update code
cptbtptpbcptdtptp Dec 7, 2023
2deb98b
feat: update code
cptbtptpbcptdtptp Dec 7, 2023
fad5ce7
feat: update code
cptbtptpbcptdtptp Dec 7, 2023
8927c46
feat: update code
cptbtptpbcptdtptp Dec 8, 2023
9497b72
feat: update code
cptbtptpbcptdtptp Dec 8, 2023
4f512b7
feat: update code
cptbtptpbcptdtptp Dec 8, 2023
c59a0be
feat: update code
cptbtptpbcptdtptp Dec 8, 2023
8e9ccad
feat: update code
cptbtptpbcptdtptp Dec 10, 2023
8c80986
feat: update code
cptbtptpbcptdtptp Dec 10, 2023
b5d0cd7
feat: udpate code
cptbtptpbcptdtptp Dec 10, 2023
f87173b
feat: update code
cptbtptpbcptdtptp Dec 11, 2023
92663ea
feat: update code
cptbtptpbcptdtptp Dec 11, 2023
be96545
feat: update code
cptbtptpbcptdtptp Dec 11, 2023
be1a300
feat: update code
cptbtptpbcptdtptp Dec 11, 2023
81d5d9f
feat: update code
cptbtptpbcptdtptp Dec 11, 2023
c30afce
feat: update code
cptbtptpbcptdtptp Dec 11, 2023
73a72cb
feat: update code
cptbtptpbcptdtptp Dec 11, 2023
50aa239
feat: update code
cptbtptpbcptdtptp Dec 11, 2023
030f26d
feat: update code
cptbtptpbcptdtptp Dec 11, 2023
4bd44de
feat: update code
cptbtptpbcptdtptp Dec 11, 2023
15f9604
feat: udpate code
cptbtptpbcptdtptp Dec 11, 2023
1256689
feat: update code
cptbtptpbcptdtptp Dec 12, 2023
dfbedda
feat: update code
cptbtptpbcptdtptp Dec 12, 2023
ce7606f
feat: update code
cptbtptpbcptdtptp Dec 12, 2023
f5c4237
feat: update code
cptbtptpbcptdtptp Dec 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-swc3": "^0.10.1",
"ts-node": "^10",
"typescript": "^5.1.6"
"typescript": "^5.1.6",
"@types/webxr": "latest"
},
"husky": {
"hooks": {
Expand Down
9 changes: 8 additions & 1 deletion packages/core/src/Camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ShaderTagKey } from "./shader/ShaderTagKey";
import { ShaderDataGroup } from "./shader/enums/ShaderDataGroup";
import { RenderTarget } from "./texture/RenderTarget";
import { TextureCubeFace } from "./texture/enums/TextureCubeFace";
import { CameraType } from "./enums/CameraType";

class MathTemp {
static tempVec4 = new Vector4();
Expand Down Expand Up @@ -62,6 +63,8 @@ export class Camera extends Component {
*/
depthTextureMode: DepthTextureMode = DepthTextureMode.None;

/** @internal */
_cameraType: CameraType = CameraType.Normal;
/** @internal */
_globalShaderMacro: ShaderMacroCollection = new ShaderMacroCollection();
/** @internal */
Expand Down Expand Up @@ -524,7 +527,11 @@ export class Camera extends Component {
mipLevel = 0;
Logger.error("mipLevel only take effect in WebGL2.0");
}
this._renderPipeline.render(context, cubeFace, mipLevel);
let clearMask: CameraClearFlags;
if (this._cameraType !== CameraType.Normal) {
clearMask = this.engine.xrManager._getCameraClearFlagsMask(this._cameraType);
}
this._renderPipeline.render(context, cubeFace, mipLevel, clearMask);
this._engine._renderCount++;
}

Expand Down
29 changes: 24 additions & 5 deletions packages/core/src/Engine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IPhysics, IPhysicsManager, IShaderLab } from "@galacean/engine-design";
import { IHardwareRenderer, IPhysics, IPhysicsManager, IShaderLab, IXRDevice } from "@galacean/engine-design";
import { Color } from "@galacean/engine-math/src/Color";
import { SpriteMaskInteraction } from "./2d";
import { Font } from "./2d/text/Font";
Expand Down Expand Up @@ -26,7 +26,6 @@ import { Material } from "./material/Material";
import { ParticleBufferUtils } from "./particle/ParticleBufferUtils";
import { PhysicsScene } from "./physics/PhysicsScene";
import { ColliderShape } from "./physics/shape/ColliderShape";
import { IHardwareRenderer } from "./renderingHardwareInterface";
import { CompareFunction } from "./shader";
import { Shader } from "./shader/Shader";
import { ShaderMacro } from "./shader/ShaderMacro";
Expand All @@ -41,6 +40,7 @@ import { CullMode } from "./shader/enums/CullMode";
import { RenderQueueType } from "./shader/enums/RenderQueueType";
import { RenderState } from "./shader/state/RenderState";
import { Texture2D, Texture2DArray, TextureCube, TextureCubeFace, TextureFormat } from "./texture";
import { XRManager } from "./xr/XRManager";

ShaderPool.init();

Expand All @@ -57,6 +57,8 @@ export class Engine extends EventDispatcher {

/** Input manager of Engine. */
readonly inputManager: InputManager;
/** XR manager of Engine. */
readonly xrManager: XRManager;

/** @internal */
_particleBufferUtils: ParticleBufferUtils;
Expand Down Expand Up @@ -143,7 +145,8 @@ export class Engine extends EventDispatcher {

private _animate = () => {
if (this._vSyncCount) {
this._requestId = requestAnimationFrame(this._animate);
const raf = this.xrManager?._getRequestAnimationFrame() || requestAnimationFrame;
this._requestId = raf(this._animate);
if (this._vSyncCounter++ % this._vSyncCount === 0) {
this.update();
this._vSyncCounter = 1;
Expand Down Expand Up @@ -255,6 +258,12 @@ export class Engine extends EventDispatcher {

this.inputManager = new InputManager(this);

const { xrDevice } = configuration;
if (xrDevice) {
this.xrManager = new XRManager();
this.xrManager._initialize(this, xrDevice);
}

this._initMagentaTextures(hardwareRenderer);

if (!hardwareRenderer.canIUse(GLCapabilityType.depthTexture)) {
Expand Down Expand Up @@ -297,7 +306,8 @@ export class Engine extends EventDispatcher {
*/
pause(): void {
this._isPaused = true;
cancelAnimationFrame(this._requestId);
const caf = this.xrManager?._getCancelAnimationFrame() || cancelAnimationFrame;
caf(this._requestId);
clearTimeout(this._timeoutId);
}

Expand All @@ -308,7 +318,12 @@ export class Engine extends EventDispatcher {
if (!this._isPaused) return;
this._isPaused = false;
this.time._reset();
this._requestId = requestAnimationFrame(this._animate);
if (this._vSyncCount) {
const raf = this.xrManager?._getRequestAnimationFrame() || requestAnimationFrame;
this._requestId = raf(this._animate);
} else {
this._timeoutId = window.setTimeout(this._animate, this._targetFrameInterval);
}
}

/**
Expand All @@ -327,6 +342,7 @@ export class Engine extends EventDispatcher {
this._spriteMaskRenderDataPool.resetPool();
this._textRenderDataPool.resetPool();

this.xrManager?._update();
const { inputManager, _physicsInitialized: physicsInitialized } = this;
inputManager._update();

Expand Down Expand Up @@ -430,6 +446,7 @@ export class Engine extends EventDispatcher {
this._fontMap = null;

this.inputManager._destroy();
this.xrManager?._destroy();
this.dispatch("shutdown", this);

// Cancel animation
Expand Down Expand Up @@ -729,6 +746,8 @@ export class Engine extends EventDispatcher {
export interface EngineConfiguration {
/** Physics. */
physics?: IPhysics;
/** XR Device. */
xrDevice?: IXRDevice;
/** Color space. */
colorSpace?: ColorSpace;
/** Shader lab */
Expand Down
12 changes: 7 additions & 5 deletions packages/core/src/RenderPipeline/BasicRenderPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ export class BasicRenderPipeline {
* @param context - Render context
* @param cubeFace - Render surface of cube texture
* @param mipLevel - Set mip level the data want to write
* @param ignoreClear - Ignore clear flag
*/
render(context: RenderContext, cubeFace?: TextureCubeFace, mipLevel?: number) {
render(context: RenderContext, cubeFace?: TextureCubeFace, mipLevel?: number, ignoreClear?: CameraClearFlags) {
const camera = this._camera;
const scene = camera.scene;
const cullingResults = this._cullingResults;
Expand Down Expand Up @@ -163,7 +164,7 @@ export class BasicRenderPipeline {
}

for (let i = 0, len = this._renderPassArr 10000 ay.length; i < len; i++) {
this._drawRenderPass(context, this._renderPassArray[i], camera, cubeFace, mipLevel);
this._drawRenderPass(context, this._renderPassArray[i], camera, cubeFace, mipLevel, ignoreClear);
}
}

Expand All @@ -172,7 +173,8 @@ export class BasicRenderPipeline {
pass: RenderPass,
camera: Camera,
cubeFace?: TextureCubeFace,
mipLevel?: number
mipLevel?: number,
ignoreClear?: CameraClearFlags
) {
const cullingResults = this._cullingResults;
const { opaqueQueue, alphaTestQueue, transparentQueue } = cullingResults;
Expand All @@ -185,7 +187,7 @@ export class BasicRenderPipeline {
const renderTarget = camera.renderTarget || pass.renderTarget;
rhi.activeRenderTarget(renderTarget, camera.viewport, mipLevel);
renderTarget?._setRenderTargetInfo(cubeFace, mipLevel);
const clearFlags = pass.clearFlags ?? camera.clearFlags;
const clearFlags = (pass.clearFlags ?? camera.clearFlags) & ~(ignoreClear ?? CameraClearFlags.None);
const color = pass.clearColor ?? background.solidColor;
if (clearFlags !== CameraClearFlags.None) {
rhi.clearRenderTarget(camera.engine, clearFlags, color);
Expand All @@ -196,7 +198,7 @@ export class BasicRenderPipeline {
} else {
opaqueQueue.render(camera, pass.mask, PipelineStage.Forward);
alphaTestQueue.render(camera, pass.mask, PipelineStage.Forward);
if (camera.clearFlags & CameraClearFlags.Color) {
if (clearFlags & CameraClearFlags.Color) {
if (background.mode === BackgroundMode.Sky) {
background.sky._render(context);
} else if (background.mode === BackgroundMode.Texture && background.texture) {
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/enums/CameraType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @internal
*/
export enum CameraType {
Normal = 0x0,
XRCenterCamera = 0x1,
XRLeftCamera = 0x2,
XRRightCamera = 0x4
}
2 changes: 2 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ export { BackgroundMode } from "./enums/BackgroundMode";
export { DepthTextureMode } from "./enums/DepthTextureMode";
export { FogMode } from "./enums/FogMode";
export { CameraClearFlags } from "./enums/CameraClearFlags";
export { CameraType } from "./enums/CameraType";
export { ColorSpace } from "./enums/ColorSpace";
export { BackgroundTextureFillMode } from "./enums/BackgroundTextureFillMode";
export { XRManager } from "./xr/XRManager";
export * from "./input/index";
export * from "./lighting/index";
export * from "./shadow/index";
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/renderingHardwareInterface/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export type { IHardwareRenderer } from "./IHardwareRenderer";
export type { IPlatformBuffer } from "./IPlatformBuffer";
export type { IPlatformRenderTarget } from "./IPlatformRenderTarget";
export type { IPlatformTexture } from "./IPlatformTexture";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shader/ShaderProgram.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { IHardwareRenderer } from "@galacean/engine-design";
import { Vector2, Vector3, Vector4 } from "@galacean/engine-math";
import { Logger } from "../base/Logger";
import { Camera } from "../Camera";
import { Engine } from "../Engine";
import { Material } from "../material/Material";
import { Renderer } from "../Renderer";
import { IHardwareRenderer } from "../renderingHardwareInterface/IHardwareRenderer";
import { Scene } from "../Scene";
import { Texture } from "../texture";
import { ShaderDataGroup } from "./enums/ShaderDataGroup";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shader/ShaderUniform.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IHardwareRenderer } from "@galacean/engine-design";
import { Color, Matrix, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
import { Engine } from "../Engine";
import { ColorSpace } from "../enums/ColorSpace";
import { IHardwareRenderer } from "../renderingHardwareInterface/IHardwareRenderer";
import { Texture } from "../texture/Texture";
import { ShaderPropertyValueType } from "./ShaderData";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shader/state/BlendState.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IHardwareRenderer } from "@galacean/engine-design";
import { Color } from "@galacean/engine-math";
import { GLCapabilityType } from "../../base/Constant";
import { deepClone } from "../../clone/CloneManager";
import { IHardwareRenderer } from "../../renderingHardwareInterface/IHardwareRenderer";
import { ShaderData } from "../ShaderData";
import { ShaderProperty } from "../ShaderProperty";
import { BlendFactor } from "../enums/BlendFactor";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shader/state/DepthState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IHardwareRenderer } from "../../renderingHardwareInterface/IHardwareRenderer";
import { IHardwareRenderer } from "@galacean/engine-design";
import { ShaderData } from "../ShaderData";
import { ShaderProperty } from "../ShaderProperty";
import { CompareFunction } from "../enums/CompareFunction";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shader/state/RasterState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IHardwareRenderer } from "../../renderingHardwareInterface/IHardwareRenderer";
import { IHardwareRenderer } from "@galacean/engine-design";
import { ShaderData } from "../ShaderData";
import { ShaderProperty } from "../ShaderProperty";
import { CullMode } from "../enums/CullMode";
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shader/state/StencilState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IHardwareRenderer } from "../../renderingHardwareInterface/IHardwareRenderer";
import { IHardwareRenderer } from "@galacean/engine-design";
import { ShaderData } from "../ShaderData";
import { ShaderProperty } from "../ShaderProperty";
import { CompareFunction } from "../enums/CompareFunction";
Expand Down
< 17AE div id="diff-46d92a4780c1a5d58e633c07be5c6b386a0b4c34b63184a019518502fe3cf95b" data-details-container-group="file" class="file js-file js-details-container js-targetable-element show-inline-notes Details Details--on open " data-file-type=".ts" data-file-deleted="false" data-tagsearch-path="packages/core/src/xr/XRManager.ts" data-targets="diff-file-filter.diffEntries" >
44 changes: 44 additions & 0 deletions packages/core/src/xr/XRManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { IXRDevice } from "@galacean/engine-design";
import { Engine } from "../Engine";
import { CameraClearFlags } from "../enums/CameraClearFlags";
import { CameraType } from "../enums/CameraType";

/**
* XRManager located in the main package, its implementation logic is XRManagerExtended in the sub-package engine-xr.
*/
export class XRManager {
/**
* @internal
*/
_initialize(engine: Engine, xrDevice: IXRDevice): void {}

/**
* @internal
*/
_update(): void {}

/**
* @internal
*/
_destroy(): void {}

/**
* @internal
*/
_getRequestAnimationFrame(): (callback: FrameRequestCallback) => number {
return null;
}

/**
* @internal
*/
_getCancelAnimationFrame(): (id: number) => void {
return null;
}
/**
* @internal
*/
_getCameraClearFlagsMask(type: CameraType): CameraClearFlags {
return CameraClearFlags.None;
}
}
1 change: 1 addition & 0 deletions packages/design/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export type { IClone } from "./IClone";
export * from "./physics/index";
export * from "./renderingHardwareInterface/index";
export * from "./shader-lab/index";
export * from "./xr/index";
1 change: 1 addition & 0 deletions packages/design/src/renderingHardwareInterface/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export type { IHardwareRenderer } from "./IHardwareRenderer";
export type { IPlatformPrimitive } from "./IPlatformPrimitive";
35 changes: 35 additions & 0 deletions packages/design/src/xr/IXRDevice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { IHardwareRenderer } from "../renderingHardwareInterface";
import { IXRSession } from "./IXRSession";
import { IXRPlatformFeature } from "./feature/IXRPlatformFeature";

/**
* The interface of XR device.
*/
export interface IXRDevice {
/**
* Check if the specified session mode is supported.
* @param mode - The mode of the session.
*/
isSupportedSessionMode(mode: number): Promise<void>;

/**
* Check if the specified feature is supported.
* @param mode - The type of the feature.
*/
isSupportedFeature(type: number): boolean;

/**
* Get the platform feature instance of this device
* @param engine - The engine.
* @param type - The type of the feature.
*/
createPlatformFeature(type: number, ...args: any[]): IXRPlatformFeature;

/**
* Request a session.
* @param engine - The engine
* @param mode - The mode of the session
* @param platformFeatures - The requested platform features
*/
requestSession(rhi: IHardwareRenderer, mode: number, platformFeatures: IXRPlatformFeature[]): Promise<IXRSession>;
}
14 changes: 14 additions & 0 deletions packages/design/src/xr/IXRFrame.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { IXRInput } from "./input/IXRInput";

/**
* The base interface of XR frame.
* It can be understood as a snapshot of
* the information of each input in this frame.
*/
export interface IXRFrame {
/**
* Update xr input information.
* @param inputs - xr input
*/
updateInputs(inputs: IXRInput[]): void;
}
17 changes: 17 additions & 0 deletions packages/design/src/xr/IXRInputEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Unified XR input events.
*/
export interface IXRInputEvent {
/** Interaction type. */
targetRayMode: number;
/** Specific interactions. */
type: number;
/** Type of interactive input. */
input: number;
/** Touch id. (Meaningful when and only when targetRayMode is screen) */
id?: number;
/** X coordinate on screen. (Meaningful when and only when targetRayMode is screen) */
x?: number;
/** Y coordinate on screen. (Meaningful when and only when targetRayMode is screen) */
y?: number;
}
Loading
0