Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 1.51 KB

README.md

File metadata and controls

45 lines (34 loc) · 1.51 KB

simple-three.js

一个简单的three.js引擎,用于说明webgl原理,不要用于生产环境!不要用于生产环境!不要用于生产环境!

实现了我觉得特别常用的一些核心功能..

文章列表

使用

<script type="module">   
  import owo from './gl-owo.js' 

  let scene = new owo.Scene()
  let camera = new owo.PerspectiveCamera( 45, innerWidth / innerHeight, 0.1, 1000)

  let renderer = new owo.WebGLRenderer()
  renderer.setSize( window.innerWidth, window.innerHeight ) 
  document.body.appendChild( renderer.domElement )

  let cube = new owo.Mesh(
    new owo.BoxGeometry(20),
    new owo.MeshBasicMaterial({color:[0,0,1,1]})
  )
  scene.add(cube)

  requestAnimationFrame(function animate(){
    requestAnimationFrame(animate)
    renderer.render(scene, camera)
    cube.rotation.x += .1 
  
  })

</script>

License

MIT