@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
21 lines (20 loc) • 514 B
JavaScript
;
import { isString, isArray } from "../Type";
import { AttribType } from "./Constant";
export class CoreAttributeData {
constructor(_size, _type) {
this._size = _size;
this._type = _type;
}
size() {
return this._size;
}
type() {
return this._type;
}
static from_value(attrib_value) {
const type = isString(attrib_value) ? AttribType.STRING : AttribType.NUMERIC;
const size = isArray(attrib_value) ? attrib_value.length : 1;
return new this(size, type);
}
}