zoukankan      html  css  js  c++  java
  • IfcContext

    IfcContext

    学习

    class IfcContext {
        constructor(options) {
            this.render = () => {
                requestAnimationFrame(this.render);
                this.updateAllComponents();
            };
            if (!options.container)
                throw new Error('Could not get container element!');
            this.options = options;
            this.events = new IfcEvents();
            this.items = this.newItems();
            this.scene = new IfcScene(this);
            this.renderer = new IfcRenderer(this);
            this.ifcCamera = new IfcCamera(this);
            this.events.publish(IfcEvent.onCameraReady);
            this.clippingPlanes = [];
            this.ifcCaster = new IfcRaycaster(this);
            this.clock = new Clock(true);
            this.ifcAnimator = new Animator();
            this.setupWindowRescale();
            this.render();
        }
        getScene() {
            return this.scene.scene;
        }
        getRenderer() {
            return this.renderer.basicRenderer;
        }
        getRenderer2D() {
            return this.renderer.renderer2D;
        }
        getCamera() {
            return this.ifcCamera.activeCamera;
        }
        getIfcCamera() {
            return this.ifcCamera;
        }
        getDomElement() {
            return this.getRenderer().domElement;
        }
        getDomElement2D() {
            return this.getRenderer2D().domElement;
        }
        getContainerElement() {
            return this.options.container;
        }
        getDimensions() {
            const element = this.getContainerElement();
            return new Vector2(element.clientWidth, element.clientHeight);
        }
        getClippingPlanes() {
            return this.clippingPlanes;
        }
        getAnimator() {
            return this.ifcAnimator;
        }
        getCenter(mesh) {
            var _a;
            const center = new Vector3();
            mesh.geometry.computeBoundingBox();
            (_a = mesh.geometry.boundingBox) === null || _a === void 0 ? void 0 : _a.getCenter(center);
            return center;
        }
        addComponent(component) {
            this.items.components.push(component);
        }
        addClippingPlane(plane) {
            this.clippingPlanes.push(plane);
        }
        removeClippingPlane(plane) {
            const index = this.clippingPlanes.indexOf(plane);
            this.clippingPlanes.splice(index, 1);
        }
        castRay(items) {
            return this.ifcCaster.castRay(items);
        }
        castRayIfc() {
            return this.ifcCaster.castRayIfc();
        }
        fitToFrame() {
            this.ifcCamera.navMode[NavigationModes.Orbit].fitModelToFrame();
        }
        toggleCameraControls(active) {
            this.ifcCamera.toggleCameraControls(active);
        }
        updateAspect() {
            this.ifcCamera.updateAspect();
            this.renderer.adjustRendererSize();
        }
        updateAllComponents() {
            const delta = this.clock.getDelta();
            this.items.components.forEach((component) => component.update(delta));
        }
        setupWindowRescale() {
            window.addEventListener('resize', () => {
                this.updateAspect();
            });
        }
        newItems() {
            return {
                components: [],
                ifcModels: [],
                pickableIfcModels: []
            };
        }
    }

    ##############33

  • 相关阅读:
    Windows Server 2008 R2 服务器系统安装及配置全过程图文详解
    c#多线程
    DevExpress之TreeList控件用作导航使用说明
    Windows操作系统下搭建Git服务器和客户端。
    D^3CTF 2021 8-bit-pub
    shiro-1.2.4反序列化分析踩坑
    *CTF2021 oh-my-bet
    无线网络密码破解初体验
    瑞昱rtl819x-SDK-v3.4.14b的watchdog分析
    RC4加密算法
  • 原文地址:https://www.cnblogs.com/herd/p/15563774.html
Copyright © 2011-2022 走看看