-
-
Notifications
You must be signed in to change notification settings - Fork 303
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
Use char cache mode for TextRenderer #837
Conversation
@@ -438,30 +424,34 @@ export class TextRenderer extends Renderer { | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text maybe don't need mask. SpriteMask with TextRenderer is a litte strange.
|
||
return charInfo; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CharAssembler do not have design value now, because you only have one mode of char now!
maxY < maxPos.y && (maxY = maxPos.y); | ||
} | ||
min.set(minX, minY, 0); | ||
max.set(maxX, maxY, 0); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two waste! You should cache a localBounds when compute localPositions in CharAssembler.updateData(renderer: TextRenderer): void
,
and then just call BoundingBox.transform(localBounds, worldMatrix, worldBounds);
when transfom modify.
Another thing is you can optimization compoute localBounds logic, use the first and end line's left/right。Don't for in
!
for (let i = 0, n = _charRenderDatas.length; i < n; ++i) { | ||
const { localPositions, renderData } = _charRenderDatas[i]; | ||
for (let j = 0; j < 4; ++j) { | ||
Vector3.transformToVec3(localPositions[j], worldMatrix, renderData.positions[j]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (this._transformChangeFlag.flag || isFontDirty || isRenderDirty) { | ||
isFontDirty && this._resetCharFont(); | ||
isRenderDirty && this._updateData(); | ||
this._updatePosition(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe don't need any more
); | ||
this._charFont._addRefCount(1); | ||
} | ||
|
||
private _updatePosition(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_updatePosition ()
->_updateWorldPosition()
is better to express function purpose
* dev/0.8: (28 commits) v0.8.0-alpha.3 v0.8.0-alpha.2 Use char cache mode for TextRenderer (galacean#837) Add basic physics joint component include `FixedJoint`, `SpringJoint`, `HingeJoint` (galacean#853) `InputManager` support pointer button and wheel (galacean#831) fix: TextureCube is left-hand,so x need inverse (galacean#855) Add SpriteRenderer drawMode property(support simple and sliced) (galacean#828) v0.8.0-alpha.1 v0.8.0-alpha.0 Feat(core): add more clear flag item for Camera.clearFlags (galacean#843) Fix transform`translate` and `rotate` space bug (galacean#847) Refactor `cloneTo` to `copyFrom` for math library and rename `setValue` to `set` (galacean#844) optimization camera code (galacean#830) feat: physics character controller (galacean#818) v0.7.0-beta.7 refactor: rename (galacean#827) Merge latest main (galacean#820) fix: change `region` and `pivot` origin to left-bottom (galacean#809) Fix SkyBox render mirror problem (galacean#816) feat: add `priority` for renderer to order(galacean#803) ... # Conflicts: # lerna.json # packages/core/package.json # packages/core/src/2d/dynamic-atlas/DynamicTextAtlas.ts # packages/core/src/2d/sprite/Sprite.ts # packages/core/src/2d/sprite/SpriteMask.ts # packages/core/src/2d/sprite/SpriteRenderer.ts # packages/core/src/2d/text/TextRenderer.ts # packages/core/src/Renderer.ts # packages/core/src/Transform.ts # packages/core/src/physics/index.ts # packages/design/package.json # packages/design/src/physics/IPhysics.ts # packages/draco/package.json # packages/loader/package.json # packages/loader/src/SpriteAtlasLoader.ts # packages/math/package.json # packages/math/src/CollisionUtil.ts # packages/math/src/Vector2.ts # packages/math/src/Vector3.ts # packages/math/src/Vector4.ts # packages/oasis-engine/package.json # packages/physics-lite/package.json # packages/physics-lite/src/LitePhysics.ts # packages/physics-physx/package.json # packages/physics-physx/src/PhysXPhysics.ts # packages/resource-process/package.json # packages/resource-process/tsconfig.json # packages/rhi-webgl/package.json # tests/package.json
* Test: Use Floss and Chai to Replace Jest (#778) test: Use Floss and Chai to Replace Jest * refactor: remove toolkit features (#780) * v0.7.0-beta.4 (#795) * Fix:local translate (#706) * fix(transform):local translate * Add component denpendent decorator (#796) * feat: add `dependentComponents` decorator * ci: remove ci on node 12 (#801) * Update README.md * Fix Test Version Error (#802) * ci: remove ci on node 12 * test: fix version * feat: add `priority` for renderer to order(#803) * feat(renderer): add `priority` for renderer to order * Fix SkyBox render mirror problem (#816) * refactor: fix skybox mirror problem * fix: change `region` and `pivot` origin to left-bottom (#809) * fix: change `region` and `pivot` origin to left-bottom * Merge latest main (#820) * v0.7.0-beta.4 * Update README.md * Update README.md * Update README.md * Add component denpendent decorator (#796) (#807) * feat: add `dependentComponents` decorator * fix(Renderer): destroy crash when material is null (#808) * Improve BlendShape when use attribute mode (#804) * feat: improve BlendShape when use attribute mode * v0.7.0-beta.5 * refactor: fix skybox mirror problem * fix: fixed the bug of animator revert when blendWeight length exceeds 4 (#817) * fix: fixed the bug of animator revert when blendWeight length exceeds 4 * v0.7.0-beta.6 * refactor: fix shader * fix(text): fix horizontal and vertical alignment error (#772) * fix(text): fix horizontal alignment error Co-authored-by: luzhuang <[email protected]> Co-authored-by: singlecoder <[email protected]> * refactor: rename (#827) * v0.7.0-beta.7 * feat: physics character controller (#818) * feat: add `CharacterController` for physX backend * optimization camera code (#830) refactor: optimization camera code * Refactor `cloneTo` to `copyFrom` for math library and rename `setValue` to `set` (#844) * feat: refactor `cloneTo` to `copyFrom` for math library * feat: rename `setValue` to `set` for math library * Fix transform`translate` and `rotate` space bug (#847) * fix: transform`translate` and `rotate` space bug * refactor: opt comments * Feat(core): add more clear flag item for Camera.clearFlags (#843) * feat(core): add more clear flag item for Camera.clearFlags * v0.8.0-alpha.0 * v0.8.0-alpha.1 * Add SpriteRenderer drawMode property(support simple and sliced) (#828) * feat: add sprite draw mode(support simple and sliced) * fix: TextureCube is left-hand,so x need inverse (#855) * `InputManager` support pointer button and wheel (#831) * feat: `InputManager` support pointer button and wheel * Add basic physics joint component include `FixedJoint`, `SpringJoint`, `HingeJoint` (#853) * feat: basic physics joint * Use char cache mode for TextRenderer (#837) * feat(text): use char cache mode for TextRenderer * v0.8.0-alpha.2 * v0.8.0-alpha.3 * fix: resolve conflict * fix: resolve conflict Co-authored-by: Hu Song <[email protected]> Co-authored-by: AZhan <[email protected]> Co-authored-by: singlecoder <[email protected]> Co-authored-by: luzhuang <[email protected]> Co-authored-by: zhuxudong <[email protected]> Co-authored-by: yangfengzzz <[email protected]>
* fix: use string replace asset type to extend easily * fix: onEndRender trigger error * fix: remove ms blob deprecated * build: update typescript version * feat: update background mesh * refactor: add gc ignore * build: physics use oasis-engine dependency * bump version * bump version * feat: add register and reflection object * feat: add prefab parser * fix: resourceManager has't destory all cache * fix: cache promise is not clear * bump version * feat: export prefabloader * fix: dynamic explansion * feat: add mipmap generate warn * feat: add mipmap true * feat: add pixel buffer * feat: update engine version * feat: add type watch * feat: init all project * build: remove init oasis * refactor: use modelmesh encode buffer * Test: Use Floss and Chai to Replace Jest (#778) test: Use Floss and Chai to Replace Jest * refactor: remove console * refactor: add math serialize * refactor: add model mesh serialize * refactor: add scene loader * refactor: delete schema parser * refactor: add scene loader * refactor: add index * refactor: remove toolkit features (#780) * v0.7.0-beta.4 (#795) * refactor: fix types error * Fix:local translate (#706) * fix(transform):local translate * Add component denpendent decorator (#796) * feat: add `dependentComponents` decorator * ci: remove ci on node 12 (#801) * Update README.md * Fix Test Version Error (#802) * ci: remove ci on node 12 * test: fix version * feat: add `priority` for renderer to order(#803) * feat(renderer): add `priority` for renderer to order * refactor: remove useless import * Fix SkyBox render mirror problem (#816) * refactor: fix skybox mirror problem * fix: change `region` and `pivot` origin to left-bottom (#809) * fix: change `region` and `pivot` origin to left-bottom * Merge latest main (#820) * v0.7.0-beta.4 * Update README.md * Update README.md * Update README.md * Add component denpendent decorator (#796) (#807) * feat: add `dependentComponents` decorator * fix(Renderer): destroy crash when material is null (#808) * Improve BlendShape when use attribute mode (#804) * feat: improve BlendShape when use attribute mode * v0.7.0-beta.5 * refactor: fix skybox mirror problem * fix: fixed the bug of animator revert when blendWeight length exceeds 4 (#817) * fix: fixed the bug of animator revert when blendWeight length exceeds 4 * v0.7.0-beta.6 * refactor: fix shader * fix(text): fix horizontal and vertical alignment error (#772) * fix(text): fix horizontal alignment error Co-authored-by: luzhuang <[email protected]> Co-authored-by: singlecoder <[email protected]> * feat: export animation type * refactor: bump version * refactor: rename (#827) * v0.7.0-beta.7 * feat: physics character controller (#818) * feat: add `CharacterController` for physX backend * optimization camera code (#830) refactor: optimization camera code * Refactor `cloneTo` to `copyFrom` for math library and rename `setValue` to `set` (#844) * feat: refactor `cloneTo` to `copyFrom` for math library * feat: rename `setValue` to `set` for math library * feat: add to Obejct * feat: remove swc core * refactor: change toJSON to toObject * Fix transform`translate` and `rotate` space bug (#847) * fix: transform`translate` and `rotate` space bug * refactor: opt comments * refactor: merge dev/0.8 * refactor: remove console * Feat(core): add more clear flag item for Camera.clearFlags (#843) * feat(core): add more clear flag item for Camera.clearFlags * v0.8.0-alpha.0 * v0.8.0-alpha.1 * feat: update resource process * Add SpriteRenderer drawMode property(support simple and sliced) (#828) * feat: add sprite draw mode(support simple and sliced) * fix: TextureCube is left-hand,so x need inverse (#855) * `InputManager` support pointer button and wheel (#831) * feat: `InputManager` support pointer button and wheel * Add basic physics joint component include `FixedJoint`, `SpringJoint`, `HingeJoint` (#853) * feat: basic physics joint * Use char cache mode for TextRenderer (#837) * feat(text): use char cache mode for TextRenderer * v0.8.0-alpha.2 * v0.8.0-alpha.3 * feat: add script parser Co-authored-by: gz65555 <[email protected]> Co-authored-by: ChenMo <[email protected]> Co-authored-by: AZhan <[email protected]> Co-authored-by: singlecoder <[email protected]> Co-authored-by: luzhuang <[email protected]> Co-authored-by: zhuxudong <[email protected]> Co-authored-by: yangfengzzz <[email protected]>
* Test: Use Floss and Chai to Replace Jest (#778) test: Use Floss and Chai to Replace Jest * refactor: remove toolkit features (#780) * v0.7.0-beta.4 (#795) * Fix:local translate (#706) * fix(transform):local translate * Add component denpendent decorator (#796) * feat: add `dependentComponents` decorator * ci: remove ci on node 12 (#801) * Update README.md * Fix Test Version Error (#802) * ci: remove ci on node 12 * test: fix version * feat: add `priority` for renderer to order(#803) * feat(renderer): add `priority` for renderer to order * Fix SkyBox render mirror problem (#816) * refactor: fix skybox mirror problem * fix: change `region` and `pivot` origin to left-bottom (#809) * fix: change `region` and `pivot` origin to left-bottom * Merge latest main (#820) * v0.7.0-beta.4 * Update README.md * Update README.md * Update README.md * Add component denpendent decorator (#796) (#807) * feat: add `dependentComponents` decorator * fix(Renderer): destroy crash when material is null (#808) * Improve BlendShape when use attribute mode (#804) * feat: improve BlendShape when use attribute mode * v0.7.0-beta.5 * refactor: fix skybox mirror problem * fix: fixed the bug of animator revert when blendWeight length exceeds 4 (#817) * fix: fixed the bug of animator revert when blendWeight length exceeds 4 * v0.7.0-beta.6 * refactor: fix shader * fix(text): fix horizontal and vertical alignment error (#772) * fix(text): fix horizontal alignment error Co-authored-by: luzhuang <[email protected]> Co-authored-by: singlecoder <[email protected]> * refactor: rename (#827) * v0.7.0-beta.7 * feat: physics character controller (#818) * feat: add `CharacterController` for physX backend * optimization camera code (#830) refactor: optimization camera code * Refactor `cloneTo` to `copyFrom` for math library and rename `setValue` to `set` (#844) * feat: refactor `cloneTo` to `copyFrom` for math library * feat: rename `setValue` to `set` for math library * Fix transform`translate` and `rotate` space bug (#847) * fix: transform`translate` and `rotate` space bug * refactor: opt comments * Feat(core): add more clear flag item for Camera.clearFlags (#843) * feat(core): add more clear flag item for Camera.clearFlags * v0.8.0-alpha.0 * v0.8.0-alpha.1 * Add SpriteRenderer drawMode property(support simple and sliced) (#828) * feat: add sprite draw mode(support simple and sliced) * fix: TextureCube is left-hand,so x need inverse (#855) * `InputManager` support pointer button and wheel (#831) * feat: `InputManager` support pointer button and wheel * Add basic physics joint component include `FixedJoint`, `SpringJoint`, `HingeJoint` (#853) * feat: basic physics joint * Use char cache mode for TextRenderer (#837) * feat(text): use char cache mode for TextRenderer * v0.8.0-alpha.2 * v0.8.0-alpha.3 * Optimization performance for `TextRenderer` to update world positions (#861) * refactor(text): optimization performance for `TextRenderer` to update world positions * Fix `InputManager` bug (#863) * fix: `pointer` position bug * fix: `pointerMovingDelta` value bug * fix: input `onPointerXX` bug not follow `Camera` cullingMask * fix(2d): `SpriteRenderer` can not show error (#865) * v0.8.0-alpha.4 * v0.8.0-alpha.5 Co-authored-by: Hu Song <[email protected]> Co-authored-by: ChenMo <[email protected]> Co-authored-by: AZhan <[email protected]> Co-authored-by: singlecoder <[email protected]> Co-authored-by: luzhuang <[email protected]> Co-authored-by: zhuxudong <[email protected]> Co-authored-by: yangfengzzz <[email protected]>
* feat(text): use char cache mode for TextRenderer
Please check if the PR fulfills these requirements