use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class DicomPlaneViewer method render.
@Override
public synchronized void render(Renderer renderer, int flags) {
RenderProps rprops = getRenderProps();
renderer.pushModelMatrix();
// adjust for widths and location
renderer.mulModelMatrix(location);
AffineTransform3d scaling = new AffineTransform3d();
scaling.applyScaling(widths.x, widths.y, 1);
renderer.mulModelMatrix(scaling);
ColorMapProps oldColorMap = renderer.setColorMap(rprops.getColorMap());
FaceStyle oldFaceStyle = renderer.setFaceStyle(FaceStyle.FRONT_AND_BACK);
Shading oldShading = renderer.setShading(rprops.getShading());
if (!renderer.isSelecting()) {
renderer.setFaceColoring(rprops, isSelected());
}
renderer.drawTriangles(robj, 0);
renderer.setShading(oldShading);
renderer.setFaceStyle(oldFaceStyle);
renderer.setColorMap(oldColorMap);
renderer.popModelMatrix();
}
use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class DicomViewer method render.
@Override
public synchronized void render(Renderer renderer, int flags) {
RenderProps rprops = getRenderProps();
renderer.pushModelMatrix();
renderer.setModelMatrix(myRenderTransform);
if (drawBox) {
// draw box
Shading savedShading = renderer.setShading(Shading.NONE);
renderer.setLineColoring(rprops, isSelected());
renderer.drawLines(robj, 0);
renderer.setShading(savedShading);
}
ColorMapProps oldColorMap = renderer.setColorMap(rprops.getColorMap());
FaceStyle oldFaceStyle = renderer.setFaceStyle(FaceStyle.FRONT_AND_BACK);
Shading oldShading = renderer.setShading(rprops.getShading());
if (!renderer.isSelecting()) {
renderer.setFaceColoring(rprops, isSelected());
}
for (int i = 0; i < 3; i++) {
if (drawSlice[i]) {
renderer.drawTriangles(robj, i);
}
}
renderer.setShading(oldShading);
renderer.setFaceStyle(oldFaceStyle);
renderer.setColorMap(oldColorMap);
renderer.popModelMatrix();
}
use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class MuscleElementDesc method render.
public void render(Renderer renderer, RenderProps props, int flags) {
double widgetSize = 0;
double directionLength = 0;
ModelComponent gparent = getGrandParent();
DirectionRenderType renderType = DirectionRenderType.ELEMENT;
if (gparent instanceof MuscleBundle) {
MuscleBundle bundle = (MuscleBundle) gparent;
widgetSize = bundle.getElementWidgetSize();
directionLength = bundle.getDirectionRenderLen();
renderType = bundle.getDirectionRenderType();
}
if (widgetSize != 0) {
Shading savedShading = renderer.setPropsShading(props);
if (myWidgetColor != null) {
renderer.setFaceColoring(props, myWidgetColor, isSelected());
} else {
renderer.setFaceColoring(props, isSelected());
}
myElement.renderWidget(renderer, widgetSize, props);
renderer.setShading(savedShading);
}
if (directionLength > 0) {
Matrix3d F = new Matrix3d();
Vector3d dir = new Vector3d();
float[] coords0 = new float[3];
float[] coords1 = new float[3];
renderDirection(renderer, props, coords0, coords1, F, dir, directionLength, renderType);
}
}
use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class FemElementRenderer method render.
public void render(Renderer renderer, FemElement3d elem, RenderProps props) {
RenderObject r = myRob;
updateEdgePositions(r, elem);
Shading savedShading = renderer.setShading(Shading.NONE);
renderer.setLineWidth(props.getLineWidth());
renderer.setLineColoring(props, elem.isSelected());
renderer.drawLines(r);
renderer.setLineWidth(1);
renderer.setShading(savedShading);
double wsize = elem.getElementWidgetSize();
if (wsize > 0) {
renderWidget(renderer, elem, wsize, props);
}
}
use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class ParticleLineConstraint method render.
public void render(Renderer renderer, int flags) {
if (myLineSize > 0) {
computeRenderVtxs();
RenderProps props = myRenderProps;
Shading savedShading = renderer.setPropsShading(props);
renderer.setLineColoring(props, isSelected());
renderer.drawLine(myRenderVtxs[0], myRenderVtxs[1]);
renderer.setShading(savedShading);
}
}
Aggregations