-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.h
More file actions
142 lines (123 loc) · 4.51 KB
/
main.h
File metadata and controls
142 lines (123 loc) · 4.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//--------------------------------------------------------------------------------
//
// main.h
// Author : Xu Wenjie
// Date : 2017-04-26
//--------------------------------------------------------------------------------
#pragma once
#define NOMINMAX
//--------------------------------------------------------------------------------
// インクルードファイル
//--------------------------------------------------------------------------------
#include <Windows.h>
#include <stdio.h>
//Include STL
#include <list>
#include <vector>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <sstream>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <map>
#include <unordered_map>
using namespace std;
//Cereal
#include <cereal/archives/JSON.hpp>
#include <cereal/archives/binary.hpp>
#include <cereal/types/vector.hpp>
#include <cereal/types/string.hpp>
using namespace cereal;
//FBX
#include <fbxsdk.h>
//OpenMP
//#include <omp.h>
//KF関数
#include "KF_Math.h"
#include "KF_Utility.h"
//DirectX系
#ifdef USING_DIRECTX
#include <d3dx9.h>
#define DIRECTINPUT_VERSION (0x0800)
#include <dinput.h>
#include <XAudio2.h>//sound
#endif
//--------------------------------------------------------------------------------
// ライブラリ読み込み
//--------------------------------------------------------------------------------
#ifdef USING_DIRECTX
#pragma comment(lib,"d3d9.lib")
#pragma comment(lib,"d3dx9.lib")
#pragma comment(lib,"dxguid.lib")
#pragma comment(lib,"dinput8.lib")
#endif
#pragma comment(lib,"winmm.lib") //システム時刻取得に必要
#pragma comment(lib,"libfbxsdk-mt.lib")
//--------------------------------------------------------------------------------
// 定数定義
//--------------------------------------------------------------------------------
typedef unsigned short us;
typedef unsigned long ul;
#define SAFE_RELEASE(p) if(p){ p->Release(); p=nullptr; } //safe release mode
#define SCREEN_WIDTH (1280) //ウインドウ幅
#define SCREEN_HEIGHT (720) //ウインドウ高さ
#define FRAME_PER_SECOND (60)
#define TIMER_INTERVAL (1000.0 / FRAME_PER_SECOND) //更新間隔
#define DELTA_TIME ((float)TIMER_INTERVAL * 0.001f) //更新間隔(秒単位)
#define CLASS_NAME "KF_Framework" //クラスの名前
#define WINDOW_NAME "KF_ModelAnalyzer" //ウインドウの名前
#ifdef USING_DIRECTX
#define FVF_VERTEX_2D (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1) //頂点フォーマット
#define FVF_VERTEX_3D (D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX1 ) //3D頂点フォーマット
#endif
//--------------------------------------------------------------------------------
// 前方宣言
//--------------------------------------------------------------------------------
class CManager;
//--------------------------------------------------------------------------------
// 構造体定義
//--------------------------------------------------------------------------------
typedef struct
{
CKFVec3 vPos; //xyz
float fRhw; //rhw
unsigned long ulColor;//色
CKFVec2 vUV; //テクスチャ
}VERTEX_2D;//2D頂点情報構造体 頂点フォーマットと構造を合わせること
typedef struct//頂点情報構造体 上の頂点フォーマットと構造を合わせること
{
CKFVec3 vPos; //xyz
CKFVec3 vNormal;//法線
unsigned long ulColor;//色
CKFVec2 vUV; //uv
}VERTEX_3D;//3D頂点情報構造体 頂点フォーマットと構造を合わせること
//--------------------------------------------------------------------------------
// クラス宣言
//--------------------------------------------------------------------------------
class CMain
{
public:
//--------------------------------------------------------------------------------
// 関数定義
//--------------------------------------------------------------------------------
static int Main(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR IpCmdLine, int nCmdShow);
static bool OpenModelFile(string& strFileName);
static bool OpenTextureFile(string& strTexName);
//Get関数
static CManager* GetManager(void) { return m_pManager; }
private:
//--------------------------------------------------------------------------------
// 関数定義
//--------------------------------------------------------------------------------
CMain() {}
~CMain() {}
static LRESULT CALLBACK wndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static void closeApp(HWND hWnd);
//--------------------------------------------------------------------------------
// 変数定義
//--------------------------------------------------------------------------------
static CManager* m_pManager;
static HWND m_hWnd;
};