Skip to content

Commit ed34ee1

Browse files
committed
Merge branch 'master' into releaseCandidate_O
2 parents 05bcccf + 3c25924 commit ed34ee1

File tree

16 files changed

+843
-68
lines changed

16 files changed

+843
-68
lines changed

src/Core/Datatypes/Geometry.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ namespace Datatypes {
161161
renderType(renType),
162162
vbo(vbo),
163163
ibo(ibo),
164-
mColorScheme(scheme)
164+
mColorScheme(scheme),
165+
scalar(1.0)
165166
{}
166167

167168
static const char* getName() { return "SpireSubPass"; }
@@ -180,6 +181,7 @@ namespace Datatypes {
180181
RenderType renderType;
181182
SpireVBO vbo;
182183
SpireIBO ibo;
184+
double scalar;
183185

184186
struct Uniform
185187
{

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace fs = CPM_ES_FS_NS;
4444
namespace SCIRun {
4545
namespace Render {
4646

47-
ESCore::ESCore()
47+
ESCore::ESCore() : r_(0.0f), g_(0.0f), b_(0.0f), a_(0.0f)
4848
{
4949
// Register common systems.
5050
gen::registerAll(*this);
@@ -118,7 +118,8 @@ void ESCore::execute(double currentTime, double constantFrameTime)
118118
// Reset the GL state (we shouldn't really need to do this, but we will anyways).
119119
mDefaultGLState.apply();
120120

121-
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
121+
//lClearColor(0.0f, 0.0f, 0.0f, 0.0f);
122+
glClearColor(r_, g_, b_, a_);
122123
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
123124
}
124125

@@ -129,6 +130,14 @@ void ESCore::execute(double currentTime, double constantFrameTime)
129130
mCurrentTime += constantFrameTime;
130131
}
131132

133+
void ESCore::setBackgroundColor(float r, float g, float b, float a)
134+
{
135+
r_ = r;
136+
g_ = g;
137+
b_ = b;
138+
a_ = a;
139+
}
140+
132141
} // namespace Render
133142
} // namespace SCIRun
134143

src/Interface/Modules/Render/ES/Core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class ESCore : public CPM_ES_ACORN_NS::Acorn
4343
virtual ~ESCore();
4444

4545
void execute(double currentTime, double constantFrameTime);
46+
void setBackgroundColor(float r, float g, float b, float a);
4647

4748
private:
4849

@@ -52,6 +53,8 @@ class ESCore : public CPM_ES_ACORN_NS::Acorn
5253

5354
float mFPS; ///< Actual FPS of system.
5455
float mLastRealTime; ///< Last realtime passed into the core.
56+
57+
float r_, g_, b_, a_;
5558
};
5659

5760
} // namespace Render

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ namespace SCIRun {
234234
showOrientation_ = value;
235235
}
236236

237+
//------------------------------------------------------------------------------
238+
void SRInterface::setBackgroundColor(QColor color)
239+
{
240+
mCore.setBackgroundColor(color.redF(), color.greenF(), color.blueF(), color.alphaF());
241+
}
242+
237243
//------------------------------------------------------------------------------
238244
void SRInterface::inputMouseUp(const glm::ivec2& /*pos*/, MouseButton /*btn*/)
239245
{
@@ -426,6 +432,14 @@ namespace SCIRun {
426432

427433
// Add transformation
428434
gen::Transform trafo;
435+
436+
if (pass.renderType == Core::Datatypes::GeometryObject::RENDER_RLIST_SPHERE)
437+
{
438+
double scale = pass.scalar;
439+
trafo.transform[0].x = scale;
440+
trafo.transform[1].y = scale;
441+
trafo.transform[2].z = scale;
442+
}
429443
mCore.addComponent(entityID, trafo);
430444

431445
// Add lighting uniform checks

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ namespace SCIRun {
134134
/// Toggle Orientation Axes
135135
void showOrientation(bool value);
136136

137+
/// Set the Background Color
138+
void setBackgroundColor(QColor color);
139+
137140
private:
138141

139142
class SRObject
@@ -170,14 +173,14 @@ namespace SCIRun {
170173
Core::Datatypes::GeometryObject::RenderType renderType;
171174
};
172175

173-
std::string mName;
174-
glm::mat4 mObjectToWorld;
175-
std::list<SRPass> mPasses;
176-
Core::Geometry::BBox mBBox; ///< Objects bounding box (calculated from VBO).
176+
std::string mName;
177+
glm::mat4 mObjectToWorld;
178+
std::list<SRPass> mPasses;
179+
Core::Geometry::BBox mBBox; ///< Objects bounding box (calculated from VBO).
177180

178181
boost::optional<std::string> mColorMap;
179182

180-
int mPort;
183+
int mPort;
181184
};
182185

183186
// Sets up ESCore.

src/Interface/Modules/Render/ViewScene.cc

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ void ViewSceneDialog::newGeometryValue()
125125
LOG_DEBUG("ViewSceneDialog::asyncExecute after locking");
126126

127127
itemManager_->removeAll();
128-
128+
/*
129129
std::shared_ptr<Render::SRInterface> spire = mSpire.lock();
130130
if (spire == nullptr)
131131
return;
132132
spire->removeAllGeomObjects();
133-
133+
*/
134134
// Grab the geomData transient value.
135135
auto geomDataTransient = state_->getTransientValue(Parameters::GeomData);
136136
if (geomDataTransient && !geomDataTransient->empty())
@@ -149,23 +149,23 @@ void ViewSceneDialog::newGeometryValue()
149149
}
150150

151151
int port = 0;
152-
//std::vector<std::string> validObjects;
152+
std::vector<std::string> validObjects;
153153
for (auto it = geomData->begin(); it != geomData->end(); ++it, ++port)
154154
{
155155
boost::shared_ptr<Core::Datatypes::GeometryObject> obj = *it;
156156
spire->handleGeomObject(obj, port);
157-
//validObjects.push_back(obj->objectName);
157+
validObjects.push_back(obj->objectName);
158158
itemManager_->addItem(QString::fromStdString(obj->objectName));
159159
}
160-
//spire->gcInvalidObjects(validObjects);
161-
}/*
160+
spire->gcInvalidObjects(validObjects);
161+
}
162162
else
163163
{
164164
std::shared_ptr<Render::SRInterface> spire = mSpire.lock();
165165
if (spire == nullptr)
166166
return;
167167
spire->removeAllGeomObjects();
168-
}*/
168+
}
169169
//TODO IMPORTANT: we need some call somewhere to clear the transient geometry list once spire/ES has received the list of objects. They take up lots of memory...
170170
//state_->setTransientValue(Parameters::GeomData, boost::shared_ptr<std::list<boost::shared_ptr<Core::Datatypes::GeometryObject>>>(), false);
171171
}
@@ -376,6 +376,23 @@ void ViewSceneDialog::configurationButtonClicked()
376376
mConfigurationDock->setVisible(showConfiguration_);
377377
}
378378

379+
//------------------------------------------------------------------------------
380+
void ViewSceneDialog::assignBackgroundColor()
381+
{
382+
QColor bgColor = Qt::black;
383+
auto newColor = QColorDialog::getColor(bgColor, this, "Choose background color");
384+
if (newColor.isValid())
385+
{
386+
bgColor = newColor;
387+
mConfigurationDock->setSampleColor(bgColor);
388+
//TODO: set color of button to this color
389+
//defaultMeshColorButton_->set
390+
//state_->setValue(ShowFieldModule::DefaultMeshColor, ColorRGB(defaultMeshColor_.red(), defaultMeshColor_.green(), defaultMeshColor_.blue()).toString());
391+
std::shared_ptr<Render::SRInterface> spire = mSpire.lock();
392+
spire->setBackgroundColor(bgColor);
393+
}
394+
}
395+
379396
//------------------------------------------------------------------------------
380397
void ViewSceneDialog::addToolBar()
381398
{

src/Interface/Modules/Render/ViewScene.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ namespace SCIRun {
8383
void viewAxisSelected(int index);
8484
void viewVectorSelected(int index);
8585
void configurationButtonClicked();
86+
void assignBackgroundColor();
8687

8788
protected:
8889
virtual void closeEvent(QCloseEvent* evt) override;

0 commit comments

Comments
 (0)