backup with fully working version, only one texture renders
This commit is contained in:
@@ -391,23 +391,11 @@
|
||||
<p class="modal-caption" id="gallery-modal-caption"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-overlay" id="model-modal" hidden>
|
||||
<div class="modal-content model-modal-content">
|
||||
<button type="button" class="modal-close" data-close-modal aria-label="Close"><i class="fas fa-times"></i></button>
|
||||
<h3 class="model-modal-title" id="model-modal-title"></h3>
|
||||
<div id="model-viewer-container"></div>
|
||||
<p class="bio-help"><i class="fas fa-info-circle"></i> Drag to rotate · scroll to zoom</p>
|
||||
<p class="bio-help model-disclaimer"><i class="fas fa-exclamation-triangle"></i> This is just a preview — if the model is broken, contact Jake so he can fix it.</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_js %}
|
||||
{% if models_manifest %}
|
||||
<script src="{% static 'vendor/three.min.js' %}"></script>
|
||||
<script src="{% static 'js/geo_builder.js' %}"></script>
|
||||
<script src="{% static 'js/model_viewer.js' %}"></script>
|
||||
<script src="{% static 'js/packs_preview.js' %}"></script>
|
||||
{% endif %}
|
||||
<script>
|
||||
(function () {
|
||||
@@ -493,41 +481,19 @@
|
||||
modal.hidden = true;
|
||||
const media = modal.querySelector('.modal-media');
|
||||
if (media) media.innerHTML = '';
|
||||
if (modal.id === 'model-modal') {
|
||||
const viewer = document.getElementById('model-viewer-container');
|
||||
if (viewer) viewer.innerHTML = '';
|
||||
if (window.PacksModelViewer) window.PacksModelViewer.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
document.querySelectorAll('.modal-overlay').forEach(modal => {
|
||||
modal.addEventListener('click', (e) => {
|
||||
if (e.target === modal) {
|
||||
modal.hidden = true;
|
||||
if (modal.id === 'model-modal' && window.PacksModelViewer) window.PacksModelViewer.dispose();
|
||||
}
|
||||
if (e.target === modal) modal.hidden = true;
|
||||
});
|
||||
});
|
||||
|
||||
// Model renderer (Three.js showcase).
|
||||
if (window.PacksModelViewer) {
|
||||
// Model renderer (Blockbench showcase).
|
||||
if (window.PacksPreview) {
|
||||
document.querySelectorAll('.model-render-btn').forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
document.getElementById('model-modal-title').textContent = btn.dataset.name || '';
|
||||
const container = document.getElementById('model-viewer-container');
|
||||
container.innerHTML = '';
|
||||
window.PacksModelViewer.render(
|
||||
btn.dataset.member,
|
||||
container,
|
||||
{
|
||||
baseUrl: btn.dataset.baseUrl,
|
||||
vanillaBaseUrl: btn.dataset.vanillaBaseUrl,
|
||||
defaultTexture: btn.dataset.defaultTexture || null,
|
||||
}
|
||||
);
|
||||
document.getElementById('model-modal').hidden = false;
|
||||
});
|
||||
btn.addEventListener('click', () => window.PacksPreview.open(btn));
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user