Browse Source

docs: add docs for the Sky object instance (#28529)

* docs: 27034 Add docs for the Sky Object instance

* add inheritance information, delete random hardcode number in example

* Update Sky.html

Clean up.

* Update Sky.html

More clean up.

---------

Co-authored-by: Michael Herzog <[email protected]>
Jaime A Torrealba C 1 year ago
parent
commit
b9a846df12
2 changed files with 93 additions and 1 deletions
  1. 91 0
      docs/examples/en/objects/Sky.html
  2. 2 1
      docs/list.json

+ 91 - 0
docs/examples/en/objects/Sky.html

@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:Mesh] &rarr;
+
+		<h1>[name]</h1>
+
+		<p class="desc">
+			[name] creates a ready to go sky environment for your scenes.
+		</p>
+
+		<h2>Import</h2>
+
+		<p>
+			[name] is an add-on, and therefore must be imported explicitly.
+			See [link:#manual/introduction/Installation Installation / Addons].
+		</p>
+
+		<code>
+			import { Sky } from 'three/addons/objects/Sky.js';
+		</code>
+
+		<h2>Code Example</h2>
+
+		<code>
+		const sky = new Sky();<br />
+		sky.scale.setScalar( 450000 );<br />
+
+		const phi = MathUtils.degToRad( 90 );<br />
+		const theta = MathUtils.degToRad( 180 );<br />
+		const sunPosition = new Vector3().setFromSphericalCoords( 1, phi, theta );<br />
+
+		sky.material.uniforms.sunPosition.value = sunPosition;<br />
+
+		scene.add( sky );
+		</code>
+
+		<h2>Examples</h2>
+
+		<p>[example:webgl_shaders_sky misc / objects / Sky ]</p>
+
+		<h2>Constructor</h2>
+
+		<h3>[name]()</h3>
+		<p>
+		Create a new [name] instance.
+		</p>
+
+		<h2>Properties</h2>
+		<p>
+		[name] instance is a [page:Mesh] with a pre-defined [page:ShaderMaterial], so every property described here should be set using [page:Uniform]s.
+		</p>
+
+		<h3>[property:Number turbidity]</h3>
+		<p>
+		Haziness of the [name].
+		</p>
+		<h3>[property:Number rayleigh]</h3>
+		<p>
+		For a more detailed explanation see: [link:https://en.wikipedia.org/wiki/Rayleigh_scattering Rayleigh scattering] .
+		</p>
+		<h3>[property:Number mieCoefficient]</h3>
+		<p>
+		[link:https://en.wikipedia.org/wiki/Mie_scattering Mie scattering] amount.
+		</p>
+		<h3>[property:Number mieDirectionalG]</h3>
+		<p>
+		[link:https://en.wikipedia.org/wiki/Mie_scattering Mie scattering] direction.
+		</p>
+		<h3>[property:Vector3 sunPosition]</h3>
+		<p>
+		The position of the sun.
+		</p>
+		<h3>[property:Vector3 up]</h3>
+		<p>
+		The sun's elevation from the horizon, in degrees.
+		</p>
+
+		<h2>Source</h2>
+
+		<p>
+		[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Sky.js examples/jsm/objects/Sky.js]
+		</p>
+	</body>
+</html>

+ 2 - 1
docs/list.json

@@ -378,7 +378,8 @@
 			},
 			},
 
 
 			"Objects": {
 			"Objects": {
-				"Lensflare": "examples/en/objects/Lensflare"
+				"Lensflare": "examples/en/objects/Lensflare",
+				"Sky": "examples/en/objects/Sky"
 			},
 			},
 
 
 			"Post-Processing": {
 			"Post-Processing": {