[+] Meshline cursor
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
"@types/three": "^0.135.0",
|
||||
"core-js": "^3.6.5",
|
||||
"marked": "^4.0.6",
|
||||
"meshline": "^2.0.3",
|
||||
"moment": "^2.29.1",
|
||||
"three": "^0.135.0",
|
||||
"vue": "^3.0.0",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import * as THREE from "three";
|
||||
import {BufferGeometry, Color} from "three";
|
||||
import {MeshLine, MeshLineMaterial} from 'meshline';
|
||||
|
||||
export default class Cursor extends THREE.Mesh
|
||||
{
|
||||
constructor(conf: {radius: number, color: Color, width: number})
|
||||
{
|
||||
// https://discourse.threejs.org/t/shift-vertices-of-circle-geometry-not-working/26664
|
||||
const pts = new THREE.Path().absarc(0, 0, conf.radius, 0, Math.PI * 2, true).getPoints(90)
|
||||
const geometry = new MeshLine()
|
||||
geometry.setGeometry(new BufferGeometry().setFromPoints(pts), () => 1)
|
||||
|
||||
// MeshLine: https://stackoverflow.com/a/25759280/7346633
|
||||
const material = new MeshLineMaterial({resolution: new THREE.Vector2(window.innerWidth, window.innerHeight),
|
||||
color: conf.color, lineWidth: 1})
|
||||
super(geometry, material)
|
||||
}
|
||||
}
|
||||
@@ -5868,6 +5868,13 @@ merge2@^1.2.3, merge2@^1.3.0:
|
||||
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
|
||||
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
|
||||
|
||||
meshline@^2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/meshline/-/meshline-2.0.3.tgz#2652e430cf2ea309a027a9d41bca28a6fa27c69f"
|
||||
integrity sha512-Xadw4xmmQcSsS636hppJJXkRQBofxU1jP7ptaop7KFUbYrJtN9Av5pKTL10cK8wBh1xAQEzSwD3HQt0YjRV41A==
|
||||
dependencies:
|
||||
three "^0.129.0"
|
||||
|
||||
methods@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
|
||||
@@ -8341,6 +8348,11 @@ thread-loader@^2.1.3:
|
||||
loader-utils "^1.1.0"
|
||||
neo-async "^2.6.0"
|
||||
|
||||
three@^0.129.0:
|
||||
version "0.129.0"
|
||||
resolved "https://registry.yarnpkg.com/three/-/three-0.129.0.tgz#f5e530bbc96eac5d5b4749cb5da886ef0d42f554"
|
||||
integrity sha512-wiWio1yVRg2Oj6WEWsTHQo5eSzYpEwSBtPSi3OofNpvFbf26HFfb9kw4FZJNjII4qxzp0b1xLB11+tKkBGB1ZA==
|
||||
|
||||
three@^0.135.0:
|
||||
version "0.135.0"
|
||||
resolved "https://registry.yarnpkg.com/three/-/three-0.135.0.tgz#cff4ec8edd3c51ce9bc7e88d13e8eafed4d0ddfc"
|
||||
|
||||
Reference in New Issue
Block a user