Skip to content

Commit 9acdace

Browse files
authored
Manual: Honor latest changes. (#26353)
1 parent edefdc2 commit 9acdace

File tree

68 files changed

+6109
-6121
lines changed

Some content is hidden

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

68 files changed

+6109
-6121
lines changed

manual/en/backgrounds.html

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ <h1>Backgrounds and Skyboxes</h1>
7373
a texture.</p>
7474
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">const loader = new THREE.TextureLoader();
7575
const bgTexture = loader.load('resources/images/daikanyama.jpg');
76+
bgTexture.colorSpace = THREE.SRGBColorSpace;
7677
scene.background = bgTexture;
7778
</pre>
7879
<p>which gives us</p>
@@ -219,11 +220,6 @@ <h1>Backgrounds and Skyboxes</h1>
219220
<a href="https://hdrihaven.com">this site</a>.</p>
220221
<div class="threejs_center"><img src="../examples/resources/images/equirectangularmaps/tears_of_steel_bridge_2k.jpg" style="width: 600px"></div>
221222

222-
<p>It's not much different. First we load the equirectangular image as a texture
223-
and then, in the callback after it has loaded, we can call <a href="/docs/#api/en/renderers/WebGLCubeRenderTarget.fromEquirectangularTexture"><code class="notranslate" translate="no">WebGLCubeRenderTarget.fromEquirectangularTexture</code></a>
224-
which will generate a cubemap from the equirectangular texture for us.
225-
We pass in the size we want the cubemap to be to <a href="/docs/#api/en/renderers/WebGLCubeRenderTarget"><code class="notranslate" translate="no">WebGLCubeRenderTarget</code></a>.
226-
Passing in the height of the equirectangular image seems like a good bet.</p>
227223
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">{
228224
- const loader = new THREE.CubeTextureLoader();
229225
- const texture = loader.load([
@@ -239,9 +235,9 @@ <h1>Backgrounds and Skyboxes</h1>
239235
+ const texture = loader.load(
240236
+ 'resources/images/equirectangularmaps/tears_of_steel_bridge_2k.jpg',
241237
+ () =&gt; {
242-
+ const rt = new THREE.WebGLCubeRenderTarget(texture.image.height);
243-
+ rt.fromEquirectangularTexture(renderer, texture);
244-
+ scene.background = rt.texture;
238+
+ texture.mapping = THREE.EquirectangularReflectionMapping;
239+
+ texture.colorSpace = THREE.SRGBColorSpace;
240+
+ scene.background = texture;
245241
+ });
246242
}
247243
</pre>

manual/en/custom-buffergeometry.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,7 @@ <h1>Custom BufferGeometry</h1>
436436
make your own geometry and how to dynamically update the contents of a
437437
<a href="/docs/#api/en/core/BufferAttribute"><code class="notranslate" translate="no">BufferAttribute</code></a>.</p>
438438
<!-- needed in English only to prevent warning from outdated translations -->
439-
<p><a href="resources/threejs-geometry.svg"></a>
440-
<a href="custom-geometry.html"></a></p>
439+
<p><a href="resources/threejs-geometry.svg"></a></p>
441440
<p><canvas id="c"></canvas></p>
442441
<script type="module" src="../resources/threejs-custom-buffergeometry.js"></script>
443442

manual/en/fundamentals.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ <h1>Fundamentals</h1>
273273
three.js which we'll go over in <a href="lights.html">a future article</a>. For now let's create a directional light.</p>
274274
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">{
275275
const color = 0xFFFFFF;
276-
const intensity = 1;
276+
const intensity = 3;
277277
const light = new THREE.DirectionalLight(color, intensity);
278278
light.position.set(-1, 2, 4);
279279
scene.add(light);

manual/examples/3dlut-base-cube-maker.html

Lines changed: 78 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -26,63 +26,88 @@ <h1>Color Cube Image Maker</h1>
2626
</body>
2727
<script type="module">
2828

29-
const ctx = document.querySelector('canvas').getContext('2d');
30-
31-
function drawColorCubeImage(ctx, size) {
32-
const canvas = ctx.canvas;
33-
canvas.width = size * size;
34-
canvas.height = size;
35-
36-
for (let zz = 0; zz < size; ++zz) {
37-
for (let yy = 0; yy < size; ++yy) {
38-
for (let xx = 0; xx < size; ++xx) {
39-
const r = Math.floor(xx / (size - 1) * 255);
40-
const g = Math.floor(yy / (size - 1) * 255);
41-
const b = Math.floor(zz / (size - 1) * 255);
42-
ctx.fillStyle = `rgb(${r},${g},${b})`;
43-
ctx.fillRect(zz * size + xx, yy, 1, 1);
44-
}
45-
}
46-
}
47-
document.querySelector('#width').textContent = canvas.width;
48-
document.querySelector('#height').textContent = canvas.height;
29+
const ctx = document.querySelector( 'canvas' ).getContext( '2d' );
30+
31+
function drawColorCubeImage( ctx, size ) {
32+
33+
const canvas = ctx.canvas;
34+
canvas.width = size * size;
35+
canvas.height = size;
36+
37+
for ( let zz = 0; zz < size; ++ zz ) {
38+
39+
for ( let yy = 0; yy < size; ++ yy ) {
40+
41+
for ( let xx = 0; xx < size; ++ xx ) {
42+
43+
const r = Math.floor( xx / ( size - 1 ) * 255 );
44+
const g = Math.floor( yy / ( size - 1 ) * 255 );
45+
const b = Math.floor( zz / ( size - 1 ) * 255 );
46+
ctx.fillStyle = `rgb(${r},${g},${b})`;
47+
ctx.fillRect( zz * size + xx, yy, 1, 1 );
48+
49+
}
50+
51+
}
52+
53+
}
54+
55+
document.querySelector( '#width' ).textContent = canvas.width;
56+
document.querySelector( '#height' ).textContent = canvas.height;
57+
4958
}
5059

51-
drawColorCubeImage(ctx, 8);
52-
53-
function handleSizeChange(event) {
54-
const elem = event.target;
55-
elem.style.background = '';
56-
try {
57-
const size = parseInt(elem.value);
58-
if (size >= 2 && size <= 64) {
59-
drawColorCubeImage(ctx, size);
60-
}
61-
} catch (e) {
62-
elem.style.background = 'red';
63-
}
60+
drawColorCubeImage( ctx, 8 );
61+
62+
function handleSizeChange( event ) {
63+
64+
const elem = event.target;
65+
elem.style.background = '';
66+
try {
67+
68+
const size = parseInt( elem.value );
69+
if ( size >= 2 && size <= 64 ) {
70+
71+
drawColorCubeImage( ctx, size );
72+
73+
}
74+
75+
} catch ( e ) {
76+
77+
elem.style.background = 'red';
78+
79+
}
80+
6481
}
6582

66-
const sizeElem = document.querySelector('#size');
67-
sizeElem.addEventListener('change', handleSizeChange, true);
68-
69-
const saveData = (function() {
70-
const a = document.createElement('a');
71-
document.body.appendChild(a);
72-
a.style.display = 'none';
73-
return function saveData(blob, fileName) {
74-
const url = window.URL.createObjectURL(blob);
75-
a.href = url;
76-
a.download = fileName;
77-
a.click();
78-
};
79-
}());
80-
81-
document.querySelector('button').addEventListener('click', () => {
82-
ctx.canvas.toBlob((blob) => {
83-
saveData(blob, `identity-lut-s${ctx.canvas.height}.png`);
84-
});
85-
});
83+
const sizeElem = document.querySelector( '#size' );
84+
sizeElem.addEventListener( 'change', handleSizeChange, true );
85+
86+
const saveData = ( function () {
87+
88+
const a = document.createElement( 'a' );
89+
document.body.appendChild( a );
90+
a.style.display = 'none';
91+
return function saveData( blob, fileName ) {
92+
93+
const url = window.URL.createObjectURL( blob );
94+
a.href = url;
95+
a.download = fileName;
96+
a.click();
97+
98+
};
99+
100+
}() );
101+
102+
document.querySelector( 'button' ).addEventListener( 'click', () => {
103+
104+
ctx.canvas.toBlob( ( blob ) => {
105+
106+
saveData( blob, `identity-lut-s${ctx.canvas.height}.png` );
107+
108+
} );
109+
110+
} );
86111

87112
</script>
88113
</html>

0 commit comments

Comments
 (0)