|
@ -177,21 +177,21 @@ function init() { |
|
|
camera.position.z = 20; |
|
|
camera.position.z = 20; |
|
|
|
|
|
|
|
|
// Fetch JSON data
|
|
|
// Fetch JSON data
|
|
|
fetch('../json/articles.json') |
|
|
// fetch('../json/articles.json')
|
|
|
.then(response => response.json()) |
|
|
// .then(response => response.json())
|
|
|
.then(jsonData => { |
|
|
// .then(jsonData => {
|
|
|
for (let i = 0; i < jsonData.length; i++) { |
|
|
// for (let i = 0; i < jsonData.length; i++) {
|
|
|
let temp_txt = loader.load('../images/' + jsonData[i]['image']); |
|
|
// let temp_txt = loader.load('../images/' + jsonData[i]['image']);
|
|
|
temp_txt.minFilter = THREE.NearestFilter; |
|
|
// temp_txt.minFilter = THREE.NearestFilter;
|
|
|
temp_txt.magFilter = THREE.NearestFilter; |
|
|
// temp_txt.magFilter = THREE.NearestFilter;
|
|
|
temp_txt.colorSpace = THREE.SRGBColorSpace; |
|
|
// temp_txt.colorSpace = THREE.SRGBColorSpace;
|
|
|
let title = jsonData[i]['name'] |
|
|
// let title = jsonData[i]['name']
|
|
|
let filename = jsonData[i]['filename'] |
|
|
// let filename = jsonData[i]['filename']
|
|
|
let article = new Article(temp_txt, title, filename.replace(/\.[^/.]+$/, ""), i); |
|
|
// let article = new Article(temp_txt, title, filename.replace(/\.[^/.]+$/, ""), i);
|
|
|
article.AddToScene(scene, aspect); |
|
|
// article.AddToScene(scene, aspect);
|
|
|
object_list.push(article); |
|
|
// object_list.push(article);
|
|
|
} |
|
|
// }
|
|
|
}) |
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -246,19 +246,19 @@ function animate(time) { |
|
|
const deltaTime = (time - lastTime) / 1000; // Convert time to seconds
|
|
|
const deltaTime = (time - lastTime) / 1000; // Convert time to seconds
|
|
|
lastTime = time; |
|
|
lastTime = time; |
|
|
|
|
|
|
|
|
pickHelper.pick(pickPosition, scene, camera, time); |
|
|
// pickHelper.pick(pickPosition, scene, camera, time);
|
|
|
|
|
|
|
|
|
for (let i = 0; i < object_list.length; i++){ |
|
|
// for (let i = 0; i < object_list.length; i++){
|
|
|
object_list[i].UpdateRotation(deltaTime); |
|
|
// object_list[i].UpdateRotation(deltaTime);
|
|
|
object_list[i].UpdatePosition(deltaTime, pickHelper); |
|
|
// object_list[i].UpdatePosition(deltaTime, pickHelper);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
// Update the plane texture offset
|
|
|
// Update the plane texture offset
|
|
|
const scrollSpeed = 0.2; |
|
|
const scrollSpeed = 0.2; |
|
|
planeMat.map.offset.y += scrollSpeed * deltaTime; |
|
|
planeMat.map.offset.y += scrollSpeed * deltaTime; |
|
|
planeMat.map.offset.x += scrollSpeed / 0.75 * deltaTime; |
|
|
planeMat.map.offset.x += scrollSpeed / 0.75 * deltaTime; |
|
|
|
|
|
|
|
|
ChangeCursor(); |
|
|
// ChangeCursor();
|
|
|
// Render the scene from the perspective of the camera
|
|
|
// Render the scene from the perspective of the camera
|
|
|
renderer.render(scene, camera); |
|
|
renderer.render(scene, camera); |
|
|
} |
|
|
} |
|
|