diff --git a/js/display_mode.js b/js/display_mode.js index 8d2ca18c..8929ed1c 100644 --- a/js/display_mode.js +++ b/js/display_mode.js @@ -201,12 +201,12 @@ if (localStorage.getItem('display_presets') != null) { class refModel { - constructor(id) { + constructor(id, options = 0) { var scope = this; this.model = new THREE.Object3D(); this.name = tl('display.reference.'+id); this.id = id; - this.icon = id; + this.icon = options.icon || id; this.initialized = false; this.pose_angles = {}; @@ -293,6 +293,16 @@ class refModel { setDisplayArea(side*9.039, -8.318, 20.8, 0, 0, 0, 1,1,1) } break; + case 'frame': + this.updateBasePosition = function() { + setDisplayArea(8, 8, -1, 0, 0, 0, 0.5, 0.5, 0.5) + } + break; + case 'frame_invisible': + this.updateBasePosition = function() { + setDisplayArea(8, 8, 0.0, 0, 0, 0, 0.5, 0.5, 0.5) + } + break; case 'bow': this.updateBasePosition = function() { var side = display_slot.includes('left') ? -1 : 1; @@ -421,6 +431,7 @@ class refModel { case 'crossbow': this.buildMonitor(); break; case 'block': this.buildBlock(); break; case 'frame': this.buildFrame(); break; + case 'frame_invisible': this.buildFrameInvisible(); break; } this.initialized = true; } @@ -1059,22 +1070,28 @@ class refModel { {"size": [10,1,1], "pos": [8, 2.5, -0.5], "origin": [0, 0, 0], "north":{"uv":[3,13,13,14]},"east":{"uv":[3,13,13,14]},"south":{"uv":[3,13,13,14]},"west":{"uv":[3,13,13,14]},"up":{"uv":[3,13,13,14]},"down":{"uv":[3,13,13,14]}} ]`), 'assets/item_frame.png') } + buildFrameInvisible() { + this.buildModel(JSON.parse(`[ + {"size": [16,16,16], "pos": [8, 8, 8], "origin": [0, 0, 0], "north":{"uv":[0,0,16,16]},"east":{"uv":[0,0,16,16]},"south":{"uv":[0,0,16,16]},"west":{"uv":[0,0,16,16]},"up":{"uv":[0,0,16,16]},"down":{"uv":[0,0,16,16]}} + ]`), 'assets/missing.png') + } } window.displayReferenceObjects = { refmodels: { - player: new refModel('player'), - zombie: new refModel('zombie'), - armor_stand: new refModel('armor_stand'), - baby_zombie: new refModel('baby_zombie'), - armor_stand_small: new refModel('armor_stand_small'), - monitor: new refModel('monitor'), - bow: new refModel('bow'), - crossbow: new refModel('crossbow'), - block: new refModel('block'), - frame: new refModel('frame'), - inventory_nine: new refModel('inventory_nine'), - inventory_full: new refModel('inventory_full'), - hud: new refModel('hud') + player: new refModel('player', {icon: 'icon-player'}), + zombie: new refModel('zombie', {icon: 'icon-zombie'}), + armor_stand: new refModel('armor_stand', {icon: 'icon-armor_stand'}), + baby_zombie: new refModel('baby_zombie', {icon: 'icon-baby_zombie'}), + armor_stand_small: new refModel('armor_stand_small', {icon: 'icon-armor_stand_small'}), + monitor: new refModel('monitor', {icon: 'fa-asterisk'}), + bow: new refModel('bow', {icon: 'icon-bow'}), + crossbow: new refModel('crossbow', {icon: 'icon-crossbow'}), + block: new refModel('block', {icon: 'fa-cube'}), + frame: new refModel('frame', {icon: 'filter_frames'}), + frame_invisible: new refModel('frame_invisible', {icon: 'visibility_off'}), + inventory_nine: new refModel('inventory_nine', {icon: 'icon-inventory_nine'}), + inventory_full: new refModel('inventory_full', {icon: 'icon-inventory_full'}), + hud: new refModel('hud', {icon: 'icon-hud'}) }, active: '', bar: function(buttons) { @@ -1091,19 +1108,16 @@ window.displayReferenceObjects = { var i = 0; while (i < buttons.length) { var ref = this.refmodels[buttons[i]] - var icon = 'icon-'+ref.icon - switch (icon) { - case 'icon-monitor': icon = 'fa fa-asterisk'; break; - } + let icon = Blockbench.getIconNode(ref.icon); var button = $( `