-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrunkParameters.h
More file actions
95 lines (79 loc) · 1.91 KB
/
TrunkParameters.h
File metadata and controls
95 lines (79 loc) · 1.91 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
#ifndef _TRUNK_PARAMETERS_H
#define _TRUNK_PARAMETERS_H
#include <cstring>
#include <fstream>
#include <iostream>
class TrunkParameters {
public:
#define MAXPATHLEN 256
float radiusFactor;
//liczba punktów segmentu w wygenerowanym modelu
int circlePoints;
//liczba punktów segmentu aktualnie na suwaku
//po wciśnięciu generate bądź refresh circlePoints <- circlePointsCurrentAdj
int circlePointsCurrentAdj;
float aValue;
float mValue;
char barkPath[MAXPATHLEN]; //path to bark texture
bool barkTexInitialized;
float kx; //ile razy ma sie owinac tekstura wokol pnia
float ky; //ile jednostek tekstury na jednostke pnia
static const float RADIUSFACTOR_DEFAULT=1.8;
static const float AVALUE_DEFAULT=0;
static const float MVALUE_DEFAULT=1;
static const int CIRCLEPOINTS_DEFAULT=10;
static const bool BARKTEXINITIALIZED_DEFAULT=FALSE;
static const float KX_DEFAULT=3;
static const float KY_DEFAULT=0.5;
TrunkParameters() {
setDefault();
}
void setDefault()
{
char defaultPath[]="textures/bark0_256.bmp";
strcpy(barkPath,defaultPath);
radiusFactor=RADIUSFACTOR_DEFAULT;
aValue=AVALUE_DEFAULT;
mValue=MVALUE_DEFAULT;
circlePointsCurrentAdj = CIRCLEPOINTS_DEFAULT;
barkTexInitialized=BARKTEXINITIALIZED_DEFAULT;
kx=KX_DEFAULT;
ky=KY_DEFAULT;
}
void setBarkPath(char *path) {
assert(strlen(path)<MAXPATHLEN);
strcpy(barkPath,path);
}
void setCirclePointsValue()
{
circlePoints = circlePointsCurrentAdj;
}
/* Serialization methods */
void save(ofstream &s)
{
#define SAVE(param) s<<param<<endl;
SAVE(radiusFactor);
SAVE(circlePoints);
SAVE(aValue);
SAVE(mValue);
SAVE(barkPath);
SAVE(kx);
SAVE(ky);
#undef SAVE
}
void load(ifstream &s)
{
barkTexInitialized=FALSE;
#define LOAD(param) s>>param;
LOAD(radiusFactor);
LOAD(circlePointsCurrentAdj);
LOAD(aValue);
LOAD(mValue);
LOAD(barkPath);
LOAD(kx);
LOAD(ky);
#undef LOAD
}
#undef MAXPATHLEN
};
#endif