track made out of cubes.

beta.r3js.org
polygonboutique 2016-11-21 14:36:38 +01:00
parent 87bd9178bf
commit 2382e2a1d5
8 changed files with 121 additions and 9 deletions

View File

@ -6,6 +6,7 @@ var plumber = require('gulp-plumber');
var istanbul = require('gulp-istanbul');
var mocha = require('gulp-mocha');
var watch = require('gulp-watch');
var preprocessor = require('gulp-c-preprocessor');
gulp.task(
'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(
'default',
[
'build'
'build',
'compileRuntime',
'compileEditor'
],
function() {
return watch([
@ -69,7 +152,9 @@ gulp.task(
],
function() {
gulp.start([
'build'
'build',
'compileRuntime',
'compileEditor'
]);
})
}

View File

@ -22,4 +22,13 @@ if (typeof _ == 'undefined') {
}
var _ = require('lodash');
}
}
//#ifdef RUNTIME__
console.log("Loading runtime library...");
//#endif
//#ifdef EDITOR__
console.log("Loading editor library...");
//#endif

View File

@ -31,6 +31,7 @@ GameLib.D3.ComponentMeshPermutation = function ComponentMeshPermutation(
GameLib.D3.Utils.Extend(GameLib.D3.ComponentMeshPermutation, GameLib.D3.ComponentInterface);
};
//#ifdef RUNTIME__
if(typeof THREE != "undefined") {
ComponentMeshPermutation_quaternion = new THREE.Quaternion();
ComponentMeshPermutation_quaternionCopy = new THREE.Quaternion();
@ -67,4 +68,5 @@ GameLib.D3.ComponentMeshPermutation.prototype.onLateUpdate = function(
parentEntity.mesh.quaternion.copy(ComponentMeshPermutation_quaternion);
parentEntity.mesh.scale.copy(ComponentMeshPermutation_scale);
}
};
};
//#endif

View File

@ -31,10 +31,12 @@ GameLib.D3.ComponentTriggerBoxBox = function ComponentTriggerBoxBox(
this.onLeave = onLeave || null;
this.onSetParent = onSetParent || null;
// runtime code
// defines code
this.entitiesInside = [];
};
//#ifdef RUNTIME__
if(typeof THREE != "undefined") {
ComponentTriggerBoxBox_BB = 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(
parentScene,

View File

@ -29,10 +29,11 @@ GameLib.D3.ComponentTriggerBoxSphere = function ComponentTriggerBoxSphere(
this.onLeave = onLeave || null;
this.onSetParent = onSetParent || null;
// runtime code
// defines code
this.entitiesInside = [];
};
//#ifdef RUNTIME__
if(typeof THREE != "undefined") {
ComponentTriggerBoxSphere_TargetPosition_Vec3 = new THREE.Vector3();
ComponentTriggerBoxSphere_TargetRadius = 0.0;
@ -115,6 +116,8 @@ GameLib.D3.ComponentTriggerBoxSphere.prototype.onUpdate = function(
}
};
//#endif
GameLib.D3.ComponentTriggerBoxSphere.prototype.onSetParentEntity = function(
parentScene,
parentEntity

View File

@ -41,10 +41,11 @@ GameLib.D3.ComponentTriggerSphereSphere = function ComponentTriggerSphereSphere(
this.onLeave = onLeave || null;
this.onSetParent = onSetParent || null;
// runtime code
// defines code
this.entitiesInside = [];
};
//#ifdef RUNTIME__
if(typeof THREE != "undefined") {
ComponentTriggerSphereSphere_spherePosition_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(
parentScene,
parentEntity

View File

@ -30,6 +30,8 @@ GameLib.D3.ComponentVehicleAIObjectAvoidance = function(
console.log("constructor for : ComponentVehicleAIObjectAvoidance");
};
//#ifdef RUNTIME__
/////////////////////////////////////////////////////////////////////////
///////////////////////// Methods to override ///////////////////////////
/////////////////////////////////////////////////////////////////////////
@ -563,4 +565,6 @@ GameLib.D3.ComponentVehicleAIObjectAvoidance.prototype.onUpdate = function(
}
}
};
};
//#endif

View File

@ -49,6 +49,7 @@ GameLib.D3.ComponentVehicleAIPathSteering.prototype.onSetParentEntity = function
}
};
//#ifdef RUNTIME__
GameLib.D3.ComponentVehicleAIPathSteering.prototype.onUpdate = function(
deltaTime,
parentEntity
@ -239,4 +240,5 @@ GameLib.D3.ComponentVehicleAIPathSteering.prototype.onUpdate = function(
this.raycastVehicleComponent.instance.applyEngineForce(-3500, 2);
this.raycastVehicleComponent.instance.applyEngineForce(-3500, 3);
};
};
//#endif