Repository

js/Mobilizing/renderer/3D/three/shape/3D/primitive/Point.js

import * as THREE from 'three';
import Mesh from "../../Mesh";
import Vector3 from "../../../types/Vector3";
import Material from "../../../scene/Material";
import Transform from "../../../scene/Transform";

export default class Point extends Mesh {
    /**
    * @param {Object} params Parameters object, given by the constructor.
    * @param {Number} [params.point=Vector3(0, 0, 0)] the point 3D coordinates
    */
    constructor({
        points = new Vector3(0, 0, 0),
    } = {}) {
        super(...arguments);

        this.points = points;

        //line have special material so we must manage it specifically
        this.geometry = new THREE.Geometry();
        this.geometry.dynamic = true;

        this.geometry.vertices.push(this.points);
        this.material = new Material({ type: "points" });

        this._mesh = new THREE.Points(this.geometry, this.material._material);
        this.transform = new Transform(this);
    }
}