-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from jerzakm/plane-to-triangle
Plane to triangle
- Loading branch information
Showing
7 changed files
with
112 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@threejs-kit/instanced-sprite-mesh": minor | ||
--- | ||
|
||
Option to use a triangle instead of a plane for the sprite geometry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { BufferGeometry, BufferAttribute } from "three"; | ||
|
||
export const createSpriteTriangle = () => { | ||
const geometry = new BufferGeometry(); | ||
|
||
const vertices = new Float32Array([ | ||
// top | ||
0.0, 1.0, 0.0, | ||
// bot-left | ||
-1.0, -1.0, 0.0, | ||
// bot-right | ||
1.0, -1.0, 0.0, | ||
]); | ||
geometry.setAttribute("position", new BufferAttribute(vertices, 3)); | ||
|
||
const uvs = new Float32Array([ | ||
// top | ||
0.5, 1, | ||
// bot-left | ||
0, 0.0, | ||
// bot-right | ||
1, 0.0, | ||
]); | ||
|
||
geometry.setAttribute("uv", new BufferAttribute(uvs, 2)); | ||
geometry.computeVertexNormals(); | ||
|
||
return geometry; | ||
}; |
ef9b39e
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.
Successfully deployed to the following URLs:
threejs-kit-playground – ./apps/playground
threejs-kit-playground-jerzakm.vercel.app
threejs-kit-playground.vercel.app
threejs-kit-playground-git-main-jerzakm.vercel.app