Browse Source

refactor variable names (no logic changes)

world-fix
Trent Larson 2 years ago
parent
commit
b5db2b4140
  1. 17
      src/components/World/World.js

17
src/components/World/World.js

@ -14,15 +14,12 @@ import { createControls } from "./systems/controls.js";
import { createRenderer } from "./systems/renderer.js"; import { createRenderer } from "./systems/renderer.js";
import { AppString } from "@/constants/app"; import { AppString } from "@/constants/app";
// These variables are module-scoped: we cannot access them const BASE32 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
// from outside the module const COLOR1 = "#42b883";
const COLOR2 = "#0055aa";
const color = "#42b883";
const color2 = "#0055aa";
const PLATFORM_SIZE = 100;
const PLATFORM_BORDER = 10; const PLATFORM_BORDER = 10;
const PLATFORM_EDGE_FOR_UNKNOWNS = 10; const PLATFORM_EDGE_FOR_UNKNOWNS = 10;
const BASE32 = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"; const PLATFORM_SIZE = 100;
function createLight() { function createLight() {
const light = new SpotLight(0xffffff, 100, 0, Math.PI / 8, 0.5, 0); const light = new SpotLight(0xffffff, 100, 0, Math.PI / 8, 0.5, 0);
@ -37,7 +34,7 @@ class World {
// Instances of camera, scene, and renderer // Instances of camera, scene, and renderer
this.camera = createCamera(); this.camera = createCamera();
this.scene = createScene(color2); this.scene = createScene(COLOR2);
this.renderer = createRenderer(); this.renderer = createRenderer();
this.light = null; this.light = null;
@ -52,11 +49,11 @@ class World {
const controls = createControls(this.camera, this.renderer.domElement); const controls = createControls(this.camera, this.renderer.domElement);
// Light Instance, with optional light helper // Light Instance, with optional light helper
const { light } = createLights(color); const { light } = createLights(COLOR1);
// Terrain Instance // Terrain Instance
const terrain = createTerrain({ const terrain = createTerrain({
color: color, color: COLOR1,
height: PLATFORM_SIZE + PLATFORM_BORDER, height: PLATFORM_SIZE + PLATFORM_BORDER,
width: PLATFORM_SIZE + PLATFORM_BORDER + PLATFORM_EDGE_FOR_UNKNOWNS, width: PLATFORM_SIZE + PLATFORM_BORDER + PLATFORM_EDGE_FOR_UNKNOWNS,
}); });

Loading…
Cancel
Save