Okay, now I need it to be able to make the assets (especially the 3D ones) more detailed. I asked it to make a dragon and it made a cube
Browse files- editor.html +12 -7
- index.html +4 -4
- models.html +300 -0
editor.html
CHANGED
|
@@ -577,10 +577,9 @@
|
|
| 577 |
});
|
| 578 |
});
|
| 579 |
// Initialize 3D Scene with Three.js
|
| 580 |
-
let scene, camera, renderer, controls;
|
| 581 |
let currentModel = null;
|
| 582 |
-
|
| 583 |
-
function initViewport() {
|
| 584 |
const viewport = document.getElementById('viewport');
|
| 585 |
|
| 586 |
// Clear any existing content
|
|
@@ -602,13 +601,19 @@
|
|
| 602 |
// Setup camera
|
| 603 |
camera = new THREE.PerspectiveCamera(75, viewport.clientWidth / viewport.clientHeight, 0.1, 1000);
|
| 604 |
camera.position.z = 5;
|
| 605 |
-
|
| 606 |
// Setup renderer
|
| 607 |
-
renderer = new THREE.WebGLRenderer({
|
|
|
|
|
|
|
|
|
|
| 608 |
renderer.setSize(viewport.clientWidth, viewport.clientHeight);
|
|
|
|
|
|
|
| 609 |
viewport.appendChild(renderer.domElement);
|
| 610 |
-
|
| 611 |
-
//
|
|
|
|
|
|
|
| 612 |
controls = new THREE.OrbitControls(camera, renderer.domElement);
|
| 613 |
controls.enableDamping = true;
|
| 614 |
controls.dampingFactor = 0.25;
|
|
|
|
| 577 |
});
|
| 578 |
});
|
| 579 |
// Initialize 3D Scene with Three.js
|
| 580 |
+
let scene, camera, renderer, controls, gltfLoader;
|
| 581 |
let currentModel = null;
|
| 582 |
+
function initViewport() {
|
|
|
|
| 583 |
const viewport = document.getElementById('viewport');
|
| 584 |
|
| 585 |
// Clear any existing content
|
|
|
|
| 601 |
// Setup camera
|
| 602 |
camera = new THREE.PerspectiveCamera(75, viewport.clientWidth / viewport.clientHeight, 0.1, 1000);
|
| 603 |
camera.position.z = 5;
|
|
|
|
| 604 |
// Setup renderer
|
| 605 |
+
renderer = new THREE.WebGLRenderer({
|
| 606 |
+
antialias: true,
|
| 607 |
+
precision: 'highp'
|
| 608 |
+
});
|
| 609 |
renderer.setSize(viewport.clientWidth, viewport.clientHeight);
|
| 610 |
+
renderer.shadowMap.enabled = true;
|
| 611 |
+
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
| 612 |
viewport.appendChild(renderer.domElement);
|
| 613 |
+
|
| 614 |
+
// Initialize GLTF loader
|
| 615 |
+
gltfLoader = new THREE.GLTFLoader();
|
| 616 |
+
// Add orbit controls
|
| 617 |
controls = new THREE.OrbitControls(camera, renderer.domElement);
|
| 618 |
controls.enableDamping = true;
|
| 619 |
controls.dampingFactor = 0.25;
|
index.html
CHANGED
|
@@ -49,10 +49,10 @@
|
|
| 49 |
</div>
|
| 50 |
<div class="hidden md:block">
|
| 51 |
<div class="ml-10 flex items-baseline space-x-4">
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
</div>
|
| 57 |
</div>
|
| 58 |
</div>
|
|
|
|
| 49 |
</div>
|
| 50 |
<div class="hidden md:block">
|
| 51 |
<div class="ml-10 flex items-baseline space-x-4">
|
| 52 |
+
<a href="index.html" class="bg-slate-700 text-white px-3 py-2 rounded-md text-sm font-medium">Home</a>
|
| 53 |
+
<a href="editor.html" class="text-gray-300 hover:bg-slate-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">AI Creator</a>
|
| 54 |
+
<a href="models.html" class="text-gray-300 hover:bg-slate-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">3D Models</a>
|
| 55 |
+
<a href="#" class="text-gray-300 hover:bg-slate-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Tutorials</a>
|
| 56 |
</div>
|
| 57 |
</div>
|
| 58 |
</div>
|
models.html
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>BlockCraft Studio | 3D Models</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
+
<script src="https://cdn.jsdelivr.net/npm/three@0.132.2/build/three.min.js"></script>
|
| 12 |
+
<script src="https://cdn.jsdelivr.net/npm/three@0.132.2/examples/js/controls/OrbitControls.js"></script>
|
| 13 |
+
<script src="https://cdn.jsdelivr.net/npm/three@0.132.2/examples/js/loaders/GLTFLoader.js"></script>
|
| 14 |
+
<style>
|
| 15 |
+
.model-card:hover .model-preview {
|
| 16 |
+
transform: scale(1.03);
|
| 17 |
+
}
|
| 18 |
+
#viewport {
|
| 19 |
+
width: 100%;
|
| 20 |
+
height: 100%;
|
| 21 |
+
}
|
| 22 |
+
.category-btn.active {
|
| 23 |
+
background-color: #3b82f6;
|
| 24 |
+
color: white;
|
| 25 |
+
}
|
| 26 |
+
</style>
|
| 27 |
+
</head>
|
| 28 |
+
<body class="bg-slate-900 text-gray-100 min-h-screen">
|
| 29 |
+
<!-- Navbar -->
|
| 30 |
+
<nav class="bg-slate-800/80 border-b border-slate-700">
|
| 31 |
+
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
| 32 |
+
<div class="flex items-center justify-between h-16">
|
| 33 |
+
<div class="flex items-center">
|
| 34 |
+
<div class="flex-shrink-0">
|
| 35 |
+
<div class="flex items-center">
|
| 36 |
+
<i data-feather="box" class="text-blue-400 mr-2"></i>
|
| 37 |
+
<span class="text-xl font-bold bg-gradient-to-r from-blue-400 to-emerald-400 bg-clip-text text-transparent">BlockCraft Studio</span>
|
| 38 |
+
</div>
|
| 39 |
+
</div>
|
| 40 |
+
<div class="hidden md:block">
|
| 41 |
+
<div class="ml-10 flex items-baseline space-x-4">
|
| 42 |
+
<a href="index.html" class="text-gray-300 hover:bg-slate-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Home</a>
|
| 43 |
+
<a href="editor.html" class="bg-slate-700 text-white px-3 py-2 rounded-md text-sm font-medium">AI Creator</a>
|
| 44 |
+
<a href="models.html" class="text-gray-300 hover:bg-slate-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">3D Models</a>
|
| 45 |
+
<a href="#" class="text-gray-300 hover:bg-slate-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Tutorials</a>
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
<div class="hidden md:block">
|
| 50 |
+
<div class="ml-4 flex items-center md:ml-6">
|
| 51 |
+
<button class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-md text-sm font-medium flex items-center">
|
| 52 |
+
<i data-feather="download" class="mr-2 w-4 h-4"></i>
|
| 53 |
+
Download
|
| 54 |
+
</button>
|
| 55 |
+
</div>
|
| 56 |
+
</div>
|
| 57 |
+
</div>
|
| 58 |
+
</div>
|
| 59 |
+
</nav>
|
| 60 |
+
|
| 61 |
+
<!-- Main Content -->
|
| 62 |
+
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
| 63 |
+
<div class="flex flex-col md:flex-row gap-8">
|
| 64 |
+
<!-- Model Preview -->
|
| 65 |
+
<div class="flex-1 bg-slate-800/80 border border-slate-700 rounded-xl p-4">
|
| 66 |
+
<div id="viewport" class="w-full h-96 rounded-lg overflow-hidden">
|
| 67 |
+
<div class="w-full h-full flex items-center justify-center">
|
| 68 |
+
<div class="text-center">
|
| 69 |
+
<i data-feather="box" class="w-16 h-16 mx-auto text-slate-500"></i>
|
| 70 |
+
<p class="text-slate-400 mt-2">Select a model to preview</p>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
<div class="mt-4">
|
| 75 |
+
<h2 class="text-xl font-bold text-white" id="model-title">No Model Selected</h2>
|
| 76 |
+
<p class="text-gray-400 mt-1" id="model-description">Select a model from the library to preview it here</p>
|
| 77 |
+
<div class="mt-4 flex space-x-2">
|
| 78 |
+
<button id="import-btn" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-md text-sm font-medium flex items-center" disabled>
|
| 79 |
+
<i data-feather="plus" class="mr-2 w-4 h-4"></i>
|
| 80 |
+
Import to Editor
|
| 81 |
+
</button>
|
| 82 |
+
<button class="bg-slate-700 hover:bg-slate-600 text-white px-4 py-2 rounded-md text-sm font-medium flex items-center">
|
| 83 |
+
<i data-feather="download" class="mr-2 w-4 h-4"></i>
|
| 84 |
+
Download
|
| 85 |
+
</button>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
|
| 90 |
+
<!-- Model Library -->
|
| 91 |
+
<div class="w-full md:w-80 bg-slate-800/80 border border-slate-700 rounded-xl p-4">
|
| 92 |
+
<div class="flex space-x-2 mb-4 overflow-x-auto pb-2">
|
| 93 |
+
<button class="category-btn active px-3 py-1 rounded-full text-sm bg-blue-500 text-white">All</button>
|
| 94 |
+
<button class="category-btn px-3 py-1 rounded-full text-sm bg-slate-700 text-gray-300">Creatures</button>
|
| 95 |
+
<button class="category-btn px-3 py-1 rounded-full text-sm bg-slate-700 text-gray-300">Structures</button>
|
| 96 |
+
<button class="category-btn px-3 py-1 rounded-full text-sm bg-slate-700 text-gray-300">Vehicles</button>
|
| 97 |
+
<button class="category-btn px-3 py-1 rounded-full text-sm bg-slate-700 text-gray-300">Furniture</button>
|
| 98 |
+
<button class="category-btn px-3 py-1 rounded-full text-sm bg-slate-700 text-gray-300">Weapons</button>
|
| 99 |
+
</div>
|
| 100 |
+
|
| 101 |
+
<div class="space-y-3 max-h-[32rem] overflow-y-auto">
|
| 102 |
+
<!-- Dragon Model -->
|
| 103 |
+
<div class="model-card bg-slate-700 rounded-lg p-3 cursor-pointer" data-model="dragon">
|
| 104 |
+
<div class="model-preview bg-slate-800 rounded h-24 flex items-center justify-center transition-transform">
|
| 105 |
+
<i data-feather="box" class="text-blue-400 w-8 h-8"></i>
|
| 106 |
+
</div>
|
| 107 |
+
<h3 class="text-sm font-medium text-white mt-2">Dragon</h3>
|
| 108 |
+
<p class="text-xs text-gray-400">Detailed winged creature with animations</p>
|
| 109 |
+
</div>
|
| 110 |
+
|
| 111 |
+
<!-- Castle Model -->
|
| 112 |
+
<div class="model-card bg-slate-700 rounded-lg p-3 cursor-pointer" data-model="castle">
|
| 113 |
+
<div class="model-preview bg-slate-800 rounded h-24 flex items-center justify-center transition-transform">
|
| 114 |
+
<i data-feather="box" class="text-blue-400 w-8 h-8"></i>
|
| 115 |
+
</div>
|
| 116 |
+
<h3 class="text-sm font-medium text-white mt-2">Medieval Castle</h3>
|
| 117 |
+
<p class="text-xs text-gray-400">Large structure with towers and walls</p>
|
| 118 |
+
</div>
|
| 119 |
+
|
| 120 |
+
<!-- Airship Model -->
|
| 121 |
+
<div class="model-card bg-slate-700 rounded-lg p-3 cursor-pointer" data-model="airship">
|
| 122 |
+
<div class="model-preview bg-slate-800 rounded h-24 flex items-center justify-center transition-transform">
|
| 123 |
+
<i data-feather="box" class="text-blue-400 w-8 h-8"></i>
|
| 124 |
+
</div>
|
| 125 |
+
<h3 class="text-sm font-medium text-white mt-2">Steampunk Airship</h3>
|
| 126 |
+
<p class="text-xs text-gray-400">Flying vehicle with propellers</p>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<!-- Robot Model -->
|
| 130 |
+
<div class="model-card bg-slate-700 rounded-lg p-3 cursor-pointer" data-model="robot">
|
| 131 |
+
<div class="model-preview bg-slate-800 rounded h-24 flex items-center justify-center transition-transform">
|
| 132 |
+
<i data-feather="box" class="text-blue-400 w-8 h-8"></i>
|
| 133 |
+
</div>
|
| 134 |
+
<h3 class="text-sm font-medium text-white mt-2">Mech Robot</h3>
|
| 135 |
+
<p class="text-xs text-gray-400">Animated robotic character</p>
|
| 136 |
+
</div>
|
| 137 |
+
|
| 138 |
+
<!-- Tree Model -->
|
| 139 |
+
<div class="model-card bg-slate-700 rounded-lg p-3 cursor-pointer" data-model="tree">
|
| 140 |
+
<div class="model-preview bg-slate-800 rounded h-24 flex items-center justify-center transition-transform">
|
| 141 |
+
<i data-feather="box" class="text-blue-400 w-8 h-8"></i>
|
| 142 |
+
</div>
|
| 143 |
+
<h3 class="text-sm font-medium text-white mt-2">Magic Tree</h3>
|
| 144 |
+
<p class="text-xs text-gray-400">Animated glowing tree</p>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
|
| 151 |
+
<script>
|
| 152 |
+
// Initialize Three.js scene
|
| 153 |
+
let scene, camera, renderer, controls, currentModel;
|
| 154 |
+
|
| 155 |
+
function initViewport() {
|
| 156 |
+
const viewport = document.getElementById('viewport');
|
| 157 |
+
|
| 158 |
+
// Clear any existing content
|
| 159 |
+
viewport.innerHTML = '';
|
| 160 |
+
|
| 161 |
+
// Setup Three.js scene
|
| 162 |
+
scene = new THREE.Scene();
|
| 163 |
+
scene.background = new THREE.Color(0x0f172a);
|
| 164 |
+
|
| 165 |
+
// Add lights
|
| 166 |
+
const ambientLight = new THREE.AmbientLight(0x404040);
|
| 167 |
+
scene.add(ambientLight);
|
| 168 |
+
|
| 169 |
+
const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
|
| 170 |
+
directionalLight.position.set(1, 1, 1).normalize();
|
| 171 |
+
scene.add(directionalLight);
|
| 172 |
+
|
| 173 |
+
// Setup camera
|
| 174 |
+
camera = new THREE.PerspectiveCamera(75, viewport.clientWidth / viewport.clientHeight, 0.1, 1000);
|
| 175 |
+
camera.position.z = 5;
|
| 176 |
+
|
| 177 |
+
// Setup renderer
|
| 178 |
+
renderer = new THREE.WebGLRenderer({ antialias: true });
|
| 179 |
+
renderer.setSize(viewport.clientWidth, viewport.clientHeight);
|
| 180 |
+
viewport.appendChild(renderer.domElement);
|
| 181 |
+
|
| 182 |
+
// Add orbit controls
|
| 183 |
+
controls = new THREE.OrbitControls(camera, renderer.domElement);
|
| 184 |
+
controls.enableDamping = true;
|
| 185 |
+
controls.dampingFactor = 0.25;
|
| 186 |
+
|
| 187 |
+
// Render loop
|
| 188 |
+
function animate() {
|
| 189 |
+
requestAnimationFrame(animate);
|
| 190 |
+
controls.update();
|
| 191 |
+
renderer.render(scene, camera);
|
| 192 |
+
}
|
| 193 |
+
animate();
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
// Load model function
|
| 197 |
+
function loadModel(modelName) {
|
| 198 |
+
// Remove existing model
|
| 199 |
+
if (currentModel) {
|
| 200 |
+
scene.remove(currentModel);
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
const viewport = document.getElementById('viewport');
|
| 204 |
+
viewport.innerHTML = '';
|
| 205 |
+
renderer.setSize(viewport.clientWidth, viewport.clientHeight);
|
| 206 |
+
viewport.appendChild(renderer.domElement);
|
| 207 |
+
|
| 208 |
+
// Show loading state
|
| 209 |
+
const loadingDiv = document.createElement('div');
|
| 210 |
+
loadingDiv.className = 'w-full h-full flex items-center justify-center';
|
| 211 |
+
loadingDiv.innerHTML = `
|
| 212 |
+
<div class="text-center">
|
| 213 |
+
<i data-feather="loader" class="w-8 h-8 mx-auto text-blue-400 animate-spin"></i>
|
| 214 |
+
<p class="text-blue-400 mt-2">Loading model...</p>
|
| 215 |
+
</div>
|
| 216 |
+
`;
|
| 217 |
+
viewport.appendChild(loadingDiv);
|
| 218 |
+
feather.replace();
|
| 219 |
+
|
| 220 |
+
// Simulate loading different models
|
| 221 |
+
setTimeout(() => {
|
| 222 |
+
viewport.removeChild(loadingDiv);
|
| 223 |
+
viewport.appendChild(renderer.domElement);
|
| 224 |
+
|
| 225 |
+
// In a real app, this would load actual GLTF models
|
| 226 |
+
let geometry;
|
| 227 |
+
switch(modelName) {
|
| 228 |
+
case 'dragon':
|
| 229 |
+
geometry = new THREE.BoxGeometry(1, 0.5, 2);
|
| 230 |
+
updateModelInfo('Dragon', 'A majestic flying creature with detailed wings and scales');
|
| 231 |
+
break;
|
| 232 |
+
case 'castle':
|
| 233 |
+
geometry = new THREE.BoxGeometry(2, 1, 1.5);
|
| 234 |
+
updateModelInfo('Medieval Castle', 'A grand castle with multiple towers and walls');
|
| 235 |
+
break;
|
| 236 |
+
case 'airship':
|
| 237 |
+
geometry = new THREE.BoxGeometry(1.5, 0.5, 0.8);
|
| 238 |
+
updateModelInfo('Steampunk Airship', 'A flying vehicle with rotating propellers');
|
| 239 |
+
break;
|
| 240 |
+
case 'robot':
|
| 241 |
+
geometry = new THREE.BoxGeometry(0.8, 1.2, 0.8);
|
| 242 |
+
updateModelInfo('Mech Robot', 'A mechanical warrior with animated joints');
|
| 243 |
+
break;
|
| 244 |
+
case 'tree':
|
| 245 |
+
geometry = new THREE.BoxGeometry(0.7, 1.5, 0.7);
|
| 246 |
+
updateModelInfo('Magic Tree', 'An enchanted tree with glowing leaves');
|
| 247 |
+
break;
|
| 248 |
+
default:
|
| 249 |
+
geometry = new THREE.BoxGeometry(1, 1, 1);
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
const material = new THREE.MeshPhongMaterial({
|
| 253 |
+
color: 0x3b82f6,
|
| 254 |
+
specular: 0x111111,
|
| 255 |
+
shininess: 30
|
| 256 |
+
});
|
| 257 |
+
currentModel = new THREE.Mesh(geometry, material);
|
| 258 |
+
scene.add(currentModel);
|
| 259 |
+
|
| 260 |
+
// Update import button
|
| 261 |
+
document.getElementById('import-btn').disabled = false;
|
| 262 |
+
}, 1500);
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
function updateModelInfo(title, description) {
|
| 266 |
+
document.getElementById('model-title').textContent = title;
|
| 267 |
+
document.getElementById('model-description').textContent = description;
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
// Initialize when DOM loads
|
| 271 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 272 |
+
initViewport();
|
| 273 |
+
feather.replace();
|
| 274 |
+
|
| 275 |
+
// Handle model selection
|
| 276 |
+
document.querySelectorAll('.model-card').forEach(card => {
|
| 277 |
+
card.addEventListener('click', () => {
|
| 278 |
+
loadModel(card.dataset.model);
|
| 279 |
+
});
|
| 280 |
+
});
|
| 281 |
+
|
| 282 |
+
// Handle category filtering
|
| 283 |
+
document.querySelectorAll('.category-btn').forEach(btn => {
|
| 284 |
+
btn.addEventListener('click', () => {
|
| 285 |
+
document.querySelector('.category-btn.active').classList.remove('active', 'bg-blue-500', 'text-white');
|
| 286 |
+
document.querySelector('.category-btn.active').classList.add('bg-slate-700', 'text-gray-300');
|
| 287 |
+
btn.classList.add('active', 'bg-blue-500', 'text-white');
|
| 288 |
+
btn.classList.remove('bg-slate-700', 'text-gray-300');
|
| 289 |
+
});
|
| 290 |
+
});
|
| 291 |
+
|
| 292 |
+
// Handle import to editor
|
| 293 |
+
document.getElementById('import-btn').addEventListener('click', () => {
|
| 294 |
+
// In a real app, this would send the model to the editor
|
| 295 |
+
alert('Model would be imported to editor in the full application');
|
| 296 |
+
});
|
| 297 |
+
});
|
| 298 |
+
</script>
|
| 299 |
+
</body>
|
| 300 |
+
</html>
|