convert classes to es6
(cherry picked from commit e7615d49a4071fe5b5f192884f142c9f3385211a)
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
window.BlockRenderer = class {
|
||||
import EnumBlockFace from "../../util/EnumBlockFace.js";
|
||||
import BlockRenderType from "../../util/BlockRenderType.js";
|
||||
import Tessellator from "./Tessellator.js";
|
||||
import MathHelper from "../../util/MathHelper.js";
|
||||
import Block from "../world/block/Block.js";
|
||||
|
||||
export default class BlockRenderer {
|
||||
|
||||
static CLASSIC_LIGHTNING = false;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.Tessellator = class {
|
||||
export default class Tessellator {
|
||||
|
||||
constructor() {
|
||||
this.material = new THREE.MeshBasicMaterial({
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
window.WorldRenderer = class {
|
||||
import BlockRenderer from "./BlockRenderer.js";
|
||||
import EntityRenderManager from "./entity/EntityRenderManager.js";
|
||||
import MathHelper from "../../util/MathHelper.js";
|
||||
import ChunkSection from "../world/ChunkSection.js";
|
||||
import Block from "../world/block/Block.js";
|
||||
|
||||
export default class WorldRenderer {
|
||||
|
||||
static RENDER_DISTANCE = 4;
|
||||
static THIRD_PERSON_DISTANCE = 4;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
window.EntityRenderManager = class {
|
||||
import PlayerRenderer from "./entity/PlayerRenderer.js";
|
||||
import PlayerEntity from "../../entity/PlayerEntity.js";
|
||||
|
||||
export default class EntityRenderManager {
|
||||
|
||||
constructor(worldRenderer) {
|
||||
this.worldRenderer = worldRenderer;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
window.EntityRenderer = class {
|
||||
import Tessellator from "../Tessellator.js";
|
||||
import MathHelper from "../../../util/MathHelper.js";
|
||||
|
||||
export default class EntityRenderer {
|
||||
|
||||
constructor(model) {
|
||||
this.model = model;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
window.PlayerRenderer = class extends EntityRenderer {
|
||||
import ModelPlayer from "../../model/model/ModelPlayer.js";
|
||||
import EntityRenderer from "../EntityRenderer.js";
|
||||
import Block from "../../../world/block/Block.js";
|
||||
|
||||
export default class PlayerRenderer extends EntityRenderer {
|
||||
|
||||
constructor(worldRenderer) {
|
||||
super(new ModelPlayer());
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
window.FontRenderer = class {
|
||||
import Gui from "../../gui/Gui.js";
|
||||
|
||||
export default class FontRenderer {
|
||||
|
||||
static BITMAP_SIZE = 16;
|
||||
static FIELD_SIZE = 8;
|
||||
|
||||
static COLOR_CODE_INDEX_LOOKUP = "0123456789abcdef";
|
||||
|
||||
constructor() {
|
||||
constructor(minecraft) {
|
||||
this.charWidths = [];
|
||||
|
||||
this.isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
||||
this.texture = Gui.loadTexture("gui/font.png")
|
||||
this.texture = minecraft.resources["gui/font.png"];
|
||||
|
||||
let bitMap = this.createBitMap(this.texture);
|
||||
|
||||
@@ -136,6 +138,4 @@ window.FontRenderer = class {
|
||||
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height);
|
||||
return canvas.getContext('2d').getImageData(0, 0, img.width, img.height).data;
|
||||
}
|
||||
}
|
||||
|
||||
window.FontRenderer.INSTANCE = new FontRenderer();
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
window.ItemRenderer = class {
|
||||
import Block from "../../world/block/Block.js";
|
||||
|
||||
export default class ItemRenderer {
|
||||
|
||||
constructor(minecraft, window) {
|
||||
this.minecraft = minecraft;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.ScreenRenderer = class {
|
||||
export default class ScreenRenderer {
|
||||
|
||||
constructor(minecraft, window) {
|
||||
this.minecraft = minecraft;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
window.IsometricRenderer = class {
|
||||
import TextCoord from "./TextCoord.js";
|
||||
import Point from "./Point.js";
|
||||
import Triangle from "./Triangle.js";
|
||||
|
||||
export default class IsometricRenderer {
|
||||
|
||||
// http://jsfiddle.net/xzL58dha/3/
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.Point = class {
|
||||
export default class Point {
|
||||
constructor(x, y) {
|
||||
this.x = x ? x : 0;
|
||||
this.y = y ? y : 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.TextCoord = class {
|
||||
export default class TextCoord {
|
||||
constructor(u, v) {
|
||||
this.u = u ? u : 0;
|
||||
this.v = v ? v : 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.Triangle = class {
|
||||
export default class Triangle {
|
||||
constructor(p0, p1, p2, t0, t1, t2) {
|
||||
this.p0 = p0;
|
||||
this.p1 = p1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.ModelBase = class {
|
||||
export default class ModelBase {
|
||||
|
||||
/**
|
||||
* Rebuild the model
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
window.ModelPlayer = class extends ModelBase {
|
||||
import ModelRenderer from "../renderer/ModelRenderer.js";
|
||||
import MathHelper from "../../../../util/MathHelper.js";
|
||||
import ModelBase from "../ModelBase.js";
|
||||
|
||||
export default class ModelPlayer extends ModelBase {
|
||||
|
||||
/**
|
||||
* Create cubes for the zombie model
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
window.ModelRenderer = class {
|
||||
import Polygon from "./Polygon.js";
|
||||
import Vertex from "./Vertex.js";
|
||||
|
||||
export default class ModelRenderer {
|
||||
|
||||
/**
|
||||
* Create cube object
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
window.Polygon = class {
|
||||
import Vertex from "./Vertex.js";
|
||||
|
||||
export default class Polygon {
|
||||
|
||||
constructor(vertices, minU, minV, maxU, maxV, textureWidth, textureHeight) {
|
||||
this.vertices = vertices;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
window.Vertex = class {
|
||||
import Vector3 from "../../../../util/Vector3.js";
|
||||
|
||||
export default class Vertex {
|
||||
|
||||
/**
|
||||
* A vertex contains a 3 float vector position and UV coordinates
|
||||
|
||||
Reference in New Issue
Block a user