use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class PlanarConnector method render.
public void render(Renderer renderer, int flags) {
Vector3d nrm = new Vector3d(0, 0, 1);
RigidTransform3d TDW = getCurrentTDW();
computeRenderVtxs(TDW);
nrm.transform(TDW);
RenderProps props = myRenderProps;
Shading savedShading = renderer.setPropsShading(props);
renderer.setFaceColoring(props, isSelected());
renderer.setFaceStyle(props.getFaceStyle());
renderer.beginDraw(DrawMode.TRIANGLE_STRIP);
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);
// set default
renderer.setFaceStyle(FaceStyle.FRONT);
renderer.drawPoint(myRenderProps, myRenderCoords, isSelected());
}
use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class SoftPlaneCollider method render.
public void render(Renderer renderer, int flags) {
Point3d renderCenter = new Point3d();
myPlane.set(myNormal, myCenter);
myPlane.project(renderCenter, myCenter);
RigidTransform3d X = new RigidTransform3d();
Vector3d nrml = myPlane.getNormal();
X.R.setZDirection(nrml);
X.p.set(renderCenter);
renderer.pushModelMatrix();
renderer.mulModelMatrix(X);
Shading savedShading = renderer.setPropsShading(myRenderProps);
renderer.setFaceColoring(myRenderProps, isSelected());
renderer.setFaceStyle(myRenderProps.getFaceStyle());
renderer.beginDraw(Renderer.DrawMode.TRIANGLE_STRIP);
renderer.setNormal(nrml.x, nrml.y, nrml.z);
renderer.addVertex(mySize, -mySize, 0);
renderer.addVertex(mySize, mySize, 0);
renderer.addVertex(-mySize, -mySize, 0);
renderer.addVertex(-mySize, mySize, 0);
renderer.endDraw();
renderer.setShading(savedShading);
// set default
renderer.setFaceStyle(FaceStyle.FRONT);
renderer.popModelMatrix();
}
use of maspack.render.Renderer.Shading in project artisynth_core by artisynth.
the class FreehandTool method render.
public void render(Renderer renderer, int flags) {
if (!myVisibleP) {
return;
}
renderer.pushModelMatrix();
RigidTransform3d X = new RigidTransform3d();
getToolToWorld(X);
renderer.mulModelMatrix(X);
Shading savedShading = renderer.setShading(Shading.NONE);
float[] rgb = new float[4];
myLineColor.getRGBColorComponents(rgb);
renderer.setColor(rgb);
renderer.setLineWidth(myLineWidth);
if (myClosedP) {
renderer.beginDraw(DrawMode.LINE_LOOP);
} else {
renderer.beginDraw(DrawMode.LINE_STRIP);
}
for (int i = 0; i < myPoints.size(); i++) {
Point2d p = myPoints.get(i);
renderer.addVertex(p.x, p.y, 0);
}
renderer.endDraw();
renderer.setLineWidth(1);
renderer.setShading(savedShading);
renderer.popModelMatrix();
}
Aggregations