Skip to content

dwqdaiwenqi/simple-three.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

simple three.js engine~手撕一个three.js引擎

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published