![]() Also cloning down the repo, installing the packages, and running the server might be the fastest way to get things up and running on your end. This is also where I have the source code examples for my many other blog posts on threejs. The source code examples for this post as well as my many other posts on threejs can be found on Github in my test threejs repo. Source code examples for this post and many others are up on Github There are also a wide range of other topics that branch off from object3d that are worth looking into more also, such as the Euler class that is used when it comes to the rotation property of a line segments object, and the Vector3 class that is used with the position property. In this post it is mainly the Line Segments instance to which a knowledge of Object3d applies, but there is also the camera, and the scene object also that are other examples of objects that are based off of Object3d. ![]() If you have not done so take a moment to look into this class in great detail, there is a lot to know about it and it apples to a whole lot of objects in three.js. The line segments constructor that is used with the geometry that is returned by the edges geometry constrictor is based on a class known as object3d. The Object3d class is also worth looking into more also. However there is a restriction on what materials can be used as I can only use Line materials such as the Line basic material with an instance of line segments. You might all ready be somewhat familiar with the Mesh Constructor in threejs, this Line Segments constructor is somewhat similar in the sense that it is yet another object in three.js that is based off of the object3d class, and it will work with a geometry instance. Once A geometry is passed to the Edges geometry constrictor another geometry is returned, but then in order to see anything the nest step would be to pass the resulting Edges geometry to the Line segments constructor. The Line segments constructor, and Line Materials There is also loading a geometry in from an external file, or creating a custom geometry with a little javaScript code using the Buffer Geometry constructor directly. There are a number of options to choose from in threejs when it comes to built in geometry constructors such as the box geometry constructor, and the sphere geometry constructor. In other words in order to create an Edge Geometry to use with Line Segments you first need a geometry. The first argument for the Edges Geometry constructor should be an instance of buffer geometry from which to create edges from. Read up a bit more on buffer geometry in general first I will however take a moment to go over a few things that you might want to read up on more if you find this post a little to advanced still. In order to gain something of value from reading this it is called for to have at least some background on these subjects as I will not be getting into the very basics of threejs and javaScript here. This is a post on the THREE.EdgesGeometry constructor function in the javaScript library known as threejs. The Edges geometry constructor and what to know first. ![]() This subject then deserves at least one stand alone post on the topic then, as there are some stations in which I might want to use this in place of what is typically used. ![]() So when it comes to creating another kind of wire frame mode that is just the edges of a geometry this edges geometry constructor can help with that when used with the line constructor in place of the use of the mesh constructor. When it comes to wire frame mode that works more or less as expected, however it will work by showing all the triangles of a geometry, not just the edges of a geometry as a line, or collection of line segments. I became aware of how this constructor can be useful when I took a second look into how to go about working with wire frames when updating my post on that subject in threejs. There is just one more additional argument when calling the constructor that is a threshold angle. It works by passing a geometry to which I want the edges from and returns a new geometry that will be just the edges from the given source geometry. The edges geometry constructor in threejs is yet another useful little feature of threejs that can be a handy tool when I just want to view the edges of a geometry. ![]()
0 Comments
Leave a Reply. |