pos机如何入门

 新闻资讯2  |   2023-07-11 09:39  |  投稿人:pos机之家

网上有很多关于pos机如何入门,THREEJS 使用入门的知识,也有很多人为大家解答关于pos机如何入门的问题,今天pos机之家(www.poszjia.com)为大家整理了关于这方面的知识,让我们一起来看下吧!

本文目录一览:

1、pos机如何入门

pos机如何入门

1、THREEJS 官方网址: <u>https://threejs.org/。</u> threejs 通过封装WEBGL API 实现了在网页端直接进行三维3d模型渲染。应用场景包括:小游戏,在线展厅,DIY 互动等现代互联网应用,极具发展前景。

2、官方使用案例https://threejs.org/examples/,可以直接套用。

webglmaterial.png

以 <u>https://github.com/mrdoob/three.js/blob/master/examples/webgl_materials.html</u> 为例,讲解如何使用Threejs构建自己的应用:步骤一、新建html页面。

<!DOCTYPE html> <html lang="en"> <head> <title>three.js webgl - materials</title> <meta charset="utf-8"> <meta name="viewport" content="width="360px",height="auto" />

script type="module"> import * as THREE from '../build/three.module.js'; //引入threejs 主框架 import Stats from './jsm/libs/stats.module.js'; //引入状态帧计数状态显示 let stats; let camera, scene, renderer; let pointLight; const objects = [], materials = []; init(); animate(); function init() { const container = document.createElement( 'div' );//创建3d 场景所在的区域 document.body.appendChild( container ); camera = new THREE.PerspectiveCamera( 45, window.innerwidth="360px",height="auto" />

requestAnimationFrame( animate );//这部分是关键,通过设置浏览器的动画循环调用animate函数。保障画面循环渲染。好比cpu的时钟,一直在运转。 render();//场景渲染,webgl 渲染实际工作内容。 stats.update(); } function render() { const timer = 0.0001 * Date.now(); camera.position.x = Math.cos( timer ) * 1000; camera.position.z = Math.sin( timer ) * 1000; camera.lookAt( scene.position ); for ( let i = 0, l = objects.length; i < l; i ++ ) { const object = objects[ i ]; object.rotation.x += 0.01; object.rotation.y += 0.005; } materials[ materials.length - 2 ].emissive.setHSL( 0.54, 1, 0.35 * ( 0.5 + 0.5 * Math.sin( 35 * timer ) ) ); materials[ materials.length - 3 ].emissive.setHSL( 0.04, 1, 0.35 * ( 0.5 + 0.5 * Math.cos( 35 * timer ) ) ); pointLight.position.x = Math.sin( timer * 7 ) * 300; pointLight.position.y = Math.cos( timer * 5 ) * 400; pointLight.position.z = Math.cos( timer * 3 ) * 300; renderer.render( scene, camera );//调用renderer引擎实际渲染场景scene,camera,后续另外再讲场景渲染的数学模型。 } </script> </body> </html>

3、如何在vue中引入THREEJS步骤一、新建threejs 组件,ZeusStage.vue

大画家效果图.jpg

<template> <div ref="container" > </div></template><script> import * as THREE from 'three' export default { name: 'ZeusStage', provide () { return { parentObj: null, // avoid "injection not found" warning _baseUrl: null, global: this.global } }, props: { size: { type: Object, // { w, h } required: false, default: function(){ return { w:100, h:100 } } }, scenejson:{ type: Object }, scene_url:{ type:String } }, data () { return { g_material_selected:'黄金', img_blend:'', popover_active: false, }; }, watch: { size(newval, oldval) { if (newval != oldval) { this.$refs.container.style.width="360px",height="auto" />

instanceof THREE.OrthographicCamera) { camera.left = dom.offsetwidth="360px",height="auto" />

步骤二、调用ZeusStage.vue组件

<template> <div id="app"> <div class="container " style="background-image:url(images/background-3d.png)"> <ZeusStage ref="zeus_stage" :size="size" :scenejson="scenejson" :scene_url="scene_url"></ZeusStage> </div> </div></template><script>import ZeusStage from './components/ZeusStage.vue' export default { name: 'App', components: { ZeusStage }, mounted(){ var _this = this; function onresize(){ _this.size = { w: window.innerwidth="360px",height="auto" />

0人点赞

THREEJS web3d

以上就是关于pos机如何入门,THREEJS 使用入门的知识,后面我们会继续为大家整理关于pos机如何入门的知识,希望能够帮助到大家!

转发请带上网址:http://www.poszjia.com/newsone/83282.html
上一篇:pos机好做什么 下一篇:徐州通联pos机

你可能会喜欢:

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 babsan@163.com 举报,一经查实,本站将立刻删除。