Przeglądaj źródła

rename Ray -> Raycaster, Ray3 -> Ray per @mrdoob (see #2729)

Ben Houston 12 lat temu
rodzic
commit
e6f509baf6

+ 2 - 2
docs/api/core/Projector.html

@@ -23,9 +23,9 @@
 
 		<h3>.unprojectVector( [page:Vector3 vector], [page:Camera camera] ) [page:Vector3]</h3>
 
-		<h3>.pickingRay( [page:Vector3 vector], [page:Camera camera] ) [page:Ray]</h3>
+		<h3>.pickingRay( [page:Vector3 vector], [page:Camera camera] ) [page:Raycaster]</h3>
 		<div>
-		Translates a 2D point from NDC (<em>Normalized Device Coordinates</em>) to a [page:Ray] that can be used for picking. NDC range from [-1..1] in x (left to right) and [1.0 .. -1.0] in y (top to bottom).
+		Translates a 2D point from NDC (<em>Normalized Device Coordinates</em>) to a [page:Raycaster] that can be used for picking. NDC range from [-1..1] in x (left to right) and [1.0 .. -1.0] in y (top to bottom).
 		</div>
 
 		<h3>.projectScene( [page:Scene scene], [page:Camera camera], [page:Boolean sort] ) [page:Object]</h3>

+ 1 - 1
docs/list.js

@@ -26,7 +26,7 @@ var list = {
 			[ "Object3D", "api/core/Object3D" ],
 			[ "Projector", "api/core/Projector" ],
 			[ "Quaternion", "api/core/Quaternion" ],
-			[ "Ray", "api/core/Ray" ],
+			[ "Raycaster", "api/core/Raycaster" ],
 			[ "Rectangle", "api/core/Rectangle" ],
 			[ "Spline", "api/core/Spline" ],
 			[ "UV", "api/core/UV" ],

+ 1 - 1
editor/js/ui/Viewport.js

@@ -66,7 +66,7 @@ var Viewport = function ( signals ) {
 	intersectionPlane.visible = false;
 	sceneHelpers.add( intersectionPlane );
 
-	var ray = new THREE.Ray();
+	var ray = new THREE.Raycaster();
 	var projector = new THREE.Projector();
 	var offset = new THREE.Vector3();
 

+ 1 - 1
examples/canvas_interactive_cubes.html

@@ -122,7 +122,7 @@
 				var vector = new THREE.Vector3( ( event.clientX / window.innerWidth ) * 2 - 1, - ( event.clientY / window.innerHeight ) * 2 + 1, 0.5 );
 				projector.unprojectVector( vector, camera );
 
-				var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
+				var ray = new THREE.Raycaster( camera.position, vector.subSelf( camera.position ).normalize() );
 
 				var intersects = ray.intersectObjects( objects );
 

+ 1 - 1
examples/canvas_interactive_cubes_tween.html

@@ -101,7 +101,7 @@
 				var vector = new THREE.Vector3( ( event.clientX / window.innerWidth ) * 2 - 1, - ( event.clientY / window.innerHeight ) * 2 + 1, 0.5 );
 				projector.unprojectVector( vector, camera );
 
-				var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
+				var ray = new THREE.Raycaster( camera.position, vector.subSelf( camera.position ).normalize() );
 
 				var intersects = ray.intersectObjects( scene.children );
 

+ 1 - 1
examples/canvas_interactive_particles.html

@@ -149,7 +149,7 @@
 				var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 );
 				projector.unprojectVector( vector, camera );
 
-				var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
+				var ray = new THREE.Raycaster( camera.position, vector.subSelf( camera.position ).normalize() );
 
 				var intersects = ray.intersectObjects( scene.children );
 

+ 1 - 1
examples/canvas_interactive_voxelpainter.html

@@ -82,7 +82,7 @@
 				scene.add( plane );
 
 				mouse2D = new THREE.Vector3( 0, 10000, 0.5 );
-				ray = new THREE.Ray( camera.position, null );
+				ray = new THREE.Raycaster( camera.position, null );
 
 				// Lights
 

+ 1 - 1
examples/misc_controls_pointerlock.html

@@ -192,7 +192,7 @@
 				controls = new THREE.PointerLockControls( camera );
 				scene.add( controls.getObject() );
 
-				ray = new THREE.Ray();
+				ray = new THREE.Raycaster();
 				ray.direction.set( 0, -1, 0 );
 
 				// floor

+ 1 - 1
examples/webgl_interactive_cubes.html

@@ -145,7 +145,7 @@
 				var vector = new THREE.Vector3( mouse.x, mouse.y, 1 );
 				projector.unprojectVector( vector, camera );
 
-				var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
+				var ray = new THREE.Raycaster( camera.position, vector.subSelf( camera.position ).normalize() );
 
 				var intersects = ray.intersectObjects( scene.children );
 

+ 2 - 2
examples/webgl_interactive_draggablecubes.html

@@ -159,7 +159,7 @@
 				var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 );
 				projector.unprojectVector( vector, camera );
 
-				var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
+				var ray = new THREE.Raycaster( camera.position, vector.subSelf( camera.position ).normalize() );
 
 
 				if ( SELECTED ) {
@@ -208,7 +208,7 @@
 				var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 );
 				projector.unprojectVector( vector, camera );
 
-				var ray = new THREE.Ray( camera.position, vector.subSelf( camera.position ).normalize() );
+				var ray = new THREE.Raycaster( camera.position, vector.subSelf( camera.position ).normalize() );
 
 				var intersects = ray.intersectObjects( objects );
 

+ 1 - 1
src/core/Projector.js

@@ -65,7 +65,7 @@ THREE.Projector = function() {
 		// find direction from vector to end
 		end.subSelf( vector ).normalize();
 
-		return new THREE.Ray( vector, end );
+		return new THREE.Raycaster( vector, end );
 
 	};
 

+ 5 - 5
src/core/Ray.js → src/core/Raycaster.js

@@ -4,7 +4,7 @@
 
 ( function ( THREE ) {
 
-	THREE.Ray = function ( origin, direction, near, far ) {
+	THREE.Raycaster = function ( origin, direction, near, far ) {
 
 		this.origin = origin || new THREE.Vector3();
 		this.direction = direction || new THREE.Vector3();
@@ -234,16 +234,16 @@
 
 	//
 
-	THREE.Ray.prototype.precision = 0.0001;
+	THREE.Raycaster.prototype.precision = 0.0001;
 
-	THREE.Ray.prototype.set = function ( origin, direction ) {
+	THREE.Raycaster.prototype.set = function ( origin, direction ) {
 
 		this.origin = origin;
 		this.direction = direction;
 
 	};
 
-	THREE.Ray.prototype.intersectObject = function ( object, recursive ) {
+	THREE.Raycaster.prototype.intersectObject = function ( object, recursive ) {
 
 		var intersects = [];
 
@@ -261,7 +261,7 @@
 
 	};
 
-	THREE.Ray.prototype.intersectObjects = function ( objects, recursive ) {
+	THREE.Raycaster.prototype.intersectObjects = function ( objects, recursive ) {
 
 		var intersects = [];
 

+ 7 - 6
src/math/Ray3.js → src/math/Ray.js

@@ -2,7 +2,7 @@
  * @author bhouston / http://exocortex.com
  */
 
-THREE.Ray3 = function ( origin, direction ) {
+THREE.Ray = function ( origin, direction ) {
 
 
 	if ( origin === undefined && direction === undefined ) {
@@ -19,9 +19,9 @@ THREE.Ray3 = function ( origin, direction ) {
 
 };
 
-THREE.Ray3.prototype = {
+THREE.Ray.prototype = {
 
-	constructor: THREE.Ray3,
+	constructor: THREE.Ray,
 
 	set: function ( origin, direction) {
 
@@ -114,6 +114,7 @@ THREE.Ray3.prototype = {
 		__v1.copy( this.direction ).crossSelf( ray.direction );
 		__v2.copy( ray.origin ).subSelf( this.origin );
 
+
 		var d = __v1.dot( __v2 );
 		if( d >= 0 ) {
 
@@ -157,11 +158,11 @@ THREE.Ray3.prototype = {
 
 	clone: function () {
 
-		return new THREE.Ray3().copy( this );
+		return new THREE.Ray().copy( this );
 
 	}
 
 };
 
-THREE.Ray3.__v1 = new THREE.Vector3();
-THREE.Ray3.__v2 = new THREE.Vector3();
+THREE.Ray.__v1 = new THREE.Vector3();
+THREE.Ray.__v2 = new THREE.Vector3();

+ 1 - 1
utils/includes/canvas.json

@@ -17,7 +17,7 @@
 	"../src/math/Vertex.js",
 	"../src/math/UV.js",
 	"../src/core/EventTarget.js",
-	"../src/core/Ray.js",
+	"../src/core/Raycaster.js",
 	"../src/core/Object3D.js",
 	"../src/core/Projector.js",
 	"../src/core/Face3.js",

+ 2 - 2
utils/includes/common.json

@@ -9,7 +9,7 @@
 	"../src/math/Box3.js",
 	"../src/math/Matrix3.js",
 	"../src/math/Matrix4.js",
-	"../src/math/Ray3.js",
+	"../src/math/Ray.js",
 	"../src/math/Frustum.js",
 	"../src/math/Plane.js",
 	"../src/math/Rectangle.js",
@@ -20,7 +20,7 @@
 	"../src/math/Vertex.js",
 	"../src/math/UV.js",
 	"../src/core/EventTarget.js",
-	"../src/core/Ray.js",
+	"../src/core/Raycaster.js",
 	"../src/core/Object3D.js",
 	"../src/core/Projector.js",
 	"../src/core/Face3.js",

+ 1 - 1
utils/includes/css3d.json

@@ -12,7 +12,7 @@
 	"../src/math/Sphere.js",
 	"../src/math/Plane.js",
 	"../src/core/EventTarget.js",
-	"../src/core/Ray.js",
+	"../src/core/Raycaster.js",
 	"../src/core/Object3D.js",
 	"../src/core/Projector.js",
 	"../src/cameras/Camera.js",

+ 1 - 1
utils/includes/webgl.json

@@ -19,7 +19,7 @@
 	"../src/math/Sphere.js",
 	"../src/math/Plane.js",
 	"../src/core/EventTarget.js",
-	"../src/core/Ray.js",
+	"../src/core/Raycaster.js",
 	"../src/core/Object3D.js",
 	"../src/core/Projector.js",
 	"../src/core/Face3.js",