Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 590b213
Author: ShuangLiu <liu.shuang@huasheng.io>
Date:   Wed May 22 20:47:28 2024 +0800

    feat(buffer): return promise result

commit 4e05c04
Author: ShuangLiu <liu.shuang@huasheng.io>
Date:   Wed May 1 03:04:32 2024 +0800

    fix(picker): missing normal in pickFire

commit 1ab8718
Author: hellmor <dymmky@126.com>
Date:   Thu Mar 21 20:36:23 2024 +0800

    fix: Error when lineJoin is set to round (Orillusion#366)

    * fix: Error when lineJoin is set to round

    Fix error when lineJoin is set to round.

    * fix: Remove eventListener.

    Remove the eventListener when transform is disposed.

commit 7ab2f48
Author: hellmor <dymmky@126.com>
Date:   Thu Mar 21 20:35:36 2024 +0800

    fix: Solve the issues mentioned in Issue367 (Orillusion#368)

    Solve the issues mentioned in Issue367.

commit 51ff3ee
Author: Codeboy <zhangcanbo@outlook.com>
Date:   Thu Mar 21 20:35:09 2024 +0800

    fix: object is disabled after removeChild  (Orillusion#381)

    * chore: remove sample_candleflame maskMap

    * fix: addChild and removeChild related

    * chore: remove log

commit 65bda50
Author: ShuangLiu <liu.shuang@huasheng.io>
Date:   Wed Mar 13 03:59:02 2024 +0800

    fix(loaderFunctions): onUrl on loadGltf
  • Loading branch information
hellmor committed May 22, 2024
1 parent 40da2f1 commit 7c3d6e0
Show file tree
Hide file tree
Showing 13 changed files with 1,744 additions and 1,637 deletions.
4 changes: 2 additions & 2 deletions packages/graphic/compute/shape3d/Path2DShape3DCode_cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,10 @@ fn drawPath2DCorner(shapeData:Path2DShape3D, currentPoint:Path3DKeyPoint){
var rotateFrom:vec3<f32>;
if(isPositive){
rotateFrom = -prevPoint.right;
rotateMat = buildRotateZ(-cornerAngle * 2.0 / f32(cornerPointExt));
rotateMat = buildRotateYMat3(-cornerAngle * 2.0 / f32(cornerPointExt));
}else{
rotateFrom = prevPoint.right;
rotateMat = buildRotateZ(cornerAngle * 2.0 / f32(cornerPointExt));
rotateMat = buildRotateYMat3(cornerAngle * 2.0 / f32(cornerPointExt));
}
tempV = currentPoint.overallLength - cornerUVLength * lastLengthUVRatio;
Expand Down
22 changes: 15 additions & 7 deletions samples/base/Sample_AddRemove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,20 @@ class Sample_AddRemove {
}

private async test() {
let list: Object3D[] = [];
let visibleList: Object3D[] = [];
let invisibleList: Object3D[] = [];
let player = await Engine3D.res.loadGltf('gltfs/anim/Minion_Lane_Super_Dawn/Minion_Lane_Super_Dawn.glb');
// gui
GUIHelp.init();
GUIHelp.addButton("add", async () => {
/******** player1 *******/
let clone = player.clone()
let clone: Object3D
if (invisibleList.length > 0) {
clone = invisibleList[invisibleList.length-1];
invisibleList.splice(invisibleList.length-1, 1);
} else {
clone = player.clone();
}
clone.transform.x = Math.random() * 100 - 50;
clone.transform.y = Math.random() * 100 - 50;
clone.transform.z = Math.random() * 100 - 50;
Expand All @@ -56,16 +63,17 @@ class Sample_AddRemove {
clone.transform.scaleZ = 20;

this.view.scene.addChild(clone);
list.push(clone);
visibleList.push(clone);
});

GUIHelp.addButton("remove", () => {
let index = Math.floor(list.length * Math.random());
let obj = list[index];
let index = Math.floor(visibleList.length * Math.random());
let obj = visibleList[index];
if (obj) {
list.splice(index, 1)
visibleList.splice(index, 1)
this.view.scene.removeChild(obj)
obj.destroy(true);
// obj.destroy(true);
invisibleList.push(obj)
}
});

Expand Down
32 changes: 30 additions & 2 deletions src/assets/Res.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ export class Res {
if (this._prefabPool.has(url)) {
return this._prefabPool.get(url) as Object3D;
}
if (loaderFunctions?.onUrl) {
url = await loaderFunctions.onUrl(url);
}

let parser;
let ext = url.substring(url.lastIndexOf('.')).toLowerCase();
let loader = new FileLoader();
if (ext == '.gltf') {
parser = await loader.load(url, GLTFParser, loaderFunctions);

} else {
parser = await loader.load(url, GLBParser, loaderFunctions);
}
Expand All @@ -206,6 +208,9 @@ export class Res {
if (this._prefabPool.has(url)) {
return this._prefabPool.get(url) as Object3D;
}
if (loaderFunctions?.onUrl) {
url = await loaderFunctions.onUrl(url);
}

let parser;
let ext = url.substring(url.lastIndexOf('.')).toLowerCase();
Expand All @@ -229,6 +234,9 @@ export class Res {
if (this._prefabPool.has(url)) {
return this._prefabPool.get(url) as Object3D;
}
if (loaderFunctions?.onUrl) {
url = await loaderFunctions.onUrl(url);
}
let loader = new FileLoader();
let parser = await loader.load(url, B3DMParser, loaderFunctions, userData);
let obj = parser.data;
Expand All @@ -246,6 +254,9 @@ export class Res {
if (this._prefabPool.has(url)) {
return this._prefabPool.get(url) as Object3D;
}
if (loaderFunctions?.onUrl) {
url = await loaderFunctions.onUrl(url);
}
let loader = new FileLoader();
let parser = await loader.load(url, I3DMParser, loaderFunctions, userData);
let obj = parser.data;
Expand All @@ -264,6 +275,9 @@ export class Res {
if (this._texturePool.has(url)) {
return this._texturePool.get(url);
}
if (loaderFunctions?.onUrl) {
url = await loaderFunctions.onUrl(url);
}
let texture = new BitmapTexture2D();
texture.flipY = flipY;
await texture.load(url, loaderFunctions);
Expand Down Expand Up @@ -314,7 +328,9 @@ export class Res {
if (this._texturePool.has(url)) {
return this._texturePool.get(url);
}

if (loaderFunctions?.onUrl) {
url = await loaderFunctions.onUrl(url);
}
let hdrTexture = new HDRTexture();
hdrTexture = await hdrTexture.load(url, loaderFunctions);
this._texturePool.set(url, hdrTexture);
Expand All @@ -332,6 +348,9 @@ export class Res {
if (this._texturePool.has(url)) {
return this._texturePool.get(url);
}
if (loaderFunctions?.onUrl) {
url = await loaderFunctions.onUrl(url);
}
let hdrTexture = new HDRTextureCube();
hdrTexture = await hdrTexture.load(url, loaderFunctions);
this._texturePool.set(url, hdrTexture);
Expand All @@ -348,6 +367,9 @@ export class Res {
if (this._texturePool.has(url)) {
return this._texturePool.get(url);
}
if (loaderFunctions?.onUrl) {
url = await loaderFunctions.onUrl(url);
}
let ldrTextureCube = new LDRTextureCube();
ldrTextureCube = await ldrTextureCube.load(url, loaderFunctions);
this._texturePool.set(url, ldrTextureCube);
Expand Down Expand Up @@ -381,6 +403,9 @@ export class Res {
if (this._texturePool.has(url)) {
return this._texturePool.get(url);
}
if (loaderFunctions?.onUrl) {
url = await loaderFunctions.onUrl(url);
}

let cubeMap = new BitmapTextureCube();
await cubeMap.loadStd(url);
Expand All @@ -392,6 +417,9 @@ export class Res {
* @param url the path of image
*/
public async loadJSON(url: string, loaderFunctions?: LoaderFunctions) {
if (loaderFunctions?.onUrl) {
url = await loaderFunctions.onUrl(url);
}
return await new FileLoader()
.loadJson(url, loaderFunctions)
.then(async (ret) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/core/GUICanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class GUICanvas extends ComponentBase {
}

public copyComponent(from: this): this {
from.index = from.index;
this.index = from.index;
return this;
}
}
2 changes: 1 addition & 1 deletion src/components/gui/uiComponents/UITransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class UITransform extends ComponentBase {
}

public beforeDestroy(force?: boolean): void {
this.transform.eventDispatcher.addEventListener(this.transform.eventLocalChange.type, this.onTransformChange, this);
this.transform.eventDispatcher.removeEventListener(this.transform.eventLocalChange.type, this.onTransformChange, this);
super.beforeDestroy?.(force);
}
}
1 change: 0 additions & 1 deletion src/components/renderer/RenderNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ export class RenderNode extends ComponentBase {
}

public onDisable(): void {
this._enable = false;
EntityCollect.instance.removeRenderNode(this.transform.scene3D, this);
super.onDisable?.();
}
Expand Down
5 changes: 5 additions & 0 deletions src/event/CEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export class CEvent {
*/
public ctrlKey: boolean;

/**
* Is Meta key pressed when the event occurs
*/
public metaKey: boolean;

/**
* Is Alt key pressed when the event occurs
*/
Expand Down
Loading

0 comments on commit 7c3d6e0

Please sign in to comment.