Compare commits

...

119 Commits

Author SHA1 Message Date
empirephoenix afe86a314d Revert "Backport changes from the master branch." 8 years ago
empirephoenix ec71c5e04e Merge pull request #671 from JavaSaBr/backport_changes_from_3.2 8 years ago
javasabr fa84e7bf28 backport changes from the master branch. 8 years ago
Nehon b1727b9772 Fixed InstanceGeomerty not working properly when using the lighting material and a non DirectionalLight 8 years ago
empirephoenix 088419eef0 Merge pull request #582 from FennelFetish/font 8 years ago
Rémy Bouquet 9ba574e584 fixed bad comma in previous commit 8 years ago
Nehon c154a47b02 Fixed tangent and normal argument position in Skinning.glsllib 8 years ago
MeFisto94 10b23db94d TestMipMapGen: Use the non AWT MipMap Generator (Don't depend on jme3-desktop but jme3-core, to run this test on android) 8 years ago
MeFisto94 479392f6fd TestFancyCar: Remove unused SettingsDialog imports, allowing the Test to also run on android (no jme3-desktop dependency anymore) 8 years ago
Rémy Bouquet 5470abb2b0 Fixed warnings in Terrain shader. 8 years ago
empirephoenix 8214346e8b Merge pull request #624 from jMonkeyEngine/revert-573-cleanup_build_scripts 8 years ago
empirephoenix a87db2c117 Revert "Cleanup build scripts (3.1)" 8 years ago
empirephoenix 0f93df648e Merge pull request #573 from jMonkeyEngine/cleanup_build_scripts 8 years ago
Paul Speed af04bf9d22 Forcing one of the files to change so we might actually get a new build. 8 years ago
empirephoenix 2761bc3677 Merge pull request #615 from riccardobl/FixMeshCollisionShapeJ3oReadv3.1 8 years ago
Riccardo Balbo 1ae6e98d05 Fix MeshCollisionShape crash when loaded from j3o: always create BVH before scaling. 8 years ago
Nehon 69cd160956 Fixed an issue where ParticleEmitter had NaN bounds during the first update when added to the scene graph during the update loop 8 years ago
Nehon 789daa6295 Fixed warning that were coming out of the particle.j3md. Also fixed the preshadow technique 8 years ago
Rémy Bouquet 659ed8fd23 Merge pull request #602 from stephengold/v3.1 8 years ago
Stephen Gold f3e2925bd8 fix errors in how vector projection is calculated 8 years ago
Rémy Bouquet 5d2c89f040 Merge pull request #599 from stephengold/v3.1 8 years ago
Stephen Gold ac8eb4d40a CapsuleCollisionShape: warn about scaling only if it's not identity 8 years ago
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 8 years ago
iwgeric 7ecb81c230 Update AndroidLocator to allow assets to be stored in Android assets, drawable, or mipmap directories. 8 years ago
Paul Speed 63e8c9c485 Convert Skeleton and Bone over to use the JME cloner system for cloning... 8 years ago
empirephoenix 975954fb17 Merge pull request #575 from Fadorico/upstream3.1 8 years ago
Fennel e60d67b1bb Fixes tab stops in BitmapText / BitmapFont. 8 years ago
Paul Speed 92b5d40003 Modified BitmapTextPage to always deep clone its mesh since otherwise 8 years ago
Paul Speed 4952ad0cb5 Broke out the Serializer's static initializer into a separate initialize() 8 years ago
Paul Speed a13a3a7f09 Another bitmap text clone fix. The text pages array (the list of the actual geometry of 8 years ago
Paul Speed 735397f16e Another fix for BitmapText cloning where the regular clone() was 8 years ago
Paul Speed c1764bc425 Fixed the cloned Letters to use the cloned StringBlock instead of the 8 years ago
Paul Speed da1b7da329 Added a test for cloning BitmapText. 8 years ago
Paul Speed e879a0e142 Fix for issue #577 StringBlock cannot be cloned with the cloner because 8 years ago
Fadorico e3bd122519 Write/read the width and height of the quad 8 years ago
Kirill Vainer 36e99bf032 misc: gitignore update for gradle 3.2.1 8 years ago
Kirill Vainer c37f0e59d2 build: fix gradle 3.2.1 deprecations 8 years ago
Kirill Vainer 06757f73b4 travis: upload artifacts only on linux/jdk8 8 years ago
Kirill Vainer 35b9eed76f travis: reorder structure a bit 8 years ago
Kirill Vainer e4ed3313d5 travis: fix unsupported jdk 8 years ago
Kirill Vainer 8ce2f9cfe7 travis: test matrix build 8 years ago
Kirill Vainer b99d03bd3c version: remove sdk related configuration 8 years ago
Kirill Vainer f800d74e87 travis: remove uneeded install directive 8 years ago
Kirill Vainer 78ac8df78a cleanup build cache according to travis docs 8 years ago
Kirill Vainer 39dc140f79 build v3.1, master, and PRs only from now on 8 years ago
Kirill Vainer f38becf2c6 remove SSH based maven publishing 8 years ago
Kirill Vainer 72b9f186ed fix broken bullet native source url 8 years ago
Kirill Vainer 8c4b44941e Fix #550 8 years ago
Nehon a71fb286f4 Fixed shadow fade and zfar computation as it was breaking shadow border filtering. 8 years ago
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. 8 years ago
Paul Speed 4919620e61 Improved the "compare result changed" error message to include the most 8 years ago
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. 8 years ago
Nehon efd47c4347 fixed some javadoc in AbstractShadowRenderer 8 years ago
Nehon 142b006ad6 Fixed post shadow filter for glsl1.5 8 years ago
Nehon 9500227ca7 Defaulted the render back faces shadows in the AbstractShadowRenderer to true to keep the same behavior as in 3.0 8 years ago
Nehon 5495b7d064 Fixed the link to the paper for convertHalfToFloat 8 years ago
Nehon da5e4a18c7 ShaderNodes now move all the declared extensions at the top of the generated shader source 8 years ago
Nehon dd8271e8b3 Fixed SpotLight constructor to properly compute the invSpotRange see https://github.com/jMonkeyEngine/jmonkeyengine/issues/563 8 years ago
jjYBdx4IL cfd491e270 fixes issue https://github.com/jMonkeyEngine/jmonkeyengine/issues/506 : Material->toString() does not prevent/check for possible NPEs 8 years ago
Nehon 95bf9efe9b MikktSpace tangent generator now properly generates the BindPoseTangent buffer when necessary 8 years ago
Rémy Bouquet 7e458e496c Fixed wiki links in the realm.md 8 years ago
Kirill Vainer 09e9c1efa0 Merge pull request #555 from JavaSaBr/master-original 8 years ago
Kirill Vainer 2440fc5a74 Merge pull request #554 from TehLeo/patch-2 8 years ago
empirephoenix bbad454e43 Merge pull request #541 from tonihele/issue-537 8 years ago
empirephoenix 7eb9463496 Merge pull request #505 from JavaSaBr/v3.1 8 years ago
Rémy Bouquet 769cf36221 Merge pull request #547 from MeFisto94/ios-legacyapplication 8 years ago
MeFisto94 7b0a00b364 Using LegacyApplication in the iOS Harness just like it has been done for Android in 3c56afe 8 years ago
Rémy Bouquet b42bf7f67e fixed glsl 1.0 version of the postShadowFilter shader 8 years ago
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. 8 years ago
Rémy Bouquet a7edef3a06 fixed transparent shadows on mac. 8 years ago
Toni Helenius 52c0a35525 Added a cursor cache to avoid cursor disappearing and app crashing when too many cursors are created 8 years ago
Riccardo Balbo c92009a40a Use texture() instead of texture2D() in bloomExtract15 and bloomFinal15 8 years ago
Rémy Bouquet e4a8b8d91c Merge pull request #530 from tiatin/v3.1 9 years ago
tiatin f65f0a7ee8 Added ability to set framebuffer image format used in FilterPostProcessor. 9 years ago
Julien Gouesse 4ba4da2e31 Merge pull request #525 from saloisio/v3.1 9 years ago
saloisio 05c39990ca NewtMouseInput now resets mouse cursor to default image when inputManager.setMouseCursor(null) invoked 9 years ago
Rémy Bouquet fae07c9c71 Merge pull request #522 from MeFisto94/v3.1_HWSkinning 9 years ago
Rémy Bouquet eefc17428c Merge pull request #501 from MeFisto94/HwSkinningFixV02 9 years ago
Julien Gouesse 75c3d61f8f Merge pull request #520 from saloisio/v3.1 9 years ago
saloisio d0175a77b6 Merge branch 'v3.1' of https://github.com/saloisio/jmonkeyengine into v3.1 9 years ago
saloisio 9b8c27a0fb Removed auto centering of mouse cursor 9 years ago
Paul Speed 02c5d9d414 Merge pull request #517 from tiatin/v3.1 9 years ago
tiatin d8529573e4 Changed overrides from ArrayList to SafeArrayList for GC and iteration performance reasons. Fixed bug in SafeArrayList.equals(). 9 years ago
tiatin 9b0422fc3c Added iteration using iterator, if List is not ArrayList. 9 years ago
tiatin 93c2fd1989 Changed iteration over List from for-each to manual iteration. 9 years ago
javasabr be66436745 added warning 9 years ago
empirephoenix 2c3d94a166 Merge pull request #504 from davidB/v3.1 9 years ago
Paul Speed a2efd1323f Merge pull request #509 from davidB/patch-1 9 years ago
David Bernard 758fdcf394 travis: disable uploadArchives 9 years ago
javasabr f354343e47 fixed the NPE with controls 9 years ago
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 9 years ago
Nehon 3d1a541903 Fixed an issue when resizing the viewport, with a FPP and antialiasing would stop rendering 9 years ago
Nehon 6bdf479a0a Fixed an issue in the fog filter's shader that was preventing it to run on android 9 years ago
Rémy Bouquet 29dfff223c proper equal and hashcode for ShaderNodesVariables. 9 years ago
Kirill Vainer 4faf6cf36c Merge pull request #491 from riccardobl/AddGimpactCollisionAlgo 9 years ago
Kirill Vainer d27b26805a bullet native: fix mingw target platform 9 years ago
Kirill Vainer b2a57e130a travis: set known hosts using travis config 9 years ago
Kirill Vainer fafccdf15e pom: fix incorrect inception year 9 years ago
Kirill Vainer 513fc08fb6 travis: only create dist if deploying 9 years ago
Kirill Vainer 3419256941 travis: use cache rules from docs 9 years ago
Kirill Vainer 2a0a9e7b6e build: fix build error 9 years ago
Kirill Vainer a7b20629e7 build: update to gradle 2.13 9 years ago
Kirill Vainer 8416dd8c65 travis: dont cache netbeans folder anymore 9 years ago
Kirill Vainer 7d4a34f96f build: check file exists before getting text 9 years ago
Kirill Vainer 804c173757 build: minor cleanup 9 years ago
Kirill Vainer 6dfd59ea73 android-examples: use correct maven group 9 years ago
Kirill Vainer 8f7abca01b niftygui: add nifty repository to POM 9 years ago
Kirill Vainer 2c94a3f538 travis: treat v3.1 branch as trunk 9 years ago
Kirill Vainer 652358038d version: treat this branch as trunk 9 years ago
Paul Speed 2fd9da3d50 Merge pull request #487 from Dokthar/joysticks 9 years ago
MeFisto94 310f4db6ad Fixed some Reflection Errors due to the Switch from Application to LegacyApplication 9 years ago
Kirill Vainer d044ad13e1 Fix issue #479 9 years ago
Kirill Vainer 185eb7b6e5 Merge pull request #481 from riccardobl/fix_setAdamping_bulletnative 9 years ago
Kirill Vainer 0f5514192a travis: update known hosts file 9 years ago
Kirill Vainer f692f82e96 travis: update the www-updater key 9 years ago
Kirill Vainer 656a86ba0e Merge pull request #482 from Dokthar/readme-patch 9 years ago
Kirill Vainer 8d132d35f0 bullet native: update OSX natives 9 years ago
Dokthar 0f1f1e6bc7 fix readme links 9 years ago
Riccardo Balbo d2c608c788 Fix for setAngularDamping / bullet native. 9 years ago
  1. 23
      .travis.yml
  2. 7
      README.md
  3. 5
      build.gradle
  4. 2
      common-android-app.gradle
  5. 15
      common.gradle
  6. 3
      gradle.properties
  7. BIN
      gradle/wrapper/gradle-wrapper.jar
  8. 4
      gradle/wrapper/gradle-wrapper.properties
  9. 52
      gradlew
  10. 8
      gradlew.bat
  11. 144
      jme3-android/src/main/java/com/jme3/asset/plugins/AndroidLocator.java
  12. 263
      jme3-bullet-native/build.gradle
  13. BIN
      jme3-bullet-native/libs/native/osx/x86/libbulletjme.dylib
  14. BIN
      jme3-bullet-native/libs/native/osx/x86_64/libbulletjme.dylib
  15. 2
      jme3-bullet-native/src/native/cpp/com_jme3_bullet_objects_PhysicsRigidBody.cpp
  16. 2
      jme3-bullet-native/src/native/cpp/jmePhysicsSpace.cpp
  17. 1
      jme3-bullet-native/src/native/cpp/jmePhysicsSpace.h
  18. 2
      jme3-bullet/src/main/java/com/jme3/bullet/collision/shapes/CylinderCollisionShape.java
  19. 22
      jme3-bullet/src/main/java/com/jme3/bullet/collision/shapes/MeshCollisionShape.java
  20. 15
      jme3-core/build.gradle
  21. 43
      jme3-core/src/main/java/com/jme3/animation/Bone.java
  22. 10
      jme3-core/src/main/java/com/jme3/animation/Skeleton.java
  23. 3
      jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java
  24. 2
      jme3-core/src/main/java/com/jme3/audio/AudioListenerState.java
  25. 3
      jme3-core/src/main/java/com/jme3/effect/ParticleEmitter.java
  26. 7
      jme3-core/src/main/java/com/jme3/font/BitmapFont.java
  27. 26
      jme3-core/src/main/java/com/jme3/font/BitmapText.java
  28. 23
      jme3-core/src/main/java/com/jme3/font/BitmapTextPage.java
  29. 11
      jme3-core/src/main/java/com/jme3/font/LetterQuad.java
  30. 35
      jme3-core/src/main/java/com/jme3/font/StringBlock.java
  31. 6
      jme3-core/src/main/java/com/jme3/light/SpotLight.java
  32. 37
      jme3-core/src/main/java/com/jme3/material/MatParam.java
  33. 16
      jme3-core/src/main/java/com/jme3/material/Material.java
  34. 13
      jme3-core/src/main/java/com/jme3/material/Technique.java
  35. 7
      jme3-core/src/main/java/com/jme3/math/FastMath.java
  36. 2
      jme3-core/src/main/java/com/jme3/math/Triangle.java
  37. 6
      jme3-core/src/main/java/com/jme3/math/Vector3f.java
  38. 4
      jme3-core/src/main/java/com/jme3/math/Vector4f.java
  39. 8
      jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java
  40. 4
      jme3-core/src/main/java/com/jme3/renderer/RenderManager.java
  41. 3
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
  42. 3
      jme3-core/src/main/java/com/jme3/scene/GeometryGroupNode.java
  43. 39
      jme3-core/src/main/java/com/jme3/scene/Spatial.java
  44. 27
      jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java
  45. 19
      jme3-core/src/main/java/com/jme3/scene/shape/Quad.java
  46. 23
      jme3-core/src/main/java/com/jme3/shader/ShaderGenerator.java
  47. 13
      jme3-core/src/main/java/com/jme3/shader/ShaderNodeVariable.java
  48. 4
      jme3-core/src/main/java/com/jme3/shadow/AbstractShadowRenderer.java
  49. 2
      jme3-core/src/main/java/com/jme3/shadow/DirectionalLightShadowRenderer.java
  50. 2
      jme3-core/src/main/java/com/jme3/shadow/EdgeFilteringMode.java
  51. 2
      jme3-core/src/main/java/com/jme3/shadow/ShadowUtil.java
  52. 2
      jme3-core/src/main/java/com/jme3/system/JmeVersion.java
  53. 4
      jme3-core/src/main/java/com/jme3/util/ListSort.java
  54. 2
      jme3-core/src/main/java/com/jme3/util/SafeArrayList.java
  55. 18
      jme3-core/src/main/java/com/jme3/util/TangentBinormalGenerator.java
  56. 29
      jme3-core/src/main/java/com/jme3/util/TangentUtils.java
  57. 7
      jme3-core/src/main/java/com/jme3/util/mikktspace/MikkTSpaceImpl.java
  58. 7
      jme3-core/src/main/java/com/jme3/util/mikktspace/MikktspaceTangentGenerator.java
  59. 8
      jme3-core/src/main/resources/Common/MatDefs/Light/Lighting.j3md
  60. 23
      jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md
  61. 2
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadow.frag
  62. 14
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadowFilter.frag
  63. 2
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadowFilter.j3md
  64. 5
      jme3-core/src/main/resources/Common/MatDefs/Shadow/PostShadowFilter15.frag
  65. 6
      jme3-core/src/main/resources/Common/ShaderLib/Shadows.glsllib
  66. 2
      jme3-core/src/main/resources/Common/ShaderLib/Skinning.glsllib
  67. 2
      jme3-effects/src/main/resources/Common/MatDefs/Post/Fog.frag
  68. 2
      jme3-effects/src/main/resources/Common/MatDefs/Post/Fog15.frag
  69. 2
      jme3-effects/src/main/resources/Common/MatDefs/Post/bloomExtract15.frag
  70. 2
      jme3-effects/src/main/resources/Common/MatDefs/Post/bloomFinal15.frag
  71. 6
      jme3-examples/src/main/java/jme3test/TestChooser.java
  72. 15
      jme3-examples/src/main/java/jme3test/app/TestCloneSpatial.java
  73. 2
      jme3-examples/src/main/java/jme3test/bullet/TestFancyCar.java
  74. 2
      jme3-examples/src/main/java/jme3test/conversion/TestMipMapGen.java
  75. 2
      jme3-examples/src/main/java/jme3test/light/TestDirectionalLightShadow.java
  76. 2
      jme3-examples/src/main/java/jme3test/light/TestSpotLightTerrain.java
  77. 62
      jme3-examples/src/main/java/jme3test/scene/instancing/TestInstanceNodeWithLight.java
  78. 4
      jme3-ios/src/main/java/com/jme3/system/ios/IosHarness.java
  79. 2
      jme3-jbullet/src/main/java/com/jme3/bullet/collision/shapes/CylinderCollisionShape.java
  80. 40
      jme3-jogl/src/main/java/com/jme3/input/jogl/NewtMouseInput.java
  81. 21
      jme3-lwjgl/src/main/java/com/jme3/input/lwjgl/LwjglMouseInput.java
  82. 14
      jme3-networking/src/main/java/com/jme3/network/serializing/Serializer.java
  83. 40
      jme3-niftygui/build.gradle
  84. 6
      jme3-terrain/src/main/resources/Common/MatDefs/Terrain/SPTerrainLighting.frag
  85. 6
      jme3-terrain/src/main/resources/Common/MatDefs/Terrain/TerrainLighting.frag
  86. 22
      jme3-terrain/src/main/resources/Common/MatDefs/Terrain/TerrainLighting.j3md
  87. 1
      private/known_hosts
  88. BIN
      private/www-updater.key.enc
  89. 6
      upload.gradle
  90. 2
      version.gradle

@ -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:
@ -24,9 +24,9 @@ install:
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 || :'

@ -22,8 +22,8 @@ The engine is used by several commercial game studios and computer-science cours
## 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.
Go to https://github.com/jMonkeyEngine/sdk/releases to download the jMonkeyEngine SDK.
[Read the wiki](https://jmonkeyengine.github.io/wiki) 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!
@ -37,7 +37,7 @@ Plus a bunch of awesome libraries & tight integrations like Bullet, Blender, Nif
### Documentation
Did you miss it? Don't sweat it, [here it is again](http://hub.jmonkeyengine.org/wiki/doku.php).
Did you miss it? Don't sweat it, [here it is again](https://jmonkeyengine.github.io/wiki).
### Contributing
@ -46,3 +46,4 @@ Read our [contribution guide](https://github.com/jMonkeyEngine/jmonkeyengine/blo
### License
New BSD (3-clause) License. In other words, you do whatever makes you happy!

@ -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 {

@ -1,6 +1,6 @@
apply plugin: 'com.android.application'
group = 'com.jme3'
group = 'org.jmonkeyengine'
version = jmeVersion + '-' + jmeVersionTag
sourceCompatibility = '1.6'

@ -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)
@ -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()
// }
// }
}

@ -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.

@ -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

@ -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

@ -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

@ -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 androidManager.open(assetPath);
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);
}
}
}
}
private AndroidAssetInfo create(AssetManager assetManager, AssetKey key, String assetPath) throws IOException {
public AssetFileDescriptor openFileDescriptor() {
android.content.res.Resources androidResources = JmeAndroidSystem.getView().getContext().getResources();
if (resourceId == 0) {
try {
InputStream in = androidManager.open(assetPath);
if (in == null){
return null;
}else{
return new AndroidAssetInfo(assetManager, key, assetPath, in);
}
return androidResources.getAssets().openFd(assetPath);
} catch (IOException ex) {
// XXX: Prefer to show warning here?
// Should only surpress exceptions for "file missing" type errors.
return null;
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);
}
}
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();
}
}
}

@ -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 {
}
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 (!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${org.gradle.internal.jvm.Jvm.current().javaHome}\\include"
cppCompiler.args "/I$javaHome\\include"
} else{
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
cppCompiler.args '-I', "$javaHome/include"
}
if (targetPlatform.operatingSystem.name == "osx") {
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/darwin"
} else if (targetPlatform.operatingSystem.name == "linux") {
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}")
}
// C++ sources for binary compilation
sources {
bulletjme {
cpp {
source {
srcDir 'src/native/cpp'
srcDir bulletSrcPath
exclude 'BulletMultiThreaded/GpuSoftBodySolvers/**'
include '**/*.cpp'
withType(StaticLibraryBinarySpec) {
buildable = false
}
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"
}
// Java source sets for IDE acces and source jar bundling / mavenization
sourceSets {
main {
java {
srcDir 'src/native/cpp'
Mac64 {
architecture "x86_64"
operatingSystem "osx"
}
Linux32 {
architecture "x86"
operatingSystem "linux"
}
Linux64 {
architecture "x86_64"
operatingSystem "linux"
}
}
// 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"
target("Windows64")
}
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"
// 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
}
}
}
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;
}
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
}
task unzipBulletIfNeeded << {
}
// 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}"
unzipBulletIfNeeded.dependsOn {
if (buildNativeProjects == "true" && !file(bulletFolder).isDirectory()) {
unzipBullet
}
// Add depend on copy
jar.dependsOn("copyBinaryToLibs${targetPlatform}")
}
// Helper class to wrap ant dowload task
@ -232,4 +230,3 @@ class MyDownload extends DefaultTask {
ant.get(src: sourceUrl, dest: target)
}
}

@ -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);
}
/*

@ -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) {

@ -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

@ -86,8 +86,10 @@ public class CylinderCollisionShape extends CollisionShape {
*/
@Override
public void setScale(Vector3f scale) {
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);

@ -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,23 +191,17 @@ 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);
}

@ -17,9 +17,9 @@ sourceSets {
}
}
task updateVersionPropertiesFile << {
def verfile = file('src/main/resources/com/jme3/system/version.properties')
verfile.text = "# THIS IS AN AUTO-GENERATED FILE..\n" +
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" +
@ -31,9 +31,16 @@ task updateVersionPropertiesFile << {
"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 {
}

@ -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.
@ -168,6 +170,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.
*

@ -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() {

@ -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."
);

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

@ -1101,9 +1101,12 @@ public class ParticleEmitter extends Geometry {
lastPos.set(getWorldTranslation());
//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();
}

@ -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)=='#'){

@ -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) {

@ -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

@ -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();

@ -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();
@ -173,27 +174,37 @@ class StringBlock implements Cloneable {
this.wrapType = wrap;
}
void setEllipsisChar(char c) {
this.ellipsisChar = c;
}
int getEllipsisChar() {
return ellipsisChar;
}
void setTabWidth(float tabWidth) {
this.tabWidth = tabWidth;
}
void setTabPosition(float[] tabs) {
this.tabPos = tabs;
if(tabs != null && tabs.length > 0) {
this.tabPos = tabs.clone();
} else {
this.tabPos = null;
}
float getTabWidth() {
return tabWidth;
}
float[] getTabPosition() {
return tabPos;
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];
}
}
void setEllipsisChar(char c) {
this.ellipsisChar = c;
}
int getEllipsisChar() {
return ellipsisChar;
// No upcoming tab stops available, use default tab width.
return (float)Math.floor(posX / tabWidth) * tabWidth + tabWidth;
}
}

@ -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);
}

@ -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;

@ -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) +
"]";
}

@ -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();

@ -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;
}

@ -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;

@ -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);
}
/**

@ -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);
}
/**

@ -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);

@ -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;
}

@ -1672,7 +1672,6 @@ 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);
@ -1681,7 +1680,7 @@ public final class GLRenderer implements Renderer {
intBuf16.flip();
glext.glDrawBuffers(intBuf16);
context.boundDrawBuf = MRT_OFF + fb.getNumColorBuffers();
}
} else {
RenderBuffer rb = fb.getColorBuffer(fb.getTargetIndex());
// select this draw buffer

@ -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;
}

@ -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);
}

@ -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() {

@ -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
@ -127,5 +132,19 @@ public class Quad extends Mesh {
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);
}
}

@ -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,
@ -60,6 +61,10 @@ public abstract class ShaderGenerator {
* the technique def to use for the shader generation
*/
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();
}
/**

@ -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;
}

@ -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

@ -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();

@ -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

@ -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

@ -58,7 +58,7 @@ public class JmeVersion {
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", "");

@ -700,7 +700,9 @@ public class ListSort<T> {
arr[dest + lengthB] = tempArray[iterA];
} 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);
}

@ -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() {

@ -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) {

@ -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);
}
}
}
}

@ -21,15 +21,12 @@ public class MikkTSpaceImpl implements MikkTSpaceContext {
public MikkTSpaceImpl(Mesh mesh) {
this.mesh = mesh;
VertexBuffer tangentBuffer = mesh.getBuffer(VertexBuffer.Type.Tangent);
if(tangentBuffer == null){
//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);
}
//TODO ensure the Tangent buffer exists, else create one.
}
@Override
public int getNumFaces() {
return mesh.getTriangleCount();

@ -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());
}
}

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

@ -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
ViewProjectionMatrix
ViewMatrix
}
Defines {
USE_TEXTURE : Texture
PRE_SHADOW
COLOR_MAP : Texture
}
ForcedRenderState {
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

@ -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);

@ -40,7 +40,7 @@ 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 ;
@ -53,13 +53,9 @@ vec3 approximateNormal(in vec4 worldPos,in vec2 texCoord){
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
#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;

@ -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
}

@ -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++){

@ -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

@ -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;

@ -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));

@ -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));

@ -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

@ -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;
}

@ -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) {

@ -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);
}

@ -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 {

@ -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 {

@ -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",

@ -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());

@ -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);
}
}

@ -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);

@ -90,8 +90,10 @@ public class CylinderCollisionShape extends CollisionShape {
*/
@Override
public void setScale(Vector3f scale) {
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);

@ -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) {
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);
final PointerIcon joglCursor = component.getScreen().getDisplay().createPointerIcon(rec, cursor.getXHotSpot(), cursor.getHeight() - cursor.getYHotSpot());
component.setPointerIcon(joglCursor);
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);
}
}

@ -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){
@ -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,6 +170,8 @@ public class LwjglMouseInput implements MouseInput {
try {
Cursor newCursor = null;
if (jmeCursor != null) {
newCursor = cursorMap.get(jmeCursor);
if (newCursor == null) {
newCursor = new Cursor(
jmeCursor.getWidth(),
jmeCursor.getHeight(),
@ -163,6 +180,10 @@ public class LwjglMouseInput implements MouseInput {
jmeCursor.getNumImages(),
jmeCursor.getImagesData(),
jmeCursor.getImagesDelay());
// Add to cache
cursorMap.put(jmeCursor, newCursor);
}
}
Mouse.setNativeCursor(newCursor);
} catch (LWJGLException ex) {

@ -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

@ -2,22 +2,36 @@ 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 {
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"
@ -25,5 +39,3 @@ uploadArchives {
}
}
}
}
}

@ -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);
#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 );

@ -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);
#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 );

@ -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 {

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

Binary file not shown.

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

@ -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}-"

Loading…
Cancel
Save