Skip to content

Commit

Permalink
Reduce the vertex count of LabelEntities
Browse files Browse the repository at this point in the history
Reduced the vertex count for each label entity from 130 to 49, and the face count from 98 to 33.
  • Loading branch information
Gigabyte5671 committed Oct 26, 2023
1 parent 7899e97 commit ec5a0ed
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/modules/entity/entities/LabelEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function createSector(
const sectorAngle = Math.acos(
Vector3.Dot(vector1, vector2) / (vector1.length() * vector2.length())
);
const minNumberOfSegments = 5;
const minNumberOfSegments = 3;
const diameter = radius * 2;
const origin = Vector3.Zero();
const firstPoint = Vector3.Normalize(vector1).scale(radius);
Expand Down Expand Up @@ -94,7 +94,8 @@ function createSector(
{
pathArray: [points, originPoints],
offset: 0,
sideOrientation: Mesh.DOUBLESIDE
sideOrientation: Mesh.BACKSIDE,
updatable: false
},
scene
);
Expand Down Expand Up @@ -258,8 +259,8 @@ export class LabelEntity {
{
width: tagWidth,
height: tagHeight,
sideOrientation: Mesh.DOUBLESIDE,
updatable: true,
sideOrientation: Mesh.FRONTSIDE,
updatable: false,
},
scene
);
Expand Down Expand Up @@ -297,8 +298,8 @@ export class LabelEntity {
const edgeOptions = {
width: tagCornerRadius,
height: tagHeight - tagCornerRadius * 2,
sideOrientation: Mesh.DOUBLESIDE,
updatable: true,
sideOrientation: Mesh.FRONTSIDE,
updatable: false,
};
const edgePositions = [
new Vector3(-tagWidth / 2 - tagCornerRadius / 2, 0, 0),
Expand All @@ -319,8 +320,8 @@ export class LabelEntity {
{
radius: tagArrowSize,
tessellation: 3,
sideOrientation: Mesh.DOUBLESIDE,
updatable: true,
sideOrientation: Mesh.FRONTSIDE,
updatable: false,
},
scene
);
Expand Down

0 comments on commit ec5a0ed

Please sign in to comment.