How to use the @babylonjs/core/Meshes/mesh.Mesh.CreatePlane function in @babylonjs/core

To help you get started, we’ve selected a few @babylonjs/core 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 andyhall / noa / src / lib / rendering.js View on Github external
function getHighlightMesh(rendering) {
    var m = rendering._highlightMesh
    if (!m) {
        var mesh = Mesh.CreatePlane("highlight", 1.0, rendering._scene)
        var hlm = rendering.makeStandardMaterial('highlightMat')
        hlm.backFaceCulling = false
        hlm.emissiveColor = new Color3(1, 1, 1)
        hlm.alpha = 0.2
        mesh.material = hlm
        m = rendering._highlightMesh = mesh
        // outline
        var s = 0.5
        var lines = Mesh.CreateLines("hightlightLines", [
            new Vector3(s, s, 0),
            new Vector3(s, -s, 0),
            new Vector3(-s, -s, 0),
            new Vector3(-s, s, 0),
            new Vector3(s, s, 0)
        ], rendering._scene)
        lines.color = new Color3(1, 1, 1)
github andyhall / noa / src / lib / rendering.js View on Github external
scene.detachControl()

    // octree setup
    self._octree = new Octree($ => {})
    self._octree.blocks = []
    scene._selectionOctree = self._octree

    // camera, and empty mesh to hold it, and one to accumulate rotations
    self._cameraHolder = new Mesh('camHolder', scene)
    self._camera = new FreeCamera('camera', new Vector3(0, 0, 0), scene)
    self._camera.parent = self._cameraHolder
    self._camera.minZ = .01
    self._cameraHolder.visibility = false

    // plane obscuring the camera - for overlaying an effect on the whole view
    self._camScreen = Mesh.CreatePlane('camScreen', 10, scene)
    self.addMeshToScene(self._camScreen)
    self._camScreen.position.z = .1
    self._camScreen.parent = self._camera
    self._camScreenMat = self.makeStandardMaterial('camscreenmat')
    self._camScreen.material = self._camScreenMat
    self._camScreen.setEnabled(false)
    self._camLocBlock = 0

    // apply some defaults
    var lightVec = new Vector3(0.1, 1, 0.3)
    self._light = new HemisphericLight('light', lightVec, scene)

    function arrToColor(a) { return new Color3(a[0], a[1], a[2]) }
    scene.clearColor = arrToColor(opts.clearColor)
    scene.ambientColor = arrToColor(opts.ambientColor)
    self._light.diffuse = arrToColor(opts.lightDiffuse)