109 |
enum { NTrans = 3 }; |
enum { NTrans = 3 }; |
110 |
|
|
111 |
int ndice; |
int ndice; |
112 |
|
int flags; |
113 |
|
|
114 |
template<class T> float crad(const T &t) const { |
template<class T> float crad(const T &t) const { |
115 |
return t.getSqSize().x; |
return t.getSqSize().x; |
125 |
} |
} |
126 |
|
|
127 |
template<class F> void params(F &f) { |
template<class F> void params(F &f) { |
128 |
f(ndice); |
f(ndice, flags); |
129 |
} |
} |
130 |
template<class T> void render(const T &t0, const T &t1, const T &t2) |
template<class T> void render(const T &t0, const T &t1, const T &t2) |
131 |
const { |
const { |
133 |
ZVec p1 = t1.transform(t1.getSqSize()) ; |
ZVec p1 = t1.transform(t1.getSqSize()) ; |
134 |
ZVec p2 = t2.transform(t2.getSqSize()) ; |
ZVec p2 = t2.transform(t2.getSqSize()) ; |
135 |
|
|
136 |
Vec ctr = p0; |
ZVec ctr = p0; |
137 |
Vec v1 = p1 - ctr; |
Vec v1 = p1 - ctr; |
138 |
Vec v2 = p2 - ctr; |
Vec v2 = p2 - ctr; |
139 |
|
|
157 |
"\n"; |
"\n"; |
158 |
|
|
159 |
FilletSpan sp(ctr, csize, |
FilletSpan sp(ctr, csize, |
160 |
a1, d1, th1, |
a1, d1, th1, p1.z, |
161 |
a2, d2, th2); |
a2, d2, th2, p2.z); |
162 |
// Render it. XXX -- jvk, you need to make this |
// Render it. XXX -- jvk, you need to make this |
163 |
// render the solid fillet. |
// render the solid fillet. |
164 |
if(sp.split()) { |
if(sp.split()) { |
177 |
} |
} |
178 |
glEnd(); |
glEnd(); |
179 |
} else { |
} else { |
180 |
glBegin(GL_LINE_STRIP); |
if(flags & 1) { |
181 |
for(float f = 0; f < 1; f+= 1.0 / ndice) { |
ZVec intern; |
182 |
Vec p = sp.point(f, BlendSimply()); |
glBegin(GL_QUAD_STRIP); |
183 |
glVertex3f(p.x, p.y, |
for(float f = 0; f < 1; f+= 1.0 / ndice) { |
184 |
(f < .5 ? |
ZVec p = sp.point(f, BlendSimply(), &intern); |
185 |
lerp(p1.z, p0.z, 2*f) : |
glVertex(p); |
186 |
lerp(p2.z, p0.z, 2*(1-f)) ) |
glVertex(intern); |
187 |
); |
} |
188 |
|
glEnd(); |
189 |
|
} |
190 |
|
if(flags & 2) { |
191 |
|
glBegin(GL_LINE_STRIP); |
192 |
|
for(float f = 0; f < 1; f+= 1.0 / ndice) { |
193 |
|
ZVec p = sp.point(f, BlendSimply(), 0); |
194 |
|
glVertex(p); |
195 |
|
} |
196 |
|
glEnd(); |
197 |
} |
} |
|
glEnd(); |
|
198 |
} |
} |
199 |
} |
} |
200 |
}; |
}; |