Skip to content

Commit

Permalink
fix(sample): remove errors (#110)
Browse files Browse the repository at this point in the history
remove errors
  • Loading branch information
lslzl3000 committed May 7, 2023
1 parent 34ba5d9 commit e47e027
Show file tree
Hide file tree
Showing 27 changed files with 90 additions and 343 deletions.
4 changes: 2 additions & 2 deletions samples/base/Sample_InitEngine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Engine3D, Scene3D, CameraUtil, webGPUContext, View3D, AtmosphericComponent } from "@orillusion/core";
import { Engine3D, Scene3D, CameraUtil, View3D, AtmosphericComponent } from "@orillusion/core";

// init engine
class Sample_InitEngine {
Expand All @@ -12,7 +12,7 @@ class Sample_InitEngine {

// init camera3D
let mainCamera = CameraUtil.createCamera3D(null, scene);
mainCamera.perspective(60, webGPUContext.aspect, 1, 2000.0);
mainCamera.perspective(60, Engine3D.aspect, 1, 2000.0);

// create a view with target scene and camera
let view = new View3D();
Expand Down
6 changes: 3 additions & 3 deletions samples/base/Sample_Transform.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GUIHelp } from '@orillusion/debug/GUIHelp';
import { Stats } from '@orillusion/stats'
import { Engine3D, Scene3D, AtmosphericComponent, CameraUtil, webGPUContext, HoverCameraController, Object3D, MeshRenderer, BoxGeometry, LitMaterial, DirectLight, KelvinUtil, View3D } from '@orillusion/core';
import { Engine3D, Scene3D, AtmosphericComponent, CameraUtil, HoverCameraController, Object3D, MeshRenderer, BoxGeometry, LitMaterial, DirectLight, KelvinUtil, View3D } from '@orillusion/core';
import { GUIUtil } from '@samples/utils/GUIUtil';

// simple base demo
Expand All @@ -20,11 +20,11 @@ class Sample_Transform {

// init camera3D
let mainCamera = CameraUtil.createCamera3D(null, scene);
mainCamera.perspective(60, webGPUContext.aspect, 1, 2000.0);
mainCamera.perspective(60, Engine3D.aspect, 1, 2000.0);

// add a basic camera controller
let hoverCameraController = mainCamera.object3D.addComponent(HoverCameraController);
hoverCameraController.setCamera(15, -15, 300);
hoverCameraController.setCamera(15, -15, 10);

// create a basic cube
let cubeObj = new Object3D();
Expand Down
4 changes: 2 additions & 2 deletions samples/base/Sample_UseComponent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Engine3D, Scene3D, CameraUtil, webGPUContext, View3D, AtmosphericComponent, ComponentBase, Time, AxisObject, Object3DUtil, KelvinUtil, DirectLight, Object3D, HoverCameraController } from "@orillusion/core";
import { Engine3D, Scene3D, CameraUtil, View3D, AtmosphericComponent, ComponentBase, Time, AxisObject, Object3DUtil, KelvinUtil, DirectLight, Object3D, HoverCameraController } from "@orillusion/core";
import { GUIHelp } from "@orillusion/debug/GUIHelp";

// sample use component
Expand All @@ -13,7 +13,7 @@ class Sample_UseComponent {

// init camera3D
let mainCamera = CameraUtil.createCamera3D(null, scene);
mainCamera.perspective(60, webGPUContext.aspect, 1, 2000.0);
mainCamera.perspective(60, Engine3D.aspect, 1, 2000.0);
let hoverCameraController = mainCamera.object3D.addComponent(HoverCameraController);
hoverCameraController.setCamera(15, -30, 10);

Expand Down
4 changes: 2 additions & 2 deletions samples/lights/Sample_DirectLight.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Scene3D, HoverCameraController, Engine3D, AtmosphericComponent, Object3D, Camera3D, webGPUContext, Vector3, View3D, DirectLight, KelvinUtil, LitMaterial, MeshRenderer, BoxGeometry, CameraUtil } from "@orillusion/core";
import { Scene3D, HoverCameraController, Engine3D, AtmosphericComponent, Object3D, Camera3D, Vector3, View3D, DirectLight, KelvinUtil, LitMaterial, MeshRenderer, BoxGeometry, CameraUtil } from "@orillusion/core";

//sample of direction light
class Sample_DirectLight {
Expand All @@ -16,7 +16,7 @@ class Sample_DirectLight {

// init camera3D
let mainCamera = CameraUtil.createCamera3D(null, this.scene);
mainCamera.perspective(60, webGPUContext.aspect, 1, 2000.0);
mainCamera.perspective(60, Engine3D.aspect, 1, 2000.0);
//set camera data
mainCamera.object3D.addComponent(HoverCameraController).setCamera(0, -25, 1000);

Expand Down
4 changes: 2 additions & 2 deletions samples/lights/Sample_PointLight.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { AtmosphericComponent, BoxGeometry, CameraUtil, Engine3D, HoverCameraController, LitMaterial, MeshRenderer, Object3D, Object3DUtil, PointLight, Scene3D, SphereGeometry, View3D, webGPUContext, } from "@orillusion/core";
import { AtmosphericComponent, BoxGeometry, CameraUtil, Engine3D, HoverCameraController, LitMaterial, MeshRenderer, Object3D, Object3DUtil, PointLight, Scene3D, SphereGeometry, View3D, } from "@orillusion/core";
import { PointLightsScript } from "./PointLightsScript";

class Sample_PointLight {
Expand All @@ -18,7 +18,7 @@ class Sample_PointLight {
this.scene.addComponent(AtmosphericComponent);
// init camera3D
let mainCamera = CameraUtil.createCamera3D(null, this.scene);
mainCamera.perspective(60, webGPUContext.aspect, 1, 2000.0);
mainCamera.perspective(60, Engine3D.aspect, 1, 2000.0);
//set camera data
mainCamera.object3D.addComponent(HoverCameraController).setCamera(0, -25, 500);

Expand Down
4 changes: 2 additions & 2 deletions samples/lights/Sample_PointLightShadow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Scene3D, Engine3D, AtmosphericComponent, CameraUtil, webGPUContext, HoverCameraController, Vector3, View3D, SphereGeometry, Object3D, MeshRenderer, LitMaterial, PointLight, BoxGeometry, Object3DUtil } from "@orillusion/core";
import { Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, Vector3, View3D, SphereGeometry, Object3D, MeshRenderer, LitMaterial, PointLight, BoxGeometry, Object3DUtil } from "@orillusion/core";

// sample of point light shadow
class Sample_PointLightShadow {
Expand All @@ -19,7 +19,7 @@ class Sample_PointLightShadow {

// init camera3D
let mainCamera = CameraUtil.createCamera3D(null, this.scene);
mainCamera.perspective(60, webGPUContext.aspect, 1, 2000.0);
mainCamera.perspective(60, Engine3D.aspect, 1, 2000.0);
//set camera data
mainCamera.object3D.addComponent(HoverCameraController).setCamera(0, -45, 500);

Expand Down
10 changes: 5 additions & 5 deletions samples/lights/Sample_SpotLight.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Scene3D, Engine3D, AtmosphericComponent, CameraUtil, webGPUContext, HoverCameraController, View3D, SphereGeometry, Object3D, MeshRenderer, LitMaterial, SpotLight, BoxGeometry, Vector3 } from "@orillusion/core";
import { Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, SphereGeometry, Object3D, MeshRenderer, LitMaterial, SpotLight, BoxGeometry, Vector3 } from "@orillusion/core";
import { GUIHelp } from "@orillusion/debug/GUIHelp";

// sample of SpotLight
Expand All @@ -8,7 +8,7 @@ class Sample_SpotLight {
async run() {
Engine3D.setting.occlusionQuery.enable = false;
Engine3D.setting.shadow.enable = true;
Engine3D.setting.shadow.pointShadowBias = 0.075;
Engine3D.setting.shadow.pointShadowBias = 0.0001;
await Engine3D.init({});

GUIHelp.init();
Expand All @@ -18,7 +18,7 @@ class Sample_SpotLight {

// init camera3D
let mainCamera = CameraUtil.createCamera3D(null, this.scene);
mainCamera.perspective(60, webGPUContext.aspect, 1, 2000.0);
mainCamera.perspective(60, Engine3D.aspect, 1, 2000.0);
//set camera data
mainCamera.object3D.addComponent(HoverCameraController).setCamera(0, -25, 1000);

Expand Down Expand Up @@ -46,8 +46,8 @@ class Sample_SpotLight {

let spotLight = lightObj3D.addComponent(SpotLight);
lightObj3D.x = -86;
lightObj3D.y = 130;
lightObj3D.z = -395;
lightObj3D.y = 200;
lightObj3D.z = -300;
lightObj3D.transform.rotationX = 342;
lightObj3D.transform.rotationY = 360;
lightObj3D.transform.rotationZ = 199;
Expand Down
13 changes: 4 additions & 9 deletions samples/loader/Sample_FlightHelmet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Object3D, Camera3D, Scene3D, HoverCameraController, Engine3D, CameraUtil, webGPUContext, View3D, SSRPost, HDRBloomPost, AtmosphericComponent, DirectLight, KelvinUtil, Time } from "@orillusion/core";
import { Object3D, Camera3D, Scene3D, HoverCameraController, Engine3D, CameraUtil, View3D, SSRPost, HDRBloomPost, AtmosphericComponent, DirectLight, KelvinUtil, Time } from "@orillusion/core";
import { GUIUtil as GUIUtil } from "@samples/utils/GUIUtil";

class Sample_FlightHelmet {
Expand All @@ -18,16 +18,11 @@ class Sample_FlightHelmet {
renderLoop: () => this.loop(),
});

Engine3D.setting.material.materialChannelDebug = true;
Engine3D.setting.shadow.debug = true;
Engine3D.setting.shadow.autoUpdate = true;
Engine3D.setting.shadow.shadowBound = 10;
Engine3D.setting.shadow.shadowBias = 0.00001;

Engine3D.setting.shadow.shadowBias = 0.0001;
Engine3D.setting.render.postProcessing.ssao.radius = 0.018;
Engine3D.setting.render.postProcessing.ssao.aoPower = 1;
Engine3D.setting.render.postProcessing.gtao.debug = false;

Engine3D.setting.render.postProcessing.bloom = {
enable: true,
blurX: 4,
Expand All @@ -39,9 +34,8 @@ class Sample_FlightHelmet {


this.scene = new Scene3D();
this.scene.hideSky();
let camera = CameraUtil.createCamera3DObject(this.scene);
camera.perspective(60, webGPUContext.aspect, 1, 5000.0);
camera.perspective(60, Engine3D.aspect, 1, 5000.0);

camera.object3D.addComponent(HoverCameraController).setCamera(-45, -30, 15);

Expand All @@ -67,6 +61,7 @@ class Sample_FlightHelmet {
let atmospheric = this.scene.addComponent(AtmosphericComponent);
atmospheric.sunY = 0.73;
atmospheric.sunRadiance = 47;
atmospheric.enable = false
}
/******** light *******/
{
Expand Down
19 changes: 9 additions & 10 deletions samples/loader/Sample_LoadGLTF.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Object3D, Scene3D, Engine3D, CameraUtil, webGPUContext, HoverCameraController, View3D, AtmosphericComponent, DirectLight, KelvinUtil } from "@orillusion/core";
import { Object3D, Scene3D, Engine3D, CameraUtil, HoverCameraController, View3D, AtmosphericComponent, DirectLight, KelvinUtil } from "@orillusion/core";
import { GUIUtil } from "@samples/utils/GUIUtil";

//Samples to show models, they are using PBR material
Expand All @@ -10,14 +10,14 @@ class Sample_LoadGLTF {
//config settings
Engine3D.setting.material.materialChannelDebug = true;
Engine3D.setting.shadow.shadowBound = 5;
Engine3D.setting.shadow.shadowBias = 0.002;
Engine3D.setting.shadow.shadowBias = 0.0001;
Engine3D.setting.render.postProcessing.bloom = {
enable: true,
blurX: 4,
blurY: 4,
intensity: 5,
brightness: 0.86,
debug: true
debug: false
};

//init engine
Expand All @@ -26,7 +26,7 @@ class Sample_LoadGLTF {
this.scene = new Scene3D();

let camera = CameraUtil.createCamera3DObject(this.scene);
camera.perspective(60, webGPUContext.aspect, 0.01, 5000.0);
camera.perspective(60, Engine3D.aspect, 0.01, 5000.0);
camera.object3D.addComponent(HoverCameraController).setCamera(25, -5, 100);

let view = new View3D();
Expand All @@ -44,8 +44,8 @@ class Sample_LoadGLTF {
let atmospheric = this.scene.addComponent(AtmosphericComponent);
atmospheric.sunY = 0.62;
atmospheric.sunRadiance = 47;
this.scene.exposure = 1;
this.scene.roughness = 0.56;
atmospheric.exposure = 1;
atmospheric.roughness = 0.56;
}

/******** light *******/
Expand All @@ -67,34 +67,33 @@ class Sample_LoadGLTF {
/******** player1 *******/
let player1 = (await Engine3D.res.loadGltf('gltfs/anim/Minion_Lane_Super_Dawn/Minion_Lane_Super_Dawn.glb', {})) as Object3D;
player1.transform.x = -10;
player1.transform.y = -10;
player1.transform.z = 20;
player1.transform.scaleX = 10;
player1.transform.scaleY = 10;
player1.transform.scaleZ = 10;
player1.transform.y = 5;
this.scene.addChild(player1);

/******** player2 *******/
let player2 = (await Engine3D.res.loadGltf('gltfs/anim/Minion_Lane_Super_Dawn/Prime_Helix.glb', {})) as Object3D;
player2.transform.x = 10;
player2.transform.y = -10;
player2.transform.scaleX = 10;
player2.transform.scaleY = 10;
player2.transform.scaleZ = 10;
player2.transform.y = 5;
this.scene.addChild(player2);

/******** player3 *******/
let player3 = (await Engine3D.res.loadGltf('gltfs/anim/Minion_Lane_Super_Dawn/Minion_Lane_Ranged_Dusk.glb', {})) as Object3D;
player3.transform.x = 10;
player3.transform.y = -10;
player3.transform.z = 20;
player3.transform.scaleX = 10;
player3.transform.scaleY = 10;
player3.transform.scaleZ = 10;
player3.transform.y = 5;
this.scene.addChild(player3);
}
}

}

new Sample_LoadGLTF().run();
106 changes: 0 additions & 106 deletions samples/material/Sample_CustomMaterial.ts

This file was deleted.

4 changes: 2 additions & 2 deletions samples/material/Sample_PBR.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GUIHelp } from "@orillusion/debug/GUIHelp";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, webGPUContext, HoverCameraController, View3D, DirectLight, KelvinUtil, LitMaterial, MeshRenderer, BoxGeometry, SphereGeometry } from "@orillusion/core";
import { Object3D, Scene3D, Engine3D, AtmosphericComponent, CameraUtil, HoverCameraController, View3D, DirectLight, KelvinUtil, LitMaterial, MeshRenderer, BoxGeometry, SphereGeometry } from "@orillusion/core";
import { GUIUtil } from "@samples/utils/GUIUtil";

class Sample_PBR {
Expand All @@ -19,7 +19,7 @@ class Sample_PBR {
this.scene = new Scene3D();
this.scene.addComponent(AtmosphericComponent);
let camera = CameraUtil.createCamera3DObject(this.scene);
camera.perspective(60, webGPUContext.aspect, 1, 5000.0);
camera.perspective(60, Engine3D.aspect, 1, 5000.0);

camera.object3D.addComponent(HoverCameraController).setCamera(30, 0, 120);

Expand Down
Loading

0 comments on commit e47e027

Please sign in to comment.