fixes from integration tests
parent
39258d2afe
commit
7e8e3155bd
File diff suppressed because one or more lines are too long
|
@ -5,6 +5,15 @@ if (typeof GameLib == 'undefined') {
|
||||||
if (typeof GameLib.D3 == 'undefined') {
|
if (typeof GameLib.D3 == 'undefined') {
|
||||||
GameLib.D3 = function(){};
|
GameLib.D3 = function(){};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof Q == 'undefined') {
|
||||||
|
if (typeof require == 'undefined') {
|
||||||
|
console.warn('You need the Q promise library for the GameLib.D3');
|
||||||
|
throw new Error('You need the Q promise library for the GameLib.D3');
|
||||||
|
}
|
||||||
|
|
||||||
|
var Q = require('q');
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* BoneWeight object - associates a vertex to a bone with some weight
|
* BoneWeight object - associates a vertex to a bone with some weight
|
||||||
* @param boneIndex int
|
* @param boneIndex int
|
||||||
|
@ -1368,17 +1377,17 @@ GameLib.D3.Material.TYPE_MULTI_MATERIAL= "MultiMaterial";
|
||||||
* Creates an instance Material from a GameLib.D3.Material
|
* Creates an instance Material from a GameLib.D3.Material
|
||||||
* @param gameLibMaterial GameLib.D3.Material
|
* @param gameLibMaterial GameLib.D3.Material
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param uploadPath String
|
* @param uploadUrl String
|
||||||
* @param progressCallback
|
* @param progressCallback
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Material.createInstanceMaterial = function(
|
GameLib.D3.Material.createInstanceMaterial = function(
|
||||||
gameLibMaterial,
|
gameLibMaterial,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var defer = this.Q.defer();
|
var defer = Q.defer();
|
||||||
|
|
||||||
var instanceMaterial = null;
|
var instanceMaterial = null;
|
||||||
|
|
||||||
|
@ -1531,7 +1540,7 @@ GameLib.D3.Material.createInstanceMaterial = function(
|
||||||
blenderMaps,
|
blenderMaps,
|
||||||
instanceMaterial,
|
instanceMaterial,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
);
|
);
|
||||||
Q.all(textureMaps).then(
|
Q.all(textureMaps).then(
|
||||||
|
@ -2496,10 +2505,6 @@ GameLib.D3.RigidBody.prototype.createRigidBodyInstance = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (typeof require != 'undefined') {
|
|
||||||
var Q = require('q');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scenes are objects putting meshes into 'world space'
|
* Scenes are objects putting meshes into 'world space'
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -2577,7 +2582,7 @@ GameLib.D3.Scene = function(
|
||||||
* @param gameLibScene GameLib.D3.Scene
|
* @param gameLibScene GameLib.D3.Scene
|
||||||
* @param onLoaded callback
|
* @param onLoaded callback
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param uploadPath String
|
* @param uploadUrl String
|
||||||
* @param progressCallback callback
|
* @param progressCallback callback
|
||||||
* @param apiUrl
|
* @param apiUrl
|
||||||
*/
|
*/
|
||||||
|
@ -2585,7 +2590,7 @@ GameLib.D3.Scene.loadSceneFromApi = function(
|
||||||
gameLibScene,
|
gameLibScene,
|
||||||
onLoaded,
|
onLoaded,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback,
|
progressCallback,
|
||||||
apiUrl
|
apiUrl
|
||||||
) {
|
) {
|
||||||
|
@ -2791,7 +2796,7 @@ GameLib.D3.Scene.loadSceneFromApi = function(
|
||||||
onLoaded,
|
onLoaded,
|
||||||
false,
|
false,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2807,7 +2812,7 @@ GameLib.D3.Scene.loadSceneFromApi = function(
|
||||||
* @param onLoaded callback when all meshes have loaded
|
* @param onLoaded callback when all meshes have loaded
|
||||||
* @param computeNormals set to true to compute new face and vertex normals during load
|
* @param computeNormals set to true to compute new face and vertex normals during load
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param uploadPath
|
* @param uploadUrl
|
||||||
* @param progressCallback
|
* @param progressCallback
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Scene.loadScene = function(
|
GameLib.D3.Scene.loadScene = function(
|
||||||
|
@ -2815,12 +2820,14 @@ GameLib.D3.Scene.loadScene = function(
|
||||||
onLoaded,
|
onLoaded,
|
||||||
computeNormals,
|
computeNormals,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
) {
|
) {
|
||||||
|
|
||||||
console.log("loading scene " + gameLibScene.name);
|
console.log("loading scene " + gameLibScene.name);
|
||||||
|
|
||||||
|
graphics.isNotThreeThrow();
|
||||||
|
|
||||||
var meshQ = [];
|
var meshQ = [];
|
||||||
|
|
||||||
for (var m = 0; m < gameLibScene.meshes.length; m++) {
|
for (var m = 0; m < gameLibScene.meshes.length; m++) {
|
||||||
|
@ -2968,7 +2975,7 @@ GameLib.D3.Scene.loadScene = function(
|
||||||
GameLib.D3.Material.createInstanceMaterial(
|
GameLib.D3.Material.createInstanceMaterial(
|
||||||
materials[mi],
|
materials[mi],
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -3109,11 +3116,11 @@ GameLib.D3.Scene.loadScene = function(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}.catch(
|
}).catch(
|
||||||
function(error){
|
function(error){
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
));
|
);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Physics Shape Superset
|
* Physics Shape Superset
|
||||||
|
@ -3328,10 +3335,6 @@ GameLib.D3.Physics.Solver = function(
|
||||||
GameLib.D3.Physics.SPLIT_SOLVER = 0x1;
|
GameLib.D3.Physics.SPLIT_SOLVER = 0x1;
|
||||||
GameLib.D3.Physics.GS_SOLVER = 0x2;
|
GameLib.D3.Physics.GS_SOLVER = 0x2;
|
||||||
|
|
||||||
if (typeof require != 'undefined') {
|
|
||||||
var Q = require('q');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Texture Superset
|
* Texture Superset
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -3543,7 +3546,7 @@ GameLib.D3.Texture.TYPE_RGBD_ENCODING = 3006; // MAXRANGE IS 256.
|
||||||
* @param instanceMaterial
|
* @param instanceMaterial
|
||||||
* @param instanceMaterialMapType
|
* @param instanceMaterialMapType
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param uploadPath String
|
* @param uploadUrl String
|
||||||
* @param progressCallback
|
* @param progressCallback
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
|
@ -3552,7 +3555,7 @@ GameLib.D3.Texture.loadMap = function(
|
||||||
instanceMaterial,
|
instanceMaterial,
|
||||||
instanceMaterialMapType,
|
instanceMaterialMapType,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -3566,7 +3569,7 @@ GameLib.D3.Texture.loadMap = function(
|
||||||
/**
|
/**
|
||||||
* Else, load from upload source
|
* Else, load from upload source
|
||||||
*/
|
*/
|
||||||
imagePath = uploadPath + '/' + gameLibTexture.image.filename;
|
imagePath = uploadUrl + '/' + gameLibTexture.image.filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imagePath) {
|
if (imagePath) {
|
||||||
|
@ -3635,7 +3638,7 @@ GameLib.D3.Texture.loadMap = function(
|
||||||
* @param blenderMaps
|
* @param blenderMaps
|
||||||
* @param instanceMaterial
|
* @param instanceMaterial
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param uploadPath String
|
* @param uploadUrl String
|
||||||
* @param progressCallback
|
* @param progressCallback
|
||||||
* @returns Q[]
|
* @returns Q[]
|
||||||
*/
|
*/
|
||||||
|
@ -3644,7 +3647,7 @@ GameLib.D3.Texture.loadMaps = function(
|
||||||
blenderMaps,
|
blenderMaps,
|
||||||
instanceMaterial,
|
instanceMaterial,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -3720,7 +3723,7 @@ GameLib.D3.Texture.loadMaps = function(
|
||||||
instanceMaterial,
|
instanceMaterial,
|
||||||
instanceMap,
|
instanceMap,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,4 +4,13 @@ if (typeof GameLib == 'undefined') {
|
||||||
|
|
||||||
if (typeof GameLib.D3 == 'undefined') {
|
if (typeof GameLib.D3 == 'undefined') {
|
||||||
GameLib.D3 = function(){};
|
GameLib.D3 = function(){};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof Q == 'undefined') {
|
||||||
|
if (typeof require == 'undefined') {
|
||||||
|
console.warn('You need the Q promise library for the GameLib.D3');
|
||||||
|
throw new Error('You need the Q promise library for the GameLib.D3');
|
||||||
|
}
|
||||||
|
|
||||||
|
var Q = require('q');
|
||||||
}
|
}
|
|
@ -510,17 +510,17 @@ GameLib.D3.Material.TYPE_MULTI_MATERIAL= "MultiMaterial";
|
||||||
* Creates an instance Material from a GameLib.D3.Material
|
* Creates an instance Material from a GameLib.D3.Material
|
||||||
* @param gameLibMaterial GameLib.D3.Material
|
* @param gameLibMaterial GameLib.D3.Material
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param uploadPath String
|
* @param uploadUrl String
|
||||||
* @param progressCallback
|
* @param progressCallback
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Material.createInstanceMaterial = function(
|
GameLib.D3.Material.createInstanceMaterial = function(
|
||||||
gameLibMaterial,
|
gameLibMaterial,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var defer = this.Q.defer();
|
var defer = Q.defer();
|
||||||
|
|
||||||
var instanceMaterial = null;
|
var instanceMaterial = null;
|
||||||
|
|
||||||
|
@ -673,7 +673,7 @@ GameLib.D3.Material.createInstanceMaterial = function(
|
||||||
blenderMaps,
|
blenderMaps,
|
||||||
instanceMaterial,
|
instanceMaterial,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
);
|
);
|
||||||
Q.all(textureMaps).then(
|
Q.all(textureMaps).then(
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
if (typeof require != 'undefined') {
|
|
||||||
var Q = require('q');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scenes are objects putting meshes into 'world space'
|
* Scenes are objects putting meshes into 'world space'
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -79,7 +75,7 @@ GameLib.D3.Scene = function(
|
||||||
* @param gameLibScene GameLib.D3.Scene
|
* @param gameLibScene GameLib.D3.Scene
|
||||||
* @param onLoaded callback
|
* @param onLoaded callback
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param uploadPath String
|
* @param uploadUrl String
|
||||||
* @param progressCallback callback
|
* @param progressCallback callback
|
||||||
* @param apiUrl
|
* @param apiUrl
|
||||||
*/
|
*/
|
||||||
|
@ -87,7 +83,7 @@ GameLib.D3.Scene.loadSceneFromApi = function(
|
||||||
gameLibScene,
|
gameLibScene,
|
||||||
onLoaded,
|
onLoaded,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback,
|
progressCallback,
|
||||||
apiUrl
|
apiUrl
|
||||||
) {
|
) {
|
||||||
|
@ -293,7 +289,7 @@ GameLib.D3.Scene.loadSceneFromApi = function(
|
||||||
onLoaded,
|
onLoaded,
|
||||||
false,
|
false,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +305,7 @@ GameLib.D3.Scene.loadSceneFromApi = function(
|
||||||
* @param onLoaded callback when all meshes have loaded
|
* @param onLoaded callback when all meshes have loaded
|
||||||
* @param computeNormals set to true to compute new face and vertex normals during load
|
* @param computeNormals set to true to compute new face and vertex normals during load
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param uploadPath
|
* @param uploadUrl
|
||||||
* @param progressCallback
|
* @param progressCallback
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Scene.loadScene = function(
|
GameLib.D3.Scene.loadScene = function(
|
||||||
|
@ -317,12 +313,14 @@ GameLib.D3.Scene.loadScene = function(
|
||||||
onLoaded,
|
onLoaded,
|
||||||
computeNormals,
|
computeNormals,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
) {
|
) {
|
||||||
|
|
||||||
console.log("loading scene " + gameLibScene.name);
|
console.log("loading scene " + gameLibScene.name);
|
||||||
|
|
||||||
|
graphics.isNotThreeThrow();
|
||||||
|
|
||||||
var meshQ = [];
|
var meshQ = [];
|
||||||
|
|
||||||
for (var m = 0; m < gameLibScene.meshes.length; m++) {
|
for (var m = 0; m < gameLibScene.meshes.length; m++) {
|
||||||
|
@ -470,7 +468,7 @@ GameLib.D3.Scene.loadScene = function(
|
||||||
GameLib.D3.Material.createInstanceMaterial(
|
GameLib.D3.Material.createInstanceMaterial(
|
||||||
materials[mi],
|
materials[mi],
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -611,9 +609,9 @@ GameLib.D3.Scene.loadScene = function(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}.catch(
|
}).catch(
|
||||||
function(error){
|
function(error){
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
));
|
);
|
||||||
};
|
};
|
|
@ -1,7 +1,3 @@
|
||||||
if (typeof require != 'undefined') {
|
|
||||||
var Q = require('q');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Texture Superset
|
* Texture Superset
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -213,7 +209,7 @@ GameLib.D3.Texture.TYPE_RGBD_ENCODING = 3006; // MAXRANGE IS 256.
|
||||||
* @param instanceMaterial
|
* @param instanceMaterial
|
||||||
* @param instanceMaterialMapType
|
* @param instanceMaterialMapType
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param uploadPath String
|
* @param uploadUrl String
|
||||||
* @param progressCallback
|
* @param progressCallback
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
|
@ -222,7 +218,7 @@ GameLib.D3.Texture.loadMap = function(
|
||||||
instanceMaterial,
|
instanceMaterial,
|
||||||
instanceMaterialMapType,
|
instanceMaterialMapType,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -236,7 +232,7 @@ GameLib.D3.Texture.loadMap = function(
|
||||||
/**
|
/**
|
||||||
* Else, load from upload source
|
* Else, load from upload source
|
||||||
*/
|
*/
|
||||||
imagePath = uploadPath + '/' + gameLibTexture.image.filename;
|
imagePath = uploadUrl + '/' + gameLibTexture.image.filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imagePath) {
|
if (imagePath) {
|
||||||
|
@ -305,7 +301,7 @@ GameLib.D3.Texture.loadMap = function(
|
||||||
* @param blenderMaps
|
* @param blenderMaps
|
||||||
* @param instanceMaterial
|
* @param instanceMaterial
|
||||||
* @param graphics GameLib.D3.Graphics
|
* @param graphics GameLib.D3.Graphics
|
||||||
* @param uploadPath String
|
* @param uploadUrl String
|
||||||
* @param progressCallback
|
* @param progressCallback
|
||||||
* @returns Q[]
|
* @returns Q[]
|
||||||
*/
|
*/
|
||||||
|
@ -314,7 +310,7 @@ GameLib.D3.Texture.loadMaps = function(
|
||||||
blenderMaps,
|
blenderMaps,
|
||||||
instanceMaterial,
|
instanceMaterial,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -390,7 +386,7 @@ GameLib.D3.Texture.loadMaps = function(
|
||||||
instanceMaterial,
|
instanceMaterial,
|
||||||
instanceMap,
|
instanceMap,
|
||||||
graphics,
|
graphics,
|
||||||
uploadPath,
|
uploadUrl,
|
||||||
progressCallback
|
progressCallback
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue