Skip to content

Commit b62e7ba

Browse files
committed
Last cleanup
1 parent 0526882 commit b62e7ba

File tree

3 files changed

+54
-68
lines changed

3 files changed

+54
-68
lines changed

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

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,26 @@
7474
#include "comp/ClippingPlaneUniforms.h"
7575

7676
using namespace SCIRun;
77-
using namespace SCIRun::Core;
78-
using namespace SCIRun::Core::Datatypes;
79-
using namespace SCIRun::Graphics::Datatypes;
80-
using namespace SCIRun::Core::Geometry;
77+
using namespace Core;
78+
using namespace Datatypes;
79+
using namespace Graphics::Datatypes;
80+
using namespace Geometry;
8181

8282
using namespace std::placeholders;
83-
using namespace SCIRun::Render;
83+
using namespace Render;
8484

8585
namespace fs = spire;
8686

8787
namespace
8888
{
8989
static glm::vec4 inverseGammaCorrect(const glm::vec4& in)
9090
{
91-
return glm::vec4(glm::pow(glm::vec3(in), glm::vec3(2.2f)), in.a);
91+
return glm::vec4(pow(glm::vec3(in), glm::vec3(2.2f)), in.a);
9292
}
9393

9494
static glm::vec3 inverseGammaCorrect(const glm::vec3& in)
9595
{
96-
return glm::pow(in, glm::vec3(2.2f));
96+
return pow(in, glm::vec3(2.2f));
9797
}
9898

9999
const std::string widgetSelectFboName = "Selection:FBO:0";
@@ -147,7 +147,7 @@ void SRInterface::runGCOnNextExecution()
147147
{
148148
// Generate synchronous filesystem, manually add its static component,
149149
// then mark it as non-serializable.
150-
std::string filesystemRoot = Core::Application::Instance().executablePath().string();
150+
std::string filesystemRoot = Application::Instance().executablePath().string();
151151
filesystemRoot += boost::filesystem::path::preferred_separator;
152152
fs::StaticFS fileSystem((std::make_shared<fs::FilesystemSync>(filesystemRoot)));
153153
mCore.addStaticComponent(fileSystem);
@@ -336,7 +336,7 @@ void SRInterface::runGCOnNextExecution()
336336
//----------------------------------------------------------------------------------------------
337337
void SRInterface::applyAutoRotation()
338338
{
339-
if (glm::length(autoRotateVector) > 0.1) mCamera->rotate(autoRotateVector * autoRotateSpeed);
339+
if (length(autoRotateVector) > 0.1) mCamera->rotate(autoRotateVector * autoRotateSpeed);
340340
if (tryAutoRotate) mCamera->tryAutoRotate();
341341
}
342342

@@ -479,7 +479,8 @@ void SRInterface::runGCOnNextExecution()
479479
return widgetUpdater_.currentWidget();
480480
}
481481

482-
std::tuple<uint32_t, std::string, std::vector<uint64_t>> SCIRun::Render::SRInterface::addSelectPasses(SCIRun::Graphics::Datatypes::WidgetHandle widget)
482+
std::tuple<uint32_t, std::string, std::vector<uint64_t>> SRInterface::addSelectPasses(
483+
WidgetHandle widget)
483484
{
484485
std::weak_ptr<ren::ShaderMan> sm = mCore.getStaticComponent<ren::StaticShaderMan>()->instance_;
485486
auto shaderMan = sm.lock();
@@ -502,8 +503,7 @@ void SRInterface::runGCOnNextExecution()
502503
}
503504

504505
const char* selectionShaderName = "Shaders/Selection";
505-
GLuint shaderID = shaderMan->getIDForAsset(selectionShaderName);
506-
if (shaderID == 0)
506+
if (shaderMan->getIDForAsset(selectionShaderName) == 0)
507507
{
508508
const char* vs =
509509
"uniform mat4 uModelViewProjection;\n"
@@ -531,7 +531,7 @@ void SRInterface::runGCOnNextExecution()
531531
" gl_FragColor = fColor;\n"
532532
"}\n";
533533

534-
shaderID = shaderMan->addInMemoryVSFS(vs, fs, selectionShaderName);
534+
shaderMan->addInMemoryVSFS(vs, fs, selectionShaderName);
535535
}
536536
addShaderToEntity(entityID, selectionShaderName);
537537

@@ -566,7 +566,7 @@ void SRInterface::runGCOnNextExecution()
566566
return std::make_tuple(selid, objectName, entityIds);
567567
}
568568

569-
void SCIRun::Render::SRInterface::addSelectVertexBufferObjects(SCIRun::Graphics::Datatypes::WidgetHandle widget, std::shared_ptr<ren::VBOMan> vboMan)
569+
void SRInterface::addSelectVertexBufferObjects(WidgetHandle widget, std::shared_ptr<ren::VBOMan> vboMan)
570570
{
571571
for (const auto& vbo : widget->vbos())
572572
{
@@ -584,7 +584,7 @@ void SRInterface::runGCOnNextExecution()
584584
}
585585
}
586586

587-
void SCIRun::Render::SRInterface::addSelectIndexBufferObjects(SCIRun::Graphics::Datatypes::WidgetHandle widget, std::shared_ptr<ren::IBOMan> iboMan)
587+
void SRInterface::addSelectIndexBufferObjects(WidgetHandle widget, std::shared_ptr<ren::IBOMan> iboMan)
588588
{
589589
for (const auto& ibo : widget->ibos())
590590
{
@@ -596,7 +596,7 @@ void SRInterface::runGCOnNextExecution()
596596
}
597597
}
598598

599-
GLenum SCIRun::Render::SRInterface::computePrimitiveType(size_t indexSize)
599+
GLenum SRInterface::computePrimitiveType(size_t indexSize)
600600
{
601601
auto primType = GL_UNSIGNED_SHORT;
602602
switch (indexSize)
@@ -619,7 +619,7 @@ void SRInterface::runGCOnNextExecution()
619619
return primType;
620620
}
621621

622-
GLenum SCIRun::Render::SRInterface::computePrimitive(const SCIRun::Graphics::Datatypes::SpireIBO & ibo)
622+
GLenum SRInterface::computePrimitive(const SpireIBO& ibo)
623623
{
624624
auto primitive = GL_TRIANGLES;
625625
switch (ibo.prim)
@@ -786,11 +786,11 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
786786
glm::vec3 a4(1.0, 1.0, 1.0);
787787
return std::max(
788788
std::max(
789-
std::abs(glm::dot(n, a1)),
790-
std::abs(glm::dot(n, a2))),
789+
std::abs(dot(n, a1)),
790+
std::abs(dot(n, a2))),
791791
std::max(
792-
std::abs(glm::dot(n, a3)),
793-
std::abs(glm::dot(n, a4))));
792+
std::abs(dot(n, a3)),
793+
std::abs(dot(n, a4))));
794794
}
795795

796796
//----------------------------------------------------------------------------------------------
@@ -805,30 +805,30 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
805805
glm::mat4 trans_bb = glm::mat4(1.0f);
806806
glm::vec3 scale_bb(mSceneBBox.x_length() / 2.0, mSceneBBox.y_length() / 2.0, mSceneBBox.z_length() / 2.0);
807807
glm::vec3 center_bb(mSceneBBox.center().x(), mSceneBBox.center().y(), mSceneBBox.center().z());
808-
glm::mat4 temp = glm::scale(glm::mat4(1.0f), scale_bb);
808+
glm::mat4 temp = scale(glm::mat4(1.0f), scale_bb);
809809
trans_bb = temp * trans_bb;
810-
temp = glm::translate(glm::mat4(1.0f), center_bb);
810+
temp = translate(glm::mat4(1.0f), center_bb);
811811
trans_bb = temp * trans_bb;
812812
int index = 0;
813813
for (const auto& i : clippingPlanes_)
814814
{
815815
glm::vec3 n3(i.x, i.y, i.z);
816816
float d = i.d;
817817
glm::vec4 n(0.0);
818-
if (glm::length(n3) > 0.0)
818+
if (length(n3) > 0.0)
819819
{
820-
n3 = glm::normalize(n3);
820+
n3 = normalize(n3);
821821
n = glm::vec4(n3, 0.0);
822822
d *= getMaxProjLength(n3);
823823
}
824824
glm::vec4 o = glm::vec4(n.x, n.y, n.z, 1.0) * d;
825825
o.w = 1;
826826
o = trans_bb * o;
827-
n = glm::inverseTranspose(trans_bb) * n;
827+
n = inverseTranspose(trans_bb) * n;
828828
o.w = 0;
829829
n.w = 0;
830-
n = glm::normalize(n);
831-
n.w = -glm::dot(o, n);
830+
n = normalize(n);
831+
n.w = -dot(o, n);
832832
clippingPlanes->clippingPlanes.push_back(n);
833833
glm::vec4 control(i.visible ? 1.0 : 0.0,
834834
i.showFrame ? 1.0 : 0.0,
@@ -962,7 +962,6 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
962962
primType = GL_UNSIGNED_INT;
963963
logRendererError("Unable to determine index buffer depth.");
964964
throw std::invalid_argument("Unable to determine index buffer depth.");
965-
break;
966965
}
967966

968967
GLenum primitive = GL_TRIANGLES;
@@ -1171,7 +1170,7 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
11711170
}
11721171

11731172
{
1174-
Graphics::Datatypes::SpireSubPass::Uniform uniform;
1173+
SpireSubPass::Uniform uniform;
11751174
uniform.name = "uFogSettings";
11761175
applyFog(uniform);
11771176
applyUniform(entityID, uniform);
@@ -1355,7 +1354,7 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
13551354
//font texture
13561355
//read in the font data
13571356
bool success = true;
1358-
auto fontPath = SCIRun::Core::Application::Instance().executablePath() / "Assets" / "times_new_roman.font";
1357+
auto fontPath = Application::Instance().executablePath() / "Assets" / "times_new_roman.font";
13591358
std::ifstream in(fontPath.string(), std::ifstream::binary);
13601359
if (in.fail())
13611360
{
@@ -1531,8 +1530,8 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
15311530
}
15321531
yPos = yLow2 + (orientPosY + 0.5f) * (yHigh2 - yLow2);
15331532

1534-
glm::mat4 invCamTrans = glm::translate(glm::mat4(1.0f), glm::vec3(xPos, yPos, -1.5f));
1535-
glm::mat4 axesScale = glm::scale(glm::mat4(1.0f), glm::vec3(orientSize));
1533+
glm::mat4 invCamTrans = translate(glm::mat4(1.0f), glm::vec3(xPos, yPos, -1.5f));
1534+
glm::mat4 axesScale = scale(glm::mat4(1.0f), glm::vec3(orientSize));
15361535
glm::mat4 axesTransform = axesScale * axesRot;
15371536

15381537
GLint locCamViewVec = glGetUniformLocation(shader, "uCamViewVec");
@@ -1551,71 +1550,71 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
15511550

15521551
// X Axis (dark)
15531552
{
1554-
glm::mat4 xform = glm::rotate(glm::mat4(1.0f), glm::pi<float>() / 2.0f, glm::vec3(0.0, 1.0, 0.0));
1553+
glm::mat4 xform = rotate(glm::mat4(1.0f), glm::pi<float>() / 2.0f, glm::vec3(0.0, 1.0, 0.0));
15551554
glm::mat4 finalTrafo = axesTransform * xform;
15561555

15571556
GL(glUniform4f(locDiffuseColor, 0.25f, 0.0f, 0.0f, 1.0f));
15581557

15591558
glm::mat4 worldToProj = projection * invCamTrans * finalTrafo;
1560-
const GLfloat* ptr = glm::value_ptr(worldToProj);
1559+
const GLfloat* ptr = value_ptr(worldToProj);
15611560
GL(glUniformMatrix4fv(locProjIVObject, 1, false, ptr));
15621561

15631562
glm::mat4 objectSpace = finalTrafo;
1564-
ptr = glm::value_ptr(objectSpace);
1563+
ptr = value_ptr(objectSpace);
15651564
GL(glUniformMatrix4fv(locObject, 1, false, ptr));
15661565

15671566
GL(glDrawElements(iboData->primMode, iboData->numPrims, iboData->primType, nullptr));
15681567
}
15691568

15701569
// X Axis
15711570
{
1572-
glm::mat4 xform = glm::rotate(glm::mat4(1.0f), -glm::pi<float>() / 2.0f, glm::vec3(0.0, 1.0, 0.0));
1571+
glm::mat4 xform = rotate(glm::mat4(1.0f), -glm::pi<float>() / 2.0f, glm::vec3(0.0, 1.0, 0.0));
15731572
glm::mat4 finalTrafo = axesTransform * xform;
15741573

15751574
GL(glUniform4f(locDiffuseColor, 1.0f, 0.0f, 0.0f, 1.0f));
15761575

15771576
glm::mat4 worldToProj = projection * invCamTrans * finalTrafo;
1578-
const GLfloat* ptr = glm::value_ptr(worldToProj);
1577+
const GLfloat* ptr = value_ptr(worldToProj);
15791578
GL(glUniformMatrix4fv(locProjIVObject, 1, false, ptr));
15801579

15811580
glm::mat4 objectSpace = finalTrafo;
1582-
ptr = glm::value_ptr(objectSpace);
1581+
ptr = value_ptr(objectSpace);
15831582
GL(glUniformMatrix4fv(locObject, 1, false, ptr));
15841583

15851584
GL(glDrawElements(iboData->primMode, iboData->numPrims, iboData->primType, nullptr));
15861585
}
15871586

15881587
// Y Axis (dark)
15891588
{
1590-
glm::mat4 xform = glm::rotate(glm::mat4(1.0f), -glm::pi<float>() / 2.0f, glm::vec3(1.0, 0.0, 0.0));
1589+
glm::mat4 xform = rotate(glm::mat4(1.0f), -glm::pi<float>() / 2.0f, glm::vec3(1.0, 0.0, 0.0));
15911590
glm::mat4 finalTrafo = axesTransform * xform;
15921591

15931592
GL(glUniform4f(locDiffuseColor, 0.0f, 0.25f, 0.0f, 1.0f));
15941593

15951594
glm::mat4 worldToProj = projection * invCamTrans * finalTrafo;
1596-
const GLfloat* ptr = glm::value_ptr(worldToProj);
1595+
const GLfloat* ptr = value_ptr(worldToProj);
15971596
GL(glUniformMatrix4fv(locProjIVObject, 1, false, ptr));
15981597

15991598
glm::mat4 objectSpace = finalTrafo;
1600-
ptr = glm::value_ptr(objectSpace);
1599+
ptr = value_ptr(objectSpace);
16011600
GL(glUniformMatrix4fv(locObject, 1, false, ptr));
16021601

16031602
GL(glDrawElements(iboData->primMode, iboData->numPrims, iboData->primType, nullptr));
16041603
}
16051604

16061605
// Y Axis
16071606
{
1608-
glm::mat4 xform = glm::rotate(glm::mat4(1.0f), glm::pi<float>() / 2.0f, glm::vec3(1.0, 0.0, 0.0));
1607+
glm::mat4 xform = rotate(glm::mat4(1.0f), glm::pi<float>() / 2.0f, glm::vec3(1.0, 0.0, 0.0));
16091608
glm::mat4 finalTrafo = axesTransform * xform;
16101609

16111610
GL(glUniform4f(locDiffuseColor, 0.0f, 1.0f, 0.0f, 1.0f));
16121611

16131612
glm::mat4 worldToProj = projection * invCamTrans * finalTrafo;
1614-
const GLfloat* ptr = glm::value_ptr(worldToProj);
1613+
const GLfloat* ptr = value_ptr(worldToProj);
16151614
GL(glUniformMatrix4fv(locProjIVObject, 1, false, ptr));
16161615

16171616
glm::mat4 objectSpace = finalTrafo;
1618-
ptr = glm::value_ptr(objectSpace);
1617+
ptr = value_ptr(objectSpace);
16191618
GL(glUniformMatrix4fv(locObject, 1, false, ptr));
16201619

16211620
GL(glDrawElements(iboData->primMode, iboData->numPrims, iboData->primType, nullptr));
@@ -1629,11 +1628,11 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
16291628
GL(glUniform4f(locDiffuseColor, 0.0f, 0.0f, 0.25f, 1.0f));
16301629

16311630
glm::mat4 worldToProj = projection * invCamTrans * finalTrafo;
1632-
const GLfloat* ptr = glm::value_ptr(worldToProj);
1631+
const GLfloat* ptr = value_ptr(worldToProj);
16331632
GL(glUniformMatrix4fv(locProjIVObject, 1, false, ptr));
16341633

16351634
glm::mat4 objectSpace = finalTrafo;
1636-
ptr = glm::value_ptr(objectSpace);
1635+
ptr = value_ptr(objectSpace);
16371636
GL(glUniformMatrix4fv(locObject, 1, false, ptr));
16381637

16391638
GL(glDrawElements(iboData->primMode, iboData->numPrims, iboData->primType, nullptr));
@@ -1642,17 +1641,17 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
16421641
// Z Axis
16431642
{
16441643
// No rotation at all
1645-
glm::mat4 xform = glm::rotate(glm::mat4(1.0f), glm::pi<float>(), glm::vec3(1.0, 0.0, 0.0));
1644+
glm::mat4 xform = rotate(glm::mat4(1.0f), glm::pi<float>(), glm::vec3(1.0, 0.0, 0.0));
16461645
glm::mat4 finalTrafo = axesTransform * xform;
16471646

16481647
GL(glUniform4f(locDiffuseColor, 0.0f, 0.0f, 1.0f, 1.0f));
16491648

16501649
glm::mat4 worldToProj = projection * invCamTrans * finalTrafo;
1651-
const GLfloat* ptr = glm::value_ptr(worldToProj);
1650+
const GLfloat* ptr = value_ptr(worldToProj);
16521651
GL(glUniformMatrix4fv(locProjIVObject, 1, false, ptr));
16531652

16541653
glm::mat4 objectSpace = finalTrafo;
1655-
ptr = glm::value_ptr(objectSpace);
1654+
ptr = value_ptr(objectSpace);
16561655
GL(glUniformMatrix4fv(locObject, 1, false, ptr));
16571656

16581657
GL(glDrawElements(iboData->primMode, iboData->numPrims, iboData->primType, nullptr));
@@ -1703,7 +1702,7 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
17031702
}
17041703

17051704
//----------------------------------------------------------------------------------------------
1706-
void SRInterface::applyMatFactors(Graphics::Datatypes::SpireSubPass::Uniform& uniform)
1705+
void SRInterface::applyMatFactors(SpireSubPass::Uniform& uniform)
17071706
{
17081707
if (uniform.name == "uAmbientColor")
17091708
uniform.data = inverseGammaCorrect(glm::vec4(mMatAmbient));
@@ -1714,7 +1713,7 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
17141713
}
17151714

17161715
//----------------------------------------------------------------------------------------------
1717-
void SRInterface::applyFog(Graphics::Datatypes::SpireSubPass::Uniform& uniform)
1716+
void SRInterface::applyFog(SpireSubPass::Uniform& uniform)
17181717
{
17191718
if (uniform.name == "uFogSettings")
17201719
{
@@ -1728,7 +1727,7 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
17281727
uniform.data = inverseGammaCorrect(mFogColor);
17291728
}
17301729

1731-
uniform.type = Graphics::Datatypes::SpireSubPass::Uniform::UniformType::UNIFORM_VEC4;
1730+
uniform.type = SpireSubPass::Uniform::UniformType::UNIFORM_VEC4;
17321731
}
17331732

17341733
//----------------------------------------------------------------------------------------------
@@ -1763,7 +1762,7 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
17631762
viewVector.z = cos(inclination) * cos(azimuth);
17641763
viewVector.x = cos(inclination) * sin(azimuth);
17651764
viewVector.y = sin(inclination);
1766-
mLightDirectionView[index] = glm::normalize(viewVector);
1765+
mLightDirectionView[index] = normalize(viewVector);
17671766
}
17681767

17691768
//----------------------------------------------------------------------------------------------
@@ -1810,7 +1809,7 @@ glm::vec2 ScreenParams::positionFromClick(int x, int y) const
18101809
}
18111810
}
18121811

1813-
std::ostream& SCIRun::Render::operator<<(std::ostream& o, const glm::mat4& m)
1812+
std::ostream& Render::operator<<(std::ostream& o, const glm::mat4& m)
18141813
{
18151814
o << "{" << m[0].x << ",\t" << m[0].y << ",\t" << m[0].z << ",\t" << m[0].w << "}\n"
18161815
<< "{" << m[1].x << ",\t" << m[1].y << ",\t" << m[1].z << ",\t" << m[1].w << "}\n"

src/Modules/Visualization/ShowFieldGlyphs.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ void GlyphBuilder::addGlyph(
217217
}
218218
case RenderState::GlyphType::SPRING_GLYPH:
219219
BOOST_THROW_EXCEPTION(AlgorithmInputException() << ErrorMessage("Spring Geom is not supported yet."));
220-
break;
221220
default:
222221
if (use_lines)
223222
glyphs.addLine(p1, p2, node_color, node_color);
@@ -653,10 +652,8 @@ void GlyphBuilder::renderScalars(
653652
break;
654653
case RenderState::GlyphType::BOX_GLYPH:
655654
BOOST_THROW_EXCEPTION(AlgorithmInputException() << ErrorMessage("Box Geom is not supported yet."));
656-
break;
657655
case RenderState::GlyphType::AXIS_GLYPH:
658656
BOOST_THROW_EXCEPTION(AlgorithmInputException() << ErrorMessage("Axis Geom is not supported yet."));
659-
break;
660657
default:
661658
if (usePoints)
662659
glyphs.addPoint(points[i], node_color);

0 commit comments

Comments
 (0)