Reference Source

src/plugins/GroundShadowPlugin/ModelGroundShadow.js

import {Mesh} from "../../viewer/scene/mesh/Mesh.js";
import {VBOGeometry} from "../../viewer/scene/geometry/VBOGeometry.js";
import {buildPlaneGeometry} from "../../viewer/scene/geometry/builders/buildPlaneGeometry.js";
import {PhongMaterial} from "../../viewer/scene/materials/PhongMaterial.js";
import {Texture} from "../../viewer/scene/materials/Texture.js";
import {Component} from "../../viewer/scene/Component.js";

class ModelGroundShadow extends Component {

    constructor(owner, cfg) {

        super(owner, cfg);

        this._modelId = cfg.modelId;

        this._texture = new Texture(this, {
            image: this.image
        });

        this._mesh = new Mesh(this, {
            geometry: new VBOGeometry(this, buildPlaneGeometry({
                xSize: 1,
                ySize: 1,
                zSize: 1
            })),
            material: new PhongMaterial(this, {
                ambient: [0.9, 0.3, 0.9],
                shininess: 30,
                diffuseMap: this._texture
            })
        });
    }

    set image(image) {
        this._texture.image = image;
    }

    destroy() {
        super.destroy();
        //..
    }
}

export {ModelGroundShadow};