怎样免费做公司网站,大数据技术与应用,网站系统说明书,国内服务器怎么绕过备案参考资料
第一个3D案例—透视投影相机第一个3D案例—渲染器…Canvas画布布局和全屏
知识点
透视投影相机PerspectiveCameraWebGL渲染器WebGLRenderer辅助观察坐标系AxesHelper漫反射网格材质MeshLambertMaterial点光源PointLight点光源辅助观察PointLightHelper环境光Ambien…参考资料
第一个3D案例—透视投影相机第一个3D案例—渲染器…Canvas画布布局和全屏
知识点
透视投影相机PerspectiveCameraWebGL渲染器WebGLRenderer辅助观察坐标系AxesHelper漫反射网格材质MeshLambertMaterial点光源PointLight点光源辅助观察PointLightHelper环境光AmbientLight平行光DirectionalLight平行光辅助观察DirectionalLightHelper相机控件OrbitControls请求动画帧window.requestAnimationFramecanvas画布宽高度动态变化性能监控Stats
代码实现 相机、渲染器、光 !DOCTYPE html
html langen
headmeta charsetUTF-8titleThree.js/title
/headbody/body!-- 具体路径配置你根据自己文件目录设置我的是课件中源码形式 --script typeimportmap{imports: {three: ./js/three.module.js,three/addons/: ../three.js/examples/jsm/}}/scriptscript typemoduleimport * as THREE from three;import { OrbitControls } from three/addons/controls/OrbitControls.js;const width 800const height 500// 场景const scene new THREE.Scene();// 几何体const geometry new THREE.BoxGeometry(100, 100, 100);// 材质 // MeshBasicMaterial不受光// MeshLambertMaterial受光const material new THREE.MeshLambertMaterial({color:0x0000ff,});// 网格模型物体const mesh new THREE.Mesh(geometry, material);mesh.position.set(0, 0, 0);scene.add(mesh);// 坐标系const axes new THREE.AxesHelper(200);scene.add(axes);// // 点光源// const pointLight new THREE.PointLight( 0xffffff, 1.0, 0, 0);// pointLight.position.set(-200, 200, 200 );// scene.add( pointLight );// // 辅助点光源// const pointLightHelper new THREE.PointLightHelper( pointLight, 10 );// scene.add( pointLightHelper );// 环境光const ambientLight new THREE.AmbientLight( 0xffffff, 0.2);scene.add( ambientLight );// 平行光const directionalLight new THREE.DirectionalLight( 0xffffff, 1, 0, 0);// directionalLight.position.set(100, 0, 0);// directionalLight.position.set(0, 100, 0);// directionalLight.position.set(100, 100, 100);directionalLight.position.set(100, 60, 50);directionalLight.target mesh;scene.add( directionalLight );// 辅助平行光const directionalLightHelper new THREE.DirectionalLightHelper( directionalLight, 10 );scene.add( directionalLightHelper );// 相机const camera new THREE.PerspectiveCamera(75, width/height, 0.1, 1000);camera.position.set(200, 200, 200);camera.lookAt(scene.position);// 渲染器const renderer new THREE.WebGLRenderer();renderer.setSize(width, height);renderer.render(scene, camera);document.body.appendChild(renderer.domElement);// 控制器const controls new OrbitControls(camera, renderer.domElement);controls.addEventListener(change, () {renderer.render(scene, camera);});/script
/html动画 !DOCTYPE html
html langen
headmeta charsetUTF-8titleThree.js/title
/headbody/body!-- 具体路径配置你根据自己文件目录设置我的是课件中源码形式 --script typeimportmap{imports: {three: ./js/three.module.js,three/addons/: ../three.js/examples/jsm/}}/scriptscript typemoduleimport * as THREE from three;import { OrbitControls } from three/addons/controls/OrbitControls.js;const width 800const height 500// 场景const scene new THREE.Scene();// 几何体const geometry new THREE.BoxGeometry(100, 100, 100);// 材质const material new THREE.MeshBasicMaterial({color: 0x00ff00,transparent: true,opacity: 0.5});// 网格模型物体const mesh new THREE.Mesh(geometry, material);mesh.position.set(0, 0, 0);scene.add(mesh);// 坐标系const axes new THREE.AxesHelper(200);scene.add(axes);// 相机const camera new THREE.PerspectiveCamera(75, width/height, 0.1, 1000);camera.position.set(200, 200, 200);camera.lookAt(scene.position);// 渲染器const renderer new THREE.WebGLRenderer();renderer.setSize(width, height);renderer.render(scene, camera);document.body.appendChild(renderer.domElement);// 动画渲染// 跟踪时间var clock new THREE.Clock();function render() {const spt clock.getDelta() * 1000;console.log( ~ file: animation.html:59 ~ render ~ spt:, spt)requestAnimationFrame(render);mesh.rotation.y 0.01;renderer.render(scene, camera);}render();// 控制器const controls new OrbitControls(camera, renderer.domElement);controls.addEventListener(change, () {// 因为动画渲染了所以这里可以省略// renderer.render(scene, camera);});/script
/html画布动态变化 !DOCTYPE html
html langen
headmeta charsetUTF-8titleThree.js/titlestylebody {margin: 0;overflow: hidden;}/style
/headbody/body!-- 具体路径配置你根据自己文件目录设置我的是课件中源码形式 --script typeimportmap{imports: {three: ./js/three.module.js}}/scriptscript typemoduleimport * as THREE from three;let width window.innerWidth;let height window.innerHeight;// 场景const scene new THREE.Scene();// 几何体const geometry new THREE.BoxGeometry(100, 100, 100);// 材质const material new THREE.MeshBasicMaterial({color: 0x00ff00,transparent: true,opacity: 0.5});// 网格模型物体const mesh new THREE.Mesh(geometry, material);mesh.position.set(0, 0, 0);scene.add(mesh);// 坐标系const axes new THREE.AxesHelper(200);scene.add(axes);// 相机const camera new THREE.PerspectiveCamera(75, width/height, 0.1, 1000);camera.position.set(200, 200, 200);camera.lookAt(scene.position);// 渲染器const renderer new THREE.WebGLRenderer();renderer.setSize(width, height);renderer.render(scene, camera);document.body.appendChild(renderer.domElement);// 填满浏览器window.onresize function () {width window.innerWidth;height window.innerHeight;renderer.setSize(width, height);camera.aspect width / height;camera.updateProjectionMatrix();}/script
/html性能监控 !DOCTYPE html
html langen
headmeta charsetUTF-8titleThree.js/title
/headbody/body!-- 具体路径配置你根据自己文件目录设置我的是课件中源码形式 --script typeimportmap{imports: {three: ./js/three.module.js,three/addons/: ../three.js/examples/jsm/}}/scriptscript typemoduleimport * as THREE from three;import { OrbitControls } from three/addons/controls/OrbitControls.js;import Stats from three/addons/libs/stats.module.js;const width 800const height 500// 场景const scene new THREE.Scene();// 几何体const geometry new THREE.BoxGeometry(100, 100, 100);// 材质const material new THREE.MeshBasicMaterial({color: 0x00ff00,transparent: true,opacity: 0.5});// 网格模型物体const mesh new THREE.Mesh(geometry, material);mesh.position.set(0, 0, 0);scene.add(mesh);for (let i 0; i 1000; i) {// 几何体const geometry new THREE.BoxGeometry(5, 5, 5);// 材质const material new THREE.MeshBasicMaterial({color: 0x00ff00,transparent: true,opacity: 0.5});// 网格模型物体const mesh new THREE.Mesh(geometry, material);mesh.position.set((Math.random() - 0.5) * 200, (Math.random() - 0.5) * 200, (Math.random() - 0.5) * 200);scene.add(mesh);}// 坐标系const axes new THREE.AxesHelper(200);scene.add(axes);// 相机const camera new THREE.PerspectiveCamera(75, width/height, 0.1, 1000);camera.position.set(200, 200, 200);camera.lookAt(scene.position);// 渲染器const renderer new THREE.WebGLRenderer();renderer.setSize(width, height);renderer.render(scene, camera);document.body.appendChild(renderer.domElement);// 性能监控const stats new Stats()document.body.appendChild(stats.domElement);// 动画渲染// 跟踪时间var clock new THREE.Clock();function render() {stats.update()const spt clock.getDelta() * 1000;requestAnimationFrame(render);mesh.rotation.y 0.01;renderer.render(scene, camera);}render();/script
/html 文章转载自: http://www.morning.rhmk.cn.gov.cn.rhmk.cn http://www.morning.rjbb.cn.gov.cn.rjbb.cn http://www.morning.hxpff.cn.gov.cn.hxpff.cn http://www.morning.kjdxh.cn.gov.cn.kjdxh.cn http://www.morning.bylzr.cn.gov.cn.bylzr.cn http://www.morning.ydflc.cn.gov.cn.ydflc.cn http://www.morning.dmwck.cn.gov.cn.dmwck.cn http://www.morning.wpkr.cn.gov.cn.wpkr.cn http://www.morning.tsmxh.cn.gov.cn.tsmxh.cn http://www.morning.kxbry.cn.gov.cn.kxbry.cn http://www.morning.jcfg.cn.gov.cn.jcfg.cn http://www.morning.jzfrl.cn.gov.cn.jzfrl.cn http://www.morning.jkbqs.cn.gov.cn.jkbqs.cn http://www.morning.xgmf.cn.gov.cn.xgmf.cn http://www.morning.rlwgn.cn.gov.cn.rlwgn.cn http://www.morning.kgnrh.cn.gov.cn.kgnrh.cn http://www.morning.twgzq.cn.gov.cn.twgzq.cn http://www.morning.fqtdz.cn.gov.cn.fqtdz.cn http://www.morning.ysckr.cn.gov.cn.ysckr.cn http://www.morning.fbfnk.cn.gov.cn.fbfnk.cn http://www.morning.mqfhy.cn.gov.cn.mqfhy.cn http://www.morning.lnmby.cn.gov.cn.lnmby.cn http://www.morning.qbtkg.cn.gov.cn.qbtkg.cn http://www.morning.npxht.cn.gov.cn.npxht.cn http://www.morning.jtmql.cn.gov.cn.jtmql.cn http://www.morning.ns3nt8.cn.gov.cn.ns3nt8.cn http://www.morning.ftnhr.cn.gov.cn.ftnhr.cn http://www.morning.spqbp.cn.gov.cn.spqbp.cn http://www.morning.synkr.cn.gov.cn.synkr.cn http://www.morning.btgxf.cn.gov.cn.btgxf.cn http://www.morning.leboju.com.gov.cn.leboju.com http://www.morning.mkfr.cn.gov.cn.mkfr.cn http://www.morning.ggmls.cn.gov.cn.ggmls.cn http://www.morning.qnftc.cn.gov.cn.qnftc.cn http://www.morning.qrndh.cn.gov.cn.qrndh.cn http://www.morning.elsemon.com.gov.cn.elsemon.com http://www.morning.zfqdt.cn.gov.cn.zfqdt.cn http://www.morning.hyyxsc.cn.gov.cn.hyyxsc.cn http://www.morning.rpgdd.cn.gov.cn.rpgdd.cn http://www.morning.gyylt.cn.gov.cn.gyylt.cn http://www.morning.cwgpl.cn.gov.cn.cwgpl.cn http://www.morning.sqdjn.cn.gov.cn.sqdjn.cn http://www.morning.pkggl.cn.gov.cn.pkggl.cn http://www.morning.mlnby.cn.gov.cn.mlnby.cn http://www.morning.tgts.cn.gov.cn.tgts.cn http://www.morning.kyjpg.cn.gov.cn.kyjpg.cn http://www.morning.vnuwdy.cn.gov.cn.vnuwdy.cn http://www.morning.qwyms.cn.gov.cn.qwyms.cn http://www.morning.qhtlq.cn.gov.cn.qhtlq.cn http://www.morning.hwxxh.cn.gov.cn.hwxxh.cn http://www.morning.wnhgb.cn.gov.cn.wnhgb.cn http://www.morning.dfltx.cn.gov.cn.dfltx.cn http://www.morning.jydhl.cn.gov.cn.jydhl.cn http://www.morning.kwfnt.cn.gov.cn.kwfnt.cn http://www.morning.tsycr.cn.gov.cn.tsycr.cn http://www.morning.cgthq.cn.gov.cn.cgthq.cn http://www.morning.mqwdh.cn.gov.cn.mqwdh.cn http://www.morning.dbfj.cn.gov.cn.dbfj.cn http://www.morning.wrlxy.cn.gov.cn.wrlxy.cn http://www.morning.nwljj.cn.gov.cn.nwljj.cn http://www.morning.dcmnl.cn.gov.cn.dcmnl.cn http://www.morning.hsrch.cn.gov.cn.hsrch.cn http://www.morning.jqcrf.cn.gov.cn.jqcrf.cn http://www.morning.qllcm.cn.gov.cn.qllcm.cn http://www.morning.nckjk.cn.gov.cn.nckjk.cn http://www.morning.hmxb.cn.gov.cn.hmxb.cn http://www.morning.bqfpm.cn.gov.cn.bqfpm.cn http://www.morning.gxfzrb.com.gov.cn.gxfzrb.com http://www.morning.nzdks.cn.gov.cn.nzdks.cn http://www.morning.rwqj.cn.gov.cn.rwqj.cn http://www.morning.nzxdz.cn.gov.cn.nzxdz.cn http://www.morning.qcwrm.cn.gov.cn.qcwrm.cn http://www.morning.yltnl.cn.gov.cn.yltnl.cn http://www.morning.drspc.cn.gov.cn.drspc.cn http://www.morning.pcgjj.cn.gov.cn.pcgjj.cn http://www.morning.xtxp.cn.gov.cn.xtxp.cn http://www.morning.rpgdd.cn.gov.cn.rpgdd.cn http://www.morning.tsqrc.cn.gov.cn.tsqrc.cn http://www.morning.cfjyr.cn.gov.cn.cfjyr.cn http://www.morning.fbmrz.cn.gov.cn.fbmrz.cn