use of maspack.render.Renderer.ColorInterpolation in project artisynth_core by artisynth.
the class PointMeshRenderer method render.
@Override
public void render(Renderer renderer, RenderProps props, int flags) {
PointMesh mesh = getMesh();
RenderObject rob = getRenderObject();
if (mesh.numVertices() == 0) {
return;
}
boolean highlight = ((flags & Renderer.HIGHLIGHT) != 0);
renderer.pushModelMatrix();
if (mesh.isRenderBuffered()) {
renderer.mulModelMatrix(mesh.getXMeshToWorldRender());
} else {
renderer.mulModelMatrix(mesh.XMeshToWorld);
}
float savedLineWidth = renderer.getLineWidth();
Shading savedShadeModel = renderer.getShading();
// if (renderer.isSelecting()) {
// shading = Shading.NONE;
// }
PointStyle pointStyle = props.getPointStyle();
if (pointStyle == PointStyle.POINT && !mesh.hasNormals()) {
renderer.setShading(Shading.NONE);
} else {
renderer.setShading(props.getShading());
}
ColorInterpolation savedColorInterp = null;
if (usingHSV(mesh)) {
savedColorInterp = renderer.setColorInterpolation(ColorInterpolation.HSV);
}
renderer.setPointColoring(props, highlight);
switch(pointStyle) {
case POINT:
{
int size = props.getPointSize();
if (size > 0) {
renderer.drawPoints(rob, PointStyle.POINT, size);
}
break;
}
case CUBE:
case SPHERE:
{
double rad = props.getPointRadius();
if (rad > 0) {
renderer.drawPoints(rob, pointStyle, rad);
}
break;
}
}
if (savedColorInterp != null) {
renderer.setColorInterpolation(savedColorInterp);
}
if (mesh.getNormalRenderLen() > 0) {
renderer.setLineWidth(props.getLineWidth());
renderer.setLineColoring(props, highlight);
renderer.drawLines(rob);
}
renderer.setLineWidth(savedLineWidth);
renderer.setShading(savedShadeModel);
renderer.popModelMatrix();
}
use of maspack.render.Renderer.ColorInterpolation in project artisynth_core by artisynth.
the class PolylineMeshRenderer method render.
@Override
public void render(Renderer renderer, RenderProps props, int flags) {
PolylineMesh mesh = getMesh();
RenderObject rob = getRenderObject();
if (mesh.numVertices() == 0) {
return;
}
boolean highlight = ((flags & Renderer.HIGHLIGHT) != 0);
renderer.pushModelMatrix();
if (mesh.isRenderBuffered()) {
renderer.mulModelMatrix(mesh.getXMeshToWorldRender());
} else {
renderer.mulModelMatrix(mesh.XMeshToWorld);
}
float savedLineWidth = renderer.getLineWidth();
Shading savedShadeModel = renderer.getShading();
// Shading shading = props.getShading();
// if (renderer.isSelecting()) {
// shading = Shading.NONE;
// }
LineStyle lineStyle = props.getLineStyle();
Shading savedShading = renderer.getShading();
if (lineStyle == LineStyle.LINE && !mesh.hasNormals()) {
renderer.setShading(Shading.NONE);
} else {
renderer.setShading(props.getShading());
}
ColorInterpolation savedColorInterp = null;
if (usingHSV(mesh)) {
savedColorInterp = renderer.setColorInterpolation(ColorInterpolation.HSV);
}
renderer.setLineColoring(props, highlight);
switch(lineStyle) {
case LINE:
{
int width = props.getLineWidth();
if (width > 0) {
renderer.drawLines(rob, LineStyle.LINE, width);
}
break;
}
case SPINDLE:
case SOLID_ARROW:
case CYLINDER:
{
double rad = props.getLineRadius();
if (rad > 0) {
renderer.drawLines(rob, props.getLineStyle(), rad);
}
break;
}
}
if (savedColorInterp != null) {
renderer.setColorInterpolation(savedColorInterp);
}
renderer.setShading(savedShading);
renderer.setLineWidth(savedLineWidth);
renderer.setShading(savedShadeModel);
renderer.popModelMatrix();
}
Aggregations