use of maspack.render.Renderer.PointStyle in project artisynth_core by artisynth.
the class VertexList method drawPoints.
private void drawPoints(Renderer renderer, int gidx, RenderProps props, boolean selected) {
Shading savedShading = renderer.setPointShading(props);
renderer.setPointColoring(props, selected);
PointStyle style = props.getPointStyle();
switch(style) {
case POINT:
{
int size = props.getPointSize();
if (size > 0) {
// renderer.setLightingEnabled (false);
// renderer.setColor (props.getPointColorArray(), selected);
renderer.drawPoints(myRob, gidx, PointStyle.POINT, size);
// renderer.setLightingEnabled (true);
}
break;
}
case CUBE:
case SPHERE:
{
double rad = props.getPointRadius();
if (rad > 0) {
// Shading savedShading = renderer.getShadeModel();
// renderer.setPointLighting (props, selected);
renderer.drawPoints(myRob, gidx, style, rad);
// renderer.setShadeModel(savedShading);
}
break;
}
}
renderer.setShading(savedShading);
}
use of maspack.render.Renderer.PointStyle in project artisynth_core by artisynth.
the class VertexList method render.
public void render(Renderer renderer, int flags) {
RenderProps props = myRenderProps;
if (renderer.isSelecting()) {
PointStyle style = props.getPointStyle();
if (style == PointStyle.POINT) {
int size = props.getPointSize();
if (size > 0) {
renderer.setPointSize(size);
} else {
return;
}
}
for (int i = 0; i < size(); i++) {
VertexComponent pnt = get(i);
if (pnt.getRenderProps() == null && renderer.isSelectable(pnt)) {
float[] v0 = pnt.myRenderCoords;
renderer.beginSelectionQuery(i);
switch(style) {
case POINT:
{
renderer.drawPoint(v0);
break;
}
case CUBE:
{
renderer.drawCube(v0, 2 * props.getPointRadius());
}
case SPHERE:
{
renderer.drawSphere(v0, props.getPointRadius());
break;
}
}
renderer.endSelectionQuery();
}
}
if (style == PointStyle.POINT) {
renderer.setPointSize(1);
}
} else if (myRob != null) {
int numReg = myRob.numPoints(REG_GRP);
int numSel = myRob.numPoints(SEL_GRP);
// draw selected first
if (numSel > 0) {
drawPoints(renderer, SEL_GRP, props, /*selected=*/
true);
}
if (numReg > 0) {
drawPoints(renderer, REG_GRP, props, /*selected=*/
false);
}
}
}
Aggregations