Skip to content
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

ext_meshopt_compression support (?) #205

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added .DS_Store
Binary file not shown.
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,8 @@
"tslib": "^2.3.0",
"typedoc": "^0.22.9",
"typescript": "^4.4.4"
},
"dependencies": {
"meshoptimizer": "^0.20.0"
}
}
73 changes: 40 additions & 33 deletions serve/src/index.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,53 @@
let app = new PIXI.Application({
backgroundColor: 0xdddddd, resizeTo: window, antialias: true
})
document.body.appendChild(app.view)
globalThis.__PIXI_APP__ = app
backgroundColor: 0xdddddd,
resizeTo: window,
antialias: true,
});
document.body.appendChild(app.view);
globalThis.__PIXI_APP__ = app;

let control = new PIXI3D.CameraOrbitControl(app.view)
control.enableDamping = true
let control = new PIXI3D.CameraOrbitControl(app.view);
control.enableDamping = true;

app.loader.add("assets/chromatic/diffuse.cubemap")
app.loader.add("assets/chromatic/specular.cubemap")
app.loader.add("assets/teapot/teapot.gltf")
app.loader.add("assets/chromatic/diffuse.cubemap");
app.loader.add("assets/chromatic/specular.cubemap");
app.loader.add("assets/teapot/teapot.gltf");

app.loader.load((_, resources) => {
PIXI3D.LightingEnvironment.main.imageBasedLighting = new PIXI3D.ImageBasedLighting(
resources["assets/chromatic/diffuse.cubemap"].cubemap,
resources["assets/chromatic/specular.cubemap"].cubemap
)
PIXI3D.LightingEnvironment.main.imageBasedLighting =
new PIXI3D.ImageBasedLighting(
resources["assets/chromatic/diffuse.cubemap"].cubemap,
resources["assets/chromatic/specular.cubemap"].cubemap
);

let model = app.stage.addChild(
PIXI3D.Model.from(resources["assets/teapot/teapot.gltf"].gltf))
model.y = -0.8
model.meshes.forEach(mesh => {
mesh.material.exposure = 1.3
})
PIXI3D.Model.from(resources["assets/teapot/teapot.gltf"].gltf)
);
model.y = -0.8;
model.meshes.forEach((mesh) => {
mesh.material.exposure = 1.3;
});

let ground = app.stage.addChild(PIXI3D.Mesh3D.createPlane())
ground.y = -0.8
ground.scale.set(10, 1, 10)
let ground = app.stage.addChild(PIXI3D.Mesh3D.createPlane());
ground.y = -0.8;
ground.scale.set(10, 1, 10);

let directionalLight = Object.assign(new PIXI3D.Light(), {
intensity: 1,
type: "directional"
})
directionalLight.rotationQuaternion.setEulerAngles(25, 120, 0)
PIXI3D.LightingEnvironment.main.lights.push(directionalLight)
type: "directional",
});
directionalLight.rotationQuaternion.setEulerAngles(25, 120, 0);
PIXI3D.LightingEnvironment.main.lights.push(directionalLight);

let shadowCastingLight = new PIXI3D.ShadowCastingLight(
app.renderer, directionalLight, { shadowTextureSize: 1024, quality: PIXI3D.ShadowQuality.medium })
shadowCastingLight.softness = 1
shadowCastingLight.shadowArea = 15

let pipeline = app.renderer.plugins.pipeline
pipeline.enableShadows(ground, shadowCastingLight)
pipeline.enableShadows(model, shadowCastingLight)
})
app.renderer,
directionalLight,
{ shadowTextureSize: 1024, quality: PIXI3D.ShadowQuality.medium }
);
shadowCastingLight.softness = 1;
shadowCastingLight.shadowArea = 15;

let pipeline = app.renderer.plugins.pipeline;
pipeline.enableShadows(ground, shadowCastingLight);
pipeline.enableShadows(model, shadowCastingLight);
});
Loading
Loading