Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const size = 0.65;
const material = new THREE.ShaderMaterial({
uniforms: this.uniforms,
vertexShader: vertexShader,
fragmentShader: fragmentShader,
});
const mesh = new THREE.Mesh(
new THREE.TorusGeometry(size, 0.3, 30, 30),
material
);
mesh.rotation.x = 0.3;
this.scene.add(mesh);
this.mesh = mesh;
this.scene.add(new THREE.AmbientLight(0xcccccc));
this.light = new THREE.DirectionalLight(0xffffff, 2);
this.light.position.set(1, 1, 0.5);
this.scene.add(this.light);
// this.renderer.autoClear = false;
require('three/examples/js/postprocessing/EffectComposer');
require('three/examples/js/postprocessing/RenderPass');
require('three/examples/js/postprocessing/ShaderPass');
require('three/examples/js/postprocessing/MaskPass');
require('three/examples/js/shaders/ConvolutionShader');
require('three/examples/js/shaders/FilmShader');
require('three/examples/js/postprocessing/BloomPass');
require('three/examples/js/postprocessing/FilmPass');
require('three/examples/js/shaders/CopyShader');
async setupModels() {
await super.setupModels();
this.scene.add(new THREE.AmbientLight(0xcccccc));
this.light = new THREE.DirectionalLight(0xffffff, 2);
this.light.position.set(1, 1, 0.5);
this.scene.add(this.light);
let skyMaterial = new SkyMaterial();
const skyGeo = new THREE.SphereBufferGeometry(14500, 32, 15);
// Expose variables
this.mesh = new THREE.Mesh(skyGeo, skyMaterial);
this.scene.add(this.mesh);
// Add Sun Helper
let sunSphere = new THREE.Mesh(
new THREE.SphereBufferGeometry(2000, 16, 8),
new THREE.MeshBasicMaterial({ color: 0xffffff })
);
sunSphere.position.y = -700000;
setupLights = () => {
// lights
const directionalLightA = new THREE.DirectionalLight(0xffffff);
directionalLightA.position.set(1, 1, 1);
this.scene.add(directionalLightA);
const directionalLightB = new THREE.DirectionalLight(0xffeedd);
directionalLightB.position.set(-1, -1, -1);
this.scene.add(directionalLightB);
const ambientLight = new THREE.AmbientLight(0x222222);
this.scene.add(ambientLight);
};
this.camera = new ThreeAR.Camera(width, height, 0.01, 1000);
// Create ARKit lighting
this.arPointLight = new ThreeAR.Light();
this.arPointLight.position.y = 2;
this.mesh = new THREE.Object3D();
this.scene.add(this.arPointLight);
this.shadowLight = this.getShadowLight();
this.scene.add(this.shadowLight);
this.scene.add(this.shadowLight.target);
// this.scene.add(new THREE.DirectionalLightHelper(this.shadowLight));
this.scene.add(new THREE.AmbientLight(0x404040));
this.shadowFloor = new ThreeAR.ShadowFloor({
width: 1,
height: 1,
opacity: 0.6,
});
this.mesh.add(this.shadowFloor);
// Don't scale up with distance
this.magneticObject.maintainScale = false;
this.magneticObject.add(this.mesh);
this.scene.add(this.magneticObject);
await this.loadModel();
async setupModels() {
await super.setupModels();
this.mesh = new RandomJunkNode();
await this.mesh.loadAsync();
this.scene.add(this.mesh);
this.scene.add(new THREE.AmbientLight(0x222222));
this.light = new THREE.DirectionalLight(0xffffff);
this.light.position.set(1, 1, 1);
this.scene.add(this.light);
if (!THREE.AnaglyphEffect)
require('three/examples/js/effects/AnaglyphEffect');
this.effect = new THREE.AnaglyphEffect(this.renderer);
const { width, height } = this.renderer.getSize();
this.effect.setSize(width, height);
}
Game.prototype.addLights = function(scene) {
scene.add(new THREE.AmbientLight(0xcccccc));
var light = new THREE.DirectionalLight(0xffffff, 1);
light.position.set(1, 1, 0.5).normalize();
scene.add(light);
};
async setupModels() {
await super.setupModels();
this.mesh = new RandomJunkNode();
await this.mesh.loadAsync();
this.scene.add(this.mesh);
this.scene.add(new THREE.AmbientLight(0x222222));
this.light = new THREE.DirectionalLight(0xffffff);
this.light.position.set(1, 1, 1);
this.scene.add(this.light);
require('three/examples/js/postprocessing/EffectComposer');
require('three/examples/js/postprocessing/RenderPass');
require('three/examples/js/postprocessing/ShaderPass');
require('three/examples/js/postprocessing/MaskPass');
require('three/examples/js/postprocessing/GlitchPass');
require('three/examples/js/postprocessing/BloomPass');
require('three/examples/js/postprocessing/FilmPass');
require('three/examples/js/shaders/CopyShader');
require('three/examples/js/shaders/ColorCorrectionShader');
require('three/examples/js/shaders/VignetteShader');
require('three/examples/js/shaders/DigitalGlitch');
setupLights = () => {
const directionalLightA = new THREE.DirectionalLight(0xffffff);
directionalLightA.position.set(1, 1, 1);
this.scene.add(directionalLightA);
const directionalLightB = new THREE.DirectionalLight(0xffeedd);
directionalLightB.position.set(-1, -1, -1);
this.scene.add(directionalLightB);
const ambientLight = new THREE.AmbientLight(0x222222);
this.scene.add(ambientLight);
};
async setupModels() {
await super.setupModels();
this.mesh = new RandomJunkNode();
await this.mesh.loadAsync();
this.scene.add(this.mesh);
this.scene.add(new THREE.AmbientLight(0x222222));
this.light = new THREE.DirectionalLight(0xffffff);
this.light.position.set(1, 1, 1);
this.scene.add(this.light);
require('three/examples/js/postprocessing/EffectComposer');
require('three/examples/js/postprocessing/RenderPass');
require('three/examples/js/postprocessing/ShaderPass');
require('three/examples/js/postprocessing/MaskPass');
require('three/examples/js/postprocessing/GlitchPass');
require('three/examples/js/postprocessing/BloomPass');
require('three/examples/js/postprocessing/FilmPass');
require('three/examples/js/shaders/CopyShader');
require('three/examples/js/shaders/ColorCorrectionShader');
require('three/examples/js/shaders/VignetteShader');
require('three/examples/js/shaders/DigitalGlitch');
bevelEnabled: true,
bevelSegments: 2,
steps: 2,
bevelSize: 1,
bevelThickness: 1
};
const heartGeometry = new THREE.ExtrudeGeometry(heartShape, options);
const heartMaterial = new THREE.MeshPhongMaterial({ color: 0xff0000 });
this.heart = new THREE.Mesh(heartGeometry, heartMaterial);
this.heart.scale.set(0.005, 0.005, 0.005);
this.heart.position.set(2, 0, -2);
this.heart.rotation.set(0, 0, Math.PI);
this.scene.add(this.heart);
this.scene.add(new THREE.AmbientLight(0xffffff));
};