setCullMode(_:)
Configures how the render pipeline determines which primitives to remove.
Declaration
func setCullMode(_ cullMode: MTLCullMode)Parameters
- cullMode:
An Mtlcullmode value that configures how the render pipeline determines which primitives to remove from the pipeline.
Discussion
This method configures which primitives the render pipeline removes, if any, based on the direction of each primitive’s face relative to the scene’s camera. For example, you can correctly cull hidden surfaces on some geometric models, such as a sphere made of filled triangles, if it uses orientable surfaces. A surface is orientable if its primitives consistently use the same ordering for its vertices. Metal defines vertex ordering with the MTLWinding type, which includes MTLWinding.clockwise and MTLWinding.counterClockwise. You can tell the render pipeline which direction your primitives face by calling the setFrontFacing(_:) method, which affects the primitives the culling mode removes.
The render pass’s default culling mode is MTLCullMode.none.