Files
cocos4/cocos/3d/assets/primitive.ts
T
Yun Hsiao Wu 182a29a869 skinning mesh bounds (#4591)
* skinning mesh bounds

* scene-utils docs

* fix batching
2019-06-12 17:06:13 +08:00

31 lines
717 B
TypeScript

import { ccclass, property } from '../../core/data/class-decorator';
import { Enum } from '../../core/value-types';
import { createMesh } from '../misc/utils';
import * as primitives from '../primitive';
import { Mesh } from './mesh';
const PrimitiveType = Enum({
BOX: 0,
SPHERE: 1,
CYLINDER: 2,
CONE: 3,
CAPSULE: 4,
TORUS: 5,
PLANE: 6,
QUAD: 7,
});
@ccclass('cc.Primitive')
export class Primitive extends Mesh {
@property(PrimitiveType)
public type: number = PrimitiveType.BOX;
@property
public info: Record<string, number> = {};
public onLoaded () {
createMesh(primitives[PrimitiveType[this.type]](this.info), this);
}
}
cc.Primitive = Primitive;