问题
I was working with generating random lines in Three.js, as demonstrated in this fiddle. But, I was wondering if I can acces the Buffer Geometry of another object (in my case THREE.PerspectiveCamera) so that the lines would be created inside that geometry (view-frustum). I found out that by calling this:
var helperGeometry = camera_RT_Helper.geometry;
console.log(helperGeometry)
it will return:
What I use for assigning the BUFFER GEOMETRY :
var myBufferGeometry = new THREE.BufferGeometry(); //Create geometry
myBufferGeometry.addAttribute( 'position', new THREE.BufferAttribute( vertices_Per_Point, 3 ) );
//Set Drawcalls (when drawing should start & end)
drawCount = 2; // draw the first 2 points, only
myBufferGeometry.setDrawRange( 0, drawCount );
//Create material with color and linewidth
var material = new THREE.LineBasicMaterial( { color: 0xff0000, linewidth: 2 } );
//Create ray according to camera's geometry and material
ray = new THREE.Line( myBufferGeometry, material );
scene_Main.add(ray);
RESULTS :
WHAT I'M TRYING TO DO :
I'm trying to demonstrate RayTracing. The main goal is to shoot a N number of rays from the startPoint (nearPlane of camera's geometry) to the endPoint (farPlane of camera's geometry). I tried replacing var myBufferGeometry with the Camera's BufferGeometry var helperGeometry but as shown here its very weird.
Can the above be implemented??
来源:https://stackoverflow.com/questions/54808325/how-to-declare-a-buffergeometry-of-another-object-in-three-js