kovacsv / Online3DViewer

A solution to visualize and explore 3D models in your browser.
https://3dviewer.net
MIT License
2.57k stars 548 forks source link

e.Clone not a function error #475

Closed mfkeles closed 5 months ago

mfkeles commented 5 months ago

Hi,

I am not super familiar with web development but I am trying to use embedded viewer on just-the-docs themed jekyll website. I keep getting the error e.Clone not a function both when setting the edges or the environment. I am a bit puzzled and can't figure out exactly what I am doing wrong. The most recent build is included in the js/o3dv and as far as I can tell correctly addressed. Here is the website: https://mfkeles.github.io/FlyVISTA/docs/hardware

Here is the code for the viewer

window.addEventListener('load', () => {
    // get the parent element of the viewer
    let parentDiv = document.getElementById('viewer-chamber');

    // initialize the viewer with the parent element and some parameters
    let viewer = new OV.EmbeddedViewer(parentDiv, {
        backgroundColor: new OV.RGBAColor(255, 255, 255, 255),
        defaultColor: new OV.RGBColor(200, 200, 200),
        environmentSettings: {
            environmentMap: [],
            backgroundIsEnvMap: false
        },
        onModelLoaded: () => {
            let model = viewer.GetModel();
            // do something with the model if needed
        }
    });

    // load the STL model
    viewer.LoadModelFromUrlList([
        window.siteBaseurl + "/assets/models/chamber.stl"
    ]);
});
---
layout: default
title: Hardware
nav_order: 3
has_children: true
permalink: docs/hardware
---

## Hardware

FlyVISTA aims to capture micron scale behaviors over many hours in freely behaving flies.

### Behavioral Chambers

<div id="viewer-chamber" style="width: 600px; height: 400px;"></div>

<script src="{{ site.baseurl }}/assets/js/o3dv/o3dv.min.js"></script>
<script>
window.addEventListener('load', () => {
    // get the parent element of the viewer
    let parentDiv = document.getElementById('viewer-chamber');

    // initialize the viewer with the parent element and some parameters
    let viewer = new OV.EmbeddedViewer(parentDiv, {
        backgroundColor: new OV.RGBAColor(255, 255, 255, 255),
        defaultColor: new OV.RGBColor(127, 127, 127),
        edgeSettings: {
            showEdges: true,
            edgeColor: new OV.RGBColor(0, 0, 0),
            edgeThreshold: 0.5
        },
        environmentSettings: {
            environmentMap: [],
            backgroundIsEnvMap: false
        },
        onModelLoaded: () => {
            let model = viewer.GetModel();
            // do something with the model if needed
        }
    });

    // load the STL model
    viewer.LoadModelFromUrlList([
        "{{ site.baseurl }}/assets/models/chamber.stl"
    ]);
});
</script>

here is the error:

o3dv.min.js:3938 Uncaught TypeError: e.Clone is not a function
    at sl.SetEnvironmentMapSettings (o3dv.min.js:3938:124125)
    at new ol (o3dv.min.js:3938:130252)
    at viewer.js:6:18