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 1 commit
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
Next Next commit
perf(plane): plane horizontal default
singlecoder committed Oct 12, 2021

Verified

This commit was signed with the committer’s verified signature.
cjihrig Colin Ihrig
commit 4aadb7774b08460248adf1e09997ab5ada15cfa3
8 changes: 4 additions & 4 deletions packages/core/src/mesh/PrimitiveMesh.ts
Original file line number Diff line number Diff line change
@@ -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;