Skip to content

Commit

Permalink
fix: render sprite incorrectly caused by diff algorithm when config r…
Browse files Browse the repository at this point in the history
…eusable
  • Loading branch information
RGCHN committed Dec 17, 2023
1 parent 86e0bce commit fe87365
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
24 changes: 10 additions & 14 deletions packages/effects-core/src/plugins/sprite/sprite-mesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,20 @@ export class SpriteMesh {
const uSizeStart = start + 4;
const uQuatStart = start + 8;
const uColorStart = start + 12;

if (!selfData.visible && !init) {
mainDataArray[uSizeStart + 2] = -1;

return;
}

const uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];

// if (selfData.startSize) {
// selfData.transform.scaleBy(1 / selfData.startSize[0], 1 / selfData.startSize[1], 1);
// }

const tempPos = new Vector3();
const tempQuat = new Quaternion();
const tempScale = new Vector3();
const uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];

selfData.transform.assignWorldTRS(tempPos, tempQuat, tempScale);
if (selfData.visible) {
selfData.transform.assignWorldTRS(tempPos, tempQuat, tempScale);
} else {
if (!init) {
mainDataArray[uSizeStart + 2] = -1;

return;
}
}

const uPos = [...tempPos.toArray(), 0];
const uSize = [...tempScale.toArray(), 0];
Expand Down
3 changes: 1 addition & 2 deletions web-packages/demo/src/single.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import '@galacean/effects-plugin-spine';
import '@galacean/effects-plugin-model';
import inspireList from './assets/inspire-list';

const json = inspireList.preComp.url;
const json = 'https://mdn.alipayobjects.com/mars/afts/file/A*3mT3SJ4KGKYAAAAAAAAAAAAADlB4AQ';
const container = document.getElementById('J-container');

(async () => {
try {
const player = createPlayer();

const comp = await player.loadScene(json);
} catch (e) {
console.error('biz', e);
}
Expand Down

0 comments on commit fe87365

Please sign in to comment.