66 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-06-25 00:23:03 +08:00
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
/**
* A representation of a model
*/
export default class Model {
/**
* Setup a default empty model
*/
constructor() {
this._type = 'default';
this._poolID = -1;
this._node = null;
this._inputAssembler = null;
this._effect = null;
this._viewID = -1;
this._cameraID = -1;
this._userKey = -1;
this._castShadow = false;
this._boundingShape = null;
}
/**
* Set the hosting node of this model
* @param {Node} node the hosting node
*/
setNode(node) {
this._node = node;
}
/**
* Set the input assembler
* @param {InputAssembler} ia
*/
setInputAssembler(ia) {
this._inputAssembler = ia;
}
/**
* Set the model effect
* @param {?Effect} effect the effect to use
*/
setEffect(effect) {
this._effect = effect;
}
/**
* Set the user key
* @param {number} key
*/
setUserKey(key) {
this._userKey = key;
}
/**
* Extract a drawing item
* @param {Object} out the receiving item
*/
extractDrawItem(out) {
out.model = this;
out.node = this._node;
out.ia = this._inputAssembler;
out.effect = this._effect;
}
}