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

perf: plane horizontal default #535

Merged
merged 2 commits into from
Oct 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/core/src/mesh/PrimitiveMesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,14 @@ export class PrimitiveMesh {

for (let i = 0; i < vertexCount; ++i) {
const x = i % horizontalCount;
const y = (i * horizontalCountReciprocal) | 0;
const z = (i * horizontalCountReciprocal) | 0;

// Position
positions[i] = new Vector3(x * gridWidth - halfWidth, y * gridHeight - halfHeight, 0);
positions[i] = new Vector3(x * gridWidth - halfWidth, 0, z * gridHeight - halfHeight);
// Normal
normals[i] = new Vector3(0, 0, 1);
normals[i] = new Vector3(0, 1, 0);
// Texcoord
uvs[i] = new Vector2(x * horizontalSegmentsReciprocal, 1 - y * verticalSegmentsReciprocal);
uvs[i] = new Vector2(x * horizontalSegmentsReciprocal, 1 - z * verticalSegmentsReciprocal);
}

let offset = 0;
Expand All @@ -283,8 +283,8 @@ export class PrimitiveMesh {
}

const { bounds } = mesh;
bounds.min.setValue(-halfWidth, -halfHeight, 0);
bounds.max.setValue(halfWidth, halfHeight, 0);
bounds.min.setValue(-halfWidth, 0, -halfHeight);
bounds.max.setValue(halfWidth, 0, halfHeight);

PrimitiveMesh._initialize(mesh, positions, normals, uvs, indices, noLongerAccessible);
return mesh;
Expand Down