polygonjs-engine
Version:
node-based webgl 3D engine https://polygonjs.com
21 lines (16 loc) • 482 B
text/typescript
import {CoreType} from '../Type';
import {AttribType} from './Constant';
export class CoreAttributeData {
constructor(private _size: number, private _type: AttribType) {}
size() {
return this._size;
}
type() {
return this._type;
}
static from_value(attrib_value: any) {
const type = CoreType.isString(attrib_value) ? AttribType.STRING : AttribType.NUMERIC;
const size = CoreType.isArray(attrib_value) ? attrib_value.length : 1;
return new this(size, type);
}
}