use of artisynth.core.femmodels.FemModel.SurfaceRender in project artisynth_core by artisynth.
the class FemMeshComp method setSurfaceRendering.
@Override
public void setSurfaceRendering(SurfaceRender mode) {
SurfaceRender oldMode = getSurfaceRendering();
super.setSurfaceRendering(mode);
if (oldMode != mode) {
if (myFem != null) {
// paranoid: myFem should always be non-null here
switch(mode) {
case Strain:
myFem.setComputeNodalStrain(true);
myFem.updateStressAndStiffness();
break;
case Stress:
myFem.setComputeNodalStress(true);
myFem.updateStressAndStiffness();
break;
default:
{
myFem.setComputeNodalStrain(false);
myFem.setComputeNodalStress(false);
break;
}
}
}
// save/restore original vertex colors
MeshBase mesh = getMesh();
if (mesh != null) {
boolean oldStressOrStrain = isStressOrStrainRendering(oldMode);
boolean newStressOrStrain = isStressOrStrainRendering(mode);
if (newStressOrStrain != oldStressOrStrain) {
if (newStressOrStrain) {
saveShading();
saveMeshColoring(mesh);
mesh.setVertexColoringEnabled();
mesh.setVertexColorMixing(ColorMixing.REPLACE);
myRenderProps.setShading(Shading.NONE);
// enable stress/strain rendering *after* vertex coloring set
// not sure we need this here
updateVertexColors();
} else {
// disable stress/strain rendering *before* restoring colors
restoreMeshColoring(mesh);
restoreShading();
}
}
}
}
}
use of artisynth.core.femmodels.FemModel.SurfaceRender in project artisynth_core by artisynth.
the class MFreeMeshComp method setSurfaceRendering.
@Override
public void setSurfaceRendering(SurfaceRender mode) {
SurfaceRender oldMode = getSurfaceRendering();
super.setSurfaceRendering(mode);
if (oldMode != mode) {
if (myModel != null) {
// paranoid: myFem should always be non-null here
switch(mode) {
case Strain:
myModel.setComputeNodalStrain(true);
myModel.updateStressAndStiffness();
break;
case Stress:
myModel.setComputeNodalStress(true);
myModel.updateStressAndStiffness();
break;
default:
{
myModel.setComputeNodalStrain(false);
myModel.setComputeNodalStress(false);
break;
}
}
}
// save/restore original vertex colors
MeshBase mesh = getMesh();
if (mesh != null) {
boolean oldStressOrStrain = isStressOrStrainRendering(oldMode);
boolean newStressOrStrain = isStressOrStrainRendering(mode);
if (newStressOrStrain != oldStressOrStrain) {
if (newStressOrStrain) {
saveShading();
saveMeshColoring(mesh);
mesh.setVertexColoringEnabled();
mesh.setVertexColorMixing(ColorMixing.REPLACE);
myRenderProps.setShading(Shading.NONE);
// enable stress/strain rendering *after* vertex coloring set
// not sure we need this here
updateVertexColors();
} else {
// disable stress/strain rendering *before* restoring colors
restoreMeshColoring(mesh);
restoreShading();
}
}
}
}
}
Aggregations