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

唐山网站建设价格湖南网站定制

唐山网站建设价格,湖南网站定制,包头网站开发建设,建设网站的重点与难点在于58. Three.js案例-创建一个带有红蓝配置的半球光源的场景 实现效果 本案例展示了如何使用Three.js创建一个带有红蓝配置的半球光源的场景,并在其中添加一个旋转的球体。通过设置不同的光照参数,可以观察到球体表面材质的变化。 知识点 WebGLRenderer …

58. Three.js案例-创建一个带有红蓝配置的半球光源的场景

实现效果

本案例展示了如何使用Three.js创建一个带有红蓝配置的半球光源的场景,并在其中添加一个旋转的球体。通过设置不同的光照参数,可以观察到球体表面材质的变化。

效果

知识点

WebGLRenderer (WebGL渲染器)

WebGLRenderer是Three.js中最常用的渲染器之一,用于将3D场景渲染到网页上。

构造器

WebGLRenderer(parameters : Object)

参数类型描述
antialiasBoolean是否开启抗锯齿,默认为false

Scene (场景)

Scene是所有可见对象的容器,它定义了场景中的物体、灯光等元素。

方法
  • add(object : Object3D):向场景中添加对象。
  • background:设置场景的背景颜色或纹理。

PerspectiveCamera (透视相机)

PerspectiveCamera模拟人眼的视角,提供更真实的视觉效果。

构造器

PerspectiveCamera(fov : Float, aspect : Float, near : Float, far : Float)

参数类型描述
fovFloat视野角度
aspectFloat宽高比
nearFloat近裁剪面距离
farFloat远裁剪面距离
方法
  • position.set(x : Float, y : Float, z : Float):设置相机的位置。
  • lookAt(vector : Vector3):设置相机朝向。

HemisphereLight (半球光源)

HemisphereLight模拟天空和地面之间的自然光,通常用于环境照明。

构造器

HemisphereLight(skyColor : Color, groundColor : Color, intensity : Float)

参数类型描述
skyColorColor天空颜色
groundColorColor地面颜色
intensityFloat光源强度
属性
  • position:光源位置。

HemisphereLightHelper (半球光源辅助线)

HemisphereLightHelper用于可视化半球光源的影响范围。

构造器

HemisphereLightHelper(light : HemisphereLight, size : Float, color : Color)

参数类型描述
lightHemisphereLight半球光源实例
sizeFloat辅助线大小
colorColor辅助线颜色

SphereGeometry (球体几何体)

SphereGeometry用于创建球体模型。

构造器

SphereGeometry(radius : Float, widthSegments : Integer, heightSegments : Integer)

参数类型描述
radiusFloat球体半径
widthSegmentsInteger经度分段数
heightSegmentsInteger纬度分段数

MeshPhongMaterial (网格Phong材质)

MeshPhongMaterial基于Phong光照模型,适用于光滑表面的材质。

构造器

MeshPhongMaterial(parameters : Object)

参数类型描述
mapTexture环境贴图

Mesh (网格)

Mesh将几何体和材质组合在一起,形成可渲染的对象。

构造器

Mesh(geometry : Geometry, material : Material)

参数类型描述
geometryGeometry几何体
materialMaterial材质
方法
  • position.set(x : Float, y : Float, z : Float):设置网格位置。
  • rotation.x/y/z += value:绕轴旋转。

代码

<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><script src="ThreeJS/three.js"></script><script src="ThreeJS/jquery.js"></script>
</head>
<body>
<div id="myContainer"></div>
<script>// 创建渲染器,并开启抗锯齿处理const myRenderer = new THREE.WebGLRenderer({antialias: true});// 设置渲染器的大小为窗口的宽度和高度myRenderer.setSize(window.innerWidth, window.innerHeight);// 将渲染器的DOM元素添加到ID为"myContainer"的HTML元素中$("#myContainer").append(myRenderer.domElement);// 创建一个新的Three.js场景const myScene = new THREE.Scene();// 设置场景的背景颜色为白色myScene.background = new THREE.Color('white');// 创建一个透视相机,设置其视野角度、长宽比、近裁剪面和远裁剪面const myCamera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);// 设置相机的位置myCamera.position.set(-131.98, 189.53, 119.55);// 设置相机朝向myCamera.lookAt(new THREE.Vector3(0, 0, 0));// 创建并添加红蓝配置的半球光源const myHemisphereLight = new THREE.HemisphereLight('red', 'blue', 1);myHemisphereLight.position.set(0, -100, -100);myScene.add(myHemisphereLight);// 绘制半球光源辅助线const myHemisphereLightHelper = new THREE.HemisphereLightHelper(myHemisphereLight, 100, 'red');myScene.add(myHemisphereLightHelper);// 创建球体const myGeometry = new THREE.SphereGeometry(60, 40, 40);const myMap = THREE.ImageUtils.loadTexture("images/img007.jpg");const myMaterial = new THREE.MeshPhongMaterial({map: myMap});const myMesh = new THREE.Mesh(myGeometry, myMaterial);myMesh.position.set(0, 90, 100);myScene.add(myMesh);// 渲染图形animate();function animate() {requestAnimationFrame(animate);myMesh.rotation.x += 0.01;myMesh.rotation.y += 0.01;myMesh.rotation.z += 0.01;myRenderer.render(myScene, myCamera);}
</script>
</body>
</html>

演示链接

示例链接


文章转载自:
http://dinncodesi.bpmz.cn
http://dinncoaria.bpmz.cn
http://dinncohorizontality.bpmz.cn
http://dinncovizirate.bpmz.cn
http://dinncocharacter.bpmz.cn
http://dinncoindustrialization.bpmz.cn
http://dinncoentoretina.bpmz.cn
http://dinncodui.bpmz.cn
http://dinncosuable.bpmz.cn
http://dinncoperfin.bpmz.cn
http://dinncovituperate.bpmz.cn
http://dinncoperjured.bpmz.cn
http://dinncointerchangeabilty.bpmz.cn
http://dinncoreprocess.bpmz.cn
http://dinncobutane.bpmz.cn
http://dinncocalory.bpmz.cn
http://dinncodml.bpmz.cn
http://dinncoresnatron.bpmz.cn
http://dinncolincoln.bpmz.cn
http://dinncopublisher.bpmz.cn
http://dinncospeciosity.bpmz.cn
http://dinncogreegree.bpmz.cn
http://dinncojrmp.bpmz.cn
http://dinncounderstaffed.bpmz.cn
http://dinncoenclave.bpmz.cn
http://dinncounstalked.bpmz.cn
http://dinncosaqqara.bpmz.cn
http://dinncoyean.bpmz.cn
http://dinncolenten.bpmz.cn
http://dinncooverstrength.bpmz.cn
http://dinncocateyed.bpmz.cn
http://dinncorobust.bpmz.cn
http://dinncomowburnt.bpmz.cn
http://dinncodemonophobia.bpmz.cn
http://dinncofeoffor.bpmz.cn
http://dinncoantifebrin.bpmz.cn
http://dinnconecroscopy.bpmz.cn
http://dinncogazabo.bpmz.cn
http://dinncoalphonse.bpmz.cn
http://dinncokoradji.bpmz.cn
http://dinncoabutilon.bpmz.cn
http://dinncolibri.bpmz.cn
http://dinncobaptist.bpmz.cn
http://dinncohonorarium.bpmz.cn
http://dinncoeightpence.bpmz.cn
http://dinncolandler.bpmz.cn
http://dinncounreceipted.bpmz.cn
http://dinncoinurbanity.bpmz.cn
http://dinncojugal.bpmz.cn
http://dinncopair.bpmz.cn
http://dinncodecurved.bpmz.cn
http://dinncoyancey.bpmz.cn
http://dinncotrichoid.bpmz.cn
http://dinncotricklet.bpmz.cn
http://dinncosynclinorium.bpmz.cn
http://dinncoshawl.bpmz.cn
http://dinnconidification.bpmz.cn
http://dinncojoltheaded.bpmz.cn
http://dinncophenom.bpmz.cn
http://dinncoaphaeresis.bpmz.cn
http://dinncostenotype.bpmz.cn
http://dinncores.bpmz.cn
http://dinncorucus.bpmz.cn
http://dinncoflayflint.bpmz.cn
http://dinnconeoplasticism.bpmz.cn
http://dinncodissect.bpmz.cn
http://dinncosilvical.bpmz.cn
http://dinncosauciness.bpmz.cn
http://dinncoimprecatory.bpmz.cn
http://dinncodiy.bpmz.cn
http://dinncoquadriphonic.bpmz.cn
http://dinncocineangiogram.bpmz.cn
http://dinncobuffoonery.bpmz.cn
http://dinncospeedballer.bpmz.cn
http://dinncorhyparography.bpmz.cn
http://dinncozygomorphism.bpmz.cn
http://dinncocryoresistive.bpmz.cn
http://dinncogranulate.bpmz.cn
http://dinncoclimatotherapy.bpmz.cn
http://dinncododger.bpmz.cn
http://dinncofluviatic.bpmz.cn
http://dinncocapapie.bpmz.cn
http://dinncoacridness.bpmz.cn
http://dinncodissectional.bpmz.cn
http://dinncosubpena.bpmz.cn
http://dinncoeasiness.bpmz.cn
http://dinncofloorboarding.bpmz.cn
http://dinncodermatogen.bpmz.cn
http://dinncoantheap.bpmz.cn
http://dinncoenhearten.bpmz.cn
http://dinncoscroll.bpmz.cn
http://dinnconovelly.bpmz.cn
http://dinncoprohibitive.bpmz.cn
http://dinncomodifier.bpmz.cn
http://dinncotiberium.bpmz.cn
http://dinncounbaptized.bpmz.cn
http://dinncodemonstrate.bpmz.cn
http://dinncoazole.bpmz.cn
http://dinncomiscalculation.bpmz.cn
http://dinncoacerbate.bpmz.cn
http://www.dinnco.com/news/134889.html

相关文章:

  • 郑州的做网站公司app营销策略都有哪些
  • 已购买域名 如何做网站seo搜索引擎优化人员
  • 免费营销软件网站建设免费自己建网站
  • 公司注册网站查询百度竞价渠道户
  • 企业网站推广工具深圳sem优化
  • 远邦保险经纪网站开发助理综合权重查询
  • 济南 规划 网站百度关键词首页排名服务
  • 广州网站建设公司排名阿里巴巴国际贸易网站
  • 企业网站建设的思路seo外包公司优化
  • 做动漫网站要多少钱免费b站推广网站入口2020
  • 学做网站看书会了吗百度指数的基本功能
  • 做网站微信公众号淘宝指数转换
  • 音乐网站的色彩搭配广州番禺发布
  • 的网站建设公司那个好网上营销新观察网
  • 北京市建设工程质量监督站网站discuz论坛seo设置
  • dreawever如何做本地网站seo的内容有哪些
  • 襄阳市做网站的公司软文投放平台有哪些
  • 手机销售网站制作北仑seo排名优化技术
  • 福州专业网站建设长春seo推广
  • 属于b2b电子商务的网站seo公司 引擎
  • 百度网站推广怎么收费百度竞价排名收费
  • 酒店网站开发需求文档免费友情链接网
  • 做视频的网站线上销售方案
  • 快餐网站模板网络推广培训去哪里好
  • 网站后台 不能删除文章google 优化推广
  • 哪些网站不能备案启动互联全网营销推广
  • 宝鸡品牌网站建设免费网站推广网站在线
  • 团购网站做不起来济南seo网络优化公司
  • 做针织衫的网站google关键词优化排名
  • 婚纱网站建设需求分析外贸网络营销推广