A Mesh is used in three.js to create triangular polygon based mesh Objects with a geometry, and a material. The Mesh Constructor is one of many constructors that you will find yourself using often as you get into making three.js projects. It is typically what is used for any kind of 3d Object that will be placed in a Scene
A Basic example of using a mesh would involve creating an instance of Mesh with the THREE.Mesh constructor, passing it the geometry that you want to use. Be default the basic material will be used with a random color, if you want to use something else for a material then you will want to pass that to the Mesh Constructor as the second argument.
In this demo I am just calling all the relevant constructors to produce a Mesh that will then directly be placed in the Scene. I can get away with this because it is a very basic demo, in more complex projects I will typically want to store the instance of Mesh to a variable so I can later work with it elsewhere.
it is important to note that THREE.Mesh is just one of many constructors in three.js that inherit from Object3D which I will not get into detail about here. However for now it is a good idea to just know that Object3D brings a whole bunch of methods, and properties to THREE.Mesh that can be used to do things like moving the mesh around, and changing its rotation.
Here I am using the Object3D position property that stores an instance of Vector3 that can be used to change what should be the center point of the Mesh geometry assuming it has been normalized.
That might come off as a mouth full so maybe another way of explaining it is that there is a point in space in which the geometry of the mesh is relative to. The position property can be used to change the value of that point in space.
Also In this demo I am using the lookAt Method, which is another useful methods that is inherited from, use guessed it, Object3D.
Read my full post on material index, and arrays of materials
It is possible to pass an array of materials rather than just a single instance of some kind of mesh material such as the basic material. When doing this the material index value of the face3 instances in the geometry used is of interest when it comes to assigning what material is used for what face.
I have a post on this in which I get into this in detail but I can also provide a basic example of this here:
There is not much more to write about with Mesh, at least not at this time. However that is not at all the case with many other topics that branch off from Mesh such as geometry, materials, Object3D, Vector3, the Scenes, and many more.