mirror of
https://github.com/anatolykopyl/vue-three-d-mockup.git
synced 2026-03-26 12:55:08 +00:00
Notches
This commit is contained in:
@@ -81,11 +81,25 @@ class MockupModel extends Group {
|
||||
|
||||
function roundedPlane(width, height, radius) {
|
||||
const x = 0; const y = 0;
|
||||
const nW = 25;
|
||||
const nH = radius / 2.2;
|
||||
const shape = new Shape();
|
||||
|
||||
shape.moveTo(x, y + radius);
|
||||
shape.lineTo(x, y + height - radius);
|
||||
shape.quadraticCurveTo(x, y + height, x + radius, y + height);
|
||||
|
||||
shape.lineTo(width / 2 - nW / 2 - nH, y + height);
|
||||
shape.quadraticCurveTo(width / 2 - nW / 2, y + height, width / 2 - nW / 2, y + height - nH / 2);
|
||||
shape.quadraticCurveTo(
|
||||
width / 2 - nW / 2, y + height - nH, width / 2 - nW / 2 + nH, y + height - nH,
|
||||
);
|
||||
shape.lineTo(width / 2 + nW / 2 - nH, y + height - nH);
|
||||
shape.quadraticCurveTo(
|
||||
width / 2 + nW / 2, y + height - nH, width / 2 + nW / 2, y + height - nH / 2,
|
||||
);
|
||||
shape.quadraticCurveTo(width / 2 + nW / 2, y + height, width / 2 + nW / 2 + nH, y + height);
|
||||
|
||||
shape.lineTo(x + width - radius, y + height);
|
||||
shape.quadraticCurveTo(x + width, y + height, x + width, y + height - radius);
|
||||
shape.lineTo(x + width, y + radius);
|
||||
@@ -120,6 +134,9 @@ var script = {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
linearFilter: {
|
||||
type: Boolean,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const container = ref(null);
|
||||
@@ -180,7 +197,11 @@ var script = {
|
||||
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
|
||||
|
||||
const material = new THREE.MeshLambertMaterial({ map: texture });
|
||||
// material.map.minFilter = THREE.LinearFilter;
|
||||
|
||||
if (props.linearFilter) {
|
||||
material.map.minFilter = THREE.LinearFilter;
|
||||
}
|
||||
|
||||
const screen = new THREE.Mesh(geometry, material);
|
||||
|
||||
const recomputeUVs = () => {
|
||||
|
||||
@@ -38,6 +38,9 @@ export default {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
linearFilter: {
|
||||
type: Boolean,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const container = ref(null);
|
||||
@@ -98,7 +101,11 @@ export default {
|
||||
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
|
||||
|
||||
const material = new THREE.MeshLambertMaterial({ map: texture });
|
||||
// material.map.minFilter = THREE.LinearFilter;
|
||||
|
||||
if (props.linearFilter) {
|
||||
material.map.minFilter = THREE.LinearFilter;
|
||||
}
|
||||
|
||||
const screen = new THREE.Mesh(geometry, material);
|
||||
|
||||
const recomputeUVs = () => {
|
||||
|
||||
@@ -2,11 +2,25 @@ import { Shape, ShapeBufferGeometry } from 'three';
|
||||
|
||||
export default function roundedPlane(width, height, radius) {
|
||||
const x = 0; const y = 0;
|
||||
const nW = 25;
|
||||
const nH = radius / 2.2;
|
||||
const shape = new Shape();
|
||||
|
||||
shape.moveTo(x, y + radius);
|
||||
shape.lineTo(x, y + height - radius);
|
||||
shape.quadraticCurveTo(x, y + height, x + radius, y + height);
|
||||
|
||||
shape.lineTo(width / 2 - nW / 2 - nH, y + height);
|
||||
shape.quadraticCurveTo(width / 2 - nW / 2, y + height, width / 2 - nW / 2, y + height - nH / 2);
|
||||
shape.quadraticCurveTo(
|
||||
width / 2 - nW / 2, y + height - nH, width / 2 - nW / 2 + nH, y + height - nH,
|
||||
);
|
||||
shape.lineTo(width / 2 + nW / 2 - nH, y + height - nH);
|
||||
shape.quadraticCurveTo(
|
||||
width / 2 + nW / 2, y + height - nH, width / 2 + nW / 2, y + height - nH / 2,
|
||||
);
|
||||
shape.quadraticCurveTo(width / 2 + nW / 2, y + height, width / 2 + nW / 2 + nH, y + height);
|
||||
|
||||
shape.lineTo(x + width - radius, y + height);
|
||||
shape.quadraticCurveTo(x + width, y + height, x + width, y + height - radius);
|
||||
shape.lineTo(x + width, y + radius);
|
||||
|
||||
Reference in New Issue
Block a user