Skip to content

Commit a48402d

Browse files
committed
Transparent Edges work Closes #820
1 parent e7bb3c0 commit a48402d

File tree

2 files changed

+60
-40
lines changed

2 files changed

+60
-40
lines changed

src/Interface/Modules/Render/ES/systems/RenderTransBasicSys.cc

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class RenderBasicSysTrans :
101101
if (!srstate.front().state.get(RenderState::USE_TRANSPARENCY))
102102
{
103103
return;
104-
}
104+
}
105105

106106
GLuint iboID = ibo.front().glid;
107107
GLuint iboXID = ibo.front().glid;
@@ -110,6 +110,7 @@ class RenderBasicSysTrans :
110110
GLuint iboNegXID = ibo.front().glid;
111111
GLuint iboNegYID = ibo.front().glid;
112112
GLuint iboNegZID = ibo.front().glid;
113+
GLuint iboLinesID = ibo.front().glid;
113114

114115
int index = 0;
115116
for (auto it = ibo.begin(); it != ibo.end(); ++it, ++index)
@@ -126,30 +127,39 @@ class RenderBasicSysTrans :
126127
iboNegYID = it->glid;
127128
if (index == 5)
128129
iboNegZID = it->glid;
130+
if (index == 6)
131+
iboLinesID = it->glid;
129132
}
130133

131-
Core::Geometry::Vector currentDir(camera.front().data.worldToView[0][2],
132-
camera.front().data.worldToView[1][2],
133-
camera.front().data.worldToView[2][2]);
134-
135-
Core::Geometry::Vector absDir(abs(camera.front().data.worldToView[0][2]),
136-
abs(camera.front().data.worldToView[1][2]),
137-
abs(camera.front().data.worldToView[2][2]));
138-
139-
double xORy = absDir.x() > absDir.y() ? absDir.x() : absDir.y();
140-
double orZ = absDir.z() > xORy ? absDir.z() : xORy;
141-
142-
if (orZ == absDir.x())
134+
if (ibo.front().primMode == Core::Datatypes::GeometryObject::SpireIBO::LINES)
143135
{
144-
iboID = currentDir.x() < orZ ? iboNegXID : iboXID;
136+
iboID = iboLinesID;
145137
}
146-
if (orZ == absDir.y())
147-
{
148-
iboID = currentDir.y() < orZ ? iboNegYID : iboYID;
149-
}
150-
if (orZ == absDir.z())
138+
else
151139
{
152-
iboID = currentDir.z() < orZ ? iboNegZID : iboZID;
140+
Core::Geometry::Vector currentDir(camera.front().data.worldToView[0][2],
141+
camera.front().data.worldToView[1][2],
142+
camera.front().data.worldToView[2][2]);
143+
144+
Core::Geometry::Vector absDir(abs(camera.front().data.worldToView[0][2]),
145+
abs(camera.front().data.worldToView[1][2]),
146+
abs(camera.front().data.worldToView[2][2]));
147+
148+
double xORy = absDir.x() > absDir.y() ? absDir.x() : absDir.y();
149+
double orZ = absDir.z() > xORy ? absDir.z() : xORy;
150+
151+
if (orZ == absDir.x())
152+
{
153+
iboID = currentDir.x() < orZ ? iboNegXID : iboXID;
154+
}
155+
if (orZ == absDir.y())
156+
{
157+
iboID = currentDir.y() < orZ ? iboNegYID : iboYID;
158+
}
159+
if (orZ == absDir.z())
160+
{
161+
iboID = currentDir.z() < orZ ? iboNegZID : iboZID;
162+
}
153163
}
154164

155165
// Setup *everything*. We don't want to enter multiple conditional

src/Interface/Modules/Render/ES/systems/RenderTransColorMapSys.cc

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class RenderColorMapSysTrans :
110110
GLuint iboNegXID = ibo.front().glid;
111111
GLuint iboNegYID = ibo.front().glid;
112112
GLuint iboNegZID = ibo.front().glid;
113+
GLuint iboLinesID = ibo.front().glid;
113114

114115
int index = 0;
115116
for (auto it = ibo.begin(); it != ibo.end(); ++it, ++index)
@@ -126,30 +127,39 @@ class RenderColorMapSysTrans :
126127
iboNegYID = it->glid;
127128
if (index == 5)
128129
iboNegZID = it->glid;
129-
}
130-
131-
Core::Geometry::Vector currentDir(camera.front().data.worldToView[0][2],
132-
camera.front().data.worldToView[1][2],
133-
camera.front().data.worldToView[2][2]);
134-
135-
Core::Geometry::Vector absDir(abs(camera.front().data.worldToView[0][2]),
136-
abs(camera.front().data.worldToView[1][2]),
137-
abs(camera.front().data.worldToView[2][2]));
138-
139-
double xORy = absDir.x() > absDir.y() ? absDir.x() : absDir.y();
140-
double orZ = absDir.z() > xORy ? absDir.z() : xORy;
141-
142-
if (orZ == absDir.x())
143-
{
144-
iboID = currentDir.x() < orZ ? iboNegXID : iboXID;
130+
if (index == 6)
131+
iboLinesID = it->glid;
145132
}
146-
if (orZ == absDir.y())
133+
134+
if (ibo.front().primMode == Core::Datatypes::GeometryObject::SpireIBO::LINES)
147135
{
148-
iboID = currentDir.y() < orZ ? iboNegYID : iboYID;
136+
iboID = iboLinesID;
149137
}
150-
if (orZ == absDir.z())
138+
else
151139
{
152-
iboID = currentDir.z() < orZ ? iboNegZID : iboZID;
140+
Core::Geometry::Vector currentDir(camera.front().data.worldToView[0][2],
141+
camera.front().data.worldToView[1][2],
142+
camera.front().data.worldToView[2][2]);
143+
144+
Core::Geometry::Vector absDir(abs(camera.front().data.worldToView[0][2]),
145+
abs(camera.front().data.worldToView[1][2]),
146+
abs(camera.front().data.worldToView[2][2]));
147+
148+
double xORy = absDir.x() > absDir.y() ? absDir.x() : absDir.y();
149+
double orZ = absDir.z() > xORy ? absDir.z() : xORy;
150+
151+
if (orZ == absDir.x())
152+
{
153+
iboID = currentDir.x() < orZ ? iboNegXID : iboXID;
154+
}
155+
if (orZ == absDir.y())
156+
{
157+
iboID = currentDir.y() < orZ ? iboNegYID : iboYID;
158+
}
159+
if (orZ == absDir.z())
160+
{
161+
iboID = currentDir.z() < orZ ? iboNegZID : iboZID;
162+
}
153163
}
154164

155165
// Setup *everything*. We don't want to enter multiple conditional

0 commit comments

Comments
 (0)