Advertisement
Guest User

Untitled

a guest
Sep 26th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.88 KB | None | 0 0
  1. function skin3D(a, b) {
  2. this.width = 267, this.height = 250, this.radius = 30, this.alpha = 0, this.delta = -0.8, this.beta = 0.3, this.fps = 60, this.autoTurnAround = 0.005, this.animSpeed = 0.011, this.animDistanceK = 0.7, this.pause = !1, this.stop = !1, this.sensitivity = 1, this.backgroundColor = 16316664, this.zoom = [15, 60], this.maxBeta = Math.PI, this.img, this.skinTexture, this.cloakTexture, this.blockTexture, this.context, this.canvas, this.material1, this.material2, this.camera, this.scene, this.rendered, this.init = function() {
  3. this.camera = new THREE.PerspectiveCamera(75, this.width / this.height, 1, 1e4), this.scene = new THREE.Scene, cloakMesh = null, this.createSkinImage(a)
  4. }, this.createSkinImage = function(a) {
  5. var b = this;
  6. this.img = new Image, this.img.crossOrigin = "", this.img.src = a, this.img.onload = function() {
  7. if (b.write("Loaded Image " + b.img.src), null == b.skinTexture) {
  8. if (b.canvas = document.getElementById(canvas), b.canvas.width = b.img.width, b.canvas.height = b.img.width, b.skinTexture = new THREE.Texture(b.canvas), b.skinTexture.magFilter = THREE.NearestFilter, b.skinTexture.minFilter = THREE.NearestMipMapNearestFilter, b.material1 = new THREE.MeshBasicMaterial({
  9. map: b.skinTexture,
  10. side: THREE.FrontSide
  11. }), b.material2 = new THREE.MeshBasicMaterial({
  12. map: b.skinTexture,
  13. transparent: !0,
  14. opacity: 1,
  15. alphaTest: 0.5,
  16. side: THREE.DoubleSide
  17. }), b.context = b.GetCTX(b.canvas), !b.context) {
  18. return b.loadFail(1)
  19. };
  20. b.context.clearRect(0, 0, b.img.width, b.img.width), b.context.drawImage(b.img, 0, 0), b.skin2D.complete(b.context, b), b.callMethods(), b.write("Init end.")
  21. } else {
  22. b.canvas.width = b.img.width, b.canvas.height = b.img.width, b.context.clearRect(0, 0, b.img.width, b.img.width), b.context.drawImage(b.img, 0, 0), b.skin2D.complete(b.context, b), b.needsUpdates()
  23. }
  24. }, this.img.onerror = function() {
  25. b.GetSkinName() != default ? b.changeSkinName(default) : (b.write("Failed loading " + b.img.src), b.loadFail(2))
  26. }
  27. }, this.changeSkin = function(a) {
  28. this.img.src = a
  29. }, this.GetSkinName = function() {
  30. var a = this.img.src.split("/"),
  31. b = a[a.length - 1].split(".");
  32. return b[0]
  33. }, this.changeSkinName = function(a) {
  34. for (var b = this.img.src.split("/"), d = "", c = 0; c < b.length - 1; c++) {
  35. d += b[c] + "/"
  36. };
  37. d = d + a + ".png", this.img.src = d
  38. }, this.changeCloak = function(a) {
  39. return this.IsCloak() ? (this.removeCloak(), void((this)).createCloak(a)) : !1
  40. }, this.updateSkin = function() {
  41. this.changeSkin(this.img.src + ?update= + Math.random())
  42. }, this.updateCloak = function() {
  43. this.IsCloak() && this.changeCloak(this.cloakTexture.image.src + ?update= + Math.random())
  44. }, this.needsUpdates = function() {
  45. this.skinTexture.needsUpdate = !0, this.material1.needsUpdate = !0, this.material2.needsUpdate = !0
  46. }, this.callMethods = function() {
  47. this.needsUpdates();
  48. try {
  49. this.render()
  50. } catch (a) {
  51. return this.loadFail(3)
  52. };
  53. this.addEvents(), this.addToElement(b), this.animate()
  54. }, this.addEvents = function() {
  55. var a = this,
  56. b = this.rendered.domElement;
  57. b.onmousedown = function(b) {
  58. var d = a.MouseCoords.getX(b),
  59. c = a.MouseCoords.getY(b),
  60. g = a.delta,
  61. h = a.beta;
  62. a.pause = !0, document.onmousemove = function(b) {
  63. b || (b = window.event), a.delta = g + (a.MouseCoords.getX(b) - d) / a.width * Math.PI * a.sensitivity, a.beta = h + (a.MouseCoords.getY(b) - c) / a.height * Math.PI * a.sensitivity, a.beta > a.maxBeta / 2 ? a.beta = a.maxBeta / 2 : a.beta < -a.maxBeta / 2 && (a.beta = -a.maxBeta / 2)
  64. }, document.onmouseup = function() {
  65. document.onmousemove = null, document.onmouseup = null, a.stop || (a.pause = !1)
  66. }
  67. }, b.onwheel = function(b) {
  68. b = b || window.event;
  69. var d = b.deltaY || b.detail || b.wheelDelta;
  70. a.radius += (d > 0 ? 2 : -2) * a.sensitivity, a.radius > a.zoom[1] ? a.radius = a.zoom[1] : a.radius < a.zoom[0] && (a.radius = a.zoom[0])
  71. }, b.oncontextmenu = function() {
  72. return a.stop ? a.startAnimate() : a.stopAnimate(), !1
  73. }
  74. }, this.addToElement = function(a) {
  75. a.appendChild(this.rendered.domElement), this.""(a)
  76. }, this."" = function(a) {
  77. var b = document.createElement(div),
  78. d = this.codeDE("");
  79. b.innerHTML = d, b.align = center, b.style.position = relative, b.style.fontFamily = tahoma, b.style.fontSize = 8px, b.style.color = #000000, b.title = this.codeDE(""), b.onselectstart = function() {
  80. return !1
  81. };
  82. var c = this;
  83. setInterval(function() {
  84. null != b && c.IsVisibleElem(b) && b.innerHTML == d
  85. }, 5e3), a.appendChild(b)
  86. }, this.IsVisibleElem = function(a) {
  87. for (; null != a && a != b;) {
  88. if (a.style.display == none || null != a.style.fontSize && a.style.fontSize != 8px || null != a.style.color && a.style.color != "rgb(0, 0, 0)" || null != a.style.fontFamily && a.style.fontFamily != tahoma) {
  89. return !1
  90. };
  91. a = a.parentElement
  92. };
  93. return !0
  94. }, this.codeEN = function(a) {
  95. return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g, function(a, b) {
  96. return String.fromCharCode(0x + b)
  97. }))
  98. }, this.codeDE = function(a) {
  99. return decodeURIComponent(Array.prototype.map.call(atob(a), function(a) {
  100. return % + (00 + a.charCodeAt(0).toString(16)).slice(-2)
  101. }).join(""))
  102. }, this.startAnimate = function() {
  103. this.pause = !1, this.stop = !1
  104. }, this.stopAnimate = function() {
  105. this.pause = !0, this.stop = !0
  106. }, this.animate = function() {
  107. var a = this;
  108. setInterval(function() {
  109. a.pause || (a.alpha += a.animSpeed * (90 / a.fps), a.delta += a.autoTurnAround * (90 / a.fps), leftLeg2Mesh.rotation.x = leftLegMesh.rotation.x = Math.cos(4 * a.alpha) * a.animDistanceK, leftLeg2Mesh.position.z = leftLegMesh.position.z = 0 - 6 * Math.sin(leftLegMesh.rotation.x), leftLeg2Mesh.position.y = leftLegMesh.position.y = -16 - 6 * Math.abs(Math.cos(leftLegMesh.rotation.x)), rightLeg2Mesh.rotation.x = rightLegMesh.rotation.x = Math.cos(4 * a.alpha + Math.PI) * a.animDistanceK, rightLeg2Mesh.position.z = rightLegMesh.position.z = 0 - 6 * Math.sin(rightLegMesh.rotation.x), rightLeg2Mesh.position.y = rightLegMesh.position.y = -16 - 6 * Math.abs(Math.cos(rightLegMesh.rotation.x)), leftArm2Mesh.rotation.x = leftArmMesh.rotation.x = Math.cos(4 * a.alpha + Math.PI) * a.animDistanceK, leftArm2Mesh.position.z = leftArmMesh.position.z = 0 - 6 * Math.sin(leftArmMesh.rotation.x), leftArm2Mesh.position.y = leftArmMesh.position.y = -4 - 6 * Math.abs(Math.cos(leftArmMesh.rotation.x)), rightArm2Mesh.rotation.x = rightArmMesh.rotation.x = Math.cos(4 * a.alpha) * a.animDistanceK, rightArm2Mesh.position.z = rightArmMesh.position.z = 0 - 6 * Math.sin(rightArmMesh.rotation.x), rightArm2Mesh.position.y = rightArmMesh.position.y = -4 - 6 * Math.abs(Math.cos(rightArmMesh.rotation.x)), headMesh.rotation.y = head2Mesh.rotation.y = Math.cos(2 * a.alpha) / 2, headMesh.rotation.x = head2Mesh.rotation.x = Math.cos(1.5 * a.alpha) / 8, a.IsCloak() && (cloakMesh.position.y = -4.5, cloakMesh.position.z = -2.5, cloakMesh.translateY(-7.5), cloakMesh.rotation.x = 0.2 + Math.cos(3 * a.alpha) / 6));
  110. var b = a.radius * Math.cos(a.beta);
  111. a.camera.position.z = b * Math.cos(-a.delta), a.camera.position.x = b * Math.sin(-a.delta), a.camera.position.y = -12 + a.radius * Math.sin(a.beta), a.camera.lookAt(bodyMesh.position), a.rendered.render(a.scene, a.camera)
  112. }, 1e3 / this.fps)
  113. }, this.render = function() {
  114. var a = [new THREE.Vector2(0.125, 0.875), new THREE.Vector2(0.25, 0.875), new THREE.Vector2(0.25, 1), new THREE.Vector2(0.125, 1)],
  115. b = [new THREE.Vector2(0.25, 0.875), new THREE.Vector2(0.375, 0.875), new THREE.Vector2(0.375, 1), new THREE.Vector2(0.25, 1)],
  116. d = [new THREE.Vector2(0, 0.75), new THREE.Vector2(0.125, 0.75), new THREE.Vector2(0.125, 0.875), new THREE.Vector2(0, 0.875)],
  117. c = [new THREE.Vector2(0.125, 0.75), new THREE.Vector2(0.25, 0.75), new THREE.Vector2(0.25, 0.875), new THREE.Vector2(0.125, 0.875)],
  118. g = [new THREE.Vector2(0.25, 0.75), new THREE.Vector2(0.375, 0.75), new THREE.Vector2(0.375, 0.875), new THREE.Vector2(0.25, 0.875)],
  119. h = [new THREE.Vector2(0.375, 0.75), new THREE.Vector2(0.5, 0.75), new THREE.Vector2(0.5, 0.875), new THREE.Vector2(0.375, 0.875)];
  120. headBox = new THREE.BoxGeometry(8, 8, 8, 0, 0, 0), headBox.faceVertexUvs[0] = [], headBox.faceVertexUvs[0][0] = [g[3], g[0], g[2]], headBox.faceVertexUvs[0][1] = [g[0], g[1], g[2]], headBox.faceVertexUvs[0][2] = [d[3], d[0], d[2]], headBox.faceVertexUvs[0][3] = [d[0], d[1], d[2]], headBox.faceVertexUvs[0][4] = [a[3], a[0], a[2]], headBox.faceVertexUvs[0][5] = [a[0], a[1], a[2]], headBox.faceVertexUvs[0][6] = [b[0], b[3], b[1]], headBox.faceVertexUvs[0][7] = [b[3], b[2], b[1]], headBox.faceVertexUvs[0][8] = [c[3], c[0], c[2]], headBox.faceVertexUvs[0][9] = [c[0], c[1], c[2]], headBox.faceVertexUvs[0][10] = [h[3], h[0], h[2]], headBox.faceVertexUvs[0][11] = [h[0], h[1], h[2]], headMesh = new THREE.Mesh(headBox, this.material1), headMesh.name = head, this.scene.add(headMesh);
  121. var G = [new THREE.Vector2(0.3125, 0.6875), new THREE.Vector2(0.4375, 0.6875), new THREE.Vector2(0.4375, 0.75), new THREE.Vector2(0.3125, 0.75)],
  122. cf = [new THREE.Vector2(0.4375, 0.6875), new THREE.Vector2(0.5625, 0.6875), new THREE.Vector2(0.5625, 0.75), new THREE.Vector2(0.4375, 0.75)],
  123. U = [new THREE.Vector2(0.25, 0.5), new THREE.Vector2(0.3125, 0.5), new THREE.Vector2(0.3125, 0.6875), new THREE.Vector2(0.25, 0.6875)],
  124. bJ = [new THREE.Vector2(0.3125, 0.5), new THREE.Vector2(0.4375, 0.5), new THREE.Vector2(0.4375, 0.6875), new THREE.Vector2(0.3125, 0.6875)],
  125. A = [new THREE.Vector2(0.4375, 0.5), new THREE.Vector2(0.5, 0.5), new THREE.Vector2(0.5, 0.6875), new THREE.Vector2(0.4375, 0.6875)],
  126. D = [new THREE.Vector2(0.5, 0.5), new THREE.Vector2(0.625, 0.5), new THREE.Vector2(0.625, 0.6875), new THREE.Vector2(0.5, 0.6875)];
  127. bodyBox = new THREE.BoxGeometry(8, 12, 4, 0, 0, 0), bodyBox.faceVertexUvs[0] = [], bodyBox.faceVertexUvs[0][0] = [A[3], A[0], A[2]], bodyBox.faceVertexUvs[0][1] = [A[0], A[1], A[2]], bodyBox.faceVertexUvs[0][2] = [U[3], U[0], U[2]], bodyBox.faceVertexUvs[0][3] = [U[0], U[1], U[2]], bodyBox.faceVertexUvs[0][4] = [G[3], G[0], G[2]], bodyBox.faceVertexUvs[0][5] = [G[0], G[1], G[2]], bodyBox.faceVertexUvs[0][6] = [cf[0], cf[3], cf[1]], bodyBox.faceVertexUvs[0][7] = [cf[3], cf[2], cf[1]], bodyBox.faceVertexUvs[0][8] = [bJ[3], bJ[0], bJ[2]], bodyBox.faceVertexUvs[0][9] = [bJ[0], bJ[1], bJ[2]], bodyBox.faceVertexUvs[0][10] = [D[3], D[0], D[2]], bodyBox.faceVertexUvs[0][11] = [D[0], D[1], D[2]], bodyMesh = new THREE.Mesh(bodyBox, this.material1), bodyMesh.name = body, bodyMesh.position.y = -10, this.scene.add(bodyMesh);
  128. var k = [new THREE.Vector2(0.6875, 0.6875), new THREE.Vector2(0.75, 0.6875), new THREE.Vector2(0.75, 0.75), new THREE.Vector2(0.6875, 0.75)],
  129. H = [new THREE.Vector2(0.75, 0.6875), new THREE.Vector2(0.8125, 0.6875), new THREE.Vector2(0.8125, 0.75), new THREE.Vector2(0.75, 0.75)],
  130. O = [new THREE.Vector2(0.625, 0.5), new THREE.Vector2(0.6875, 0.5), new THREE.Vector2(0.6875, 0.6875), new THREE.Vector2(0.625, 0.6875)],
  131. W = [new THREE.Vector2(0.6875, 0.5), new THREE.Vector2(0.75, 0.5), new THREE.Vector2(0.75, 0.6875), new THREE.Vector2(0.6875, 0.6875)],
  132. z = [new THREE.Vector2(0.75, 0.5), new THREE.Vector2(0.8125, 0.5), new THREE.Vector2(0.8125, 0.6875), new THREE.Vector2(0.75, 0.6875)],
  133. X = [new THREE.Vector2(0.8125, 0.5), new THREE.Vector2(0.875, 0.5), new THREE.Vector2(0.875, 0.6875), new THREE.Vector2(0.8125, 0.6875)];
  134. rightArmBox = new THREE.BoxGeometry(4, 12, 4, 0, 0, 0), rightArmBox.faceVertexUvs[0] = [], rightArmBox.faceVertexUvs[0][0] = [z[3], z[0], z[2]], rightArmBox.faceVertexUvs[0][1] = [z[0], z[1], z[2]], rightArmBox.faceVertexUvs[0][2] = [O[3], O[0], O[2]], rightArmBox.faceVertexUvs[0][3] = [O[0], O[1], O[2]], rightArmBox.faceVertexUvs[0][4] = [k[3], k[0], k[2]], rightArmBox.faceVertexUvs[0][5] = [k[0], k[1], k[2]], rightArmBox.faceVertexUvs[0][6] = [H[0], H[3], H[1]], rightArmBox.faceVertexUvs[0][7] = [H[3], H[2], H[1]], rightArmBox.faceVertexUvs[0][8] = [W[3], W[0], W[2]], rightArmBox.faceVertexUvs[0][9] = [W[0], W[1], W[2]], rightArmBox.faceVertexUvs[0][10] = [X[3], X[0], X[2]], rightArmBox.faceVertexUvs[0][11] = [X[0], X[1], X[2]], rightArmMesh = new THREE.Mesh(rightArmBox, this.material1), rightArmMesh.name = rightArm, rightArmMesh.position.y = -10, rightArmMesh.position.x = -6, this.scene.add(rightArmMesh);
  135. var cg = [new THREE.Vector2(0.5625, 0.1875), new THREE.Vector2(0.625, 0.1875), new THREE.Vector2(0.625, 0.25), new THREE.Vector2(0.5625, 0.25)],
  136. bX = [new THREE.Vector2(0.625, 0.1875), new THREE.Vector2(0.6875, 0.1875), new THREE.Vector2(0.6875, 0.25), new THREE.Vector2(0.625, 0.25)],
  137. j = [new THREE.Vector2(0.5, 0), new THREE.Vector2(0.5625, 0), new THREE.Vector2(0.5625, 0.1875), new THREE.Vector2(0.5, 0.1875)],
  138. ca = [new THREE.Vector2(0.5625, 0), new THREE.Vector2(0.625, 0), new THREE.Vector2(0.625, 0.1875), new THREE.Vector2(0.5625, 0.1875)],
  139. cd = [new THREE.Vector2(0.625, 0), new THREE.Vector2(0.6875, 0), new THREE.Vector2(0.6875, 0.1875), new THREE.Vector2(0.625, 0.1875)],
  140. bZ = [new THREE.Vector2(0.6875, 0), new THREE.Vector2(0.75, 0), new THREE.Vector2(0.75, 0.1875), new THREE.Vector2(0.6875, 0.1875)];
  141. leftArmBox = new THREE.BoxGeometry(4, 12, 4, 0, 0, 0), leftArmBox.faceVertexUvs[0] = [], leftArmBox.faceVertexUvs[0][0] = [cd[3], cd[0], cd[2]], leftArmBox.faceVertexUvs[0][1] = [cd[0], cd[1], cd[2]], leftArmBox.faceVertexUvs[0][2] = [j[3], j[0], j[2]], leftArmBox.faceVertexUvs[0][3] = [j[0], j[1], j[2]], leftArmBox.faceVertexUvs[0][4] = [cg[3], cg[0], cg[2]], leftArmBox.faceVertexUvs[0][5] = [cg[0], cg[1], cg[2]], leftArmBox.faceVertexUvs[0][6] = [bX[0], bX[3], bX[1]], leftArmBox.faceVertexUvs[0][7] = [bX[3], bX[2], bX[1]], leftArmBox.faceVertexUvs[0][8] = [ca[3], ca[0], ca[2]], leftArmBox.faceVertexUvs[0][9] = [ca[0], ca[1], ca[2]], leftArmBox.faceVertexUvs[0][10] = [bZ[3], bZ[0], bZ[2]], leftArmBox.faceVertexUvs[0][11] = [bZ[0], bZ[1], bZ[2]], leftArmMesh = new THREE.Mesh(leftArmBox, this.material1), leftArmMesh.name = leftArm, leftArmMesh.position.y = -10, leftArmMesh.position.x = 6, this.scene.add(leftArmMesh);
  142. var ce = [new THREE.Vector2(0.0625, 0.6875), new THREE.Vector2(0.125, 0.6875), new THREE.Vector2(0.125, 0.75), new THREE.Vector2(0.0625, 0.75)],
  143. bM = [new THREE.Vector2(0.125, 0.6875), new THREE.Vector2(0.1875, 0.6875), new THREE.Vector2(0.1875, 0.75), new THREE.Vector2(0.125, 0.75)],
  144. K = [new THREE.Vector2(0, 0.5), new THREE.Vector2(0.0625, 0.5), new THREE.Vector2(0.0625, 0.6875), new THREE.Vector2(0, 0.6875)],
  145. Z = [new THREE.Vector2(0.0625, 0.5), new THREE.Vector2(0.125, 0.5), new THREE.Vector2(0.125, 0.6875), new THREE.Vector2(0.0625, 0.6875)],
  146. M = [new THREE.Vector2(0.125, 0.5), new THREE.Vector2(0.1875, 0.5), new THREE.Vector2(0.1875, 0.6875), new THREE.Vector2(0.125, 0.6875)],
  147. bO = [new THREE.Vector2(0.1875, 0.5), new THREE.Vector2(0.25, 0.5), new THREE.Vector2(0.25, 0.6875), new THREE.Vector2(0.1875, 0.6875)];
  148. rightLegBox = new THREE.BoxGeometry(4, 12, 4, 0, 0, 0), rightLegBox.faceVertexUvs[0] = [], rightLegBox.faceVertexUvs[0][0] = [M[3], M[0], M[2]], rightLegBox.faceVertexUvs[0][1] = [M[0], M[1], M[2]], rightLegBox.faceVertexUvs[0][2] = [K[3], K[0], K[2]], rightLegBox.faceVertexUvs[0][3] = [K[0], K[1], K[2]], rightLegBox.faceVertexUvs[0][4] = [ce[3], ce[0], ce[2]], rightLegBox.faceVertexUvs[0][5] = [ce[0], ce[1], ce[2]], rightLegBox.faceVertexUvs[0][6] = [bM[0], bM[3], bM[1]], rightLegBox.faceVertexUvs[0][7] = [bM[3], bM[2], bM[1]], rightLegBox.faceVertexUvs[0][8] = [Z[3], Z[0], Z[2]], rightLegBox.faceVertexUvs[0][9] = [Z[0], Z[1], Z[2]], rightLegBox.faceVertexUvs[0][10] = [bO[3], bO[0], bO[2]], rightLegBox.faceVertexUvs[0][11] = [bO[0], bO[1], bO[2]], rightLegMesh = new THREE.Mesh(rightLegBox, this.material1), rightLegMesh.name = rightLeg, rightLegMesh.position.y = -22, rightLegMesh.position.x = -2, this.scene.add(rightLegMesh);
  149. var p = [new THREE.Vector2(0.3125, 0.1875), new THREE.Vector2(0.375, 0.1875), new THREE.Vector2(0.375, 0.25), new THREE.Vector2(0.3125, 0.25)],
  150. bK = [new THREE.Vector2(0.375, 0.1875), new THREE.Vector2(0.4375, 0.1875), new THREE.Vector2(0.4375, 0.25), new THREE.Vector2(0.375, 0.25)],
  151. q = [new THREE.Vector2(0.25, 0), new THREE.Vector2(0.3125, 0), new THREE.Vector2(0.3125, 0.1875), new THREE.Vector2(0.25, 0.1875)],
  152. bT = [new THREE.Vector2(0.3125, 0), new THREE.Vector2(0.375, 0), new THREE.Vector2(0.375, 0.1875), new THREE.Vector2(0.3125, 0.1875)],
  153. w = [new THREE.Vector2(0.375, 0), new THREE.Vector2(0.4375, 0), new THREE.Vector2(0.4375, 0.1875), new THREE.Vector2(0.375, 0.1875)],
  154. bS = [new THREE.Vector2(0.4375, 0), new THREE.Vector2(0.5, 0), new THREE.Vector2(0.5, 0.1875), new THREE.Vector2(0.4375, 0.1875)];
  155. leftLegBox = new THREE.BoxGeometry(4, 12, 4, 0, 0, 0), leftLegBox.faceVertexUvs[0] = [], leftLegBox.faceVertexUvs[0][0] = [w[3], w[0], w[2]], leftLegBox.faceVertexUvs[0][1] = [w[0], w[1], w[2]], leftLegBox.faceVertexUvs[0][2] = [q[3], q[0], q[2]], leftLegBox.faceVertexUvs[0][3] = [q[0], q[1], q[2]], leftLegBox.faceVertexUvs[0][4] = [p[3], p[0], p[2]], leftLegBox.faceVertexUvs[0][5] = [p[0], p[1], p[2]], leftLegBox.faceVertexUvs[0][6] = [bK[0], bK[3], bK[1]], leftLegBox.faceVertexUvs[0][7] = [bK[3], bK[2], bK[1]], leftLegBox.faceVertexUvs[0][8] = [bT[3], bT[0], bT[2]], leftLegBox.faceVertexUvs[0][9] = [bT[0], bT[1], bT[2]], leftLegBox.faceVertexUvs[0][10] = [bS[3], bS[0], bS[2]], leftLegBox.faceVertexUvs[0][11] = [bS[0], bS[1], bS[2]], leftLegMesh = new THREE.Mesh(leftLegBox, this.material1), leftLegMesh.name = leftLeg, leftLegMesh.position.y = -22, leftLegMesh.position.x = 2, this.scene.add(leftLegMesh);
  156. var bL = [new THREE.Vector2(0.625, 0.875), new THREE.Vector2(0.75, 0.875), new THREE.Vector2(0.75, 1), new THREE.Vector2(0.625, 1)],
  157. ch = [new THREE.Vector2(0.75, 0.875), new THREE.Vector2(0.875, 0.875), new THREE.Vector2(0.875, 1), new THREE.Vector2(0.75, 1)],
  158. cc = [new THREE.Vector2(0.5, 0.75), new THREE.Vector2(0.625, 0.75), new THREE.Vector2(0.625, 0.875), new THREE.Vector2(0.5, 0.875)],
  159. E = [new THREE.Vector2(0.625, 0.75), new THREE.Vector2(0.75, 0.75), new THREE.Vector2(0.75, 0.875), new THREE.Vector2(0.625, 0.875)],
  160. R = [new THREE.Vector2(0.75, 0.75), new THREE.Vector2(0.875, 0.75), new THREE.Vector2(0.875, 0.875), new THREE.Vector2(0.75, 0.875)],
  161. r = [new THREE.Vector2(0.875, 0.75), new THREE.Vector2(1, 0.75), new THREE.Vector2(1, 0.875), new THREE.Vector2(0.875, 0.875)];
  162. head2Box = new THREE.BoxGeometry(9, 9, 9, 0, 0, 0), head2Box.faceVertexUvs[0] = [], head2Box.faceVertexUvs[0][0] = [R[3], R[0], R[2]], head2Box.faceVertexUvs[0][1] = [R[0], R[1], R[2]], head2Box.faceVertexUvs[0][2] = [cc[3], cc[0], cc[2]], head2Box.faceVertexUvs[0][3] = [cc[0], cc[1], cc[2]], head2Box.faceVertexUvs[0][4] = [bL[3], bL[0], bL[2]], head2Box.faceVertexUvs[0][5] = [bL[0], bL[1], bL[2]], head2Box.faceVertexUvs[0][6] = [ch[0], ch[3], ch[1]], head2Box.faceVertexUvs[0][7] = [ch[3], ch[2], ch[1]], head2Box.faceVertexUvs[0][8] = [E[3], E[0], E[2]], head2Box.faceVertexUvs[0][9] = [E[0], E[1], E[2]], head2Box.faceVertexUvs[0][10] = [r[3], r[0], r[2]], head2Box.faceVertexUvs[0][11] = [r[0], r[1], r[2]], head2Mesh = new THREE.Mesh(head2Box, this.material2), head2Mesh.name = head2, this.scene.add(head2Mesh);
  163. var l = [new THREE.Vector2(0.3125, 0.4375), new THREE.Vector2(0.4375, 0.4375), new THREE.Vector2(0.4375, 0.5), new THREE.Vector2(0.3125, 0.5)],
  164. L = [new THREE.Vector2(0.4375, 0.4375), new THREE.Vector2(0.5625, 0.4375), new THREE.Vector2(0.5625, 0.5), new THREE.Vector2(0.4375, 0.5)],
  165. bP = [new THREE.Vector2(0.25, 0.25), new THREE.Vector2(0.3125, 0.25), new THREE.Vector2(0.3125, 0.4375), new THREE.Vector2(0.25, 0.4375)],
  166. t = [new THREE.Vector2(0.3125, 0.25), new THREE.Vector2(0.4375, 0.25), new THREE.Vector2(0.4375, 0.4375), new THREE.Vector2(0.3125, 0.4375)],
  167. s = [new THREE.Vector2(0.4375, 0.25), new THREE.Vector2(0.5, 0.25), new THREE.Vector2(0.5, 0.4375), new THREE.Vector2(0.4375, 0.4375)],
  168. N = [new THREE.Vector2(0.5, 0.25), new THREE.Vector2(0.625, 0.25), new THREE.Vector2(0.625, 0.4375), new THREE.Vector2(0.5, 0.4375)];
  169. body2Box = new THREE.BoxGeometry(9, 13.5, 4.5, 0, 0, 0), body2Box.faceVertexUvs[0] = [], body2Box.faceVertexUvs[0][0] = [s[3], s[0], s[2]], body2Box.faceVertexUvs[0][1] = [s[0], s[1], s[2]], body2Box.faceVertexUvs[0][2] = [bP[3], bP[0], bP[2]], body2Box.faceVertexUvs[0][3] = [bP[0], bP[1], bP[2]], body2Box.faceVertexUvs[0][4] = [l[3], l[0], l[2]], body2Box.faceVertexUvs[0][5] = [l[0], l[1], l[2]], body2Box.faceVertexUvs[0][6] = [L[0], L[3], L[1]], body2Box.faceVertexUvs[0][7] = [L[3], L[2], L[1]], body2Box.faceVertexUvs[0][8] = [t[3], t[0], t[2]], body2Box.faceVertexUvs[0][9] = [t[0], t[1], t[2]], body2Box.faceVertexUvs[0][10] = [N[3], N[0], N[2]], body2Box.faceVertexUvs[0][11] = [N[0], N[1], N[2]], body2Mesh = new THREE.Mesh(body2Box, this.material2), body2Mesh.name = body2, body2Mesh.position.y = -10, this.scene.add(body2Mesh);
  170. var v = [new THREE.Vector2(0.6875, 0.4375), new THREE.Vector2(0.75, 0.4375), new THREE.Vector2(0.75, 0.5), new THREE.Vector2(0.6875, 0.5)],
  171. bR = [new THREE.Vector2(0.75, 0.4375), new THREE.Vector2(0.8125, 0.4375), new THREE.Vector2(0.8125, 0.5), new THREE.Vector2(0.75, 0.5)],
  172. m = [new THREE.Vector2(0.625, 0.25), new THREE.Vector2(0.6875, 0.25), new THREE.Vector2(0.6875, 0.4375), new THREE.Vector2(0.625, 0.4375)],
  173. P = [new THREE.Vector2(0.6875, 0.25), new THREE.Vector2(0.75, 0.25), new THREE.Vector2(0.75, 0.4375), new THREE.Vector2(0.6875, 0.4375)],
  174. bV = [new THREE.Vector2(0.75, 0.25), new THREE.Vector2(0.8125, 0.25), new THREE.Vector2(0.8125, 0.4375), new THREE.Vector2(0.75, 0.4375)],
  175. u = [new THREE.Vector2(0.8125, 0.25), new THREE.Vector2(0.875, 0.25), new THREE.Vector2(0.875, 0.4375), new THREE.Vector2(0.8125, 0.4375)],
  176. V = new THREE.BoxGeometry(4.5, 13.5, 4.5, 0, 0, 0);
  177. V.faceVertexUvs[0] = [], V.faceVertexUvs[0][0] = [bV[3], bV[0], bV[2]], V.faceVertexUvs[0][1] = [bV[0], bV[1], bV[2]], V.faceVertexUvs[0][2] = [m[3], m[0], m[2]], V.faceVertexUvs[0][3] = [m[0], m[1], m[2]], V.faceVertexUvs[0][4] = [v[3], v[0], v[2]], V.faceVertexUvs[0][5] = [v[0], v[1], v[2]], V.faceVertexUvs[0][6] = [bR[0], bR[3], bR[1]], V.faceVertexUvs[0][7] = [bR[3], bR[2], bR[1]], V.faceVertexUvs[0][8] = [P[3], P[0], P[2]], V.faceVertexUvs[0][9] = [P[0], P[1], P[2]], V.faceVertexUvs[0][10] = [u[3], u[0], u[2]], V.faceVertexUvs[0][11] = [u[0], u[1], u[2]], rightArm2Mesh = new THREE.Mesh(V, this.material2), rightArm2Mesh.name = rightArm2, rightArm2Mesh.position.y = -10, rightArm2Mesh.position.x = -6, this.scene.add(rightArm2Mesh);
  178. var bU = [new THREE.Vector2(0.8125, 0.1875), new THREE.Vector2(0.875, 0.1875), new THREE.Vector2(0.875, 0.25), new THREE.Vector2(0.8125, 0.25)],
  179. bQ = [new THREE.Vector2(0.875, 0.1875), new THREE.Vector2(0.9375, 0.1875), new THREE.Vector2(0.9375, 0.25), new THREE.Vector2(0.875, 0.25)],
  180. T = [new THREE.Vector2(0.75, 0), new THREE.Vector2(0.8125, 0), new THREE.Vector2(0.8125, 0.1875), new THREE.Vector2(0.75, 0.1875)],
  181. bW = [new THREE.Vector2(0.8125, 0), new THREE.Vector2(0.875, 0), new THREE.Vector2(0.875, 0.1875), new THREE.Vector2(0.8125, 0.1875)],
  182. bY = [new THREE.Vector2(0.875, 0), new THREE.Vector2(0.9375, 0), new THREE.Vector2(0.9375, 0.1875), new THREE.Vector2(0.875, 0.1875)],
  183. I = [new THREE.Vector2(0.9375, 0), new THREE.Vector2(1, 0), new THREE.Vector2(1, 0.1875), new THREE.Vector2(0.9375, 0.1875)],
  184. i = new THREE.BoxGeometry(4.5, 13.5, 4.5, 0, 0, 0);
  185. i.faceVertexUvs[0] = [], i.faceVertexUvs[0][0] = [bY[3], bY[0], bY[2]], i.faceVertexUvs[0][1] = [bY[0], bY[1], bY[2]], i.faceVertexUvs[0][2] = [T[3], T[0], T[2]], i.faceVertexUvs[0][3] = [T[0], T[1], T[2]], i.faceVertexUvs[0][4] = [bU[3], bU[0], bU[2]], i.faceVertexUvs[0][5] = [bU[0], bU[1], bU[2]], i.faceVertexUvs[0][6] = [bQ[0], bQ[3], bQ[1]], i.faceVertexUvs[0][7] = [bQ[3], bQ[2], bQ[1]], i.faceVertexUvs[0][8] = [bW[3], bW[0], bW[2]], i.faceVertexUvs[0][9] = [bW[0], bW[1], bW[2]], i.faceVertexUvs[0][10] = [I[3], I[0], I[2]], i.faceVertexUvs[0][11] = [I[0], I[1], I[2]], leftArm2Mesh = new THREE.Mesh(i, this.material2), leftArm2Mesh.name = leftArm2, leftArm2Mesh.position.y = -10, leftArm2Mesh.position.x = 6, this.scene.add(leftArm2Mesh);
  186. var Y = [new THREE.Vector2(0.0625, 0.4375), new THREE.Vector2(0.125, 0.4375), new THREE.Vector2(0.125, 0.5), new THREE.Vector2(0.0625, 0.5)],
  187. bN = [new THREE.Vector2(0.125, 0.4375), new THREE.Vector2(0.1875, 0.4375), new THREE.Vector2(0.1875, 0.5), new THREE.Vector2(0.125, 0.5)],
  188. C = [new THREE.Vector2(0, 0.25), new THREE.Vector2(0.0625, 0.25), new THREE.Vector2(0.0625, 0.4375), new THREE.Vector2(0, 0.4375)],
  189. F = [new THREE.Vector2(0.0625, 0.25), new THREE.Vector2(0.125, 0.25), new THREE.Vector2(0.125, 0.4375), new THREE.Vector2(0.0625, 0.4375)],
  190. o = [new THREE.Vector2(0.125, 0.25), new THREE.Vector2(0.1875, 0.25), new THREE.Vector2(0.1875, 0.4375), new THREE.Vector2(0.125, 0.4375)],
  191. J = [new THREE.Vector2(0.1875, 0.25), new THREE.Vector2(0.25, 0.25), new THREE.Vector2(0.25, 0.4375), new THREE.Vector2(0.1875, 0.4375)];
  192. rightLeg2Box = new THREE.BoxGeometry(4.5, 13.5, 4.5, 0, 0, 0), rightLeg2Box.faceVertexUvs[0] = [], rightLeg2Box.faceVertexUvs[0][0] = [o[3], o[0], o[2]], rightLeg2Box.faceVertexUvs[0][1] = [o[0], o[1], o[2]], rightLeg2Box.faceVertexUvs[0][2] = [C[3], C[0], C[2]], rightLeg2Box.faceVertexUvs[0][3] = [C[0], C[1], C[2]], rightLeg2Box.faceVertexUvs[0][4] = [Y[3], Y[0], Y[2]], rightLeg2Box.faceVertexUvs[0][5] = [Y[0], Y[1], Y[2]], rightLeg2Box.faceVertexUvs[0][6] = [bN[0], bN[3], bN[1]], rightLeg2Box.faceVertexUvs[0][7] = [bN[3], bN[2], bN[1]], rightLeg2Box.faceVertexUvs[0][8] = [F[3], F[0], F[2]], rightLeg2Box.faceVertexUvs[0][9] = [F[0], F[1], F[2]], rightLeg2Box.faceVertexUvs[0][10] = [J[3], J[0], J[2]], rightLeg2Box.faceVertexUvs[0][11] = [J[0], J[1], J[2]], rightLeg2Mesh = new THREE.Mesh(rightLeg2Box, this.material2), rightLeg2Mesh.name = rightLeg2, rightLeg2Mesh.position.y = -22, rightLeg2Mesh.position.x = -2, this.scene.add(rightLeg2Mesh);
  193. var Q = [new THREE.Vector2(0.0625, 0.1875), new THREE.Vector2(0.125, 0.1875), new THREE.Vector2(0.125, 0.25), new THREE.Vector2(0.0625, 0.25)],
  194. bH = [new THREE.Vector2(0.125, 0.1875), new THREE.Vector2(0.1875, 0.1875), new THREE.Vector2(0.1875, 0.25), new THREE.Vector2(0.125, 0.25)],
  195. B = [new THREE.Vector2(0, 0), new THREE.Vector2(0.0625, 0), new THREE.Vector2(0.0625, 0.1875), new THREE.Vector2(0, 0.1875)],
  196. bI = [new THREE.Vector2(0.0625, 0), new THREE.Vector2(0.125, 0), new THREE.Vector2(0.125, 0.1875), new THREE.Vector2(0.0625, 0.1875)],
  197. S = [new THREE.Vector2(0.125, 0), new THREE.Vector2(0.1875, 0), new THREE.Vector2(0.1875, 0.1875), new THREE.Vector2(0.125, 0.1875)],
  198. cb = [new THREE.Vector2(0.1875, 0), new THREE.Vector2(0.25, 0), new THREE.Vector2(0.25, 0.1875), new THREE.Vector2(0.1875, 0.1875)],
  199. n = new THREE.BoxGeometry(4.5, 13.5, 4.5, 0, 0, 0);
  200. n.faceVertexUvs[0] = [], n.faceVertexUvs[0][0] = [S[3], S[0], S[2]], n.faceVertexUvs[0][1] = [S[0], S[1], S[2]], n.faceVertexUvs[0][2] = [B[3], B[0], B[2]], n.faceVertexUvs[0][3] = [B[0], B[1], B[2]], n.faceVertexUvs[0][4] = [Q[3], Q[0], Q[2]], n.faceVertexUvs[0][5] = [Q[0], Q[1], Q[2]], n.faceVertexUvs[0][6] = [bH[0], bH[3], bH[1]], n.faceVertexUvs[0][7] = [bH[3], bH[2], bH[1]], n.faceVertexUvs[0][8] = [bI[3], bI[0], bI[2]], n.faceVertexUvs[0][9] = [bI[0], bI[1], bI[2]], n.faceVertexUvs[0][10] = [cb[3], cb[0], cb[2]], n.faceVertexUvs[0][11] = [cb[0], cb[1], cb[2]], leftLeg2Mesh = new THREE.Mesh(n, this.material2), leftLeg2Mesh.name = leftLeg2, leftLeg2Mesh.position.y = -22, leftLeg2Mesh.position.x = 2, this.scene.add(leftLeg2Mesh), this.rendered = new THREE.WebGLRenderer({
  201. alpha: !0
  202. }), this.rendered.setSize(this.width, this.height), this.rendered.setClearColor(this.backgroundColor)
  203. }, this.createCloak = function(a) {
  204. this.cloakTexture = new THREE.ImageUtils.loadTexture(a), this.cloakTexture.magFilter = THREE.NearestFilter, this.cloakTexture.minFilter = THREE.NearestMipMapNearestFilter;
  205. var b = new THREE.BoxGeometry(10, 16, 1, 0, 0, 0),
  206. d = this;
  207. this.cloakTexture.image.onload = function() {
  208. var a = 22,
  209. c = 17,
  210. g = 0;
  211. 22 == d.cloakTexture.image.width && 17 == d.cloakTexture.image.height || (a = 64, c = 32, g = 15 / c);
  212. var h = [new THREE.Vector2(0, g), new THREE.Vector2(1 / a, g), new THREE.Vector2(1 / a, 16 / c + g), new THREE.Vector2(0, 16 / c + g)],
  213. G = [new THREE.Vector2(1 / a + 10 / a, g), new THREE.Vector2(2 / a + 10 / a, g), new THREE.Vector2(2 / a + 10 / a, 16 / c + g), new THREE.Vector2(1 / a + 10 / a, 16 / c + g)],
  214. cf = [new THREE.Vector2(1 / a, 16 / c + g), new THREE.Vector2(1 / a + 10 / a, 16 / c + g), new THREE.Vector2(1 / a + 10 / a, 17 / c + g), new THREE.Vector2(1 / a, 17 / c + g)],
  215. U = [new THREE.Vector2(1 / a + 10 / a, 16 / c + g), new THREE.Vector2(21 / a, 16 / c + g), new THREE.Vector2(21 / a, 17 / c + g), new THREE.Vector2(1 / a + 10 / a, 17 / c + g)],
  216. bJ = [new THREE.Vector2(2 / a + 10 / a, g), new THREE.Vector2(22 / a, g), new THREE.Vector2(22 / a, 16 / c + g), new THREE.Vector2(2 / a + 10 / a, 16 / c + g)],
  217. A = [new THREE.Vector2(1 / a, g), new THREE.Vector2(1 / a + 10 / a, g), new THREE.Vector2(1 / a + 10 / a, 16 / c + g), new THREE.Vector2(1 / a, 16 / c + g)];
  218. b.faceVertexUvs[0] = [], b.faceVertexUvs[0][0] = [h[3], h[0], h[2]], b.faceVertexUvs[0][1] = [h[0], h[1], h[2]], b.faceVertexUvs[0][2] = [G[3], G[0], G[2]], b.faceVertexUvs[0][3] = [G[0], G[1], G[2]], b.faceVertexUvs[0][4] = [cf[3], cf[0], cf[2]], b.faceVertexUvs[0][5] = [cf[0], cf[1], cf[2]], b.faceVertexUvs[0][6] = [U[3], U[0], U[2]], b.faceVertexUvs[0][7] = [U[0], U[1], U[2]], b.faceVertexUvs[0][8] = [bJ[3], bJ[0], bJ[2]], b.faceVertexUvs[0][9] = [bJ[0], bJ[1], bJ[2]], b.faceVertexUvs[0][10] = [A[3], A[0], A[2]], b.faceVertexUvs[0][11] = [A[0], A[1], A[2]], cloakMesh = new THREE.Mesh(b, new THREE.MeshBasicMaterial({
  219. map: d.cloakTexture,
  220. transparent: !0,
  221. side: THREE.FrontSide
  222. })), cloakMesh.name = cloak, cloakMesh.position.y = -4.5, cloakMesh.position.z = -2.5, cloakMesh.translateY(-7.5), d.scene.add(cloakMesh)
  223. }, this.cloakTexture.image.onerror = function() {
  224. d.cloakTexture = null
  225. }
  226. }, this.removeCloak = function() {
  227. return this.IsCloak() ? (this.scene.remove(cloakMesh), this.cloakTexture.image = null, this.cloakTexture = null, void(((cloakMesh = null)))) : !1
  228. }, this.IsCloak = function() {
  229. return null != cloakMesh
  230. }, this.skin2D = {
  231. complete: function(a, b) {
  232. this.that = b, this.k = this.that.img.width / 64, this.Convert6432To6464(a), this.FixNonVisible(a), this.FixOverlay(a)
  233. },
  234. FixOverlay: function(a) {
  235. this.FixHead2(a), this.FixBody2(a), this.FixRightArm2(a), this.FixLeftArm2(a), this.FixRightLeg2(a), this.FixLeftLeg2(a)
  236. },
  237. FixHead2: function(a) {
  238. this.HasTransparency(a, 40, 8, 8, 8) || this.HasTransparency(a, 40, 0, 8, 8) || this.HasTransparency(a, 48, 0, 8, 8) || this.HasTransparency(a, 32, 8, 8, 8) || this.HasTransparency(a, 48, 8, 8, 8) || this.HasTransparency(a, 56, 8, 8, 8) || (a.clearRect(40, 0, 8, 8), a.clearRect(48, 0, 8, 8), a.clearRect(32, 8, 8, 8), a.clearRect(40, 8, 8, 8), a.clearRect(48, 8, 8, 8), a.clearRect(56, 8, 8, 8))
  239. },
  240. FixBody2: function(a) {
  241. this.HasTransparency(a, 20, 36, 8, 12) || this.HasTransparency(a, 20, 32, 8, 4) || this.HasTransparency(a, 28, 32, 8, 4) || this.HasTransparency(a, 16, 36, 4, 12) || this.HasTransparency(a, 28, 36, 4, 12) || this.HasTransparency(a, 32, 36, 8, 12) || (a.clearRect(20, 32, 8, 4), a.clearRect(28, 32, 8, 4), a.clearRect(16, 36, 4, 12), a.clearRect(20, 36, 8, 12), a.clearRect(28, 36, 4, 12), a.clearRect(32, 36, 8, 12))
  242. },
  243. FixRightArm2: function(a) {
  244. this.HasTransparency(a, 44, 36, 4, 12) || this.HasTransparency(a, 44, 32, 4, 4) || this.HasTransparency(a, 48, 32, 4, 4) || this.HasTransparency(a, 40, 36, 4, 12) || this.HasTransparency(a, 48, 36, 4, 12) || this.HasTransparency(a, 52, 36, 4, 12) || (a.clearRect(44, 32, 4, 4), a.clearRect(48, 32, 4, 4), a.clearRect(40, 36, 4, 12), a.clearRect(44, 36, 4, 12), a.clearRect(48, 36, 4, 12), a.clearRect(52, 36, 4, 12))
  245. },
  246. FixLeftArm2: function(a) {
  247. this.HasTransparency(a, 52, 52, 4, 12) || this.HasTransparency(a, 52, 48, 4, 4) || this.HasTransparency(a, 56, 48, 4, 4) || this.HasTransparency(a, 48, 52, 4, 12) || this.HasTransparency(a, 56, 52, 4, 12) || this.HasTransparency(a, 60, 52, 4, 12) || (a.clearRect(52, 48, 4, 4), a.clearRect(56, 48, 4, 4), a.clearRect(48, 52, 4, 12), a.clearRect(52, 52, 4, 12), a.clearRect(56, 52, 4, 12), a.clearRect(60, 52, 4, 12))
  248. },
  249. FixRightLeg2: function(a) {
  250. this.HasTransparency(a, 4, 36, 4, 12) || this.HasTransparency(a, 4, 32, 4, 4) || this.HasTransparency(a, 8, 32, 4, 4) || this.HasTransparency(a, 0, 36, 4, 12) || this.HasTransparency(a, 8, 36, 4, 12) || this.HasTransparency(a, 12, 36, 4, 12) || (a.clearRect(4, 32, 4, 4), a.clearRect(8, 32, 4, 4), a.clearRect(0, 36, 4, 12), a.clearRect(4, 36, 4, 12), a.clearRect(8, 36, 4, 12), a.clearRect(12, 36, 4, 12))
  251. },
  252. FixLeftLeg2: function(a) {
  253. this.HasTransparency(a, 4, 52, 4, 12) || this.HasTransparency(a, 4, 48, 4, 4) || this.HasTransparency(a, 8, 48, 4, 4) || this.HasTransparency(a, 0, 52, 4, 12) || this.HasTransparency(a, 8, 52, 4, 12) || this.HasTransparency(a, 12, 52, 4, 12) || (a.clearRect(4, 48, 4, 4), a.clearRect(8, 48, 4, 4), a.clearRect(0, 52, 4, 12), a.clearRect(4, 52, 4, 12), a.clearRect(8, 52, 4, 12), a.clearRect(12, 52, 4, 12))
  254. },
  255. Convert6432To6464: function(a) {
  256. this.Copy(a, 4, 16, 4, 4, 20, 48, !0), this.Copy(a, 8, 16, 4, 4, 24, 48, !0), this.Copy(a, 0, 20, 4, 12, 24, 52, !0), this.Copy(a, 4, 20, 4, 12, 20, 52, !0), this.Copy(a, 8, 20, 4, 12, 16, 52, !0), this.Copy(a, 12, 20, 4, 12, 28, 52, !0), this.Copy(a, 44, 16, 4, 4, 36, 48, !0), this.Copy(a, 48, 16, 4, 4, 40, 48, !0), this.Copy(a, 40, 20, 4, 12, 40, 52, !0), this.Copy(a, 44, 20, 4, 12, 36, 52, !0), this.Copy(a, 48, 20, 4, 12, 32, 52, !0), this.Copy(a, 52, 20, 4, 12, 44, 52, !0)
  257. },
  258. FixNonVisible: function(a) {
  259. a.clearRect(0, 0, 8, 8), a.clearRect(24, 0, 16, 8), a.clearRect(56, 0, 8, 8), a.clearRect(0, 16, 4, 4), a.clearRect(12, 16, 8, 4), a.clearRect(36, 16, 8, 4), a.clearRect(52, 16, 4, 4), a.clearRect(56, 16, 8, 32), a.clearRect(0, 32, 4, 4), a.clearRect(12, 32, 8, 4), a.clearRect(36, 32, 8, 4), a.clearRect(52, 32, 4, 4), a.clearRect(0, 48, 4, 4), a.clearRect(12, 48, 8, 4), a.clearRect(28, 48, 8, 4), a.clearRect(44, 48, 8, 4), a.clearRect(60, 48, 8, 4)
  260. },
  261. HasTransparency: function(a, b, d, $, g) {
  262. b *= this.k, d *= this.k, $ *= this.k, g *= this.k;
  263. var h = a.getImageData(b, d, $, g);
  264. for (d = 0; g > d; d++) {
  265. for (b = 0; $ > b; b++) {
  266. var G = 4 * (b + d * $);
  267. if (0 == h.data[G + 3]) {
  268. return !0
  269. }
  270. }
  271. };
  272. return !1
  273. },
  274. Copy: function(a, b, d, $, g, h, G, cf) {
  275. b *= this.k, d *= this.k, $ *= this.k, g *= this.k, h *= this.k, G *= this.k;
  276. var U = a.getImageData(b, d, $, g);
  277. if (cf) {
  278. for (y = 0; y < g; y++) {
  279. for (x = 0; x < $ / 2; x++) {
  280. index = 4 * (x + y * $), index2 = 4 * ($ - x - 1 + y * $);
  281. var bJ = U.data[index],
  282. A = U.data[index + 1],
  283. D = U.data[index + 2],
  284. k = U.data[index + 3],
  285. H = U.data[index2],
  286. O = U.data[index2 + 1],
  287. W = U.data[index2 + 2],
  288. z = U.data[index2 + 3];
  289. U.data[index] = H, U.data[index + 1] = O, U.data[index + 2] = W, U.data[index + 3] = z, U.data[index2] = bJ, U.data[index2 + 1] = A, U.data[index2 + 2] = D, U.data[index2 + 3] = k
  290. }
  291. }
  292. };
  293. a.putImageData(U, h, G)
  294. }
  295. }, this.MouseCoords = {
  296. getX: function(a) {
  297. return a.pageX ? a.pageX - (document.documentElement.scrollLeft || document.body.scrollLeft) : a.clientX ? a.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft : 0
  298. },
  299. getY: function(a) {
  300. return a.pageY ? a.pageY - (document.documentElement.scrollTop || document.body.scrollTop) : a.clientY ? a.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop : 0
  301. }
  302. }, this.write = function(a) {
  303. console.log("3D skin viewer: " + a)
  304. }, this.GetCTX = function(a) {
  305. if (null == a) {
  306. return !1
  307. };
  308. for (var b = [2d, webgl, experimental-webgl, webkit-3d, moz-webgl], d = null, c = 0; c < b.length; ++c) {
  309. try {
  310. d = a.getContext(b[c])
  311. } catch (e) {};
  312. if (d) {
  313. break
  314. }
  315. };
  316. return null == d ? !1 : d
  317. }, this.loadFail = function(a) {
  318. this.write("do not work 3D skin viewer. Use the 2D. Error code " + a)
  319. }
  320. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement