UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

24 lines (23 loc) 857 B
"use strict"; import { AttribType } from "../../../../../core/geometry/Constant"; import { TypeAssert } from "../../../../poly/Assert"; export function addCoreGroupAttribute(attribType, coreGroup, params) { switch (attribType) { case AttribType.NUMERIC: _addNumericAttributeToCoreGroup(coreGroup, params); return; case AttribType.STRING: _addStringAttributeToCoreGroup(coreGroup, params); return; } TypeAssert.unreachable(attribType); } function _addNumericAttributeToCoreGroup(coreGroup, params) { const value = [params.value1, params.value2, params.value3, params.value4][params.size - 1]; const attribName = params.name; coreGroup.setAttribValue(attribName, value); } function _addStringAttributeToCoreGroup(coreGroup, params) { const value = params.string; coreGroup.setAttribValue(params.name, value); }