mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
29 lines
621 B
JavaScript
29 lines
621 B
JavaScript
"use strict";
|
|
|
|
import Vector from './Utilities/Vector.js';
|
|
|
|
class ChunkReference extends Vector
|
|
{
|
|
constructor(inPlaneName, inX, inY)
|
|
{
|
|
super(inX, inY);
|
|
this.planeName = inPlaneName;
|
|
}
|
|
|
|
/**
|
|
* Returns a plain Vector of this chunk reference in plane space.
|
|
* @param {number} chunkSize The size of the chunk this ChunkReference refers to.
|
|
* @returns {Vector} This ChunkReference in plane space.
|
|
*/
|
|
inPlaneSpace(chunkSize)
|
|
{
|
|
return this.clone().multiply(chunkSize);
|
|
}
|
|
|
|
toString()
|
|
{
|
|
return `ChunkReference: (${this.x}, ${this.y}, ${this.planeName})`;
|
|
}
|
|
}
|
|
|
|
export default ChunkReference;
|