add README.md
This commit is contained in:
@ -352,48 +352,51 @@ namespace Prism
|
||||
e.NewName = Utils::RemoveExtension(e.NewName);
|
||||
e.OldName = Utils::RemoveExtension(e.OldName);
|
||||
|
||||
AssetHandle parentHandle = FindParentHandle(e.FilePath);
|
||||
const AssetHandle parentHandle = FindParentHandle(e.FilePath);
|
||||
|
||||
switch (e.Action)
|
||||
if (std::filesystem::path(e.FilePath).extension() != ".meta")
|
||||
{
|
||||
case FileSystemAction::Added:
|
||||
switch (e.Action)
|
||||
{
|
||||
if (e.IsDirectory)
|
||||
ProcessDirectory(e.FilePath, parentHandle);
|
||||
else
|
||||
ImportAsset(e.FilePath, parentHandle);
|
||||
}
|
||||
break;
|
||||
case FileSystemAction::Modified:
|
||||
{
|
||||
if (!e.IsDirectory)
|
||||
ImportAsset(e.FilePath, parentHandle);
|
||||
}
|
||||
break;
|
||||
case FileSystemAction::Rename:
|
||||
{
|
||||
for (auto it = s_LoadedAssets.begin(); it != s_LoadedAssets.end(); it++)
|
||||
case FileSystemAction::Added:
|
||||
{
|
||||
if (it->second->FileName == e.OldName)
|
||||
if (e.IsDirectory)
|
||||
ProcessDirectory(e.FilePath, parentHandle);
|
||||
else
|
||||
ImportAsset(e.FilePath, parentHandle);
|
||||
}
|
||||
break;
|
||||
case FileSystemAction::Modified:
|
||||
{
|
||||
if (!e.IsDirectory)
|
||||
ImportAsset(e.FilePath, parentHandle);
|
||||
}
|
||||
break;
|
||||
case FileSystemAction::Rename:
|
||||
{
|
||||
for (auto it = s_LoadedAssets.begin(); it != s_LoadedAssets.end(); it++)
|
||||
{
|
||||
it->second->FilePath = e.FilePath;
|
||||
it->second->FileName = e.NewName;
|
||||
if (it->second->FileName == e.OldName)
|
||||
{
|
||||
it->second->FilePath = e.FilePath;
|
||||
it->second->FileName = e.NewName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FileSystemAction::Delete:
|
||||
{
|
||||
for (auto it = s_LoadedAssets.begin(); it != s_LoadedAssets.end(); it++)
|
||||
break;
|
||||
case FileSystemAction::Delete:
|
||||
{
|
||||
if (it->second->FilePath != e.FilePath)
|
||||
continue;
|
||||
for (auto it = s_LoadedAssets.begin(); it != s_LoadedAssets.end(); it++)
|
||||
{
|
||||
if (it->second->FilePath != e.FilePath)
|
||||
continue;
|
||||
|
||||
RemoveAsset(it->first);
|
||||
break;
|
||||
RemoveAsset(it->first);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
128
README.md
Normal file
128
README.md
Normal file
@ -0,0 +1,128 @@
|
||||
# Prism Engine
|
||||
|
||||
Prism 是一个基于**实体-组件系统 (ECS)** 的轻量级 3D 编辑引擎,整合了 2D 与 3D 渲染管线、物理模拟 (PhysX/Box2D) 以及 C# 脚本支持。
|
||||
|
||||
---
|
||||
|
||||
## ✨ 特性
|
||||
|
||||
- **混合渲染**
|
||||
支持 2D 与 3D 渲染管线,基于 OpenGL 实现。
|
||||
- **ECS 架构**
|
||||
使用 `entt` 作为核心 ECS 库,组件化设计易于扩展。
|
||||
- **物理模拟**
|
||||
- 3D 物理:NVIDIA PhysX(刚体、碰撞体)
|
||||
- 2D 物理:Box2D(刚体、碰撞体、多种关节)
|
||||
- **C# 脚本**
|
||||
集成 Mono 运行时,允许使用 C# 编写实体逻辑。
|
||||
- **资产管理系统**
|
||||
支持拖拽导入模型(Assimp)、纹理(stb)等资源。
|
||||
- **编辑器界面**
|
||||
- 基于 ImGui、ImGuizmo、ImViewZmo 的编辑器面板
|
||||
- 场景层级面板、对象属性面板、资源浏览器
|
||||
- 物理调试可视化
|
||||
- **动画系统**
|
||||
支持简单骨骼动画。
|
||||
- **序列化**
|
||||
使用 YAML (yaml-cpp) 序列化场景和资产。
|
||||
- ~~**跨平台** (目前主要支持 Windows, PhysX没有成功构建)~~
|
||||
---
|
||||
|
||||
## 🧩 已实现组件
|
||||
|
||||
```cpp
|
||||
// Core
|
||||
TagComponent, RelationshipComponent, TransformComponent
|
||||
|
||||
// 2D Rendering
|
||||
SpriteRendererComponent
|
||||
|
||||
// 2D Physics
|
||||
RigidBody2DComponent, BoxCollider2DComponent, CircleCollider2DComponent,
|
||||
DistanceJoint2DComponent, RevoluteJoint2DComponent,
|
||||
PrismaticJoint2DComponent, WeldJoint2DComponent
|
||||
|
||||
// 3D Rendering
|
||||
MeshComponent, CameraComponent,
|
||||
DirectionalLightComponent, SkyLightComponent
|
||||
|
||||
// 3D Physics
|
||||
RigidBodyComponent, BoxColliderComponent, SphereColliderComponent,
|
||||
CapsuleColliderComponent, MeshColliderComponent
|
||||
|
||||
// Animation
|
||||
AnimationComponent
|
||||
|
||||
// Scripting
|
||||
ScriptComponent
|
||||
```
|
||||
|
||||
> 组件列表仍在持续扩展中。
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ 技术栈 / 依赖
|
||||
|
||||
| 领域 | 库 |
|
||||
|----------|--------------------------------------------|
|
||||
| 渲染 | OpenGL (GLAD), GLFW, GLM |
|
||||
| 2D/3D 物理 | PhysX, Box2D |
|
||||
| ECS | EnTT |
|
||||
| 脚本 | Mono (.NET) |
|
||||
| 资产加载 | Assimp, stb_image |
|
||||
| 编辑器 UI | ImGui, ImGuizmo, ImViewZmo |
|
||||
| 日志 | spdlog |
|
||||
| 序列化 | yaml-cpp |
|
||||
| 其他 | FastNoise (噪声生成), tinyfiledialogs(简单的文件打开) |
|
||||
|
||||
---
|
||||
|
||||
## 🚀 快速开始
|
||||
|
||||
### 环境要求
|
||||
- Windows 10/11 (暂未适配Linux和Max, 暂时未能在Linux成功构建PhysX的库.后面可能会考虑去看看Jolt或者Bullet)
|
||||
- MSVC C++17
|
||||
- CMake 3.10+
|
||||
- (mono 使用Net内部集成的,可以使用dotnet直接构建,目前使用版本为 8.0)
|
||||
|
||||
### 构建步骤
|
||||
|
||||
1. **克隆仓库**(包含子模块)
|
||||
```bash
|
||||
git clone --recursive https://github.com/xxx/PrismEngine.git
|
||||
```
|
||||
|
||||
2. **配置依赖**
|
||||
- PhysX SDK: Prism/CmakeLists.txt内记录了是用的PhysX的构建配置,建议手动按照配置构建SDK,构建好后无需移动文件,项目可以自动链接库
|
||||
|
||||
3. **编译**
|
||||
**Cmake**:
|
||||
```bash
|
||||
cd Prism
|
||||
cmake -B build -G Ninja
|
||||
cmake --build build --target PrismEditor --config Release -j10
|
||||
```
|
||||
|
||||
**Visual Studio**:
|
||||
visual Studio启用Cmake。 然后点击project下拉框,找到 PrismEditor,构建。
|
||||
|
||||
**JetBrain Clion**:
|
||||
clion 会自动识别Cmake, 运行调试配置找到PrismEditor构建。
|
||||
|
||||
---
|
||||
|
||||
## 📖 使用指南
|
||||
|
||||
- **创建新场景**:`File -> New Scene` 或者 `Ctrl+N`
|
||||
- **添加实体**:在场景层级面板右键 `Create Entity`
|
||||
- **添加组件**:选中实体后,在属性面板点击 `Add Component`
|
||||
- **拖拽资源**:从资源浏览器将模型/纹理拖入场景或实体
|
||||
---
|
||||
|
||||
## 🙏 致谢
|
||||
|
||||
- 感谢所有开源库的作者们
|
||||
- 感谢 Unity、Unreal 等商业引擎
|
||||
- 特别感谢 Hazel Engine 系列教程的启发
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user