本文主要是介绍[97编程世界冠军4K组]代码被转为ts脚本github代码如何在WIN10运行和调试,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
源代码地址:iGitHub - SuperSodaSea/Omniscent: Analysis and Replication of Omniscent, the 1st in the Mekka & Symposium 1997 PC 4K Intro Competition.
1、软件安装nodejs和webstorm都要安装:
node-v20.12.2-x64.msi
WebStorm-2024.1.1.exe
代码:
Omniscent-main.zip
我修改了些代码,gitee地址:
r77683962/Omniscent
2、nodejs安装完成后通过npm安装pnpm、tsc、rollup,有兴趣可以搜索下这些命令的功能,进入cmd执行以下命令,(建议使用管理员模式进入cmd,不然有些安装会报没有权限):
npm config set registry https://registry.npmmirror.com/
npm i -g pnpm
pnpm i tsc
pnpm i rollup
3、在webstorm设置node.js和pnpm工具地址:
File菜单->settings->Languages&Frameworks->node.js,然后使用自已安装的路径替换
node路径(这个根据自已的安装路径设置):
C:\Program Files\nodejs\node.exe
pnpm路径(这个根据自已的安装路径设置):
C:\Users\PC\AppData\Roaming\npm\pnpm.cmd
4、Omniscent-main.zip代码解压,然后使用webstorm打开解压目录(要注意被打开的目录里有src、types这些目录才对)
5、编译代码根目录package.json第25行:
"build": "rollup -c"
这行前边会有一个绿色的三角形,点击这个三角形,选择Run 'build',编译日志如下:
C:\Users\Administrator\AppData\Roaming\npm\pnpm.cmd run build
> omniscent@ build D:\projects\Omniscent_git
> rollup -c
src/index.ts → lib/cjs, lib/esm...
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme
created lib/cjs, lib/esm in 2.1s
demo/src/index.ts → dist...
created dist in 7s
Process finished with exit code 0
编译完成在根目录下会生成dist、lib、node_modules目录
6、打开根目录dist目录的index.html文件,点击右上角的Chrome图标,点击Play,就可以看到运行的3D界面了。
这个代码主要用到:three.js(3D库)
three.js在线帮助手册: https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene
参考来源:
https://blog.csdn.net/xueli_2017/article/details/91492971
这个链接也有些有意思的例子:GitHub - gkjohnson/three-mesh-bvh: A BVH implementation to speed up raycasting and enable spatial queries against three.js meshes.o
这篇关于[97编程世界冠军4K组]代码被转为ts脚本github代码如何在WIN10运行和调试的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!