@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
15 lines (14 loc) • 411 B
JavaScript
;
import { rangeWithEnd } from "../../ArrayUtils";
const POSITION = "position";
export class CoreGeometryIndexBuilder {
static createIndexIfNone(geometry) {
if (!geometry.index) {
const position = geometry.getAttribute(POSITION);
if (position) {
const position_array = position.array;
geometry.setIndex(rangeWithEnd(position_array.length / 3));
}
}
}
}