forked from jeromeetienne/threex.geometricglow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
threex.geometricglowmesh.js
30 lines (25 loc) · 962 Bytes
/
threex.geometricglowmesh.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var THREEx = THREEx || {}
THREEx.GeometricGlowMesh = function(mesh){
var object3d = new THREE.Object3D
var geometry = mesh.geometry.clone()
THREEx.dilateGeometry(geometry, 0.01)
var material = THREEx.createAtmosphereMaterial()
material.uniforms.glowColor.value = new THREE.Color('cyan')
material.uniforms.coeficient.value = 1.1
material.uniforms.power.value = 1.4
var insideMesh = new THREE.Mesh(geometry, material );
object3d.add( insideMesh );
var geometry = mesh.geometry.clone()
THREEx.dilateGeometry(geometry, 0.1)
var material = THREEx.createAtmosphereMaterial()
material.uniforms.glowColor.value = new THREE.Color('cyan')
material.uniforms.coeficient.value = 0.1
material.uniforms.power.value = 1.2
material.side = THREE.BackSide
var outsideMesh = new THREE.Mesh( geometry, material );
object3d.add( outsideMesh );
// expose a few variable
this.object3d = object3d
this.insideMesh = insideMesh
this.outsideMesh= outsideMesh
}