17 }; |
17 }; |
18 |
18 |
19 // ============================================================================= |
19 // ============================================================================= |
20 // LDObject constructors |
20 // LDObject constructors |
21 LDObject::LDObject () { |
21 LDObject::LDObject () { |
22 |
22 commonInit (); |
|
23 } |
|
24 |
|
25 void LDObject::commonInit () { |
|
26 qObjListEntry = nullptr; |
23 } |
27 } |
24 |
28 |
25 LDGibberish::LDGibberish () { |
29 LDGibberish::LDGibberish () { |
26 |
30 commonInit (); |
27 } |
31 } |
28 |
32 |
29 LDGibberish::LDGibberish (str _zContent, str _zReason) { |
33 LDGibberish::LDGibberish (str _zContent, str _zReason) { |
30 zContent = _zContent; |
34 zContents = _zContent; |
31 zReason = _zReason; |
35 zReason = _zReason; |
|
36 |
|
37 commonInit (); |
32 } |
38 } |
33 |
39 |
34 LDEmpty::LDEmpty () { |
40 LDEmpty::LDEmpty () { |
35 |
41 commonInit (); |
36 } |
42 } |
37 |
43 |
38 LDComment::LDComment () { |
44 LDComment::LDComment () { |
39 |
45 commonInit (); |
40 } |
46 } |
41 |
47 |
42 LDSubfile::LDSubfile () { |
48 LDSubfile::LDSubfile () { |
43 |
49 commonInit (); |
44 } |
50 } |
45 |
51 |
46 LDLine::LDLine () { |
52 LDLine::LDLine () { |
47 |
53 commonInit (); |
48 } |
54 } |
49 |
55 |
50 LDTriangle::LDTriangle () { |
56 LDTriangle::LDTriangle () { |
51 |
57 commonInit (); |
52 } |
58 } |
53 |
59 |
54 LDQuad::LDQuad () { |
60 LDQuad::LDQuad () { |
55 |
61 commonInit (); |
56 } |
62 } |
57 |
63 |
58 LDCondLine::LDCondLine () { |
64 LDCondLine::LDCondLine () { |
59 |
65 commonInit (); |
60 } |
66 } |
61 |
67 |
62 LDVector::LDVector () { |
68 LDVector::LDVector () { |
63 |
69 commonInit (); |
64 } |
70 } |
65 |
71 |
66 LDVertex::LDVertex () { |
72 LDVertex::LDVertex () { |
67 |
73 commonInit (); |
68 } |
74 } |
69 |
75 |
70 ulong LDObject::getIndex () { |
76 ulong LDObject::getIndex () { |
71 if (!g_CurrentFile) |
77 if (!g_CurrentFile) |
72 return -1u; |
78 return -1u; |
77 return i; |
83 return i; |
78 } |
84 } |
79 |
85 |
80 return -1u; |
86 return -1u; |
81 } |
87 } |
|
88 |
|
89 // ============================================================================= |
|
90 str LDComment::getContents () { |
|
91 return str::mkfmt ("0%s", zText.chars ()); |
|
92 } |
|
93 |
|
94 str LDLine::getContents () { |
|
95 return str::mkfmt ("2 %d %f %f %f %f %f %f", dColor, |
|
96 vaCoords[0].x, vaCoords[0].y, vaCoords[0].z, |
|
97 vaCoords[1].x, vaCoords[1].y, vaCoords[1].z); |
|
98 } |
|
99 |
|
100 str LDTriangle::getContents () { |
|
101 return str::mkfmt ("3 %d %f %f %f %f %f %f %f %f %f", dColor, |
|
102 vaCoords[0].x, vaCoords[0].y, vaCoords[0].z, |
|
103 vaCoords[1].x, vaCoords[1].y, vaCoords[1].z, |
|
104 vaCoords[2].x, vaCoords[2].y, vaCoords[2].z); |
|
105 } |
|
106 |
|
107 str LDQuad::getContents () { |
|
108 // Oh, Jesus. |
|
109 return str::mkfmt ("3 %d %f %f %f %f %f %f %f %f %f %f %f %f", dColor, |
|
110 vaCoords[0].x, vaCoords[0].y, vaCoords[0].z, |
|
111 vaCoords[1].x, vaCoords[1].y, vaCoords[1].z, |
|
112 vaCoords[2].x, vaCoords[2].y, vaCoords[2].z, |
|
113 vaCoords[3].x, vaCoords[3].y, vaCoords[3].z); |
|
114 } |
|
115 |
|
116 str LDCondLine::getContents () { |
|
117 return str::mkfmt ("3 %d %f %f %f %f %f %f %f %f %f %f %f %f", dColor, |
|
118 vaCoords[0].x, vaCoords[0].y, vaCoords[0].z, |
|
119 vaCoords[1].x, vaCoords[1].y, vaCoords[1].z, |
|
120 vaControl[0].x, vaControl[0].y, vaControl[0].z, |
|
121 vaControl[1].x, vaControl[1].y, vaControl[1].z); |
|
122 } |
|
123 |
|
124 str LDGibberish::getContents () { |
|
125 return zContents; |
|
126 } |
|
127 |
|
128 str LDSubfile::getContents () { |
|
129 return str::mkfmt ("1 %d %f %f %f %f %f %f %f %f %f %f %f %f %s", dColor, |
|
130 vPosition.x, vPosition.y, vPosition.y, |
|
131 faMatrix[0], faMatrix[1], faMatrix[2], |
|
132 faMatrix[3], faMatrix[4], faMatrix[5], |
|
133 faMatrix[6], faMatrix[7], faMatrix[8], |
|
134 zFileName.chars()); |
|
135 } |
|
136 |
|
137 str LDVector::getContents () { |
|
138 return str::mkfmt ("0 !LDFORGE VECTOR"); // TODO |
|
139 } |
|
140 |
|
141 str LDVertex::getContents () { |
|
142 return "!LDFORGE VERTEX"; // TODO |
|
143 } |
|
144 |
|
145 str LDEmpty::getContents () { |
|
146 return str (); |
|
147 } |