forked from Orillusion/orillusion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [0.8.2](Orillusion/orillusion@v0.8.1...v0.8.2) (2024-07-21) ### Bug Fixes * **doc:** fix TextureCube order ([Orillusion#388](Orillusion#388)) ([Orillusion#421](Orillusion#421)) ([7e4e15d](Orillusion@7e4e15d)) * **MeshRenderer:** replace geometry error ([Orillusion#415](Orillusion#415)) ([c79e287](Orillusion@c79e287)) * **PCF:** PCF shadow error ([Orillusion#371](Orillusion#371)) ([c47257c](Orillusion@c47257c)) * **pick:** fix undefined values ([Orillusion#416](Orillusion#416)) ([5548467](Orillusion@5548467)) * **pick:** fix gui pick events ([Orillusion#422](Orillusion#422)) ([367f469](Orillusion@367f469)) * **pick:** fix right click ([Orillusion#418](Orillusion#418)) ([b248c45](Orillusion@b248c45)) ### BREAKING CHANGES * **PointerEvent3D:** simplified `event.data` with `{worldPos, screenUv, meshID, worldNormal}`
- Loading branch information
Showing
25 changed files
with
255 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule public
updated
24 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { BoxGeometry, Engine3D, GeometryBase, LitMaterial, MeshRenderer, Object3D, Object3DUtil, Scene3D, SphereGeometry, TorusGeometry, Vector3 } from "@orillusion/core"; | ||
import { createExampleScene, createSceneParam } from "@samples/utils/ExampleScene"; | ||
import { GUIHelp } from "@orillusion/debug/GUIHelp"; | ||
|
||
// An sample to replace geometry of meshRenderer | ||
class Sample_ReplaceGeometry { | ||
scene: Scene3D; | ||
geometries: GeometryBase[]; | ||
renderer: MeshRenderer; | ||
index = 0; | ||
async run() { | ||
let param = createSceneParam(); | ||
param.light.intensity = 1; | ||
param.camera.distance = 40; | ||
await Engine3D.init(); | ||
let exampleScene = createExampleScene(param); | ||
|
||
Engine3D.setting.shadow.shadowBound = 100; | ||
Engine3D.setting.shadow.shadowSize = 2048; | ||
Engine3D.setting.shadow.shadowBias = 0.04; | ||
|
||
this.scene = exampleScene.scene; | ||
|
||
Engine3D.startRenderView(exampleScene.view); | ||
|
||
|
||
GUIHelp.init(); | ||
this.initGeometries(); | ||
|
||
let duck = await (await Engine3D.res.loadGltf('PBR/Duck/Duck.gltf')) as Object3D; | ||
let duckGeometry = duck.getComponents(MeshRenderer)[0].geometry; | ||
this.geometries.push(duckGeometry); | ||
|
||
this.initRenderer(); | ||
let scale = new Vector3(1, 1, 1); | ||
GUIHelp.add(this, 'index', 0, 4, 1).onChange((value) => { | ||
this.renderer.geometry = this.geometries[value]; | ||
if (value == this.geometries.length - 1) { | ||
scale.set(0.03, 0.03, 0.03); | ||
} else { | ||
scale.set(1, 1, 1); | ||
} | ||
this.renderer.object3D.localScale = scale; | ||
}) | ||
|
||
GUIHelp.open(); | ||
this.initFloor(); | ||
} | ||
|
||
initFloor() { | ||
let floorHeight = 20; | ||
let floor = Object3DUtil.GetSingleCube(1000, floorHeight, 1000, 0.5, 0.5, 0.5); | ||
floor.y = -floorHeight; | ||
this.scene.addChild(floor); | ||
} | ||
|
||
initGeometries() { | ||
this.geometries = []; | ||
this.geometries.push(new SphereGeometry(2, 20, 20)); | ||
this.geometries.push(new BoxGeometry(2, 8, 4)); | ||
this.geometries.push(new TorusGeometry(2, 0.4)); | ||
} | ||
|
||
initRenderer() { | ||
let obj = new Object3D(); | ||
this.renderer = obj.addComponent(MeshRenderer); | ||
this.renderer.material = new LitMaterial(); | ||
this.renderer.geometry = this.geometries[0]; | ||
this.scene.addChild(obj); | ||
} | ||
} | ||
|
||
new Sample_ReplaceGeometry().run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.