-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeightMapLoaderClass.hpp
90 lines (56 loc) · 1.55 KB
/
HeightMapLoaderClass.hpp
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
#ifndef HEIGHTMAPLOADERCLASS_HPP
#define HEIGHTMAPLOADERCLASS_HPP
#include <d3d11.h>
#include <DirectXMath.h>
#include <iostream>
#include <fstream>
#include "Globals.hpp"
#include "lodepng.h"
#include "WICTextureLoader.h"
#include <iterator>
#include <codecvt>
#include <locale>
#include <string>
#include "HeightMapClass.hpp"
// V/VT/VN V/VT/VN V/VT/VN
struct FaceIndexData
{
DirectX::XMFLOAT3 Vertex1 = { 0.0f, 0.0f, 0.0f };
DirectX::XMFLOAT3 Vertex2 = { 0.0f, 0.0f, 0.0f };
DirectX::XMFLOAT3 Vertex3 = { 0.0f, 0.0f, 0.0f };
};
class HeightMapLoaderClass {
private:
std::string HeightMapFileName;
std::string HeightMapImageName;
std::wstring *HeightMapTextureName;
bool SmoothNormals;
int HeightMapWidth;
int HeightMapHeight;
int VertexCount;
int fc;
float *VertexHeightArray;
DirectX::XMFLOAT3 *TempNormalArray;
// PRIVATE FUNCTIONS
void StoreToVertexData(HeightMapVertexData *HeightMapVertexDataArray);
void ConvertToVertexData(HeightMapVertexData* *HeightMapVertexDataArray);
public:
HeightMapLoaderClass();
~HeightMapLoaderClass();
void ReleaseAll();
/* ------------- COMMENTS -------------
Loads a PNG file directly into raw pixel data, returned in
as a 'vector<unsigned char> in the following format: RGBARGBA...
*/
void LoadHeightMap(
std::vector<unsigned char> *ImageData,
HeightMapVertexData* *HeightMapVertexDataArray
);
// GET FUNCTIONS
int GetFaceCount();
int GetHeightMapWidth();
int GetHeightMapHeight();
float* GetVertexHeightArray();
std::wstring GetHeightMapTextureName(int TextureSlot);
};
#endif