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

湘潭企业网站建设计算机培训班培训费用

湘潭企业网站建设,计算机培训班培训费用,网站建设违约,建个网站费用由于ply文件是第三方提供的&#xff0c;threejs无法用绝路路径的方式显示ply 所以想通过webapi把ply通过url地址的方式给threejs 1.webapi部分 /// <summary>/// 获取PLY文件/// </summary>/// <returns></returns>[HttpPost(Name "GetPly&qu…

由于ply文件是第三方提供的,threejs无法用绝路路径的方式显示ply

所以想通过webapi把ply通过url地址的方式给threejs 

1.webapi部分

        /// <summary>/// 获取PLY文件/// </summary>/// <returns></returns>[HttpPost(Name = "GetPly")]public async Task<IActionResult> GetPly(GlueFileModel gfm){ string fileExt = Path.GetExtension(gfm.PlyFile); //绝对路径的ply文件 例如"D:\test\test.ply"//获取文件的ContentTypevar provider = new FileExtensionContentTypeProvider();//var memi = provider.Mappings[fileExt];var memi = "application/octet-stream";var fileBytes = System.IO.File.ReadAllBytes(gpm.PlyFile);string fileName = Path.GetFileName(gpm.PlyFile);return File(fileBytes, memi, fileName);}

2.Vue部分取得ply文件

		let pa = { No: "", PlyFile: "D:/test/test.ply" }//let pa = { No: "", PlyFile: GluePlyResultFile.value }let plyUrl = ""await axios.post(global_const.WEBAPI + `Python/GetPly`, pa, { responseType: 'blob' }).then(function (response) {console.log(response);plyUrl = window.URL.createObjectURL(new Blob([response.data]));return plyUrl//response.data;}).catch(function (error) {//ElMessage.error(cmd + '命令执行异常!' + error)console.log(error);});

3.threejs中load ply方法 

		//let s = '../src/assets/ply/Result.ply'let s = plyUrl;loader.load(s,function (geometry) {console.log('loader.load ');console.log(geometry);geometry.computeVertexNormals();const pos = geometry.attributes.position;const count =10;// pos.count;const colorsArr = [];for (let i = 0; i < count; i++) {const percent = i / count; //点索引值相对所有点数量的百分比//根据顶点位置顺序大小设置颜色渐变// 红色分量从0到1变化,蓝色分量从1到0变化colorsArr.push(percent, 0, 1 - percent); //蓝色到红色渐变色}//类型数组创建顶点颜色color数据//const colors = new Float32Array(colorsArr);// 设置几何体attributes属性的颜色color属性//geometry.attributes.color = new THREE.BufferAttribute(colors, 3);// color vertices based on vertex positionsconst colors = geometry.getAttribute('position').array.slice();console.log('colors',colors)for (let i = 0, l = colors.length; i < l; i++) {if (colors[i] > 0) colors[i] = 0.5;else colors[i] = 0;}geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3, false));const material2 = new THREE.PointsMaterial({ size: 0.01, vertexColors: true });//THREE.VertexColors//const material.vertexColors = true;let mesh2 = new THREE.Points(geometry, material2);mesh2.position.x = 1;//0;mesh2.position.y = 2;//-1;mesh2.position.z = 3;//0;mesh2.scale.multiplyScalar(0.4);mesh2.castShadow = true;mesh2.receiveShadow = true;scene.add(mesh2);scene.background = new THREE.Color(0x52645b);console.log('loader.load OK');},function (xhr) {//console.log((xhr.loaded / xhr.total) * 100 + "% loaded");},function (err) {console.error(err);});

http://www.hkea.cn/news/226217/

相关文章:

  • 网站建设公司怎么做网络营销网站推广
  • 360应用商店seo服务套餐
  • 废橡胶网站建设个人博客网页设计
  • 什么网站做一手项目好域名查询官网
  • 做日用品的要找什么网站好站长工具端口检测
  • 贵州软件开发 网站开发手机版百度一下
  • 企业网站建立答辩问题百度怎么发布广告
  • 温州快建网站地推拉新接单网
  • 濉溪县城乡建设委员会燃气办网站热狗网站排名优化外包
  • 网站能不能自己做免费的seo教程
  • 湖南的商城网站建设优化教程网下载
  • 做网站需要哪些工程师西安seo诊断
  • tp做的网站封装成app2023北京封控了
  • 增城做网站要多少钱推广普通话手抄报
  • 石家庄网站系统开发智能搜索引擎
  • 迅速网站网络营销平台推广方案
  • 学前端要逛那些网站微信引流主动被加软件
  • 韩国flash网站免费手机网站建站平台
  • 东莞做网站卓诚网络昆明长尾词seo怎么优化
  • WordPress个性萌化插件郑州seo优化哪家好
  • 专业手机移动网站建设免费的seo优化
  • 西安网站建设王永杰域名注册 万网
  • 网站营销优化方案北京做的好的seo公司
  • 企业网站排名提升软件优化南宁seo优化
  • 创意合肥网站建设杭州seo公司排名
  • 网站专题页是什么中国十大关键词
  • 五月天做网站网络策划与营销
  • 高校网站如何建设论文谷歌官网下载
  • 做网站内容软件个人网站怎么做
  • 收废铁的做网站有优点吗海南百度推广开户