import {TypedSopNode} from "@polygonjs/polygonjs/dist/src/engine/nodes/sop/_Base";
import {InputCloneMode as InputCloneMode2} from "@polygonjs/polygonjs/dist/src/engine/poly/InputCloneMode";
import {RBD_SHAPES} from "../../../core/physics/ammo/RBDBodyHelper";
import {PhysicsRbdAttributesSopOperation, RBD_ATTRIBUTE_MODES} from "../../../core/operations/sop/PhysicsRbdAttributes";
import {NodeParamsConfig, ParamConfig} from "@polygonjs/polygonjs/dist/src/engine/nodes/utils/params/ParamsConfig";
const DEFAULT = PhysicsRbdAttributesSopOperation.DEFAULT_PARAMS;
class PhysicsRBDAttributesSopParamsConfig extends NodeParamsConfig {
  constructor() {
    super(...arguments);
    this.mode = ParamConfig.INTEGER(DEFAULT.mode, {
      menu: {
        entries: RBD_ATTRIBUTE_MODES.map((name, value) => {
          return {name, value};
        })
      }
    });
    this.active = ParamConfig.BOOLEAN(DEFAULT.active);
    this.shape = ParamConfig.INTEGER(DEFAULT.shape, {
      menu: {
        entries: RBD_SHAPES.map((name, value) => {
          return {name, value};
        })
      }
    });
    this.addId = ParamConfig.BOOLEAN(DEFAULT.addId);
    this.mass = ParamConfig.FLOAT(DEFAULT.mass);
    this.restitution = ParamConfig.FLOAT(DEFAULT.restitution);
    this.damping = ParamConfig.FLOAT(DEFAULT.damping);
    this.angularDamping = ParamConfig.FLOAT(DEFAULT.angularDamping);
    this.friction = ParamConfig.FLOAT(DEFAULT.friction);
    this.simulated = ParamConfig.FLOAT(DEFAULT.simulated);
  }
}
const ParamsConfig2 = new PhysicsRBDAttributesSopParamsConfig();
export class PhysicsRbdAttributesSopNode extends TypedSopNode {
  constructor() {
    super(...arguments);
    this.params_config = ParamsConfig2;
  }
  static type() {
    return "physicsRbdAttributes";
  }
  initializeNode() {
    this.io.inputs.setCount(1);
    this.io.inputs.initInputsClonedState(InputCloneMode2.FROM_NODE);
  }
  cook(input_contents) {
    this._operation = this._operation || new PhysicsRbdAttributesSopOperation(this._scene, this.states);
    const core_group = this._operation.cook(input_contents, this.pv);
    this.setCoreGroup(core_group);
  }
}
