提交 68848947 编写于 作者: V Vincent Lark

working on loaders docs, with new cross doc syntax

上级 0425538f
......@@ -28,10 +28,10 @@
<h2>Methods</h2>
<h3>.load( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<div>
url — required<br />
onLoad — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
onLoad — Will be called when load completes. The argument will be the loaded [page:Object3D].<br />
onProgress — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
onError — Will be called when load errors.<br />
</div>
......@@ -39,19 +39,42 @@
Begin loading from url and call onLoad with the parsed response content.
</div>
<h3>.parse([page:Object json])</h3>
<h3>[method:Object3D parse]([page:Object json])</h3>
<div>
text — The <em>JSON</em> structure to parse.
</div>
<div>
Parse a <em>JSON</em> structure and returns an [page:Object3D object] or a [page:Scene scene].<br />
Found objects are converted to [page:Mesh meshs] with a [page:BufferGeometry BufferGeometry] and a default [page:MeshPhongMaterial MeshPhongMaterial].<br />
Found objects are converted to [page:Mesh] with a [page:BufferGeometry] and a default [page:MeshPhongMaterial].<br />
Lights are parsed accordingly.
</div>
<h2>Example</h2>
<a target="_parent" href="http://threejs.org/examples/#webgl_loader_babylon">webgl_loader_babylon</a>
<code>
// instantiate a loader
var loader = new THREE.BabylonLoader();
// load a Babylon resource
loader.load(
// resource URL
'models/babylon/skull.babylon',
// Function when resource is loaded
function ( object ) {
scene.add( object );
},
// Function called when download progresses
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// Function called when download errors
function ( xhr ) {
console.log( 'An error happened' );
}
);
</code>
[example:webgl_loader_babylon]
<h2>Source</h2>
......
......@@ -9,36 +9,72 @@
<body>
<h1>[name]</h1>
<div class="desc">todo</div>
<div class="desc">A loader for loading an [page:BufferGeometry].</div>
<h2>Example</h2>
<code>todo</code>
<h2>Constructor</h2>
<h3>todo</h3>
<div></div>
<h3>[name]([page:LoadingManager manager])</h3>
<div>
manager -- The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
</div>
<div>
Creates a new [name].
</div>
<h2>Properties</h2>
<h3>todo</h3>
<div>
todo
</div>
<h2>Methods</h2>
<h3>todo</h3>
<div>todo</div>
<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<div>
url — required<br />
onLoad — Will be called when load completes. The argument will be the loaded [page:BufferGeometry].<br />
onProgress — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
onError — Will be called when load errors.<br />
</div>
<div>
Begin loading from url and call onLoad with the parsed response content.
</div>
<h3>[method:BufferGeometry parse]([page:Object json])</h3>
<div>
todo
text — The <em>JSON</em> structure to parse.
</div>
<div>
Parse a <em>JSON</em> structure and returns an [page:BufferGeometry].
</div>
<h2>Example</h2>
<code>
// instantiate a loader
var loader = new THREE.BabylonLoader();
// load a resource
loader.load(
// resource URL
'models/json/pressure.json',
// Function when resource is loaded
function ( geometry ) {
var material = new THREE.MeshLambertMaterial( { color: 0xF5F5F5 } );
var object = new THREE.Mesh( geometry, material );
scene.add( object );
},
// Function called when download progresses
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// Function called when download errors
function ( xhr ) {
console.log( 'An error happened' );
}
);
</code>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -9,7 +9,7 @@
<body>
<h1>[name]</h1>
<div class="desc">A simple caching classe.</div>
<div class="desc">A simple caching classe, used internaly by [page:XHRLoader].</div>
<h2>Constructor</h2>
......@@ -22,7 +22,7 @@
<h2>Properties</h2>
<h3>.[page:Object files]</h3>
<h3>[property:Object files]</h3>
<div>
An [page:Object object] that hold cached values.
</div>
......@@ -30,7 +30,7 @@
<h2>Methods</h2>
<h3>.add( [page:String key], value )</h3>
<h3>[method:null add]( [page:String key], value )</h3>
<div>
key — required. A string key <br />
value — <br />
......@@ -39,7 +39,7 @@
Adds a cache entry with that key to hold the value. If this key already holds a value, it is overwritten.
</div>
<h3>.get( [page:String key] )</h3>
<h3>[method:null get]( [page:String key] )</h3>
<div>
key — required. A string key <br />
</div>
......@@ -47,7 +47,7 @@
Get the value of key. If the key does not exist the null value is returned.
</div>
<h3>.remove( [page:String key] )</h3>
<h3>[method:null remove]( [page:String key] )</h3>
<div>
key — required. A string key <br />
</div>
......@@ -55,7 +55,7 @@
Remove the cached value associated with the key.
</div>
<h3>.clear()</h3>
<h3>[method:null clear]()</h3>
<div>
Remove all values from the cache.
</div>
......
......@@ -9,46 +9,79 @@
<body>
<h1>[name]</h1>
<div class="desc">A loader for loading an [page:Image image].</div>
<div class="desc">A loader for loading an [page:Image].</div>
<h2>Constructor</h2>
<h2>Constructor</h2>
<h3>[name]([page:LoadingManager manager])</h3>
<div>
manager -- The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
</div>
<div>
manager -- The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
</div>
<div>
Creates a new [name].
</div>
<h2>Properties</h2>
<h3>[property:string crossOrigin]</h3>
<div>
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
</div>
</div>
<h2>Methods</h2>
<h3>[method:Image load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<div>
onLoad -- Will be called when load completes. The argument will be the loaded Imageloader.
onProgress -- Will be called while load progresses. The argument will be the progress event.
onError -- Will be called when load errors.
onLoad -- Will be called when load completes. The argument will be the loaded Imageloader.<br />
onProgress -- Will be called while load progresses. The argument will be the progress event.<br />
onError -- Will be called when load errors.<br />
url — required
</div>
<div>
Begin loading from url and return the [page:Image image] object that will contain the data.
</div>
Begin loading from url and return the [page:Image image] object that will contain the data.
</div>
<h3>[method:todo setCrossOrigin]([page:String value])</h3>
<h3>[method:null setCrossOrigin]([page:String value])</h3>
<div>
value -- The crossOrigin string.
value -- The crossOrigin string.
</div>
<div>
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
</div>
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
</div>
<h2>Example</h2>
<code>
// instantiate a loader
var loader = new THREE.ImageLoader();
// load a image resource
loader.load(
// resource URL
'textures/skyboxsun25degtest.png',
// Function when resource is loaded
function ( image ) {
// do something with it
// like drawing a part of if on a canvas
var canvas = document.createElement( 'canvas' );
var context = canvas.getContext( '2d' );
context.drawImage( image, 100, 100 );
},
// Function called when download progresses
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// Function called when download errors
function ( xhr ) {
console.log( 'An error happened' );
}
);
</code>
[example:webgl_shaders_ocean]
<h2>Source</h2>
......
......@@ -23,18 +23,18 @@
<div>
todo
</div>
<h2>Properties</h2>
<h3>[property:boolean withCredentials]</h3>
<div>
todo
</div>
</div>
<h2>Methods</h2>
<h3>[method:todo load]( [page:String url], [page:Function callback], [page:String texturePath] )</h3>
<h3>[method:null load]( [page:String url], [page:Function callback], [page:String texturePath] )</h3>
<div>
url — required<br />
callback — required. This function will be called with the loaded model as an instance of [page:Geometry geometry] when the load is completed.<br />
......@@ -42,7 +42,7 @@
</div>
<h3>[method:todo parse]([page:todo json], [page:todo texturePath])</h3>
<h3>[method:Object3D parse]([page:todo json], [page:todo texturePath])</h3>
<div>
json -- todo <br />
texturePath -- todo
......@@ -51,7 +51,7 @@
todo
</div>
<h3>[method:todo loadAjaxJSON]([page:todo context], [page:todo url], [page:todo callback], [page:todo texturePath], [page:todo callbackProgress])</h3>
<h3>[method:null loadAjaxJSON]([page:todo context], [page:todo url], [page:todo callback], [page:todo texturePath], [page:todo callbackProgress])</h3>
<div>
context -- todo <br />
url -- todo <br />
......
......@@ -11,19 +11,19 @@
<div class="desc">Handles and keeps track of loaded and pending data.</div>
<code>
var manager = new THREE.LoadingManager();
manager.onProgress = function ( item, loaded, total ) {
var manager = new THREE.LoadingManager();
manager.onProgress = function ( item, loaded, total ) {
console.log( item, loaded, total );
console.log( item, loaded, total );
};
};
var loader = new THREE.OBJLoader( manager );
loader.load( 'file.obj', function ( object ) {
var loader = new THREE.OBJLoader( manager );
loader.load( 'file.obj', function ( object ) {
//
//
} );
} );
</code>
......@@ -31,8 +31,8 @@ loader.load( 'file.obj', function ( object ) {
<h3>[name]([page:function onLoad], [page:function onProgress], [page:function onError])</h3>
<div>
[page:function onLoad] -- The function that needs to be called when all loaders are done.
[page:function onProgress] -- The function that needs to be called when an item is complete.
[page:function onLoad] -- The function that needs to be called when all loaders are done.<br />
[page:function onProgress] -- The function that needs to be called when an item is complete.<br />
[page:function onError] -- The function that needs to be called when an item is errors.
</div>
<div>
......@@ -61,7 +61,7 @@ loader.load( 'file.obj', function ( object ) {
<h2>Methods</h2>
<h3>[method:todo itemStart]( [page:String url] )</h3>
<h3>[method:null itemStart]( [page:String url] )</h3>
<div>
url — the url to load
</div>
......@@ -69,7 +69,7 @@ loader.load( 'file.obj', function ( object ) {
This should be called by any loader used by the manager when the loader starts loading an url. These shouldn't be called outside a loader.
</div>
<h3>[method:todo itemEnd]( [page:String url] )</h3>
<h3>[method:null itemEnd]( [page:String url] )</h3>
<div>
url — the url to load
</div>
......@@ -80,7 +80,7 @@ loader.load( 'file.obj', function ( object ) {
<h2>Example</h2>
<a target="_parent" href="http://threejs.org/examples/#webgl_loader_obj">webgl_loader_obj</a>
[example:webgl_loader_obj]
<h2>Source</h2>
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">A loader for loading an <em>.obj</em> resource.</div>
<h2>Constructor</h2>
<h3>[name]([page:String baseUrl], [page:Object options], [page:String crossOrigin])</h3>
<div>
baseUrl — The base url from which to find subsequent resources.<br />
options — Options passed to the created material (side, wrap, normalizeRGB, ignoreZeroRGBs, invertTransparency).<br />
crossOrigin — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.<br />
</div>
<div>
Creates a new [name].
</div>
<h2>Properties</h2>
<h2>Methods</h2>
<h3>.load( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<div>
url — required<br />
onLoad — Will be called when load completes. The argument will be the loaded [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator] instance.<br />
onProgress — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
onError — Will be called when load errors.<br />
</div>
<div>
Begin loading from url and return the loaded material.
</div>
<h3>.parse([page:String text])</h3>
<div>
text — The textual <em>obj</em> structure to parse.
</div>
<div>
Parse a <em>mtl</em> text structure and returns a [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator] instance.<br />
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/[name].js examples/js/loaders/[name].js]
</body>
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">A loader for loading an <em>.mtl</em> resource, used internaly by [page:OBJMTLLoader] and [page:UTF8Loader].</div>
<h2>Constructor</h2>
<h3>[name]([page:String baseUrl], [page:Object options], [page:String crossOrigin])</h3>
<div>
baseUrl — The base url from which to find subsequent resources.<br />
options — Options passed to the created material (side, wrap, normalizeRGB, ignoreZeroRGBs, invertTransparency).<br />
crossOrigin — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.<br />
</div>
<div>
Creates a new [name].
</div>
<h2>Properties</h2>
<h2>Methods</h2>
<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<div>
url — required<br />
onLoad — Will be called when load completes. The argument will be the loaded [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator] instance.<br />
onProgress — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
onError — Will be called when load errors.<br />
</div>
<div>
Begin loading from url and return the loaded material.
</div>
<h3>[method:MTLLoaderMaterialCreator parse]([page:String text])</h3>
<div>
text — The textual <em>mtl</em> structure to parse.
</div>
<div>
Parse a <em>mtl</em> text structure and returns a [page:MTLLoaderMaterialCreator] instance.<br />
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/[name].js examples/js/loaders/[name].js]
</body>
</html>
......@@ -9,15 +9,15 @@
<body>
<h1>[name]</h1>
<div class="desc">A loader for loading an [page:Material material].</div>
<div class="desc">A loader for loading an [page:Material] in JSON format.</div>
<h2>Constructor</h2>
<h2>Constructor</h2>
<h3>[name]([page:LoadingManager manager])</h3>
<div>
manager -- The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
</div>
<div>
manager -- The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
</div>
<div>
Creates a new [name].
</div>
......@@ -25,32 +25,60 @@
<h2>Methods</h2>
<h3>[method:Image load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<div>
onLoad -- Will be called when load completes. The argument will be the loaded Imageloader.
onProgress -- Will be called while load progresses. The argument will be the progress event.
onError -- Will be called when load errors.
onLoad -- Will be called when load completes. The argument will be the loaded [page:Material].<br />
onProgress -- Will be called while load progresses. The argument will be the progress event.<br />
onError -- Will be called when load errors.<br />
url — required
</div>
<div>
Begin loading from url and return the [page:Material material] object that will contain the data.
</div>
Begin loading from url and return the [page:Material] object that will contain the data.
</div>
<h3>[method:todo setCrossOrigin]([page:String value])</h3>
<h3>[method:null setCrossOrigin]([page:String value])</h3>
<div>
value -- The crossOrigin string.
value -- The crossOrigin string.
</div>
<div>
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
</div>
The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
</div>
<h3>[method:todo parse]([page:Object json])</h3>
<div>
json -- The json object containing the parameters of the Material.
<h3>[method:Material parse]([page:Object json])</h3>
<div>
json -- The json object containing the parameters of the Material.
</div>
<div>
Creates a new [page:Material material] of the type 'json.type' and with parameters defined in the json object.
</div>
Creates a new [page:Material] of the type [page:String json.type] with parameters defined in the json object.
</div>
<h2>Example</h2>
<code>
// instantiate a loader
var loader = new THREE.MaterialLoader();
// load a resource
loader.load(
// resource URL
'models/babylon/skull.babylon',
// Function when resource is loaded
function ( object ) {
scene.add( object );
},
// Function called when download progresses
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
// Function called when download errors
function ( xhr ) {
console.log( 'An error happened' );
}
);
</code>
<h2>Source</h2>
......
......@@ -31,7 +31,7 @@
<h3>.load( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<div>
url — required<br />
onLoad — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
onLoad — Will be called when load completes. The argument will be the loaded [page:Object3D].<br />
onProgress — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
onError — Will be called when load errors.<br />
</div>
......@@ -44,8 +44,8 @@
text — The textual <em>obj</em> structure to parse.
</div>
<div>
Parse an <em>obj</em> text structure and returns an [page:Object3D object].<br />
Found objects are converted to [page:Mesh meshs] with a [page:BufferGeometry BufferGeometry] and a default [page:MeshLambertMaterial MeshLambertMaterial].
Parse an <em>obj</em> text structure and returns a [page:Object3D].<br />
Found objects are converted to [page:Mesh] with a [page:BufferGeometry] and a default [page:MeshLambertMaterial].
</div>
<h2>Example</h2>
......
......@@ -28,7 +28,7 @@
<h2>Methods</h2>
<h3>.load( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
<div>
url — required<br />
onLoad — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
......@@ -40,7 +40,7 @@
</div>
<h3>.parse( [page:String json] )</h3>
<h3>[method:Object3D parse]( [page:String json] )</h3>
<div>
json — required. The JSON source to parse<br />
</div>
......@@ -48,7 +48,7 @@
Parses a JSON content and return a threejs object.
</div>
<h3>.setCrossOrigin([page:String value]</h3>
<h3>[method:null setCrossOrigin]([page:String value]</h3>
<div>
value — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
</div>
......@@ -56,7 +56,17 @@
<h2>Example</h2>
<a target="_parent" href="http://threejs.org/examples/#webgl_loader_msgpack">webgl_loader_msgpack</a>
<code>
// instantiate a loader
var loader = new THREE.ObjectLoader();
// assuming we loaded a JSON structure from elsewhere
var object = loader.parse( a_json_object );
scene.add( object );
</code>
[example:webgl_loader_msgpack]
<h2>Source</h2>
......
......@@ -11,13 +11,13 @@
<h1>[name]</h1>
<div class="desc">Material rendered with custom shaders. A shader is a small program written in [link:https://www.opengl.org/documentation/glsl/ GLSL] to run on the GPU. You may want to use a custom shader if you need to:
<div class="desc">Material rendered with custom shaders. A shader is a small program written in [link:https://www.opengl.org/documentation/glsl/ GLSL] to run on the GPU. You may want to use a custom shader if you need to:
<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.
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.
</div>
<h3>Example</h3>
......@@ -39,7 +39,7 @@
</code>
<h3>Vertex shaders and fragment shaders</h3>
<p>You can specify two different types of shaders for each material:
<p>You can specify two different types of shaders for each material:
<ul>
<li>The *vertex shader* runs first; it recieves *attributes*, calculates/manipulates the position of each individual vertex, and passes additional data (*varying*s) to the fragment shader.</li>
<li>The *fragment shader* runs second; it sets the color of each individual "fragment" (pixel) rendered to the screen.</li>
......@@ -69,13 +69,13 @@
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>
<p>
To declare a custom attribute, use the *attributes* property of the material:
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.
Each attribute must have a *type* property and a *value* property.
<table>
<caption><a id="attribute-types">Attribute types</a></caption>
<thead>
......@@ -113,7 +113,7 @@
</tr>
</tbody>
</table>
The way attribute data is stored depends on whether you're using [page:BufferGeometry] or [page:Geometry]:
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>
......@@ -135,7 +135,7 @@
time: { type: "f", value: 1.0 },
resolution: { type: "v2", value: new THREE.Vector2() }
}
</code>
</code>
Each uniform must have a <a href="#uniform-types">*type*</a> and a *value*:
<table>
<caption><a id="uniform-types">Uniform types</a></caption>
......@@ -221,7 +221,7 @@
{ type: 'f', value: 1.0 }
</code>
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>
</div>
<h3>[property:Object attributes]</h3>
<div>
......@@ -230,12 +230,12 @@
<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.
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>
</div>
<h3>[property:Object defines]</h3>
<div>
......@@ -251,49 +251,49 @@
#define FOO 15
#define BAR true
</code>
in the GLSL code.
</div>
in the GLSL code.
</div>
<h3>[property:String fragmentShader]</h3>
<div>
Fragment shader GLSL code. This is the actual code for the shader. In the example above, the *vertexShader* and *fragmentShader* code is extracted from the DOM; it could be passed as a string directly or loaded via AJAX instead.
</div>
</div>
<h3>[property:String vertexShader]</h3>
<div>
Vertex shader GLSL code. This is the actual code for the shader. In the example above, the *vertexShader* and *fragmentShader* code is extracted from the DOM; it could be passed as a string directly or loaded via AJAX instead.
</div>
</div>
<h3>[property:Boolean lights]</h3>
<div>
Defines whether this material uses lighting; true to pass uniform data related to lighting to this shader
</div>
</div>
<h3>[property:Boolean morphTargets]</h3>
<div>
Defines whether the material uses morphTargets; true morphTarget attributes to this shader
</div>
</div>
<h3>[property:Boolean morphNormals]</h3>
<div>
Defines whether the material uses morphNormals; true to pass morphNormal attributes to this shader
</div>
</div>
<h3>[property:Boolean wireframe]</h3>
<div>
Render geometry as wireframe (using GL_LINES instead of GL_TRIANGLES). Default is false (i.e. render as flat polygons).
</div>
</div>
<h3>[property:Number vertexColors]</h3>
<div>
Define how the vertices are colored, by defining how the *colors* attribute gets populated. Possible values are [page:Materials THREE.NoColors], [page:Materials THREE.FaceColors] and [page:Materials THREE.VertexColors]. Default is THREE.NoColors.
</div>
<h3>[property:Boolean skinning]</h3>
<div>
Define whether the material uses skinning; true to pass skinning attributes to the shader. Default is false.
</div>
</div>
<h3>[property:Boolean fog]</h3>
<div>Define whether the material color is affected by global fog settings; true to pass fog uniforms to the shader. Default is false.</div>
......@@ -302,7 +302,7 @@
<h3>[property:Number shading]</h3>
<div>
Define shading type, which determines whether normals are smoothed between vertices; possible values are [page:Materials THREE.SmoothShading] or [page:Materials THREE.FlatShading]. Default is THREE.SmoothShading.
</div>
</div>
<h3>[property:Number linewidth]</h3>
<div>Controls line thickness; only effective if the material is attached to a [page:Line]. Default is 1.</div>
......@@ -321,7 +321,7 @@
<h3>[method:todo clone]()</h3>
<div>
Generates a shallow copy of this material. Note that the vertexShader and fragmentShader are copied <emph>by reference</emph>, as are the definitions of the *attributes*; this means that clones of the material will share the same compiled [page:WebGLProgram]. However, the *uniforms* are copied <emph>by value</emph>, which allows you to have different sets of uniforms for different copies of the material.
Generates a shallow copy of this material. Note that the vertexShader and fragmentShader are copied <emph>by reference</emph>, as are the definitions of the *attributes*; this means that clones of the material will share the same compiled [page:WebGLProgram]. However, the *uniforms* are copied <emph>by value</emph>, which allows you to have different sets of uniforms for different copies of the material.
</div>
<h2>Source</h2>
......
......@@ -94,17 +94,9 @@
// model
var loader = new THREE.BabylonLoader( manager );
loader.load( 'models/babylon/skull.babylon', function ( object ) {
loader.load( 'models/babylon/skull.babylon', function ( babylonScene ) {
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
scene.add( child );
}
} );
scene.add( babylonScene );
}, onProgress, onError );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册