Skip to content

Commit 9e95d61

Browse files
committed
fixed rgb convert and closes #985
1 parent 008ee65 commit 9e95d61

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

src/Graphics/Glyphs/GlyphGeom.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void GlyphGeom::buildObject(GeometryHandle geom, const std::string uniqueNodeID,
9191
}
9292
else if (colorScheme == GeometryObject::COLOR_IN_SITU)
9393
{
94-
attribs.push_back(GeometryObject::SpireVBO::AttributeData("aColor", 1 * sizeof(uint32_t), true));
94+
attribs.push_back(GeometryObject::SpireVBO::AttributeData("aColor", 4 * sizeof(float)));
9595
if (useTriangles)
9696
{
9797
shader = "Shaders/DirPhongInSitu";

src/Modules/Visualization/ShowField.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,9 +1073,7 @@ void ShowFieldModule::renderNodes(
10731073
GeometryObject::ColorScheme colorScheme = GeometryObject::COLOR_UNIFORM;
10741074
ColorRGB node_color;
10751075

1076-
if (fld->basis_order() < 0 ||
1077-
(fld->basis_order() == 0 && mesh->dimensionality() != 0) ||
1078-
state.get(RenderState::USE_DEFAULT_COLOR))
1076+
if (fld->basis_order() < 0 || (fld->basis_order() == 0 && mesh->dimensionality() != 0) || state.get(RenderState::USE_DEFAULT_COLOR))
10791077
colorScheme = GeometryObject::COLOR_UNIFORM;
10801078
else if (state.get(RenderState::USE_COLORMAP))
10811079
colorScheme = GeometryObject::COLOR_MAP;

src/Modules/Visualization/ShowFieldGlyphs.cc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,17 @@ void ShowFieldGlyphs::renderVectors(
251251
ColorRGB node_color;
252252

253253
if (fld->basis_order() < 0 || (fld->basis_order() == 0 && mesh->dimensionality() != 0) || state.get(RenderState::USE_DEFAULT_COLOR))
254+
{
254255
colorScheme = GeometryObject::COLOR_UNIFORM;
256+
}
255257
else if (state.get(RenderState::USE_COLORMAP))
258+
{
256259
colorScheme = GeometryObject::COLOR_MAP;
260+
}
257261
else
262+
{
258263
colorScheme = GeometryObject::COLOR_IN_SITU;
264+
}
259265

260266
mesh->synchronize(Mesh::EDGES_E);
261267

@@ -363,7 +369,7 @@ void ShowFieldGlyphs::renderVectors(
363369
}
364370
if (colorScheme == GeometryObject::COLOR_IN_SITU)
365371
{
366-
Vector colorVector = Vector(1,0,0);
372+
Vector colorVector = inputVector.normal();
367373
node_color = ColorRGB(colorVector.x(), colorVector.y(), colorVector.z());
368374
}
369375
}
@@ -429,11 +435,17 @@ void ShowFieldGlyphs::renderScalars(
429435
ColorRGB node_color;
430436

431437
if (fld->basis_order() < 0 || (fld->basis_order() == 0 && mesh->dimensionality() != 0) || state.get(RenderState::USE_DEFAULT_COLOR))
438+
{
432439
colorScheme = GeometryObject::COLOR_UNIFORM;
440+
}
433441
else if (state.get(RenderState::USE_COLORMAP))
442+
{
434443
colorScheme = GeometryObject::COLOR_MAP;
444+
}
435445
else
446+
{
436447
colorScheme = GeometryObject::COLOR_IN_SITU;
448+
}
437449

438450
mesh->synchronize(Mesh::NODES_E);
439451

@@ -483,6 +495,7 @@ void ShowFieldGlyphs::renderScalars(
483495
node_color = ColorRGB(colorVector.x(), colorVector.y(), colorVector.z());
484496
}
485497
}
498+
//std::cout << node_color << std::endl;
486499
switch (state.mGlyphType)
487500
{
488501
case RenderState::GlyphType::POINT_GLYPH:
@@ -575,11 +588,17 @@ void ShowFieldGlyphs::renderTensors(
575588
ColorRGB node_color;
576589

577590
if (fld->basis_order() < 0 || (fld->basis_order() == 0 && mesh->dimensionality() != 0) || state.get(RenderState::USE_DEFAULT_COLOR))
591+
{
578592
colorScheme = GeometryObject::COLOR_UNIFORM;
593+
}
579594
else if (state.get(RenderState::USE_COLORMAP))
595+
{
580596
colorScheme = GeometryObject::COLOR_MAP;
597+
}
581598
else
599+
{
582600
colorScheme = GeometryObject::COLOR_IN_SITU;
601+
}
583602

584603
mesh->synchronize(Mesh::NODES_E);
585604

@@ -738,7 +757,7 @@ RenderState ShowFieldGlyphs::getScalarsRenderState(
738757
RenderState renState;
739758

740759
bool useColorMap = state->getValue(ShowFieldGlyphs::ScalarsColoring).toInt() == 1;
741-
bool rgbConversion = state->getValue(ShowFieldGlyphs::VectorsColoring).toInt() == 2;
760+
bool rgbConversion = state->getValue(ShowFieldGlyphs::ScalarsColoring).toInt() == 2;
742761
renState.set(RenderState::USE_NORMALS, true);
743762

744763
renState.set(RenderState::IS_ON, state->getValue(ShowFieldGlyphs::ShowScalars).toBool());

0 commit comments

Comments
 (0)