track made out of cubes.
parent
87bd9178bf
commit
2382e2a1d5
89
gulpfile.js
89
gulpfile.js
|
@ -6,6 +6,7 @@ var plumber = require('gulp-plumber');
|
||||||
var istanbul = require('gulp-istanbul');
|
var istanbul = require('gulp-istanbul');
|
||||||
var mocha = require('gulp-mocha');
|
var mocha = require('gulp-mocha');
|
||||||
var watch = require('gulp-watch');
|
var watch = require('gulp-watch');
|
||||||
|
var preprocessor = require('gulp-c-preprocessor');
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
'build',
|
'build',
|
||||||
|
@ -58,10 +59,92 @@ gulp.task(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
gulp.task('compileRuntime', ['build'],
|
||||||
|
function() {
|
||||||
|
gulp.src(['./build/defines/runtime.js', './build/game-lib.js'])
|
||||||
|
.pipe(concat('game-lib-runtime.js'))
|
||||||
|
.pipe(preprocessor(
|
||||||
|
{
|
||||||
|
// End of line character
|
||||||
|
endLine: '\n',
|
||||||
|
|
||||||
|
// Escape '//#' & '/*#' comments (see extra/comments)
|
||||||
|
commentEscape: true,
|
||||||
|
|
||||||
|
// Empty lines to add between code and included files
|
||||||
|
includeSpaces: 0,
|
||||||
|
|
||||||
|
// Limit of empty following lines (0 = no limit)
|
||||||
|
emptyLinesLimit: 0,
|
||||||
|
|
||||||
|
// Base path for including files
|
||||||
|
basePath: './',
|
||||||
|
|
||||||
|
// Stop the compiler when an error ocurred ?
|
||||||
|
stopOnError: true,
|
||||||
|
|
||||||
|
// Constants in #enum command must be in hexadecimal ?
|
||||||
|
enumInHex: true
|
||||||
|
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.pipe(minify({
|
||||||
|
ext:{
|
||||||
|
src:'.js',
|
||||||
|
min:'-min.js'
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest('./build/'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task('compileEditor', ['build'],
|
||||||
|
function() {
|
||||||
|
gulp.src(['./build/defines/editor.js', './build/game-lib.js'])
|
||||||
|
.pipe(concat('game-lib-editor.js'))
|
||||||
|
.pipe(preprocessor(
|
||||||
|
{
|
||||||
|
// End of line character
|
||||||
|
endLine: '\n',
|
||||||
|
|
||||||
|
// Escape '//#' & '/*#' comments (see extra/comments)
|
||||||
|
commentEscape: true,
|
||||||
|
|
||||||
|
// Empty lines to add between code and included files
|
||||||
|
includeSpaces: 0,
|
||||||
|
|
||||||
|
// Limit of empty following lines (0 = no limit)
|
||||||
|
emptyLinesLimit: 0,
|
||||||
|
|
||||||
|
// Base path for including files
|
||||||
|
basePath: './',
|
||||||
|
|
||||||
|
// Stop the compiler when an error ocurred ?
|
||||||
|
stopOnError: true,
|
||||||
|
|
||||||
|
// Constants in #enum command must be in hexadecimal ?
|
||||||
|
enumInHex: true
|
||||||
|
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.pipe(minify({
|
||||||
|
ext:{
|
||||||
|
src:'.js',
|
||||||
|
min:'-min.js'
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest('./build/'));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
'default',
|
'default',
|
||||||
[
|
[
|
||||||
'build'
|
'build',
|
||||||
|
'compileRuntime',
|
||||||
|
'compileEditor'
|
||||||
],
|
],
|
||||||
function() {
|
function() {
|
||||||
return watch([
|
return watch([
|
||||||
|
@ -69,7 +152,9 @@ gulp.task(
|
||||||
],
|
],
|
||||||
function() {
|
function() {
|
||||||
gulp.start([
|
gulp.start([
|
||||||
'build'
|
'build',
|
||||||
|
'compileRuntime',
|
||||||
|
'compileEditor'
|
||||||
]);
|
]);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,3 +23,12 @@ if (typeof _ == 'undefined') {
|
||||||
|
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//#ifdef RUNTIME__
|
||||||
|
console.log("Loading runtime library...");
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
//#ifdef EDITOR__
|
||||||
|
console.log("Loading editor library...");
|
||||||
|
//#endif
|
|
@ -31,6 +31,7 @@ GameLib.D3.ComponentMeshPermutation = function ComponentMeshPermutation(
|
||||||
GameLib.D3.Utils.Extend(GameLib.D3.ComponentMeshPermutation, GameLib.D3.ComponentInterface);
|
GameLib.D3.Utils.Extend(GameLib.D3.ComponentMeshPermutation, GameLib.D3.ComponentInterface);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//#ifdef RUNTIME__
|
||||||
if(typeof THREE != "undefined") {
|
if(typeof THREE != "undefined") {
|
||||||
ComponentMeshPermutation_quaternion = new THREE.Quaternion();
|
ComponentMeshPermutation_quaternion = new THREE.Quaternion();
|
||||||
ComponentMeshPermutation_quaternionCopy = new THREE.Quaternion();
|
ComponentMeshPermutation_quaternionCopy = new THREE.Quaternion();
|
||||||
|
@ -68,3 +69,4 @@ GameLib.D3.ComponentMeshPermutation.prototype.onLateUpdate = function(
|
||||||
parentEntity.mesh.scale.copy(ComponentMeshPermutation_scale);
|
parentEntity.mesh.scale.copy(ComponentMeshPermutation_scale);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//#endif
|
|
@ -31,10 +31,12 @@ GameLib.D3.ComponentTriggerBoxBox = function ComponentTriggerBoxBox(
|
||||||
this.onLeave = onLeave || null;
|
this.onLeave = onLeave || null;
|
||||||
this.onSetParent = onSetParent || null;
|
this.onSetParent = onSetParent || null;
|
||||||
|
|
||||||
// runtime code
|
// defines code
|
||||||
this.entitiesInside = [];
|
this.entitiesInside = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//#ifdef RUNTIME__
|
||||||
if(typeof THREE != "undefined") {
|
if(typeof THREE != "undefined") {
|
||||||
ComponentTriggerBoxBox_BB = new THREE.Box3();
|
ComponentTriggerBoxBox_BB = new THREE.Box3();
|
||||||
ComponentTriggerBoxBox_BBEntity = new THREE.Box3();
|
ComponentTriggerBoxBox_BBEntity = new THREE.Box3();
|
||||||
|
@ -89,6 +91,8 @@ GameLib.D3.ComponentTriggerBoxBox.prototype.onUpdate = function(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
GameLib.D3.ComponentTriggerBoxBox.prototype.onSetParentEntity = function(
|
GameLib.D3.ComponentTriggerBoxBox.prototype.onSetParentEntity = function(
|
||||||
parentScene,
|
parentScene,
|
||||||
|
|
|
@ -29,10 +29,11 @@ GameLib.D3.ComponentTriggerBoxSphere = function ComponentTriggerBoxSphere(
|
||||||
this.onLeave = onLeave || null;
|
this.onLeave = onLeave || null;
|
||||||
this.onSetParent = onSetParent || null;
|
this.onSetParent = onSetParent || null;
|
||||||
|
|
||||||
// runtime code
|
// defines code
|
||||||
this.entitiesInside = [];
|
this.entitiesInside = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//#ifdef RUNTIME__
|
||||||
if(typeof THREE != "undefined") {
|
if(typeof THREE != "undefined") {
|
||||||
ComponentTriggerBoxSphere_TargetPosition_Vec3 = new THREE.Vector3();
|
ComponentTriggerBoxSphere_TargetPosition_Vec3 = new THREE.Vector3();
|
||||||
ComponentTriggerBoxSphere_TargetRadius = 0.0;
|
ComponentTriggerBoxSphere_TargetRadius = 0.0;
|
||||||
|
@ -115,6 +116,8 @@ GameLib.D3.ComponentTriggerBoxSphere.prototype.onUpdate = function(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//#endif
|
||||||
|
|
||||||
GameLib.D3.ComponentTriggerBoxSphere.prototype.onSetParentEntity = function(
|
GameLib.D3.ComponentTriggerBoxSphere.prototype.onSetParentEntity = function(
|
||||||
parentScene,
|
parentScene,
|
||||||
parentEntity
|
parentEntity
|
||||||
|
|
|
@ -41,10 +41,11 @@ GameLib.D3.ComponentTriggerSphereSphere = function ComponentTriggerSphereSphere(
|
||||||
this.onLeave = onLeave || null;
|
this.onLeave = onLeave || null;
|
||||||
this.onSetParent = onSetParent || null;
|
this.onSetParent = onSetParent || null;
|
||||||
|
|
||||||
// runtime code
|
// defines code
|
||||||
this.entitiesInside = [];
|
this.entitiesInside = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//#ifdef RUNTIME__
|
||||||
if(typeof THREE != "undefined") {
|
if(typeof THREE != "undefined") {
|
||||||
ComponentTriggerSphereSphere_spherePosition_Vector3 = new THREE.Vector3();
|
ComponentTriggerSphereSphere_spherePosition_Vector3 = new THREE.Vector3();
|
||||||
ComponentTriggerSphereSphere_targetBoundingSpherePosition_Vector3 = new THREE.Vector3();
|
ComponentTriggerSphereSphere_targetBoundingSpherePosition_Vector3 = new THREE.Vector3();
|
||||||
|
@ -126,6 +127,8 @@ GameLib.D3.ComponentTriggerSphereSphere.prototype.onUpdate = function(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//#endif
|
||||||
|
|
||||||
GameLib.D3.ComponentTriggerSphereSphere.prototype.onSetParentEntity = function(
|
GameLib.D3.ComponentTriggerSphereSphere.prototype.onSetParentEntity = function(
|
||||||
parentScene,
|
parentScene,
|
||||||
parentEntity
|
parentEntity
|
||||||
|
|
|
@ -30,6 +30,8 @@ GameLib.D3.ComponentVehicleAIObjectAvoidance = function(
|
||||||
console.log("constructor for : ComponentVehicleAIObjectAvoidance");
|
console.log("constructor for : ComponentVehicleAIObjectAvoidance");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//#ifdef RUNTIME__
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
///////////////////////// Methods to override ///////////////////////////
|
///////////////////////// Methods to override ///////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -564,3 +566,5 @@ GameLib.D3.ComponentVehicleAIObjectAvoidance.prototype.onUpdate = function(
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//#endif
|
|
@ -49,6 +49,7 @@ GameLib.D3.ComponentVehicleAIPathSteering.prototype.onSetParentEntity = function
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//#ifdef RUNTIME__
|
||||||
GameLib.D3.ComponentVehicleAIPathSteering.prototype.onUpdate = function(
|
GameLib.D3.ComponentVehicleAIPathSteering.prototype.onUpdate = function(
|
||||||
deltaTime,
|
deltaTime,
|
||||||
parentEntity
|
parentEntity
|
||||||
|
@ -240,3 +241,4 @@ GameLib.D3.ComponentVehicleAIPathSteering.prototype.onUpdate = function(
|
||||||
this.raycastVehicleComponent.instance.applyEngineForce(-3500, 2);
|
this.raycastVehicleComponent.instance.applyEngineForce(-3500, 2);
|
||||||
this.raycastVehicleComponent.instance.applyEngineForce(-3500, 3);
|
this.raycastVehicleComponent.instance.applyEngineForce(-3500, 3);
|
||||||
};
|
};
|
||||||
|
//#endif
|
Loading…
Reference in New Issue