lore-engine
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -20,3 +20,3 @@ (function() { | ||
pointHelper.setPointScale(1.0); | ||
pointHelper.setFogDistance(600, 900); | ||
pointHelper.setFog([0.05, 0.05, 0.05, 1.0], 6.0); | ||
pointHelper.addFilter('hueRange', new Lore.Filters.InRangeFilter('color', 0, 0.22, 0.25)); | ||
@@ -23,0 +23,0 @@ |
@@ -19,3 +19,3 @@ (function() { | ||
pointHelper.setPointScale(1.0); | ||
pointHelper.setFogDistance(600, 900); | ||
pointHelper.setFog([0.05, 0.05, 0.05, 1.0], 6.0); | ||
pointHelper.addFilter('hueRange', new Lore.Filters.InRangeFilter('color', 0, 0.22, 0.25)); | ||
@@ -22,0 +22,0 @@ |
@@ -20,2 +20,3 @@ (function() { | ||
pointHelper.setPointScale(1.0); | ||
pointHelper.setFog([0.05, 0.05, 0.05, 1.0], 6.0); | ||
pointHelper.addFilter('hueRange', new Lore.Filters.InRangeFilter('color', 0, 0.22, 0.25)); | ||
@@ -22,0 +23,0 @@ |
@@ -16,3 +16,4 @@ (function() { | ||
pointHelper.setPointScale(5.0); | ||
pointHelper.setFog([1.0, 1.0, 1.0, 1.0], 6.0); | ||
lore.controls.setLookAt(pointHelper.getCenter()); | ||
@@ -19,0 +20,0 @@ lore.controls.setRadius(pointHelper.getMaxRadius()); |
{ | ||
"name": "lore-engine", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A WebGL based 3D data visualization engine.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/lore.js", |
@@ -6,3 +6,3 @@ ![Lore](https://github.com/reymond-group/lore/blob/master/logo.png?raw=true) | ||
# Lore | ||
Current Version: 1.0.0 ([Starbreaker](https://www.youtube.com/watch?v=nr8pgN195Zw)) | ||
Current Version: 1.0.8 ([Godzilla](https://youtu.be/RTzb-sduiWc)) | ||
@@ -23,3 +23,5 @@ ### Teasers | ||
See the examples folder for more details. | ||
### Example | ||
A basic [fiddle](https://jsfiddle.net/bmkxpg7g/2/) | ||
**See the examples folder for more details.** | ||
@@ -26,0 +28,0 @@ |
@@ -366,13 +366,17 @@ //@ts-check | ||
/** | ||
* Sets the fog start and end distances, as seen from the camera. | ||
* Sets the fog colour and it's density, as seen from the camera. | ||
* | ||
* @param {Number} fogStart The start distance of the fog. | ||
* @param {Number} fogEnd The end distance of the fog. | ||
* @param {Array} color An array defining the rgba values of the fog colour. | ||
* @param {Number} fogDensity The density of the fog. | ||
* @returns {PointHelper} Itself. | ||
*/ | ||
setFogDistance(fogStart, fogEnd) { | ||
console.warn('This function is deprecated.'); | ||
// this.geometry.shader.uniforms.fogStart.value = fogStart; | ||
// this.geometry.shader.uniforms.fogEnd.value = fogEnd; | ||
setFog(color, fogDensity = 6.0) { | ||
if (!this.geometry.shader.uniforms.clearColor || !this.geometry.shader.uniforms.fogDensity) { | ||
console.warn('Shader "' + this.geometry.shader.name + '" does not support fog.'); | ||
return this; | ||
} | ||
this.geometry.shader.uniforms.clearColor.value = color; | ||
this.geometry.shader.uniforms.fogDensity.value = fogDensity; | ||
return this; | ||
@@ -379,0 +383,0 @@ } |
@@ -6,3 +6,4 @@ const Shader = require('../Core/Shader') | ||
cutoff: new Uniform('cutoff', 0.0, 'float'), | ||
clearColor: new Uniform('clearColor', [0.0, 0.0, 0.0, 1.0], 'float_vec4') }, [ | ||
clearColor: new Uniform('clearColor', [0.0, 0.0, 0.0, 1.0], 'float_vec4'), | ||
fogDensity: new Uniform('fogDensity', 6.0, 'float') }, [ | ||
'uniform float size;', | ||
@@ -44,2 +45,3 @@ 'uniform float cutoff;', | ||
'uniform vec4 clearColor;', | ||
'uniform float fogDensity;', | ||
'varying vec3 vColor;', | ||
@@ -56,6 +58,6 @@ 'varying float vDiscard;', | ||
'if (mag > 1.0) discard; // discard fragments outside circle', | ||
'float fogIntensity = (gl_FragCoord.z / gl_FragCoord.w) * 2.0;', | ||
'fogIntensity *= clearColor.w;', | ||
'gl_FragColor = mix(vec4(vColor, 1.0), clearColor, fogIntensity);', | ||
'float z = gl_FragCoord.z / gl_FragCoord.w;', | ||
'float fog_factor = clamp(exp2(-fogDensity * fogDensity * z * z * 1.442695), 0.025, 1.0);', | ||
'gl_FragColor = mix(clearColor, vec4(vColor, 1.0), fog_factor);', | ||
'}' | ||
]); |
@@ -7,3 +7,4 @@ const Shader = require('../Core/Shader') | ||
cutoff: new Uniform('cutoff', 0.0, 'float'), | ||
clearColor: new Uniform('clearColor', [0.0, 0.0, 0.0, 1.0], 'float_vec4') }, [ | ||
clearColor: new Uniform('clearColor', [0.0, 0.0, 0.0, 1.0], 'float_vec4'), | ||
fogDensity: new Uniform('fogDensity', 6.0, 'float') }, [ | ||
'uniform float size;', | ||
@@ -48,2 +49,3 @@ 'uniform float cutoff;', | ||
'uniform vec4 clearColor;', | ||
'uniform float fogDensity;', | ||
'varying vec3 vColor;', | ||
@@ -53,7 +55,6 @@ 'varying float vDiscard;', | ||
'if(vDiscard > 0.5) discard;', | ||
'float fogIntensity = (gl_FragCoord.z / gl_FragCoord.w);', | ||
'fogIntensity = fogIntensity + fogIntensity * 2.0;', | ||
'fogIntensity *= clearColor.w;', | ||
'gl_FragColor = mix(vec4(vColor, 1.0), clearColor, fogIntensity);', | ||
'float z = gl_FragCoord.z / gl_FragCoord.w;', | ||
'float fog_factor = clamp(exp2(-fogDensity * fogDensity * z * z * 1.442695), 0.025, 1.0);', | ||
'gl_FragColor = mix(clearColor, vec4(vColor, 1.0), fog_factor);', | ||
'}' | ||
]); |
@@ -7,3 +7,4 @@ const Shader = require('../Core/Shader') | ||
time: new Uniform('time', 0.0, 'float'), | ||
clearColor: new Uniform('clearColor', [0.0, 0.0, 0.0, 1.0], 'float_vec4') }, [ | ||
clearColor: new Uniform('clearColor', [0.0, 0.0, 0.0, 1.0], 'float_vec4'), | ||
fogDensity: new Uniform('fogDensity', 6.0, 'float') }, [ | ||
'uniform float size;', | ||
@@ -47,2 +48,3 @@ 'uniform float cutoff;', | ||
'uniform vec4 clearColor;', | ||
'uniform float fogDensity;', | ||
'varying vec3 vColor;', | ||
@@ -52,7 +54,6 @@ 'varying float vDiscard;', | ||
'if(vDiscard > 0.5) discard;', | ||
'float fogIntensity = (gl_FragCoord.z / gl_FragCoord.w);', | ||
'fogIntensity = fogIntensity + fogIntensity * 2.0;', | ||
'fogIntensity *= clearColor.w;', | ||
'gl_FragColor = mix(vec4(vColor, 1.0), clearColor, fogIntensity);', | ||
'float z = gl_FragCoord.z / gl_FragCoord.w;', | ||
'float fog_factor = clamp(exp2(-fogDensity * fogDensity * z * z * 1.442695), 0.025, 1.0);', | ||
'gl_FragColor = mix(clearColor, vec4(vColor, 1.0), fog_factor);', | ||
'}' | ||
]); |
@@ -6,3 +6,4 @@ const Shader = require('../Core/Shader') | ||
cutoff: new Uniform('cutoff', 0.0, 'float'), | ||
clearColor: new Uniform('clearColor', [0.0, 0.0, 0.0, 1.0], 'float_vec4') }, [ | ||
clearColor: new Uniform('clearColor', [0.0, 0.0, 0.0, 1.0], 'float_vec4'), | ||
fogDensity: new Uniform('fogDensity', 6.0, 'float') }, [ | ||
'uniform float size;', | ||
@@ -44,2 +45,3 @@ 'uniform float cutoff;', | ||
'uniform vec4 clearColor;', | ||
'uniform float fogDensity;', | ||
'varying vec3 vColor;', | ||
@@ -59,8 +61,7 @@ 'varying float vDiscard;', | ||
'float diffuse = max(0.25, dot(light_dir, N));', | ||
'float fogIntensity = (gl_FragCoord.z / gl_FragCoord.w);', | ||
'fogIntensity = fogIntensity + fogIntensity * 2.0;', | ||
'fogIntensity *= clearColor.w;', | ||
'float z = gl_FragCoord.z / gl_FragCoord.w;', | ||
'float fog_factor = clamp(exp2(-fogDensity * fogDensity * z * z * 1.442695), 0.025, 1.0);', | ||
'vec3 color = vColor * diffuse;', | ||
'gl_FragColor = mix(vec4(color, 1.0), clearColor, fogIntensity);', | ||
'gl_FragColor = mix(clearColor, vec4(color, 1.0), fog_factor);', | ||
'}' | ||
]); |
@@ -6,3 +6,4 @@ const Shader = require('../Core/Shader') | ||
cutoff: new Uniform('cutoff', 0.0, 'float'), | ||
clearColor: new Uniform('clearColor', [1.0, 1.0, 1.0, 1.0], 'float_vec4') }, [ | ||
clearColor: new Uniform('clearColor', [1.0, 1.0, 1.0, 1.0], 'float_vec4'), | ||
fogDensity: new Uniform('fogDensity', 6.0, 'float') }, [ | ||
'uniform float size;', | ||
@@ -44,2 +45,3 @@ 'uniform float cutoff;', | ||
'uniform vec4 clearColor;', | ||
'uniform float fogDensity;', | ||
'in vec3 vColor;', | ||
@@ -58,8 +60,7 @@ 'in float vDiscard;', | ||
'alpha = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r);', | ||
'float fogIntensity = (gl_FragCoord.z / gl_FragCoord.w);', | ||
'fogIntensity = fogIntensity + fogIntensity * 2.0;', | ||
'fogIntensity *= clearColor.w;', | ||
'float z = gl_FragCoord.z / gl_FragCoord.w;', | ||
'float fog_factor = clamp(exp2(-fogDensity * fogDensity * z * z * 1.442695), 0.025, 1.0);',, | ||
'// fragColor = vec4(vec3(gl_FragDepth) * fog, 1.0);', | ||
'fragColor = mix(vec4(vColor, 1.0), clearColor, fogIntensity) * alpha;', | ||
'fragColor = mix(clearColor, vec4(vColor, 1.0), fog_factor);', | ||
'}' | ||
]); |
@@ -6,3 +6,4 @@ const Shader = require('../Core/Shader') | ||
cutoff: new Uniform('cutoff', 0.0, 'float'), | ||
clearColor: new Uniform('clearColor', [1.0, 1.0, 1.0, 1.0], 'float_vec4') }, [ | ||
clearColor: new Uniform('clearColor', [1.0, 1.0, 1.0, 1.0], 'float_vec4'), | ||
fogDensity: new Uniform('fogDensity', 6.0, 'float') }, [ | ||
'uniform float size;', | ||
@@ -44,2 +45,3 @@ 'uniform float cutoff;', | ||
'uniform vec4 clearColor;', | ||
'uniform float fogDensity;', | ||
'varying vec3 vColor;', | ||
@@ -63,8 +65,7 @@ 'varying float vDiscard;', | ||
'// specular += 0.1 * rand(gl_PointCoord);', | ||
'float fogIntensity = (gl_FragCoord.z / gl_FragCoord.w);', | ||
'fogIntensity = fogIntensity + fogIntensity * 2.0;', | ||
'fogIntensity *= clearColor.w;', | ||
'float z = gl_FragCoord.z / gl_FragCoord.w;', | ||
'float fog_factor = clamp(exp2(-fogDensity * fogDensity * z * z * 1.442695), 0.025, 1.0);', | ||
'vec3 color = vColor * diffuse + specular * 0.5;', | ||
'gl_FragColor = mix(vec4(color, 1.0), clearColor, fogIntensity);', | ||
'gl_FragColor = mix(clearColor, vec4(color, 1.0), fog_factor);', | ||
'}' | ||
]); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44200875
32317
128