engine icon indicating copy to clipboard operation
engine copied to clipboard

Add loader options(Texture, Mesh)

Open gz65555 opened this issue 2 years ago • 1 comments

Please check if the PR fulfills these requirements

  • [x] 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, ...)

Add options for load Texture2D:

  • width
  • height
  • format
  • mipmap

Usage

engine.resourceManager.load<Texture2D>({
  url: '...',
  type: AssetType.Texture2D,
  width: 24,
  height: 24,
  format: ...,
  mipmap: false
})

But additional options can't be inferred by typescript.

gz65555 avatar Jul 26 '22 04:07 gz65555

now I have to read mesh data back from GPU to assemble texture, this method will cause GLContext lost

yangfengzzz avatar Sep 08 '22 08:09 yangfengzzz

Codecov Report

Base: 29.60% // Head: 36.50% // Increases project coverage by +6.89% :tada:

Coverage data is based on head (92eb1b8) compared to base (71eb8cb). Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           dev/0.9     #890      +/-   ##
===========================================
+ Coverage    29.60%   36.50%   +6.89%     
===========================================
  Files          329      333       +4     
  Lines        14650    14826     +176     
  Branches      2235     2278      +43     
===========================================
+ Hits          4337     5412    +1075     
+ Misses        9801     8811     -990     
- Partials       512      603      +91     
Impacted Files Coverage Δ
packages/loader/src/GLTFLoader.ts 11.11% <0.00%> (-1.39%) :arrow_down:
packages/loader/src/Texture2DLoader.ts 6.25% <0.00%> (-1.45%) :arrow_down:
packages/loader/src/gltf/GLTFResource.ts 0.00% <ø> (ø)
packages/loader/src/gltf/parser/MeshParser.ts 0.80% <0.00%> (-0.01%) :arrow_down:
packages/core/src/sky/Sky.ts 3.12% <0.00%> (-96.88%) :arrow_down:
...kages/core/src/RenderPipeline/SpriteMaskElement.ts 14.28% <0.00%> (-10.72%) :arrow_down:
packages/core/src/RenderPipeline/SpriteElement.ts 10.00% <0.00%> (-10.00%) :arrow_down:
...s/core/src/animation/internal/AnimatorTempValue.ts 20.00% <0.00%> (-5.00%) :arrow_down:
packages/core/src/2d/sprite/SpriteRenderer.ts 21.18% <0.00%> (-0.94%) :arrow_down:
packages/core/src/material/BaseMaterial.ts 70.23% <0.00%> (-0.46%) :arrow_down:
... and 75 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Sep 23 '22 06:09 codecov-commenter