Added toggle Elytra

This commit is contained in:
James Harrison 2020-09-11 00:11:31 +01:00
parent 3e0a24841b
commit 03c1b75a7c
3 changed files with 12 additions and 1 deletions

View File

@ -197,6 +197,8 @@
<input id="cape_url_upload" type="file" accept="image/*" style="display: none;"> <input id="cape_url_upload" type="file" accept="image/*" style="display: none;">
<button type="button" class="control" <button type="button" class="control"
onclick="document.getElementById('cape_url_upload').click();">Browse...</button> onclick="document.getElementById('cape_url_upload').click();">Browse...</button>
<button type="button" class="control"
onclick="skinViewer.toggleElytra()">Toggle Elytra</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -432,7 +432,11 @@ export class ElytraObject extends Group {
constructor(texture: Texture) { constructor(texture: Texture) {
super(); super();
const elytraMaterial = new MeshBasicMaterial({ map: texture, transparent: true, opacity: 1, side: DoubleSide, alphaTest: 0.5, const elytraMaterial = new MeshBasicMaterial({
map: texture,
side: DoubleSide,
transparent: true,
alphaTest: 1e-5,
polygonOffset: true, polygonOffset: true,
polygonOffsetFactor: -1.0, polygonOffsetFactor: -1.0,
polygonOffsetUnits: -4.0 polygonOffsetUnits: -4.0

View File

@ -308,6 +308,11 @@ class SkinViewer {
context.clearRect(0, 0, canvas.width, canvas.height); context.clearRect(0, 0, canvas.width, canvas.height);
context.drawImage(image, 0, 0, image.width, image.height); context.drawImage(image, 0, 0, image.width, image.height);
} }
public toggleElytra() {
this.playerObject.cape.visible = !this.playerObject.cape.visible;
this.playerObject.elytra.visible = !this.playerObject.cape.visible;
}
} }
interface SkinViewer extends SkinContainer<LoadOptions>, CapeContainer<LoadOptions> { } interface SkinViewer extends SkinContainer<LoadOptions>, CapeContainer<LoadOptions> { }