Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
innerHeight: height,
devicePixelRatio: scale,
} = window;
// scene
this.scene = new THREE.Scene();
if (this.AR) {
// AR Background Texture
this.scene.background = ExpoTHREE.createARBackgroundTexture(
arSession,
this.renderer
);
/// AR Camera
this.camera = ExpoTHREE.createARCamera(
arSession,
width,
height,
0.01,
1000
);
} else {
// Standard Background
this.scene.background = new THREE.Color(0x999999);
this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);
/// Standard Camera
this.camera = new THREE.PerspectiveCamera(35, width / height, 1, 15);
this.camera.position.set(3, 0.15, 3);
// controls
this.renderer = ExpoTHREE.createRenderer({ gl });
this.renderer.setPixelRatio(scale);
this.renderer.setSize(width, height);
this.renderer.setClearColor(0x000000, 1.0);
// scene
this.scene = new THREE.Scene();
this.scene.background = ExpoTHREE.createARBackgroundTexture(
arSession,
this.renderer
);
// camera
this.camera = ExpoTHREE.createARCamera(
arSession,
width,
height,
0.01,
1000
);
// custom scene
this._setupScene();
// resize listener
window.addEventListener('resize', this._onWindowResize, false);
};
_onGLContextCreate = async (gl, arSession) => {
const { drawingBufferWidth, drawingBufferHeight } = gl;
const scale = PixelRatio.get();
const width = drawingBufferWidth / scale;
const height = drawingBufferHeight / scale;
const renderer = ExpoTHREE.createRenderer({ gl });
renderer.setSize(width, height);
renderer.setPixelRatio(scale);
const scene = new THREE.Scene();
const camera = ExpoTHREE.createARCamera(
arSession,
width,
height,
0.01,
1000
);
// need to add camera to scene to make attached objects visible
scene.add(camera);
scene.background = ExpoTHREE.createARBackgroundTexture(
arSession,
renderer
);
ExpoTHREE.setIsLightEstimationEnabled(arSession, true);
ExpoTHREE.setIsPlaneDetectionEnabled(arSession, true);
innerHeight: height,
devicePixelRatio: scale,
} = window;
// scene
this.scene = new THREE.Scene();
if (this.AR) {
// AR Background Texture
this.scene.background = ExpoTHREE.createARBackgroundTexture(
arSession,
this.renderer
);
/// AR Camera
this.camera = ExpoTHREE.createARCamera(
arSession,
width,
height,
0.01,
1000
);
} else {
// Standard Background
this.scene.background = new THREE.Color(0x999999);
this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);
/// Standard Camera
this.camera = new THREE.PerspectiveCamera(50, width / height, 0.1, 500);
this.camera.position.set(0, -4, 0);
innerHeight: height,
devicePixelRatio: scale,
} = window;
// scene
this.scene = new THREE.Scene();
if (this.AR) {
// AR Background Texture
this.scene.background = ExpoTHREE.createARBackgroundTexture(
arSession,
this.renderer
);
/// AR Camera
this.camera = ExpoTHREE.createARCamera(
arSession,
width,
height,
0.01,
1000
);
} else {
// Standard Background
this.scene.background = new THREE.Color(0x999999);
this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);
/// Standard Camera
this.camera = new THREE.PerspectiveCamera(50, width / height, 1, 500);
this.camera.up.set(0, 0, 1);
this.camera.position.set(0, -12, 6);
innerHeight: height,
devicePixelRatio: scale,
} = window;
// scene
this.scene = new THREE.Scene();
if (this.AR) {
// AR Background Texture
this.scene.background = ExpoTHREE.createARBackgroundTexture(
arSession,
this.renderer
);
/// AR Camera
this.camera = ExpoTHREE.createARCamera(
arSession,
width,
height,
0.01,
1000
);
} else {
// Standard Background
this.scene.background = new THREE.Color(0x999999);
this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);
/// Standard Camera
this.camera = new THREE.PerspectiveCamera(25, width / height, 1, 10000);
this.camera.position.set(600, 1150, 5);
this.camera.up.set(0, 0, 1);
this.camera.lookAt(new THREE.Vector3(-100, 0, 0));
innerHeight: height,
devicePixelRatio: scale,
} = window;
// scene
this.scene = new THREE.Scene();
if (this.AR) {
// AR Background Texture
this.scene.background = ExpoTHREE.createARBackgroundTexture(
arSession,
this.renderer
);
/// AR Camera
this.camera = ExpoTHREE.createARCamera(
arSession,
width,
height,
0.01,
1000
);
} else {
// Standard Background
this.scene.background = new THREE.Color(0x999999);
this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);
/// Standard Camera
this.camera = new THREE.PerspectiveCamera(50, width / height, 1, 500);
this.camera.up.set(0, 0, 1);
this.camera.position.set(0, -12, 6);
innerHeight: height,
devicePixelRatio: scale,
} = window;
// scene
this.scene = new THREE.Scene();
if (this.AR) {
// AR Background Texture
this.scene.background = ExpoTHREE.createARBackgroundTexture(
arSession,
this.renderer
);
/// AR Camera
this.camera = ExpoTHREE.createARCamera(
arSession,
width,
height,
0.01,
1000
);
} else {
// Standard Background
this.scene.background = new THREE.Color(0x999999);
this.scene.fog = new THREE.FogExp2(0xcccccc, 0.002);
/// Standard Camera
this.camera = new THREE.PerspectiveCamera(45, width / height, 1, 10000);
this.camera.position.set(1000, -300, 1000);
// controls
}
this.arSession = arSession;
/// Enable ARKit light estimation
ExpoTHREE.setIsLightEstimationEnabled(arSession, true);
ExpoTHREE.setIsPlaneDetectionEnabled(arSession, true);
this.renderer = ExpoTHREE.createRenderer({ gl, canvas });
this.renderer.setPixelRatio(scale);
this.renderer.setSize(width, height);
this.renderer.setClearColor(0x000000, 1.0);
this.scene = new THREE.Scene();
this.scene.background = ExpoTHREE.createARBackgroundTexture(arSession, this.renderer);
this.scene.size = { width, height };
this.camera = ExpoTHREE.createARCamera(arSession, width, height, 0.01, 1000);
this.setupLights();
this.setupARUtils();
this.setupBall();
};
this.renderer.setPixelRatio(scale);
this.renderer.setSize(width, height);
this.renderer.setClearColor(0x000000, 1.0);
// scene
this.scene = new THREE.Scene();
if (AR) {
// AR Background Texture
this.scene.background = ExpoTHREE.createARBackgroundTexture(
arSession,
this.renderer
);
/// AR Camera
this.camera = ExpoTHREE.createARCamera(
arSession,
width,
height,
0.01,
1000
);
} else {
// Standard Background
this.scene.background = new THREE.Color(0xcccccc);
this.scene.fog = new THREE.FogExp2(0x222222, 0.0001);
/// Standard Camera
this.camera = new THREE.PerspectiveCamera(80, width / height, 50, 10000);
this.camera.position.x = 2500;
this.camera.position.y = 2500;