|
@@ -41677,6 +41677,7 @@ var BABYLON;
|
|
_this._floats = {};
|
|
_this._floats = {};
|
|
_this._floatsArrays = {};
|
|
_this._floatsArrays = {};
|
|
_this._colors3 = {};
|
|
_this._colors3 = {};
|
|
|
|
+ _this._colors3Arrays = {};
|
|
_this._colors4 = {};
|
|
_this._colors4 = {};
|
|
_this._vectors2 = {};
|
|
_this._vectors2 = {};
|
|
_this._vectors3 = {};
|
|
_this._vectors3 = {};
|
|
@@ -41741,6 +41742,14 @@ var BABYLON;
|
|
this._colors3[name] = value;
|
|
this._colors3[name] = value;
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
|
|
+ ShaderMaterial.prototype.setColor3Array = function (name, value) {
|
|
|
|
+ this._checkUniform(name);
|
|
|
|
+ this._colors3Arrays[name] = value.reduce(function (arr, color) {
|
|
|
|
+ color.toArray(arr, arr.length);
|
|
|
|
+ return arr;
|
|
|
|
+ }, []);
|
|
|
|
+ return this;
|
|
|
|
+ };
|
|
ShaderMaterial.prototype.setColor4 = function (name, value) {
|
|
ShaderMaterial.prototype.setColor4 = function (name, value) {
|
|
this._checkUniform(name);
|
|
this._checkUniform(name);
|
|
this._colors4[name] = value;
|
|
this._colors4[name] = value;
|
|
@@ -41915,6 +41924,9 @@ var BABYLON;
|
|
for (name in this._colors3) {
|
|
for (name in this._colors3) {
|
|
this._effect.setColor3(name, this._colors3[name]);
|
|
this._effect.setColor3(name, this._colors3[name]);
|
|
}
|
|
}
|
|
|
|
+ for (name in this._colors3Arrays) {
|
|
|
|
+ this._effect.setArray3(name, this._colors3Arrays[name]);
|
|
|
|
+ }
|
|
// Color4
|
|
// Color4
|
|
for (name in this._colors4) {
|
|
for (name in this._colors4) {
|
|
var color = this._colors4[name];
|
|
var color = this._colors4[name];
|
|
@@ -42038,6 +42050,11 @@ var BABYLON;
|
|
for (name in this._colors3) {
|
|
for (name in this._colors3) {
|
|
serializationObject.colors3[name] = this._colors3[name].asArray();
|
|
serializationObject.colors3[name] = this._colors3[name].asArray();
|
|
}
|
|
}
|
|
|
|
+ // Color3 array
|
|
|
|
+ serializationObject.colors3Arrays = {};
|
|
|
|
+ for (name in this._colors3Arrays) {
|
|
|
|
+ serializationObject.colors3Arrays[name] = this._colors3Arrays[name];
|
|
|
|
+ }
|
|
// Color4
|
|
// Color4
|
|
serializationObject.colors4 = {};
|
|
serializationObject.colors4 = {};
|
|
for (name in this._colors4) {
|
|
for (name in this._colors4) {
|
|
@@ -42108,6 +42125,19 @@ var BABYLON;
|
|
for (name in source.colors3) {
|
|
for (name in source.colors3) {
|
|
material.setColor3(name, BABYLON.Color3.FromArray(source.colors3[name]));
|
|
material.setColor3(name, BABYLON.Color3.FromArray(source.colors3[name]));
|
|
}
|
|
}
|
|
|
|
+ // Color3 arrays
|
|
|
|
+ for (name in source.colors3Arrays) {
|
|
|
|
+ var colors = source.colors3Arrays[name].reduce(function (arr, num, i) {
|
|
|
|
+ if (i % 3 === 0) {
|
|
|
|
+ arr.push([num]);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ arr[arr.length - 1].push(num);
|
|
|
|
+ }
|
|
|
|
+ return arr;
|
|
|
|
+ }, []).map(function (color) { return BABYLON.Color3.FromArray(color); });
|
|
|
|
+ material.setColor3Array(name, colors);
|
|
|
|
+ }
|
|
// Color4
|
|
// Color4
|
|
for (name in source.colors4) {
|
|
for (name in source.colors4) {
|
|
material.setColor4(name, BABYLON.Color4.FromArray(source.colors4[name]));
|
|
material.setColor4(name, BABYLON.Color4.FromArray(source.colors4[name]));
|
|
@@ -50062,19 +50092,23 @@ var BABYLON;
|
|
(function (PoseEnabledControllerType) {
|
|
(function (PoseEnabledControllerType) {
|
|
PoseEnabledControllerType[PoseEnabledControllerType["VIVE"] = 0] = "VIVE";
|
|
PoseEnabledControllerType[PoseEnabledControllerType["VIVE"] = 0] = "VIVE";
|
|
PoseEnabledControllerType[PoseEnabledControllerType["OCULUS"] = 1] = "OCULUS";
|
|
PoseEnabledControllerType[PoseEnabledControllerType["OCULUS"] = 1] = "OCULUS";
|
|
- PoseEnabledControllerType[PoseEnabledControllerType["GENERIC"] = 2] = "GENERIC";
|
|
|
|
|
|
+ PoseEnabledControllerType[PoseEnabledControllerType["WINDOWS"] = 2] = "WINDOWS";
|
|
|
|
+ PoseEnabledControllerType[PoseEnabledControllerType["GENERIC"] = 3] = "GENERIC";
|
|
})(PoseEnabledControllerType = BABYLON.PoseEnabledControllerType || (BABYLON.PoseEnabledControllerType = {}));
|
|
})(PoseEnabledControllerType = BABYLON.PoseEnabledControllerType || (BABYLON.PoseEnabledControllerType = {}));
|
|
var PoseEnabledControllerHelper = (function () {
|
|
var PoseEnabledControllerHelper = (function () {
|
|
function PoseEnabledControllerHelper() {
|
|
function PoseEnabledControllerHelper() {
|
|
}
|
|
}
|
|
PoseEnabledControllerHelper.InitiateController = function (vrGamepad) {
|
|
PoseEnabledControllerHelper.InitiateController = function (vrGamepad) {
|
|
- // for now, only Oculus and Vive are supported
|
|
|
|
|
|
+ // Oculus Touch
|
|
if (vrGamepad.id.indexOf('Oculus Touch') !== -1) {
|
|
if (vrGamepad.id.indexOf('Oculus Touch') !== -1) {
|
|
return new OculusTouchController(vrGamepad);
|
|
return new OculusTouchController(vrGamepad);
|
|
}
|
|
}
|
|
- else {
|
|
|
|
|
|
+ else if (vrGamepad.id.toLowerCase().indexOf('openvr') !== -1) {
|
|
return new ViveController(vrGamepad);
|
|
return new ViveController(vrGamepad);
|
|
}
|
|
}
|
|
|
|
+ else {
|
|
|
|
+ return new GenericController(vrGamepad);
|
|
|
|
+ }
|
|
};
|
|
};
|
|
return PoseEnabledControllerHelper;
|
|
return PoseEnabledControllerHelper;
|
|
}());
|
|
}());
|
|
@@ -50214,6 +50248,13 @@ var BABYLON;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
WebVRController.prototype._setButtonValue = function (newState, currentState, buttonIndex) {
|
|
WebVRController.prototype._setButtonValue = function (newState, currentState, buttonIndex) {
|
|
|
|
+ if (!newState) {
|
|
|
|
+ newState = {
|
|
|
|
+ pressed: false,
|
|
|
|
+ touched: false,
|
|
|
|
+ value: 0
|
|
|
|
+ };
|
|
|
|
+ }
|
|
if (!currentState) {
|
|
if (!currentState) {
|
|
this._buttons[buttonIndex] = {
|
|
this._buttons[buttonIndex] = {
|
|
pressed: newState.pressed,
|
|
pressed: newState.pressed,
|
|
@@ -50467,6 +50508,28 @@ var BABYLON;
|
|
return ViveController;
|
|
return ViveController;
|
|
}(WebVRController));
|
|
}(WebVRController));
|
|
BABYLON.ViveController = ViveController;
|
|
BABYLON.ViveController = ViveController;
|
|
|
|
+ var GenericController = (function (_super) {
|
|
|
|
+ __extends(GenericController, _super);
|
|
|
|
+ function GenericController(vrGamepad) {
|
|
|
|
+ return _super.call(this, vrGamepad) || this;
|
|
|
|
+ }
|
|
|
|
+ GenericController.prototype.initControllerMesh = function (scene, meshLoaded) {
|
|
|
|
+ var _this = this;
|
|
|
|
+ BABYLON.SceneLoader.ImportMesh("", "http://yoda.blob.core.windows.net/models/", "genericvrcontroller.babylon", scene, function (newMeshes) {
|
|
|
|
+ _this._defaultModel = newMeshes[1];
|
|
|
|
+ if (meshLoaded) {
|
|
|
|
+ meshLoaded(_this._defaultModel);
|
|
|
|
+ }
|
|
|
|
+ _this.attachToMesh(_this._defaultModel);
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ GenericController.prototype.handleButtonChange = function (buttonIdx, state, changes) {
|
|
|
|
+ console.log("Button id: " + buttonIdx + "state: ");
|
|
|
|
+ console.dir(state);
|
|
|
|
+ };
|
|
|
|
+ return GenericController;
|
|
|
|
+ }(WebVRController));
|
|
|
|
+ BABYLON.GenericController = GenericController;
|
|
})(BABYLON || (BABYLON = {}));
|
|
})(BABYLON || (BABYLON = {}));
|
|
|
|
|
|
//# sourceMappingURL=babylon.extendedGamepad.js.map
|
|
//# sourceMappingURL=babylon.extendedGamepad.js.map
|