use of maspack.render.Light in project artisynth_core by artisynth.
the class GLViewer method setDefaultLights.
public void setDefaultLights() {
// // For debugging lights, set to R-G-B
// float light0_ambient[] = { 0.2f, 0.2f, 0.2f, 1.0f };
// float light0_diffuse[] = { 0.8f, 0.0f, 0.0f, 1.0f };
// float light0_specular[] = { 0, 0, 0, 1 };
// float light0_position[] = { 1, 0, 0, 0 };
//
// float light1_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
// float light1_diffuse[] = { 0.0f, 0.8f, 0.0f, 1.0f };
// float light1_specular[] = { 0.0f, 0.0f, 0.0f, 1.0f };
// float light1_position[] = { 0, 1, 0, 0 };
//
// float light2_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
// float light2_diffuse[] = { 0.0f, 0.0f, 0.8f, 1.0f };
// float light2_specular[] = { 0.0f, 0.0f, 0.0f, 1.0f };
// float light2_position[] = { 0, 0, 1, 0 };
float[] light0_ambient = { 0.1f, 0.1f, 0.1f, 1f };
float[] light0_diffuse = { 0.8f, 0.8f, 0.8f, 1.0f };
float[] light0_specular = { 0.5f, 0.5f, 0.5f, 1.0f };
float[] light0_position = { -0.8660254f, 0.5f, 1f, 0f };
float[] light1_ambient = { 0.0f, 0.0f, 0.0f, 1.0f };
float[] light1_diffuse = { 0.5f, 0.5f, 0.5f, 1.0f };
float[] light1_specular = { 0.5f, 0.5f, 0.5f, 1.0f };
float[] light1_position = { 0.8660254f, 0.5f, 1f, 0f };
float[] light2_ambient = { 0.0f, 0.0f, 0.0f, 1.0f };
float[] light2_diffuse = { 0.5f, 0.5f, 0.5f, 1.0f };
float[] light2_specular = { 0.5f, 0.5f, 0.5f, 1.0f };
float[] light2_position = { 0f, -10f, 1f, 0f };
lightManager.clearLights();
lightManager.addLight(new Light(light0_position, light0_ambient, light0_diffuse, light0_specular));
lightManager.addLight(new Light(light1_position, light1_ambient, light1_diffuse, light1_specular));
lightManager.addLight(new Light(light2_position, light2_ambient, light2_diffuse, light2_specular));
lightManager.setMaxIntensity(1.0f);
myProgramInfo.setNumLights(lightManager.numLights());
}
use of maspack.render.Light in project artisynth_core by artisynth.
the class GLViewer method addLight.
public Light addLight(float[] position, float[] ambient, float[] diffuse, float[] specular) {
Light light = new Light(position, ambient, diffuse, specular);
lightManager.addLight(light);
myProgramInfo.setNumLights(lightManager.numLights());
return light;
}
use of maspack.render.Light 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);
}
Aggregations