painterSortStable (webgl/WebGLRenderLists.js)

three.js · src/renderers/webgl/WebGLRenderLists.js · javascript · MIT
ui, tag:embed-classified

Manages render lists for WebGL in three.js.

// Source: https://github.com/mrdoob/three.js | License: MIT | Copyright 2010-2026 three.js authors
// Provided via justclaw.it.com; keep this notice with the code.
function painterSortStable( a, b ) {

	if ( a.groupOrder !== b.groupOrder ) {

		return a.groupOrder - b.groupOrder;

	} else if ( a.renderOrder !== b.renderOrder ) {

		return a.renderOrder - b.renderOrder;

	} else if ( a.material.id !== b.material.id ) {

		return a.material.id - b.material.id;

	} else if ( a.materialVariant !== b.materialVariant ) {

		return a.materialVariant - b.materialVariant;

	} else if ( a.z !== b.z ) {

		return a.z - b.z;

	} else {

		return a.id - b.id;

	}

}

function reversePainterSortStable( a, b ) {

	if ( a.groupOrder !== b.groupOrder ) {

		return a.groupOrder - b.groupOrder;

	} else if 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key