@luma.gl/engine
Advanced tools
Comparing version 9.0.0-beta.1 to 9.0.0-beta.2
@@ -22,7 +22,6 @@ import type { RenderPipelineProps } from '@luma.gl/core'; | ||
release(pipeline: RenderPipeline): void; | ||
_createRenderPipeline(props: PipelineFactoryProps): RenderPipeline; | ||
/** Calculate a hash based on all the inputs for a render pipeline */ | ||
_hashRenderPipeline(props: PipelineFactoryProps): string; | ||
_getHash(key: string): number; | ||
private _hashRenderPipeline; | ||
private _getHash; | ||
} | ||
//# sourceMappingURL=pipeline-factory.d.ts.map |
@@ -51,19 +51,2 @@ import { RenderPipeline } from '@luma.gl/core'; | ||
} | ||
_createRenderPipeline(props) { | ||
if (!props.fs) { | ||
throw new Error('fs'); | ||
} | ||
const pipeline = this.device.createRenderPipeline({ | ||
...props, | ||
vs: this.device.createShader({ | ||
stage: 'vertex', | ||
source: props.vs | ||
}), | ||
fs: props.fs ? this.device.createShader({ | ||
stage: 'fragment', | ||
source: props.fs | ||
}) : null | ||
}); | ||
return pipeline; | ||
} | ||
_hashRenderPipeline(props) { | ||
@@ -70,0 +53,0 @@ const vsHash = this._getHash(props.vs); |
@@ -144,2 +144,6 @@ import { Buffer, RenderPipeline, UniformStore, getTypedArrayFromDataType } from '@luma.gl/core'; | ||
this.pipeline.setUniforms(this.uniforms); | ||
const { | ||
indexBuffer | ||
} = this.vertexArray; | ||
const indexCount = indexBuffer ? indexBuffer.byteLength / (indexBuffer.indexType === 'uint32' ? 4 : 2) : undefined; | ||
this.pipeline.draw({ | ||
@@ -150,2 +154,3 @@ renderPass, | ||
instanceCount: this.instanceCount, | ||
indexCount, | ||
transformFeedback: this.transformFeedback | ||
@@ -161,3 +166,3 @@ }); | ||
this.setTopology(gpuGeometry.topology || 'triangle-list'); | ||
this.bufferLayout = mergeBufferLayouts(this.bufferLayout, gpuGeometry.bufferLayout); | ||
this.bufferLayout = mergeBufferLayouts(gpuGeometry.bufferLayout, this.bufferLayout); | ||
if (this.vertexArray) { | ||
@@ -164,0 +169,0 @@ this._setGeometryAttributes(gpuGeometry); |
{ | ||
"name": "@luma.gl/engine", | ||
"version": "9.0.0-beta.1", | ||
"version": "9.0.0-beta.2", | ||
"description": "WebGL2 Components for High Performance Rendering and Computation", | ||
@@ -43,5 +43,5 @@ "type": "module", | ||
"@babel/runtime": "^7.0.0", | ||
"@luma.gl/constants": "9.0.0-beta.1", | ||
"@luma.gl/core": "9.0.0-beta.1", | ||
"@luma.gl/shadertools": "9.0.0-beta.1", | ||
"@luma.gl/constants": "9.0.0-beta.2", | ||
"@luma.gl/core": "9.0.0-beta.2", | ||
"@luma.gl/shadertools": "9.0.0-beta.2", | ||
"@math.gl/core": "^4.0.0", | ||
@@ -51,3 +51,3 @@ "@probe.gl/log": "^4.0.2", | ||
}, | ||
"gitHead": "5fb42f651e80825336a372ca5a66de7d55611ddf" | ||
"gitHead": "d90ddd6231c3d405d88dfb9e8c232c4dfefcc056" | ||
} |
@@ -32,1 +32,17 @@ // import type {Geometry} from './geometry'; | ||
} | ||
// export function calculateVertexNormals(positions: Float32Array): Uint8Array { | ||
// let normals = new Uint8Array(positions.length / 3); | ||
// for (let i = 0; i < positions.length; i++) { | ||
// const vec1 = new Vector3(positions.subarray(i * 3, i + 0, i + 3)); | ||
// const vec2 = new Vector3(positions.subarray(i + 3, i + 6)); | ||
// const vec3 = new Vector3(positions.subarray(i + 6, i + 9)); | ||
// const normal = new Vector3(vec1).cross(vec2).normalize(); | ||
// normals.set(normal[0], i + 4); | ||
// normals.set(normal[1], i + 4 + 1); | ||
// normals.set(normal[2], i + 2); | ||
// } | ||
// const normal = new Vector3(vec1).cross(vec2).normalize(); | ||
// } |
@@ -12,3 +12,3 @@ // luma.gl, MIT license | ||
/** | ||
/** | ||
* Efficiently creates / caches pipelines | ||
@@ -21,3 +21,3 @@ */ | ||
fs: undefined! | ||
} | ||
}; | ||
@@ -32,3 +32,4 @@ readonly device: Device; | ||
static getDefaultPipelineFactory(device: Device): PipelineFactory { | ||
device._lumaData.defaultPipelineFactory = device._lumaData.defaultPipelineFactory || new PipelineFactory(device); | ||
device._lumaData.defaultPipelineFactory = | ||
device._lumaData.defaultPipelineFactory || new PipelineFactory(device); | ||
return device._lumaData.defaultPipelineFactory as PipelineFactory; | ||
@@ -50,3 +51,3 @@ } | ||
vs: this.device.createShader({stage: 'vertex', source: props.vs}), | ||
fs: props.fs ? this.device.createShader({stage: 'fragment', source: props.fs}) : null, | ||
fs: props.fs ? this.device.createShader({stage: 'fragment', source: props.fs}) : null | ||
}); | ||
@@ -76,18 +77,4 @@ | ||
_createRenderPipeline(props: PipelineFactoryProps): RenderPipeline { | ||
if (!props.fs) { | ||
throw new Error('fs'); | ||
} | ||
const pipeline = this.device.createRenderPipeline({ | ||
...props, | ||
vs: this.device.createShader({stage: 'vertex', source: props.vs}), | ||
fs: props.fs ? this.device.createShader({stage: 'fragment', source: props.fs}) : null, | ||
}); | ||
return pipeline; | ||
} | ||
/** Calculate a hash based on all the inputs for a render pipeline */ | ||
_hashRenderPipeline(props: PipelineFactoryProps): string { | ||
private _hashRenderPipeline(props: PipelineFactoryProps): string { | ||
const vsHash = this._getHash(props.vs); | ||
@@ -115,3 +102,3 @@ const fsHash = props.fs ? this._getHash(props.fs) : 0; | ||
_getHash(key: string): number { | ||
private _getHash(key: string): number { | ||
if (this._hashes[key] === undefined) { | ||
@@ -123,2 +110,1 @@ this._hashes[key] = this._hashCounter++; | ||
} | ||
@@ -195,4 +195,7 @@ // luma.gl, MIT license | ||
const platformInfo = getPlatformInfo(device); | ||
// Extract modules from shader inputs if not supplied | ||
const modules = | ||
(this.props.modules?.length > 0 ? this.props.modules : this.shaderInputs?.getModules()) || []; | ||
const {vs, fs, getUniforms} = this.props.shaderAssembler.assembleShaders({ | ||
@@ -304,2 +307,5 @@ platformInfo, | ||
const {indexBuffer} = this.vertexArray; | ||
const indexCount = indexBuffer ? indexBuffer.byteLength / (indexBuffer.indexType === 'uint32' ? 4 : 2) : undefined; | ||
this.pipeline.draw({ | ||
@@ -310,2 +316,3 @@ renderPass, | ||
instanceCount: this.instanceCount, | ||
indexCount, | ||
transformFeedback: this.transformFeedback | ||
@@ -329,3 +336,3 @@ }); | ||
this.setTopology(gpuGeometry.topology || 'triangle-list'); | ||
this.bufferLayout = mergeBufferLayouts(this.bufferLayout, gpuGeometry.bufferLayout); | ||
this.bufferLayout = mergeBufferLayouts(gpuGeometry.bufferLayout, this.bufferLayout); | ||
if (this.vertexArray) { | ||
@@ -332,0 +339,0 @@ this._setGeometryAttributes(gpuGeometry); |
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
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
1227273
21538
+ Added@luma.gl/constants@9.0.0-beta.2(transitive)
+ Added@luma.gl/core@9.0.0-beta.2(transitive)
+ Added@luma.gl/shadertools@9.0.0-beta.2(transitive)
- Removed@luma.gl/constants@9.0.0-beta.1(transitive)
- Removed@luma.gl/core@9.0.0-beta.1(transitive)
- Removed@luma.gl/shadertools@9.0.0-beta.1(transitive)
Updated@luma.gl/core@9.0.0-beta.2