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