11 KiB
Shadow Editor
English / 中文
- 名称:Shadow Editor
- 版本:v0.5.4(即将发布)
- 简介:基于Three.js、Go语言和MongoDB的跨平台的3D场景编辑器。
- 源码:GitHub Gitee | 文档:Gitee | 示例:GitHub Gitee | 视频:微博 Bilibili | 资源:百度网盘
- 技术栈:html、css、javascript、rollup、react.js、webgl、three.js、golang、MongoDB。
- 如果对您有帮助,请【捐赠】支持项目发展。谢谢!
v0.5.4即将发布
- 使用
Electron创建Windows桌面应用程序,点击此处查看详情。
下载地址:https://github.com/tengge1/ShadowEditor/releases/download/v0.5.3/ShadowEditor-win32-x64.zip
说明:MongoDB需要Visual C++ Redistributable for Visual Studio 2015。如果无法正常使用,从这里下载并
安装:https://www.microsoft.com/en-us/download/details.aspx?id=48145
- 使用命令行在Windows上安装和启动ShadowEditor服务。
.\ShadowEditor install: 在Windows上安装服务。
.\ShadowEditor remove: 在Windows上移除服务。
.\ShadowEditor start: 在Windows上启动服务。
.\ShadowEditor stop: 在Windows上停止服务。
你也可以在Windows服务管理器中管理这个服务。
- 使用
nodejs重写脚本,现在你可以使用npm管理这个项目。
v0.5.3发布
- 发布日期:2020年6月14日
- 更新日志:
- 修复windows上上传模型和发布场景bug。
- 添加开源项目链接。
- THREE.js数学模块翻译为Go语言,点此查看详情。
- 使用Travis CI作为持续集成工具。
- 注释掉index.html文件中的ServiceWorker,因为它带来了很多问题。
功能特点
- 跨平台:支持
Windows、Linux和Mac;支持桌面版和Web版。 - 支持多种3D格式:
3ds,3mf,amf,assimp(anim),awd,babylon,binary,bvh(anim),collada,ctm,draco,fbx(anim),gcode,gltf(gltf和glb, anim),js(anim),kmz,lmesh(anim),md2,mmd(pmd和pmx, anim),nrrd,obj,pcd,pdb,ply,prwm,sea3d(anim),stl,vrm,vrml,vtk,X. (anim)表示支持动画。 - 内置物体:组;平面、正方体、圆、圆柱体、球体、二十面体、圆环面、圆环结、茶壶、车床;不缩放文字、三维文字;线段、CatmullRom曲线、二次贝塞尔曲线、三次贝塞尔曲线、椭圆曲线;点标注;箭头帮助器、轴帮助器;精灵。
- 内置光源:环境光、平行光、点光源、聚光灯、半球光、矩形光。
- 内置组件:背景音乐、粒子发射器、天空、火焰、水、烟、布、柏林地形、天空球。
- 支持材质:线条材质、虚线材质、基本材质、深度材质、法向量材质、兰伯特材质、冯氏材质、点云材质、标准材质、物理材质、精灵材质、着色器材质、原始着色器材质。
- 编辑
javascript、着色器程序和json,具有智能提示。 - 实时播放器可以播放场景中的动画。
- 导出
gltf、obj、ply、stl、Collada、DRACO模型。 - 将场景发布成静态资源,可以嵌入
iframe中。 - 支持语言:
English、中文、繁體中文、日本語、한국어、русский、Le français。 - 场景版本管理:支持历史记录和日志、撤销和重做,自动保存。
- 权限管理:组织机构、用户、角色、权限、注册、登录、修改密码。
- 资源管理:场景、模型、贴图、材质、音频、动画、截图、录制视频、字体。
需求
- MongoDB v3.6.8+
- Chrome 81.0+ 或者 Firefox 75.0+
下面的软件仅在从源码编译时才需要。
- Golang 1.14.2+
- NodeJS 14.1+
- gcc 9.3.0+ (Windows上需要安装
tdm-gcc、MinGW-w64或MinGW。请保证gcc可以通过命令行访问) - git 2.25.1+
注意 版本号仅供参考。
下载和编译
你可以使用git下载源码。
git clone https://github.com/tengge1/ShadowEditor.git
在国内,由于github比较慢,可以使用gitee。
git clone https://gitee.com/tengge1/ShadowEditor.git
在Windows和Ubuntu上构建
- 如果你在国内, 执行
npm run set-proxy设置go语言和nodejs代理。 - 执行
npm install安装nodejs依赖。 - 执行
npm run build构建服务端和Web端。 - 编辑
build/config.toml,修改MongoDB的host和port设置。 - 执行
npm run start启动服务端。现在你可以访问:http://localhost:2020。
安装为Windows服务
- 以管理员身份在
build文件夹中打开PowerShell或cmd。 - 运行
.\ShadowEditor install,将ShadowEditor安装为服务。 - 运行
.\ShadowEditor start,启动ShadowEditor服务。 - 现在你可以访问:
http://localhost:2020。 - 你也可以在
Windows服务管理器中管理这个服务。
安装为Ubuntu服务
- 编辑
./scripts/service_linux/shadoweditor.service,设置正确的路径。 - 执行
sudo cp ./scripts/service_linux/shadoweditor.service /etc/systemd/system/。 - 执行
sudo systemctl daemon-reload重新加载服务守护程序。 - 执行
sudo systemctl start shadoweditor启动服务。 - 执行
sudo systemctl enable shadoweditor设置开机自启动。
创建Windows桌面应用程序
点击此处查看如何使用Electron创建Windows桌面应用程序。
命令行使用
PS E:\github\ShadowEditor\server> .\shadoweditor
ShadowEditor is a 3D scene editor based on three.js, golang and mongodb.
This application uses mongodb to store data.
Usage:
ShadowEditor [command]
Available Commands:
debug Debug service on Windows
help Help about any command
install Install service on Windows
serve Start server
start Start service on Windows
stop Stop service on Windows
version Print the version number
Flags:
--config string config file (default "./config.toml")
-h, --help help for ShadowEditor
Use "ShadowEditor [command] --help" for more information about a command.
开发指南
- 下载并安装
NodeJs,golang,MongoDB和Visual Studio Code. - 推荐安装以下VSCode扩展, 它们对开发很有用。
ESLint, Go, Shader languages support for VS Code, TOML Language Support.
参与贡献
ShadowEditor是一个为用户和开发者而生的项目。在这个项目上,你可以提交代码,尝试你的想法。没有报酬,但是有很多乐趣。提交代码,你需要:
- Fork 本仓库。
- 新建 Feat_xxx 分支。
- 提交代码。
- 新建 Pull Request。
注意: 不要提交大的二进制文件,否则可能会被拒绝。如果需要,你可以把想忽略的文件或目录添加到.gitignore文件中。
常见问题
- 上传模型失败。
需要把模型贴图等资源压缩成一个zip包,而且入口文件不能嵌套文件夹。服务端会解压上传的zip包到./build/public/Upload/Model文件夹,并在MongoDB _Mesh表里添加一条记录。
- 如何将多个模型组合在一起?
基本几何体都支持多层嵌套。可以添加一个组(在几何体菜单中),然后在场景树状图上,将多个模型拖动到组上。
- 如何开启权限系统?
编辑config.toml文件,将authority.enabled设置为true。默认管理员用户名是admin,密码是123456。
- 前端报
asm.js 已被禁用,因为脚本调试程序已连接。请断开调试程序的连接,以启用 asm.js。的错误。
完整错误:asm.js 已被禁用,因为脚本调试程序已连接。请断开调试程序的连接,以启用 asm.js。 ammo.js (1,1) SCRIPT1028: SCRIPT1028: Expected identifier, string or number ShadowEditor.js (3948,8) SCRIPT5009: 'Shadow' is not defined。
解决方法:腾讯浏览器不支持使用Emscripten编译的ammo.js(WebAssembly),建议换成谷歌浏览器或火狐浏览器。
- 怎么从C#版本升级到golang版本?
数据结构和客户端都没变,只需要把文件夹./ShadowEditor.Web/Upload/复制到build/public/Upload/即可。
开源项目
感谢以下开源项目。
https://github.com/golang/go
https://github.com/BurntSushi/toml
https://github.com/dgrijalva/jwt-go
https://github.com/dimfeld/httptreemux
https://github.com/inconshreveable/mousetrap
https://github.com/json-iterator/go
https://github.com/mozillazg/go-pinyin
https://github.com/otiai10/copy
https://github.com/sirupsen/logrus
https://github.com/spf13/cobra
https://github.com/spf13/viper
https://github.com/urfave/negroni
https://go.mongodb.org/mongo-driver
https://github.com/facebook/react
https://github.com/mrdoob/three.js
https://github.com/rollup/rollup
https://github.com/babel/babel
https://github.com/eslint/eslint
https://github.com/rollup/rollup-plugin-babel
https://github.com/rollup/rollup-plugin-commonjs
https://github.com/rollup/rollup-plugin-json
https://github.com/rollup/rollup-plugin-node-resolve
https://github.com/egoist/rollup-plugin-postcss
https://github.com/rollup/rollup-plugin-replace
https://github.com/tweenjs/tween.js
https://github.com/JedWatson/classnames
https://github.com/d3/d3-dispatch
https://github.com/i18next/i18next
https://github.com/js-cookie/js-cookie
https://github.com/facebook/prop-types
https://github.com/codemirror/CodeMirror
https://github.com/jquery/esprima
https://github.com/tschw/glslprep.js
https://github.com/zaach/jsonlint
https://github.com/acornjs/acorn
https://github.com/kripken/ammo.js
https://github.com/dataarts/dat.gui
https://github.com/toji/gl-matrix
https://github.com/squarefeet/ShaderParticleEngine
https://github.com/mrdoob/stats.js
https://github.com/mrdoob/texgen.js
https://github.com/yomotsu/VolumetricFire
