Comments (9)
Thanks! I noticed the issue you are experiencing only first time in Safari (not after that), Chrome works fine for me). I think I know what the issue could be, I'll look into it.
from pixi3d.
Thanks for the help, fix is included in release 1.1.2.
from pixi3d.
I can load both of those models you linked to using this code:
let app = new PIXI.Application({
backgroundColor: 0xdddddd, resizeTo: window, antialias: true
})
document.body.appendChild(app.view)
app.loader.add("assets/BarramundiFish.glb")
app.loader.load((_, resources) => {
let model = app.stage.addChild(
PIXI3D.Model.from(resources["assets/BarramundiFish.glb"].gltf))
})
You sure you downloaded those glb files correctly?
from pixi3d.
I am writing down my findings here,
this callback seems to be called multiple times, number of call is equal to number of images.
https://github.com/jnsmalm/pixi3d/blob/develop/src/gltf/gltf-asset.ts#L119
I think this kinda messes up the loader's next() call, https://github.com/jnsmalm/pixi3d/blob/develop/src/loader/gltf-binary-loader.ts#L14
Adding a setTimeout before adding to stage, seems to do the trick, example:
import * as PIXI from 'pixi.js';
import { Model } from 'pixi3d';
const app = new PIXI.Application({
width: 600,
height: 400,
backgroundColor: 0x1099bb,
resolution: window.devicePixelRatio || 1,
sharedTicker: true,
});
document.body.appendChild(app.view);
PIXI.Loader.shared
.add('barramundi-fish', './resources/barramundi-fish.glb')
.load((_, resources) => {
// this fails
// @ts-ignore
app.stage.addChild(Model.from(resources['barramundi-fish'].gltf));
// this works
// setTimeout(() => {
// @ts-ignore
// app.stage.addChild(Model.from(resources['barramundi-fish'].gltf));
// }, 100);
});
from pixi3d.
Which device/os/browser are you using?
from pixi3d.
mac os Catalina / Chrome
from pixi3d.
I created minimal reproducible demo,
https://goldenratio.github.io/pixi3d-poc-72/ (please, open dev console to see the error)
Here is the repo,
https://github.com/goldenratio/pixi3d-poc-72
from pixi3d.
I have updated the develop branch with an update, it would be huge help if you would like to test the following (because I can't really reproduce it)
- Clone the repo
git clone https://github.com/jnsmalm/pixi3d.git
npm install
- Update the contents of the file /serve/src/index.js with the code below (pretty much a copy of your code)
npm run serve
- Hopefully it will work now!
/serve/src/index.js
const app = new PIXI.Application({
width: 600,
height: 400,
backgroundColor: 0x1099bb,
resolution: window.devicePixelRatio || 1,
sharedTicker: true,
});
document.body.appendChild(app.view);
PIXI.Loader.shared.add('barramundi-fish', './resources/barramundi-fish.glb').load((_, resources) => {
// this should work now
app.stage.addChild(PIXI3D.Model.from(resources['barramundi-fish'].gltf));
// this works also
// setTimeout(() => {
// app.stage.addChild(PIXI3D.Model.from(resources['barramundi-fish'].gltf));
// }, 100);
});
from pixi3d.
fix seems to work. Thanks!
from pixi3d.
Related Issues (20)
- Sprite3D zIndex is not applied to internal ProjectionSprite zIndex HOT 3
- Error: Extension class must have an extension object HOT 4
- vec3/planes changes errors HOT 2
- Unlit mesh color is brighter than it should be HOT 9
- iOS 16.4 rendering issue HOT 3
- Compile errors when using @pixi/math-extras HOT 3
- 3d Model and ImageBasedLighting visibility issue HOT 5
- Render shadow on "invisible" plane. HOT 5
- Can't load GLTF with shape-keys animations HOT 6
- Textures smaller than 200x200 pixels do not render with Sprite3D HOT 15
- Memory not cleared when destroying models HOT 38
- Not an issue, just greetings! HOT 1
- Boilerplate from create-pixi3d-app fails with PixiJs 7.2.4 HOT 2
- render point clouds HOT 13
- Possible to trim CompositeSprite to make it only fit the rendered object? HOT 14
- Is there a use case for pixi v7? The following code will not work properly in v7 HOT 1
- Support of LODs and map level geometry culling HOT 2
- Crashes with "Unrecognized source type to auto-detect resource" when imported in NodeJS HOT 6
- Crashes with "Could not find dependency: '@pixi/<it varies>' relative to '/node_modules/pixi3d/dist/cjs/pixi5/pixi3d.js" HOT 4
- Support for PixiJS 8 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pixi3d.