Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// this.renderer.render(current.scene, this.cameraForRenderTargets);
// } else {
if (!current.skip) {
this.renderer.setClearColor(new Color(0x000000), 0.0);
this.renderer.setRenderTarget(current.target);
this.renderer.render(current.scene, this.cameraForRenderTargets);
}
// } else {
// console.log(current.target.texture.uuid);
// }
// }
}
}
this.renderer.setRenderTarget(null);
this.renderer.setClearColor(new Color(0x000000), 0.0);
this.renderer.render(this.scene, this.camera);
if (config.renderView.postProcessing && this.effectComposer && window.d3) {
this.effectComposer.render(this.elapse);
}
if (window.port && window.port.onRender) {
window.port.onRender.forEach(o => {
o(this.renderer, this.scene);
});
}
}
// const n = neighborCount;
// let minDist = n > 0 ? neighborsOfFirstPoint[0].dist : 0;
// for (let i = 0; i < n; ++i) {
// const c = new THREE.Color(
// dist2color(distFunc, neighborsOfFirstPoint[i].dist, minDist)
// );
// let dst = neighborsOfFirstPoint[i].index * 3;
// colors[dst++] = c.r;
// colors[dst++] = c.g;
// colors[dst++] = c.b;
// }
// }
// Color the hover point.
if (hoverPointIndex != null) {
const c = new THREE.Color(POINT_COLOR_HOVER);
let dst = hoverPointIndex * 3;
colors[dst++] = c.r;
colors[dst++] = c.g;
colors[dst++] = c.b;
}
return colors;
}
const ambientLight = ambientLightRef.current;
const pointLight = pointLightRef.current;
camera.far = CAMERA_FAR;
camera.fov = CAMERA_FOV;
camera.near = CAMERA_NEAR;
const position = coordinatesToPosition(
lookAt,
RADIUS * distanceRadiusScale,
);
camera.position.set(...position);
// apply light options
ambientLight.color = new Color(ambientLightColor);
ambientLight.intensity = ambientLightIntensity;
pointLight.color = new Color(pointLightColor);
pointLight.intensity = pointLightIntensity;
pointLight.position.set(
RADIUS * pointLightRadiusScaleX,
RADIUS * pointLightRadiusScaleY,
RADIUS * pointLightRadiusScaleZ,
);
// apply orbit controls options
orbitControls.enableDamping = true;
orbitControls.autoRotate = enableAutoRotate;
orbitControls.autoRotateSpeed = autoRotateSpeed;
orbitControls.dampingFactor = CAMERA_DAMPING_FACTOR;
orbitControls.enablePan = false;
orbitControls.enableRotate = enableRotate;
orbitControls.enableZoom = enableZoom;
orbitControls.maxDistance = RADIUS * maxDistanceRadiusScale;
const materialColor = 0xdddddd;
const material = new THREE.ShaderMaterial({
uniforms: THREE.UniformsUtils.merge([
THREE.ShaderLib.lambert.uniforms,
{
heightmap: { value: null },
},
]),
vertexShader: vert,
fragmentShader: THREE.ShaderChunk.meshlambert_frag,
});
material.lights = true;
// Material attributes from MeshPhongMaterial
material.color = new THREE.Color(materialColor);
material.emissive = new THREE.Color(0x000000);
// Sets the uniforms with the material values
material.uniforms.diffuse.value = new THREE.Color(0x555555);
material.uniforms.emissive.value = material.emissive;
material.uniforms.opacity.value = material.opacity;
material.defines.WIDTH = WIDTH.toFixed(1);
material.defines.HEIGHT = HEIGHT.toFixed(1);
material.defines.UNIT = UNIT.toFixed(1);
return new THREE.Mesh(
new THREE.PlaneBufferGeometry(2048, 1024, 256, 128),
material,
// DEFAULT
//this.fragmentShader = ShaderLib.standard.fragmentShader;
this.fragmentShader = fragmentShader;
this.color = new THREE.Color(0xffffff); // diffuse
this.roughness = 0.7;
this.metalness = 0.0;
this.map = null;
this.lightMap = null;
this.lightMapIntensity = 1.0;
this.aoMap = null;
this.aoMapIntensity = 1.0;
this.emissive = new THREE.Color(0x000000);
this.emissiveIntensity = 1.0;
this.emissiveMap = null;
this.bumpMap = null;
this.bumpScale = 1;
this.normalMap = null;
this.normalScale = new THREE.Vector2(1, 1);
this.displacementMap = null;
this.displacementScale = 1;
this.displacementBias = 0;
this.roughnessMap = null;
this.metalnessMap = null;
}, mesh => {
mesh.material.color = new THREE.Color(theme.linkColor());
renderer.render(scene, camera);
});
set(preset) {
!isUndefined(preset.visible) && this.highCircle.circlesVisible(preset.visible | 0, preset.opacityStep || 1);
!isUndefined(preset.pointsColor) && this.highCircle.pointsColor(new Color(preset.pointsColor));
!isUndefined(preset.ringColor) && this.highCircle.ringColor(new Color(preset.ringColor));
!isUndefined(preset.opacity) && this.highCircle.ring.opacity(preset.opacity);
!isUndefined(preset.impact) && this.highCircle.impact(preset.impact);
!isUndefined(preset.stabilityStart) && this.highCircle.stabilityStart(preset.stabilityStart);
!isUndefined(preset.stabilityEnd) && this.highCircle.stabilityEnd(preset.stabilityEnd);
!isUndefined(preset.rotation) && this.highCircle.rotation(preset.rotation);
!isUndefined(preset.perlin) && this.highCircle.perlin(preset.perlin);
!isUndefined(preset.background) && this.sceneSet.renderer.setClearColor(new Color(preset.background));
!isUndefined(preset.floatsOpacity) && (this.floats.material.opacity = preset.floatsOpacity);
}
if (Array.isArray(pbrSpecularGlossiness.diffuseFactor)) {
var array = pbrSpecularGlossiness.diffuseFactor
params.color.fromArray(array)
params.opacity = array[3]
}
if (pbrSpecularGlossiness.diffuseTexture !== undefined) {
pending.push(parser.assignTexture(params, 'map', pbrSpecularGlossiness.diffuseTexture))
}
params.emissive = new Color(0.0, 0.0, 0.0)
params.glossiness =
pbrSpecularGlossiness.glossinessFactor !== undefined ? pbrSpecularGlossiness.glossinessFactor : 1.0
params.specular = new Color(1.0, 1.0, 1.0)
if (Array.isArray(pbrSpecularGlossiness.specularFactor)) {
params.specular.fromArray(pbrSpecularGlossiness.specularFactor)
}
if (pbrSpecularGlossiness.specularGlossinessTexture !== undefined) {
var specGlossMapDef = pbrSpecularGlossiness.specularGlossinessTexture
pending.push(parser.assignTexture(params, 'glossinessMap', specGlossMapDef))
pending.push(parser.assignTexture(params, 'specularMap', specGlossMapDef))
}
return Promise.all(pending)
},
addArcSlice (startAngle, percent, color, permanent) {
const size = Math.PI * percent;
const slice = new THREE.RingGeometry(this.innerRadius - arcMeterWidth, this.innerRadius - 1, 30, 8, startAngle, size);
const mat = new THREE.MeshBasicMaterial({ color: new THREE.Color(color.r, color.g, color.b), side: THREE.DoubleSide, transparent: true, opacity: color.a });
const mesh = new THREE.Mesh(slice, mat);
mesh.position.set(0, 0, this.depth + 5);
mesh.rotation.y = Math.PI;
mesh.userData.context = 'arc';
mesh.userData.defaultOpacity = color.a;
if (!permanent) { this.arcMeterSegments.push(mesh); }
this.container.add(mesh);
return { mesh: mesh, angle: startAngle + size };
}
this.addBall = function ( ballx, bally, ballz, strength, subtract, colors ) {
var sign = Math.sign( strength );
strength = Math.abs( strength );
var userDefineColor = ! ( colors === undefined || colors === null );
var ballColor = new THREE.Color( ballx, bally, ballz );
if ( userDefineColor ) {
try {
ballColor =
colors instanceof THREE.Color
? colors
: Array.isArray( colors )
? new THREE.Color(
Math.min( Math.abs( colors[ 0 ] ), 1 ),
Math.min( Math.abs( colors[ 1 ] ), 1 ),
Math.min( Math.abs( colors[ 2 ] ), 1 )
)
: new THREE.Color( colors );
} catch ( err ) {