Skip to content

Commit a9c46e3

Browse files
committed
Refactor world controller & renderer
1 parent 586fec5 commit a9c46e3

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

GruntFile.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ module.exports = function(grunt) {
5353
'js/utils/vector2.js',
5454
'js/utils/vector3.js',
5555
'js/exceptions.js',
56+
'js/texture_container.js',
57+
'js/model_container.js',
5658
'js/game/gameplay_object.js',
5759
'js/game/vehicle.js',
5860
'js/game/road.js',
@@ -64,10 +66,8 @@ module.exports = function(grunt) {
6466
'js/game/traffic_light.js',
6567
'js/game/traffic_lights_controller.js',
6668
'js/game/map.js',
67-
'js/texture_container.js',
68-
'js/model_container.js',
69-
'js/world_renderer.js',
70-
'js/world_controller.js',
69+
'js/game/world_renderer.js',
70+
'js/game/world_controller.js',
7171
'js/game/road_controller.js',
7272
'js/game/vehicle_controller.js',
7373
'js/scenes/gameplay_scene.js',

js/world_controller.js js/game/world_controller.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
(function() {
2-
TRAFFICSIM_APP.WorldController = function (gameplayScene) {
2+
TRAFFICSIM_APP.game = TRAFFICSIM_APP.game || {};
3+
TRAFFICSIM_APP.game.world_controller = TRAFFICSIM_APP.game.world_controller || {};
4+
5+
var NS = TRAFFICSIM_APP.game.world_controller;
6+
7+
NS.WorldController = function (gameplayScene) {
38
var self = this;
49

510
var gameplayScene = gameplayScene;

js/world_renderer.js js/game/world_renderer.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
(function() {
2-
TRAFFICSIM_APP.WorldRenderer = function (worldController) {
2+
/* All meshes added to the ThreeJS scene will be automatically drawn on the screen. This namespace
3+
* is supposed to handle rendering situations that are part of any other namespace. */
4+
TRAFFICSIM_APP.game = TRAFFICSIM_APP.game || {};
5+
TRAFFICSIM_APP.game.world_renderer = TRAFFICSIM_APP.game.world_renderer || {};
6+
7+
var NS = TRAFFICSIM_APP.game.world_renderer;
8+
9+
NS.WorldRenderer = function (worldController) {
310
var renderer;
411
var worldController = worldController;
512
var drawDebugInfo = {

js/scenes/gameplay_scene.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
function initialize() {
2424
clock = new THREE.Clock();
25-
worldController = new TRAFFICSIM_APP.WorldController(self);
26-
worldRenderer = new TRAFFICSIM_APP.WorldRenderer(worldController);
25+
worldController = new TRAFFICSIM_APP.game.world_controller.WorldController(self);
26+
worldRenderer = new TRAFFICSIM_APP.game.world_renderer.WorldRenderer(worldController);
2727
}
2828

2929
this.update = function () {

0 commit comments

Comments
 (0)