File size: 17,672 Bytes
25dbc47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eacc6ef
 
25dbc47
 
eacc6ef
25dbc47
eacc6ef
25dbc47
eacc6ef
 
 
25dbc47
 
 
eacc6ef
 
 
 
 
26a60ee
eacc6ef
 
25dbc47
eacc6ef
 
 
 
 
 
25dbc47
 
 
 
 
 
eacc6ef
 
26a60ee
25dbc47
eacc6ef
 
 
 
25dbc47
 
eacc6ef
25dbc47
 
eacc6ef
26a60ee
eacc6ef
25dbc47
 
eacc6ef
 
 
 
 
 
 
 
25dbc47
 
eacc6ef
 
 
 
 
 
 
 
 
25dbc47
 
eacc6ef
 
 
 
 
 
 
 
 
 
26a60ee
 
eacc6ef
 
 
 
 
 
 
 
25dbc47
 
eacc6ef
 
 
26a60ee
 
 
eacc6ef
 
25dbc47
 
eacc6ef
 
 
26a60ee
eacc6ef
26a60ee
eacc6ef
 
26a60ee
eacc6ef
 
26a60ee
25dbc47
eacc6ef
25dbc47
 
eacc6ef
 
 
 
 
 
 
26a60ee
eacc6ef
 
 
 
 
25dbc47
 
eacc6ef
 
 
 
 
 
 
 
 
 
 
 
 
25dbc47
 
eacc6ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26a60ee
eacc6ef
 
26a60ee
 
eacc6ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26a60ee
eacc6ef
26a60ee
eacc6ef
26a60ee
 
 
eacc6ef
26a60ee
 
eacc6ef
26a60ee
eacc6ef
26a60ee
 
 
eacc6ef
26a60ee
eacc6ef
 
25dbc47
eacc6ef
 
 
 
 
25dbc47
 
26a60ee
eacc6ef
25dbc47
 
eacc6ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26a60ee
eacc6ef
26a60ee
 
eacc6ef
 
 
 
25dbc47
 
 
 
eacc6ef
25dbc47
eacc6ef
26a60ee
eacc6ef
 
 
 
 
26a60ee
25dbc47
26a60ee
eacc6ef
 
26a60ee
eacc6ef
25dbc47
26a60ee
25dbc47
 
 
 
 
 
 
 
 
 
 
eacc6ef
 
 
25dbc47
 
 
 
 
eacc6ef
 
25dbc47
 
 
 
 
eacc6ef
 
25dbc47
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D Interactive Cat</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/[email protected]/examples/js/controls/OrbitControls.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/loaders/GLTFLoader.min.js"></script>
    <style>
        body {
            margin: 0;
            overflow: hidden;
            touch-action: none;
        }
        #container {
            position: relative;
            width: 100vw;
            height: 100vh;
        }
        #loading {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.7);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: white;
            font-family: Arial, sans-serif;
            z-index: 100;
        }
        .spinner {
            width: 50px;
            height: 50px;
            border: 5px solid rgba(255,255,255,0.3);
            border-radius: 50%;
            border-top-color: #fff;
            animation: spin 1s ease-in-out infinite;
            margin-bottom: 20px;
        }
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
        #instructions {
            position: absolute;
            bottom: 20px;
            width: 100%;
            text-align: center;
            color: white;
            font-family: Arial, sans-serif;
            background: rgba(0,0,0,0.5);
            padding: 10px;
            box-sizing: border-box;
        }
    </style>
</head>
<body class="bg-gray-900">
    <div id="container">
        <div id="loading">
            <div class="spinner"></div>
            <h1 class="text-2xl font-bold mb-2">Loading 3D Cat...</h1>
            <p class="text-gray-300">Please wait while we prepare your interactive feline friend</p>
        </div>
        <div id="instructions">
            <p class="text-lg">Touch and drag to rotate the cat | Pinch to zoom</p>
            <p class="text-sm text-gray-300 hidden md:block">On desktop: Click and drag to rotate | Scroll to zoom</p>
        </div>
    </div>

    <script>
        // Initialize Three.js scene
        const container = document.getElementById('container');
        const loadingScreen = document.getElementById('loading');
        
        const scene = new THREE.Scene();
        scene.background = new THREE.Color(0x333333);
        
        const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
        camera.position.z = 5;
        
        const renderer = new THREE.WebGLRenderer({ antialias: true });
        renderer.setPixelRatio(window.devicePixelRatio);
        renderer.setSize(window.innerWidth, window.innerHeight);
        renderer.shadowMap.enabled = true;
        container.appendChild(renderer.domElement);
        
        // Add lights
        const ambientLight = new THREE.AmbientLight(0x404040);
        scene.add(ambientLight);
        
        const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
        directionalLight.position.set(1, 1, 1);
        directionalLight.castShadow = true;
        scene.add(directionalLight);
        
        const directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.5);
        directionalLight2.position.set(-1, -1, -1);
        scene.add(directionalLight2);
        
        // Add controls
        const controls = new THREE.OrbitControls(camera, renderer.domElement);
        controls.enableDamping = true;
        controls.dampingFactor = 0.05;
        controls.screenSpacePanning = false;
        controls.maxPolarAngle = Math.PI;
        controls.minPolarAngle = 0;
        controls.minDistance = 2;
        controls.maxDistance = 10;
        // Create a more realistic cat model
        function createCat() {
            const group = new THREE.Group();
            
            // Fur texture
            const furTexture = new THREE.TextureLoader().load('https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/textures/fur.jpg');
            furTexture.wrapS = furTexture.wrapT = THREE.RepeatWrapping;
            furTexture.repeat.set(2, 2);
            
            // Body (more cat-like shape)
            const bodyGeometry = new THREE.SphereGeometry(1, 64, 64);
            bodyGeometry.scale(1.5, 0.7, 0.8);
            const bodyMaterial = new THREE.MeshStandardMaterial({ 
                color: 0x9e9e9e,
                map: furTexture,
                roughness: 0.9,
                metalness: 0.0,
                bumpMap: furTexture,
                bumpScale: 0.1
            });
            const body = new THREE.Mesh(bodyGeometry, bodyMaterial);
            body.castShadow = true;
            body.receiveShadow = true;
            group.add(body);
            
            // Head (more realistic shape)
            const headGeometry = new THREE.SphereGeometry(0.6, 64, 64);
            headGeometry.scale(1.1, 0.9, 0.9);
            const headMaterial = new THREE.MeshStandardMaterial({ 
                color: 0x9e9e9e,
                map: furTexture,
                roughness: 0.9,
                metalness: 0.0
            });
            const head = new THREE.Mesh(headGeometry, headMaterial);
            head.position.set(1.2, 0.15, 0);
            head.castShadow = true;
            group.add(head);
            
            // Ears (more cat-like)
            const earGeometry = new THREE.ConeGeometry(0.25, 0.6, 64);
            earGeometry.rotateX(Math.PI / 2);
            
            // Inner ear
            const innerEarGeometry = new THREE.ConeGeometry(0.15, 0.5, 64);
            innerEarGeometry.rotateX(Math.PI / 2);
            const innerEarMaterial = new THREE.MeshStandardMaterial({ color: 0xff9999 });
            
            const leftEar = new THREE.Mesh(earGeometry, headMaterial);
            leftEar.position.set(1.5, 0.55, 0.35);
            leftEar.rotation.z = -0.5;
            group.add(leftEar);
            
            const leftInnerEar = new THREE.Mesh(innerEarGeometry, innerEarMaterial);
            leftInnerEar.position.set(1.5, 0.55, 0.35);
            leftInnerEar.rotation.z = -0.5;
            leftInnerEar.position.z += 0.05;
            group.add(leftInnerEar);
            
            const rightEar = new THREE.Mesh(earGeometry, headMaterial);
            rightEar.position.set(1.5, 0.55, -0.35);
            rightEar.rotation.z = 0.5;
            group.add(rightEar);
            
            const rightInnerEar = new THREE.Mesh(innerEarGeometry, innerEarMaterial);
            rightInnerEar.position.set(1.5, 0.55, -0.35);
            rightInnerEar.rotation.z = 0.5;
            rightInnerEar.position.z -= 0.05;
            group.add(rightInnerEar);
            
            // Eyes (more detailed)
            const eyeGeometry = new THREE.SphereGeometry(0.1, 32, 32);
            const eyeMaterial = new THREE.MeshStandardMaterial({ 
                color: 0x00aaff,
                roughness: 0.1,
                metalness: 0.3
            });
            
            const pupilGeometry = new THREE.SphereGeometry(0.06, 16, 16);
            const pupilMaterial = new THREE.MeshStandardMaterial({ color: 0x000000 });
            
            // Left eye
            const leftEye = new THREE.Mesh(eyeGeometry, eyeMaterial);
            leftEye.position.set(1.65, 0.15, 0.25);
            group.add(leftEye);
            
            const leftPupil = new THREE.Mesh(pupilGeometry, pupilMaterial);
            leftPupil.position.set(1.65, 0.15, 0.25);
            leftPupil.position.x += 0.05;
            group.add(leftPupil);
            
            // Right eye
            const rightEye = new THREE.Mesh(eyeGeometry, eyeMaterial);
            rightEye.position.set(1.65, 0.15, -0.25);
            group.add(rightEye);
            
            const rightPupil = new THREE.Mesh(pupilGeometry, pupilMaterial);
            rightPupil.position.set(1.65, 0.15, -0.25);
            rightPupil.position.x += 0.05;
            group.add(rightPupil);
            
            // Nose (more detailed)
            const noseGeometry = new THREE.SphereGeometry(0.08, 32, 32);
            noseGeometry.scale(1.5, 1, 1);
            const noseMaterial = new THREE.MeshStandardMaterial({ 
                color: 0xff9999,
                roughness: 0.5
            });
            const nose = new THREE.Mesh(noseGeometry, noseMaterial);
            nose.position.set(1.75, 0.05, 0);
            group.add(nose);
            
            // Mouth
            const mouthGeometry = new THREE.TorusGeometry(0.03, 0.01, 8, 16);
            mouthGeometry.rotateX(Math.PI / 2);
            const mouthMaterial = new THREE.MeshStandardMaterial({ color: 0x000000 });
            const mouth = new THREE.Mesh(mouthGeometry, mouthMaterial);
            mouth.position.set(1.8, -0.05, 0);
            group.add(mouth);
            
            // Whiskers (more numerous and curved)
            const whiskerMaterial = new THREE.LineBasicMaterial({ 
                color: 0xdddddd,
                linewidth: 2
            });
            
            // Left whiskers
            for (let i = 0; i < 6; i++) {
                const yOffset = -0.05 + (i * 0.02);
                const curve = new THREE.CubicBezierCurve3(
                    new THREE.Vector3(1.7, 0.05, 0.15),
                    new THREE.Vector3(1.8, 0.05 + yOffset, 0.3),
                    new THREE.Vector3(2.0, 0.05 + yOffset, 0.5),
                    new THREE.Vector3(2.2, 0.05 + yOffset, 0.7)
                );
                
                const whiskerGeometry = new THREE.BufferGeometry().setFromPoints(curve.getPoints(10));
                const whisker = new THREE.Line(whiskerGeometry, whiskerMaterial);
                group.add(whisker);
            }
            
            // Right whiskers
            for (let i = 0; i < 6; i++) {
                const yOffset = -0.05 + (i * 0.02);
                const curve = new THREE.CubicBezierCurve3(
                    new THREE.Vector3(1.7, 0.05, -0.15),
                    new THREE.Vector3(1.8, 0.05 + yOffset, -0.3),
                    new THREE.Vector3(2.0, 0.05 + yOffset, -0.5),
                    new THREE.Vector3(2.2, 0.05 + yOffset, -0.7)
                );
                
                const whiskerGeometry = new THREE.BufferGeometry().setFromPoints(curve.getPoints(10));
                const whisker = new THREE.Line(whiskerGeometry, whiskerMaterial);
                group.add(whisker);
            }
            
            // Legs (more cat-like)
            const legGeometry = new THREE.CylinderGeometry(0.12, 0.08, 0.6, 32);
            const legMaterial = new THREE.MeshStandardMaterial({ 
                color: 0x9e9e9e,
                map: furTexture
            });
            
            // Front legs (with paws)
            const frontLeftLeg = new THREE.Mesh(legGeometry, legMaterial);
            frontLeftLeg.position.set(0.6, -0.6, 0.45);
            frontLeftLeg.rotation.x = Math.PI / 2;
            frontLeftLeg.rotation.z = -0.2;
            group.add(frontLeftLeg);
            
            const frontRightLeg = new THREE.Mesh(legGeometry, legMaterial);
            frontRightLeg.position.set(0.6, -0.6, -0.45);
            frontRightLeg.rotation.x = Math.PI / 2;
            frontRightLeg.rotation.z = 0.2;
            group.add(frontRightLeg);
            
            // Back legs (more muscular)
            const backLegGeometry = new THREE.CylinderGeometry(0.15, 0.1, 0.7, 32);
            const backLeftLeg = new THREE.Mesh(backLegGeometry, legMaterial);
            backLeftLeg.position.set(-0.5, -0.65, 0.45);
            backLeftLeg.rotation.x = Math.PI / 2;
            backLeftLeg.rotation.z = -0.1;
            group.add(backLeftLeg);
            
            const backRightLeg = new THREE.Mesh(backLegGeometry, legMaterial);
            backRightLeg.position.set(-0.5, -0.65, -0.45);
            backRightLeg.rotation.x = Math.PI / 2;
            backRightLeg.rotation.z = 0.1;
            group.add(backRightLeg);
            
            // Paws for all legs
            const pawGeometry = new THREE.SphereGeometry(0.1, 32, 32);
            pawGeometry.scale(1.5, 0.5, 1);
            
            // Front paws
            const frontLeftPaw = new THREE.Mesh(pawGeometry, legMaterial);
            frontLeftPaw.position.set(0.6, -0.6, 0.6);
            group.add(frontLeftPaw);
            
            const frontRightPaw = new THREE.Mesh(pawGeometry, legMaterial);
            frontRightPaw.position.set(0.6, -0.6, -0.6);
            group.add(frontRightPaw);
            
            // Back paws
            const backLeftPaw = new THREE.Mesh(pawGeometry, legMaterial);
            backLeftPaw.position.set(-0.5, -0.65, 0.6);
            group.add(backLeftPaw);
            
            const backRightPaw = new THREE.Mesh(pawGeometry, legMaterial);
            backRightPaw.position.set(-0.5, -0.65, -0.6);
            group.add(backRightPaw);
            
            // Tail (more fluffy and natural curve)
            const tailCurve = new THREE.CatmullRomCurve3([
                new THREE.Vector3(-1.2, -0.3, 0),
                new THREE.Vector3(-1.8, -0.2, 0.2),
                new THREE.Vector3(-2.2, 0.1, 0.4),
                new THREE.Vector3(-2.4, 0.5, 0.2),
                new THREE.Vector3(-2.5, 0.8, -0.2)
            ]);
            
            const tailGeometry = new THREE.TubeGeometry(tailCurve, 64, 0.15, 32, false);
            const tail = new THREE.Mesh(tailGeometry, bodyMaterial);
            group.add(tail);
            
            // Add subtle fur effect using particles
            const furParticles = new THREE.BufferGeometry();
            const particleCount = 2000;
            const positions = new Float32Array(particleCount * 3);
            
            for (let i = 0; i < particleCount; i++) {
                positions[i * 3] = (Math.random() - 0.5) * 3;
                positions[i * 3 + 1] = (Math.random() - 0.5) * 2;
                positions[i * 3 + 2] = (Math.random() - 0.5) * 2;
            }
            
            furParticles.setAttribute('position', new THREE.BufferAttribute(positions, 3));
            const furMaterial = new THREE.PointsMaterial({
                color: 0xdddddd,
                size: 0.03,
                transparent: true,
                opacity: 0.6
            });
            
            const fur = new THREE.Points(furParticles, furMaterial);
            group.add(fur);
return group;
        }
        
        // Create and add cat to scene
        const cat = createCat();
        scene.add(cat);
        // Add more realistic floor
        const floorGeometry = new THREE.PlaneGeometry(20, 20);
        const floorTexture = new THREE.TextureLoader().load('https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/textures/hardwood2_diffuse.jpg');
        floorTexture.wrapS = floorTexture.wrapT = THREE.RepeatWrapping;
        floorTexture.repeat.set(4, 4);
        
        const floorBumpMap = new THREE.TextureLoader().load('https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/textures/hardwood2_bump.jpg');
        floorBumpMap.wrapS = floorBumpMap.wrapT = THREE.RepeatWrapping;
        floorBumpMap.repeat.set(4, 4);
        
        const floorMaterial = new THREE.MeshStandardMaterial({ 
            map: floorTexture,
            bumpMap: floorBumpMap,
            bumpScale: 0.1,
            roughness: 0.7,
            metalness: 0.1
        });
const floor = new THREE.Mesh(floorGeometry, floorMaterial);
        floor.rotation.x = -Math.PI / 2;
        floor.position.y = -0.8;
        floor.receiveShadow = true;
        scene.add(floor);
        
        // Hide loading screen after a short delay (simulating loading)
        setTimeout(() => {
            loadingScreen.style.opacity = 0;
            setTimeout(() => {
                loadingScreen.style.display = 'none';
            }, 500);
        }, 1500);
        
        // Handle window resize
        window.addEventListener('resize', () => {
            camera.aspect = window.innerWidth / window.innerHeight;
            camera.updateProjectionMatrix();
            renderer.setSize(window.innerWidth, window.innerHeight);
        });
        
        // Animation loop
        function animate() {
            requestAnimationFrame(animate);
            controls.update();
            renderer.render(scene, camera);
        }
        
        animate();
    </script>
<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://enzostvs-deepsite.hf.space/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://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Broshy/deepsite-3d-cat-touch-controls" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>