modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGShape3D.java
Print this page
*** 110,120 ****
if (g.getLights() == null || g.getLights()[0] == null) {
// If no lights are in scene apply default light. Default light
// is a single point white point light at camera eye position.
meshView.setAmbientLight(0.0f, 0.0f, 0.0f);
Vec3d cameraPos = g.getCameraNoClone().getPositionInWorld(null);
! meshView.setPointLight(pointLightIdx++,
(float)cameraPos.x,
(float)cameraPos.y,
(float)cameraPos.z,
1.0f, 1.0f, 1.0f, 1.0f);
} else {
--- 110,120 ----
if (g.getLights() == null || g.getLights()[0] == null) {
// If no lights are in scene apply default light. Default light
// is a single point white point light at camera eye position.
meshView.setAmbientLight(0.0f, 0.0f, 0.0f);
Vec3d cameraPos = g.getCameraNoClone().getPositionInWorld(null);
! meshView.setPointLight(pointLightIdx++, g.getPixelScaleFactor(),
(float)cameraPos.x,
(float)cameraPos.y,
(float)cameraPos.z,
1.0f, 1.0f, 1.0f, 1.0f);
} else {
*** 149,159 ****
// intensity *= attenuationFactor;
if (lightBase instanceof NGPointLight) {
NGPointLight light = (NGPointLight)lightBase;
if (rL != 0.0f || gL != 0.0f || bL != 0.0f) {
Affine3D lightWT = light.getWorldTransform();
! meshView.setPointLight(pointLightIdx++,
(float)lightWT.getMxt(),
(float)lightWT.getMyt(),
(float)lightWT.getMzt(),
rL, gL, bL, 1.0f);
}
--- 149,159 ----
// intensity *= attenuationFactor;
if (lightBase instanceof NGPointLight) {
NGPointLight light = (NGPointLight)lightBase;
if (rL != 0.0f || gL != 0.0f || bL != 0.0f) {
Affine3D lightWT = light.getWorldTransform();
! meshView.setPointLight(pointLightIdx++, g.getPixelScaleFactor(),
(float)lightWT.getMxt(),
(float)lightWT.getMyt(),
(float)lightWT.getMzt(),
rL, gL, bL, 1.0f);
}
*** 171,181 ****
meshView.setAmbientLight(ambientRed, ambientGreen, ambientBlue);
}
// TODO: 3D Required for D3D implementation of lights, which is limited to 3
while (pointLightIdx < 3) {
// Reset any previously set lights
! meshView.setPointLight(pointLightIdx++, 0, 0, 0, 0, 0, 0, 0);
}
meshView.render(g);
}
--- 171,181 ----
meshView.setAmbientLight(ambientRed, ambientGreen, ambientBlue);
}
// TODO: 3D Required for D3D implementation of lights, which is limited to 3
while (pointLightIdx < 3) {
// Reset any previously set lights
! meshView.setPointLight(pointLightIdx++, 0, 0, 0, 0, 0, 0, 0, 0);
}
meshView.render(g);
}