-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3DShapeViewer.h
107 lines (82 loc) · 2.23 KB
/
3DShapeViewer.h
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
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include "framework.h"
#include "resource.h"
#include "shapefile.h"
#include "shapedata.h"
#include "quadtree.h"
#include "object.h"
#include "camera.h"
#include "utility.h"
#include <Commdlg.h>
#include <Windows.h>
#include <Windowsx.h>
#include <EGL/egl.h>
#include <GLES3/gl3.h>
#include <iostream>
#include <locale>
#include <string>
#include <codecvt>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <fstream>
#include <cstdint>
#include <stdarg.h>
#include <CommCtrl.h>
class ShapeViewer {
public:
HWND hWnd;
HINSTANCE hInst;
TCHAR szFileName[MAX_PATH];
bool keyPressed[256] = { false, };
EGLOptions eglOptions;
const int WINDOW_POS_X = 500;
const int WINDOW_POS_Y = 0;
const int WINDOW_WIDTH = 913;
const int WINDOW_HEIGHT = 956;
const float CAMERA_START_Z = 3.0f;
RenderOption renderOption;
bool drawGrid = false;
FILE* SHPFile;
bool isShapeLoaded = false;
int recordCount = 0;
float aspectRatio = 1.0f;
glm::mat4 modelMat = glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f));
shared_ptr<Camera> camera;
GLfloat minTotal[3]{ FLT_MIN, FLT_MIN, FLT_MIN };
GLfloat maxTotal[3]{ FLT_MAX, FLT_MAX, FLT_MAX };
GLfloat delTotal[3];
int startMouseX = 0, startMouseY = 0;
int totalMouseX = (895.0f / 2.0f), totalMouseY = (895.0f / 2.0f);
int mouseX = 0, mouseY = 0;
shared_ptr<ObjectData> objectData;
std::vector<shared_ptr<Object>> objects;
bool getStatus = false;
bool isFPS = false;
bool isRButtonDown = false;
bool isObjectPicked = false;
bool pickedObjectColor = false;
bool pickedObjectPrint = false;
Ray pickingRay{};
RECT rt;
ShapeViewer();
LRESULT msgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void status();
void getNdc(float x, float y, float& ndcX, float& ndcY);
bool initialize(HINSTANCE hInstance, int nCmdShow);
void render();
void cleanUp();
bool openShapefile();
bool readShapefile();
void closeShapefile();
void mouseMove(bool isFPSMode, const LPARAM& lParam);
bool isKeyPressed(char ch);
void update();
};
ShapeViewer* g_shapeViewer;
typedef unsigned char uchar;
using namespace std;