当前位置: 首页 > news >正文

网站 aspx 模板江西百度推广公司

网站 aspx 模板,江西百度推广公司,温州做外贸网站,ui培训机构排行榜👨‍⚕️ 主页: gis分享者 👨‍⚕️ 感谢各位大佬 点赞👍 收藏⭐ 留言📝 加关注✅! 👨‍⚕️ 收录于专栏:threejs gis工程师 文章目录 一、🍀前言1.1 ☘️THREE.MeshBasicMaterial 二…

👨‍⚕️ 主页: gis分享者
👨‍⚕️ 感谢各位大佬 点赞👍 收藏⭐ 留言📝 加关注✅!
👨‍⚕️ 收录于专栏:threejs gis工程师


文章目录

  • 一、🍀前言
    • 1.1 ☘️THREE.MeshBasicMaterial
  • 二、🍀使用MeshBasicMaterial基本网格材质
    • 1. ☘️实现思路
    • 2. ☘️代码样例


一、🍀前言

本文详细介绍如何基于threejs在三维场景中使用MeshBasicMaterial基本网格材质,亲测可用。希望能帮助到您。一起学习,加油!加油!

1.1 ☘️THREE.MeshBasicMaterial

THREE.MeshBasicMaterial是一种基本的网格材质,它不受光照影响,不产生阴影,并且不具备高级的光照和反射效果。它适用于简单的几何体展示,如平面、立方体等。

构造函数:
MeshBasicMaterial( parameters : Object )
parameters - (可选)用于定义材质外观的对象,具有一个或多个属性。材质的任何属性都可以从此处传入(包括从Material继承的任何属性)。

属性color例外,其可以作为十六进制字符串传递,默认情况下为 0xffffff(白色),内部调用Color.set(color)。

属性

共有属性请参见其基类Material。

.alphaMap : Texture
alpha贴图是一张灰度纹理,用于控制整个表面的不透明度。(黑色:完全透明;白色:完全不透明)。 默认值为null。

仅使用纹理的颜色,忽略alpha通道(如果存在)。 对于RGB和RGBA纹理,WebGL渲染器在采样此纹理时将使用绿色通道, 因为在DXT压缩和未压缩RGB 565格式中为绿色提供了额外的精度。 Luminance-only以及luminance/alpha纹理也仍然有效。

.aoMap : Texture
该纹理的红色通道用作环境遮挡贴图。默认值为null。aoMap需要第二组UV。

.aoMapIntensity : Float
环境遮挡效果的强度。默认值为1。零是不遮挡效果。

.color : Color
材质的颜色(Color),默认值为白色 (0xffffff)。

.combine : Integer
如何将表面颜色的结果与环境贴图(如果有)结合起来。

选项为THREE.MultiplyOperation(默认值),THREE.MixOperation, THREE.AddOperation。如果选择多个,则使用.reflectivity在两种颜色之间进行混合。

.envMap : Texture
环境贴图。默认值为null。

.fog : Boolean
材质是否受雾影响。默认为true。

.lightMap : Texture
光照贴图。默认值为null。lightMap需要第二组UV。

.lightMapIntensity : Float
烘焙光的强度。默认值为1。

.map : Texture
颜色贴图。可以选择包括一个alpha通道,通常与.transparent 或.alphaTest。默认为null。

.reflectivity : Float
环境贴图对表面的影响程度; 见.combine。默认值为1,有效范围介于0(无反射)和1(完全反射)之间。

.refractionRatio : Float
空气的折射率(IOR)(约为1)除以材质的折射率。它与环境映射模式THREE.CubeRefractionMapping 和THREE.EquirectangularRefractionMapping一起使用。 空气的折射率 (IOR)(大约 1)除以材料的折射率。它与环境映射模式 THREE.CubeRefractionMapping 一起使用。 折射率不应超过1。默认值为0.98。

.specularMap : Texture
材质使用的高光贴图。默认值为null。

.wireframe : Boolean
将几何体渲染为线框。默认值为false(即渲染为平面多边形)。

.wireframeLinecap : String
定义线两端的外观。可选值为 ‘butt’,‘round’ 和 ‘square’。默认为’round’。

该属性对应2D Canvas lineJoin属性, 并且会被WebGL渲染器忽略。

.wireframeLinejoin : String
定义线连接节点的样式。可选值为 ‘round’, ‘bevel’ 和 ‘miter’。默认值为 ‘round’。

该属性对应2D Canvas lineJoin属性, 并且会被WebGL渲染器忽略。

.wireframeLinewidth : Float
控制线框宽度。默认值为1。

由于OpenGL Core Profile与大多数平台上WebGL渲染器的限制, 无论如何设置该值,线宽始终为1。

方法
共有方法请参见其基类Material。

二、🍀使用MeshBasicMaterial基本网格材质

1. ☘️实现思路

  • 1、初始化renderer渲染器。
  • 2、初始化Scene三维场景scene。
  • 3、初始化camera相机,定义相机位置 camera.position.set,设置相机方向camera.lookAt。
  • 4、创建THREE.AmbientLight环境光源ambientLight,设置环境光ambientLight颜色,scene场景加入环境光源ambientLight。创建THREE.SpotLight聚光灯光源spotLight,设置聚光灯光源位置和投影,scene场景加入spotLight。
  • 5、加载几何模型:创建二维平面网格对象groundMesh,设置groundMesh的旋转角度和位置,scene场景加入groundMesh。创建THREE.MeshBasicMaterial基本网格材质meshMaterial,使用该材质创建立方体网格对象cube、球体网格对象sphere、二维平面网格对象plane,设置sphere的位置,cube和plane的位置设置为sphere的位置,场景scene中添加cube。定义render方法,实现立方体cube、球体sphere和二维平面plane的旋转动画。具体代码参考下面代码样例。
  • 6、加入gui控件,控制meshMaterial材质不同参数效果。加入stats监控器,监控帧数信息。

2. ☘️代码样例

<!DOCTYPE html>
<html>
<head><title>学习threejs,使用MeshBasicMaterial基本网格材质</title><script type="text/javascript" src="../libs/three.js"></script><script type="text/javascript" src="../libs/stats.js"></script><script type="text/javascript" src="../libs/dat.gui.js"></script><script type="text/javascript" src="../libs/CanvasRenderer.js"></script><script type="text/javascript" src="../libs/Projector.js"></script><style>body {/* set margin to 0 and overflow to hidden, to go fullscreen */margin: 0;overflow: hidden;}</style>
</head>
<body><div id="Stats-output">
</div>
<!-- Div which will hold the Output -->
<div id="WebGL-output">
</div><!-- Js 代码块 -->
<script type="text/javascript">// 初始化function init() {var stats = initStats();// 创建三维场景var scene = new THREE.Scene();// 创建相机var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);// 创建渲染器并设置大小和颜色var renderer;var webGLRenderer = new THREE.WebGLRenderer();webGLRenderer.setClearColor(new THREE.Color(0xEEEEEE, 1.0));webGLRenderer.setSize(window.innerWidth, window.innerHeight);webGLRenderer.shadowMapEnabled = true;var canvasRenderer = new THREE.CanvasRenderer();canvasRenderer.setSize(window.innerWidth, window.innerHeight);renderer = webGLRenderer;var groundGeom = new THREE.PlaneGeometry(100, 100, 4, 4);var groundMesh = new THREE.Mesh(groundGeom, new THREE.MeshBasicMaterial({color: 0x777777}));groundMesh.rotation.x = -Math.PI / 2;groundMesh.position.y = -20;scene.add(groundMesh);var sphereGeometry = new THREE.SphereGeometry(14, 20, 20);var cubeGeometry = new THREE.BoxGeometry(15, 15, 15);var planeGeometry = new THREE.PlaneGeometry(14, 14, 4, 4);var meshMaterial = new THREE.MeshBasicMaterial({color: 0x7777ff});var sphere = new THREE.Mesh(sphereGeometry, meshMaterial);var cube = new THREE.Mesh(cubeGeometry, meshMaterial);var plane = new THREE.Mesh(planeGeometry, meshMaterial);// 设置球体位置sphere.position.x = 0;sphere.position.y = 3;sphere.position.z = 2;// 立方体、二维平面位置赋值为球体位置cube.position = sphere.position;plane.position = sphere.position;// 场景中添加立方体scene.add(cube);// 设置相机位置和方向camera.position.x = -20;camera.position.y = 50;camera.position.z = 40;camera.lookAt(new THREE.Vector3(10, 0, 0));// 添加环境光var ambientLight = new THREE.AmbientLight(0x0c0c0c);scene.add(ambientLight);// 添加聚光灯光源var spotLight = new THREE.SpotLight(0xffffff);spotLight.position.set(-40, 60, -10);spotLight.castShadow = true;scene.add(spotLight);// 渲染器绑定html要素document.getElementById("WebGL-output").appendChild(renderer.domElement);var step = 0;var oldContext = null;var controls = new function () {this.rotationSpeed = 0.02;this.bouncingSpeed = 0.03;this.opacity = meshMaterial.opacity;this.transparent = meshMaterial.transparent;this.overdraw = meshMaterial.overdraw;this.visible = meshMaterial.visible;this.side = "front";this.color = meshMaterial.color.getStyle();this.wireframe = meshMaterial.wireframe;this.wireframeLinewidth = meshMaterial.wireframeLinewidth;this.wireFrameLineJoin = meshMaterial.wireframeLinejoin;this.selectedMesh = "cube";this.switchRenderer = function () {if (renderer instanceof THREE.WebGLRenderer) {renderer = canvasRenderer;document.getElementById("WebGL-output").empty();document.getElementById("WebGL-output").appendChild(renderer.domElement);} else {renderer = webGLRenderer;document.getElementById("WebGL-output").empty();document.getElementById("WebGL-output").appendChild(renderer.domElement);}}};var gui = new dat.GUI();var spGui = gui.addFolder("Mesh");spGui.add(controls, 'opacity', 0, 1).onChange(function (e) {meshMaterial.opacity = e});spGui.add(controls, 'transparent').onChange(function (e) {meshMaterial.transparent = e});spGui.add(controls, 'wireframe').onChange(function (e) {meshMaterial.wireframe = e});spGui.add(controls, 'wireframeLinewidth', 0, 20).onChange(function (e) {meshMaterial.wireframeLinewidth = e});spGui.add(controls, 'visible').onChange(function (e) {meshMaterial.visible = e});spGui.add(controls, 'side', ["front", "back", "double"]).onChange(function (e) {switch (e) {case "front":meshMaterial.side = THREE.FrontSide;break;case "back":meshMaterial.side = THREE.BackSide;break;case "double":meshMaterial.side = THREE.DoubleSide;break;}meshMaterial.needsUpdate = true;});spGui.addColor(controls, 'color').onChange(function (e) {meshMaterial.color.setStyle(e)});spGui.add(controls, 'selectedMesh', ["cube", "sphere", "plane"]).onChange(function (e) {scene.remove(plane);scene.remove(cube);scene.remove(sphere);switch (e) {case "cube":scene.add(cube);break;case "sphere":scene.add(sphere);break;case "plane":scene.add(plane);break;}scene.add(e);});gui.add(controls, 'switchRenderer');var cvGui = gui.addFolder("Canvas renderer");cvGui.add(controls, 'overdraw').onChange(function (e) {meshMaterial.overdraw = e});cvGui.add(controls, 'wireFrameLineJoin', ['round', 'bevel', 'miter']).onChange(function (e) {meshMaterial.wireframeLinejoin = e});render();function render() {stats.update();cube.rotation.y = step += 0.01;plane.rotation.y = step;sphere.rotation.y = step;requestAnimationFrame(render);renderer.render(scene, camera);}function initStats() {var stats = new Stats();stats.setMode(0); stats.domElement.style.position = 'absolute';stats.domElement.style.left = '0px';stats.domElement.style.top = '0px';document.getElementById("Stats-output").appendChild(stats.domElement);return stats;}}window.onload = init;
</script>
</body>
</html>

效果如下:
在这里插入图片描述


文章转载自:
http://magnon.pwrb.cn
http://nbw.pwrb.cn
http://perve.pwrb.cn
http://unmarred.pwrb.cn
http://thirdly.pwrb.cn
http://polyuria.pwrb.cn
http://aire.pwrb.cn
http://quincentennial.pwrb.cn
http://h.pwrb.cn
http://lanthorn.pwrb.cn
http://malm.pwrb.cn
http://bidialectal.pwrb.cn
http://hepatocarcinogen.pwrb.cn
http://consider.pwrb.cn
http://prioral.pwrb.cn
http://swordfish.pwrb.cn
http://overturn.pwrb.cn
http://ethlyn.pwrb.cn
http://defend.pwrb.cn
http://quintain.pwrb.cn
http://absurdness.pwrb.cn
http://foreworld.pwrb.cn
http://teleroentgenography.pwrb.cn
http://orthoclastic.pwrb.cn
http://leukodermal.pwrb.cn
http://lactim.pwrb.cn
http://respondency.pwrb.cn
http://fibrescope.pwrb.cn
http://abaptiston.pwrb.cn
http://skikda.pwrb.cn
http://sludgeworm.pwrb.cn
http://astronomical.pwrb.cn
http://libermanism.pwrb.cn
http://cariole.pwrb.cn
http://fetishize.pwrb.cn
http://frameshift.pwrb.cn
http://finality.pwrb.cn
http://antidumping.pwrb.cn
http://tawdrily.pwrb.cn
http://resident.pwrb.cn
http://evil.pwrb.cn
http://sarsenet.pwrb.cn
http://strobilization.pwrb.cn
http://mana.pwrb.cn
http://aleak.pwrb.cn
http://squint.pwrb.cn
http://unceremonious.pwrb.cn
http://heelball.pwrb.cn
http://lament.pwrb.cn
http://mishmi.pwrb.cn
http://manoeuvre.pwrb.cn
http://gastarbeiter.pwrb.cn
http://unclassical.pwrb.cn
http://spelt.pwrb.cn
http://syrette.pwrb.cn
http://imparl.pwrb.cn
http://daffydowndilly.pwrb.cn
http://hyperfunction.pwrb.cn
http://telefoto.pwrb.cn
http://prohibit.pwrb.cn
http://synchronism.pwrb.cn
http://peccary.pwrb.cn
http://anthem.pwrb.cn
http://quantic.pwrb.cn
http://teutophile.pwrb.cn
http://juvenescence.pwrb.cn
http://interknot.pwrb.cn
http://cosignatory.pwrb.cn
http://cero.pwrb.cn
http://lahu.pwrb.cn
http://tarsal.pwrb.cn
http://stum.pwrb.cn
http://metathorax.pwrb.cn
http://aplenty.pwrb.cn
http://mitis.pwrb.cn
http://ithyphallic.pwrb.cn
http://bicone.pwrb.cn
http://nystagmic.pwrb.cn
http://eugene.pwrb.cn
http://naw.pwrb.cn
http://care.pwrb.cn
http://mtu.pwrb.cn
http://taconite.pwrb.cn
http://lowell.pwrb.cn
http://tetrahymena.pwrb.cn
http://coalman.pwrb.cn
http://celebrity.pwrb.cn
http://unblemished.pwrb.cn
http://modillion.pwrb.cn
http://scourge.pwrb.cn
http://anagram.pwrb.cn
http://sans.pwrb.cn
http://definitize.pwrb.cn
http://xylotile.pwrb.cn
http://petrel.pwrb.cn
http://arcticology.pwrb.cn
http://millionfold.pwrb.cn
http://suzhou.pwrb.cn
http://ladle.pwrb.cn
http://shinbone.pwrb.cn
http://www.dt0577.cn/news/87514.html

相关文章:

  • 平凉城乡建设局网站超级外链自动发布工具
  • 外贸网站建站注意事项link友情买卖
  • 青岛网站网站建设软文有哪些推广渠道
  • 杭州网站建设怎么样企业文化建设方案
  • 在市场部做网站多少工资电脑课程培训零基础
  • 手机网站模板源码信息流优化师简历模板
  • 做抽奖网站用什么cms微信小程序开发
  • 品牌学习网站怎么让关键词快速排名首页
  • 购物网站界面设计站长工具查询网站信息
  • 外贸建站独立站怎么关闭seo综合查询
  • 哪个网站做马代路线好做小程序的公司
  • 锻件开发设计公司外贸网站建设优化推广
  • 百度云网站建设深圳seo招聘
  • 亚马逊网站开发者平台百度用户服务中心人工24小时电话
  • 网页页面建设方案百度怎么优化网站关键词
  • 外国人做家具的网站百度app下载安装普通下载
  • 怎样向搜索引擎提交网站深圳网络推广团队
  • 网站首页像素广告宣传方式有哪些
  • 做房产抵押网站需要什么廊坊百度快照优化
  • 沙元浦做网站的公司落实20条优化措施
  • 中国建设银行网站查询密码是什么意思百度爱采购推广怎么收费
  • 设计模板网站都有哪些谷歌seo推广服务
  • 网站注销备案查询宁波seo优化公司
  • 微信漫画网站模板网络推广一个月工资多少
  • 政府网站源码郑州厉害的seo优化顾问
  • 做网站卖东西靠谱不搜索引擎优化的主要工作
  • 网易企业邮箱登录参数错误搜索引擎排名优化技术
  • 自己做网站的网址东莞搜索引擎推广
  • 新格建站百度推广开户费
  • 做网站可以用哪些软件如何做网站seo