Compare commits

...

118 Commits
master ... v3.1

Author SHA1 Message Date
Stephen Gold
607e24b2fa rm docs from v3.1 branch to reduce risk from issues like #1160 2019-09-17 13:12:08 -07:00
NemesisMate
92e85f9012 Fixed softkeyboard's (simulated) backspace not being recognized (#713) 2017-09-21 15:28:36 -04:00
Nehon
b1727b9772 Fixed InstanceGeomerty not working properly when using the lighting material and a non DirectionalLight
see https://hub.jmonkeyengine.org/t/instancednode-doesnt-work-with-light/38316/5
2017-04-12 20:58:33 +02:00
empirephoenix
088419eef0 Merge pull request #582 from FennelFetish/font
Fixes tab stops in BitmapText / BitmapFont (3.1)
2017-04-07 10:23:03 +02:00
Rémy Bouquet
9ba574e584 fixed bad comma in previous commit 2017-04-01 22:06:31 +02:00
Nehon
c154a47b02 Fixed tangent and normal argument position in Skinning.glsllib 2017-04-01 05:46:19 +02:00
MeFisto94
10b23db94d TestMipMapGen: Use the non AWT MipMap Generator (Don't depend on jme3-desktop but jme3-core, to run this test on android) 2017-03-20 14:35:22 +01:00
MeFisto94
479392f6fd TestFancyCar: Remove unused SettingsDialog imports, allowing the Test to also run on android (no jme3-desktop dependency anymore) 2017-03-20 14:30:47 +01:00
Rémy Bouquet
5470abb2b0 Fixed warnings in Terrain shader.
Fixed the use of the first diffuse map
Fixed the camera positioning in the TestSpotLightTerrain
2017-02-26 09:30:08 +01:00
empirephoenix
8214346e8b Merge pull request #624 from jMonkeyEngine/revert-573-cleanup_build_scripts
Revert "Cleanup build scripts (3.1)"
2017-02-24 16:39:35 +01:00
empirephoenix
a87db2c117 Revert "Cleanup build scripts (3.1)" 2017-02-24 16:39:20 +01:00
empirephoenix
0f93df648e Merge pull request #573 from jMonkeyEngine/cleanup_build_scripts
Cleanup build scripts (3.1)
2017-02-24 10:03:44 +01:00
Paul Speed
af04bf9d22 Forcing one of the files to change so we might actually get a new build. 2017-02-12 22:35:55 -05:00
empirephoenix
2761bc3677 Merge pull request #615 from riccardobl/FixMeshCollisionShapeJ3oReadv3.1
Fix bullet crash when MeshCollisionShape is loaded from j3o [v3.1]
2017-02-06 15:34:56 +01:00
Riccardo Balbo
1ae6e98d05 Fix MeshCollisionShape crash when loaded from j3o: always create BVH before scaling. 2017-02-06 14:59:30 +01:00
Nehon
69cd160956 Fixed an issue where ParticleEmitter had NaN bounds during the first update when added to the scene graph during the update loop 2017-01-26 21:10:49 +01:00
Nehon
789daa6295 Fixed warning that were coming out of the particle.j3md. Also fixed the preshadow technique 2017-01-24 20:17:19 +01:00
Rémy Bouquet
659ed8fd23 Merge pull request #602 from stephengold/v3.1
fix errors in how vector projection is calculated
2017-01-20 23:14:15 +01:00
Stephen Gold
f3e2925bd8 fix errors in how vector projection is calculated 2017-01-20 13:08:28 -08:00
Rémy Bouquet
5d2c89f040 Merge pull request #599 from stephengold/v3.1
CapsuleCollisionShape: warn about scaling only if it's not identity
2017-01-17 21:31:31 +01:00
Stephen Gold
ac8eb4d40a CapsuleCollisionShape: warn about scaling only if it's not identity
same diff riccardobl committed to 'master' on Jun 20, 2016
2017-01-17 11:42:21 -08:00
Nehon
aae6170cc5 Fixed MikktSpaceTangentGenerator that was not replacing existing Tangent buffers on the mesh. That could cause crashes when the old tangent buffer did not have the same amount of components 2016-12-30 16:53:09 +01:00
iwgeric
7ecb81c230 Update AndroidLocator to allow assets to be stored in Android assets, drawable, or mipmap directories.
Texture assets can now be stored in Android Drawable and Mipmap directories.  Allows Android to automatically select the closest matching image asset for the actual device configuration (ie. lower resolution textures for lower-end devices).  Search order is:  assets -> drawable -> mipmap.  First match found is returned.

(cherry picked from commit c219ce1)
2016-12-29 00:41:02 -05:00
Paul Speed
63e8c9c485 Convert Skeleton and Bone over to use the JME cloner system for cloning...
this should do automatic fix-up and hopefully make bones attachments work 
properly again in clones.
2016-12-13 06:03:43 -05:00
empirephoenix
975954fb17 Merge pull request #575 from Fadorico/upstream3.1
Write/read the width and height of a quad (3.1)
2016-12-07 13:01:26 +01:00
Fennel
e60d67b1bb Fixes tab stops in BitmapText / BitmapFont.
The first explicitely set tab stop was always skipped.
For all non-explicitely set tab stops it inserted a fixed spacing.
This commit changes the behaviour so tabs are aligned to columns.
It also adds handling of tabs to BitmapFont.getLineWidth() which ignored tabs before.
2016-12-07 07:05:23 +01:00
Paul Speed
92b5d40003 Modified BitmapTextPage to always deep clone its mesh since otherwise
BitmapText objects end up sharing them and that's bad.
2016-12-04 20:35:49 -05:00
Paul Speed
4952ad0cb5 Broke out the Serializer's static initializer into a separate initialize()
static method.  This allows servers to completely reset the Serializer's
registry when restarting the server in the same JVM instance.
2016-12-04 16:28:12 -05:00
Paul Speed
a13a3a7f09 Another bitmap text clone fix. The text pages array (the list of the actual geometry of
the bitmap text) wasn't really being cloned... only the elements were.  This meant that
that a cloned BitmapText object would continue to share the meshes from the original.
2016-12-04 15:49:51 -05:00
Paul Speed
735397f16e Another fix for BitmapText cloning where the regular clone() was
completely bypassing the JME cloner framework... and making a bad
clone.
2016-12-04 15:31:30 -05:00
Paul Speed
c1764bc425 Fixed the cloned Letters to use the cloned StringBlock instead of the
original reference.
2016-12-04 14:24:34 -05:00
Paul Speed
da1b7da329 Added a test for cloning BitmapText. 2016-12-04 04:26:41 -05:00
Paul Speed
e879a0e142 Fix for issue #577 StringBlock cannot be cloned with the cloner because
it is package private and the cloner cannot instantiate one directly.
Since it is extremely unlikely (read: impossible) that there would ever 
be shared StringBlock references between BitmapText objects then it is safe 
to just clone it directly.
It is important to note that BitmapText never really did support clone
before and only pretended to... so this wasn't really a regression.
2016-12-04 04:20:55 -05:00
Fadorico
e3bd122519 Write/read the width and height of the quad 2016-11-24 18:16:48 -05:00
Kirill Vainer
36e99bf032 misc: gitignore update for gradle 3.2.1 2016-11-24 15:32:56 -05:00
Kirill Vainer
c37f0e59d2 build: fix gradle 3.2.1 deprecations 2016-11-24 15:31:15 -05:00
Kirill Vainer
06757f73b4 travis: upload artifacts only on linux/jdk8 2016-11-24 15:26:29 -05:00
Kirill Vainer
35b9eed76f travis: reorder structure a bit 2016-11-24 15:25:28 -05:00
Kirill Vainer
e4ed3313d5 travis: fix unsupported jdk 2016-11-24 15:19:39 -05:00
Kirill Vainer
8ce2f9cfe7 travis: test matrix build 2016-11-24 15:08:34 -05:00
Kirill Vainer
b99d03bd3c version: remove sdk related configuration 2016-11-24 14:48:49 -05:00
Kirill Vainer
f800d74e87 travis: remove uneeded install directive 2016-11-24 14:46:21 -05:00
Kirill Vainer
78ac8df78a cleanup build cache according to travis docs 2016-11-24 14:44:31 -05:00
Kirill Vainer
39dc140f79 build v3.1, master, and PRs only from now on
Developers should be using PRs instead of plain branches.
2016-11-24 14:41:00 -05:00
Kirill Vainer
f38becf2c6 remove SSH based maven publishing
The updates.jmonkeyengine.org server is no longer used.
2016-11-24 14:24:52 -05:00
Kirill Vainer
72b9f186ed fix broken bullet native source url 2016-11-24 13:31:59 -05:00
Kirill Vainer
8c4b44941e Fix #550 2016-11-23 22:04:56 -05:00
Nehon
a71fb286f4 Fixed shadow fade and zfar computation as it was breaking shadow border filtering. 2016-11-20 23:55:47 +01:00
Nehon
69d8e5d13e Fixed an issue where some occluders were wrongly culled out from the shadow map at very steep light angle, and when the view cam was almost align with light direction. 2016-11-20 19:04:53 +01:00
Paul Speed
4919620e61 Improved the "compare result changed" error message to include the most
likely cause of the error.
2016-11-20 07:14:24 -05:00
Nehon
1315af8d52 Changed the minimum value of a float when converting it to half float. It was 5.96046E-8f and it's now 3.054738E-5f. This values seems to be the lowest one before 0 when converting back half to float.
This issue has been revealed in this post https://hub.jmonkeyengine.org/t/pbr-nan-to-half-conversion-errors/37219
The bad minimum was causing erratic data being wrote to the texture when the value was very close to 0, and causing the glitches and even crashes when color values were given as Float.Infinity or Float.NaN.
2016-11-04 20:09:27 +01:00
Nehon
efd47c4347 fixed some javadoc in AbstractShadowRenderer 2016-11-04 17:00:15 +01:00
Nehon
142b006ad6 Fixed post shadow filter for glsl1.5 2016-11-02 09:59:02 +01:00
Nehon
9500227ca7 Defaulted the render back faces shadows in the AbstractShadowRenderer to true to keep the same behavior as in 3.0 2016-11-02 09:26:55 +01:00
Nehon
5495b7d064 Fixed the link to the paper for convertHalfToFloat 2016-10-31 10:02:59 +01:00
Nehon
da5e4a18c7 ShaderNodes now move all the declared extensions at the top of the generated shader source 2016-10-09 20:13:07 +02:00
Nehon
dd8271e8b3 Fixed SpotLight constructor to properly compute the invSpotRange see https://github.com/jMonkeyEngine/jmonkeyengine/issues/563 2016-10-09 10:01:17 +02:00
jjYBdx4IL
cfd491e270 fixes issue https://github.com/jMonkeyEngine/jmonkeyengine/issues/506 : Material->toString() does not prevent/check for possible NPEs 2016-10-06 09:07:40 +02:00
Nehon
95bf9efe9b MikktSpace tangent generator now properly generates the BindPoseTangent buffer when necessary 2016-10-03 23:33:39 +02:00
Rémy Bouquet
7e458e496c Fixed wiki links in the realm.md 2016-09-22 09:13:41 +02:00
Kirill Vainer
09e9c1efa0 Merge pull request #555 from JavaSaBr/master-original
fixed missing Cloneable in the Triangle.
2016-09-11 20:32:17 -04:00
Kirill Vainer
2440fc5a74 Merge pull request #554 from TehLeo/patch-2
Fix for MTR Framebuffers
2016-09-11 15:05:08 -04:00
empirephoenix
bbad454e43 Merge pull request #541 from tonihele/issue-537
Added a cursor cache for LWJGL 2, resolves #537
2016-09-05 16:07:36 +02:00
empirephoenix
7eb9463496 Merge pull request #505 from JavaSaBr/v3.1
fixed the NPE with controls, thanks to JavaSaBr
2016-09-05 16:05:24 +02:00
Rémy Bouquet
769cf36221 Merge pull request #547 from MeFisto94/ios-legacyapplication
Using LegacyApplication in the iOS Harness
2016-08-20 11:59:07 +02:00
MeFisto94
7b0a00b364 Using LegacyApplication in the iOS Harness just like it has been done for Android in 3c56afe 2016-08-20 11:26:41 +02:00
Rémy Bouquet
b42bf7f67e fixed glsl 1.0 version of the postShadowFilter shader 2016-08-12 20:52:47 +02:00
Rémy Bouquet
056dbdf981 Changed the int value of EdgeFilteringMode.Nearest from 0 to 10 as it seems a define with a 0 value is now ignored. 2016-08-12 18:29:36 +02:00
Rémy Bouquet
a7edef3a06 fixed transparent shadows on mac. 2016-08-12 18:25:56 +02:00
Toni Helenius
52c0a35525 Added a cursor cache to avoid cursor disappearing and app crashing when too many cursors are created 2016-08-09 19:56:12 +03:00
Riccardo Balbo
c92009a40a Use texture() instead of texture2D() in bloomExtract15 and bloomFinal15 2016-07-19 18:36:47 +02:00
Rémy Bouquet
e4a8b8d91c Merge pull request #530 from tiatin/v3.1
v3.1 - Added ability to set framebuffer image format used in FilterPostProce…
2016-07-13 23:01:15 +02:00
tiatin
f65f0a7ee8 Added ability to set framebuffer image format used in FilterPostProcessor.
https://hub.jmonkeyengine.org/t/ability-to-change-image-format-for-filterpostprocessor/36379
2016-07-13 22:17:22 +03:00
Julien Gouesse
4ba4da2e31 Merge pull request #525 from saloisio/v3.1
NewtMouseInput accepts null cursor
2016-07-07 21:00:21 +02:00
saloisio
05c39990ca NewtMouseInput now resets mouse cursor to default image when inputManager.setMouseCursor(null) invoked 2016-07-07 14:38:35 -04:00
Rémy Bouquet
fae07c9c71 Merge pull request #522 from MeFisto94/v3.1_HWSkinning
Also applying PR #501 on 3.1
2016-07-04 18:17:20 +02:00
Rémy Bouquet
eefc17428c Merge pull request #501 from MeFisto94/HwSkinningFixV02
Fixes #499: Fix Hardware Skinning in 3.1
2016-07-04 17:07:29 +02:00
Julien Gouesse
75c3d61f8f Merge pull request #520 from saloisio/v3.1
NewtMouseInput no longer auto-centers mouse cursor
2016-06-30 17:42:32 +02:00
saloisio
d0175a77b6 Merge branch 'v3.1' of https://github.com/saloisio/jmonkeyengine into v3.1 2016-06-30 11:22:07 -04:00
saloisio
9b8c27a0fb Removed auto centering of mouse cursor 2016-06-30 09:42:18 -04:00
Paul Speed
02c5d9d414 Merge pull request #517 from tiatin/v3.1
Garbage collection and list iteration improvements for v3.1
2016-06-26 21:47:13 -04:00
tiatin
d8529573e4 Changed overrides from ArrayList to SafeArrayList for GC and iteration performance reasons. Fixed bug in SafeArrayList.equals(). 2016-06-26 15:08:12 +03:00
tiatin
9b0422fc3c Added iteration using iterator, if List is not ArrayList.
Reason for this is that if List is LinkedList, complexity for get(int i) is O(n/4).
2016-06-26 15:08:09 +03:00
tiatin
93c2fd1989 Changed iteration over List from for-each to manual iteration.
For-Each loop creates Iterator object and uses hasNext and next methods, which are slower, than manual iteration. Also allocating Iterator object increases work for GC.

Forum post: https://hub.jmonkeyengine.org/t/iteration-over-list-performance-improvement/36250

See test 9 for more details: http://www.devahead.com/blog/2011/12/coding-for-performance-and-avoiding-garbage-collection-in-android/
2016-06-26 15:08:06 +03:00
javasabr
be66436745 added warning 2016-06-26 08:52:38 +03:00
empirephoenix
2c3d94a166 Merge pull request #504 from davidB/v3.1
nifty-gui: upgrade from 1.4.1 to 1.4.2, available on maven central wi…
2016-06-22 16:19:51 +02:00
Paul Speed
a2efd1323f Merge pull request #509 from davidB/patch-1
travis: disable uploadArchives
2016-06-13 02:24:45 -04:00
David Bernard
758fdcf394 travis: disable uploadArchives
without uploadArchives no more snapshots, but you can release (beta2,...)
2016-06-12 21:53:57 +02:00
javasabr
f354343e47 fixed the NPE with controls 2016-06-05 20:30:21 +03:00
David Bernard
f46680815d nifty-gui: upgrade from 1.4.1 to 1.4.2, available on maven central with the new “official” groupId: com.github.nifty-gui 2016-06-05 10:53:54 +02:00
Nehon
3d1a541903 Fixed an issue when resizing the viewport, with a FPP and antialiasing would stop rendering 2016-06-02 18:54:42 +02:00
Nehon
6bdf479a0a Fixed an issue in the fog filter's shader that was preventing it to run on android 2016-05-19 18:53:26 +02:00
Rémy Bouquet
29dfff223c proper equal and hashcode for ShaderNodesVariables. 2016-05-14 23:46:21 +02:00
Kirill Vainer
4faf6cf36c Merge pull request #491 from riccardobl/AddGimpactCollisionAlgo
Fix GImpact passing through other shapes.
2016-05-04 13:52:23 -04:00
Kirill Vainer
d27b26805a bullet native: fix mingw target platform 2016-05-04 13:24:04 -04:00
Kirill Vainer
b2a57e130a travis: set known hosts using travis config 2016-05-03 22:44:00 -04:00
Kirill Vainer
fafccdf15e pom: fix incorrect inception year 2016-05-03 22:44:00 -04:00
Kirill Vainer
513fc08fb6 travis: only create dist if deploying 2016-05-03 22:44:00 -04:00
Kirill Vainer
3419256941 travis: use cache rules from docs 2016-05-03 22:44:00 -04:00
Kirill Vainer
2a0a9e7b6e build: fix build error 2016-05-03 22:44:00 -04:00
Kirill Vainer
a7b20629e7 build: update to gradle 2.13 2016-05-03 22:43:59 -04:00
Kirill Vainer
8416dd8c65 travis: dont cache netbeans folder anymore 2016-05-03 22:43:59 -04:00
Kirill Vainer
7d4a34f96f build: check file exists before getting text
Conflicts:
	jme3-core/build.gradle
2016-05-03 22:43:55 -04:00
Kirill Vainer
804c173757 build: minor cleanup 2016-05-03 22:41:54 -04:00
Kirill Vainer
6dfd59ea73 android-examples: use correct maven group 2016-05-03 22:41:54 -04:00
Kirill Vainer
8f7abca01b niftygui: add nifty repository to POM 2016-05-03 22:35:42 -04:00
Kirill Vainer
2c94a3f538 travis: treat v3.1 branch as trunk 2016-04-26 20:15:25 -04:00
Kirill Vainer
652358038d version: treat this branch as trunk 2016-04-26 20:11:17 -04:00
Paul Speed
2fd9da3d50 Merge pull request #487 from Dokthar/joysticks
Joystick detection on linux and more... (v3.1)
2016-04-25 17:51:50 -04:00
MeFisto94
310f4db6ad Fixed some Reflection Errors due to the Switch from Application to LegacyApplication 2016-04-24 21:52:25 +02:00
Kirill Vainer
d044ad13e1 Fix issue #479 2016-04-23 15:37:33 -04:00
Kirill Vainer
185eb7b6e5 Merge pull request #481 from riccardobl/fix_setAdamping_bulletnative
Fix for setAngularDamping / bullet native.
2016-04-23 15:28:34 -04:00
Kirill Vainer
0f5514192a travis: update known hosts file 2016-04-23 14:57:28 -04:00
Kirill Vainer
f692f82e96 travis: update the www-updater key 2016-04-23 14:45:51 -04:00
Kirill Vainer
656a86ba0e Merge pull request #482 from Dokthar/readme-patch
fix readme links
2016-04-22 20:13:40 -04:00
Kirill Vainer
8d132d35f0 bullet native: update OSX natives 2016-04-22 10:55:10 -04:00
Dokthar
0f1f1e6bc7 fix readme links 2016-04-21 22:36:04 +02:00
Riccardo Balbo
d2c608c788 Fix for setAngularDamping / bullet native. 2016-04-21 18:33:50 +02:00
92 changed files with 970 additions and 705 deletions

View File

@ -1,16 +1,16 @@
language: java
sudo: false
env:
- GRADLE_USER_HOME=gradle-cache
addons:
ssh_known_hosts: updates.jmonkeyengine.org
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
directories:
- gradle-cache
- netbeans
# branches:
# only:
# - master
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
notifications:
slack:
@ -20,13 +20,13 @@ notifications:
secure: "PWEk4+VL986c3gAjWp12nqyifvxCjBqKoESG9d7zWh1uiTLadTHhZJRMdsye36FCpz/c/Jt7zCRO/5y7FaubQptnRrkrRfjp5f99MJRzQVXnUAM+y385qVkXKRKd/PLpM7XPm4AvjvxHCyvzX2wamRvul/TekaXKB9Ti5FCN87s="
install:
- ./gradlew assemble
- ./gradlew assemble
script:
- ./gradlew check
- ./gradlew createZipDistribution
before_deploy:
- ./gradlew createZipDistribution
- export RELEASE_DIST=$(ls build/distributions/*.zip)
deploy:
@ -55,5 +55,6 @@ before_install:
# export ANDROID_NDK=`pwd`/android-ndk-r10c
after_success:
- '[ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew uploadArchives || :'
- '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew uploadArchives bintrayUpload || :'
- '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew bintrayUpload || :'
# - '[ "$TRAVIS_BRANCH" == "v3.1" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew uploadArchives || :'
# - '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew uploadArchives bintrayUpload || :'

View File

@ -1,59 +0,0 @@
# How to contribute to jMonkeyEngine
First and foremost, you have to familiarize yourself with Git & GitHub. Dig through
[help.github.com](https://help.github.com/), [try.github.io](http://try.github.io/) and the [gh cheat sheet](https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.md) if these are new topics for you. If you'd like to contribute with something other than code, just tell us about it on the forum.
## Communication
Communication always comes first. **All** code changes and other contributions should start with the [forum](http://hub.jmonkeyengine.org/). Make a thread to explain your change and show us the important bits of your code. If the code is too long to be posted within the forums code tags, please paste your code in a Gist or pastebin and link to the submission in your thread. You are required to register on our website in order to create threads. (We do support login via GitHub though).
### New Contributors
When you're ready to submit your code, just make a [pull request](https://help.github.com/articles/using-pull-requests).
- Do not commit your code until you have received proper feedback.
- In your commit log message, please refer back to the originating forum thread (example) for a full circle reference. Also please [reference related issues](https://help.github.com/articles/closing-issues-via-commit-messages) by typing the issue hashtag.
- When committing, always be sure to run an update before you commit. If there is a conflict between the latest revision and your patch after the update, then it is your responsibility to track down the update that caused the conflict and determine the issue (and fix it). In the case where the breaking commit has no thread linked (and one cannot be found in the forum), then the contributor should contact an administrator and wait for feedback before committing.
- If your code is committed and it introduces new functionality, please edit the wiki accordingly. We can easily roll back to previous revisions, so just do your best; point us to it and well see if it sticks!
p.s. We will try hold ourselves to a [certain standard](http://www.defmacro.org/2013/04/03/issue-etiquette.html) when it comes to GitHub etiquette. If at any point we fail to uphold this standard, let us know.
#### Core Contributors
Developers in the Contributors team can push directly to Main instead of submitting pull requests, however for new features it is often a good idea to do a pull request as a means to get a last code review.
## Building the engine
1. Install [Gradle](http://www.gradle.org/)
2. Navigate to the project directory and run 'gradle build' from command line to build the engine.
## Best Practices
### Git essentials
- [Creating good pull requests](http://seesparkbox.com/foundry/creating_good_pull_requests)
- [How to write the perfect pull request](https://github.com/blog/1943-how-to-write-the-perfect-pull-request?utm_content=buffer0eb16&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer)
### Testing
general testing tips? WIP
### Code Quality
We generally abide by the standard Java Code Conventions. Besides that, just make an effort to write elegant code:
1. Handles errors gracefully
2. Only reinvents the wheel when there is a measurable benefit in doing so.
3. Has consistent naming conventions.
4. Has comments around ugly code explaining why it is ugly.
5. Compiles (or runs if interpreted) without warnings.
## Reporting bugs
1. Start by searching the [forum](http://hub.jmonkeyengine.org) and GH issue tracker for duplicates.
2. Create a new issue, explaining the problem in proper detail (templates pending).
## Documentation
- How to edit the wiki - WIP
- How to edit JavaDocs - WIP

View File

@ -1,48 +0,0 @@
jMonkeyEngine
=============
[![Build Status](https://travis-ci.org/jMonkeyEngine/jmonkeyengine.svg?branch=master)](https://travis-ci.org/jMonkeyEngine/jmonkeyengine)
jMonkeyEngine is a 3D game engine for adventurous Java developers. Its open source, cross platform and cutting edge. And it is all beautifully documented. The 3.0 branch is the latest stable version of the jMonkeyEngine 3 SDK, a complete game development suite. We'll be frequently submitting stable 3.0.x updates until the major 3.1 version arrives.
The engine is used by several commercial game studios and computer-science courses. Here's a taste:
![jME3 Games Mashup](http://i.imgur.com/hBehW2i.jpg)
- [jME powered games on IndieDB](http://www.indiedb.com/engines/jmonkeyengine/games)
- [Maker's Tale](http://steamcommunity.com/sharedfiles/filedetails/?id=93461954t)
- [Boardtastic 2](https://play.google.com/store/apps/details?id=com.boardtastic.skateboarding)
- [Copod](http://herebeben.com/copod)
- [Attack of the Gelatinous Blob](http://attackofthegelatinousblob.com/)
- [Chaos](http://4realms.net/)
- [Mythruna](https://mythruna.com/)
- [PirateHell](http://www.desura.com/games/piratehell)
- [3089 (on steam)](http://store.steampowered.com/app/263360/)
- [3079 (on steam)](http://store.steampowered.com/app/259620/)
## Getting started
Go to http://hub.jmonkeyengine.org/downloads/ to download the jMonkeyEngine SDK.
[Read the wiki](http://hub.jmonkeyengine.org/wiki/doku.php) for a complete install guide. Power up with some SDK Plugins and AssetPacks and you are off to the races. At this point you're gonna want to [join the forum](http://hub.jmonkeyengine.org/) so our tribe can grow stronger.
Note: The master branch on GitHub is a development version of the engine and is NOT MEANT TO BE USED IN PRODUCTION, it will break constantly during development of the stable jME versions!
### Technology Stack
- Java
- NetBeans Platform
- Gradle
Plus a bunch of awesome libraries & tight integrations like Bullet, Blender, NiftyGUI and other goodies.
### Documentation
Did you miss it? Don't sweat it, [here it is again](http://hub.jmonkeyengine.org/wiki/doku.php).
### Contributing
Read our [contribution guide](https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/CONTRIBUTING.md).
### License
New BSD (3-clause) License. In other words, you do whatever makes you happy!

View File

@ -1,5 +1,3 @@
import org.gradle.api.artifacts.*
buildscript {
repositories {
jcenter()
@ -12,7 +10,6 @@ buildscript {
apply plugin: 'base'
apply from: file('version.gradle')
apply from: file('upload.gradle')
// This is applied to all sub projects
subprojects {
@ -118,7 +115,7 @@ task mergedSource(type: Copy){
}
task wrapper(type: Wrapper, description: 'Creates and deploys the Gradle wrapper to the current directory.') {
gradleVersion = '2.2.1'
gradleVersion = '2.13'
}
ext {

View File

@ -1,6 +1,6 @@
apply plugin: 'com.android.application'
group = 'com.jme3'
group = 'org.jmonkeyengine'
version = jmeVersion + '-' + jmeVersionTag
sourceCompatibility = '1.6'
@ -10,4 +10,4 @@ repositories {
maven {
url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
}
}
}

View File

@ -67,11 +67,11 @@ task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from
from javadoc.destinationDir
}
def pomConfig = {
ext.pomConfig = {
name POM_NAME
description POM_DESCRIPTION
url POM_URL
inceptionYear '2016'
inceptionYear POM_INCEPTION_YEAR
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
@ -84,7 +84,6 @@ def pomConfig = {
distribution POM_LICENSE_DISTRIBUTION
}
}
// from http://hub.jmonkeyengine.org/introduction/team/
developers {
developer {
name 'jMonkeyEngine Team'
@ -103,6 +102,7 @@ task writeFullPom {
}.writeTo(pomFile)
}
}
assemble.dependsOn(writeFullPom)
install.dependsOn(writeFullPom)
uploadArchives.dependsOn(writeFullPom)
@ -110,7 +110,7 @@ uploadArchives.dependsOn(writeFullPom)
artifacts {
archives jar
archives sourcesJar
if(buildJavaDoc == "true"){
if (buildJavaDoc == "true") {
archives javadocJar
}
archives writeFullPom.outputs.files[0]
@ -130,12 +130,3 @@ uploadArchives {
pom.project pomConfig
}
}
task createFolders(description: 'Creates the source folders if they do not exist.') doLast {
// sourceSets*.allSource*.srcDirs*.each { File srcDir ->
// if (!srcDir.isDirectory()) {
// println "Creating source folder: ${srcDir}"
// srcDir.mkdirs()
// }
// }
}

View File

@ -19,7 +19,7 @@ buildAndroidExamples = false
ndkPath = /opt/android-ndk-r10c
# Path for downloading native Bullet
bulletUrl = http://bullet.googlecode.com/files/bullet-2.82-r2704.zip
bulletUrl = https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/bullet/bullet-2.82-r2704.zip
bulletFolder = bullet-2.82-r2704
bulletZipFile = bullet.zip
@ -36,6 +36,7 @@ POM_SCM_DEVELOPER_CONNECTION=scm:git:git@github.com:jMonkeyEngine/jmonkeyengine.
POM_LICENSE_NAME=New BSD (3-clause) License
POM_LICENSE_URL=http://opensource.org/licenses/BSD-3-Clause
POM_LICENSE_DISTRIBUTION=repo
POM_INCEPTION_YEAR=2009
# Bintray settings to override in $HOME/.gradle/gradle.properties or ENV or commandline
bintray_user=

Binary file not shown.

View File

@ -1,6 +1,6 @@
#Mon Dec 01 20:04:11 EST 2014
#Sat Apr 30 16:44:31 EDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip

52
gradlew vendored
View File

@ -6,12 +6,30 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
@ -40,31 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@ -90,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@ -114,6 +113,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`

8
gradlew.bat vendored
View File

@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@ -46,7 +46,7 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

View File

@ -1,6 +1,7 @@
package com.jme3.asset.plugins;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import com.jme3.asset.*;
import com.jme3.system.android.JmeAndroidSystem;
import java.io.IOException;
@ -12,26 +13,89 @@ public class AndroidLocator implements AssetLocator {
private static final Logger logger = Logger.getLogger(AndroidLocator.class.getName());
private android.content.res.AssetManager androidManager;
private String rootPath = "";
public AndroidLocator() {
}
public void setRootPath(String rootPath) {
this.rootPath = rootPath;
}
@Override
public AssetInfo locate(AssetManager manager, AssetKey key) {
String assetPath = rootPath + key.getName();
// Fix path issues
if (assetPath.startsWith("/")) {
// Remove leading /
assetPath = assetPath.substring(1);
}
assetPath = assetPath.replace("//", "/");
// Not making this a property and storing for future use in case the view stored in JmeAndroidSystem
// is replaced due to device orientation change. Not sure it is necessary to do this yet, but am for now.
android.content.res.Resources androidResources = JmeAndroidSystem.getView().getContext().getResources();
String androidPackageName = JmeAndroidSystem.getView().getContext().getPackageName();
// logger.log(Level.INFO, "Asset Key: {0}", key);
// logger.log(Level.INFO, "Asset Name: {0}", key.getName());
// logger.log(Level.INFO, "Asset Path: {0}", assetPath);
// logger.log(Level.INFO, "Asset Extension: {0}", key.getExtension());
// logger.log(Level.INFO, "Asset Key Class: {0}", key.getClass().getName());
// logger.log(Level.INFO, "androidPackageName: {0}", androidPackageName);
// logger.log(Level.INFO, "Resource Name: {0}", getResourceName(assetPath));
// check the assets directory for the asset using assetPath
try {
InputStream in = androidResources.getAssets().open(assetPath);
if (in != null){
return new AndroidAssetInfo(manager, key, assetPath, in, 0);
}
} catch (IOException ex) {
// allow to fall through to the other checks in the resources directories.
// logger.log(Level.INFO, "Resource[{0}] not found in assets directory.", assetPath);
}
// if not found in the assets directory, check the drawable and mipmap directories (only valid for images)
String resourceName = getResourceName(assetPath);
int resourceId = androidResources.getIdentifier(resourceName, "drawable", androidPackageName);
// logger.log(Level.INFO, "drawable resourceId: {0}", resourceId);
if (resourceId == 0) { // drawable resource not found, check mipmap resource type
resourceId = androidResources.getIdentifier(resourceName, "mipmap", androidPackageName);
// logger.log(Level.INFO, "mipmap resourceId: {0}", resourceId);
}
if (resourceId == 0) { // not found in resource directories, return null;
return null;
}
// try to open a stream with the resourceId returned by Android
try {
InputStream in = androidResources.openRawResource(resourceId);
if (in != null){
// logger.log(Level.INFO, "Creating new AndroidResourceInfo.");
return new AndroidAssetInfo(manager, key, assetPath, in, resourceId);
}
} catch (Resources.NotFoundException ex) {
// input stream failed to open, return null
return null;
}
return null;
}
public class AndroidAssetInfo extends AssetInfo {
private InputStream in;
private final String assetPath;
private int resourceId;
public AndroidAssetInfo(com.jme3.asset.AssetManager assetManager, AssetKey<?> key, String assetPath, InputStream in) {
AndroidAssetInfo(AssetManager assetManager, AssetKey<?> key, String assetPath, InputStream in, int resourceId) {
super(assetManager, key);
this.assetPath = assetPath;
this.in = in;
}
public AssetFileDescriptor openFileDescriptor() {
try {
return androidManager.openFd(assetPath);
} catch (IOException ex) {
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
}
this.resourceId = resourceId;
}
@Override
@ -43,55 +107,47 @@ public class AndroidLocator implements AssetLocator {
return in2;
}else{
// Create a new stream for subsequent invocations.
android.content.res.Resources androidResources = JmeAndroidSystem.getView().getContext().getResources();
if (resourceId == 0) {
try {
return androidResources.getAssets().open(assetPath);
} catch (IOException ex) {
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
}
} else {
try {
return androidResources.openRawResource(resourceId);
} catch (Resources.NotFoundException ex) {
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
}
}
}
}
public AssetFileDescriptor openFileDescriptor() {
android.content.res.Resources androidResources = JmeAndroidSystem.getView().getContext().getResources();
if (resourceId == 0) {
try {
return androidManager.open(assetPath);
return androidResources.getAssets().openFd(assetPath);
} catch (IOException ex) {
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
}
} else {
try {
return androidResources.openRawResourceFd(resourceId);
} catch (Resources.NotFoundException ex) {
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
}
}
}
}
private AndroidAssetInfo create(AssetManager assetManager, AssetKey key, String assetPath) throws IOException {
try {
InputStream in = androidManager.open(assetPath);
if (in == null){
return null;
}else{
return new AndroidAssetInfo(assetManager, key, assetPath, in);
}
} catch (IOException ex) {
// XXX: Prefer to show warning here?
// Should only surpress exceptions for "file missing" type errors.
return null;
}
}
public AndroidLocator() {
androidManager = JmeAndroidSystem.getView().getContext().getAssets();
}
public void setRootPath(String rootPath) {
this.rootPath = rootPath;
}
@SuppressWarnings("rawtypes")
@Override
public AssetInfo locate(com.jme3.asset.AssetManager manager, AssetKey key) {
String assetPath = rootPath + key.getName();
// Fix path issues
if (assetPath.startsWith("/")) {
// Remove leading /
assetPath = assetPath.substring(1);
}
assetPath = assetPath.replace("//", "/");
try {
return create(manager, key, assetPath);
} catch (IOException ex) {
// This is different handling than URL locator
// since classpath locating would return null at the getResource()
// call, otherwise there's a more critical error...
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
private String getResourceName(String name) {
int idx = name.lastIndexOf('.');
if (idx <= 0 || idx == name.length() - 1) {
return name;
} else {
return name.substring(0, idx).toLowerCase();
}
}
}

View File

@ -139,8 +139,10 @@ public class AndroidInputHandler14 extends AndroidInputHandler implements View.O
boolean isJoystick =
((source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) ||
((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK);
boolean isUnknown =
(source & android.view.InputDevice.SOURCE_UNKNOWN) == android.view.InputDevice.SOURCE_UNKNOWN;
if (isTouch && touchInput != null) {
if (touchInput != null && (isTouch || (isUnknown && this.touchInput.isSimulateKeyboard()))) {
// logger.log(Level.INFO, "onKey source: {0}, isTouch: {1}",
// new Object[]{source, isTouch});
consumed = touchInput.onKey(event);

View File

@ -1,5 +1,7 @@
apply plugin: 'cpp'
import java.nio.file.Paths
String bulletSrcPath = bulletFolder + '/src'
if (!hasProperty('mainClass')) {
@ -10,37 +12,90 @@ dependencies {
compile project(':jme3-bullet')
}
// Defines created C++ libraries
libraries {
bulletjme {
model {
components {
bulletjme(NativeLibrarySpec) {
targetPlatform 'Windows64'
targetPlatform 'Windows32'
targetPlatform 'Mac64'
targetPlatform 'Mac32'
targetPlatform 'Linux64'
targetPlatform 'Linux32'
sources {
cpp {
source {
srcDir 'src/native/cpp'
srcDir bulletSrcPath
exclude 'BulletMultiThreaded/GpuSoftBodySolvers/**'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'src/native/cpp'
srcDir bulletSrcPath
include '**/*.h'
}
}
}
}
}
all {
binaries.all {
if (toolChain in VisualCpp) {
cppCompiler.args "/I${org.gradle.internal.jvm.Jvm.current().javaHome}\\include"
} else{
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
binaries {
withType(SharedLibraryBinarySpec) {
def projectPath = project.projectDir.absolutePath
def javaHome = org.gradle.internal.jvm.Jvm.current().javaHome
def os = targetPlatform.operatingSystem.name
def arch = targetPlatform.architecture.name
def fileName = sharedLibraryFile.name
// Gradle decided to change underscores to dashes - fix that.
arch = arch.replaceAll('-', '_')
// For all binaries that can't be built on the current system
if (buildNativeProjects != "true") {
buildable = false
}
if (targetPlatform.operatingSystem.name == "osx") {
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/darwin"
} else if (targetPlatform.operatingSystem.name == "linux") {
if (!buildable) {
if (sharedLibraryFile.exists()) {
// Add binary to jar file if the binary exists in the build folder already,
// e.g. when the build of jme3-bullet-native has been run on a virtual box
// and the project hasn't been cleaned yet.
jar.into("native/${os}/${arch}") {
from sharedLibraryFile
}
} else {
// Get from libs folder if no fresh build is available in the build folder and add to jar file
def precompiledFile = Paths.get(projectPath, 'libs', 'native', os, arch, fileName).toFile()
if (precompiledFile.exists()) {
jar.into("native/${os}/${arch}") {
from precompiledFile
}
}
}
return
}
if (toolChain in VisualCpp) {
cppCompiler.args "/I$javaHome\\include"
} else{
cppCompiler.args '-I', "$javaHome/include"
}
if (os == "osx") {
cppCompiler.args '-I', "$javaHome/include/darwin"
} else if (os == "linux") {
cppCompiler.args "-fvisibility=hidden"
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/linux"
cppCompiler.args '-I', "$javaHome/include/linux"
cppCompiler.args "-fPIC"
cppCompiler.args "-fpermissive"
linker.args "-fvisibility=hidden"
// cppCompiler.args "-static-libgcc"
// cppCompiler.args "-static-libstdc++"
// linker.args "-static-libgcc"
// linker.args "-static-libstdc++"
} else if (targetPlatform.operatingSystem.name == "windows") {
} else if (os == "windows") {
if (toolChain in Gcc) {
if (toolChain.name.startsWith('mingw')) {
cppCompiler.args '-I', "${projectDir}/src/native/cpp/fake_win32"
cppCompiler.args '-I', "$projectDir/src/native/cpp/fake_win32"
} else {
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"
cppCompiler.args '-I', "$javaHome/include/win32"
}
cppCompiler.args "-fpermissive"
cppCompiler.args "-static"
@ -48,48 +103,63 @@ libraries {
linker.args "-Wl,--exclude-all-symbols"
}
else if (toolChain in VisualCpp) {
cppCompiler.args "/I${org.gradle.internal.jvm.Jvm.current().javaHome}\\include\\win32"
cppCompiler.args "/I$javaHome\\include\\win32"
}
cppCompiler.define('WIN32')
// linker.args 'Shlwapi.lib', 'Advapi32.lib'
}
tasks.all { dependsOn unzipBulletIfNeeded }
// Add output to jar file
jar.into("native/${os}/${arch}") {
from sharedLibraryFile
}
// Add depend on build
jar.dependsOn tasks
// Add output to libs folder
task "copyBinaryToLibs${targetPlatform.name}"(type: Copy, dependsOn: tasks) {
from sharedLibraryFile
into "libs/native/${os}/${arch}"
}
// Add depend on copy
jar.dependsOn("copyBinaryToLibs${targetPlatform.name}")
}
withType(StaticLibraryBinarySpec) {
buildable = false
}
}
}
// C++ sources for binary compilation
sources {
bulletjme {
cpp {
source {
srcDir 'src/native/cpp'
srcDir bulletSrcPath
exclude 'BulletMultiThreaded/GpuSoftBodySolvers/**'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'src/native/cpp'
srcDir bulletSrcPath
include '**/*.h'
}
platforms {
Windows32 {
architecture "x86"
operatingSystem "windows"
}
Windows64 {
architecture "x86_64"
operatingSystem "windows"
}
Mac32 {
architecture "x86"
operatingSystem "osx"
}
Mac64 {
architecture "x86_64"
operatingSystem "osx"
}
Linux32 {
architecture "x86"
operatingSystem "linux"
}
Linux64 {
architecture "x86_64"
operatingSystem "linux"
}
}
}
// Java source sets for IDE acces and source jar bundling / mavenization
sourceSets {
main {
java {
srcDir 'src/native/cpp'
}
}
}
// Set of target platforms, will be available based on build system
model {
toolChains {
gcc(Gcc)
clang(Clang)
mingw_x86(Gcc) {
eachPlatform() {
cCompiler.executable "i686-w64-mingw32-gcc"
@ -98,7 +168,7 @@ model {
assembler.executable "i686-w64-mingw32-g++"
staticLibArchiver.executable "i686-w64-mingw32-gcc-ar"
}
target("windows_x86")
target("Windows32")
}
mingw_x86_64(Gcc) {
eachPlatform() {
@ -108,115 +178,43 @@ model {
assembler.executable "x86_64-w64-mingw32-g++"
staticLibArchiver.executable "x86_64-w64-mingw32-gcc-ar"
}
target("windows_x86_64")
}
}
platforms{
// osx_universal { // TODO: universal binary doesn't work?
// architecture 'x86_64'
// architecture 'x86'
// operatingSystem 'osx'
// }
osx_x86 {
architecture "x86"
operatingSystem "osx"
}
osx_x86_64 {
architecture "x86_64"
operatingSystem "osx"
}
linux_x86 {
architecture "x86"
operatingSystem "linux"
}
linux_x86_64 {
architecture "x86_64"
operatingSystem "linux"
}
windows_x86 {
architecture "x86"
operatingSystem "windows"
}
windows_x86_64 {
architecture "x86_64"
operatingSystem "windows"
target("Windows64")
}
}
}
// Java source sets for IDE access and source jar bundling / mavenization
sourceSets {
main {
java {
srcDir 'src/native/cpp'
}
}
}
// Download bullet if not available
task downloadBullet(type: MyDownload) {
sourceUrl = bulletUrl
target = file(bulletZipFile)
}
// Unzip bullet if not available
task unzipBullet(type: Copy) {
def zipFile = file(bulletZipFile)
def outputDir = file(".")
from zipTree(zipFile)
into outputDir
from zipTree(bulletZipFile)
into file('.')
}
unzipBullet.dependsOn {
def zipFilePath = project.projectDir.absolutePath + File.separator + bulletZipFile
def zipFile = new File(zipFilePath)
if (!zipFile.exists()) {
if (!file(bulletZipFile).exists()) {
downloadBullet
}
}
compileJava.dependsOn {
if(buildNativeProjects=="true"){
def bulletUnzipDir = new File(project.projectDir.absolutePath + File.separator + bulletFolder)
if (!bulletUnzipDir.isDirectory()) {
unzipBullet
}
}
task unzipBulletIfNeeded << {
}
binaries.withType(StaticLibraryBinarySpec) {
buildable = false
}
// Adds all available binaries to java jar task
binaries.withType(SharedLibraryBinary) { binary ->
// For all binaries that can't be built on the current system
if(buildNativeProjects!="true"){
buildable = false;
unzipBulletIfNeeded.dependsOn {
if (buildNativeProjects == "true" && !file(bulletFolder).isDirectory()) {
unzipBullet
}
if (!buildable) {
//Get from libs folder if no fresh build is available in the build folder and add to jar file
if(!binary.tasks.outputFile.get(0).exists()){
def fileName = binary.tasks.outputFile.get(0).getName();
def precompiledFile = new File(project.projectDir.absolutePath + File.separator + "libs" + File.separator + "native" + File.separator + "${targetPlatform.operatingSystem.name}" + File.separator + "${targetPlatform.architecture.name}" + File.separator + "${fileName}")
if(precompiledFile.exists()){
jar.into("native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}") { from precompiledFile }
}
return
} else{
// Add binary to jar file if the binary exists in the build folder already,
// e.g. when the build of jme3-bullet-native has been run on a virtual box
// and the project hasn't been cleaned yet.
jar.into("native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}") { from binary.tasks.outputFile }
return
}
}
// For all binaries that can be built on the current system
def builderTask = binary.tasks
// Add output to jar file
jar.into("native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}") { from builderTask.outputFile }
// Add depend on build
jar.dependsOn builderTask
// Add output to libs folder
task "copyBinaryToLibs${targetPlatform}"(type: Copy, dependsOn: builderTask) {
from builderTask.outputFile
into "libs/native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}"
}
// Add depend on copy
jar.dependsOn("copyBinaryToLibs${targetPlatform}")
}
// Helper class to wrap ant dowload task
@ -229,7 +227,6 @@ class MyDownload extends DefaultTask {
@TaskAction
void download() {
ant.get(src: sourceUrl, dest: target)
ant.get(src: sourceUrl, dest: target)
}
}

BIN
jme3-bullet-native/libs/native/osx/x86/libbulletjme.dylib Normal file → Executable file

Binary file not shown.

Binary file not shown.

View File

@ -434,7 +434,7 @@ extern "C" {
env->ThrowNew(newExc, "The native object does not exist.");
return;
}
body->setDamping(body->getAngularDamping(), value);
body->setDamping(body->getLinearDamping(), value);
}
/*

View File

@ -147,6 +147,8 @@ void jmePhysicsSpace::createPhysicsSpace(jfloat minX, jfloat minY, jfloat minZ,
} else {
dispatcher = new btCollisionDispatcher(collisionConfiguration);
}
btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);
// the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
if (threading) {

View File

@ -48,6 +48,7 @@
#include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h"
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
#include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h"
/**
* Author: Normen Hansen

View File

@ -86,7 +86,9 @@ public class CylinderCollisionShape extends CollisionShape {
*/
@Override
public void setScale(Vector3f scale) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "CylinderCollisionShape cannot be scaled");
if (!scale.equals(Vector3f.UNIT_XYZ)) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "CylinderCollisionShape cannot be scaled");
}
}
public void write(JmeExporter ex) throws IOException {

View File

@ -122,7 +122,7 @@ public class MeshCollisionShape extends CollisionShape {
this.vertexStride = 12;
this.triangleIndexStride = 12;
this.memoryOptimized = memoryOptimized;
this.createShape(true);
this.createShape(null);
}
private void createCollisionMesh(Mesh mesh) {
@ -150,7 +150,7 @@ public class MeshCollisionShape extends CollisionShape {
vertices.rewind();
vertices.clear();
this.createShape(true);
this.createShape(null);
}
@Override
@ -191,25 +191,19 @@ public class MeshCollisionShape extends CollisionShape {
this.vertexBase = BufferUtils.createByteBuffer(capsule.readByteArray(MeshCollisionShape.VERTEX_BASE, null));
byte[] nativeBvh = capsule.readByteArray(MeshCollisionShape.NATIVE_BVH, null);
if (nativeBvh == null) {
// Either using non memory optimized BVH or old J3O file
memoryOptimized = false;
createShape(true);
} else {
// Using memory optimized BVH, load from J3O, then assign it.
memoryOptimized = true;
createShape(false);
nativeBVHBuffer = setBVH(nativeBvh, this.objectId);
}
memoryOptimized=nativeBvh != null;
createShape(nativeBvh);
}
private void createShape(boolean buildBvt) {
private void createShape(byte bvh[]) {
boolean buildBvh=bvh==null||bvh.length==0;
this.meshId = NativeMeshUtil.createTriangleIndexVertexArray(this.triangleIndexBase, this.vertexBase, this.numTriangles, this.numVertices, this.vertexStride, this.triangleIndexStride);
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Created Mesh {0}", Long.toHexString(this.meshId));
this.objectId = createShape(memoryOptimized, buildBvt, this.meshId);
this.objectId = createShape(memoryOptimized, buildBvh, this.meshId);
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Created Shape {0}", Long.toHexString(this.objectId));
if(!buildBvh) nativeBVHBuffer = setBVH(bvh, this.objectId);
this.setScale(this.scale);
this.setMargin(this.margin);
this.setMargin(this.margin);
}
/**

View File

@ -17,23 +17,30 @@ sourceSets {
}
}
task updateVersionPropertiesFile << {
def verfile = file('src/main/resources/com/jme3/system/version.properties')
verfile.text = "# THIS IS AN AUTO-GENERATED FILE..\n" +
"# DO NOT MODIFY!\n" +
"build.date=${jmeBuildDate}\n" +
"git.revision=${jmeRevision}\n" +
"git.branch=${jmeBranchName}\n" +
"git.hash=${jmeGitHash}\n" +
"git.hash.short=${jmeShortGitHash}\n" +
"git.tag=${jmeGitTag}\n" +
"name.full=jMonkeyEngine ${jmeFullVersion}\n" +
"version.full=${jmeFullVersion}\n" +
"version.number=${jmeVersion}\n" +
"version.tag=${jmeVersionTag}"
task updateVersionPropertiesFile {
def versionFile = file('src/main/resources/com/jme3/system/version.properties')
def versionFileText = "# THIS IS AN AUTO-GENERATED FILE..\n" +
"# DO NOT MODIFY!\n" +
"build.date=${jmeBuildDate}\n" +
"git.revision=${jmeRevision}\n" +
"git.branch=${jmeBranchName}\n" +
"git.hash=${jmeGitHash}\n" +
"git.hash.short=${jmeShortGitHash}\n" +
"git.tag=${jmeGitTag}\n" +
"name.full=jMonkeyEngine ${jmeFullVersion}\n" +
"version.full=${jmeFullVersion}\n" +
"version.number=${jmeVersion}\n" +
"version.tag=${jmeVersionTag}"
outputs.upToDateWhen {
versionFile.exists() && versionFile.text == versionFileText
}
doLast {
versionFile.text = versionFileText
}
}
compileJava.dependsOn(updateVersionPropertiesFile)
processResources.dependsOn updateVersionPropertiesFile
dependencies {
}

View File

@ -35,6 +35,8 @@ import com.jme3.export.*;
import com.jme3.math.*;
import com.jme3.scene.Node;
import com.jme3.util.TempVars;
import com.jme3.util.clone.JmeCloneable;
import com.jme3.util.clone.Cloner;
import java.io.IOException;
import java.util.ArrayList;
@ -62,13 +64,13 @@ import java.util.ArrayList;
* @author Kirill Vainer
* @author Rémy Bouquet
*/
public final class Bone implements Savable {
public final class Bone implements Savable, JmeCloneable {
// Version #2: Changed naming of transforms as they were misleading
public static final int SAVABLE_VERSION = 2;
private String name;
private Bone parent;
private final ArrayList<Bone> children = new ArrayList<Bone>();
private ArrayList<Bone> children = new ArrayList<Bone>();
/**
* If enabled, user can control bone transform with setUserTransforms.
* Animation transforms are not applied to this bone when enabled.
@ -167,6 +169,43 @@ public final class Bone implements Savable {
*/
public Bone() {
}
@Override
public Object jmeClone() {
try {
Bone clone = (Bone)super.clone();
return clone;
} catch (CloneNotSupportedException ex) {
throw new AssertionError();
}
}
@Override
public void cloneFields( Cloner cloner, Object original ) {
this.parent = cloner.clone(parent);
this.children = cloner.clone(children);
this.attachNode = cloner.clone(attachNode);
this.bindPos = cloner.clone(bindPos);
this.bindRot = cloner.clone(bindRot);
this.bindScale = cloner.clone(bindScale);
this.modelBindInversePos = cloner.clone(modelBindInversePos);
this.modelBindInverseRot = cloner.clone(modelBindInverseRot);
this.modelBindInverseScale = cloner.clone(modelBindInverseScale);
this.localPos = cloner.clone(localPos);
this.localRot = cloner.clone(localRot);
this.localScale = cloner.clone(localScale);
this.modelPos = cloner.clone(modelPos);
this.modelRot = cloner.clone(modelRot);
this.modelScale = cloner.clone(modelScale);
this.tmpTransform = cloner.clone(tmpTransform);
}
/**
* Returns the name of the bone, set in the constructor.

View File

@ -122,11 +122,19 @@ public final class Skeleton implements Savable, JmeCloneable {
@Override
public Object jmeClone() {
return new Skeleton(this);
try {
Skeleton clone = (Skeleton)super.clone();
return clone;
} catch (CloneNotSupportedException ex) {
throw new AssertionError();
}
}
@Override
public void cloneFields( Cloner cloner, Object original ) {
this.rootBones = cloner.clone(rootBones);
this.boneList = cloner.clone(boneList);
this.skinningMatrixes = cloner.clone(skinningMatrixes);
}
private void createSkinningMatrices() {

View File

@ -255,7 +255,8 @@ public class SkeletonControl extends AbstractControl implements Cloneable, JmeCl
// is operating on this material, in that case, user
// is sharing materials between models which is NOT allowed
// when hardware skinning used.
throw new UnsupportedOperationException(
Logger.getLogger(SkeletonControl.class.getName()).log(Level.SEVERE,
"Material instances cannot be shared when hardware skinning is used. " +
"Ensure all models use unique material instances."
);

View File

@ -70,7 +70,7 @@ public class AudioListenerState extends BaseAppState {
@Override
public void render(RenderManager rm) {
if (!isEnabled()) {
if (!isEnabled() || listener == null) {
return;
}

View File

@ -1101,9 +1101,12 @@ public class ParticleEmitter extends Geometry {
lastPos.set(getWorldTranslation());
BoundingBox bbox = (BoundingBox) this.getMesh().getBound();
bbox.setMinMax(min, max);
this.setBoundRefresh();
//This check avoids a NaN bounds when all the particles are dead during the first update.
if (!min.equals(Vector3f.POSITIVE_INFINITY) && !max.equals(Vector3f.NEGATIVE_INFINITY)) {
BoundingBox bbox = (BoundingBox) this.getMesh().getBound();
bbox.setMinMax(min, max);
this.setBoundRefresh();
}
vars.release();
}

View File

@ -86,6 +86,8 @@ public class BitmapFont implements Savable {
Bottom
}
static final float DEFAULT_TAB_WIDTH = 50.0f;
private BitmapCharacterSet charSet;
private Material[] pages;
@ -215,6 +217,11 @@ public class BitmapFont implements Savable {
firstCharOfLine = true;
continue;
}
if(theChar == '\t') {
lineWidth = (float)Math.floor(lineWidth / DEFAULT_TAB_WIDTH) * DEFAULT_TAB_WIDTH;
lineWidth += DEFAULT_TAB_WIDTH;
}
BitmapCharacter c = charSet.getCharacter((int) theChar);
if (c != null){
if (theChar == '\\' && i<text.length()-1 && text.charAt(i+1)=='#'){

View File

@ -50,7 +50,7 @@ public class BitmapText extends Node {
private BitmapFont font;
private StringBlock block;
private boolean needRefresh = true;
private final BitmapTextPage[] textPages;
private BitmapTextPage[] textPages;
private Letters letters;
public BitmapText(BitmapFont font) {
@ -76,13 +76,7 @@ public class BitmapText extends Node {
@Override
public BitmapText clone() {
BitmapText clone = (BitmapText) super.clone();
for (int i = 0; i < textPages.length; i++) {
clone.textPages[i] = textPages[i].clone();
}
clone.block = block.clone();
clone.needRefresh = true;
return clone;
return (BitmapText)super.clone(false);
}
/**
@ -92,10 +86,16 @@ public class BitmapText extends Node {
public void cloneFields( Cloner cloner, Object original ) {
super.cloneFields(cloner, original);
textPages = textPages.clone();
for( int i = 0; i < textPages.length; i++ ) {
textPages[i] = cloner.clone(textPages[i]);
}
this.block = cloner.clone(block);
// Cannot use the cloner to clone the StringBlock because it
// is package private... so we'll forgo the (probably unnecessary)
// reference fixup in this case and just clone it directly.
//this.block = cloner.clone(block);
this.block = block != null ? block.clone() : null;
// Change in behavior: The 'letters' field was not cloned or recreated
// before. I'm not sure how this worked and suspect BitmapText was just
@ -369,7 +369,9 @@ public class BitmapText extends Node {
}
/**
* @param tabs tab positions
* Sets the positions at where the text continues after a tab character.<br>
* These tab stops need to be sorted from smallest to biggest value.
* @param tabs Sorted tab positions. Use <code>null</code> to reset tab positions.
*/
public void setTabPosition(float... tabs) {
block.setTabPosition(tabs);
@ -378,7 +380,9 @@ public class BitmapText extends Node {
}
/**
* used for the tabs over the last tab position.
* Used for all tabs after the last custom tab position
* (see {@link #setTabPosition(float...) setTabPosition}).<br>
* This value is also used when no custom tab positions are set.
* @param width tab size
*/
public void setTabWidth(float width) {

View File

@ -38,10 +38,12 @@ import com.jme3.scene.VertexBuffer;
import com.jme3.scene.VertexBuffer.Type;
import com.jme3.texture.Texture2D;
import com.jme3.util.BufferUtils;
import com.jme3.util.clone.Cloner;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
import java.util.LinkedList;
import java.util.LinkedList;
/**
* One page per BitmapText Font Texture.
@ -119,10 +121,29 @@ class BitmapTextPage extends Geometry {
@Override
public BitmapTextPage clone() {
BitmapTextPage clone = (BitmapTextPage) super.clone();
clone.mesh = mesh.deepClone();
//clone.mesh = mesh.deepClone();
return clone;
}
/**
* Called internally by com.jme3.util.clone.Cloner. Do not call directly.
*/
@Override
public void cloneFields( Cloner cloner, Object original ) {
Mesh originalMesh = this.mesh;
super.cloneFields(cloner, original);
// BitmapTextPage always requires a new mesh or different
// BitmapText instances will clobber one another.
// But if we were already deep cloning meshes then we don't
// want to do it again... so we'll check first.
if( this.mesh == originalMesh ) {
this.mesh = mesh.deepClone();
}
}
// Here is where one might add JmeCloneable related stuff except
// the old clone() method doesn't actually bother to clone anything.
// The arrays and the pageQuads are shared across all BitmapTextPage

View File

@ -306,8 +306,6 @@ class LetterQuad {
}
void update(StringBlock block) {
final float[] tabs = block.getTabPosition();
final float tabWidth = block.getTabWidth();
final Rectangle bound = getBound(block);
sizeScale = block.getSize() / font.getCharSet().getRenderedSize();
lineY = computeLineY(block);
@ -320,16 +318,9 @@ class LetterQuad {
xAdvance = 0;
} else if (isTab()) {
x0 = previous.getNextX();
width = tabWidth;
width = block.calcNextTabPosition(x0) - x0;
y0 = lineY;
height = 0;
if (tabs != null && x0 < tabs[tabs.length-1]) {
for (int i = 0; i < tabs.length-1; i++) {
if (x0 > tabs[i] && x0 < tabs[i+1]) {
width = tabs[i+1] - x0;
}
}
}
xAdvance = width;
} else if (bitmapChar == null) {
x0 = getPrevious().getX1();

View File

@ -53,7 +53,7 @@ class StringBlock implements Cloneable {
private int lineCount;
private LineWrapMode wrapType = LineWrapMode.Word;
private float[] tabPos;
private float tabWidth = 50;
private float tabWidth = BitmapFont.DEFAULT_TAB_WIDTH;
private char ellipsisChar = 0x2026;
/**
@ -91,6 +91,7 @@ class StringBlock implements Cloneable {
clone.color = color.clone();
if (textBox != null)
clone.textBox = textBox.clone();
// tabPos is read-only and replaced on write.
return clone;
} catch (CloneNotSupportedException ex) {
throw new AssertionError();
@ -172,22 +173,6 @@ class StringBlock implements Cloneable {
void setLineWrapMode(LineWrapMode wrap) {
this.wrapType = wrap;
}
void setTabWidth(float tabWidth) {
this.tabWidth = tabWidth;
}
void setTabPosition(float[] tabs) {
this.tabPos = tabs;
}
float getTabWidth() {
return tabWidth;
}
float[] getTabPosition() {
return tabPos;
}
void setEllipsisChar(char c) {
this.ellipsisChar = c;
@ -196,4 +181,30 @@ class StringBlock implements Cloneable {
int getEllipsisChar() {
return ellipsisChar;
}
void setTabWidth(float tabWidth) {
this.tabWidth = tabWidth;
}
void setTabPosition(float[] tabs) {
if(tabs != null && tabs.length > 0) {
this.tabPos = tabs.clone();
} else {
this.tabPos = null;
}
}
float calcNextTabPosition(float posX) {
// If there is an upcoming user-set tab stop, use that one.
if (tabPos != null && posX < tabPos[tabPos.length-1]) {
for (int i = 0; i < tabPos.length; i++) {
if (posX < tabPos[i]) {
return tabPos[i];
}
}
}
// No upcoming tab stops available, use default tab width.
return (float)Math.floor(posX / tabWidth) * tabWidth + tabWidth;
}
}

View File

@ -102,7 +102,7 @@ public class SpotLight extends Light {
this();
setPosition(position);
setDirection(direction);
this.spotRange = range;
setSpotRange(range);
}
/**
@ -133,7 +133,7 @@ public class SpotLight extends Light {
computeAngleParameters();
setPosition(position);
setDirection(direction);
this.spotRange = range;
setSpotRange(range);
}
/**
@ -158,7 +158,7 @@ public class SpotLight extends Light {
computeAngleParameters();
setPosition(position);
setDirection(direction);
this.spotRange = range;
setSpotRange(range);
}

View File

@ -309,6 +309,8 @@ When arrays can be inserted in J3M files
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
oc.write(b.booleanValue(), "value_bool", false);
} else if (value.getClass().isArray() && value instanceof Savable[]) {
oc.write((Savable[])value, "value_savable_array", null);
}
}
@ -327,6 +329,41 @@ When arrays can be inserted in J3M files
case Int:
value = ic.readInt("value_int", 0);
break;
case Vector2Array:
Savable[] savableArray = ic.readSavableArray("value_savable_array", null);
if (savableArray != null) {
value = new Vector2f[savableArray.length];
System.arraycopy(savableArray, 0, value, 0, savableArray.length);
}
break;
case Vector3Array:
savableArray = ic.readSavableArray("value_savable_array", null);
if (savableArray != null) {
value = new Vector3f[savableArray.length];
System.arraycopy(savableArray, 0, value, 0, savableArray.length);
}
break;
case Vector4Array:
savableArray = ic.readSavableArray("value_savable_array", null);
if (savableArray != null) {
value = new Vector4f[savableArray.length];
System.arraycopy(savableArray, 0, value, 0, savableArray.length);
}
break;
case Matrix3Array:
savableArray = ic.readSavableArray("value_savable_array", null);
if (savableArray != null) {
value = new Matrix3f[savableArray.length];
System.arraycopy(savableArray, 0, value, 0, savableArray.length);
}
break;
case Matrix4Array:
savableArray = ic.readSavableArray("value_savable_array", null);
if (savableArray != null) {
value = new Matrix4f[savableArray.length];
System.arraycopy(savableArray, 0, value, 0, savableArray.length);
}
break;
default:
value = ic.readSavable("value_savable", null);
break;

View File

@ -35,7 +35,7 @@ import com.jme3.asset.AssetKey;
import com.jme3.asset.AssetManager;
import com.jme3.asset.CloneableSmartAsset;
import com.jme3.export.*;
import com.jme3.light.*;
import com.jme3.light.LightList;
import com.jme3.material.RenderState.BlendMode;
import com.jme3.material.RenderState.FaceCullMode;
import com.jme3.material.TechniqueDef.LightMode;
@ -54,6 +54,8 @@ import com.jme3.texture.Image;
import com.jme3.texture.Texture;
import com.jme3.texture.image.ColorSpace;
import com.jme3.util.ListMap;
import com.jme3.util.SafeArrayList;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
@ -749,8 +751,8 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
sortingId = -1;
}
private int applyOverrides(Renderer renderer, Shader shader, List<MatParamOverride> overrides, int unit) {
for (MatParamOverride override : overrides) {
private int applyOverrides(Renderer renderer, Shader shader, SafeArrayList<MatParamOverride> overrides, int unit) {
for (MatParamOverride override : overrides.getArray()) {
VarType type = override.getVarType();
MatParam paramDef = def.getMaterialParam(override.getName());
@ -777,7 +779,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
}
private void updateShaderMaterialParameters(Renderer renderer, Shader shader,
List<MatParamOverride> worldOverrides, List<MatParamOverride> forcedOverrides) {
SafeArrayList<MatParamOverride> worldOverrides, SafeArrayList<MatParamOverride> forcedOverrides) {
int unit = 0;
if (worldOverrides != null) {
@ -945,7 +947,7 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
updateRenderState(renderManager, renderer, techniqueDef);
// Get world overrides
List<MatParamOverride> overrides = geometry.getWorldMatParamOverrides();
SafeArrayList<MatParamOverride> overrides = geometry.getWorldMatParamOverrides();
// Select shader to use
Shader shader = technique.makeCurrent(renderManager, overrides, renderManager.getForcedMatParams(), lights, rendererCaps);
@ -992,8 +994,8 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
@Override
public String toString() {
return "Material[name=" + name +
", def=" + def.getName() +
", tech=" + technique.getDef().getName() +
", def=" + (def != null ? def.getName() : null) +
", tech=" + (technique != null && technique.getDef() != null ? technique.getDef().getName() : null) +
"]";
}

View File

@ -31,10 +31,10 @@
*/
package com.jme3.material;
import com.jme3.material.logic.TechniqueDefLogic;
import com.jme3.asset.AssetManager;
import com.jme3.light.LightList;
import com.jme3.material.TechniqueDef.LightMode;
import com.jme3.material.logic.TechniqueDefLogic;
import com.jme3.renderer.Caps;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
@ -42,9 +42,8 @@ import com.jme3.shader.DefineList;
import com.jme3.shader.Shader;
import com.jme3.shader.VarType;
import com.jme3.util.ListMap;
import java.util.ArrayList;
import com.jme3.util.SafeArrayList;
import java.util.EnumSet;
import java.util.List;
/**
* Represents a technique instance.
@ -110,8 +109,8 @@ public final class Technique {
}
}
private void applyOverrides(DefineList defineList, List<MatParamOverride> overrides) {
for (MatParamOverride override : overrides) {
private void applyOverrides(DefineList defineList, SafeArrayList<MatParamOverride> overrides) {
for (MatParamOverride override : overrides.getArray()) {
if (!override.isEnabled()) {
continue;
}
@ -134,8 +133,8 @@ public final class Technique {
* @param rendererCaps The renderer capabilities which the shader should support.
* @return A compatible shader.
*/
Shader makeCurrent(RenderManager renderManager, List<MatParamOverride> worldOverrides,
List<MatParamOverride> forcedOverrides,
Shader makeCurrent(RenderManager renderManager, SafeArrayList<MatParamOverride> worldOverrides,
SafeArrayList<MatParamOverride> forcedOverrides,
LightList lights, EnumSet<Caps> rendererCaps) {
TechniqueDefLogic logic = def.getLogic();
AssetManager assetManager = owner.getMaterialDef().getAssetManager();

View File

@ -942,8 +942,7 @@ final public class FastMath {
* Converts a single precision (32 bit) floating point value
* into half precision (16 bit).
*
* <p>Source: <a href="http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf">
* http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf</a><br><strong>broken link</strong>
* <p>Source: <a href="ftp://www.fox-toolkit.org/pub/fasthalffloatconversion.pdf</a>
*
* @param half The half floating point value as a short.
* @return floating point value of the half.
@ -982,9 +981,9 @@ final public class FastMath {
return 0x7bff;
} else if (flt < -65504f) {
return (short) (0x7bff | 0x8000);
} else if (flt > 0f && flt < 5.96046E-8f) {
} else if (flt > 0f && flt < 3.054738E-5f) {
return 0x0001;
} else if (flt < 0f && flt > -5.96046E-8f) {
} else if (flt < 0f && flt > -3.054738E-5f) {
return (short) 0x8001;
}

View File

@ -44,7 +44,7 @@ import java.io.IOException;
* @author Mark Powell
* @author Joshua Slack
*/
public class Triangle extends AbstractTriangle implements Savable, java.io.Serializable {
public class Triangle extends AbstractTriangle implements Savable, Cloneable, java.io.Serializable {
static final long serialVersionUID = 1;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* Copyright (c) 2009-2017 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -392,7 +392,7 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
public Vector3f project(Vector3f other){
float n = this.dot(other); // A . B
float d = other.lengthSquared(); // |B|^2
return new Vector3f(other).normalizeLocal().multLocal(n/d);
return new Vector3f(other).multLocal(n/d);
}
/**
@ -405,7 +405,7 @@ public final class Vector3f implements Savable, Cloneable, java.io.Serializable
public Vector3f projectLocal(Vector3f other){
float n = this.dot(other); // A . B
float d = other.lengthSquared(); // |B|^2
return set(other).normalizeLocal().multLocal(n/d);
return set(other).multLocal(n/d);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* Copyright (c) 2009-2017 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -317,7 +317,7 @@ public final class Vector4f implements Savable, Cloneable, java.io.Serializable
public Vector4f project(Vector4f other){
float n = this.dot(other); // A . B
float d = other.lengthSquared(); // |B|^2
return new Vector4f(other).normalizeLocal().multLocal(n/d);
return new Vector4f(other).multLocal(n/d);
}
/**

View File

@ -141,7 +141,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
fsQuad.setWidth(1);
fsQuad.setHeight(1);
if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) {
if (fbFormat == Format.RGB111110F && !renderer.getCaps().contains(Caps.PackedFloatTexture)) {
fbFormat = Format.RGB8;
}
@ -448,7 +448,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
cameraInit = true;
computeDepth = false;
if (renderFrameBuffer == null) {
if (renderFrameBuffer == null && renderFrameBufferMS == null) {
outputBuffer = viewPort.getOutputFrameBuffer();
}
@ -520,6 +520,10 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
this.assetManager = assetManager;
}
public void setFrameBufferFormat(Format fbFormat) {
this.fbFormat = fbFormat;
}
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.write(numSamples, "numSamples", 0);

View File

@ -83,7 +83,7 @@ public class RenderManager {
private Material forcedMaterial = null;
private String forcedTechnique = null;
private RenderState forcedRenderState = null;
private final List<MatParamOverride> forcedOverrides = new ArrayList<>();
private final SafeArrayList<MatParamOverride> forcedOverrides = new SafeArrayList<>(MatParamOverride.class);
private int viewX, viewY, viewWidth, viewHeight;
private final Matrix4f orthoMatrix = new Matrix4f();
private final LightList filteredLightList = new LightList(null);
@ -462,7 +462,7 @@ public class RenderManager {
*
* @return The forced material parameters.
*/
public List<MatParamOverride> getForcedMatParams() {
public SafeArrayList<MatParamOverride> getForcedMatParams() {
return forcedOverrides;
}

View File

@ -1672,16 +1672,15 @@ public final class GLRenderer implements Renderer {
+ " by the video hardware!");
}
if (context.boundDrawBuf != MRT_OFF + fb.getNumColorBuffers()) {
intBuf16.clear();
for (int i = 0; i < fb.getNumColorBuffers(); i++) {
intBuf16.put(GLFbo.GL_COLOR_ATTACHMENT0_EXT + i);
}
intBuf16.flip();
glext.glDrawBuffers(intBuf16);
context.boundDrawBuf = MRT_OFF + fb.getNumColorBuffers();
intBuf16.clear();
for (int i = 0; i < fb.getNumColorBuffers(); i++) {
intBuf16.put(GLFbo.GL_COLOR_ATTACHMENT0_EXT + i);
}
intBuf16.flip();
glext.glDrawBuffers(intBuf16);
context.boundDrawBuf = MRT_OFF + fb.getNumColorBuffers();
} else {
RenderBuffer rb = fb.getColorBuffer(fb.getTargetIndex());
// select this draw buffer

View File

@ -9,9 +9,6 @@ package com.jme3.scene;
public abstract class GeometryGroupNode extends Node {
public static int getGeometryStartIndex(Geometry geom) {
if (geom.startIndex == -1) {
throw new AssertionError();
}
return geom.startIndex;
}

View File

@ -55,6 +55,7 @@ import com.jme3.util.SafeArrayList;
import com.jme3.util.TempVars;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
@ -138,8 +139,8 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
protected LightList localLights;
protected transient LightList worldLights;
protected ArrayList<MatParamOverride> localOverrides;
protected ArrayList<MatParamOverride> worldOverrides;
protected SafeArrayList<MatParamOverride> localOverrides;
protected SafeArrayList<MatParamOverride> worldOverrides;
/**
* This spatial's name.
@ -207,8 +208,8 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
localLights = new LightList(this);
worldLights = new LightList(this);
localOverrides = new ArrayList<>();
worldOverrides = new ArrayList<>();
localOverrides = new SafeArrayList<>(MatParamOverride.class);
worldOverrides = new SafeArrayList<>(MatParamOverride.class);
refreshFlags |= RF_BOUND;
}
@ -432,7 +433,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
*
* @return The list of local material parameter overrides.
*/
public List<MatParamOverride> getLocalMatParamOverrides() {
public SafeArrayList<MatParamOverride> getLocalMatParamOverrides() {
return localOverrides;
}
@ -446,7 +447,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
*
* @return The list of world material parameter overrides.
*/
public List<MatParamOverride> getWorldMatParamOverrides() {
public SafeArrayList<MatParamOverride> getWorldMatParamOverrides() {
return worldOverrides;
}
@ -1384,8 +1385,8 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
clone.localLights.setOwner(clone);
clone.worldLights.setOwner(clone);
clone.worldOverrides = new ArrayList<MatParamOverride>();
clone.localOverrides = new ArrayList<MatParamOverride>();
clone.worldOverrides = new SafeArrayList<>(MatParamOverride.class);
clone.localOverrides = new SafeArrayList<>(MatParamOverride.class);
for (MatParamOverride override : localOverrides) {
clone.localOverrides.add((MatParamOverride) override.clone());
@ -1598,7 +1599,7 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
capsule.write(shadowMode, "shadow_mode", ShadowMode.Inherit);
capsule.write(localTransform, "transform", Transform.IDENTITY);
capsule.write(localLights, "lights", null);
capsule.writeSavableArrayList(localOverrides, "overrides", null);
capsule.writeSavableArrayList(new ArrayList(localOverrides), "overrides", null);
// Shallow clone the controls array to convert its type.
capsule.writeSavableArrayList(new ArrayList(controls), "controlsList", null);
@ -1622,11 +1623,13 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
localLights = (LightList) ic.readSavable("lights", null);
localLights.setOwner(this);
localOverrides = ic.readSavableArrayList("overrides", null);
if (localOverrides == null) {
localOverrides = new ArrayList<>();
ArrayList<MatParamOverride> localOverridesList = ic.readSavableArrayList("overrides", null);
if (localOverridesList == null) {
localOverrides = new SafeArrayList<>(MatParamOverride.class);
} else {
localOverrides = new SafeArrayList(MatParamOverride.class, localOverridesList);
}
worldOverrides = new ArrayList<>();
worldOverrides = new SafeArrayList<>(MatParamOverride.class);
//changed for backward compatibility with j3o files generated before the AnimControl/SkeletonControl split
//the AnimControl creates the SkeletonControl for old files and add it to the spatial.
@ -1635,6 +1638,16 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
//controls = ic.readSavableArrayList("controlsList", null));
controls.addAll(0, ic.readSavableArrayList("controlsList", null));
// remove all controls which wasn't loaded.
if(controls.contains(null)) {
logger.log(Level.WARNING, "This spatial has problems with loading controls.", this);
for (Iterator<Control> iterator = controls.iterator(); iterator.hasNext(); ) {
final Control control = iterator.next();
if(control == null) iterator.remove();
}
}
userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null);
}

View File

@ -31,6 +31,7 @@
*/
package com.jme3.scene.instancing;
import com.jme3.bounding.BoundingVolume;
import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
import com.jme3.export.JmeImporter;
@ -309,6 +310,7 @@ public class InstancedGeometry extends Geometry {
} else {
// Deleting element in the middle
}
setBoundRefresh();
}
public void addInstance(Geometry geometry) {
@ -327,6 +329,31 @@ public class InstancedGeometry extends Geometry {
geometries[freeIndex] = geometry;
InstancedNode.setGeometryStartIndex2(geometry, freeIndex);
setBoundRefresh();
}
@Override
protected void updateWorldBound() {
refreshFlags &= ~RF_BOUND;
BoundingVolume resultBound = null;
for (int i = 0; i < firstUnusedIndex; i++) {
Geometry geom = geometries[i];
if (geom != null) {
if (resultBound != null) {
// merge current world bound with child world bound
resultBound.mergeLocal(geom.getWorldBound());
} else {
// set world bound to first non-null child world bound
if (geom.getWorldBound() != null) {
resultBound = geom.getWorldBound().clone(this.worldBound);
}
}
}
}
this.worldBound = resultBound;
}
public Geometry[] getGeometries() {

View File

@ -32,8 +32,13 @@
package com.jme3.scene.shape;
import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
import com.jme3.export.JmeImporter;
import com.jme3.export.OutputCapsule;
import com.jme3.scene.Mesh;
import com.jme3.scene.VertexBuffer.Type;
import java.io.IOException;
/**
* <code>Quad</code> represents a rectangular plane in space
@ -126,6 +131,20 @@ public class Quad extends Mesh {
updateBound();
setStatic();
}
@Override
public void read(JmeImporter e) throws IOException {
super.read(e);
InputCapsule capsule = e.getCapsule(this);
width = capsule.readFloat("width", 0);
height = capsule.readFloat("height", 0);
}
@Override
public void write(JmeExporter e) throws IOException {
super.write(e);
OutputCapsule capsule = e.getCapsule(this);
capsule.write(width, "width", 0);
capsule.write(height, "height", 0);
}
}

View File

@ -38,6 +38,7 @@ import com.jme3.material.Technique;
import com.jme3.material.TechniqueDef;
import com.jme3.shader.Shader.ShaderType;
import java.util.List;
import java.util.regex.*;
/**
* This class is the base for a shader generator using the ShaderNodes system,
@ -59,7 +60,11 @@ public abstract class ShaderGenerator {
/**
* the technique def to use for the shader generation
*/
protected TechniqueDef techniqueDef = null;
protected TechniqueDef techniqueDef = null;
/**
* Extension pattern
*/
Pattern extensions = Pattern.compile("(#extension.*\\s+)");
/**
* Build a shaderGenerator
@ -142,7 +147,23 @@ public abstract class ShaderGenerator {
sourceDeclaration.append(source);
return sourceDeclaration.toString();
return moveExtensionsUp(sourceDeclaration);
}
/**
* parses the source and moves all the extensions at the top of the shader source as having extension declarations
* in the middle of a shader is against the specs and not supported by all drivers.
* @param sourceDeclaration
* @return
*/
private String moveExtensionsUp(StringBuilder sourceDeclaration) {
Matcher m = extensions.matcher( sourceDeclaration.toString());
StringBuilder finalSource = new StringBuilder();
while(m.find()){
finalSource.append(m.group());
}
finalSource.append(m.replaceAll(""));
return finalSource.toString();
}
/**

View File

@ -150,7 +150,12 @@ public class ShaderNodeVariable implements Savable, Cloneable {
@Override
public int hashCode() {
int hash = 5;
int hash = 7;
hash = 29 * hash + (name != null?name.hashCode():0);
hash = 29 * hash + (type != null?type.hashCode():0);
hash = 29 * hash + (nameSpace != null?nameSpace.hashCode():0);
hash = 29 * hash + (condition != null?condition.hashCode():0);
hash = 29 * hash + (multiplicity != null?multiplicity.hashCode():0);
return hash;
}
@ -172,6 +177,12 @@ public class ShaderNodeVariable implements Savable, Cloneable {
if ((this.nameSpace == null) ? (other.nameSpace != null) : !this.nameSpace.equals(other.nameSpace)) {
return false;
}
if ((this.condition == null) ? (other.condition != null) : !this.condition.equals(other.condition)) {
return false;
}
if ((this.multiplicity == null) ? (other.multiplicity != null) : !this.multiplicity.equals(other.multiplicity)) {
return false;
}
return true;
}

View File

@ -94,7 +94,7 @@ public abstract class AbstractShadowRenderer implements SceneProcessor, Savable
protected CompareMode shadowCompareMode = CompareMode.Hardware;
protected Picture[] dispPic;
protected RenderState forcedRenderState = new RenderState();
protected Boolean renderBackFacesShadows;
protected Boolean renderBackFacesShadows = true;
/**
* true if the fallback material should be used, otherwise false
@ -725,7 +725,7 @@ public abstract class AbstractShadowRenderer implements SceneProcessor, Savable
}
/**
* Sets the shadow edges thickness. default is 1, setting it to lower values
* Sets the shadow edges thickness. default is 10, setting it to lower values
* can help to reduce the jagged effect of the shadow edges
*
* @param edgesThickness

View File

@ -145,7 +145,7 @@ public class DirectionalLightShadowRenderer extends AbstractShadowRenderer {
float frustumNear = Math.max(viewCam.getFrustumNear(), 0.001f);
ShadowUtil.updateFrustumPoints(viewCam, frustumNear, zFar, 1.0f, points);
//shadowCam.setDirection(direction);
shadowCam.setFrustumFar(zFar);
shadowCam.getRotation().lookAt(light.getDirection(), shadowCam.getUp());
shadowCam.update();
shadowCam.updateViewProjection();

View File

@ -40,7 +40,7 @@ public enum EdgeFilteringMode {
* Shadows are not filtered. Nearest sample is used, causing in blocky
* shadows.
*/
Nearest(0),
Nearest(10),
/**
* Bilinear filtering is used. Has the potential of being hardware
* accelerated on some GPUs

View File

@ -465,7 +465,7 @@ public class ShadowUtil {
shadowCam.setProjectionMatrix(null);
if (ortho) {
shadowCam.setFrustum(-1, 1, -1, 1, 1, -1);
shadowCam.setFrustum(-shadowCam.getFrustumFar(), shadowCam.getFrustumFar(), -1, 1, 1, -1);
}
// create transform to rotate points to viewspace

View File

@ -38,14 +38,14 @@ import java.util.logging.Logger;
/**
* Pulls in version info from the version.properties file.
*
*
* @author Kirill Vainer
*/
public class JmeVersion {
private static final Logger logger = Logger.getLogger(JmeVersion.class.getName());
private static final Properties props = new Properties();
static {
try {
props.load(JmeVersion.class.getResourceAsStream("version.properties"));
@ -53,12 +53,12 @@ public class JmeVersion {
logger.log(Level.WARNING, "Unable to read version info!", ex);
}
}
public static final String BUILD_DATE = props.getProperty("build.date", "1900-01-01");
public static final String BRANCH_NAME = props.getProperty("git.branch", "unknown");
public static final String GIT_HASH = props.getProperty("git.hash", "");
public static final String GIT_SHORT_HASH = props.getProperty("git.hash.short", "");
public static final String GIT_TAG = props.getProperty("git.tag", "");
public static final String GIT_TAG = props.getProperty("git.tag", "3.1-unknown");
public static final String VERSION_NUMBER = props.getProperty("version.number", "");
public static final String VERSION_TAG = props.getProperty("version.tag", "");
public static final String VERSION_FULL = props.getProperty("version.full", "");

View File

@ -698,9 +698,11 @@ public class ListSort<T> {
System.arraycopy(arr, iterB, arr, dest, lengthB);
// The last element of run A belongs at the end of the merge.
arr[dest + lengthB] = tempArray[iterA];
} else if(lengthA== 0){
} else if(lengthA == 0){
throw new UnsupportedOperationException("Compare function result changed! " +
"Make sure you do not modify the scene from another thread!");
"Make sure you do not modify the scene from"
+ " another thread and that the comparisons are not based"
+ " on NaN values.");
} else {//Fail label
System.arraycopy(tempArray, iterA, arr, dest, lengthA);
}

View File

@ -258,7 +258,7 @@ public class SafeArrayList<E> implements List<E>, Cloneable {
if( o1 == null || !o1.equals(o2) )
return false;
}
return !(i1.hasNext() || !i2.hasNext());
return !(i1.hasNext() || i2.hasNext());
}
public int hashCode() {

View File

@ -226,23 +226,7 @@ public class TangentBinormalGenerator {
processTriangleData(mesh, vertices, approxTangents,splitMirrored);
//if the mesh has a bind pose, we need to generate the bind pose for the tangent buffer
if (mesh.getBuffer(Type.BindPosePosition) != null) {
VertexBuffer tangents = mesh.getBuffer(Type.Tangent);
if (tangents != null) {
VertexBuffer bindTangents = new VertexBuffer(Type.BindPoseTangent);
bindTangents.setupData(Usage.CpuOnly,
4,
Format.Float,
BufferUtils.clone(tangents.getData()));
if (mesh.getBuffer(Type.BindPoseTangent) != null) {
mesh.clearBuffer(Type.BindPoseTangent);
}
mesh.setBuffer(bindTangents);
tangents.setUsage(Usage.Stream);
}
}
TangentUtils.generateBindPoseTangentsIfNecessary(mesh);
}
public static void generate(Mesh mesh, boolean approxTangents) {

View File

@ -0,0 +1,29 @@
package com.jme3.util;
import com.jme3.scene.*;
/**
* Created by Nehon on 03/10/2016.
*/
public class TangentUtils {
public static void generateBindPoseTangentsIfNecessary(Mesh mesh){
if (mesh.getBuffer(VertexBuffer.Type.BindPosePosition) != null) {
VertexBuffer tangents = mesh.getBuffer(VertexBuffer.Type.Tangent);
if (tangents != null) {
VertexBuffer bindTangents = new VertexBuffer(VertexBuffer.Type.BindPoseTangent);
bindTangents.setupData(VertexBuffer.Usage.CpuOnly,
4,
VertexBuffer.Format.Float,
BufferUtils.clone(tangents.getData()));
if (mesh.getBuffer(VertexBuffer.Type.BindPoseTangent) != null) {
mesh.clearBuffer(VertexBuffer.Type.BindPoseTangent);
}
mesh.setBuffer(bindTangents);
tangents.setUsage(VertexBuffer.Usage.Stream);
}
}
}
}

View File

@ -21,13 +21,10 @@ public class MikkTSpaceImpl implements MikkTSpaceContext {
public MikkTSpaceImpl(Mesh mesh) {
this.mesh = mesh;
VertexBuffer tangentBuffer = mesh.getBuffer(VertexBuffer.Type.Tangent);
if(tangentBuffer == null){
FloatBuffer fb = BufferUtils.createFloatBuffer(mesh.getVertexCount() * 4);
mesh.setBuffer(VertexBuffer.Type.Tangent, 4, fb);
}
//TODO ensure the Tangent buffer exists, else create one.
//replacing any existing tangent buffer, if you came here you want them new.
mesh.clearBuffer(VertexBuffer.Type.Tangent);
FloatBuffer fb = BufferUtils.createFloatBuffer(mesh.getVertexCount() * 4);
mesh.setBuffer(VertexBuffer.Type.Tangent, 4, fb);
}
@Override

View File

@ -7,9 +7,9 @@ package com.jme3.util.mikktspace;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.*;
import com.jme3.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -84,6 +84,7 @@ public class MikktspaceTangentGenerator {
if(!genTangSpaceDefault(context)){
Logger.getLogger(MikktspaceTangentGenerator.class.getName()).log(Level.SEVERE, "Failed to generate tangents for geometry " + g.getName());
}
TangentUtils.generateBindPoseTangentsIfNecessary(g.getMesh());
}
}
@ -511,7 +512,7 @@ public class MikktspaceTangentGenerator {
}
}
//TODO Nehon : Not used...seemsit's used in the original version if the structure to store the data in the regular method failed...
//TODO Nehon : Not used...seems it's used in the original version if the structure to store the data in the regular method failed...
static void generateSharedVerticesIndexListSlow(int piTriList_in_and_out[], final MikkTSpaceContext mikkTSpace, final int iNrTrianglesIn) {
int iNumUniqueVerts = 0;
for (int t = 0; t < iNrTrianglesIn; t++) {

View File

@ -214,6 +214,14 @@ MaterialDef Phong Lighting {
INSTANCING : UseInstancing
}
ForcedRenderState {
FaceCull Off
DepthTest On
DepthWrite On
PolyOffset 5 3
ColorWrite Off
}
}

View File

@ -72,25 +72,28 @@ MaterialDef Point Sprite {
Technique PreShadow {
VertexShader GLSL100 : Common/MatDefs/Misc/Particle.vert
FragmentShader GLSL100 : Common/MatDefs/Misc/Particle.frag
VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
WorldParameters {
WorldViewProjectionMatrix
WorldViewMatrix
WorldMatrix
CameraPosition
WorldViewProjectionMatrix
WorldViewMatrix
ViewProjectionMatrix
ViewMatrix
}
Defines {
USE_TEXTURE : Texture
PRE_SHADOW
COLOR_MAP : Texture
}
ForcedRenderState {
DepthWrite On
ColorWrite Off
FaceCull Off
DepthTest On
DepthWrite On
PolyOffset 5 3
ColorWrite Off
}
}
Technique SoftParticles{
@ -140,14 +143,6 @@ MaterialDef Point Sprite {
}
}
Technique {
RenderState {
Blend AlphaAdditive
// DepthWrite Off
// AlphaTestFalloff 0.01
}
}
Technique Glow {
VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert

View File

@ -80,7 +80,7 @@ void main(){
#endif
#ifdef FADE
shadow = max(0.0,mix(shadow,1.0,(shadowPosition - m_FadeInfo.x) * m_FadeInfo.y));
shadow = max(0.0, mix(shadow, 1.0, max(0.0, (shadowPosition - m_FadeInfo.x) * m_FadeInfo.y)));
#endif
shadow = shadow * m_ShadowIntensity + (1.0 - m_ShadowIntensity);

View File

@ -40,26 +40,22 @@ vec3 getPosition(in float depth, in vec2 uv){
pos = m_ViewProjectionMatrixInverse * pos;
return pos.xyz / pos.w;
}
#ifndef BACKFACE_SHADOWS
vec3 approximateNormal(in vec4 worldPos,in vec2 texCoord){
float step = g_ResolutionInverse.x ;
float stepy = g_ResolutionInverse.y ;
float depth2 = texture2D(m_DepthTexture,texCoord + vec2(step,-stepy)).r;
float depth3 = texture2D(m_DepthTexture,texCoord + vec2(-step,-stepy)).r;
vec4 worldPos2 = vec4(getPosition(depth2,texCoord + vec2(step,-stepy)),1.0);
vec4 worldPos3 = vec4(getPosition(depth3,texCoord + vec2(-step,-stepy)),1.0);
vec3 approximateNormal(in vec4 worldPos,in vec2 texCoord){
float step = g_ResolutionInverse.x ;
float stepy = g_ResolutionInverse.y ;
float depth2 = texture2D(m_DepthTexture,texCoord + vec2(step,-stepy)).r;
float depth3 = texture2D(m_DepthTexture,texCoord + vec2(-step,-stepy)).r;
vec4 worldPos2 = vec4(getPosition(depth2,texCoord + vec2(step,-stepy)),1.0);
vec4 worldPos3 = vec4(getPosition(depth3,texCoord + vec2(-step,-stepy)),1.0);
vec3 v1 = (worldPos - worldPos2).xyz;
vec3 v2 = (worldPos3 - worldPos2).xyz;
return normalize(cross(v1, v2));
}
#endif
vec3 v1 = (worldPos - worldPos2).xyz;
vec3 v2 = (worldPos3 - worldPos2).xyz;
return normalize(cross(v1, v2));
}
void main(){
#if !defined( RENDER_SHADOWS )
gl_FragColor = texture2D(m_Texture,texCoord);
return;
#endif
void main(){
float depth = texture2D(m_DepthTexture,texCoord).r;
vec4 color = texture2D(m_Texture,texCoord);
@ -72,7 +68,6 @@ void main(){
// get the vertex in world space
vec4 worldPos = vec4(getPosition(depth,texCoord),1.0);
vec3 normal = approximateNormal(worldPos, texCoord);
vec3 lightDir;
#ifdef PSSM
@ -80,14 +75,17 @@ void main(){
#else
lightDir = worldPos.xyz - m_LightPos;
#endif
float ndotl = dot(normal, lightDir);
if(ndotl > -0.0){
gl_FragColor = color;
return;
}
#ifndef BACKFACE_SHADOWS
vec3 normal = approximateNormal(worldPos, texCoord);
float ndotl = dot(normal, lightDir);
if(ndotl > -0.0){
gl_FragColor = color;
return;
}
#endif
#if (!defined(POINTLIGHT) && !defined(PSSM))
vec3 lightDir = worldPos.xyz - m_LightPos;
if( dot(m_LightDir,lightDir) < 0.0){
gl_FragColor = color;
return;

View File

@ -59,8 +59,6 @@ MaterialDef Post Shadow {
FADE : FadeInfo
PSSM : Splits
POINTLIGHT : LightViewProjectionMatrix5
//if no shadow map don't render shadows
RENDER_SHADOWS : ShadowMap0
BACKFACE_SHADOWS : BackfaceShadows
}

View File

@ -136,11 +136,6 @@ vec4 main_multiSample(in int numSample){
void main(){
#if !defined( RENDER_SHADOWS )
outFragColor = fetchTextureSample(m_Texture,texCoord,0);
return;
#endif
#ifdef RESOLVE_MS
vec4 color = vec4(0.0);
for (int i = 0; i < m_NumSamples; i++){

View File

@ -15,7 +15,7 @@
#define SHADOWGATHER(tex,coord) step(coord.z, textureGather(tex, coord.xy))
#endif
#if FILTER_MODE == 0
#if FILTER_MODE == 10
#define GETSHADOW Shadow_Nearest
#define KERNEL 1.0
#elif FILTER_MODE == 1
@ -36,7 +36,7 @@
#define SHADOWCOMPARE(tex,coord) step(coord.z, texture2DProj(tex, coord).r)
#endif
#if FILTER_MODE == 0
#if FILTER_MODE == 10
#define GETSHADOW Shadow_DoShadowCompare
#define KERNEL 1.0
#elif FILTER_MODE == 1
@ -51,7 +51,7 @@
#endif
#if FILTER_MODE == 2
#if (FILTER_MODE == 2)
#define GETSHADOW Shadow_DoDither_2x2
#define KERNEL 1.0
#elif FILTER_MODE == 3

View File

@ -46,7 +46,7 @@ void Skinning_Compute(inout vec4 position, inout vec3 normal){
}
}
void Skinning_Compute(inout vec4 position, inout vec3 tangent, inout vec3 normal){
void Skinning_Compute(inout vec4 position, inout vec3 normal, inout vec3 tangent){
if (inHWBoneWeight.x != 0.0) {
#if NUM_WEIGHTS_PER_VERT == 1
position = m_BoneMatrices[int(inHWBoneIndex.x)] * position;

View File

@ -6,10 +6,10 @@ uniform vec4 m_FogColor;
uniform float m_FogDensity;
uniform float m_FogDistance;
vec2 m_FrustumNearFar=vec2(1.0,m_FogDistance);
const float LOG2 = 1.442695;
void main() {
vec2 m_FrustumNearFar=vec2(1.0,m_FogDistance);
vec4 texVal = texture2D(m_Texture, texCoord);
float fogVal =texture2D(m_DepthTexture,texCoord).r;
float depth= (2.0 * m_FrustumNearFar.x) / (m_FrustumNearFar.y + m_FrustumNearFar.x - fogVal* (m_FrustumNearFar.y-m_FrustumNearFar.x));

View File

@ -10,10 +10,10 @@ uniform float m_FogDistance;
in vec2 texCoord;
out vec4 fragColor;
vec2 m_FrustumNearFar=vec2(1.0,m_FogDistance);
const float LOG2 = 1.442695;
void main() {
vec2 m_FrustumNearFar=vec2(1.0,m_FogDistance);
vec4 texVal = getColor(m_Texture, texCoord);
float fogVal = getDepth(m_DepthTexture,texCoord).r;
float depth= (2.0 * m_FrustumNearFar.x) / (m_FrustumNearFar.y + m_FrustumNearFar.x - fogVal* (m_FrustumNearFar.y-m_FrustumNearFar.x));

View File

@ -24,7 +24,7 @@ void main(){
#endif
#ifdef HAS_GLOWMAP
vec4 glowColor = texture2D( m_GlowMap, texCoord );
vec4 glowColor = texture( m_GlowMap, texCoord );
glowColor = pow(glowColor, vec4(m_ExposurePow));
color += glowColor;
#endif

View File

@ -10,7 +10,7 @@ out vec4 fragColor;
void main(){
vec4 colorRes = getColor(m_Texture,texCoord);
vec4 bloom = texture2D(m_BloomTex, texCoord);
vec4 bloom = texture(m_BloomTex, texCoord);
fragColor = bloom * m_BloomIntensity + colorRes;
}

View File

@ -32,7 +32,7 @@
package jme3test;
import com.jme3.app.Application;
import com.jme3.app.LegacyApplication;
import com.jme3.app.SimpleApplication;
import com.jme3.system.JmeContext;
import java.awt.*;
@ -260,7 +260,7 @@ public class TestChooser extends JDialog {
for (int i = 0; i < appClass.length; i++) {
Class<?> clazz = (Class)appClass[i];
try {
if (Application.class.isAssignableFrom(clazz)) {
if (LegacyApplication.class.isAssignableFrom(clazz)) {
Object app = clazz.newInstance();
if (app instanceof SimpleApplication) {
final Method settingMethod = clazz.getMethod("setShowSettings", boolean.class);
@ -268,7 +268,7 @@ public class TestChooser extends JDialog {
}
final Method mainMethod = clazz.getMethod("start");
mainMethod.invoke(app);
Field contextField = Application.class.getDeclaredField("context");
Field contextField = LegacyApplication.class.getDeclaredField("context");
contextField.setAccessible(true);
JmeContext context = null;
while (context == null) {

View File

@ -35,6 +35,8 @@ package jme3test.app;
import java.lang.reflect.*;
import java.util.*;
import com.jme3.asset.*;
import com.jme3.font.*;
import com.jme3.light.*;
import com.jme3.material.*;
import com.jme3.math.*;
@ -97,6 +99,19 @@ public class TestCloneSpatial {
System.out.println("-------- cloning spatial without cloning material --------------");
clone = root.clone(false);
dump("", clone);
System.out.println("-------- cloning BitmapText ------------");
DesktopAssetManager assets = new DesktopAssetManager(true);
BitmapFont font = assets.loadFont("Interface/Fonts/Console.fnt");
BitmapText text1 = new BitmapText(font);
text1.setText("Testing");
System.out.println("Original:");
dump("", text1);
System.out.println("Clone:");
clone = text1.clone();
dump("", clone);
}

View File

@ -31,7 +31,6 @@
*/
package jme3test.bullet;
import com.jme3.app.SettingsDialog;
import com.jme3.app.SimpleApplication;
import com.jme3.bounding.BoundingBox;
import com.jme3.bullet.BulletAppState;
@ -52,7 +51,6 @@ import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.shadow.BasicShadowRenderer;
import com.jme3.system.AppSettings;
public class TestFancyCar extends SimpleApplication implements ActionListener {

View File

@ -39,7 +39,7 @@ import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Quad;
import com.jme3.texture.Image;
import com.jme3.texture.Texture;
import jme3tools.converters.MipMapGenerator;
import com.jme3.util.MipMapGenerator;
public class TestMipMapGen extends SimpleApplication {

View File

@ -217,7 +217,7 @@ public class TestDirectionalLightShadow extends SimpleApplication implements Act
inputManager.addMapping("fwd", new KeyTrigger(KeyInput.KEY_PGUP));
inputManager.addMapping("back", new KeyTrigger(KeyInput.KEY_PGDN));
inputManager.addMapping("pp", new KeyTrigger(KeyInput.KEY_P));
inputManager.addMapping("backShadows", new KeyTrigger(KeyInput.KEY_B));
inputManager.addMapping("backShadows", new KeyTrigger(KeyInput.KEY_K));
inputManager.addListener(this, "lambdaUp", "lambdaDown", "ThicknessUp", "ThicknessDown",

View File

@ -98,7 +98,7 @@ public class TestSpotLightTerrain extends SimpleApplication {
ambLight.setColor(ColorRGBA.Black);
rootNode.addLight(ambLight);
cam.setLocation(new Vector3f(-41.219646f, -84.8363f, -171.67267f));
cam.setLocation(new Vector3f(-41.219646f, 0.8363f, -171.67267f));
cam.setRotation(new Quaternion(-0.04562731f, 0.89917684f, -0.09668826f, -0.4243236f));
sl.setDirection(cam.getDirection());
sl.setPosition(cam.getLocation());

View File

@ -0,0 +1,62 @@
package jme3test.scene.instancing;
import com.jme3.app.SimpleApplication;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.instancing.InstancedNode;
import com.jme3.scene.shape.Box;
public class TestInstanceNodeWithLight extends SimpleApplication {
// Try to test with different offset
private static float offset = 12;
public static void main(String[] args) {
TestInstanceNodeWithLight app = new TestInstanceNodeWithLight();
app.start();
}
Geometry box;
PointLight pointLight;
@Override
public void simpleInitApp() {
InstancedNode instancedNode = new InstancedNode("testInstancedNode");
rootNode.attachChild(instancedNode);
box = new Geometry("Box", new Box(0.5f, 0.5f, 0.5f));
Material material = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
material.setBoolean("UseInstancing", true);
material.setColor("Diffuse", ColorRGBA.Red);
material.setBoolean("UseMaterialColors", true);
box.setMaterial(material);
instancedNode.attachChild(box);
instancedNode.instance();
pointLight = new PointLight();
pointLight.setColor(ColorRGBA.White);
pointLight.setRadius(10f);
rootNode.addLight(pointLight);
box.setLocalTranslation(new Vector3f(offset, 0, 0));
pointLight.setPosition(new Vector3f(offset - 3f, 0, 0));
cam.setLocation(new Vector3f(offset - 5f, 0, 0));
cam.lookAtDirection(Vector3f.UNIT_X, Vector3f.UNIT_Y);
}
@Override
public void simpleUpdate(float tpf) {
offset += tpf;
System.err.println(offset);
box.setLocalTranslation(new Vector3f(offset, 0, 0));
pointLight.setPosition(new Vector3f(offset - 3f, 0, 0));
cam.setLocation(new Vector3f(offset - 5f, 0, 0));
cam.lookAtDirection(Vector3f.UNIT_X, Vector3f.UNIT_Y);
}
}

View File

@ -31,7 +31,7 @@
*/
package com.jme3.system.ios;
import com.jme3.app.Application;
import com.jme3.app.LegacyApplication;
import com.jme3.system.JmeSystem;
/**
@ -39,7 +39,7 @@ import com.jme3.system.JmeSystem;
*/
public abstract class IosHarness extends ObjcNativeObject {
protected Application app;
protected LegacyApplication app;
public IosHarness(long appDelegate) {
super(appDelegate);

View File

@ -90,9 +90,11 @@ public class CylinderCollisionShape extends CollisionShape {
*/
@Override
public void setScale(Vector3f scale) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "CylinderCollisionShape cannot be scaled");
if (!scale.equals(Vector3f.UNIT_XYZ)) {
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "CylinderCollisionShape cannot be scaled");
}
}
public void write(JmeExporter ex) throws IOException {
super.write(ex);
OutputCapsule capsule = ex.getCapsule(this);

View File

@ -75,17 +75,19 @@ public class NewtMouseInput implements MouseInput, MouseListener {
private int wheelPos;
private Point location;
private Point centerLocation;
private Point centerLocationOnScreen;
private Point lastKnownLocation;
private Point lockPosition;
private boolean isRecentering;
private boolean cursorMoved;
private int eventsSinceRecenter;
private volatile int mousePressedX;
private volatile int mousePressedY;
public NewtMouseInput() {
location = new Point();
centerLocation = new Point();
centerLocationOnScreen = new Point();
lastKnownLocation = new Point();
lockPosition = new Point();
}
public void setInputSource(GLWindow comp) {
@ -102,8 +104,8 @@ public class NewtMouseInput implements MouseInput, MouseListener {
lastEventWheel = 0;
location = new Point();
centerLocation = new Point();
centerLocationOnScreen = new Point();
lastKnownLocation = new Point();
lockPosition = new Point();
}
component = comp;
@ -151,17 +153,14 @@ public class NewtMouseInput implements MouseInput, MouseListener {
@Override
public void setCursorVisible(boolean visible) {
lastKnownLocation.setX(0);
lastKnownLocation.setY(0);
this.visible = visible;
component.setPointerVisible(visible);
component.confinePointer(!visible);
lockPosition.set(lastKnownLocation.getX(), lastKnownLocation.getY());
hack_confinePointer();
}
private void hack_confinePointer() {
if (component.hasFocus() && component.isPointerConfined() && !component.isPointerVisible()) {
if (component.hasFocus() && !component.isPointerVisible()) {
recenterMouse(component);
}
}
@ -215,7 +214,9 @@ public class NewtMouseInput implements MouseInput, MouseListener {
@Override
public void mousePressed(MouseEvent newtEvt) {
MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(newtEvt), true, newtEvt.getX(), component.getSurfaceHeight() - newtEvt.getY());
mousePressedX = newtEvt.getX();
mousePressedY = component.getSurfaceHeight() - newtEvt.getY();
MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(newtEvt), true, mousePressedX, mousePressedY);
evt.setTime(newtEvt.getWhen());
synchronized (eventQueue) {
eventQueue.add(evt);
@ -261,7 +262,7 @@ public class NewtMouseInput implements MouseInput, MouseListener {
// MHenze (cylab) Fix Issue 35:
// As long as the MouseInput is in recentering mode, nothing is done until the mouse is entered in the component
// by the events generated by the robot. If this happens, the last known location is resetted.
if ((centerLocation.getX() == awtEvt.getX() && centerLocation.getY() == awtEvt.getY()) || eventsSinceRecenter++ == 5) {
if ((lockPosition.getX() == awtEvt.getX() && lockPosition.getY() == awtEvt.getY()) || eventsSinceRecenter++ == 5) {
lastKnownLocation.setX(awtEvt.getX());
lastKnownLocation.setY(awtEvt.getY());
isRecentering = false;
@ -285,12 +286,7 @@ public class NewtMouseInput implements MouseInput, MouseListener {
private void recenterMouse(final GLWindow component) {
eventsSinceRecenter = 0;
isRecentering = true;
centerLocation.setX(component.getSurfaceWidth() / 2);
centerLocation.setY(component.getSurfaceHeight() / 2);
centerLocationOnScreen.setX(centerLocation.getX());
centerLocationOnScreen.setY(centerLocation.getY());
component.warpPointer(centerLocationOnScreen.getX(), centerLocationOnScreen.getY());
component.warpPointer(lockPosition.getX(), lockPosition.getY());
}
private int getJMEButtonIndex(MouseEvent awtEvt) {
@ -321,11 +317,17 @@ public class NewtMouseInput implements MouseInput, MouseListener {
@Override
public void setNativeCursor(JmeCursor cursor) {
final ByteBuffer pixels = Buffers.copyIntBufferAsByteBuffer(cursor.getImagesData());
final DimensionImmutable size = new Dimension(cursor.getWidth(), cursor.getHeight());
final PixelFormat pixFormat = PixelFormat.RGBA8888;
final PixelRectangle.GenericPixelRect rec = new PixelRectangle.GenericPixelRect(pixFormat, size, 0, true, pixels);
final PointerIcon joglCursor = component.getScreen().getDisplay().createPointerIcon(rec, cursor.getXHotSpot(), cursor.getHeight() - cursor.getYHotSpot());
component.setPointerIcon(joglCursor);
PointerIcon pointerIcon = null;
if (cursor != null) {
final ByteBuffer pixels = Buffers.copyIntBufferAsByteBuffer(cursor.getImagesData());
final DimensionImmutable size = new Dimension(cursor.getWidth(), cursor.getHeight());
final PixelFormat pixFormat = PixelFormat.RGBA8888;
final PixelRectangle.GenericPixelRect rec =
new PixelRectangle.GenericPixelRect(pixFormat, size, 0, true, pixels);
pointerIcon = component.getScreen().getDisplay()
.createPointerIcon(rec, cursor.getXHotSpot(), cursor.getHeight() - cursor.getYHotSpot());
}
component.setPointerIcon(pointerIcon);
}
}

View File

@ -39,6 +39,8 @@ import com.jme3.input.event.MouseButtonEvent;
import com.jme3.input.event.MouseMotionEvent;
import com.jme3.system.lwjgl.LwjglAbstractDisplay;
import com.jme3.system.lwjgl.LwjglTimer;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.lwjgl.LWJGLException;
@ -57,6 +59,12 @@ public class LwjglMouseInput implements MouseInput {
private boolean supportHardwareCursor = false;
private boolean cursorVisible = true;
/**
* We need to cache the cursors
* (https://github.com/jMonkeyEngine/jmonkeyengine/issues/537)
*/
private Map<JmeCursor, Cursor> cursorMap = new HashMap<JmeCursor, Cursor>();
private int curX, curY, curWheel;
public LwjglMouseInput(LwjglAbstractDisplay context){
@ -120,7 +128,7 @@ public class LwjglMouseInput implements MouseInput {
}
if (btn != -1){
MouseButtonEvent evt = new MouseButtonEvent(btn,
Mouse.getEventButtonState(), x, y);
Mouse.getEventButtonState(), x, y);
evt.setTime(Mouse.getEventNanoseconds());
listener.onMouseButtonEvent(evt);
}
@ -132,6 +140,13 @@ public class LwjglMouseInput implements MouseInput {
return;
Mouse.destroy();
// Destroy the cursor cache
for (Cursor cursor : cursorMap.values()) {
cursor.destroy();
}
cursorMap.clear();
logger.fine("Mouse destroyed.");
}
@ -155,14 +170,20 @@ public class LwjglMouseInput implements MouseInput {
try {
Cursor newCursor = null;
if (jmeCursor != null) {
newCursor = new Cursor(
jmeCursor.getWidth(),
jmeCursor.getHeight(),
jmeCursor.getXHotSpot(),
jmeCursor.getYHotSpot(),
jmeCursor.getNumImages(),
jmeCursor.getImagesData(),
jmeCursor.getImagesDelay());
newCursor = cursorMap.get(jmeCursor);
if (newCursor == null) {
newCursor = new Cursor(
jmeCursor.getWidth(),
jmeCursor.getHeight(),
jmeCursor.getXHotSpot(),
jmeCursor.getYHotSpot(),
jmeCursor.getNumImages(),
jmeCursor.getImagesData(),
jmeCursor.getImagesDelay());
// Add to cache
cursorMap.put(jmeCursor, newCursor);
}
}
Mouse.setNativeCursor(newCursor);
} catch (LWJGLException ex) {

View File

@ -77,6 +77,20 @@ public abstract class Serializer {
// Registers the classes we already have serializers for.
static {
initialize();
}
public static void initialize() {
// Reset all of the inexes and tracking variables just in case
idRegistrations.clear();
classRegistrations.clear();
registrations.clear();
nextAvailableId = -2; // historically the first ID was always -2
// Obviously need to be unlocked...
locked = false;
// Preregister some fixed serializers so that they don't move
// if the list below is modified. Automatic ID generation will

View File

@ -2,28 +2,40 @@ if (!hasProperty('mainClass')) {
ext.mainClass = ''
}
repositories {
maven{
url 'http://nifty-gui.sourceforge.net/nifty-maven-repo'
}
}
dependencies {
compile project(':jme3-core')
compile 'lessvoid:nifty:1.4.1'
compile 'lessvoid:nifty-default-controls:1.4.1'
compile 'lessvoid:nifty-style-black:1.4.1'
compile 'com.github.nifty-gui:nifty:1.4.2'
compile 'com.github.nifty-gui:nifty-default-controls:1.4.2'
compile 'com.github.nifty-gui:nifty-style-black:1.4.2'
}
uploadArchives {
repositories.mavenDeployer {
pom.project {
repositories {
repository {
id "nifty-maven-repo.sourceforge.net"
url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
}
}
ext.pomConfig = {
name POM_NAME
description POM_DESCRIPTION
url POM_URL
inceptionYear POM_INCEPTION_YEAR
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEVELOPER_CONNECTION
}
licenses {
license {
name POM_LICENSE_NAME
url POM_LICENSE_URL
distribution POM_LICENSE_DISTRIBUTION
}
}
}
developers {
developer {
name 'jMonkeyEngine Team'
id 'jMonkeyEngine'
}
}
repositories {
repository {
id "nifty-maven-repo.sourceforge.net"
url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
}
}
}

View File

@ -150,6 +150,7 @@ varying vec2 texCoord;
vec4 calculateDiffuseBlend(in vec2 texCoord) {
vec4 alphaBlend = texture2D( m_AlphaMap, texCoord.xy );
vec4 diffuseColor = vec4(1.0);
#ifdef ALPHAMAP_1
vec4 alphaBlend1 = texture2D( m_AlphaMap_1, texCoord.xy );
@ -157,9 +158,10 @@ varying vec2 texCoord;
#ifdef ALPHAMAP_2
vec4 alphaBlend2 = texture2D( m_AlphaMap_2, texCoord.xy );
#endif
vec4 diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
diffuseColor *= alphaBlend.r;
#ifdef DIFFUSEMAP
diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
diffuseColor *= alphaBlend.r;
#endif
#ifdef DIFFUSEMAP_1
vec4 diffuseColor1 = texture2D(m_DiffuseMap_1, texCoord * m_DiffuseMap_1_scale);
diffuseColor = mix( diffuseColor, diffuseColor1, alphaBlend.g );

View File

@ -151,6 +151,7 @@ varying vec3 lightVec;
vec4 calculateDiffuseBlend(in vec2 texCoord) {
vec4 alphaBlend = texture2D( m_AlphaMap, texCoord.xy );
vec4 diffuseColor = vec4(1.0);
#ifdef ALPHAMAP_1
vec4 alphaBlend1 = texture2D( m_AlphaMap_1, texCoord.xy );
@ -158,9 +159,10 @@ varying vec3 lightVec;
#ifdef ALPHAMAP_2
vec4 alphaBlend2 = texture2D( m_AlphaMap_2, texCoord.xy );
#endif
vec4 diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
diffuseColor *= alphaBlend.r;
#ifdef DIFFUSEMAP
diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
diffuseColor *= alphaBlend.r;
#endif
#ifdef DIFFUSEMAP_1
vec4 diffuseColor1 = texture2D(m_DiffuseMap_1, texCoord * m_DiffuseMap_1_scale);
diffuseColor = mix( diffuseColor, diffuseColor1, alphaBlend.g );

View File

@ -272,29 +272,7 @@ MaterialDef Terrain Lighting {
}
Technique GBuf {
VertexShader GLSL100: Common/MatDefs/Light/GBuf.vert
FragmentShader GLSL100: Common/MatDefs/Light/GBuf.frag
WorldParameters {
WorldViewProjectionMatrix
WorldMatrix
}
Defines {
VERTEX_COLOR : UseVertexColor
MATERIAL_COLORS : UseMaterialColors
V_TANGENT : VTangent
MINNAERT : Minnaert
WARDISO : WardIso
DIFFUSEMAP : DiffuseMap
NORMALMAP : NormalMap
SPECULARMAP : SpecularMap
PARALLAXMAP : ParallaxMap
}
}
Technique Glow {

View File

@ -1 +0,0 @@
updates.jmonkeyengine.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5bNOiZwU5dF62nBllxkjiSIfn0k6RVfprvO1aUypRmARD3/MKJKg7cGLezlLKaHZtVs84VpEqpmg5IzPAXWEmxUw1oke70uYMli7JV+4oPAeQRFwUdldP98I5h9VHwSjBqMycRLkxYaHF8edIPt1Zsa2dM3qrufy71ndQoFF6g7QxmT7gsTxwcNufDxymIgiAna/Qp2fr0YCLCiB8RQ7JTHfqA3dOWw0wz7AwfBTwwDCHkVxB5B4nz5iZxFr0scvqcae8vMncq8xKS7OMrLbn6asVaF6dDu+5Jc0mqxma5Qg7VC1xQXZsvlRISfrTFhQMhEx+j9w5snzihrlFnZ35

Binary file not shown.

View File

@ -1,6 +0,0 @@
task copySshKnownHosts(type: Copy) {
from 'private/known_hosts'
into System.properties['user.home'] + '/.ssh'
}
uploadArchives.dependsOn copySshKnownHosts

View File

@ -146,7 +146,7 @@ task configureVersionInfo {
System.env.TRAVIS_PULL_REQUEST != "false") {
jmeBranchName += "-pr-" + System.env.TRAVIS_PULL_REQUEST
}
if (jmeBranchName != "master") {
if (jmeBranchName != "v3.1") {
jmeFullVersion += "-${jmeBranchName}"
jmePomVersion += "-${jmeBranchName}"
jmeNbmUcSuffix = "${jmeBranchName}-"