UNPKG

sc4

Version:

A command line utility for automating SimCity 4 modding tasks & modifying savegames

41 lines (40 loc) 1.04 kB
// # vertex.ts import Color from './color.js'; // # Vertex // In quite a lot of subfiles often the sequence x, y, z, u, v, r, g, b, a // occurs. It looks like this is a vertex with [x, y, z] as coordinates, // [u, v] as coordinates for u, v mapping and [r, g, b, a] as color value. In // order to make it easier to work with this, we've put them inside a separate // class. export default class Vertex { x = 0; y = 0; z = 0; u = 0; v = 0; color = new Color(); // ## constructor(opts) constructor(opts) { if (opts) { Object.assign(this, opts); } } // ## parse(rs) parse(rs) { this.x = rs.float(); this.y = rs.float(); this.z = rs.float(); this.u = rs.float(); this.v = rs.float(); this.color = rs.color(); } // ## write(ws) write(ws) { ws.float(this.x); ws.float(this.y); ws.float(this.z); ws.float(this.u); ws.float(this.v); ws.color(this.color); } }