use of maspack.render.HasRenderProps in project artisynth_core by artisynth.
the class PointTracingProbe method initRenderProps.
private void initRenderProps(ModelComponent comp) {
RenderProps newProps = createRenderProps();
if (comp instanceof HasRenderProps) {
HasRenderProps rcomp = (HasRenderProps) comp;
RenderProps compProps = rcomp.getRenderProps();
if (compProps == null) {
compProps = rcomp.createRenderProps();
}
newProps.set(compProps);
// line and point colors of render props to match
if (compProps.getPointColorMode() == PropertyMode.Explicit) {
float[] pointColor = compProps.getPointColorF();
newProps.setPointColor(pointColor);
newProps.setLineColor(pointColor);
}
}
newProps.setLineWidth(3);
setRenderProps(newProps);
}
use of maspack.render.HasRenderProps in project artisynth_core by artisynth.
the class IsRenderableHolder method init.
private void init(IsRenderable renderable) {
if (renderable == null) {
throw new IllegalArgumentException("Cannot hold a null object");
}
myRenderable = renderable;
myProps = new PropertyList(IsRenderableHolder.class, RenderableComponentBase.class);
myProps.add("renderProps * *", "render properties", null);
if (myRenderable instanceof HasProperties) {
myProps.addReadOnly("renderable", "the held renderable object");
}
if (myRenderable instanceof HasRenderProps) {
myHasRenderProps = (HasRenderProps) myRenderable;
getRenderPropsMethod = null;
setRenderPropsMethod = null;
createRenderPropsMethod = null;
} else {
myHasRenderProps = null;
// try to find methods
Class<?> clazz = myRenderable.getClass();
getRenderPropsMethod = getMethod(clazz, "getRenderProps");
setRenderPropsMethod = getMethod(clazz, "setRenderProps", RenderProps.class);
createRenderPropsMethod = getMethod(clazz, "createRenderProps");
}
if (myRenderable instanceof Scannable) {
myScannable = (Scannable) myRenderable;
writeMethod = null;
scanMethod = null;
} else {
myScannable = null;
Class<?> clazz = myRenderable.getClass();
writeMethod = getMethod(clazz, "write", PrintWriter.class, NumberFormat.class, Object.class);
scanMethod = getMethod(clazz, "scan", ReaderTokenizer.class, CompositeComponent.class);
}
}
use of maspack.render.HasRenderProps in project artisynth_core by artisynth.
the class VectorTracingProbe method initRenderProps.
private void initRenderProps(ModelComponent comp) {
RenderProps newProps = createRenderProps();
if (comp instanceof HasRenderProps) {
HasRenderProps rcomp = (HasRenderProps) comp;
RenderProps compProps = rcomp.getRenderProps();
if (compProps == null) {
compProps = rcomp.createRenderProps();
}
newProps.set(compProps);
// line and point colors of render props to match
if (compProps.getPointColorMode() == PropertyMode.Explicit) {
float[] pointColor = compProps.getPointColorF();
newProps.setPointColor(pointColor);
newProps.setLineColor(pointColor);
}
}
newProps.setLineWidth(3);
newProps.setLineStyle(LineStyle.CYLINDER);
setRenderProps(newProps);
}
Aggregations