mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 09:28:11 +00:00
Rotate the preview mesh every frame
This commit is contained in:
1 parent
4f767aed2c
commit
ffa191ba7f
1 file changed
+4
-1
+4
-1
@@ -56,6 +56,8 @@ export const loadPreviewOnCanvas = ({
|
||||
|
||||
scene.add(light);
|
||||
|
||||
let splatMesh: SplatMesh | null = null;
|
||||
|
||||
// load the file into the preview mini-scene depending of the file's type
|
||||
if (file.name.endsWith(".glb")) {
|
||||
glbLoader({ file, scene, camera, renderer, statusCallback });
|
||||
@@ -70,7 +72,7 @@ export const loadPreviewOnCanvas = ({
|
||||
imagePlaneLoader({ file, scene, camera, renderer, statusCallback });
|
||||
} else if (file.name.endsWith(".spz")) {
|
||||
file.arrayBuffer().then((arrayBuffer) => {
|
||||
const splatMesh = new SplatMesh({
|
||||
splatMesh = new SplatMesh({
|
||||
fileBytes: arrayBuffer, fileType: SplatFileType.SPZ,
|
||||
onLoad: () => { scene.add(splatMesh) }
|
||||
});
|
||||
@@ -95,6 +97,7 @@ export const loadPreviewOnCanvas = ({
|
||||
// Render the loaded data
|
||||
const animate = function () {
|
||||
renderer.render(scene, camera);
|
||||
splatMesh?.rotateY(0.01);
|
||||
};
|
||||
renderer.setAnimationLoop(animate);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user