Fix detection of transparent meshes.

SSurface::TriangulateInto first populates the mesh with triangles
that have no color, and then paints them, which confused the code
that detects if a mesh is transparent into thinking that all of them
are; and that broke the "draw back faces in red" feature, since it
is disabled for transparent meshes.
This commit is contained in:
whitequark 2016-11-18 11:00:55 +00:00
parent 73844f7202
commit 9a0f2c3601
3 changed files with 4 additions and 1 deletions

View File

@ -43,6 +43,7 @@ Other new features:
Bug fixes:
* Do not crash when applying a symmetry constraint to two points.
* Fix TTF font metrics again (properly this time).
* Fix the "draw back faces in red" option.
* Various minor crashes.
2.2

View File

@ -34,7 +34,8 @@ void SMesh::AddTriangle(STriMeta meta, Vector a, Vector b, Vector c) {
AddTriangle(&t);
}
void SMesh::AddTriangle(const STriangle *st) {
if(st->meta.color.alpha != 255) isTransparent = true;
RgbaColor color = st->meta.color;
if(!color.IsEmpty() && color.alpha != 255) isTransparent = true;
l.Add(st);
}

View File

@ -424,6 +424,7 @@ void SSurface::TriangulateInto(SShell *shell, SMesh *sm) {
for(i = start; i < sm->l.n; i++) {
STriangle *st = &(sm->l.elem[i]);
st->meta = meta;
if(st->meta.color.alpha != 255) sm->isTransparent = true;
st->an = NormalAt(st->a.x, st->a.y);
st->bn = NormalAt(st->b.x, st->b.y);
st->cn = NormalAt(st->c.x, st->c.y);