1 Star 1 Fork 41

gfvre/Simple3DEditor

forked from 林博珩/Simple3DEditor 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.h 2.59 KB
一键复制 编辑 原始数据 按行查看 历史
林博珩 提交于 2022-03-09 21:13 . update
#ifndef __MAIN__
#define __MAIN__
#include <define.h>
#include <utils/List.h>
#include <utils/os/AppFrame.h>
#include <utils/math3d/LinearAlgebra.h>
//TODO 补全撤销功能
interface IUndo : public Object {
public:
virtual void Execute() = 0;
};
//TODO 可加入窗口内拖拽功能
class LocalData final : public Object {
public:
Vector2 cursorPos;
Vector2 cliSize;
float aspect;
Menu* menu = NULL;
Vector2 menuPos;
// 这两种对象在单个窗口中唯一
AudioListenerObject* audioListener = NULL;
CameraObject* camera = NULL;
LocalData();
~LocalData();
static LocalData* GetLocalInst();
void UpdateCursor(int x, int y);
void UpdateWindowSize(int x, int y);
void SetMenu(Menu* m);
void OnLeftDown(int x, int y);
void OnLeftUp(int x, int y);
void OnRightDown(int x, int y);
void OnRightUp(int x, int y);
void OnMenuAccel(int id, bool accel);
void Render();
void CreateAudioListener();
void CreateCamera();
void DestoryAudioListener();
void DestoryCamera();
};
//TODO 可加入全局拖拽功能,在窗口之间传送数据
class GlobalData final : public Object {
public:
enum SelectionType {
SELECT_OBJECT,
SELECT_VERTICES,
SELECT_EDGES,
SELECT_FACES
};
Vector3 audioPos = Vector3::zero;
float animFrame = 0.0f;
// 总场景对象
AViewObject* scene = NULL;
// 当前选中的对象
AViewObject* curObject = NULL;
// 选择部分
//TODO 以后将选择部分信息移入线程本地
SelectionType selType = SELECT_OBJECT;
List<AViewObject*> selObjects;
List<Vertex*> selPoints;
List<Edge*> selEdges;
List<Face*> selFaces;
GlobalData();
~GlobalData();
void SelectObject(AViewObject* o);
void SelectType(GlobalData::SelectionType type);
void OnAnimationFrame(float frame);
};
class Main final : public Object {
public:
static Main* inst;
static GlobalData* data;
Main();
~Main();
static void RequestRender();
static void SetCursor(int id);
static void SetCursor(const char* res);
static void SetMenu(Menu* m);
static void SelectObject(AViewObject* o);
static void SelectType(GlobalData::SelectionType type);
static void AddObject(AViewObject* o);
static void DeleteObject(AViewObject* o);
static void OnAnimationFrame(float frame);
static void SaveImage(String file, GLRect rect);
static void RenderAnimation(String dir, size_t start, size_t end, GLRect rect);
static Mesh* GetMesh();
int MainEntry(int argc, char** argv);
};
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/gfvre/simple3-deditor.git
git@gitee.com:gfvre/simple3-deditor.git
gfvre
simple3-deditor
Simple3DEditor
AVdevelop

搜索帮助