{
const ambientLight = new THREE.AmbientLight(0x404040);
scene.add(ambientLight);
const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
directionalLight.position.set(5, 5, 5).normalize();
scene.add(directionalLight);
const axesHelper = new THREE.AxesHelper(5);
axesHelper.material = new THREE.LineBasicMaterial({ color: 0x000000 });
scene.add(axesHelper);
const loader = new FL.FontLoader();
loader.load("https://threejs.org/examples/fonts/helvetiker_regular.typeface.json", function (font) {
const xLabelGeometry = new TG.TextGeometry("x", {
font: font,
size: 0.2,
depth: 0.01,
});
const yLabelGeometry = new TG.TextGeometry("y", {
font: font,
size: 0.2,
depth: 0.01,
});
const zLabelGeometry = new TG.TextGeometry("f(x,y)", {
font: font,
size: 0.2,
depth: 0.01,
});
const labelMaterial = new THREE.MeshBasicMaterial({ color: 0x000000 });
const xLabel = new THREE.Mesh(xLabelGeometry, labelMaterial);
xLabel.position.set(5, 0, 0);
xLabel.rotateX(Math.PI / 2);
scene.add(xLabel);
const yLabel = new THREE.Mesh(yLabelGeometry, labelMaterial);
yLabel.position.set(0, 5, 0);
yLabel.rotateX(Math.PI / 2);
yLabel.rotateY(Math.PI * 1.5);
scene.add(yLabel);
const zLabel = new THREE.Mesh(zLabelGeometry, labelMaterial);
zLabel.position.set(0, 0, 5);
scene.add(zLabel);
});
}