three.js 之 geometry几何体

2022-06-19 18 three.js

介绍

three.js 之 Loader 几何体

# 几何体介绍

# 立体缓冲几何体(长方体 正方体) BoxGeometry

image-20220619175804236

   //! 1. 创建场景对象Scene
  const scene = new THREE.Scene()
   // 创建一个立方体几何对象Geometry
 const geometry = new THREE.BoxGeometry(100, 100, 100)
  // 获取图片网格材质
  const texture = new THREE.TextureLoader().load('https://jinyanlong-1305883696.cos.ap-hongkong.myqcloud.com/%E5%B0%8Fmao.jpg')
  // 使用网格材质
  const skyBoxMaterial = new THREE.MeshBasicMaterial({
    map: texture,
    side: THREE.DoubleSide
  })
  // 网格模型对象Mesh 导入网格模型和网格才是
  content.mesh = new THREE.Mesh(geometry, skyBoxMaterial)
  // 添加到场景中去
  scene.add(mesh)
复制代码

# 平面缓冲几何体(长方形 正方形) PlaneGeometry

image-20220619175911604

  // 矩形平面网格模型,用来渲染火焰的动画效果
  const w = 25// 宽度
  const h = 1.6 * w// 高度
  const geometry = new THREE.PlaneGeometry(w, h) // 矩形平面
复制代码

# 参考文献

Three.js零基础入门教程(郭隆邦) (opens new window)

Last Updated: 2022/7/27 11:44:03
来发评论吧~
Powered By Valine
v1.4.14
未加载音频 - (ಗ ‸ ಗ )
00:00 / 00:00