How to use mage-engine - 10 common examples

To help you get started, we’ve selected a few mage-engine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MageStudio / Mage-Studio / _OLD / app_OLD / Interface.Sidebar.Right.js View on Github external
_setShaderOptions: function(shaderName) {
        var options = require('mage-engine').engine.fx.shadersEngine.get(shaderName).options,
            container = document.querySelector('#shaderOptions');

        if (options) {
            // now creating form for shader option
            for (var k in options) {
                var input = app.interface.sidebarHelper.createFormInput(k, options[k]);
                container.appendChild(input);
            }

            container.appendChild(app.interface.sidebarHelper.createButton('update', app.interface.rightSidebar.meshListener.changeShaderOption))
        } else {
            console.warn('Selected shader doesn\'t have options.');
        }
    },
github MageStudio / Mage-Studio / app / scene / EditorScene / App.js View on Github external
onKeyPress = ({ event }) => {
        switch (event.key) {
			case "q": // Q
				this.transform.setSpace(this.transform.space === "local" ? "world" : "local");
				break;
			case "ctrl": // Ctrl
				this.transform.setTranslationSnap(100);
				this.transform.setRotationSnap(THREE.Math.degToRad(15));
				break;
			case "w": // W
				this.transform.setMode("translate");
				break;
			case "e": // E
				this.transform.setMode("rotate");
				break;
			case "r": // R
				this.transform.setMode("scale");
				break;
			case 187:
			case 107: // +, =, num+
				this.transform.setSize(this.transform.size + 0.1);
				break;
			case 189:
			case 109: // -, _, num-
github MageStudio / Mage / template / src / SecondScene / App.js View on Github external
onCreate() {
        //ControlsManager.setOrbitControl();
        const cube = this.sceneHelper.addCube(20, 0xffffff);
        this.sceneHelper.addCube(40, 0x00ffff);

        SceneManager.camera.position({y: 70, z: 150});
        SceneManager.camera.lookAt(0, 0, 0);

        cube.position({y: 40});
    }
}
github MageStudio / Mage-Studio / app / scene / EditorScene / App.js View on Github external
onCreate() {
        SceneManager.camera.position({y: 70, z: 150});
        SceneManager.camera.lookAt(0, 0, 0);

        this.setTranformControls();
        this.enableInput();

        this.sceneHelper.addGrid(2000, 100);
    }
}
github MageStudio / Mage / template / src / FirstScene / App.js View on Github external
onCreate() {
        ControlsManager.setOrbitControl();
        window.cube = this.sceneHelper.addCube(20, 0xffffff);

        SceneManager.camera.position({y: 70, z: 150});
        SceneManager.camera.lookAt(0, 0, 0);

        this.sceneHelper.addGrid(200, 20);
        cube.position({z: 10});
    }
}
github MageStudio / Mage / template / src / FirstScene / App.js View on Github external
onCreate() {
        ControlsManager.setOrbitControl();
        window.cube = this.sceneHelper.addCube(20, 0xffffff);

        SceneManager.camera.position({y: 70, z: 150});
        SceneManager.camera.lookAt(0, 0, 0);

        this.sceneHelper.addGrid(200, 20);
        cube.position({z: 10});
    }
}
github MageStudio / Mage-Studio / app / scene / EditorScene / App.js View on Github external
onCreate() {
        SceneManager.camera.position({y: 70, z: 150});
        SceneManager.camera.lookAt(0, 0, 0);

        this.setTranformControls();
        this.enableInput();

        this.sceneHelper.addGrid(2000, 100);
    }
}
github MageStudio / Mage / template / src / SecondScene / App.js View on Github external
onCreate() {
        //ControlsManager.setOrbitControl();
        const cube = this.sceneHelper.addCube(20, 0xffffff);
        this.sceneHelper.addCube(40, 0x00ffff);

        SceneManager.camera.position({y: 70, z: 150});
        SceneManager.camera.lookAt(0, 0, 0);

        cube.position({y: 40});
    }
}
github MageStudio / Mage-Studio / app / scene / EditorScene / App.js View on Github external
setTranformControls() {
        ControlsManager.setOrbitControl();
        ControlsManager.setTransformControl();

        this.transform = ControlsManager.getControl('transform');
        this.transform.addEventListener('objectChange', this.dispatchMeshChange.bind(this));
    }
github MageStudio / Mage / template / src / FirstScene / App.js View on Github external
onCreate() {
        ControlsManager.setOrbitControl();
        window.cube = this.sceneHelper.addCube(20, 0xffffff);

        SceneManager.camera.position({y: 70, z: 150});
        SceneManager.camera.lookAt(0, 0, 0);

        this.sceneHelper.addGrid(200, 20);
        cube.position({z: 10});
    }
}