Search in sources :

Example 1 with LightComponent

use of artisynth.core.renderables.LightComponent in project artisynth_core by artisynth.

the class SpecularTest method attach.

@Override
public void attach(DriverInterface driver) {
    super.attach(driver);
    GLViewer viewer = driver.getViewer();
    for (int i = viewer.numLights(); i-- > 0; ) {
        viewer.removeLight(i);
    }
    Light light = new Light();
    light.setAmbient(0, 0, 0, 0);
    light.setDiffuse(0, 0, 0, 0);
    light.setSpecular(1, 1, 1, 1);
    light.setPosition(0, 0, 1);
    light.setDirection(0, 0, -1);
    light.setType(LightType.POINT);
    viewer.addLight(light);
    LightComponent lc = new LightComponent(light);
    ComponentList<LightComponent> lights = new ComponentList<>(LightComponent.class, "lights");
    lights.add(lc);
    add(lights);
}
Also used : GLViewer(maspack.render.GL.GLViewer) Light(maspack.render.Light) LightComponent(artisynth.core.renderables.LightComponent) ComponentList(artisynth.core.modelbase.ComponentList)

Aggregations

ComponentList (artisynth.core.modelbase.ComponentList)1 LightComponent (artisynth.core.renderables.LightComponent)1 GLViewer (maspack.render.GL.GLViewer)1 Light (maspack.render.Light)1