File size: 6,412 Bytes
6ce4ca6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!--
Auto-generated by: https://github.com/threlte/threlte/tree/main/packages/gltf
Command: npx @threlte/gltf@3.0.1 /Users/julienblanchon/Downloads/gpu/scene.gltf --output ./src/lib/components/3d/elements/gpu/ --types
Author: Cem Gürbüz (https://sketchfab.com/cemgurbuzz)
License: CC-BY-NC-4.0 (http://creativecommons.org/licenses/by-nc/4.0/)
Source: https://sketchfab.com/3d-models/nvidia-geforce-rtx-3090-9b7cd73fefd5435f99f891567f5a9c2e
Title: Nvidia GeForce RTX 3090
-->

<script lang="ts">
  import type * as THREE from 'three'

  import type { Snippet } from 'svelte'
  import { T, type Props } from '@threlte/core'
  import { useGltf } from '@threlte/extras'

  let {
    fan_rotation = 0,
    fallback,
    error,
    children,
    ref = $bindable(),
    ...props
  }: Props<THREE.Group<THREE.Object3DEventMap>> & {
    fan_rotation?: number
    ref?: THREE.Group<THREE.Object3DEventMap> | undefined
    children?: Snippet<[{ ref: THREE.Group<THREE.Object3DEventMap> | undefined }]>
    fallback?: Snippet
    error?: Snippet<[{ error: Error }]>
  } = $props()

  type GLTFResult = {
    nodes: {
      Metal_Frame_Metal_0: THREE.Mesh
      Front_Cover_Black_0: THREE.Mesh
      Fan_Circle_Black_Fan_0: THREE.Mesh
      Fan_F_Black_Fan_0: THREE.Mesh
      Fan_F_Slot1_0: THREE.Mesh
      Front_Cover_U_Black_0: THREE.Mesh
      Front_Cover_T_Black_0: THREE.Mesh
      Fan_Circle_B_Black_Fan_0: THREE.Mesh
      Grills_U_Metal_Black_0: THREE.Mesh
      Grills_T_Metal_Black_0: THREE.Mesh
      Plane010_Black001_0: THREE.Mesh
      Socket_Slot_0: THREE.Mesh
      Side_Metal_Part_Metal_S_0: THREE.Mesh
      Grills_F003_Metal_Black_0: THREE.Mesh
      Grills_F002_Metal_Black_0: THREE.Mesh
      Fan_B_Black_Fan_0: THREE.Mesh
      Fan_B_Slot1_0: THREE.Mesh
    }
    materials: {
      Metal: THREE.MeshStandardMaterial
      Black: THREE.MeshStandardMaterial
      Black_Fan: THREE.MeshStandardMaterial
      ['Slot.1']: THREE.MeshStandardMaterial
      Metal_Black: THREE.MeshStandardMaterial
      ['Black.001']: THREE.MeshStandardMaterial
      Slot: THREE.MeshStandardMaterial
      Metal_S: THREE.MeshStandardMaterial
    }
  }

  const gltf = useGltf<GLTFResult>('/gpu/scene.gltf')
</script>

<T.Group
  bind:ref
  dispose={false}
  {...props as any}
>
  {#await gltf}
    {@render fallback?.()}
  {:then gltf}
    <T.Group scale={0.01}>
      <T.Group
        position={[127.5, 88.51, 10.29]}
        rotation={[Math.PI / 2, 0.05, 0]}
        scale={0.3}
      >
        <T.Mesh
          geometry={gltf.nodes.Fan_F_Black_Fan_0.geometry}
          material={gltf.materials.Black_Fan}
          rotation={[0, fan_rotation, 0]}
        />
        <T.Mesh
          geometry={gltf.nodes.Fan_F_Slot1_0.geometry}
          material={gltf.materials['Slot.1']}
        />
      </T.Group>
      <T.Group
        position={[-123.9, 88.51, -37.82]}
        rotation={[Math.PI / 2, -0.05, Math.PI]}
        scale={0.3}
      >
        <T.Mesh
          geometry={gltf.nodes.Fan_B_Black_Fan_0.geometry}
          material={gltf.materials.Black_Fan}
          rotation={[0, fan_rotation, 0]}
        />
        <T.Mesh
          geometry={gltf.nodes.Fan_B_Slot1_0.geometry}
          material={gltf.materials['Slot.1']}
          
        />
      </T.Group>
      <T.Mesh
        geometry={gltf.nodes.Metal_Frame_Metal_0.geometry}
        material={gltf.materials.Metal}
        position={[0, 88.3, -8.47]}
        rotation={[Math.PI / 2, 0, 0]}
      />
      <T.Mesh
        geometry={gltf.nodes.Front_Cover_Black_0.geometry}
        material={gltf.materials.Black}
        position={[-122.3, 89.69, 12.11]}
        rotation={[Math.PI / 2, 0, 0]}
        scale={[1, 1, 0.84]}
      />
      <T.Mesh
        geometry={gltf.nodes.Fan_Circle_Black_Fan_0.geometry}
        material={gltf.materials.Black_Fan}
        position={[127.5, 88.51, 10.29]}
        rotation={[Math.PI / 2, 0, 0]}
        scale={0.79}
      />
      <T.Mesh
        geometry={gltf.nodes.Front_Cover_U_Black_0.geometry}
        material={gltf.materials.Black}
        position={[0.02, 26.08, 14.09]}
        rotation={[Math.PI / 2, 0, 0]}
      />
      <T.Mesh
        geometry={gltf.nodes.Front_Cover_T_Black_0.geometry}
        material={gltf.materials.Black}
        position={[-4.75, 163.4, 14.09]}
        rotation={[-Math.PI / 2 , 0, -Math.PI]}
      />
      <T.Mesh
        geometry={gltf.nodes.Fan_Circle_B_Black_Fan_0.geometry}
        material={gltf.materials.Black_Fan}
        position={[-124.15, 88.51, -40.18]}
        rotation={[Math.PI / 2, 0, Math.PI]}
        scale={0.79}
      />
      <T.Mesh
        geometry={gltf.nodes.Grills_U_Metal_Black_0.geometry}
        material={gltf.materials.Metal_Black}
        position={[-0.12, 3.16, 3.09]}
        rotation={[Math.PI / 2, -Math.PI / 4, 0]}
        scale={[0.55, 11.75, 0.55]}
      />
      <T.Mesh
        geometry={gltf.nodes.Grills_T_Metal_Black_0.geometry}
        material={gltf.materials.Metal_Black}
        position={[0.8, 174.49, 3.09]}
        rotation={[-Math.PI / 2, Math.PI / 4, -Math.PI]}
        scale={[0.55, 11.75, 0.55]}
      />
      <T.Mesh
        geometry={gltf.nodes.Plane010_Black001_0.geometry}
        material={gltf.materials['Black.001']}
        position={[121.84, 88.42, -34.24]}
        rotation={[-Math.PI / 2, 0, -Math.PI]}
        scale={[1, 1, 0.84]}
      />
      <T.Mesh
        geometry={gltf.nodes.Socket_Slot_0.geometry}
        material={gltf.materials.Slot}
        position={[-149.71, 187.47, -39.01]}
        rotation={[Math.PI / 2, 0, 0]}
        scale={[1, 1.93, 1]}
      />
      <T.Mesh
        geometry={gltf.nodes.Side_Metal_Part_Metal_S_0.geometry}
        material={gltf.materials.Metal_S}
        position={[-225.87, 118.09, -12.54]}
        rotation={[Math.PI / 2, 0, 0]}
      />
      <T.Mesh
        geometry={gltf.nodes.Grills_F003_Metal_Black_0.geometry}
        material={gltf.materials.Metal_Black}
        position={[131.49, 88.84, -23.02]}
        rotation={[Math.PI / 2, 0, 0]}
        scale={[1, 1, 1.02]}
      />
      <T.Mesh
        geometry={gltf.nodes.Grills_F002_Metal_Black_0.geometry}
        material={gltf.materials.Metal_Black}
        position={[-128.18, 88.84, -4.17]}
        rotation={[Math.PI / 2, 0, Math.PI]}
        scale={[1, 0.97, 1.02]}
      />
    </T.Group>
  {:catch err}
    {@render error?.({ error: err })}
  {/await}

  {@render children?.({ ref })}
</T.Group>