use of maspack.render.RenderObject in project artisynth_core by artisynth.
the class PolygonalMeshRenderer method renderEdges.
public void renderEdges(Renderer renderer, RenderProps props, boolean highlight, FeatureIndexArray edges, boolean featureSelection) {
PolygonalMesh mesh = getMesh();
RenderObject rob = getRenderObject();
if (mesh.numVertices() == 0) {
return;
}
renderer.pushModelMatrix();
if (mesh.isRenderBuffered()) {
renderer.mulModelMatrix(mesh.getXMeshToWorldRender());
} else {
renderer.mulModelMatrix(mesh.XMeshToWorld);
}
drawEdges(renderer, props, highlight, false, rob, edges, featureSelection);
renderer.popModelMatrix();
}
use of maspack.render.RenderObject in project artisynth_core by artisynth.
the class PolygonalMeshRenderer method render.
public void render(Renderer renderer, RenderProps props, boolean highlight, FeatureIndexArray faces, FeatureIndexArray edges, boolean featureSelection) {
PolygonalMesh mesh = getMesh();
if (mesh.numVertices() == 0) {
return;
}
RenderObject rob = getRenderObject();
renderer.pushModelMatrix();
if (mesh.isRenderBuffered()) {
renderer.mulModelMatrix(mesh.getXMeshToWorldRender());
} else {
renderer.mulModelMatrix(mesh.XMeshToWorld);
}
boolean drawFaces = (props.getFaceStyle() != Renderer.FaceStyle.NONE);
ColorMixing savedColorMixing = null;
if (mesh.hasColors()) {
savedColorMixing = renderer.setVertexColorMixing(mesh.getVertexColorMixing());
}
if (props.getDrawEdges()) {
drawEdges(renderer, props, highlight, drawFaces, rob, edges, featureSelection);
}
if (drawFaces) {
drawFaces(renderer, props, highlight, rob, faces, featureSelection);
}
if (mesh.hasColors()) {
renderer.setVertexColorMixing(savedColorMixing);
}
renderer.popModelMatrix();
}
use of maspack.render.RenderObject 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.RenderObject 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.RenderObject in project artisynth_core by artisynth.
the class MeshRendererBase method prerender.
/**
* Updates rendering information
* @param props render properties
*/
public void prerender(RenderProps props) {
RobSignature sig = createSignature(myMesh, props);
if (myRob == null || renderObjectNeedsBuilding(myMesh, props, sig, mySignature)) {
RenderObject robj = buildRenderObject(myMesh, props);
myRob = robj;
mySignature = sig;
} else {
updateRenderObject(myMesh, props, myRob);
}
}
Aggregations