Revision Difference
mesh_primitives#562042
<title>Mesh Reference - Primitive Types</title>
<warning>This page is work in progress</warning>
# Mesh Library References
These pages seek to provide helpful insight into the usage of the <page>mesh</page> library and its functions.
The pages in this series are:
* **Primitive Types**
# Terms and Definitions
## What is a Primitive?
Definitionally, a Primitive is the simple shapes that any model (or "mesh") is built from.
⤶
Definitionally, a Primitive is the simple shapes that any model (or "mesh") is built from.
Practically, a Primitive is a grouping of one or more vertices that the rendering system interprets together in order to draw a simple shape onto the currently active <page text="Render Target">render_rendertargets</page>.
As an example, the most common Primitive types are triangles (3 vertices), and quads (4 vertices).
## Face Culling and Vertex Winding
If the rendering system simply drew all Primitives (or "faces") for a model,
## Vertex Winding
⤶
When defining a Primitive, the order of its vertices is very important for ensuring it draws as expected. The rendering system does not perform **any** meaningful validation of the Primitive's information and instead simply draws whatever data it is provided. Because of this, it is important to provide vertices in the order that the rendering system is expecting.
⤶
There are two ways of ordering verticies (Called "Windings"): **Clockwise** and **Counter-Clockwise** (or Anti-Clockwise, if preferred.)⤶
⤶
*Fun fact: They're called "Windings" because putting lines between vertices is conceptually similar to ***winding*** a rope or wire around a spool!*⤶
⤶
<upload src="b2b4c/8dc9548bb80c0ee.png" size="176662" name="VertexWindings.png" />⤶
⤶
## Culling⤶
⤶
To save on unnecessary draw operations, the rendering system only draws Primitives (or "faces") that are facing generally towards the camera. ⤶
The way that the rendering system determines which faces to draw and which faces not to draw is based on the vertex winding of the face in question.⤶
⤶
If a face is wound counter-clockwise relative to the camera, it is assumed to be a "**front**" face (which is drawn), and if it is instead wound clockwise relative to the camera, it is considered a "**back**" face (Which is *not* drawn.)⤶
⤶
This type of culling is often called "**back face culling**" and it is the major reason why vertex order is important when creating meshes.⤶
# Primitive Types
TODO