use of maspack.render.RenderObject in project artisynth_core by artisynth.
the class VertexList method buildRenderObject.
protected void buildRenderObject() {
myRob = new RenderObject();
myRob.createPointGroup();
myRob.createPointGroup();
for (int i = 0; i < size(); i++) {
VertexComponent pnt = get(i);
myRob.addPosition(pnt.myRenderCoords);
myRob.addVertex(i);
if (pnt.getRenderProps() == null) {
myRob.pointGroup(pnt.isSelected() ? SEL_GRP : REG_GRP);
myRob.addPoint(i);
}
}
myRobValidP = true;
}
use of maspack.render.RenderObject in project artisynth_core by artisynth.
the class MultiViewerTesterBase method addAxes.
protected static void addAxes(MultiViewer tester) {
// axes
RenderObject axes = new RenderObject();
axes.beginBuild(DrawMode.LINES);
axes.addColor(255, 0, 0, 255);
axes.vertex(0, 0, 0);
axes.vertex(1, 0, 0);
axes.addColor(0, 255, 0, 255);
axes.vertex(0, 0, 0);
axes.vertex(0, 1, 0);
axes.addColor(0, 0, 255, 255);
axes.vertex(0, 0, 0);
axes.vertex(0, 0, 1);
axes.endBuild();
tester.addRenderable(new RenderObjectWrapper(axes));
}
use of maspack.render.RenderObject in project artisynth_core by artisynth.
the class MultiViewerTesterBase method addStanfordBunnies.
protected static void addStanfordBunnies(MultiViewer tester, PolygonalMesh bunny) {
RenderProps rprops = new RenderProps();
rprops.setFaceStyle(FaceStyle.FRONT_AND_BACK);
rprops.setShading(Shading.SMOOTH);
rprops.setFaceColor(Color.WHITE.darker());
rprops.setBackColor(Color.BLUE);
rprops.setLineColor(Color.ORANGE);
rprops.setSpecular(Color.WHITE);
rprops.setShininess(1000);
// rprops.setPointSlices(24);
// rprops.setLineSlices(24);
rprops.setShading(Shading.SMOOTH);
if (bunny != null) {
// one bunny
RenderObject bunnyRO;
RenderObjectWrapper rbunny;
bunnyRO = RenderObjectFactory.createFromMesh(bunny, rprops.getShading() == Shading.FLAT, rprops.getDrawEdges());
rbunny = new RenderObjectWrapper(bunnyRO);
rbunny.setTransform(new RigidTransform3d(new Vector3d(-0.707, 0.707, 0), AxisAngle.IDENTITY));
rbunny.setRenderProps(rprops);
tester.addRenderable(rbunny);
// two bunny
bunnyRO = RenderObjectFactory.createFromMesh(bunny, rprops.getShading() == Shading.FLAT, true);
rbunny = new RenderObjectWrapper(bunnyRO);
rbunny.setTransform(new RigidTransform3d(new Vector3d(0.707, -0.707, 0), AxisAngle.IDENTITY));
rbunny.setRenderProps(new RenderProps(rprops));
rbunny.getRenderProps().setDrawEdges(true);
rbunny.getRenderProps().setFaceColor(new Color(175, 153, 128));
rbunny.getRenderProps().setEdgeColor(new Color(175, 153, 128).darker());
tester.addRenderable(rbunny);
}
}
use of maspack.render.RenderObject in project artisynth_core by artisynth.
the class MultiViewerTesterBase method addSolidBunny.
protected static void addSolidBunny(MultiViewer tester, PolygonalMesh bunny) {
RenderProps rprops = new RenderProps();
rprops.setFaceStyle(FaceStyle.FRONT_AND_BACK);
rprops.setShading(Shading.SMOOTH);
rprops.setFaceColor(new Color(20, 20, 20));
rprops.setBackColor(Color.MAGENTA.darker());
rprops.setLineColor(Color.ORANGE);
rprops.setPointColor(Color.PINK);
rprops.setSpecular(Color.WHITE);
rprops.setShininess(1000);
// rprops.setPointSlices(24);
// rprops.setLineSlices(24);
rprops.setShading(Shading.SMOOTH);
rprops.setPointStyle(PointStyle.SPHERE);
rprops.setLineStyle(LineStyle.SOLID_ARROW);
rprops.setLineRadius(0.001);
rprops.setPointRadius(0.005);
if (bunny != null) {
// one bunny
RenderObject bunnyRO;
RenderObjectWrapper rbunny;
bunnyRO = RenderObjectFactory.createFromMesh(bunny, rprops.getShading() == Shading.FLAT, true);
// vertices
for (int i = 0; i < bunnyRO.numVertices(); ++i) {
bunnyRO.addPoint(i);
}
rbunny = new RenderObjectWrapper(bunnyRO);
rbunny.setTransform(new RigidTransform3d(new Vector3d(0, 0, 0), AxisAngle.IDENTITY));
rbunny.setRenderProps(rprops);
tester.addRenderable(rbunny);
}
}
use of maspack.render.RenderObject in project artisynth_core by artisynth.
the class MultiViewerTesterBase method addCylinder.
protected static void addCylinder(MultiViewer tester) {
// cylinder
RenderObject cylinderRO = RenderObjectFactory.createCylinder(32, true);
RenderObjectWrapper rcylinder = new RenderObjectWrapper(cylinderRO);
AffineTransform3d cscale = new AffineTransform3d();
cscale.setTranslation(0.3, 0.3, 0);
cscale.setRotation(new AxisAngle(1d / Math.sqrt(2), -1d / Math.sqrt(2), 0, Math.PI / 8));
cscale.applyScaling(0.05, 0.05, 1.0);
rcylinder.setTransform(cscale);
RenderProps rprops2 = rcylinder.getRenderProps();
rprops2.setFaceColor(Color.CYAN);
rprops2.setShading(Shading.SMOOTH);
tester.addRenderable(rcylinder);
}
Aggregations