Skip to content

Commit

Permalink
Merge pull request #434 from Kitware/fix-glyph-mapper
Browse files Browse the repository at this point in the history
fix(Glyph3DMapper): Add support for color on glyph
  • Loading branch information
martinken authored Nov 29, 2017
2 parents 606feb7 + f568edf commit 50dee8f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Sources/Rendering/Core/Glyph3DMapper/example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ simpleFilter.setFormula({
press[(i * 3) + 2] = (((coords[3 * i] - 0.5) * (coords[3 * i] - 0.5)) + ((coords[(3 * i) + 1] - 0.5) * (coords[(3 * i) + 1] - 0.5)) + 0.125) * 0.1;
temp[i] = coords[(3 * i) + 1] * 0.1;
}

// Mark the output vtkDataArray as modified
arraysOut.forEach(x => x.modified());
},
Expand Down
2 changes: 1 addition & 1 deletion Sources/Rendering/Core/Glyph3DMapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function vtkGlyph3DMapper(publicAPI, model) {

model.colorArray = null;
const lut = publicAPI.getLookupTable();
if (lut) {
if (lut && scalars) {
// Ensure that the lookup table is built
lut.build();
model.colorArray = lut.mapScalars(scalars, model.colorMode, 0);
Expand Down
6 changes: 5 additions & 1 deletion Sources/Rendering/OpenGL/Glyph3DMapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,11 @@ function vtkOpenGLGlyph3DMapper(publicAPI, model) {
if (model.renderable.getBuildTime().getMTime() > model.glyphBOBuildTime.getMTime()) {
model.matrixBuffer.upload(garray, ObjectType.ARRAY_BUFFER);
model.normalBuffer.upload(narray, ObjectType.ARRAY_BUFFER);
model.colorBuffer.upload(carray.getData(), ObjectType.ARRAY_BUFFER);
if (carray) {
model.colorBuffer.upload(carray.getData(), ObjectType.ARRAY_BUFFER);
} else {
model.colorBuffer.releaseGraphicResources();
}
model.glyphBOBuildTime.modified();
}
}
Expand Down

0 comments on commit 50dee8f

Please sign in to comment.