Skip to content

Commit 6a4014e

Browse files
committed
Merge pull request #880 from SCIInstitute/intermittent-trans
Intermittent trans
2 parents e29df99 + 38adca7 commit 6a4014e

File tree

5 files changed

+33
-51
lines changed

5 files changed

+33
-51
lines changed

src/Interface/Modules/Render/ES/SRInterface.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ namespace SCIRun {
9696

9797
showOrientation_ = true;
9898
autoRotate_ = false;
99-
mRenderSortType = RenderState::TransparencySortType::CONTINUOUS_SORT;
99+
mRenderSortType = RenderState::TransparencySortType::UPDATE_SORT;
100100
// Construct ESCore. We will need to bootstrap the core. We should also
101101
// probably add utility static classes.
102102
setupCore();

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

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,19 @@ class RenderBasicSysTrans :
8383
public:
8484
std::string mName;
8585
GLuint mSortedID;
86+
Core::Geometry::Vector prevDir = Core::Geometry::Vector(0.0);
8687

8788
SortedObject() :
8889
mSortedID(0)
8990
{}
9091

91-
SortedObject(const std::string& name, GLuint ID) :
92+
SortedObject(const std::string& name, GLuint ID, Core::Geometry::Vector& dir) :
9293
mName(name),
93-
mSortedID(ID)
94+
mSortedID(ID),
95+
prevDir(dir)
9496
{}
9597
};
9698

97-
Core::Geometry::Vector prevDir = Core::Geometry::Vector(0.0);
9899
std::vector<SortedObject> sortedObjects;
99100

100101
class DepthIndex {
@@ -214,13 +215,8 @@ class RenderBasicSysTrans :
214215
GLuint iboID = ibo.front().glid;
215216

216217
Core::Geometry::Vector dir(camera.front().data.worldToView[0][2],
217-
camera.front().data.worldToView[1][2],
218-
camera.front().data.worldToView[2][2]);
219-
220-
if (sortedObjects.size() <= 0)
221-
{
222-
prevDir = dir;
223-
}
218+
camera.front().data.worldToView[1][2],
219+
camera.front().data.worldToView[2][2]);
224220

225221
if (!drawLines)
226222
{
@@ -229,7 +225,6 @@ class RenderBasicSysTrans :
229225
case RenderState::TransparencySortType::CONTINUOUS_SORT:
230226
{
231227
iboID = sortObjects(dir, ibo, pass, iboMan);
232-
//std::cout << "continuous" << std::endl;
233228
break;
234229
}
235230
case RenderState::TransparencySortType::UPDATE_SORT:
@@ -247,22 +242,21 @@ class RenderBasicSysTrans :
247242
if (!indexed)
248243
{
249244
index = sortedObjects.size();
250-
sortedObjects.push_back(SortedObject(pass.front().ibo.name, 0));
245+
sortedObjects.push_back(SortedObject(pass.front().ibo.name, 0, dir));
251246
}
252247

253-
Core::Geometry::Vector diff = prevDir - dir;
254-
float distance = sqrtf(Core::Geometry::Dot(diff, diff));
248+
Core::Geometry::Vector diff = sortedObjects[index].prevDir - dir;
249+
double distance = sqrtf(Core::Geometry::Dot(diff, diff));
255250
if (distance >= 1.23 || sortedObjects[index].mSortedID == 0)
256251
{
257252
if (sortedObjects[index].mSortedID != 0)
258253
{
259254
iboMan.front().instance->removeInMemoryIBO(sortedObjects[index].mSortedID);
260255
}
261-
prevDir = dir;
256+
sortedObjects[index].prevDir = dir;
262257
sortedObjects[index].mSortedID = sortObjects(dir, ibo, pass, iboMan);
263258
}
264259
iboID = sortedObjects[index].mSortedID;
265-
//::cout << "update" << std::endl;
266260
break;
267261
}
268262
case RenderState::TransparencySortType::LISTS_SORT:
@@ -291,11 +285,6 @@ class RenderBasicSysTrans :
291285
iboNegZID = it->glid;
292286
}
293287

294-
Core::Geometry::Vector currentDir(camera.front().data.worldToView[0][2],
295-
camera.front().data.worldToView[1][2],
296-
camera.front().data.worldToView[2][2]);
297-
298-
299288
Core::Geometry::Vector absDir(abs(camera.front().data.worldToView[0][2]),
300289
abs(camera.front().data.worldToView[1][2]),
301290
abs(camera.front().data.worldToView[2][2]));
@@ -305,17 +294,16 @@ class RenderBasicSysTrans :
305294

306295
if (orZ == absDir.x())
307296
{
308-
iboID = currentDir.x() < orZ ? iboNegXID : iboXID;
297+
iboID = dir.x() < orZ ? iboNegXID : iboXID;
309298
}
310299
if (orZ == absDir.y())
311300
{
312-
iboID = currentDir.y() < orZ ? iboNegYID : iboYID;
301+
iboID = dir.y() < orZ ? iboNegYID : iboYID;
313302
}
314303
if (orZ == absDir.z())
315304
{
316-
iboID = currentDir.z() < orZ ? iboNegZID : iboZID;
305+
iboID = dir.z() < orZ ? iboNegZID : iboZID;
317306
}
318-
//std::cout << "lists" << std::endl;
319307
break;
320308
}
321309
}

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

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,19 @@ class RenderColorMapSysTrans :
8080
public:
8181
std::string mName;
8282
GLuint mSortedID;
83+
Core::Geometry::Vector prevDir = Core::Geometry::Vector(0.0);;
8384

8485
SortedObject() :
8586
mSortedID(0)
8687
{}
8788

88-
SortedObject(const std::string& name, GLuint ID) :
89+
SortedObject(const std::string& name, GLuint ID, Core::Geometry::Vector& dir) :
8990
mName(name),
90-
mSortedID(ID)
91+
mSortedID(ID),
92+
prevDir(dir)
9193
{}
9294
};
9395

94-
Core::Geometry::Vector prevDir = Core::Geometry::Vector(0.0);
9596
std::vector<SortedObject> sortedObjects;
9697

9798
class DepthIndex {
@@ -214,20 +215,14 @@ class RenderColorMapSysTrans :
214215
Core::Geometry::Vector dir(camera.front().data.worldToView[0][2],
215216
camera.front().data.worldToView[1][2],
216217
camera.front().data.worldToView[2][2]);
217-
218-
if (sortedObjects.size() <=0)
219-
{
220-
prevDir = dir;
221-
}
222-
218+
223219
if (!drawLines)
224220
{
225221
switch (pass.front().renderState.mSortType)
226222
{
227223
case RenderState::TransparencySortType::CONTINUOUS_SORT:
228224
{
229225
iboID = sortObjects(dir, ibo, pass, iboMan);
230-
//std::cout << "continuous" << std::endl;
231226
break;
232227
}
233228
case RenderState::TransparencySortType::UPDATE_SORT:
@@ -245,22 +240,21 @@ class RenderColorMapSysTrans :
245240
if (!indexed)
246241
{
247242
index = sortedObjects.size();
248-
sortedObjects.push_back(SortedObject(pass.front().ibo.name, 0));
243+
sortedObjects.push_back(SortedObject(pass.front().ibo.name, 0, dir));
249244
}
250245

251-
Core::Geometry::Vector diff = prevDir - dir;
252-
float distance = sqrtf(Core::Geometry::Dot(diff, diff));
246+
Core::Geometry::Vector diff = sortedObjects[index].prevDir - dir;
247+
double distance = sqrtf(Core::Geometry::Dot(diff, diff));
253248
if (distance >= 1.23 || sortedObjects[index].mSortedID == 0)
254249
{
255250
if (sortedObjects[index].mSortedID != 0)
256251
{
257252
iboMan.front().instance->removeInMemoryIBO(sortedObjects[index].mSortedID);
258253
}
259-
prevDir = dir;
254+
sortedObjects[index].prevDir = dir;
260255
sortedObjects[index].mSortedID = sortObjects(dir, ibo, pass, iboMan);
261256
}
262257
iboID = sortedObjects[index].mSortedID;
263-
//::cout << "update" << std::endl;
264258
break;
265259
}
266260
case RenderState::TransparencySortType::LISTS_SORT:
@@ -289,11 +283,6 @@ class RenderColorMapSysTrans :
289283
iboNegZID = it->glid;
290284
}
291285

292-
Core::Geometry::Vector currentDir(camera.front().data.worldToView[0][2],
293-
camera.front().data.worldToView[1][2],
294-
camera.front().data.worldToView[2][2]);
295-
296-
297286
Core::Geometry::Vector absDir(abs(camera.front().data.worldToView[0][2]),
298287
abs(camera.front().data.worldToView[1][2]),
299288
abs(camera.front().data.worldToView[2][2]));
@@ -303,17 +292,16 @@ class RenderColorMapSysTrans :
303292

304293
if (orZ == absDir.x())
305294
{
306-
iboID = currentDir.x() < orZ ? iboNegXID : iboXID;
295+
iboID = dir.x() < orZ ? iboNegXID : iboXID;
307296
}
308297
if (orZ == absDir.y())
309298
{
310-
iboID = currentDir.y() < orZ ? iboNegYID : iboYID;
299+
iboID = dir.y() < orZ ? iboNegYID : iboYID;
311300
}
312301
if (orZ == absDir.z())
313302
{
314-
iboID = currentDir.z() < orZ ? iboNegZID : iboZID;
303+
iboID = dir.z() < orZ ? iboNegZID : iboZID;
315304
}
316-
//std::cout << "lists" << std::endl;
317305
break;
318306
}
319307
}

src/Interface/Modules/Render/ViewSceneControls.ui

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
<string>Continuous Sort</string>
103103
</property>
104104
<property name="checked">
105-
<bool>true</bool>
105+
<bool>false</bool>
106106
</property>
107107
</widget>
108108
<widget class="QRadioButton" name="updateSortRadioButton_">
@@ -117,6 +117,9 @@
117117
<property name="text">
118118
<string>Intermittent Sort</string>
119119
</property>
120+
<property name="checked">
121+
<bool>true</bool>
122+
</property>
120123
</widget>
121124
<widget class="QRadioButton" name="listSortRadioButton_">
122125
<property name="geometry">

src/Interface/Modules/Render/ViewSceneControlsDock.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ ViewSceneControlsDock::ViewSceneControlsDock(const QString& name, ViewSceneDialo
6868
//View Tab
6969
groupBox->setVisible(false);
7070

71+
//Render Tab
72+
groupBox_6->setVisible(false);
73+
7174
}
7275

7376
void ViewSceneControlsDock::setSampleColor(const QColor& color)

0 commit comments

Comments
 (0)