mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
Remove deprecated class THREE.Geometry and THREE.Face3
This commit is contained in:
parent
eaa4ca3795
commit
73883858aa
@ -7,10 +7,9 @@ import {
|
|||||||
Object3D,
|
Object3D,
|
||||||
Vector2,
|
Vector2,
|
||||||
Vector3,
|
Vector3,
|
||||||
|
BufferGeometry
|
||||||
} from 'three'
|
} from 'three'
|
||||||
|
|
||||||
import { Geometry, Face3 } from 'three/examples/jsm/deprecated/Geometry.js'
|
|
||||||
|
|
||||||
export default class AnimatedPlane {
|
export default class AnimatedPlane {
|
||||||
constructor(params) {
|
constructor(params) {
|
||||||
Object.entries(params).forEach(([key, value]) => {
|
Object.entries(params).forEach(([key, value]) => {
|
||||||
@ -115,34 +114,34 @@ export default class AnimatedPlane {
|
|||||||
|
|
||||||
initGeometry() {
|
initGeometry() {
|
||||||
// square
|
// square
|
||||||
const geometry = new Geometry()
|
const geometry = new BufferGeometry()
|
||||||
geometry.vertices.push(new Vector3(0, 0, 0))
|
const points = [
|
||||||
geometry.vertices.push(new Vector3(this.wSize, 0, 0))
|
new Vector3(0, this.wSize, 0),
|
||||||
geometry.vertices.push(new Vector3(0, this.wSize, 0))
|
new Vector3(this.wSize, 0, 0),
|
||||||
geometry.vertices.push(new Vector3(this.wSize, this.wSize, 0))
|
new Vector3(0, 0, 0),
|
||||||
geometry.faces.push(new Face3(0, 2, 1))
|
|
||||||
geometry.faces.push(new Face3(2, 3, 1))
|
|
||||||
|
|
||||||
geometry.faceVertexUvs[0].push([
|
new Vector3(0, 0, 0),
|
||||||
new Vector2(0, 0),
|
new Vector3(this.wSize, this.wSize, 0),
|
||||||
new Vector2(0, 1),
|
new Vector3(0, this.wSize, 0),
|
||||||
new Vector2(1, 0),
|
|
||||||
])
|
|
||||||
geometry.faceVertexUvs[0].push([
|
|
||||||
new Vector2(0, 1),
|
|
||||||
new Vector2(1, 1),
|
|
||||||
new Vector2(1, 0),
|
|
||||||
])
|
|
||||||
|
|
||||||
// geometry.computeFaceNormals();
|
new Vector3(this.wSize, 0, 0),
|
||||||
// geometry.computeVertexNormals();
|
new Vector3(this.wSize, this.wSize, 0),
|
||||||
|
new Vector3(0, 0, 0),
|
||||||
|
|
||||||
|
new Vector3(0, this.wSize, 0),
|
||||||
|
new Vector3(this.wSize, this.wSize, 0),
|
||||||
|
new Vector3(this.wSize, 0, 0),
|
||||||
|
]
|
||||||
|
|
||||||
|
geometry.setFromPoints(points)
|
||||||
|
geometry.computeVertexNormals()
|
||||||
|
|
||||||
// center
|
// center
|
||||||
this.dx = this.wSize / 2
|
this.dx = this.wSize / 2
|
||||||
this.dy = this.wSize / 2
|
this.dy = this.wSize / 2
|
||||||
geometry.translate(-this.dx, -this.dy, 0)
|
geometry.translate(-this.dx, -this.dy, 0)
|
||||||
|
|
||||||
this.bGeometry = geometry.toBufferGeometry()
|
this.bGeometry = geometry
|
||||||
}
|
}
|
||||||
|
|
||||||
initAnimAttributes() {
|
initAnimAttributes() {
|
||||||
|
Loading…
Reference in New Issue
Block a user