0👍
It has been resolved.
It is basically VUE3 issue. You can fix it by few steps.
import { getCurrentInstance } from 'vue'
then inside you class:
this.instance = getCurrentInstance();
const { proxy } = this.instance;
proxy.$scene = new THREE.Scene();
then in snapShot
you can do it like
snapShot() {
const camera = this.camera;
if(!camera) return;
const scene = this.instance.proxy.$scene;
const strMime = "image/png"; // "image/png" "image/jpeg"
const renderer = this.renderer;
renderer.render(scene, camera);
const canvas = this.renderer.domElement;
return canvas.toDataURL(strMime);
}
- [Vuejs]-How to access vue store from a component when using with router
- [Vuejs]-How can I add type hints for my custom global Vue directives?
Source:stackexchange.com