first-project / index.html
Has724's picture
prepare for me an app in which I provide the details of the construction materials of a house and it builds for me 3D constructed house, - Initial Deployment
0665d20 verified
Raw History Blame Contribute Delete
13.1 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D House Constructor</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.min.js"></script>
<style>
#houseCanvas {
width: 100%;
height: 100%;
display: block;
}
.material-color-preview {
width: 25px;
height: 25px;
border-radius: 50%;
display: inline-block;
margin-left: 10px;
border: 1px solid #ccc;
}
.tooltip {
position: relative;
display: inline-block;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 200px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -100px;
opacity: 0;
transition: opacity 0.3s;
}
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
@media (max-width: 768px) {
.flex-col-reverse-mobile {
flex-direction: column-reverse;
}
}
</style>
</head>
<body class="bg-gray-100 min-h-screen">
<div class="container mx-auto px-4 py-8">
<header class="text-center mb-8">
<h1 class="text-4xl font-bold text-blue-800 mb-2">3D House Constructor</h1>
<p class="text-gray-600">Input your construction materials and see your dream house in 3D</p>
</header>
<div class="flex flex-col lg:flex-row gap-8">
<!-- Input Form -->
<div class="w-full lg:w-1/3 bg-white p-6 rounded-lg shadow-md">
<h2 class="text-2xl font-semibold mb-4 text-blue-700">House Specifications</h2>
<form id="houseForm" class="space-y-4">
<!-- Basic Dimensions -->
<div class="bg-blue-50 p-4 rounded-lg">
<h3 class="font-medium text-blue-800 mb-2">Basic Dimensions</h3>
<div class="grid grid-cols-2 gap-4">
<div>
<label for="width" class="block text-sm font-medium text-gray-700">Width (m)</label>
<input type="number" id="width" min="5" max="50" value="10" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
</div>
<div>
<label for="depth" class="block text-sm font-medium text-gray-700">Depth (m)</label>
<input type="number" id="depth" min="5" max="50" value="8" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
</div>
<div>
<label for="height" class="block text-sm font-medium text-gray-700">Height (m)</label>
<input type="number" id="height" min="2" max="20" value="3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
</div>
<div>
<label for="floors" class="block text-sm font-medium text-gray-700">Floors</label>
<select id="floors" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
</select>
</div>
</div>
</div>
<!-- Roof Options -->
<div class="bg-blue-50 p-4 rounded-lg">
<h3 class="font-medium text-blue-800 mb-2">Roof Options</h3>
<div class="space-y-3">
<div>
<label for="roofType" class="block text-sm font-medium text-gray-700">Roof Type</label>
<select id="roofType" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
<option value="flat">Flat Roof</option>
<option value="gable" selected>Gable Roof</option>
<option value="hip">Hip Roof</option>
</select>
</div>
<div>
<label for="roofColor" class="block text-sm font-medium text-gray-700">Roof Color</label>
<div class="flex items-center mt-1">
<input type="color" id="roofColor" value="#8B4513" class="rounded-md border-gray-300 shadow-sm">
<span class="material-color-preview" id="roofColorPreview" style="background-color: #8B4513;"></span>
</div>
</div>
<div>
<label for="roofMaterial" class="block text-sm font-medium text-gray-700">Roof Material</label>
<select id="roofMaterial" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
<option value="tiles">Clay Tiles</option>
<option value="metal" selected>Metal Sheets</option>
<option value="shingles">Asphalt Shingles</option>
</select>
</div>
</div>
</div>
<!-- Wall Options -->
<div class="bg-blue-50 p-4 rounded-lg">
<h3 class="font-medium text-blue-800 mb-2">Wall Options</h3>
<div class="space-y-3">
<div>
<label for="wallColor" class="block text-sm font-medium text-gray-700">Wall Color</label>
<div class="flex items-center mt-1">
<input type="color" id="wallColor" value="#F5DEB3" class="rounded-md border-gray-300 shadow-sm">
<span class="material-color-preview" id="wallColorPreview" style="background-color: #F5DEB3;"></span>
</div>
</div>
<div>
<label for="wallMaterial" class="block text-sm font-medium text-gray-700">Wall Material</label>
<select id="wallMaterial" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
<option value="brick">Brick</option>
<option value="concrete" selected>Concrete</option>
<option value="wood">Wood</option>
</select>
</div>
<div>
<label for="windowCount" class="block text-sm font-medium text-gray-700">Windows per Wall</label>
<input type="number" id="windowCount" min="0" max="10" value="3" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
</div>
</div>
</div>
<!-- Door Options -->
<div class="bg-blue-50 p-4 rounded-lg">
<h3 class="font-medium text-blue-800 mb-2">Door Options</h3>
<div class="space-y-3">
<div>
<label for="doorColor" class="block text-sm font-medium text-gray-700">Door Color</label>
<div class="flex items-center mt-1">
<input type="color" id="doorColor" value="#8B4513" class="rounded-md border-gray-300 shadow-sm">
<span class="material-color-preview" id="doorColorPreview" style="background-color: #8B4513;"></span>
</div>
</div>
<div>
<label for="doorMaterial" class="block text-sm font-medium text-gray-700">Door Material</label>
<select id="doorMaterial" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
<option value="wood" selected>Wood</option>
<option value="metal">Metal</option>
<option value="glass">Glass</option>
</select>
</div>
<div>
<label for="doorPosition" class="block text-sm font-medium text-gray-700">Door Position</label>
<select id="doorPosition" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
<option value="front">Front</option>
<option value="side" selected>Side</option>
</select>
</div>
</div>
</div>
<div class="pt-2">
<button type="button" id="generateBtn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-md transition duration-300">
Generate 3D House
</button>
</div>
</form>
</div>
<!-- 3D Viewer -->
<div class="w-full lg:w-2/3 bg-white p-4 rounded-lg shadow-md">
<div class="flex justify-between items-center mb-4">
<h2 class="text-2xl font-semibold text-blue-700">3D House Preview</h2>
<div class="flex space-x-2">
<button id="rotateBtn" class="bg-gray-200 hover:bg-gray-300 px-3 py-1 rounded-md text-sm tooltip">
<span>🔄</span>
<span class="tooltiptext">Toggle Auto Rotation</span>
</button>
<button id="resetViewBtn" class="bg-gray-200 hover:bg-gray-300 px-3 py-1 rounded-md text-sm tooltip">
<span>🏠</span>
<span class="tooltiptext">Reset View</span>
</button>
<button id="wireframeBtn" class="bg-gray-200 hover:bg-gray-300 px-3 py-1 rounded-md text-sm tooltip">
<span>🔲</span>
<span class="tooltiptext">Toggle Wireframe</span>
</button>
</div>
</div>
<div id="houseContainer" class="relative h-96 md:h-[500px] w-full bg-gray-100 rounded-lg overflow-hidden">
<div id="loading" class="absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 text-white text-lg">
Loading 3D model...
</div>
<canvas id="houseCanvas"></
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://deepsite.hf.co/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://deepsite.hf.co" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://deepsite.hf.co?remix=Has724/first-project" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>