@luma.gl/shadertools
Advanced tools
Comparing version 9.0.0-beta.1 to 9.0.0-beta.2
@@ -59,3 +59,2 @@ import { glsl } from "../glsl-utils/highlight.js"; | ||
modules, | ||
defines = {}, | ||
hookFunctions = [], | ||
@@ -67,7 +66,2 @@ inject = {}, | ||
const coreSource = source; | ||
const allDefines = {}; | ||
modules.forEach(module => { | ||
Object.assign(allDefines, module.getDefines()); | ||
}); | ||
Object.assign(allDefines, defines); | ||
let assembledSource = ''; | ||
@@ -100,3 +94,4 @@ const hookFunctionMap = normalizeShaderHooks(hookFunctions); | ||
} | ||
for (const module of modules) { | ||
const modulesToInject = platformInfo.type !== 'webgpu' ? modules : []; | ||
for (const module of modulesToInject) { | ||
if (log) { | ||
@@ -103,0 +98,0 @@ module.checkDeprecations(coreSource, log); |
@@ -7,2 +7,4 @@ import type { NumberArray } from '@math.gl/types'; | ||
export type DirlightUniforms = DirlightProps; | ||
export declare const VS_WGSL = " \nvoid dirlight_setNormal(normal: vec3<f32>) {\n dirlight_vNormal = normalize(normal);\n}\n"; | ||
export declare const FS_WGSL = "uniform dirlightUniforms {\n vec3 lightDirection;\n} dirlight;\n\n// Returns color attenuated by angle from light source\nfn dirlight_filterColor(color: vec4<f32>, dirlightInputs): vec4<f32> {\n const d: float = abs(dot(dirlight_vNormal, normalize(dirlight.lightDirection)));\n return vec4<f32>(color.rgb * d, color.a);\n}\n"; | ||
/** | ||
@@ -9,0 +11,0 @@ * Cheap lighting - single directional light, single dot product, one uniform |
import { glsl } from "../../../lib/glsl-utils/highlight.js"; | ||
const vs = glsl`\ | ||
export const VS_WGSL = `\ | ||
void dirlight_setNormal(normal: vec3<f32>) { | ||
dirlight_vNormal = normalize(normal); | ||
} | ||
`; | ||
export const FS_WGSL = `\ | ||
uniform dirlightUniforms { | ||
vec3 lightDirection; | ||
} dirlight; | ||
// Returns color attenuated by angle from light source | ||
fn dirlight_filterColor(color: vec4<f32>, dirlightInputs): vec4<f32> { | ||
const d: float = abs(dot(dirlight_vNormal, normalize(dirlight.lightDirection))); | ||
return vec4<f32>(color.rgb * d, color.a); | ||
} | ||
`; | ||
const VS_GLSL = glsl`\ | ||
out vec3 dirlight_vNormal; | ||
@@ -9,3 +25,3 @@ | ||
`; | ||
const fs = glsl`\ | ||
const FS_GLSL = glsl`\ | ||
uniform dirlightUniforms { | ||
@@ -26,4 +42,4 @@ vec3 lightDirection; | ||
dependencies: [], | ||
vs, | ||
fs, | ||
vs: VS_GLSL, | ||
fs: FS_GLSL, | ||
uniformTypes: { | ||
@@ -30,0 +46,0 @@ lightDirection: 'vec3<f32>' |
{ | ||
"name": "@luma.gl/shadertools", | ||
"version": "9.0.0-beta.1", | ||
"version": "9.0.0-beta.2", | ||
"description": "Shader module system for luma.gl", | ||
@@ -49,7 +49,7 @@ "type": "module", | ||
"@babel/runtime": "^7.0.0", | ||
"@luma.gl/core": "9.0.0-beta.1", | ||
"@luma.gl/core": "9.0.0-beta.2", | ||
"@math.gl/core": "^4.0.0", | ||
"@math.gl/types": "^4.0.0" | ||
}, | ||
"gitHead": "5fb42f651e80825336a372ca5a66de7d55611ddf" | ||
"gitHead": "d90ddd6231c3d405d88dfb9e8c232c4dfefcc056" | ||
} |
@@ -125,3 +125,3 @@ // luma.gl, MIT license | ||
modules, | ||
defines = {}, | ||
// defines = {}, | ||
hookFunctions = [], | ||
@@ -140,7 +140,7 @@ inject = {}, | ||
// Combine Module and Application Defines | ||
const allDefines = {}; | ||
modules.forEach(module => { | ||
Object.assign(allDefines, module.getDefines()); | ||
}); | ||
Object.assign(allDefines, defines); | ||
// const allDefines = {}; | ||
// modules.forEach(module => { | ||
// Object.assign(allDefines, module.getDefines()); | ||
// }); | ||
// Object.assign(allDefines, defines); | ||
@@ -191,3 +191,6 @@ // Add platform defines (use these to work around platform-specific bugs and limitations) | ||
for (const module of modules) { | ||
// TODO - hack until shadertool modules support WebGPU | ||
const modulesToInject = platformInfo.type !== 'webgpu' ? modules : []; | ||
for (const module of modulesToInject) { | ||
if (log) { | ||
@@ -194,0 +197,0 @@ module.checkDeprecations(coreSource, log); |
@@ -14,3 +14,23 @@ // luma.gl, MIT license | ||
const vs = glsl`\ | ||
// TODO | ||
export const VS_WGSL = /* WGSL */`\ | ||
void dirlight_setNormal(normal: vec3<f32>) { | ||
dirlight_vNormal = normalize(normal); | ||
} | ||
`; | ||
// TODO | ||
export const FS_WGSL = /* WGSL */`\ | ||
uniform dirlightUniforms { | ||
vec3 lightDirection; | ||
} dirlight; | ||
// Returns color attenuated by angle from light source | ||
fn dirlight_filterColor(color: vec4<f32>, dirlightInputs): vec4<f32> { | ||
const d: float = abs(dot(dirlight_vNormal, normalize(dirlight.lightDirection))); | ||
return vec4<f32>(color.rgb * d, color.a); | ||
} | ||
`; | ||
const VS_GLSL = glsl`\ | ||
out vec3 dirlight_vNormal; | ||
@@ -23,3 +43,3 @@ | ||
const fs = glsl`\ | ||
const FS_GLSL = glsl`\ | ||
uniform dirlightUniforms { | ||
@@ -44,4 +64,12 @@ vec3 lightDirection; | ||
dependencies: [], | ||
vs, | ||
fs, | ||
vs: VS_GLSL, | ||
fs: FS_GLSL, | ||
// vs: {glsl: VS_GLSL, wgsl: VS_WGSL}, | ||
// fs: {glsl: FS_GLSL, wgsl: FS_WGSL}, | ||
// fragmentInputs: [ | ||
// { | ||
// name: 'dirlight_vNormal', | ||
// type: 'vec3<f32>' | ||
// } | ||
// ], | ||
uniformTypes: { | ||
@@ -48,0 +76,0 @@ lightDirection: 'vec3<f32>' |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
2422540
410
46038
3
+ Added@luma.gl/core@9.0.0-beta.2(transitive)
- Removed@luma.gl/core@9.0.0-beta.1(transitive)
Updated@luma.gl/core@9.0.0-beta.2