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

Fix background texture render abnormal #1784

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

cptbtptpbcptdtptp
Copy link
Collaborator

When setting textureFillMode to fill first and then setting texutre, the background texture will render abnormally because the position of the mesh is not updated.

import {
  AssetType,
  BackgroundMode,
  BackgroundTextureFillMode,
  Camera,
  Texture2D,
  WebGLEngine,
} from "@galacean/engine";

WebGLEngine.create({ canvas: "canvas" }).then((engine) => {
  const scene = engine.sceneManager.activeScene;
  const { background } = scene;
  const root = scene.createRootEntity();
  const cameraEntity = root.createChild();
  cameraEntity.addComponent(Camera);
  engine.canvas.width = 480;
  engine.canvas.height = 360;

  engine.resourceManager
    .load<Texture2D>({
      url: "https://mdn.alipayobjects.com/huamei_jvf0dp/afts/img/A*nvhjTrdxAKEAAAAAAAAAAAAADleLAQ/original",
      type: AssetType.Texture2D,
    })
    .then((texture: Texture2D) => {
      background.mode = BackgroundMode.Texture;
      background.texture = texture;
      background.textureFillMode = BackgroundTextureFillMode.Fill;
    });

  engine.run();
});

@cptbtptpbcptdtptp cptbtptpbcptdtptp self-assigned this Sep 20, 2023
@cptbtptpbcptdtptp cptbtptpbcptdtptp added the bug Something isn't working label Sep 20, 2023
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage: 87.50% and project coverage change: +0.14% 🎉

Comparison is base (129e06e) 65.08% compared to head (f1245f7) 65.22%.
Report is 1 commits behind head on main.

❗ Current head f1245f7 differs from pull request most recent head e40908d. Consider uploading reports for the commit e40908d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1784      +/-   ##
==========================================
+ Coverage   65.08%   65.22%   +0.14%     
==========================================
  Files         473      473              
  Lines       23641    23641              
  Branches     3362     3362              
==========================================
+ Hits        15386    15420      +34     
+ Misses       7049     7021      -28     
+ Partials     1206     1200       -6     
Files Changed Coverage Δ
packages/core/src/Background.ts 77.63% <87.50%> (+18.42%) ⬆️

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GuoLei1990 GuoLei1990 merged commit 16f8f2c into galacean:main Sep 21, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants