use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class AxialSpringList method drawLines.
private void drawLines(Renderer renderer, RenderProps props, boolean selected) {
LineStyle style = props.getLineStyle();
Shading savedShading = renderer.setLineShading(props);
renderer.setLineColoring(props, selected);
switch(style) {
case LINE:
{
int width = props.getLineWidth();
if (width > 0) {
// renderer.setLightingEnabled (false);
// renderer.setColor (props.getLineColorArray(), selected);
renderer.drawLines(myRob, LineStyle.LINE, width);
// renderer.setLightingEnabled (true);
}
break;
}
case SPINDLE:
case SOLID_ARROW:
case CYLINDER:
{
double rad = props.getLineRadius();
if (rad > 0) {
// Shading savedShading = renderer.getShadeModel();
// renderer.setLineLighting (props, selected);
renderer.drawLines(myRob, style, rad);
// renderer.setShadeModel(savedShading);
}
break;
}
}
renderer.setShading(savedShading);
}
use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class MFreeElement3d method render.
public void render(Renderer renderer, RenderProps rprops, int flags) {
Shading savedShading = renderer.setLineShading(rprops);
renderer.setLineColoring(rprops, isSelected());
if (rprops.getLineWidth() > 0) {
switch(rprops.getLineStyle()) {
case LINE:
{
renderer.setLineWidth(rprops.getLineWidth());
renderEdges(renderer, rprops);
renderer.setLineWidth(1);
break;
}
case CYLINDER:
{
renderEdges(renderer, rprops);
break;
}
default:
break;
}
}
renderer.setShading(savedShading);
}
use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class MFreeElement3dList method render.
public void render(Renderer renderer, int flags) {
dorender(renderer, /*selected=*/
true);
dorender(renderer, /*selected=*/
false);
Shading savedShading = renderer.setPropsShading(myRenderProps);
renderer.setFaceColoring(myRenderProps, /*highlight=*/
false);
for (int i = 0; i < size(); i++) {
double widgetSize;
MFreeElement3d elem = get(i);
if (elem.getRenderProps() == null && elem.isSelected() == isSelected() && elem.getElementWidgetSize() > 0) {
if (renderer.isSelecting()) {
if (renderer.isSelectable(elem)) {
renderer.beginSelectionQuery(i);
elem.renderWidget(renderer, myRenderProps, 0);
renderer.endSelectionQuery();
}
} else {
renderer.setFaceColoring(myRenderProps, elem.isSelected());
elem.renderWidget(renderer, myRenderProps, 0);
}
}
}
renderer.setShading(savedShading);
}
use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class SegmentedPlanarConnector method render.
public void render(Renderer renderer, int flags) {
Vector3d nrm = new Vector3d(0, 0, 1);
RigidTransform3d TDW = getCurrentTDW();
RenderProps props = myRenderProps;
Shading savedShading = renderer.setPropsShading(props);
renderer.setFaceColoring(props, isSelected());
renderer.setFaceStyle(props.getFaceStyle());
ArrayList<Plane> planes = mySegPlaneCoupling.getPlanes();
for (int i = 0; i < planes.size(); i++) {
Plane plane = planes.get(i);
nrm.set(plane.getNormal());
computeRenderVtxs(i, TDW);
renderer.beginDraw(DrawMode.TRIANGLE_STRIP);
if (myRenderNormalReversedP) {
renderer.setNormal(-nrm.x, -nrm.y, -nrm.z);
} else {
renderer.setNormal(nrm.x, nrm.y, nrm.z);
}
renderer.addVertex(myRenderVtxs[3]);
renderer.addVertex(myRenderVtxs[0]);
renderer.addVertex(myRenderVtxs[2]);
renderer.addVertex(myRenderVtxs[1]);
renderer.endDraw();
}
renderer.setShading(savedShading);
renderer.setFaceStyle(FaceStyle.FRONT);
renderer.drawPoint(myRenderProps, myRenderCoords, isSelected());
}
use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class ParticlePlaneConstraint method render.
public void render(Renderer renderer, int flags) {
if (myPlaneSize > 0) {
computeRenderVtxs();
RenderProps props = myRenderProps;
Shading savedShading = renderer.setPropsShading(props);
renderer.setFaceColoring(props, isSelected());
renderer.setFaceStyle(props.getFaceStyle());
renderer.beginDraw(DrawMode.TRIANGLE_STRIP);
renderer.setNormal(myNrm.x, myNrm.y, myNrm.z);
renderer.addVertex(myRenderVtxs[3]);
renderer.addVertex(myRenderVtxs[0]);
renderer.addVertex(myRenderVtxs[2]);
renderer.addVertex(myRenderVtxs[1]);
renderer.endDraw();
renderer.setShading(savedShading);
// set default
renderer.setFaceStyle(FaceStyle.FRONT);
}
}
Aggregations