update codebase

This commit is contained in:
yushijinhun 2018-05-13 12:05:28 +08:00
parent 17822afd3d
commit b9d41d6090
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
7 changed files with 25 additions and 55 deletions

View File

@ -1 +1 @@
1ead26e313137a397c32470b2aedc62b8cc2495f 482f7e8d96080b8ce6374fdc40d7a0b2eb3d549c

View File

@ -55,14 +55,6 @@
}; };
}(); }();
var inherits = function (subClass, superClass) { var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) { if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
@ -79,16 +71,6 @@
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}; };
var possibleConstructorReturn = function (self, call) { var possibleConstructorReturn = function (self, call) {
if (!self) { if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@ -533,17 +515,17 @@
this.skinCanvas = document.createElement("canvas"); this.skinCanvas = document.createElement("canvas");
this.skinTexture = new THREE.Texture(this.skinCanvas); this.skinTexture = new THREE.Texture(this.skinCanvas);
this.skinTexture.magFilter = THREE.NearestFilter; this.skinTexture.magFilter = THREE.NearestFilter;
this.skinTexture.minFilter = THREE.NearestMipMapNearestFilter; this.skinTexture.minFilter = THREE.NearestFilter;
this.capeImg = new Image(); this.capeImg = new Image();
this.capeCanvas = document.createElement("canvas"); this.capeCanvas = document.createElement("canvas");
this.capeTexture = new THREE.Texture(this.capeCanvas); this.capeTexture = new THREE.Texture(this.capeCanvas);
this.capeTexture.magFilter = THREE.NearestFilter; this.capeTexture.magFilter = THREE.NearestFilter;
this.capeTexture.minFilter = THREE.NearestMipMapNearestFilter; this.capeTexture.minFilter = THREE.NearestFilter;
this.layer1Material = new THREE.MeshBasicMaterial({ map: this.skinTexture, side: THREE.FrontSide }); this.layer1Material = new THREE.MeshBasicMaterial({ map: this.skinTexture, side: THREE.FrontSide });
this.layer2Material = new THREE.MeshBasicMaterial({ map: this.skinTexture, transparent: true, opacity: 1, side: THREE.DoubleSide }); this.layer2Material = new THREE.MeshBasicMaterial({ map: this.skinTexture, transparent: true, opacity: 1, side: THREE.DoubleSide, alphaTest: 0.5 });
this.capeMaterial = new THREE.MeshBasicMaterial({ map: this.capeTexture }); this.capeMaterial = new THREE.MeshBasicMaterial({ map: this.capeTexture, transparent: true, opacity: 1, side: THREE.DoubleSide, alphaTest: 0.5 });
// scene // scene
this.scene = new THREE.Scene(); this.scene = new THREE.Scene();
@ -564,7 +546,7 @@
this.scene.add(this.playerObject); this.scene.add(this.playerObject);
// texture loading // texture loading
this.skinImg.crossOrigin = ""; this.skinImg.crossOrigin = "anonymous";
this.skinImg.onerror = function () { this.skinImg.onerror = function () {
return console.error("Failed loading " + _this.skinImg.src); return console.error("Failed loading " + _this.skinImg.src);
}; };
@ -601,7 +583,7 @@
_this.playerObject.skin.visible = true; _this.playerObject.skin.visible = true;
}; };
this.capeImg.crossOrigin = ""; this.capeImg.crossOrigin = "anonymous";
this.capeImg.onerror = function () { this.capeImg.onerror = function () {
return console.error("Failed loading " + _this.capeImg.src); return console.error("Failed loading " + _this.capeImg.src);
}; };
@ -1125,6 +1107,9 @@
panStart.copy(panEnd); panStart.copy(panEnd);
scope.update(); scope.update();
} }
//
// event handlers - FSM: listen for events and reset state
//
function onMouseDown(event) { function onMouseDown(event) {
if (scope.enabled === false) return; if (scope.enabled === false) return;
switch (event.button) { switch (event.button) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -25,7 +25,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
import { Vector2, Group, BoxGeometry, Mesh, Texture, NearestFilter, NearestMipMapNearestFilter, MeshBasicMaterial, FrontSide, DoubleSide, Scene, PerspectiveCamera, WebGLRenderer, Vector3, MOUSE, Quaternion, Spherical, OrthographicCamera, EventDispatcher } from 'three'; import { Vector2, Group, BoxGeometry, Mesh, Texture, NearestFilter, MeshBasicMaterial, FrontSide, DoubleSide, Scene, PerspectiveCamera, WebGLRenderer, Vector3, MOUSE, Quaternion, Spherical, OrthographicCamera, EventDispatcher } from 'three';
var classCallCheck = function (instance, Constructor) { var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) { if (!(instance instanceof Constructor)) {
@ -51,14 +51,6 @@ var createClass = function () {
}; };
}(); }();
var inherits = function (subClass, superClass) { var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) { if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
@ -75,16 +67,6 @@ var inherits = function (subClass, superClass) {
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}; };
var possibleConstructorReturn = function (self, call) { var possibleConstructorReturn = function (self, call) {
if (!self) { if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@ -529,17 +511,17 @@ var SkinViewer = function () {
this.skinCanvas = document.createElement("canvas"); this.skinCanvas = document.createElement("canvas");
this.skinTexture = new Texture(this.skinCanvas); this.skinTexture = new Texture(this.skinCanvas);
this.skinTexture.magFilter = NearestFilter; this.skinTexture.magFilter = NearestFilter;
this.skinTexture.minFilter = NearestMipMapNearestFilter; this.skinTexture.minFilter = NearestFilter;
this.capeImg = new Image(); this.capeImg = new Image();
this.capeCanvas = document.createElement("canvas"); this.capeCanvas = document.createElement("canvas");
this.capeTexture = new Texture(this.capeCanvas); this.capeTexture = new Texture(this.capeCanvas);
this.capeTexture.magFilter = NearestFilter; this.capeTexture.magFilter = NearestFilter;
this.capeTexture.minFilter = NearestMipMapNearestFilter; this.capeTexture.minFilter = NearestFilter;
this.layer1Material = new MeshBasicMaterial({ map: this.skinTexture, side: FrontSide }); this.layer1Material = new MeshBasicMaterial({ map: this.skinTexture, side: FrontSide });
this.layer2Material = new MeshBasicMaterial({ map: this.skinTexture, transparent: true, opacity: 1, side: DoubleSide }); this.layer2Material = new MeshBasicMaterial({ map: this.skinTexture, transparent: true, opacity: 1, side: DoubleSide, alphaTest: 0.5 });
this.capeMaterial = new MeshBasicMaterial({ map: this.capeTexture }); this.capeMaterial = new MeshBasicMaterial({ map: this.capeTexture, transparent: true, opacity: 1, side: DoubleSide, alphaTest: 0.5 });
// scene // scene
this.scene = new Scene(); this.scene = new Scene();
@ -560,7 +542,7 @@ var SkinViewer = function () {
this.scene.add(this.playerObject); this.scene.add(this.playerObject);
// texture loading // texture loading
this.skinImg.crossOrigin = ""; this.skinImg.crossOrigin = "anonymous";
this.skinImg.onerror = function () { this.skinImg.onerror = function () {
return console.error("Failed loading " + _this.skinImg.src); return console.error("Failed loading " + _this.skinImg.src);
}; };
@ -597,7 +579,7 @@ var SkinViewer = function () {
_this.playerObject.skin.visible = true; _this.playerObject.skin.visible = true;
}; };
this.capeImg.crossOrigin = ""; this.capeImg.crossOrigin = "anonymous";
this.capeImg.onerror = function () { this.capeImg.onerror = function () {
return console.error("Failed loading " + _this.capeImg.src); return console.error("Failed loading " + _this.capeImg.src);
}; };
@ -1121,6 +1103,9 @@ var OrbitControls = function (_THREE$EventDispatche) {
panStart.copy(panEnd); panStart.copy(panEnd);
scope.update(); scope.update();
} }
//
// event handlers - FSM: listen for events and reset state
//
function onMouseDown(event) { function onMouseDown(event) {
if (scope.enabled === false) return; if (scope.enabled === false) return;
switch (event.button) { switch (event.button) {

File diff suppressed because one or more lines are too long