Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
Conflicts:
	build/three.js
	build/three.min.js
	src/core/Object3D.js
	src/renderers/WebGLRenderer.js
  • Loading branch information
mrdoob committed Oct 15, 2015
2 parents a93be86 + 6e8b56b commit a72b0e0
Show file tree
Hide file tree
Showing 324 changed files with 13,134 additions and 5,458 deletions.
7 changes: 0 additions & 7 deletions docs/api/core/Geometry.html
Expand Up @@ -88,13 +88,6 @@ <h3>[property:Array morphTargets]</h3>
Morph vertices match number and order of primary vertices.
</div>

<h3>[property:Array morphColors]</h3>
<div>
Array of morph colors. Morph colors have similar structure as morph targets, each color set is a Javascript object:
<code>morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] }</code>
Morph colors can match either the number and order of faces (face colors) or the number of vertices (vertex colors).
</div>

<h3>[property:Array morphNormals]</h3>
<div>
Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object:
Expand Down
4 changes: 2 additions & 2 deletions docs/api/extras/geometries/TextGeometry.html
Expand Up @@ -93,13 +93,13 @@ <h2>Available Fonts</h2>
<td>/examples/fonts/gentilis_bold.typeface.js</td>
</tr>
<tr>
<td>driod sans</td>
<td>droid sans</td>
<td>normal</td>
<td>normal</td>
<td>/examples/fonts/droid/droid_sans_regular.typeface.js</td>
</tr>
<tr>
<td>driod sans</td>
<td>droid sans</td>
<td>bold</td>
<td>normal</td>
<td>/examples/fonts/droid/droid_sans_bold.typeface.js</td>
Expand Down
8 changes: 1 addition & 7 deletions docs/api/lights/DirectionalLight.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta charset="utf-8" />
<base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
Expand Down Expand Up @@ -123,12 +123,6 @@ <h3>[property:Float shadowBias]</h3>
Default — *0*.
</div>

<h3>[property:Float shadowDarkness]</h3>
<div>
Darkness of shadow casted by this light (from *0* to *1*).<br />
Default — *0.5*.
</div>

<h3>[property:Integer shadowMapWidth]</h3>
<div>
Shadow map texture width in pixels.<br />
Expand Down
6 changes: 0 additions & 6 deletions docs/api/lights/SpotLight.html
Expand Up @@ -146,12 +146,6 @@ <h3>[property:Float shadowBias]</h3>
Default — *0*.
</div>

<h3>[property:Float shadowDarkness]</h3>
<div>
Darkness of shadow casted by this light (from *0* to *1*).<br />
Default — *0.5*.
</div>

<h3>[property:Integer shadowMapWidth]</h3>
<div>
Shadow map texture width in pixels.<br />
Expand Down
166 changes: 77 additions & 89 deletions docs/api/loaders/JSONLoader.html
@@ -1,90 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:Loader] &rarr;
<h1>[name]</h1>

<div class="desc">A loader for loading objects in JSON format.</div>


<h2>Constructor</h2>

<h3>[name]()</h3>
<div>
Creates a new [name].
</div>


<h2>Properties</h2>

<h3>[property:boolean withCredentials]</h3>
<div>
If true, the ajax request will use cookies.
</div>


<h2>Methods</h2>

<h3>[method:null load]( [page:String url], [page:Function callback], [page:String texturePath] )</h3>
<div>
[page:String url] — required<br />
[page:Function callback] — required. Will be called when load completes. The arguments will be the loaded [page:Object3D] and the loaded [page:Array materials].<br />
[page:String texturePath] — optional. If not specified, textures will be assumed to be in the same folder as the Javascript model file.
</div>

<h3>[method:null loadAjaxJSON]([page:JSONLoader context], [page:String url], [page:Function callback], [page:String texturePath], [page:Function callbackProgress])</h3>
<div>
[page:JSONLoader context] — The [page:JSONLoader] instance<br />
[page:String url] — required<br />
[page:Function callback] — required. This function will be called with the loaded model as an instance of [page:Geometry geometry] when the load is completed.<br />
[page:String texturePath] — Base path for textures.<br />
[page:Function callbackProgress] — Will be called while load progresses. The argument will be an [page:Object] containing two attributes: .[page:Integer total] and .[page:Integer loaded] bytes.
</div>
<div>
Begin loading from url and call <em>callback</em> with the parsed response content.
</div>

<h3>[method:Object3D parse]( [page:Object json], [page:String texturePath] )</h3>
<div>
[page:String json] — JSON object to parse.<br />
[page:String texturePath] — Base path for textures.
</div>
<div>
Parse a <em>JSON</em> structure and return an [page:Object] containing the parsed .[page:Geometry] and .[page:Array materials].
</div>


<h2>Example</h2>

<code>
// instantiate a loader
var loader = new THREE.JSONLoader();

// load a resource
loader.load(
// resource URL
'models/animated/monster/monster.js',
// Function when resource is loaded
function ( geometry, materials ) {
var material = new THREE.MeshFaceMaterial( materials );
var object = new THREE.Mesh( geometry, material );
scene.add( object );
}
);
</code>

[example:webgl_loader_json_blender]


<h2>Source</h2>

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>
<base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:Loader] &rarr;
<h1>[name]</h1>

<div class="desc">A loader for loading objects in JSON format.</div>


<h2>Constructor</h2>

<h3>[name]()</h3>
<div>
Creates a new [name].
</div>


<h2>Properties</h2>

<h3>[property:boolean withCredentials]</h3>
<div>
If true, the ajax request will use cookies.
</div>


<h2>Methods</h2>

<h3>[method:null load]( [page:String url], [page:Function callback], [page:String texturePath] )</h3>
<div>
[page:String url] — required<br />
[page:Function callback] — required. Will be called when load completes. The arguments will be the loaded [page:Object3D] and the loaded [page:Array materials].<br />
[page:String texturePath] — optional. If not specified, textures will be assumed to be in the same folder as the Javascript model file.
</div>

<h3>[method:Object3D parse]( [page:Object json], [page:String texturePath] )</h3>
<div>
[page:String json] — JSON object to parse.<br />
[page:String texturePath] — Base path for textures.
</div>
<div>
Parse a <em>JSON</em> structure and return an [page:Object] containing the parsed .[page:Geometry] and .[page:Array materials].
</div>


<h2>Example</h2>

<code>
// instantiate a loader
var loader = new THREE.JSONLoader();

// load a resource
loader.load(
// resource URL
'models/animated/monster/monster.js',
// Function when resource is loaded
function ( geometry, materials ) {
var material = new THREE.MeshFaceMaterial( materials );
var object = new THREE.Mesh( geometry, material );
scene.add( object );
}
);
</code>

[example:webgl_loader_json_blender]


<h2>Source</h2>

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>
2 changes: 1 addition & 1 deletion docs/api/materials/MeshPhongMaterial.html
Expand Up @@ -68,7 +68,7 @@ <h3>[property:Color specular]</h3>
</div>

<h3>[property:Float shininess]</h3>
<div>How shiny the specular highlight is; a higher value gives a sharper highlight. Default is *30*. It should not be set to 0.</div>
<div>How shiny the specular highlight is; a higher value gives a sharper highlight. Default is *30*.</div>

<h3>[property:boolean metal]</h3>
<div>
Expand Down
67 changes: 21 additions & 46 deletions docs/api/materials/ShaderMaterial.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta charset="utf-8" />
<base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
Expand All @@ -16,9 +16,13 @@ <h1>[name]</h1>
<ul>
<li>implement an effect not included with any of the built-in [page:Material materials]</li>
<li>combine many objects into a single [page:Geometry] or [page:BufferGeometry] in order to improve performance</li>
<li>associate custom data with individual vertices ("custom attributes")</li>
</ul>
Note that a ShaderMaterial will only be rendered properly by [page:WebGLRenderer], since the GLSL code in the vertexShader and fragmentShader properties must be compiled and run on the GPU using WebGL.
There are the following notes to bear in mind when using a *ShaderMaterial*:

<ul>
<li>A *ShaderMaterial* will only be rendered properly by [page:WebGLRenderer], since the GLSL code in the *vertexShader* and *fragmentShader* properties must be compiled and run on the GPU using WebGL.</li>
<li>As of THREE r72, directly assigning attributes in a *ShaderMaterial* is no longer supported. A [page:BufferGeometry] instance (instead of a [page:Geometry] instance) must be used instead, using [page:BufferAttribute] instances to define custom attributes.</li>
</ul>
</div>

<h3>Example</h3>
Expand Down Expand Up @@ -67,66 +71,51 @@ <h3>Built-in attributes and uniforms</h3>
</p>

<h3>Custom attributes and uniforms</h3>
Custom attributes and uniforms must be declared both in your GLSL shader code (within *vertexShader* and/or *fragmentShader*), <emph>and</emph> in the *attributes* and *uniforms* properties of your ShaderMaterial. The declaration in the material is necessary to ensure [page:WebGLRenderer] passes your attribute/uniform data in a buffer to the GPU when the shader is run. Note that *varying*s only need to be declared within the shader code (not within the material).
<p>Both custom attributes and uniforms must be declared in your GLSL shader code (within *vertexShader* and/or *fragmentShader*). Custom uniforms must be defined in <emph>both</emph> the *uniforms* property of your *ShaderMaterial*, whereas any custom attributes must be defined via [page:BufferAttribute] instances. Note that *varying*s only need to be declared within the shader code (not within the material).
</p>
<p>
To declare a custom attribute, use the *attributes* property of the material:
<code>
attributes: {
vertexOpacity: { type: 'f', value: [] }
}
</code>
Each attribute must have a *type* property and a *value* property.

<p>To declare a custom attribute, please reference the [page:BufferGeometry] page for an overview, and the [page:BufferAttribute] page for a detailed look at the *BufferAttribute* API.</p>
<p>When creating your attributes, each typed array that you create to hold your attribute's data must be a multiple of your data type's size. For example, if your attribute is a [page:Vector3 THREE.Vector3] type, and you have 3000 vertices in your [page:BufferGeometry], your typed array value must be created with a length of 3000 * 3, or 9000 (one value per-component). A table of each data type's size is shown below for reference:</p>

<table>
<caption><a id="attribute-types">Attribute types</a></caption>
<caption><a id="attribute-sizes">Attribute sizes</a></caption>
<thead>
<tr>
<th>Attribute *type* string</th>
<th>GLSL type</th>
<th>JavaScript type</th>
<th>Size</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>'f'</code></td>
<td>float</td>
<td>[page:Number]</td>
<td>1</td>
</tr>
<tr>
<td><code>'v2'</code></td>
<td>vec2</td>
<td>[page:Vector2 THREE.Vector2]</td>
<td>2</td>
</tr>
<tr>
<td><code>'v3'</code></td>
<td>vec3</td>
<td>[page:Vector3 THREE.Vector3]</td>
<td>3</td>
</tr>
<tr>
<td><code>'c'</code></td>
<td>vec3</td>
<td>[page:Color THREE.Color]</td>
<td>3</td>
</tr>
<tr>
<td><code>'v4'</code></td>
<td>vec4</td>
<td>[page:Vector4 THREE.Vector4]</td>
<td>4</td>
</tr>
</tbody>
</table>
The way attribute data is stored depends on whether you're using [page:BufferGeometry] or [page:Geometry]:
<ul>
<li>When using [page:Geometry], attribute data is stored directly on the <emph>material</emph>, using the attribute's *value* array; each element of *value* should correspond to one vertex. To update an attribute, set the *needsUpdate* flag to true on the material attribute:
<code>
material.attributes.vertexOpacity.needsUpdate = true;
</code>
</li>
<li>When using [page:BufferGeometry], attribute data is stored within a [page:BufferAttribute] on the geometry itself, and the *value* within the material is ignored. To update an attribute, set the *needsUpdate* flag to true on the [page:BufferAttribute] of the geometry:
<code>
geometry.attributes.vertexOpacity.needsUpdate = true;
</code>
See [page:BufferGeometry] for details.</li>
</ul>

Note that attribute buffers are <emph>not</emph> refreshed automatically when their values change. To update custom attributes, set the *needsUpdate* flag to true on the [page:BufferAttribute] of the geometry (see [page:BufferGeometry] for further details).
</p>

<p>
Expand Down Expand Up @@ -232,20 +221,6 @@ <h3>[property:Object uniforms]</h3>
where *type* is a <a href="#uniform-types">uniform type string</a>, and *value* is the value of the uniform. Names must match the name of the uniform, as defined in the GLSL code. Note that uniforms are refreshed on every frame, so updating the value of the uniform will immediately update the value available to the GLSL code.
</div>

<h3>[property:Object attributes]</h3>
<div>
<p>
Object specifying the custom attributes to be passed to the shader code; keys are attribute names, values are definitions of the form
<code>
{ type: 'f', value: [1.0, 0.5, 2.0, ...] }
</code>
where *type* is an <a href="#attribute-types">attribute type string</a>, and *value* is an array containing an attribute value for each vertex in the geometry (or *undefined* if using [page:BufferGeometry]). Names must match the name of the attribute, as defined in the GLSL code.
</p>
<p>
Note that attribute buffers are <emph>not</emph> refreshed automatically when their values change; if using [page:Geometry], set <code>needsUpdate = true</code> on the attribute definition. If using [page:BufferGeometry], set <code>needsUpdate = true</code> on the [page:BufferAttribute].
</p>
</div>

<h3>[property:Object defines]</h3>
<div>
Defines custom constants using *#define* directives within the GLSL code for both the vertex shader and the fragment shader; each key/value pair yields another directive:
Expand Down

0 comments on commit a72b0e0

Please sign in to comment.