89 // ============================================================================= |
90 // ============================================================================= |
90 str LDComment::getContents () { |
91 str LDComment::getContents () { |
91 return str::mkfmt ("0 %s", zText.chars ()); |
92 return str::mkfmt ("0 %s", zText.chars ()); |
92 } |
93 } |
93 |
94 |
|
95 str LDSubfile::getContents () { |
|
96 str val = str::mkfmt ("1 %d", dColor); |
|
97 val += vPosition; |
|
98 |
|
99 for (short i = 0; i < 9; ++i) { |
|
100 val += ' '; |
|
101 val += ftoa (faMatrix[i]); |
|
102 } |
|
103 |
|
104 val += ' '; |
|
105 val += zFileName; |
|
106 return val; |
|
107 } |
|
108 |
94 str LDLine::getContents () { |
109 str LDLine::getContents () { |
95 return str::mkfmt ("2 %d %f %f %f %f %f %f", dColor, |
110 str val = str::mkfmt ("2 %d", dColor); |
96 vaCoords[0].x, vaCoords[0].y, vaCoords[0].z, |
111 |
97 vaCoords[1].x, vaCoords[1].y, vaCoords[1].z); |
112 for (ushort i = 0; i < 2; ++i) |
|
113 val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ()); |
|
114 |
|
115 return val; |
98 } |
116 } |
99 |
117 |
100 str LDTriangle::getContents () { |
118 str LDTriangle::getContents () { |
101 return str::mkfmt ("3 %d %f %f %f %f %f %f %f %f %f", dColor, |
119 str val = str::mkfmt ("3 %d", dColor); |
102 vaCoords[0].x, vaCoords[0].y, vaCoords[0].z, |
120 |
103 vaCoords[1].x, vaCoords[1].y, vaCoords[1].z, |
121 for (ushort i = 0; i < 3; ++i) |
104 vaCoords[2].x, vaCoords[2].y, vaCoords[2].z); |
122 val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ()); |
|
123 |
|
124 return val; |
105 } |
125 } |
106 |
126 |
107 str LDQuad::getContents () { |
127 str LDQuad::getContents () { |
108 // Oh, Jesus. |
128 str val = str::mkfmt ("4 %d", dColor); |
109 return str::mkfmt ("4 %d %f %f %f %f %f %f %f %f %f %f %f %f", dColor, |
129 |
110 vaCoords[0].x, vaCoords[0].y, vaCoords[0].z, |
130 for (ushort i = 0; i < 4; ++i) |
111 vaCoords[1].x, vaCoords[1].y, vaCoords[1].z, |
131 val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ()); |
112 vaCoords[2].x, vaCoords[2].y, vaCoords[2].z, |
132 |
113 vaCoords[3].x, vaCoords[3].y, vaCoords[3].z); |
133 return val; |
114 } |
134 } |
115 |
135 |
116 str LDCondLine::getContents () { |
136 str LDCondLine::getContents () { |
117 return str::mkfmt ("5 %d %f %f %f %f %f %f %f %f %f %f %f %f", dColor, |
137 str val = str::mkfmt ("5 %d", dColor); |
118 vaCoords[0].x, vaCoords[0].y, vaCoords[0].z, |
138 |
119 vaCoords[1].x, vaCoords[1].y, vaCoords[1].z, |
139 // Add the coordinates of end points |
120 vaControl[0].x, vaControl[0].y, vaControl[0].z, |
140 for (ushort i = 0; i < 2; ++i) |
121 vaControl[1].x, vaControl[1].y, vaControl[1].z); |
141 val.appendformat (" %s", vaCoords[i].getStringRep (false).chars ()); |
|
142 |
|
143 // Add the control points |
|
144 for (ushort i = 0; i < 2; ++i) |
|
145 val.appendformat (" %s", vaControl[i].getStringRep (false).chars ()); |
|
146 |
|
147 return val; |
122 } |
148 } |
123 |
149 |
124 str LDGibberish::getContents () { |
150 str LDGibberish::getContents () { |
125 return zContents; |
151 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 } |
152 } |
136 |
153 |
137 str LDVector::getContents () { |
154 str LDVector::getContents () { |
138 return str::mkfmt ("0 !LDFORGE VECTOR"); // TODO |
155 return str::mkfmt ("0 !LDFORGE VECTOR"); // TODO |
139 } |
156 } |