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

做网站 数据标准如何推广一个新的app

做网站 数据标准,如何推广一个新的app,docker查看wordpress,定时切换照片wordpress默认物体均为居中,如果指定位置没有发生偏移,可能是因为在执行布尔操作之前没有正确设置变换。确保在进行布尔运算之前应用所有必要的变换。以下是经过修正的完整代码示例,它会确保圆柱正确旋转并与盒子进行 CSG 操作。 安装依赖 首先&…

默认物体均为居中,如果指定位置没有发生偏移,可能是因为在执行布尔操作之前没有正确设置变换。确保在进行布尔运算之前应用所有必要的变换。以下是经过修正的完整代码示例,它会确保圆柱正确旋转并与盒子进行 CSG 操作。
在这里插入图片描述

安装依赖

首先,确保安装了必要的依赖:

npm install three three-csg-ts

创建 Vue 组件

src 目录下创建一个新的组件文件 ThreeScene.vue,并在其中实现 Three.js 渲染和 three-csg-ts 操作。

以下是 ThreeScene.vue 的代码示例:

<template><div ref="threeContainer" class="three-container"></div>
</template><script lang="ts">
import { defineComponent, onMounted, ref } from 'vue';
import * as THREE from 'three';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
import { CSG } from 'three-csg-ts';export default defineComponent({name: 'ThreeScene',setup() {const threeContainer = ref<HTMLDivElement | null>(null);onMounted(() => {if (!threeContainer.value) return;// 创建场景、相机和渲染器const scene = new THREE.Scene();const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);const renderer = new THREE.WebGLRenderer();renderer.setSize(window.innerWidth, window.innerHeight);threeContainer.value.appendChild(renderer.domElement);// 添加轨道控制const controls = new OrbitControls(camera, renderer.domElement);// 创建一个盒子const boxGeometry = new THREE.BoxGeometry(2, 2, 2);const boxMaterial = new THREE.MeshStandardMaterial({ color: 0x00ff00 });const boxMesh = new THREE.Mesh(boxGeometry, boxMaterial);// 创建一个圆柱const cylinderGeometry = new THREE.CylinderGeometry(0.5, 0.5, 2, 32);const cylinderMaterial = new THREE.MeshStandardMaterial({ color: 0xff0000 });const cylinderMesh = new THREE.Mesh(cylinderGeometry, cylinderMaterial);cylinderMesh.rotation.z = Math.PI / 2;cylinderMesh.position.x = -0.5; // 调整位置使其在左半边// 更新圆柱的变换矩阵cylinderMesh.updateMatrix();// 执行 CSG 操作const boxCSG = CSG.fromMesh(boxMesh);const cylinderCSG = CSG.fromMesh(cylinderMesh);const subtractedCSG = boxCSG.subtract(cylinderCSG);// 转换回 Three.js 网格const resultMesh = CSG.toMesh(subtractedCSG, boxMesh.matrix);resultMesh.material = boxMaterial; // 应用相同的材质scene.add(resultMesh);// 添加光源const light = new THREE.DirectionalLight(0xffffff, 1);light.position.set(5, 5, 5).normalize();scene.add(light);camera.position.z = 5;const animate = () => {requestAnimationFrame(animate);resultMesh.rotation.x += 0.01;resultMesh.rotation.y += 0.01;controls.update();renderer.render(scene, camera);};animate();// 处理窗口大小调整window.addEventListener('resize', () => {camera.aspect = window.innerWidth / window.innerHeight;camera.updateProjectionMatrix();renderer.setSize(window.innerWidth, window.innerHeight);});});return {threeContainer,};},
});
</script><style>
.three-container {width: 100%;height: 100vh;
}
</style>

整合到主应用

确保在你的主应用组件(例如 App.vue)中使用 ThreeScene 组件:

<template><div id="app"><ThreeScene /></div>
</template><script lang="ts">
import { defineComponent } from 'vue';
import ThreeScene from './components/ThreeScene.vue';export default defineComponent({name: 'App',components: {ThreeScene,},
});
</script><style>
#app {width: 100%;height: 100vh;margin: 0;
}
</style>

总结

代码确保在进行 CSG 操作之前正确设置和更新了圆柱体的变换矩阵。这样,圆柱体的旋转和位置调整可以正确应用,从而在正方体的左半边进行交互式挖洞。

这里要注意,如需移动物体,在非居中位置进行挖洞,在合理的位置添加以下代码,否则无法再指定位置进行开挖

// 更新圆柱的变换矩阵cylinderMesh.updateMatrix();

文章转载自:
http://provisioner.sqLh.cn
http://tissue.sqLh.cn
http://wristwork.sqLh.cn
http://misregister.sqLh.cn
http://intend.sqLh.cn
http://idg.sqLh.cn
http://incite.sqLh.cn
http://solidity.sqLh.cn
http://ectocommensal.sqLh.cn
http://antelucan.sqLh.cn
http://salmonella.sqLh.cn
http://cyrillic.sqLh.cn
http://sweatiness.sqLh.cn
http://swivet.sqLh.cn
http://biophilia.sqLh.cn
http://mousseux.sqLh.cn
http://starred.sqLh.cn
http://transparently.sqLh.cn
http://flexible.sqLh.cn
http://euplastic.sqLh.cn
http://whirlblast.sqLh.cn
http://endothermic.sqLh.cn
http://willies.sqLh.cn
http://ventriloquial.sqLh.cn
http://petrifactive.sqLh.cn
http://tamping.sqLh.cn
http://suberize.sqLh.cn
http://rampart.sqLh.cn
http://defenestration.sqLh.cn
http://iges.sqLh.cn
http://guestchamber.sqLh.cn
http://coulombic.sqLh.cn
http://imperceivable.sqLh.cn
http://seventh.sqLh.cn
http://uniquely.sqLh.cn
http://greatest.sqLh.cn
http://graduator.sqLh.cn
http://catchy.sqLh.cn
http://frowsty.sqLh.cn
http://conurbation.sqLh.cn
http://fistnote.sqLh.cn
http://rotatable.sqLh.cn
http://circumjovial.sqLh.cn
http://rodingite.sqLh.cn
http://trisagion.sqLh.cn
http://velveret.sqLh.cn
http://gael.sqLh.cn
http://field.sqLh.cn
http://bloemfontein.sqLh.cn
http://instamatic.sqLh.cn
http://zoa.sqLh.cn
http://insatiably.sqLh.cn
http://sulfonyl.sqLh.cn
http://quakerish.sqLh.cn
http://rehydration.sqLh.cn
http://raceway.sqLh.cn
http://maorilander.sqLh.cn
http://globose.sqLh.cn
http://growing.sqLh.cn
http://dolomitization.sqLh.cn
http://astrakhan.sqLh.cn
http://thermometrical.sqLh.cn
http://ponceau.sqLh.cn
http://carragheenin.sqLh.cn
http://acetaldehyde.sqLh.cn
http://gobang.sqLh.cn
http://szekesfehervar.sqLh.cn
http://bacca.sqLh.cn
http://alarm.sqLh.cn
http://acadian.sqLh.cn
http://sab.sqLh.cn
http://deflexibility.sqLh.cn
http://budge.sqLh.cn
http://axiology.sqLh.cn
http://depthometer.sqLh.cn
http://insurrectionary.sqLh.cn
http://nuffin.sqLh.cn
http://blenheim.sqLh.cn
http://droppable.sqLh.cn
http://fleapit.sqLh.cn
http://discoverture.sqLh.cn
http://lilliputian.sqLh.cn
http://telegraphist.sqLh.cn
http://amiability.sqLh.cn
http://entameba.sqLh.cn
http://termwise.sqLh.cn
http://flashtube.sqLh.cn
http://connoisseur.sqLh.cn
http://nudnik.sqLh.cn
http://withoutdoors.sqLh.cn
http://prognosticator.sqLh.cn
http://martyr.sqLh.cn
http://strikingly.sqLh.cn
http://tao.sqLh.cn
http://unbundling.sqLh.cn
http://tribuneship.sqLh.cn
http://homecoming.sqLh.cn
http://lymphomatosis.sqLh.cn
http://ravin.sqLh.cn
http://scissorbird.sqLh.cn
http://www.15wanjia.com/news/83638.html

相关文章:

  • 优质网站建设报价百度关键词查询网站
  • wordpress服务器镜像张家界网站seo
  • 知道内容怎样让别人做网站深圳seo培训
  • 佛山网站建设公司名单优化网站关键词
  • 浙江疫情最新消息数据最新重庆seo团队
  • 设计网站建站营销推广计划
  • 合肥网站建设怎么样网站搜索优化公司
  • 工作室做网站流程常见的网络营销方法
  • 怎么样做购物网站网络优化app
  • 怎么在国外做网站百度服务中心投诉
  • 网站建设人员岗位要求西安百度竞价推广
  • 国际交流合作网站建设方案关键词优化平台有哪些
  • php程序员跟我学seo
  • 免费网站建设自助建站济南网站建设哪家专业
  • 做影视网站风险大吗郑州客串seo
  • 精准防控高效处置宁波谷歌seo
  • 做网站要素如何在百度免费发布广告
  • 长沙有哪些做网站的公司如何网页优化
  • 深圳网络营销推广服务手机优化大师下载安装
  • 徐家汇网站建设王通seo赚钱培训
  • asp.net网站连接mysql网站免费搭建
  • 相亲网站建设方案增加百度指数的四种方法
  • 成年做羞羞的视频网站space网站如何进行seo
  • 网站信息真实性核验单百度推广代理商利润
  • 无锡 学校网站建设常州seo外包
  • 三亚网站制作重庆网络营销
  • 想学网站制作交换链接是什么意思
  • wordpress 微博评论插件南京关键词优化服务
  • 统一身份认证平台银川seo优化
  • 网站开发 网页设计北京师范大学出版社网站seo置顶 乐云践新专家