Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ktx2 loader #1625

Merged
merged 18 commits into from
Jul 14, 2023
Merged

Support ktx2 loader #1625

merged 18 commits into from
Jul 14, 2023

Conversation

gz65555
Copy link
Collaborator

@gz65555 gz65555 commented Jun 28, 2023

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Support ktx2 loader

Usage

Basic

engine.resourceManager('skybox.ktx2').then(...);
engine.resourceManager('duck.ktx2').then(...);

Init Transcode WebWorker

KTX2Loader.init(...);

Destroy Transcode WebWorker

KTX2Loader.destroy();

Specify Format Priority(Advanced)

engine.resourceManager({
...,
formatPriorities: [KTX2TargetFormat.RGBA32]
}).then(...);

@gz65555 gz65555 requested a review from GuoLei1990 June 28, 2023 01:58
@GuoLei1990 GuoLei1990 added the enhancement New feature or request label Jul 3, 2023
@GuoLei1990 GuoLei1990 added the resource Resource-related functions label Jul 10, 2023
@GuoLei1990
Copy link
Member

BinomialLLCTranscoder and KhronosTranscoder folder name should be lowercase

packages/loader/src/ktx2/WorkerPool.ts Show resolved Hide resolved
packages/loader/src/ktx2/WorkerPool.ts Outdated Show resolved Hide resolved
packages/loader/src/ktx2/WorkerPool.ts Outdated Show resolved Hide resolved
[KTX2TargetFormat.ETC]: [GLCapabilityType.etc],
[KTX2TargetFormat.DXT]: [GLCapabilityType.s3tc],
[KTX2TargetFormat.PVRTC]: [GLCapabilityType.pvrtc, GLCapabilityType.pvrtc_webkit]
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canIUse should improve

packages/loader/src/ktx2/KTX2Loader.ts Outdated Show resolved Hide resolved
packages/loader/src/ktx2/KTX2Loader.ts Outdated Show resolved Hide resolved
packages/loader/src/ktx2/KTX2Loader.ts Outdated Show resolved Hide resolved
packages/loader/src/ktx2/KTX2Loader.ts Show resolved Hide resolved
packages/loader/src/ktx2/KTX2Loader.ts Outdated Show resolved Hide resolved
const formatPriorities = item.params?.formatPriorities;
const targetFormat = KTX2Loader._detectTranscoder(resourceManager.engine, ktx2Container, formatPriorities);
let transcodeResultPromise: Promise<any>;
if (targetFormat === KTX2TargetFormat.ASTC && ktx2Container.isUASTC) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R8 RG8 RGBA8 should use KhronosTranscoder too!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait engine support

packages/loader/src/ktx2/KTX2Loader.ts Outdated Show resolved Hide resolved
packages/loader/src/ktx2/KTX2Loader.ts Outdated Show resolved Hide resolved
@GuoLei1990 GuoLei1990 added this to the 1.1 milestone Jul 14, 2023
@GuoLei1990 GuoLei1990 merged commit 5ff9f8e into galacean:dev/1.1 Jul 14, 2023
5 checks passed
GuoLei1990 added a commit to Sway007/engine that referenced this pull request Jul 16, 2023
* dev/1.1:
  Support ktx2 loader (galacean#1625)
  feat: add texture plugin to support ktx loader (galacean#1640)
  Fix blend shape bug due to buffer index errors (galacean#1632)
  Model Mesh supports two-way data synchronization (galacean#1588)
@GuoLei1990 GuoLei1990 linked an issue Jul 17, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resource Resource-related functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ktx2 with basis univeral
2 participants