Commit c9090e9d authored by David E. DeMarle's avatar David E. DeMarle Committed by Kitware Robot
Browse files

Merge topic 'fix-ospray-molecule-bondcolors'

b670adbd

 fix ospray rendered molecular bond colors and a crash sans bonds
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !7190
parents 02e51ec5 b670adbd
Pipeline #186905 failed with stage
in 0 seconds
...@@ -232,9 +232,6 @@ void vtkOSPRayMoleculeMapperNode::Render(bool prepass) ...@@ -232,9 +232,6 @@ void vtkOSPRayMoleculeMapperNode::Render(bool prepass)
// each endpoint is doubled because we need to use OSP_BEZIER to vary width // each endpoint is doubled because we need to use OSP_BEZIER to vary width
indices.push_back(bondInd * 8 + 0); indices.push_back(bondInd * 8 + 0);
indices.push_back(bondInd * 8 + 4); indices.push_back(bondInd * 8 + 4);
// indices.push_back(bondInd*4+1);
// indices.push_back(bondInd*4+2);
// indices.push_back(bondInd*4+3);
vtkBond bond = molecule->GetBond(bondInd); vtkBond bond = molecule->GetBond(bondInd);
pos1 = bond.GetBeginAtom().GetPosition(); pos1 = bond.GetBeginAtom().GetPosition();
...@@ -259,24 +256,18 @@ void vtkOSPRayMoleculeMapperNode::Render(bool prepass) ...@@ -259,24 +256,18 @@ void vtkOSPRayMoleculeMapperNode::Render(bool prepass)
static_cast<float>(pos2.GetZ()), bondRadius }; static_cast<float>(pos2.GetZ()), bondRadius };
// tube from atom1 to midpoint // tube from atom1 to midpoint
vertsAndRadii.emplace_back(start);
materials.emplace_back(_elementMaterials[atomicNumbers->GetValue(atomIds[0])]); materials.emplace_back(_elementMaterials[atomicNumbers->GetValue(atomIds[0])]);
vertsAndRadii.emplace_back(start); vertsAndRadii.emplace_back(start);
materials.emplace_back(_elementMaterials[atomicNumbers->GetValue(atomIds[0])]); vertsAndRadii.emplace_back(start);
vertsAndRadii.emplace_back(mid); vertsAndRadii.emplace_back(mid);
materials.emplace_back(_elementMaterials[atomicNumbers->GetValue(atomIds[0])]);
vertsAndRadii.emplace_back(mid); vertsAndRadii.emplace_back(mid);
materials.emplace_back(_elementMaterials[atomicNumbers->GetValue(atomIds[0])]);
// tube from midpoint to atom2 // tube from midpoint to atom2
vertsAndRadii.emplace_back(mid);
materials.emplace_back(_elementMaterials[atomicNumbers->GetValue(atomIds[1])]); materials.emplace_back(_elementMaterials[atomicNumbers->GetValue(atomIds[1])]);
vertsAndRadii.emplace_back(mid); vertsAndRadii.emplace_back(mid);
materials.emplace_back(_elementMaterials[atomicNumbers->GetValue(atomIds[1])]); vertsAndRadii.emplace_back(mid);
vertsAndRadii.emplace_back(end); vertsAndRadii.emplace_back(end);
materials.emplace_back(_elementMaterials[atomicNumbers->GetValue(atomIds[1])]);
vertsAndRadii.emplace_back(end); vertsAndRadii.emplace_back(end);
materials.emplace_back(_elementMaterials[atomicNumbers->GetValue(atomIds[1])]);
} }
OSPData vertsAndRadiiData = OSPData vertsAndRadiiData =
...@@ -292,7 +283,7 @@ void vtkOSPRayMoleculeMapperNode::Render(bool prepass) ...@@ -292,7 +283,7 @@ void vtkOSPRayMoleculeMapperNode::Render(bool prepass)
if (mapper->GetBondColorMode() == vtkMoleculeMapper::DiscreteByAtom) if (mapper->GetBondColorMode() == vtkMoleculeMapper::DiscreteByAtom)
{ {
OSPData materialData = ospNewCopyData1D(materials.data(), OSP_MATERIAL, 4 * numBonds); OSPData materialData = ospNewCopyData1D(materials.data(), OSP_MATERIAL, materials.size());
ospCommit(materialData); ospCommit(materialData);
ospSetObject(bondsModel, "material", materialData); ospSetObject(bondsModel, "material", materialData);
ospRelease(materialData); ospRelease(materialData);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment