@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
70 lines (69 loc) • 3.62 kB
JavaScript
;
import { coreObjectClassFactory } from "../geometry/CoreObjectFactory";
export var SoftBodyIdAttribute = /* @__PURE__ */ ((SoftBodyIdAttribute2) => {
SoftBodyIdAttribute2["SOLVER_NODE"] = "SoftBodyIdAttribute_node";
SoftBodyIdAttribute2["EMBED_HIGH_RES_NODE"] = "SoftBodyIdAttribute_embedHighResNode";
SoftBodyIdAttribute2["EPHEMERAL_ID"] = "SoftBodyIdAttribute_ephemeralId";
return SoftBodyIdAttribute2;
})(SoftBodyIdAttribute || {});
export var SoftBodyCommonAttribute = /* @__PURE__ */ ((SoftBodyCommonAttribute2) => {
SoftBodyCommonAttribute2["HIGH_RES_SKINNING_LOOKUP_SPACING"] = "SoftBodyAttribute_highResSkinningLookupSpacing";
SoftBodyCommonAttribute2["HIGH_RES_SKINNING_LOOKUP_PADDING"] = "SoftBodyAttribute_highResSkinningLookupPadding";
return SoftBodyCommonAttribute2;
})(SoftBodyCommonAttribute || {});
export class CoreSoftBodyBaseAttribute {
static _setVector3(object, attribName, value) {
coreObjectClassFactory(object).addAttribute(object, attribName, value);
}
static _getVector3(object, attribName, target) {
coreObjectClassFactory(object).attribValue(object, attribName, 0, target);
}
static _setNumber(object, attribName, value) {
coreObjectClassFactory(object).addAttribute(object, attribName, value);
}
static _getNumber(object, attribName, defaultValue) {
const val = coreObjectClassFactory(object).attribValue(object, attribName, 0);
if (val == null) {
return defaultValue;
}
return val;
}
}
export class CoreSoftBodyAttribute extends CoreSoftBodyBaseAttribute {
static setTetEmbedHighResNodeId(object, value) {
this._setNumber(object, "SoftBodyIdAttribute_embedHighResNode" /* EMBED_HIGH_RES_NODE */, value);
}
static getTetEmbedHighResNodeId(object) {
return this._getNumber(object, "SoftBodyIdAttribute_embedHighResNode" /* EMBED_HIGH_RES_NODE */, -1);
}
// static setGravity(object: ObjectContent<CoreObjectType>, value: Vector3) {
// this._setVector3(object, SoftBodyCommonAttribute.GRAVITY, value);
// }
// static getGravity(object: ObjectContent<CoreObjectType>, value: Vector3) {
// return this._getVector3(object, SoftBodyCommonAttribute.GRAVITY, value);
// }
// static setEdgeCompliance(object: ObjectContent<CoreObjectType>, value: number) {
// this._setNumber(object, SoftBodyCommonAttribute.EDGE_COMPLIANCE, value);
// }
// static getEdgeCompliance(object: ObjectContent<CoreObjectType>) {
// return this._getNumber(object, SoftBodyCommonAttribute.EDGE_COMPLIANCE, 100);
// }
// static setVolumeCompliance(object: ObjectContent<CoreObjectType>, value: number) {
// this._setNumber(object, SoftBodyCommonAttribute.VOLUME_COMPLIANCED, value);
// }
// static getVolumeCompliance(object: ObjectContent<CoreObjectType>) {
// return this._getNumber(object, SoftBodyCommonAttribute.VOLUME_COMPLIANCED, 0);
// }
static setHighResSkinningLookupSpacing(object, value) {
this._setNumber(object, "SoftBodyAttribute_highResSkinningLookupSpacing" /* HIGH_RES_SKINNING_LOOKUP_SPACING */, value);
}
static getHighResSkinningLookupSpacing(object) {
return this._getNumber(object, "SoftBodyAttribute_highResSkinningLookupSpacing" /* HIGH_RES_SKINNING_LOOKUP_SPACING */, 100);
}
static setHighResSkinningLookupPadding(object, value) {
this._setNumber(object, "SoftBodyAttribute_highResSkinningLookupPadding" /* HIGH_RES_SKINNING_LOOKUP_PADDING */, value);
}
static getHighResSkinningLookupPadding(object) {
return this._getNumber(object, "SoftBodyAttribute_highResSkinningLookupPadding" /* HIGH_RES_SKINNING_LOOKUP_PADDING */, 100);
}
}