use of maspack.render.Renderer.LineStyle in project artisynth_core by artisynth.
the class CollisionRenderer method drawLines.
private void drawLines(Renderer renderer, RenderObject ro, RenderProps props) {
LineStyle style = props.getLineStyle();
Shading savedShading = renderer.setLineShading(props);
renderer.setLineColoring(props, /*highlight=*/
false);
switch(style) {
case LINE:
{
int width = props.getLineWidth();
if (width > 0) {
// renderer.setLightingEnabled (false);
// renderer.setColor (props.getLineColorArray(), /*highlight=*/false);
renderer.drawLines(ro, LineStyle.LINE, width);
// renderer.setLightingEnabled (true);
}
break;
}
// do we need to handle the solid line case?
case SPINDLE:
case SOLID_ARROW:
case CYLINDER:
{
double rad = props.getLineRadius();
if (rad > 0) {
// Shading savedShading = renderer.getShadeModel();
// renderer.setLineLighting (props, /*highlight=*/false);
renderer.drawLines(ro, style, rad);
// renderer.setShadeModel(savedShading);
}
break;
}
}
renderer.setShading(savedShading);
}
use of maspack.render.Renderer.LineStyle 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.LineStyle in project artisynth_core by artisynth.
the class MultiPointSpring method dorender.
void dorender(Renderer renderer, RenderProps props) {
RenderObject robj = myRenderObj;
if (myDrawABPointsP) {
// draw AB points
for (int i = 0; i < numSegments(); i++) {
Segment seg = mySegments.get(i);
if (seg instanceof WrapSegment) {
WrapSegment wrapSeg = (WrapSegment) seg;
ArrayList<float[]> renderPoints = wrapSeg.myRenderABPoints;
if (renderPoints != null) {
for (int k = 0; k < renderPoints.size(); k++) {
renderer.drawPoint(myABRenderProps, renderPoints.get(k), isSelected());
}
}
}
}
}
if (robj != null) {
double size;
// draw the strands
LineStyle lineStyle = props.getLineStyle();
if (lineStyle == LineStyle.LINE) {
size = props.getLineWidth();
} else {
size = props.getLineRadius();
}
if (getRenderColor() != null) {
renderer.setColor(getRenderColor(), isSelected());
} else {
renderer.setLineColoring(props, isSelected());
}
renderer.drawLines(robj, lineStyle, size);
if (myDrawKnotsP) {
// draw the knots, if any
PointStyle pointStyle = props.getPointStyle();
if (pointStyle == PointStyle.POINT) {
size = props.getPointSize();
} else {
size = props.getPointRadius();
}
renderer.setPointColoring(props, isSelected());
robj.pointGroup(FREE_KNOTS);
renderer.drawPoints(robj, pointStyle, size);
robj.pointGroup(CONTACTING_KNOTS);
if (myContactingKnotsColor != null) {
renderer.setColor(myContactingKnotsColor);
}
renderer.drawPoints(robj, pointStyle, size);
}
}
}
use of maspack.render.Renderer.LineStyle 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();
}
use of maspack.render.Renderer.LineStyle in project artisynth_core by artisynth.
the class AxialSpringList method render.
public void render(Renderer renderer, RenderProps props, int flags) {
if (renderer.isSelecting()) {
LineStyle style = props.getLineStyle();
if (style == LineStyle.LINE) {
int width = props.getLineWidth();
if (width > 0) {
renderer.setLineWidth(width);
} else {
return;
}
}
double rad = props.getLineRadius();
for (int i = 0; i < size(); i++) {
AxialSpring spr = get(i);
if (spr.getRenderProps() == null && renderer.isSelectable(spr)) {
float[] v0 = spr.myPnt0.myRenderCoords;
float[] v1 = spr.myPnt1.myRenderCoords;
renderer.beginSelectionQuery(i);
switch(style) {
case LINE:
{
renderer.drawLine(v0, v1);
break;
}
case SPINDLE:
{
renderer.drawSpindle(v0, v1, rad);
break;
}
case SOLID_ARROW:
{
renderer.drawArrow(v0, v1, rad, /*capped=*/
true);
break;
}
case CYLINDER:
{
renderer.drawCylinder(v0, v1, rad, /*capped=*/
false);
break;
}
}
renderer.endSelectionQuery();
}
}
if (style == LineStyle.LINE) {
renderer.setLineWidth(1);
}
} else if (myRob != null) {
int numReg = myRob.numLines(REG_GRP);
int numSel = myRob.numLines(SEL_GRP);
if (numReg > 0) {
myRob.lineGroup(REG_GRP);
drawLines(renderer, props, /*selected=*/
false);
}
if (numSel > 0) {
myRob.lineGroup(SEL_GRP);
drawLines(renderer, props, /*selected=*/
true);
}
}
}
Aggregations