Skip to content

Commit f5a1efe

Browse files
committed
Added llms.txt, llms-full.txt and llms/build.js script.
1 parent adfc785 commit f5a1efe

File tree

773 files changed

+88423
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

773 files changed

+88423
-4
lines changed
File renamed without changes.

docs/llms-full.txt

Lines changed: 2617 additions & 0 deletions
Large diffs are not rendered by default.

docs/llms.txt

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Three.js
2+
3+
> Three.js is a cross-browser JavaScript library for creating 3D graphics using WebGL and WebGPU.
4+
5+
## Instructions for Large Language Models
6+
7+
When generating Three.js code, follow these guidelines:
8+
9+
### 1. Use Import Maps (Not Old CDN Patterns)
10+
11+
WRONG - outdated pattern:
12+
```html
13+
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
14+
```
15+
16+
CORRECT - modern pattern (always use latest version):
17+
```html
18+
<script type="importmap">
19+
{
20+
"imports": {
21+
"three": "https://cdn.jsdelivr.net/npm/three@0.182.0/build/three.module.js",
22+
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.182.0/examples/jsm/"
23+
}
24+
}
25+
</script>
26+
<script type="module">
27+
import * as THREE from 'three';
28+
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
29+
</script>
30+
```
31+
32+
### 2. Choosing Between WebGLRenderer and WebGPURenderer
33+
34+
Three.js maintains both renderers:
35+
36+
**Use WebGLRenderer** (default, mature):
37+
- Maximum browser compatibility
38+
- Well-established, many years of development
39+
- Most examples and tutorials use this
40+
41+
```js
42+
import * as THREE from 'three';
43+
const renderer = new THREE.WebGLRenderer();
44+
```
45+
46+
**Use WebGPURenderer** when you need:
47+
- Custom shaders/materials using TSL (Three.js Shading Language)
48+
- Compute shaders
49+
- Advanced node-based materials
50+
51+
```js
52+
import * as THREE from 'three/webgpu';
53+
const renderer = new THREE.WebGPURenderer();
54+
await renderer.init();
55+
```
56+
57+
### 3. TSL (Three.js Shading Language)
58+
59+
When using WebGPURenderer, use TSL instead of raw GLSL for custom materials:
60+
61+
```js
62+
import { texture, uv, color } from 'three/tsl';
63+
64+
const material = new THREE.MeshStandardNodeMaterial();
65+
material.colorNode = texture( myTexture ).mul( color( 0xff0000 ) );
66+
```
67+
68+
TSL benefits:
69+
- Works with both WebGL and WebGPU backends
70+
- No string manipulation or onBeforeCompile hacks
71+
- Type-safe, composable shader nodes
72+
- Automatic optimization
73+
74+
### 4. NodeMaterial Classes (for WebGPU/TSL)
75+
76+
When using TSL, use node-based materials:
77+
- MeshBasicNodeMaterial
78+
- MeshStandardNodeMaterial
79+
- MeshPhysicalNodeMaterial
80+
- LineBasicNodeMaterial
81+
- SpriteNodeMaterial
82+
83+
## Getting Started
84+
85+
- [Installation](https://threejs.org/manual/#en/installation)
86+
- [Creating a Scene](https://threejs.org/manual/#en/creating-a-scene)
87+
- [Fundamentals](https://threejs.org/manual/#en/fundamentals)
88+
- [Responsive Design](https://threejs.org/manual/#en/responsive)
89+
90+
## Renderer Guides
91+
92+
- [WebGPURenderer](https://threejs.org/manual/#en/webgpurenderer)
93+
94+
## Core Concepts
95+
96+
- [TSL Specification](https://threejs.org/docs/#api/en/nodes/TSL): Complete shader language reference
97+
- [Animation System](https://threejs.org/manual/#en/animation-system)
98+
- [Loading 3D Models](https://threejs.org/manual/#en/loading-3d-models)
99+
- [Scene Graph](https://threejs.org/manual/#en/scenegraph)
100+
- [Materials](https://threejs.org/manual/#en/materials)
101+
- [Textures](https://threejs.org/manual/#en/textures)
102+
- [Lights](https://threejs.org/manual/#en/lights)
103+
- [Cameras](https://threejs.org/manual/#en/cameras)
104+
- [Shadows](https://threejs.org/manual/#en/shadows)
105+
106+
## Essential API
107+
108+
### Core
109+
- [Object3D](https://threejs.org/docs/#api/en/core/Object3D)
110+
- [BufferGeometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
111+
- [BufferAttribute](https://threejs.org/docs/#api/en/core/BufferAttribute)
112+
113+
### Scenes
114+
- [Scene](https://threejs.org/docs/#api/en/scenes/Scene)
115+
116+
### Cameras
117+
- [PerspectiveCamera](https://threejs.org/docs/#api/en/cameras/PerspectiveCamera)
118+
- [OrthographicCamera](https://threejs.org/docs/#api/en/cameras/OrthographicCamera)
119+
120+
### Renderers
121+
- [WebGLRenderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
122+
- [WebGPURenderer](https://threejs.org/docs/#api/en/renderers/webgpu/WebGPURenderer)
123+
124+
### Objects
125+
- [Mesh](https://threejs.org/docs/#api/en/objects/Mesh)
126+
- [InstancedMesh](https://threejs.org/docs/#api/en/objects/InstancedMesh)
127+
- [Group](https://threejs.org/docs/#api/en/objects/Group)
128+
129+
### Materials
130+
- [MeshBasicMaterial](https://threejs.org/docs/#api/en/materials/MeshBasicMaterial)
131+
- [MeshStandardMaterial](https://threejs.org/docs/#api/en/materials/MeshStandardMaterial)
132+
- [MeshPhysicalMaterial](https://threejs.org/docs/#api/en/materials/MeshPhysicalMaterial)
133+
134+
### Geometries
135+
- [BoxGeometry](https://threejs.org/docs/#api/en/geometries/BoxGeometry)
136+
- [SphereGeometry](https://threejs.org/docs/#api/en/geometries/SphereGeometry)
137+
- [PlaneGeometry](https://threejs.org/docs/#api/en/geometries/PlaneGeometry)
138+
139+
### Lights
140+
- [AmbientLight](https://threejs.org/docs/#api/en/lights/AmbientLight)
141+
- [DirectionalLight](https://threejs.org/docs/#api/en/lights/DirectionalLight)
142+
- [PointLight](https://threejs.org/docs/#api/en/lights/PointLight)
143+
- [SpotLight](https://threejs.org/docs/#api/en/lights/SpotLight)
144+
145+
### Loaders
146+
- [TextureLoader](https://threejs.org/docs/#api/en/loaders/TextureLoader)
147+
- [GLTFLoader](https://threejs.org/docs/#examples/en/loaders/GLTFLoader)
148+
149+
### Controls
150+
- [OrbitControls](https://threejs.org/docs/#examples/en/controls/OrbitControls)
151+
- [TransformControls](https://threejs.org/docs/#examples/en/controls/TransformControls)
152+
153+
### Math
154+
- [Vector2](https://threejs.org/docs/#api/en/math/Vector2)
155+
- [Vector3](https://threejs.org/docs/#api/en/math/Vector3)
156+
- [Matrix4](https://threejs.org/docs/#api/en/math/Matrix4)
157+
- [Quaternion](https://threejs.org/docs/#api/en/math/Quaternion)
158+
- [Color](https://threejs.org/docs/#api/en/math/Color)

docs/pages/AMFLoader.html.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
*Inheritance: Loader →*
2+
3+
# AMFLoader
4+
5+
A loader for the AMF format.
6+
7+
The loader supports materials, color and ZIP compressed files. No constellation support (yet).
8+
9+
## Code Example
10+
11+
```js
12+
const loader = new AMFLoader();
13+
const object = await loader.loadAsync( './models/amf/rook.amf' );
14+
scene.add( object );
15+
```
16+
17+
## Import
18+
19+
AMFLoader is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation).
20+
21+
```js
22+
import { AMFLoader } from 'three/addons/loaders/AMFLoader.js';
23+
```
24+
25+
## Constructor
26+
27+
### new AMFLoader( manager : LoadingManager )
28+
29+
Constructs a new AMF loader.
30+
31+
**manager**
32+
33+
The loading manager.
34+
35+
## Methods
36+
37+
### .load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback )
38+
39+
Starts loading from the given URL and passes the loaded AMF asset to the `onLoad()` callback.
40+
41+
**url**
42+
43+
The path/URL of the file to be loaded. This can also be a data URI.
44+
45+
**onLoad**
46+
47+
Executed when the loading process has been finished.
48+
49+
**onProgress**
50+
51+
Executed while the loading is in progress.
52+
53+
**onError**
54+
55+
Executed when errors occur.
56+
57+
**Overrides:** [Loader#load](Loader.html#load)
58+
59+
### .parse( data : ArrayBuffer ) : Group
60+
61+
Parses the given AMF data and returns the resulting group.
62+
63+
**data**
64+
65+
The raw AMF asset data as an array buffer.
66+
67+
**Overrides:** [Loader#parse](Loader.html#parse)
68+
69+
**Returns:** A group representing the parsed asset.
70+
71+
## Source
72+
73+
[examples/jsm/loaders/AMFLoader.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/AMFLoader.js)

docs/pages/AONode.html.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
*Inheritance: EventDispatcher → Node → LightingNode →*
2+
3+
# AONode
4+
5+
A generic class that can be used by nodes which contribute ambient occlusion to the scene. E.g. an ambient occlusion map node can be used as input for this module. Used in [NodeMaterial](NodeMaterial.html).
6+
7+
## Constructor
8+
9+
### new AONode( aoNode : Node.<float> )
10+
11+
Constructs a new AO node.
12+
13+
**aoNode**
14+
15+
The ambient occlusion node.
16+
17+
Default is `null`.
18+
19+
## Properties
20+
21+
### .aoNode : Node.<float>
22+
23+
The ambient occlusion node.
24+
25+
Default is `null`.
26+
27+
## Source
28+
29+
[src/nodes/lighting/AONode.js](https://github.com/mrdoob/three.js/blob/master/src/nodes/lighting/AONode.js)

docs/pages/ARButton.html.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# ARButton
2+
3+
A utility class for creating a button that allows to initiate immersive AR sessions based on WebXR. The button can be created with a factory method and then appended ot the website's DOM.
4+
5+
## Code Example
6+
7+
```js
8+
document.body.appendChild( ARButton.createButton( renderer ) );
9+
```
10+
11+
## Import
12+
13+
ARButton is an addon, and must be imported explicitly, see [Installation#Addons](https://threejs.org/manual/#en/installation).
14+
15+
```js
16+
import { ARButton } from 'three/addons/webxr/ARButton.js';
17+
```
18+
19+
## Static Methods
20+
21+
### .createButton( renderer : WebGLRenderer | WebGPURenderer, sessionInit : XRSessionInit ) : HTMLElement
22+
23+
Constructs a new AR button.
24+
25+
**renderer**
26+
27+
The renderer.
28+
29+
**sessionInit**
30+
31+
The a configuration object for the AR session.
32+
33+
**Returns:** The button or an error message if `immersive-ar` isn't supported.
34+
35+
## Source
36+
37+
[examples/jsm/webxr/ARButton.js](https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/ARButton.js)

0 commit comments

Comments
 (0)