summaryrefslogtreecommitdiffhomepage
path: root/derelict.js
diff options
context:
space:
mode:
Diffstat (limited to 'derelict.js')
-rw-r--r--derelict.js16
1 files changed, 5 insertions, 11 deletions
diff --git a/derelict.js b/derelict.js
index 6864564..1a66f91 100644
--- a/derelict.js
+++ b/derelict.js
@@ -9,7 +9,7 @@ const EXPIRY = 1000 * 60 * 5
class SkirmishGrid {
scene = new THREE.Scene()
- helper = new THREE.GridHelper(50, 50)
+ helper = new THREE.GridHelper(50, 50, 0x303030, 0x222222)
camera
controls
renderer
@@ -71,8 +71,7 @@ class Wreck {
point = new THREE.Object3D()
killmail
- constructor({killmail, icon, grid}) {
- const iconElement = document.importNode(icon, true)
+ constructor({killmail, grid}) {
const labelElement = document.createElement('div')
const object2d = new CSS2DObject(this.domElement)
const ownerId = "alliance_id" in killmail.victim ? killmail.victim.alliance_id : killmail.victim.corporation_id
@@ -98,7 +97,6 @@ class Wreck {
this.domElement.classList.add('wreck', team)
this.domElement.appendChild(labelElement)
- this.domElement.appendChild(iconElement)
this.domElement.onclick = () => window.open(`https://zkillboard.com/kill/${this.killmail.killmail_id}/`)
this.domElement.oncontextmenu = () => {
grid.controls.target.copy(this.point.position)
@@ -155,7 +153,7 @@ function averagePosition(positions) {
return sum.divideScalar(positions.length)
}
-function processKillmails(obj, killmails, icon) {
+function processKillmails(obj, killmails) {
const dates = killmails.map(km => Date.parse(km.killmail_time))
const start = Math.min(...dates)
const end = Math.max(...dates)
@@ -176,7 +174,7 @@ function processKillmails(obj, killmails, icon) {
const grid = new SkirmishGrid(obj)
cluster.forEach(killmail => {
killmail.victim.position.sub(center).divideScalar(SCALE)
- const wreck = new Wreck({killmail, icon, grid})
+ const wreck = new Wreck({killmail, grid})
grid.add(wreck.point)
elements.push(wreck)
})
@@ -222,8 +220,6 @@ export function init({id, container, toolbar}) {
const loader = new THREE.TextureLoader()
const skybox = loader.loadAsync("https://i.imgur.com/rDGOLFC.jpg") // TODO: Don't use imgur as CDN.
- let icon = loadWreckIcon()
-
fetch(`/battles/${id}`)
.then(response => response.json())
.then(killmails => {
@@ -233,7 +229,5 @@ export function init({id, container, toolbar}) {
.then(data => { data.teams = killmails.teams; return data })
return Promise.all(killmails.killmails.map(retrieve))
})
- .then(killmails => {
- icon.then(icon => processKillmails({skybox, renderer, renderer2d, container}, killmails, icon))
- })
+ .then(killmails => processKillmails({skybox, renderer, renderer2d, container}, killmails))
}