-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(core): Move out deepEqual, getShaderInfo (#2005)
- Loading branch information
Showing
18 changed files
with
77 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// luma.gl | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) vis.gl contributors | ||
|
||
const uidCounters: Record<string, number> = {}; | ||
|
||
/** | ||
* Returns a UID. | ||
* @param id= - Identifier base name | ||
* @return uid | ||
**/ | ||
export function uid(id: string = 'id'): string { | ||
uidCounters[id] = uidCounters[id] || 1; | ||
const count = uidCounters[id]++; | ||
return `${id}-${count}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
// general utils | ||
import './lib/utils/array-utils-flat.spec'; | ||
import './lib/utils/utils.spec'; | ||
import './lib/utils/deep-equal.spec'; | ||
import './lib/utils/uniform.spec'; | ||
import './lib/utils/uid.spec'; | ||
|
||
// type utils | ||
import './adapter/attribute-utils/get-attribute-from-layout.spec'; | ||
|
||
import './adapter/type-utils/decode-attribute-type.spec'; | ||
|
||
import './adapter/type-utils/decode-vertex-format.spec'; | ||
import './adapter/type-utils/decode-texture-format.spec'; | ||
import './adapter/type-utils/vertex-format-from-attribute.spec'; | ||
|
||
// adapter | ||
import './adapter/attribute-utils/get-attribute-from-layout.spec'; | ||
import './adapter/canvas-context.spec'; | ||
|
||
// uniforms | ||
import './lib/uniforms/uniform-buffer-layout.spec'; | ||
import './lib/uniforms/uniform.spec'; | ||
|
||
// compiler logs | ||
import './lib/compiler-log/format-compiler-log.spec'; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...es/core/test/lib/utils/deep-equal.spec.ts → modules/engine/test/utils/deep-equal.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// luma.gl | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) vis.gl contributors | ||
|
||
/** | ||
* Load a script (identified by an url). When the url returns, the | ||
* content of this file is added into a new script element, attached to the DOM (body element) | ||
* @param scriptUrl defines the url of the script to laod | ||
* @param scriptId defines the id of the script element | ||
*/ | ||
export async function loadScript(scriptUrl: string, scriptId?: string): Promise<Event> { | ||
const head = document.getElementsByTagName('head')[0]; | ||
if (!head) { | ||
throw new Error('loadScript'); | ||
} | ||
|
||
const script = document.createElement('script'); | ||
script.setAttribute('type', 'text/javascript'); | ||
script.setAttribute('src', scriptUrl); | ||
if (scriptId) { | ||
script.id = scriptId; | ||
} | ||
|
||
return new Promise((resolve, reject) => { | ||
script.onload = resolve; | ||
script.onerror = error => | ||
reject(new Error(`Unable to load script '${scriptUrl}': ${error as string}`)); | ||
head.appendChild(script); | ||
}); | ||
} |