-
Notifications
You must be signed in to change notification settings - Fork 17
/
TFile.h
93 lines (81 loc) · 2.32 KB
/
TFile.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
/* This file is part of TSRE5.
*
* TSRE5 - train sim game engine and MSTS/OR Editors.
* Copyright (C) 2016 Piotr Gadecki <pgadecki@gmail.com>
*
* Licensed under GNU General Public License 3.0 or later.
*
* See LICENSE.md or https://www.gnu.org/licenses/gpl.html
*/
#include "FileBuffer.h"
#include <QString>
#include <unordered_map>
#ifndef TFILE_H
#define TFILE_H
class TFile {
public:
struct Mat {
QString* tex[2];
QString* name = NULL;
int atex[2][2];
int itex[2][4];
int count153 = 0;
int count155 = 0;
Mat(){
tex[0] = NULL;
tex[1] = NULL;
}
};
bool loaded = false;
bool used = false;
float* tdata = NULL;
float* errorBias = NULL;
//mat* materials;
std::unordered_map<int, Mat> materials;
std::unordered_map<int, Mat> amaterials;
int* flags;
float WSW = 0;
float WSE = 0;
float WNE = 0;
float WNW = 0;
float* errthresholdScale = NULL;
float* alwaysselectMaxdist = NULL;
int* nsamples = NULL;
float* sampleRotation = NULL;
float* sampleSize = NULL;
float floor;
float scale;
bool waterLevel = false;
int materialsCount = 0;
QString* sampleFbuffer = NULL;
QString* sampleYbuffer = NULL;
QString* sampleEbuffer = NULL;
QString* sampleNbuffer = NULL;
char* sampleASbuffer = NULL;
int patchsetDistance;
int patchsetNpatches;
TFile();
TFile(const TFile& orig);
virtual ~TFile();
bool readT(QString fSfile);
void load(FileBuffer* data);
void save(QString name);
void save(QDataStream &write);
int newMat();
int cloneMat(int id);
int getMatByTexture(QString tname);
void removeMat(int id);
void setBufferNames(QString name);
void initNew(QString name, int samples, int sampleS, int patches);
private:
void get139(FileBuffer* data, int length);
void get151(FileBuffer* data);
void get153(FileBuffer* data, TFile::Mat* m);
void get156(FileBuffer* data, TFile::Mat* m);
void get157(FileBuffer* data);
void get163(FileBuffer* data, int n);
void get251(FileBuffer* data);
void print();
int cloneAMat(int id);
};
#endif /* TFILE_H */