티스토리 뷰

Front-end/Three

Geometry

ekki88 2025. 2. 3. 16:46

three.js journey강의를 듣고 작성합니다.

 

Three.js는 정점(Vertex)과 삼각형(Face)으로 Mesh를 만든다.

3개의 정점(Vertex)으로 삼각형을 만들고, 이를 여러 개 이어서 객체를 구성한다.

BoxGeometry

6개의 매개변수가 있음

width, height, depth, widthSegments, heightsegments, depthsegments 

 

 

BufferGeometry

attribute 기반 구조를 사용해 

float32array

:형식화된 배열 , float만 저장할 수 있음 , 고정된 길이 가지고있음

모든값을 넣어야하는 1차원 배열

const positionsArray = new Float32Array([
    0,0,0,
    0,1,0,
    1,0,0
])

const positionsAttribute = new THREE.BufferAttribute(positionsArray, 3)

const geometry = new THREE.BoxGeometry()
geometry.setAttribute('position', positionsAttribute)

const material = new THREE.MeshBasicMaterial(
    {
        color:0xff0000,
        wireframe:true
    }
)

 

 

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함