Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8327179: Update the 3D lighting application #1387

Conversation

nlisker
Copy link
Collaborator

@nlisker nlisker commented Mar 3, 2024

Update for the 3D lighting test tool as described in the JBS issue.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8327179: Update the 3D lighting application (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1387/head:pull/1387
$ git checkout pull/1387

Update a local copy of the PR:
$ git checkout pull/1387
$ git pull https://git.openjdk.org/jfx.git pull/1387/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1387

View PR using the GUI difftool:
$ git pr show -t 1387

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1387.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 3, 2024

👋 Welcome back nlisker! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@nlisker nlisker marked this pull request as ready for review March 3, 2024 22:48
@openjdk openjdk bot added the rfr Ready for review label Mar 3, 2024
@mlbridge
Copy link

mlbridge bot commented Mar 3, 2024

Webrevs

@kevinrushforth
Copy link
Member

Reviewer: @arapte

@jayathirthrao you might also want to take a look?

@arapte
Copy link
Member

arapte commented Mar 5, 2024

Couple quick comments:

  • Executing the LightingSample manually fails with an exception
Caused by: java.lang.NullPointerException: Input stream must not be null
	at javafx.graphics@23-internal/javafx.scene.image.Image.validateInputStream(Image.java:1140)
	at javafx.graphics@23-internal/javafx.scene.image.Image.<init>(Image.java:707)
	at lighting3D.Environment.<clinit>(Environment.java:64)

Steps:
cd tests/performance/3DLighting/src/main/java
javac <compile.args> lighting3D/*.java
java <run.args> lighting3D.LightingApplication

  • The copyright year new files should be 2024 only. Some new files have more than one copyright year. If you are moving any existing files then please use git mv so that the files are shown as moved.
  • Some files are missing copyright headers.

Copy link
Member

@arapte arapte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

providing few more comments

var stopGraphic = new Text("⏹");
stopGraphic.setBoundsType(TextBoundsType.VISUAL);
stopGraphic.setFill(Color.RED);
stopGraphic.setFont(Font.font(20));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Play and Stop button could be same size. It would be good to look at. Currently the Stop button seems lesser than half size of play button.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you will see, the font sizes and visual sizes don't render as you would expect. Not sure why, but this way they look better. Perhaps small adjustments are in order, but if you match the sizes it comes out off.

@arapte
Copy link
Member

arapte commented Mar 6, 2024

An observation out of scope of this PR.
The effect of lighting on mesh vs a box is quite different.
Notice the screenshot, left side is a Box and right side is Mesh, both have Magenta SpotLight.
I think the effect of light should be same on a 2D surface, and the effect on Box seems correct to me.
Another observation: The effect of light on Mesh is different with 100 divisions than 200+ divisions.

Screenshot 2024-03-06 at 3 36 09 PM

@openjdk
Copy link

openjdk bot commented Mar 13, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@nlisker
Copy link
Collaborator Author

nlisker commented Mar 13, 2024

Executing the LightingSample manually fails with an exception

I think the package names of the main and resources weren't aligned.

The copyright year new files should be 2024 only. Some new files have more than one copyright year. If you are moving any existing files then please use git mv so that the files are shown as moved.

For now, for the ease of reviewing, I reverted the package name change.

The effect of lighting on mesh vs a box is quite different.

I think this is the same issue you submitted in the past: https://bugs.openjdk.org/browse/JDK-8269133

@jayathirthrao
Copy link
Member

Even after reverting package name i continue to see that 3DLighting throws exception when we manually launch it:

javafx.graphics@23-internal/javafx.scene.image.Image.validateInputStream(Image.java:1140)
	at javafx.graphics@23-internal/javafx.scene.image.Image.<init>(Image.java:707)
	at attenuation.Environment.<clinit>(Environment.java:64)

@nlisker
Copy link
Collaborator Author

nlisker commented Mar 25, 2024

I can't reproduce the exception. The path to the image is correct. Both the class and the image are under the attenuation package. Here is my launch command:

C:\Program Files\Java\jdk-21\bin\javaw.exe "-Djava.library.path=C:\Users\Nir\git\jfx\modules\javafx.graphics\build\module-lib"
--add-modules=javafx.controls,javafx.swing
-Dfile.encoding=UTF-8
-Dstdout.encoding=UTF-8
-Dstderr.encoding=UTF-8
-p "C:\Users\Nir\git\jfx\modules\javafx.controls\bin;C:\Users\Nir\git\jfx\modules\javafx.graphics\bin;C:\Users\Nir\git\jfx\modules\javafx.base\bin;C:\Users\Nir\git\jfx\modules\javafx.swing\bin"
-classpath "C:\Users\Nir\git\jfx\tests\performance\3DLighting\bin"
-XX:+ShowCodeDetailsInExceptionMessages
--add-exports javafx.graphics/test.com.sun.javafx.pgstub=javafx.controls
--add-exports javafx.base/test.com.sun.javafx.binding=javafx.controls
--add-exports javafx.base/test.util.memory=javafx.controls
--add-exports javafx.base/test.javafx.collections=javafx.controls
--add-exports javafx.base/com.sun.javafx.property=javafx.graphics
--add-exports javafx.base/test.javafx.collections=javafx.graphics
--add-exports javafx.base/test.util.memory=javafx.graphics
--add-exports java.base/sun.security.util=javafx.graphics
--add-reads javafx.base=java.management
--add-reads javafx.base=jdk.management attenuation.LightingApplication

Perhaps it's a platform-dependent path issue?

@kevinrushforth
Copy link
Member

I can reproduce the exception if I compile the test program from the command line in the .../src/main/java dir using javac and run the program from there. The reason that happens is the separation of the resources into a separate directory tree.

One way to solve this, so we can still easily compile and run it from the command line, is to provide an "ant" or "gradle" script as was done for MonkeyTester and FXMediaPlayer

@openjdk openjdk bot removed the rfr Ready for review label Mar 27, 2024
@nlisker
Copy link
Collaborator Author

nlisker commented Mar 27, 2024

I added the application to the gradle build file so it can be hooked up with its module dependencies. You can now produce a jar that bundles the resource with the classes. You still need to point to the modules at runtime.
Let me know if this is a good enough solution.

The way the project is configured in the main build file is not the best, but it will require large changes to do it better.

@nlisker
Copy link
Collaborator Author

nlisker commented Mar 27, 2024

Not sure what jcheck wants. It's complaining about empty spaces that have a } appear after them. This is the error: https://github.com/openjdk/jfx/pull/1387/files#annotation_19798318258.

@openjdk openjdk bot added the rfr Ready for review label Mar 27, 2024
@nlisker
Copy link
Collaborator Author

nlisker commented Mar 27, 2024

Looks like the line specified by jcheck was off.

Comment on lines +4047 to +4049
project(":3DLighting") {

apply plugin: "application"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't meant to suggest adding it to the main build.gradle. I think this is not the best place for it. I was thinking of something along the lines of a build.gradle or build.xml in thetests/performance/3DLighting dir which is what the other manual tests do -- at least those that are more complicated than just a collection of files in a single directory.

<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file seem unrelated to your PR.

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 25, 2024

@nlisker This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented May 23, 2024

@nlisker This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfr Ready for review
4 participants