提交 732cd593 编写于 作者: M Mr.doob

Post release fixes.

上级 0b355494
......@@ -299,6 +299,11 @@
Rotate an object along an axis in object space. The axis is assumed to be normalized.
</div>
<h3>[method:Array raycast]([page:Raycaster raycaster], [page:Array intersects])</h3>
<div>
Abstract method to get intersections between a casted ray and this object. Subclasses such as [page:Mesh], [page:Line], and [page:PointCloud] implement this method in order to participate in raycasting.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -11,18 +11,67 @@
<div class="desc">
This class makes raycasting easier. Raycasting is used for picking and more.
</div>
<h2>Example</h2>
<code>
var raycaster = new THREE.Raycaster();
var mouse = new THREE.Vector2();
function onMouseMove( event ) {
// calculate mouse position in normalized device coordinates
// (-1 to +1) for both components
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1
}
function render() {
// update the picking ray with the camera and mouse position
raycaster.setFromCamera( mouse, camera );
// calculate objects intersecting the picking ray
var intersects = raycaster.intersectObjects( scene.children );
for ( var intersect in intersects ) {
intersect.object.material.color = new THREE.Color( 0xff0000 );
}
renderer.render( scene, camera );
}
window.addEventListener( 'mousemove', onMouseMove, false );
window.requestAnimationFrame(render);
</code>
<div>Examples: [example:webgl_interactive_cubes Raycasting to a Mesh],
[example:webgl_interactive_cubes_ortho Raycasting to a Mesh in using an OrthographicCamera],
[example:webgl_interactive_buffergeometry Raycasting to a Mesh with BufferGeometry],
[example:webgl_interactive_lines Raycasting to a Line],
[example:webgl_interactive_raycasting_pointcloud Raycasting to a PointCloud],
[example:webgl_geometry_terrain_raycast Terrain raycasting],
[example:webgl_octree_raycasting Raycasting using an octree],
[example:webgl_interactive_voxelpainter Raycasting to paint voxels]</div>
<div>
</div>
<h2>Constructor</h2>
<h3>[name]( [page:Vector3 origin], [page:Vector3 direction], [page:Float near], [page:Float far] ) {</h3>
<div>
[page:Vector3 origin] — The origin vector where the ray casts from.<br />
[page:Vector3 direction] — The direction vector that gives direction to the ray.<br />
[page:Float near] — All results returned are further away then near. Near can't be negative. Default value is 0.<br />
[page:Float near] — All results returned are further away than near. Near can't be negative. Default value is 0.<br />
[page:Float far] — All results returned are closer then far. Far can't be lower then near . Default value is Infinity.
</div>
<div>
......@@ -51,7 +100,12 @@
<h3>[property:float precision]</h3>
<div>
The precision factor of the raycaster.
The precision factor of the raycaster when intersecting [page:Mesh] objects.
</div>
<h3>.[page:float linePrecision]</h3>
<div>
The precision factor of the raycaster when intersecting [page:Line] objects.
</div>
<h2>Methods</h2>
......@@ -65,16 +119,45 @@
Updates the ray with a new origin and direction.
</div>
<h3>[method:null setFromCamera]( [page:Vector2 coords], [page:Camera camera] )</h3>
<div>
[page:Vector2 coords] — 2D coordinates of the mouse, in normalized device coordinates (NDC)---X and Y components should be between -1 and 1.<br />
[page:Camera camera] — camera from which the ray should originate
</div>
<div>
Updates the ray with a new origin and direction.
</div>
<h3>[method:Array intersectObject]( [page:Object3D object], [page:Boolean recursive] )</h3>
<div>
<p>
[page:Object3D object] — The object to check for intersection with the ray.<br />
[page:Boolean recursive] — If set, it also checks all descendants. Otherwise it only checks intersecton with the object.
</p>
</div>
<div>
checks all intersection between the ray and the object with or without the descendants. Intersections are returned sorted by distance, closest first.
Checks all intersection between the ray and the object with or without the descendants. Intersections are returned sorted by distance, closest first. An array of intersections is returned...
<code>
[ { distance, point, face, faceIndex, object }, ... ]
[ { distance, point, face, faceIndex, indices, object }, ... ]
</code>
<p>
[page:Float distance] – distance between the origin of the ray and the intersection<br />
[page:Vector3 point] – point of intersection, in world coordinates<br />
[page:Face3 face] – intersected face<br />
[page:Integer faceIndex] – index of the intersected face<br />
[page:Array indices] – indices of vertices comprising the intersected face<br />
[page:Object3D object] – the intersected object
</p>
<p>
When intersecting a [page:Mesh] with a [page:BufferGeometry], the *faceIndex* will be *undefined*, and *indices* will be set; when intersecting a [page:Mesh] with a [page:Geometry], *indices* will be *undefined*.
</p>
<p>
*Raycaster* delegates to the [page:Object3D.raycast raycast] method of the passed object, when evaluating whether the ray intersects the object or not. This allows [page:Mesh meshes] to respond differently to ray casting than [page:Line lines] and [page:PointCloud pointclouds].
</p>
<p>
*Note* that for meshes, faces must be pointed towards the origin of the [page:.ray ray] in order to be detected; intersections of the ray passing through the back of a face will not be detected. To raycast against both faces of an object, you'll want to set the [page:Mesh.material material]'s [page:Material.side side] property to *THREE.DoubleSide*.
</p>
</div>
<h3>[method:Array intersectObjects]( [page:Array objects], [page:Boolean recursive] )</h3>
......@@ -83,10 +166,7 @@
[page:Boolean recursive] — If set, it also checks all descendants of the objects. Otherwise it only checks intersecton with the objects.
</div>
<div>
checks all intersection between the ray and the objects with or without the descendants. Intersections are returned sorted by distance, closest first.
<code>
[ { distance, point, face, faceIndex, object }, ... ]
</code>
Checks all intersection between the ray and the objects with or without the descendants. Intersections are returned sorted by distance, closest first. Intersections are of the same form as those returned by [page:.intersectObject].
</div>
......
......@@ -70,6 +70,11 @@
<h2>Methods</h2>
<h3>[method:Array raycast]([page:Raycaster raycaster], [page:Array intersects])</h3>
<div>
Get intersections between a casted ray and this Line. [page:Raycaster.intersectObject] will call this method.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -60,6 +60,12 @@
Updates the morphtargets to have no influence on the object.
</div>
<h3>[method:Array raycast]([page:Raycaster raycaster], [page:Array intersects])</h3>
<div>
Get intersections between a casted ray and this mesh. [page:Raycaster.intersectObject] will call this method.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -42,6 +42,11 @@
This creates a clone of the particle system.
</div>
<h3>[method:Array raycast]([page:Raycaster raycaster], [page:Array intersects])</h3>
<div>
Get intersections between a casted ray and this PointCloud. [page:Raycaster.intersectObject] will call this method.
</div>
<h2>Source</h2>
......
......@@ -127,6 +127,10 @@ input.Number {
overflow: auto;
}
#sidebar * {
vertical-align: middle;
}
#sidebar input,
#sidebar textarea,
#sidebar select {
......
......@@ -128,6 +128,10 @@ input.Number {
overflow: auto;
}
#sidebar * {
vertical-align: middle;
}
#sidebar input,
#sidebar textarea,
#sidebar select {
......
* {
vertical-align: middle;
}
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 14px;
......@@ -79,6 +75,7 @@ textarea, input { outline: none; } /* osx */
height: calc(100% - 37px) !important;
}
/* scene types */
.type {
......
......@@ -6,20 +6,6 @@
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
</head>
<body ontouchstart="">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-86951-15']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<link href="css/main.css" rel="stylesheet" />
<link id="theme" href="css/light.css" rel="stylesheet" />
......
......@@ -110,6 +110,7 @@ THREE.Mirror = function ( renderer, camera, options ) {
this.textureMatrix = new THREE.Matrix4();
this.mirrorCamera = this.camera.clone();
this.mirrorCamera.matrixAutoUpdate = true;
this.texture = new THREE.WebGLRenderTarget( width, height );
this.tempTexture = new THREE.WebGLRenderTarget( width, height );
......
......@@ -8,8 +8,10 @@ THREE.EffectComposer = function ( renderer, renderTarget ) {
if ( renderTarget === undefined ) {
var width = window.innerWidth || 1;
var height = window.innerHeight || 1;
var pixelRatio = renderer.getPixelRatio();
var width = Math.floor( renderer.context.canvas.width / pixelRatio ) || 1;
var height = Math.floor( renderer.context.canvas.height / pixelRatio ) || 1;
var parameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBuffer: false };
renderTarget = new THREE.WebGLRenderTarget( width, height, parameters );
......@@ -108,8 +110,10 @@ THREE.EffectComposer.prototype = {
renderTarget = this.renderTarget1.clone();
renderTarget.width = window.innerWidth;
renderTarget.height = window.innerHeight;
var pixelRatio = renderer.getPixelRatio();
renderTarget.width = Math.floor( this.renderer.context.canvas.width / pixelRatio );
renderTarget.height = Math.floor( this.renderer.context.canvas.height / pixelRatio );
}
......
......@@ -50,7 +50,7 @@
var NEAR = 1;
var FAR = 500;
var camera, scane, renderer;
var camera, scene, renderer;
var cameraControls;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册