Compare commits
84 Commits
master
...
cleanup_bu
Author | SHA1 | Date | |
---|---|---|---|
|
36e99bf032 | ||
|
c37f0e59d2 | ||
|
06757f73b4 | ||
|
35b9eed76f | ||
|
e4ed3313d5 | ||
|
8ce2f9cfe7 | ||
|
b99d03bd3c | ||
|
f800d74e87 | ||
|
78ac8df78a | ||
|
39dc140f79 | ||
|
f38becf2c6 | ||
|
72b9f186ed | ||
|
8c4b44941e | ||
|
a71fb286f4 | ||
|
69d8e5d13e | ||
|
4919620e61 | ||
|
1315af8d52 | ||
|
efd47c4347 | ||
|
142b006ad6 | ||
|
9500227ca7 | ||
|
5495b7d064 | ||
|
da5e4a18c7 | ||
|
dd8271e8b3 | ||
|
cfd491e270 | ||
|
95bf9efe9b | ||
|
7e458e496c | ||
|
09e9c1efa0 | ||
|
2440fc5a74 | ||
|
bbad454e43 | ||
|
7eb9463496 | ||
|
769cf36221 | ||
|
7b0a00b364 | ||
|
b42bf7f67e | ||
|
056dbdf981 | ||
|
a7edef3a06 | ||
|
52c0a35525 | ||
|
c92009a40a | ||
|
e4a8b8d91c | ||
|
f65f0a7ee8 | ||
|
4ba4da2e31 | ||
|
05c39990ca | ||
|
fae07c9c71 | ||
|
eefc17428c | ||
|
75c3d61f8f | ||
|
d0175a77b6 | ||
|
9b8c27a0fb | ||
|
02c5d9d414 | ||
|
d8529573e4 | ||
|
9b0422fc3c | ||
|
93c2fd1989 | ||
|
be66436745 | ||
|
2c3d94a166 | ||
|
a2efd1323f | ||
|
758fdcf394 | ||
|
f354343e47 | ||
|
f46680815d | ||
|
3d1a541903 | ||
|
6bdf479a0a | ||
|
29dfff223c | ||
|
4faf6cf36c | ||
|
d27b26805a | ||
|
b2a57e130a | ||
|
fafccdf15e | ||
|
513fc08fb6 | ||
|
3419256941 | ||
|
2a0a9e7b6e | ||
|
a7b20629e7 | ||
|
8416dd8c65 | ||
|
7d4a34f96f | ||
|
804c173757 | ||
|
6dfd59ea73 | ||
|
8f7abca01b | ||
|
2c94a3f538 | ||
|
652358038d | ||
|
2fd9da3d50 | ||
|
310f4db6ad | ||
|
d044ad13e1 | ||
|
185eb7b6e5 | ||
|
0f5514192a | ||
|
f692f82e96 | ||
|
656a86ba0e | ||
|
8d132d35f0 | ||
|
0f1f1e6bc7 | ||
|
d2c608c788 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,6 +14,7 @@
|
||||
*.jnilib
|
||||
*.dylib
|
||||
*.iml
|
||||
.gradletasknamecache
|
||||
.DS_Store
|
||||
/jme3-core/src/main/resources/com/jme3/system/version.properties
|
||||
/jme3-*/build/
|
||||
|
52
.travis.yml
52
.travis.yml
@ -1,16 +1,37 @@
|
||||
language: java
|
||||
sudo: false
|
||||
env:
|
||||
- GRADLE_USER_HOME=gradle-cache
|
||||
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- v3.1
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- jdk: oraclejdk8
|
||||
os: linux
|
||||
env: UPLOAD_ALL=true
|
||||
- jdk: openjdk7
|
||||
os: linux
|
||||
- os: osx
|
||||
|
||||
before_install:
|
||||
- git fetch --unshallow
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- gradle-cache
|
||||
- netbeans
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
|
||||
# branches:
|
||||
# only:
|
||||
# - master
|
||||
script:
|
||||
- ./gradlew check
|
||||
|
||||
after_success:
|
||||
- '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ -n "$UPLOAD_ALL" ] && ./gradlew bintrayUpload || :'
|
||||
|
||||
notifications:
|
||||
slack:
|
||||
@ -19,14 +40,8 @@ notifications:
|
||||
rooms:
|
||||
secure: "PWEk4+VL986c3gAjWp12nqyifvxCjBqKoESG9d7zWh1uiTLadTHhZJRMdsye36FCpz/c/Jt7zCRO/5y7FaubQptnRrkrRfjp5f99MJRzQVXnUAM+y385qVkXKRKd/PLpM7XPm4AvjvxHCyvzX2wamRvul/TekaXKB9Ti5FCN87s="
|
||||
|
||||
install:
|
||||
- ./gradlew assemble
|
||||
|
||||
script:
|
||||
- ./gradlew check
|
||||
- ./gradlew createZipDistribution
|
||||
|
||||
before_deploy:
|
||||
- ./gradlew createZipDistribution
|
||||
- export RELEASE_DIST=$(ls build/distributions/*.zip)
|
||||
|
||||
deploy:
|
||||
@ -40,9 +55,6 @@ deploy:
|
||||
repo: jMonkeyEngine/jmonkeyengine
|
||||
tags: true
|
||||
|
||||
before_install:
|
||||
- git fetch --unshallow
|
||||
- "[ $TRAVIS_PULL_REQUEST == 'false' ] && openssl aes-256-cbc -K $encrypted_a1949b55824a_key -iv $encrypted_a1949b55824a_iv -in private/www-updater.key.enc -out private/www-updater.key -d || :"
|
||||
|
||||
# before_install:
|
||||
# required libs for android build tools
|
||||
@ -54,6 +66,4 @@ before_install:
|
||||
# 7z x ndk.bin -y > /dev/null
|
||||
# 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 || :'
|
||||
|
||||
|
@ -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!
|
||||
|
||||
|
56
build.gradle
56
build.gradle
@ -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 {
|
||||
@ -32,31 +29,32 @@ task run(dependsOn: ':jme3-examples:run') {
|
||||
|
||||
defaultTasks 'run'
|
||||
|
||||
task libDist(dependsOn: subprojects.build) << {
|
||||
// description 'Builds and copies the engine binaries, sources and javadoc to build/libDist'
|
||||
File libFolder = mkdir("$buildDir/libDist/lib")
|
||||
File sourceFolder = mkdir("$buildDir/libDist/sources")
|
||||
File javadocFolder = mkdir("$buildDir/libDist/javadoc")
|
||||
subprojects.each {project ->
|
||||
if(project.ext.mainClass == ''){
|
||||
project.tasks.withType(Jar).each {archiveTask ->
|
||||
if(archiveTask.classifier == "sources"){
|
||||
copy {
|
||||
from archiveTask.archivePath
|
||||
into sourceFolder
|
||||
rename {project.name + '-' + archiveTask.classifier +'.'+ archiveTask.extension}
|
||||
}
|
||||
} else if(archiveTask.classifier == "javadoc"){
|
||||
copy {
|
||||
from archiveTask.archivePath
|
||||
into javadocFolder
|
||||
rename {project.name + '-' + archiveTask.classifier +'.'+ archiveTask.extension}
|
||||
}
|
||||
} else{
|
||||
copy {
|
||||
from archiveTask.archivePath
|
||||
into libFolder
|
||||
rename {project.name + '.' + archiveTask.extension}
|
||||
task libDist(dependsOn: subprojects.build, description: 'Builds and copies the engine binaries, sources and javadoc to build/libDist') {
|
||||
doLast {
|
||||
File libFolder = mkdir("$buildDir/libDist/lib")
|
||||
File sourceFolder = mkdir("$buildDir/libDist/sources")
|
||||
File javadocFolder = mkdir("$buildDir/libDist/javadoc")
|
||||
subprojects.each {project ->
|
||||
if(project.ext.mainClass == ''){
|
||||
project.tasks.withType(Jar).each {archiveTask ->
|
||||
if(archiveTask.classifier == "sources"){
|
||||
copy {
|
||||
from archiveTask.archivePath
|
||||
into sourceFolder
|
||||
rename {project.name + '-' + archiveTask.classifier +'.'+ archiveTask.extension}
|
||||
}
|
||||
} else if(archiveTask.classifier == "javadoc"){
|
||||
copy {
|
||||
from archiveTask.archivePath
|
||||
into javadocFolder
|
||||
rename {project.name + '-' + archiveTask.classifier +'.'+ archiveTask.extension}
|
||||
}
|
||||
} else{
|
||||
copy {
|
||||
from archiveTask.archivePath
|
||||
into libFolder
|
||||
rename {project.name + '.' + archiveTask.extension}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,7 +116,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'
|
||||
@ -10,4 +10,4 @@ repositories {
|
||||
maven {
|
||||
url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,16 +18,11 @@ repositories {
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
deployerJars
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Adding dependencies here will add the dependencies to each subproject.
|
||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.0.28-beta'
|
||||
testCompile group: 'org.easytesting', name: 'fest-assert-core', version: '2.0M10'
|
||||
deployerJars "org.apache.maven.wagon:wagon-ssh:2.9"
|
||||
}
|
||||
|
||||
jar {
|
||||
@ -67,11 +62,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 +79,6 @@ def pomConfig = {
|
||||
distribution POM_LICENSE_DISTRIBUTION
|
||||
}
|
||||
}
|
||||
// from http://hub.jmonkeyengine.org/introduction/team/
|
||||
developers {
|
||||
developer {
|
||||
name 'jMonkeyEngine Team'
|
||||
@ -103,6 +97,7 @@ task writeFullPom {
|
||||
}.writeTo(pomFile)
|
||||
}
|
||||
}
|
||||
|
||||
assemble.dependsOn(writeFullPom)
|
||||
install.dependsOn(writeFullPom)
|
||||
uploadArchives.dependsOn(writeFullPom)
|
||||
@ -110,32 +105,9 @@ uploadArchives.dependsOn(writeFullPom)
|
||||
artifacts {
|
||||
archives jar
|
||||
archives sourcesJar
|
||||
if(buildJavaDoc == "true"){
|
||||
if (buildJavaDoc == "true") {
|
||||
archives javadocJar
|
||||
}
|
||||
archives writeFullPom.outputs.files[0]
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories.mavenDeployer {
|
||||
configuration = configurations.deployerJars
|
||||
|
||||
// disable this otherwise it will fill up the server with stale jars
|
||||
uniqueVersion = false
|
||||
|
||||
repository(url: "scp://updates.jmonkeyengine.org/var/www/updates/maven") {
|
||||
authentication(userName: "www-updater", privateKey: "private/www-updater.key")
|
||||
}
|
||||
|
||||
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,13 +19,10 @@ 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
|
||||
|
||||
# Path for downloading NetBeans Base
|
||||
netbeansUrl = http://download.netbeans.org/netbeans/8.0.2/final/zip/netbeans-8.0.2-201411181905-javase.zip
|
||||
|
||||
# POM settings
|
||||
POM_NAME=jMonkeyEngine
|
||||
POM_DESCRIPTION=jMonkeyEngine is a 3D game engine for adventurous Java developers
|
||||
@ -36,6 +33,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=
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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
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
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
|
||||
|
@ -102,56 +102,58 @@ task copyJmeAndroid(type: Copy, dependsOn:copyJmeCpp) {
|
||||
into outputDir
|
||||
}
|
||||
|
||||
task generateNativeHeaders(dependsOn: copyJmeAndroid) << {
|
||||
String destDirPath = jniPath
|
||||
String classes = " \
|
||||
com.jme3.bullet.PhysicsSpace, \
|
||||
\
|
||||
com.jme3.bullet.collision.PhysicsCollisionEvent, \
|
||||
com.jme3.bullet.collision.PhysicsCollisionObject,\
|
||||
com.jme3.bullet.objects.PhysicsCharacter, \
|
||||
com.jme3.bullet.objects.PhysicsGhostObject, \
|
||||
com.jme3.bullet.objects.PhysicsRigidBody, \
|
||||
com.jme3.bullet.objects.PhysicsVehicle, \
|
||||
com.jme3.bullet.objects.VehicleWheel, \
|
||||
com.jme3.bullet.objects.infos.RigidBodyMotionState, \
|
||||
\
|
||||
com.jme3.bullet.collision.shapes.CollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.BoxCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.CapsuleCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.CompoundCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.ConeCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.CylinderCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.GImpactCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.HeightfieldCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.HullCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.MeshCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.PlaneCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.SimplexCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.SphereCollisionShape, \
|
||||
\
|
||||
com.jme3.bullet.joints.PhysicsJoint, \
|
||||
com.jme3.bullet.joints.ConeJoint, \
|
||||
com.jme3.bullet.joints.HingeJoint, \
|
||||
com.jme3.bullet.joints.Point2PointJoint, \
|
||||
com.jme3.bullet.joints.SixDofJoint, \
|
||||
com.jme3.bullet.joints.SixDofSpringJoint, \
|
||||
com.jme3.bullet.joints.SliderJoint, \
|
||||
com.jme3.bullet.joints.motors.RotationalLimitMotor, \
|
||||
com.jme3.bullet.joints.motors.TranslationalLimitMotor, \
|
||||
\
|
||||
com.jme3.bullet.util.NativeMeshUtil, \
|
||||
com.jme3.bullet.util.DebugShapeFactory"
|
||||
task generateNativeHeaders(dependsOn: copyJmeAndroid) {
|
||||
doLast {
|
||||
String destDirPath = jniPath
|
||||
String classes = " \
|
||||
com.jme3.bullet.PhysicsSpace, \
|
||||
\
|
||||
com.jme3.bullet.collision.PhysicsCollisionEvent, \
|
||||
com.jme3.bullet.collision.PhysicsCollisionObject,\
|
||||
com.jme3.bullet.objects.PhysicsCharacter, \
|
||||
com.jme3.bullet.objects.PhysicsGhostObject, \
|
||||
com.jme3.bullet.objects.PhysicsRigidBody, \
|
||||
com.jme3.bullet.objects.PhysicsVehicle, \
|
||||
com.jme3.bullet.objects.VehicleWheel, \
|
||||
com.jme3.bullet.objects.infos.RigidBodyMotionState, \
|
||||
\
|
||||
com.jme3.bullet.collision.shapes.CollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.BoxCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.CapsuleCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.CompoundCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.ConeCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.CylinderCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.GImpactCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.HeightfieldCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.HullCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.MeshCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.PlaneCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.SimplexCollisionShape, \
|
||||
com.jme3.bullet.collision.shapes.SphereCollisionShape, \
|
||||
\
|
||||
com.jme3.bullet.joints.PhysicsJoint, \
|
||||
com.jme3.bullet.joints.ConeJoint, \
|
||||
com.jme3.bullet.joints.HingeJoint, \
|
||||
com.jme3.bullet.joints.Point2PointJoint, \
|
||||
com.jme3.bullet.joints.SixDofJoint, \
|
||||
com.jme3.bullet.joints.SixDofSpringJoint, \
|
||||
com.jme3.bullet.joints.SliderJoint, \
|
||||
com.jme3.bullet.joints.motors.RotationalLimitMotor, \
|
||||
com.jme3.bullet.joints.motors.TranslationalLimitMotor, \
|
||||
\
|
||||
com.jme3.bullet.util.NativeMeshUtil, \
|
||||
com.jme3.bullet.util.DebugShapeFactory"
|
||||
|
||||
String projectClassPath = configurations.runtime.asFileTree.matching {
|
||||
exclude ".gradle"
|
||||
}.asPath
|
||||
String projectClassPath = configurations.runtime.asFileTree.matching {
|
||||
exclude ".gradle"
|
||||
}.asPath
|
||||
|
||||
exec {
|
||||
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
|
||||
args '-d', destDirPath
|
||||
args '-classpath', projectClassPath
|
||||
args classes.split(",").collect { it.trim() }
|
||||
exec {
|
||||
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
|
||||
args '-d', destDirPath
|
||||
args '-classpath', projectClassPath
|
||||
args classes.split(",").collect { it.trim() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
apply plugin: 'cpp'
|
||||
|
||||
import java.nio.file.Paths
|
||||
|
||||
String bulletSrcPath = bulletFolder + '/src'
|
||||
|
||||
if (!hasProperty('mainClass')) {
|
||||
@ -10,37 +12,90 @@ dependencies {
|
||||
compile project(':jme3-bullet')
|
||||
}
|
||||
|
||||
// Defines created C++ libraries
|
||||
libraries {
|
||||
bulletjme {
|
||||
model {
|
||||
components {
|
||||
bulletjme(NativeLibrarySpec) {
|
||||
targetPlatform 'Windows64'
|
||||
targetPlatform 'Windows32'
|
||||
targetPlatform 'Mac64'
|
||||
targetPlatform 'Mac32'
|
||||
targetPlatform 'Linux64'
|
||||
targetPlatform 'Linux32'
|
||||
|
||||
sources {
|
||||
cpp {
|
||||
source {
|
||||
srcDir 'src/native/cpp'
|
||||
srcDir bulletSrcPath
|
||||
exclude 'BulletMultiThreaded/GpuSoftBodySolvers/**'
|
||||
include '**/*.cpp'
|
||||
}
|
||||
exportedHeaders {
|
||||
srcDir 'src/native/cpp'
|
||||
srcDir bulletSrcPath
|
||||
include '**/*.h'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
all {
|
||||
binaries.all {
|
||||
if (toolChain in VisualCpp) {
|
||||
cppCompiler.args "/I${org.gradle.internal.jvm.Jvm.current().javaHome}\\include"
|
||||
} else{
|
||||
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
|
||||
|
||||
binaries {
|
||||
withType(SharedLibraryBinarySpec) {
|
||||
def projectPath = project.projectDir.absolutePath
|
||||
def javaHome = org.gradle.internal.jvm.Jvm.current().javaHome
|
||||
def os = targetPlatform.operatingSystem.name
|
||||
def arch = targetPlatform.architecture.name
|
||||
def fileName = sharedLibraryFile.name
|
||||
|
||||
// Gradle decided to change underscores to dashes - fix that.
|
||||
arch = arch.replaceAll('-', '_')
|
||||
|
||||
// For all binaries that can't be built on the current system
|
||||
if (buildNativeProjects != "true") {
|
||||
buildable = false
|
||||
}
|
||||
|
||||
if (targetPlatform.operatingSystem.name == "osx") {
|
||||
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/darwin"
|
||||
} else if (targetPlatform.operatingSystem.name == "linux") {
|
||||
if (!buildable) {
|
||||
if (sharedLibraryFile.exists()) {
|
||||
// Add binary to jar file if the binary exists in the build folder already,
|
||||
// e.g. when the build of jme3-bullet-native has been run on a virtual box
|
||||
// and the project hasn't been cleaned yet.
|
||||
jar.into("native/${os}/${arch}") {
|
||||
from sharedLibraryFile
|
||||
}
|
||||
} else {
|
||||
// Get from libs folder if no fresh build is available in the build folder and add to jar file
|
||||
def precompiledFile = Paths.get(projectPath, 'libs', 'native', os, arch, fileName).toFile()
|
||||
if (precompiledFile.exists()) {
|
||||
jar.into("native/${os}/${arch}") {
|
||||
from precompiledFile
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (toolChain in VisualCpp) {
|
||||
cppCompiler.args "/I$javaHome\\include"
|
||||
} else{
|
||||
cppCompiler.args '-I', "$javaHome/include"
|
||||
}
|
||||
|
||||
if (os == "osx") {
|
||||
cppCompiler.args '-I', "$javaHome/include/darwin"
|
||||
} else if (os == "linux") {
|
||||
cppCompiler.args "-fvisibility=hidden"
|
||||
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/linux"
|
||||
cppCompiler.args '-I', "$javaHome/include/linux"
|
||||
cppCompiler.args "-fPIC"
|
||||
cppCompiler.args "-fpermissive"
|
||||
linker.args "-fvisibility=hidden"
|
||||
|
||||
// cppCompiler.args "-static-libgcc"
|
||||
// cppCompiler.args "-static-libstdc++"
|
||||
// linker.args "-static-libgcc"
|
||||
// linker.args "-static-libstdc++"
|
||||
} else if (targetPlatform.operatingSystem.name == "windows") {
|
||||
} else if (os == "windows") {
|
||||
if (toolChain in Gcc) {
|
||||
if (toolChain.name.startsWith('mingw')) {
|
||||
cppCompiler.args '-I', "${projectDir}/src/native/cpp/fake_win32"
|
||||
cppCompiler.args '-I', "$projectDir/src/native/cpp/fake_win32"
|
||||
} else {
|
||||
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"
|
||||
cppCompiler.args '-I', "$javaHome/include/win32"
|
||||
}
|
||||
cppCompiler.args "-fpermissive"
|
||||
cppCompiler.args "-static"
|
||||
@ -48,48 +103,63 @@ libraries {
|
||||
linker.args "-Wl,--exclude-all-symbols"
|
||||
}
|
||||
else if (toolChain in VisualCpp) {
|
||||
cppCompiler.args "/I${org.gradle.internal.jvm.Jvm.current().javaHome}\\include\\win32"
|
||||
cppCompiler.args "/I$javaHome\\include\\win32"
|
||||
}
|
||||
cppCompiler.define('WIN32')
|
||||
// linker.args 'Shlwapi.lib', 'Advapi32.lib'
|
||||
}
|
||||
|
||||
tasks.all { dependsOn unzipBulletIfNeeded }
|
||||
|
||||
// Add output to jar file
|
||||
jar.into("native/${os}/${arch}") {
|
||||
from sharedLibraryFile
|
||||
}
|
||||
|
||||
// Add depend on build
|
||||
jar.dependsOn tasks
|
||||
// Add output to libs folder
|
||||
task "copyBinaryToLibs${targetPlatform.name}"(type: Copy, dependsOn: tasks) {
|
||||
from sharedLibraryFile
|
||||
into "libs/native/${os}/${arch}"
|
||||
}
|
||||
// Add depend on copy
|
||||
jar.dependsOn("copyBinaryToLibs${targetPlatform.name}")
|
||||
}
|
||||
withType(StaticLibraryBinarySpec) {
|
||||
buildable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// C++ sources for binary compilation
|
||||
sources {
|
||||
bulletjme {
|
||||
cpp {
|
||||
source {
|
||||
srcDir 'src/native/cpp'
|
||||
srcDir bulletSrcPath
|
||||
exclude 'BulletMultiThreaded/GpuSoftBodySolvers/**'
|
||||
include '**/*.cpp'
|
||||
}
|
||||
exportedHeaders {
|
||||
srcDir 'src/native/cpp'
|
||||
srcDir bulletSrcPath
|
||||
include '**/*.h'
|
||||
}
|
||||
platforms {
|
||||
Windows32 {
|
||||
architecture "x86"
|
||||
operatingSystem "windows"
|
||||
}
|
||||
Windows64 {
|
||||
architecture "x86_64"
|
||||
operatingSystem "windows"
|
||||
}
|
||||
Mac32 {
|
||||
architecture "x86"
|
||||
operatingSystem "osx"
|
||||
}
|
||||
Mac64 {
|
||||
architecture "x86_64"
|
||||
operatingSystem "osx"
|
||||
}
|
||||
Linux32 {
|
||||
architecture "x86"
|
||||
operatingSystem "linux"
|
||||
}
|
||||
Linux64 {
|
||||
architecture "x86_64"
|
||||
operatingSystem "linux"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Java source sets for IDE acces and source jar bundling / mavenization
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/native/cpp'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set of target platforms, will be available based on build system
|
||||
model {
|
||||
|
||||
toolChains {
|
||||
gcc(Gcc)
|
||||
clang(Clang)
|
||||
mingw_x86(Gcc) {
|
||||
eachPlatform() {
|
||||
cCompiler.executable "i686-w64-mingw32-gcc"
|
||||
@ -98,7 +168,7 @@ model {
|
||||
assembler.executable "i686-w64-mingw32-g++"
|
||||
staticLibArchiver.executable "i686-w64-mingw32-gcc-ar"
|
||||
}
|
||||
target("windows_x86")
|
||||
target("Windows32")
|
||||
}
|
||||
mingw_x86_64(Gcc) {
|
||||
eachPlatform() {
|
||||
@ -108,115 +178,43 @@ model {
|
||||
assembler.executable "x86_64-w64-mingw32-g++"
|
||||
staticLibArchiver.executable "x86_64-w64-mingw32-gcc-ar"
|
||||
}
|
||||
target("windows_x86_64")
|
||||
}
|
||||
}
|
||||
|
||||
platforms{
|
||||
// osx_universal { // TODO: universal binary doesn't work?
|
||||
// architecture 'x86_64'
|
||||
// architecture 'x86'
|
||||
// operatingSystem 'osx'
|
||||
// }
|
||||
osx_x86 {
|
||||
architecture "x86"
|
||||
operatingSystem "osx"
|
||||
}
|
||||
osx_x86_64 {
|
||||
architecture "x86_64"
|
||||
operatingSystem "osx"
|
||||
}
|
||||
linux_x86 {
|
||||
architecture "x86"
|
||||
operatingSystem "linux"
|
||||
}
|
||||
linux_x86_64 {
|
||||
architecture "x86_64"
|
||||
operatingSystem "linux"
|
||||
}
|
||||
windows_x86 {
|
||||
architecture "x86"
|
||||
operatingSystem "windows"
|
||||
}
|
||||
windows_x86_64 {
|
||||
architecture "x86_64"
|
||||
operatingSystem "windows"
|
||||
target("Windows64")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Java source sets for IDE access and source jar bundling / mavenization
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/native/cpp'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Download bullet if not available
|
||||
task downloadBullet(type: MyDownload) {
|
||||
sourceUrl = bulletUrl
|
||||
target = file(bulletZipFile)
|
||||
}
|
||||
|
||||
// Unzip bullet if not available
|
||||
task unzipBullet(type: Copy) {
|
||||
def zipFile = file(bulletZipFile)
|
||||
def outputDir = file(".")
|
||||
|
||||
from zipTree(zipFile)
|
||||
into outputDir
|
||||
from zipTree(bulletZipFile)
|
||||
into file('.')
|
||||
}
|
||||
|
||||
unzipBullet.dependsOn {
|
||||
def zipFilePath = project.projectDir.absolutePath + File.separator + bulletZipFile
|
||||
def zipFile = new File(zipFilePath)
|
||||
if (!zipFile.exists()) {
|
||||
if (!file(bulletZipFile).exists()) {
|
||||
downloadBullet
|
||||
}
|
||||
}
|
||||
|
||||
compileJava.dependsOn {
|
||||
if(buildNativeProjects=="true"){
|
||||
def bulletUnzipDir = new File(project.projectDir.absolutePath + File.separator + bulletFolder)
|
||||
if (!bulletUnzipDir.isDirectory()) {
|
||||
unzipBullet
|
||||
}
|
||||
}
|
||||
task unzipBulletIfNeeded {
|
||||
}
|
||||
|
||||
binaries.withType(StaticLibraryBinarySpec) {
|
||||
buildable = false
|
||||
}
|
||||
|
||||
// Adds all available binaries to java jar task
|
||||
binaries.withType(SharedLibraryBinary) { binary ->
|
||||
// For all binaries that can't be built on the current system
|
||||
if(buildNativeProjects!="true"){
|
||||
buildable = false;
|
||||
unzipBulletIfNeeded.dependsOn {
|
||||
if (buildNativeProjects == "true" && !file(bulletFolder).isDirectory()) {
|
||||
unzipBullet
|
||||
}
|
||||
if (!buildable) {
|
||||
//Get from libs folder if no fresh build is available in the build folder and add to jar file
|
||||
if(!binary.tasks.outputFile.get(0).exists()){
|
||||
def fileName = binary.tasks.outputFile.get(0).getName();
|
||||
def precompiledFile = new File(project.projectDir.absolutePath + File.separator + "libs" + File.separator + "native" + File.separator + "${targetPlatform.operatingSystem.name}" + File.separator + "${targetPlatform.architecture.name}" + File.separator + "${fileName}")
|
||||
if(precompiledFile.exists()){
|
||||
jar.into("native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}") { from precompiledFile }
|
||||
}
|
||||
return
|
||||
} else{
|
||||
// Add binary to jar file if the binary exists in the build folder already,
|
||||
// e.g. when the build of jme3-bullet-native has been run on a virtual box
|
||||
// and the project hasn't been cleaned yet.
|
||||
jar.into("native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}") { from binary.tasks.outputFile }
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// For all binaries that can be built on the current system
|
||||
def builderTask = binary.tasks
|
||||
// Add output to jar file
|
||||
jar.into("native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}") { from builderTask.outputFile }
|
||||
// Add depend on build
|
||||
jar.dependsOn builderTask
|
||||
// Add output to libs folder
|
||||
task "copyBinaryToLibs${targetPlatform}"(type: Copy, dependsOn: builderTask) {
|
||||
from builderTask.outputFile
|
||||
into "libs/native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}"
|
||||
}
|
||||
// Add depend on copy
|
||||
jar.dependsOn("copyBinaryToLibs${targetPlatform}")
|
||||
}
|
||||
|
||||
// Helper class to wrap ant dowload task
|
||||
@ -229,7 +227,6 @@ class MyDownload extends DefaultTask {
|
||||
|
||||
@TaskAction
|
||||
void download() {
|
||||
ant.get(src: sourceUrl, dest: target)
|
||||
ant.get(src: sourceUrl, dest: target)
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
jme3-bullet-native/libs/native/osx/x86/libbulletjme.dylib
Normal file → Executable file
BIN
jme3-bullet-native/libs/native/osx/x86/libbulletjme.dylib
Normal file → Executable file
Binary file not shown.
BIN
jme3-bullet-native/libs/native/osx/x86_64/libbulletjme.dylib
Normal file → Executable file
BIN
jme3-bullet-native/libs/native/osx/x86_64/libbulletjme.dylib
Normal file → Executable file
Binary file not shown.
@ -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
|
||||
|
@ -17,23 +17,30 @@ sourceSets {
|
||||
}
|
||||
}
|
||||
|
||||
task updateVersionPropertiesFile << {
|
||||
def verfile = file('src/main/resources/com/jme3/system/version.properties')
|
||||
verfile.text = "# THIS IS AN AUTO-GENERATED FILE..\n" +
|
||||
"# DO NOT MODIFY!\n" +
|
||||
"build.date=${jmeBuildDate}\n" +
|
||||
"git.revision=${jmeRevision}\n" +
|
||||
"git.branch=${jmeBranchName}\n" +
|
||||
"git.hash=${jmeGitHash}\n" +
|
||||
"git.hash.short=${jmeShortGitHash}\n" +
|
||||
"git.tag=${jmeGitTag}\n" +
|
||||
"name.full=jMonkeyEngine ${jmeFullVersion}\n" +
|
||||
"version.full=${jmeFullVersion}\n" +
|
||||
"version.number=${jmeVersion}\n" +
|
||||
"version.tag=${jmeVersionTag}"
|
||||
task updateVersionPropertiesFile {
|
||||
def versionFile = file('src/main/resources/com/jme3/system/version.properties')
|
||||
def versionFileText = "# THIS IS AN AUTO-GENERATED FILE..\n" +
|
||||
"# DO NOT MODIFY!\n" +
|
||||
"build.date=${jmeBuildDate}\n" +
|
||||
"git.revision=${jmeRevision}\n" +
|
||||
"git.branch=${jmeBranchName}\n" +
|
||||
"git.hash=${jmeGitHash}\n" +
|
||||
"git.hash.short=${jmeShortGitHash}\n" +
|
||||
"git.tag=${jmeGitTag}\n" +
|
||||
"name.full=jMonkeyEngine ${jmeFullVersion}\n" +
|
||||
"version.full=${jmeFullVersion}\n" +
|
||||
"version.number=${jmeVersion}\n" +
|
||||
"version.tag=${jmeVersionTag}"
|
||||
|
||||
outputs.upToDateWhen {
|
||||
versionFile.exists() && versionFile.text == versionFileText
|
||||
}
|
||||
doLast {
|
||||
versionFile.text = versionFileText
|
||||
}
|
||||
}
|
||||
|
||||
compileJava.dependsOn(updateVersionPropertiesFile)
|
||||
processResources.dependsOn updateVersionPropertiesFile
|
||||
|
||||
dependencies {
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,16 +1672,15 @@ public final class GLRenderer implements Renderer {
|
||||
+ " by the video hardware!");
|
||||
}
|
||||
|
||||
if (context.boundDrawBuf != MRT_OFF + fb.getNumColorBuffers()) {
|
||||
intBuf16.clear();
|
||||
for (int i = 0; i < fb.getNumColorBuffers(); i++) {
|
||||
intBuf16.put(GLFbo.GL_COLOR_ATTACHMENT0_EXT + i);
|
||||
}
|
||||
|
||||
intBuf16.flip();
|
||||
glext.glDrawBuffers(intBuf16);
|
||||
context.boundDrawBuf = MRT_OFF + fb.getNumColorBuffers();
|
||||
intBuf16.clear();
|
||||
for (int i = 0; i < fb.getNumColorBuffers(); i++) {
|
||||
intBuf16.put(GLFbo.GL_COLOR_ATTACHMENT0_EXT + i);
|
||||
}
|
||||
|
||||
intBuf16.flip();
|
||||
glext.glDrawBuffers(intBuf16);
|
||||
context.boundDrawBuf = MRT_OFF + fb.getNumColorBuffers();
|
||||
|
||||
} else {
|
||||
RenderBuffer rb = fb.getColorBuffer(fb.getTargetIndex());
|
||||
// select this draw buffer
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ import com.jme3.material.Technique;
|
||||
import com.jme3.material.TechniqueDef;
|
||||
import com.jme3.shader.Shader.ShaderType;
|
||||
import java.util.List;
|
||||
import java.util.regex.*;
|
||||
|
||||
/**
|
||||
* This class is the base for a shader generator using the ShaderNodes system,
|
||||
@ -59,7 +60,11 @@ public abstract class ShaderGenerator {
|
||||
/**
|
||||
* the technique def to use for the shader generation
|
||||
*/
|
||||
protected TechniqueDef techniqueDef = null;
|
||||
protected TechniqueDef techniqueDef = null;
|
||||
/**
|
||||
* Extension pattern
|
||||
*/
|
||||
Pattern extensions = Pattern.compile("(#extension.*\\s+)");
|
||||
|
||||
/**
|
||||
* Build a shaderGenerator
|
||||
@ -142,7 +147,23 @@ public abstract class ShaderGenerator {
|
||||
|
||||
sourceDeclaration.append(source);
|
||||
|
||||
return sourceDeclaration.toString();
|
||||
return moveExtensionsUp(sourceDeclaration);
|
||||
}
|
||||
|
||||
/**
|
||||
* parses the source and moves all the extensions at the top of the shader source as having extension declarations
|
||||
* in the middle of a shader is against the specs and not supported by all drivers.
|
||||
* @param sourceDeclaration
|
||||
* @return
|
||||
*/
|
||||
private String moveExtensionsUp(StringBuilder sourceDeclaration) {
|
||||
Matcher m = extensions.matcher( sourceDeclaration.toString());
|
||||
StringBuilder finalSource = new StringBuilder();
|
||||
while(m.find()){
|
||||
finalSource.append(m.group());
|
||||
}
|
||||
finalSource.append(m.replaceAll(""));
|
||||
return finalSource.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -698,9 +698,11 @@ public class ListSort<T> {
|
||||
System.arraycopy(arr, iterB, arr, dest, lengthB);
|
||||
// The last element of run A belongs at the end of the merge.
|
||||
arr[dest + lengthB] = tempArray[iterA];
|
||||
} else if(lengthA== 0){
|
||||
} else if(lengthA == 0){
|
||||
throw new UnsupportedOperationException("Compare function result changed! " +
|
||||
"Make sure you do not modify the scene from another thread!");
|
||||
"Make sure you do not modify the scene from"
|
||||
+ " another thread and that the comparisons are not based"
|
||||
+ " on NaN values.");
|
||||
} else {//Fail label
|
||||
System.arraycopy(tempArray, iterA, arr, dest, lengthA);
|
||||
}
|
||||
|
@ -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) {
|
||||
|
29
jme3-core/src/main/java/com/jme3/util/TangentUtils.java
Normal file
29
jme3-core/src/main/java/com/jme3/util/TangentUtils.java
Normal file
@ -0,0 +1,29 @@
|
||||
package com.jme3.util;
|
||||
|
||||
import com.jme3.scene.*;
|
||||
|
||||
/**
|
||||
* Created by Nehon on 03/10/2016.
|
||||
*/
|
||||
public class TangentUtils {
|
||||
|
||||
public static void generateBindPoseTangentsIfNecessary(Mesh mesh){
|
||||
if (mesh.getBuffer(VertexBuffer.Type.BindPosePosition) != null) {
|
||||
|
||||
VertexBuffer tangents = mesh.getBuffer(VertexBuffer.Type.Tangent);
|
||||
if (tangents != null) {
|
||||
VertexBuffer bindTangents = new VertexBuffer(VertexBuffer.Type.BindPoseTangent);
|
||||
bindTangents.setupData(VertexBuffer.Usage.CpuOnly,
|
||||
4,
|
||||
VertexBuffer.Format.Float,
|
||||
BufferUtils.clone(tangents.getData()));
|
||||
|
||||
if (mesh.getBuffer(VertexBuffer.Type.BindPoseTangent) != null) {
|
||||
mesh.clearBuffer(VertexBuffer.Type.BindPoseTangent);
|
||||
}
|
||||
mesh.setBuffer(bindTangents);
|
||||
tangents.setUsage(VertexBuffer.Usage.Stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,26 +40,22 @@ vec3 getPosition(in float depth, in vec2 uv){
|
||||
pos = m_ViewProjectionMatrixInverse * pos;
|
||||
return pos.xyz / pos.w;
|
||||
}
|
||||
#ifndef BACKFACE_SHADOWS
|
||||
vec3 approximateNormal(in vec4 worldPos,in vec2 texCoord){
|
||||
float step = g_ResolutionInverse.x ;
|
||||
float stepy = g_ResolutionInverse.y ;
|
||||
float depth2 = texture2D(m_DepthTexture,texCoord + vec2(step,-stepy)).r;
|
||||
float depth3 = texture2D(m_DepthTexture,texCoord + vec2(-step,-stepy)).r;
|
||||
vec4 worldPos2 = vec4(getPosition(depth2,texCoord + vec2(step,-stepy)),1.0);
|
||||
vec4 worldPos3 = vec4(getPosition(depth3,texCoord + vec2(-step,-stepy)),1.0);
|
||||
|
||||
vec3 approximateNormal(in vec4 worldPos,in vec2 texCoord){
|
||||
float step = g_ResolutionInverse.x ;
|
||||
float stepy = g_ResolutionInverse.y ;
|
||||
float depth2 = texture2D(m_DepthTexture,texCoord + vec2(step,-stepy)).r;
|
||||
float depth3 = texture2D(m_DepthTexture,texCoord + vec2(-step,-stepy)).r;
|
||||
vec4 worldPos2 = vec4(getPosition(depth2,texCoord + vec2(step,-stepy)),1.0);
|
||||
vec4 worldPos3 = vec4(getPosition(depth3,texCoord + vec2(-step,-stepy)),1.0);
|
||||
vec3 v1 = (worldPos - worldPos2).xyz;
|
||||
vec3 v2 = (worldPos3 - worldPos2).xyz;
|
||||
return normalize(cross(v1, v2));
|
||||
}
|
||||
#endif
|
||||
|
||||
vec3 v1 = (worldPos - worldPos2).xyz;
|
||||
vec3 v2 = (worldPos3 - worldPos2).xyz;
|
||||
return normalize(cross(v1, v2));
|
||||
}
|
||||
|
||||
void main(){
|
||||
#if !defined( RENDER_SHADOWS )
|
||||
gl_FragColor = texture2D(m_Texture,texCoord);
|
||||
return;
|
||||
#endif
|
||||
|
||||
void main(){
|
||||
float depth = texture2D(m_DepthTexture,texCoord).r;
|
||||
vec4 color = texture2D(m_Texture,texCoord);
|
||||
|
||||
@ -72,7 +68,6 @@ void main(){
|
||||
|
||||
// get the vertex in world space
|
||||
vec4 worldPos = vec4(getPosition(depth,texCoord),1.0);
|
||||
vec3 normal = approximateNormal(worldPos, texCoord);
|
||||
|
||||
vec3 lightDir;
|
||||
#ifdef PSSM
|
||||
@ -80,14 +75,17 @@ void main(){
|
||||
#else
|
||||
lightDir = worldPos.xyz - m_LightPos;
|
||||
#endif
|
||||
float ndotl = dot(normal, lightDir);
|
||||
if(ndotl > -0.0){
|
||||
gl_FragColor = color;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef BACKFACE_SHADOWS
|
||||
vec3 normal = approximateNormal(worldPos, texCoord);
|
||||
float ndotl = dot(normal, lightDir);
|
||||
if(ndotl > -0.0){
|
||||
gl_FragColor = color;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (!defined(POINTLIGHT) && !defined(PSSM))
|
||||
vec3 lightDir = worldPos.xyz - m_LightPos;
|
||||
if( dot(m_LightDir,lightDir) < 0.0){
|
||||
gl_FragColor = color;
|
||||
return;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -62,69 +62,71 @@ jar.doFirst{
|
||||
|
||||
task dist (dependsOn: ['build', ':jme3-jogl:jar', ':jme3-bullet:jar', ':jme3-android:jar', \
|
||||
':jme3-android-native:jar', ':jme3-bullet-native-android:jar', \
|
||||
':jme3-bullet-native:jar']) << {
|
||||
// Copy all dependencies to ../dist/lib, remove versions from jar files
|
||||
configurations.compile.resolvedConfiguration.resolvedArtifacts.each { artifact ->
|
||||
':jme3-bullet-native:jar']) {
|
||||
doLast {
|
||||
// Copy all dependencies to ../dist/lib, remove versions from jar files
|
||||
configurations.compile.resolvedConfiguration.resolvedArtifacts.each { artifact ->
|
||||
copy {
|
||||
from artifact.file
|
||||
into '../dist/lib'
|
||||
if(artifact.classifier != null){
|
||||
rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" }
|
||||
} else{
|
||||
rename { "${artifact.name}.${artifact.extension}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
copy {
|
||||
from artifact.file
|
||||
into '../dist/lib'
|
||||
if(artifact.classifier != null){
|
||||
rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" }
|
||||
} else{
|
||||
rename { "${artifact.name}.${artifact.extension}" }
|
||||
from jar.archivePath
|
||||
into '../dist'
|
||||
rename { "jMonkeyEngine3.jar" }
|
||||
}
|
||||
// Copy JOGL packages, remove version
|
||||
def config = project(':jme3-jogl').configurations.runtime.copyRecursive({ !(it instanceof ProjectDependency); })
|
||||
config.resolvedConfiguration.resolvedArtifacts.each {artifact ->
|
||||
copy{
|
||||
from artifact.file
|
||||
into '../dist/opt/jogl/lib'
|
||||
if(artifact.classifier != null){
|
||||
rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" }
|
||||
} else{
|
||||
rename { "${artifact.name}.${artifact.extension}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
copy {
|
||||
from jar.archivePath
|
||||
into '../dist'
|
||||
rename { "jMonkeyEngine3.jar" }
|
||||
}
|
||||
// Copy JOGL packages, remove version
|
||||
def config = project(':jme3-jogl').configurations.runtime.copyRecursive({ !(it instanceof ProjectDependency); })
|
||||
config.resolvedConfiguration.resolvedArtifacts.each {artifact ->
|
||||
copy{
|
||||
from artifact.file
|
||||
into '../dist/opt/jogl/lib'
|
||||
if(artifact.classifier != null){
|
||||
rename { "${artifact.name}-${artifact.classifier}.${artifact.extension}" }
|
||||
} else{
|
||||
rename { "${artifact.name}.${artifact.extension}" }
|
||||
}
|
||||
copy {
|
||||
from project(':jme3-jogl').jar.archivePath
|
||||
into '../dist/opt/jogl'
|
||||
rename {project(':jme3-jogl').name+".jar"}
|
||||
}
|
||||
}
|
||||
copy {
|
||||
from project(':jme3-jogl').jar.archivePath
|
||||
into '../dist/opt/jogl'
|
||||
rename {project(':jme3-jogl').name+".jar"}
|
||||
}
|
||||
|
||||
// Copy bullet packages, remove version
|
||||
copy {
|
||||
from project(':jme3-bullet').jar.archivePath
|
||||
into '../dist/opt/native-bullet'
|
||||
rename {project(':jme3-bullet').name+".jar"}
|
||||
}
|
||||
copy {
|
||||
from project(':jme3-bullet-native').jar.archivePath
|
||||
into '../dist/opt/native-bullet'
|
||||
rename {project(':jme3-bullet-native').name+".jar"}
|
||||
}
|
||||
// Copy bullet packages, remove version
|
||||
copy {
|
||||
from project(':jme3-bullet').jar.archivePath
|
||||
into '../dist/opt/native-bullet'
|
||||
rename {project(':jme3-bullet').name+".jar"}
|
||||
}
|
||||
copy {
|
||||
from project(':jme3-bullet-native').jar.archivePath
|
||||
into '../dist/opt/native-bullet'
|
||||
rename {project(':jme3-bullet-native').name+".jar"}
|
||||
}
|
||||
|
||||
// Copy android packages, remove version
|
||||
copy {
|
||||
from project(':jme3-android').jar.archivePath
|
||||
into '../dist/opt/android'
|
||||
rename {project(':jme3-android').name+".jar"}
|
||||
}
|
||||
copy {
|
||||
from project(':jme3-android-native').jar.archivePath
|
||||
into '../dist/opt/android'
|
||||
rename {project(':jme3-android-native').name+".jar"}
|
||||
}
|
||||
copy {
|
||||
from project(':jme3-bullet-native-android').jar.archivePath
|
||||
into '../dist/opt/native-bullet'
|
||||
rename {project(':jme3-bullet-native-android').name+".jar"}
|
||||
// Copy android packages, remove version
|
||||
copy {
|
||||
from project(':jme3-android').jar.archivePath
|
||||
into '../dist/opt/android'
|
||||
rename {project(':jme3-android').name+".jar"}
|
||||
}
|
||||
copy {
|
||||
from project(':jme3-android-native').jar.archivePath
|
||||
into '../dist/opt/android'
|
||||
rename {project(':jme3-android-native').name+".jar"}
|
||||
}
|
||||
copy {
|
||||
from project(':jme3-bullet-native-android').jar.archivePath
|
||||
into '../dist/opt/native-bullet'
|
||||
rename {project(':jme3-bullet-native-android').name+".jar"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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",
|
||||
|
@ -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);
|
||||
|
@ -75,17 +75,19 @@ public class NewtMouseInput implements MouseInput, MouseListener {
|
||||
private int wheelPos;
|
||||
private Point location;
|
||||
private Point centerLocation;
|
||||
private Point centerLocationOnScreen;
|
||||
private Point lastKnownLocation;
|
||||
private Point lockPosition;
|
||||
private boolean isRecentering;
|
||||
private boolean cursorMoved;
|
||||
private int eventsSinceRecenter;
|
||||
private volatile int mousePressedX;
|
||||
private volatile int mousePressedY;
|
||||
|
||||
public NewtMouseInput() {
|
||||
location = new Point();
|
||||
centerLocation = new Point();
|
||||
centerLocationOnScreen = new Point();
|
||||
lastKnownLocation = new Point();
|
||||
lockPosition = new Point();
|
||||
}
|
||||
|
||||
public void setInputSource(GLWindow comp) {
|
||||
@ -102,8 +104,8 @@ public class NewtMouseInput implements MouseInput, MouseListener {
|
||||
lastEventWheel = 0;
|
||||
location = new Point();
|
||||
centerLocation = new Point();
|
||||
centerLocationOnScreen = new Point();
|
||||
lastKnownLocation = new Point();
|
||||
lockPosition = new Point();
|
||||
}
|
||||
|
||||
component = comp;
|
||||
@ -151,17 +153,14 @@ public class NewtMouseInput implements MouseInput, MouseListener {
|
||||
|
||||
@Override
|
||||
public void setCursorVisible(boolean visible) {
|
||||
lastKnownLocation.setX(0);
|
||||
lastKnownLocation.setY(0);
|
||||
|
||||
this.visible = visible;
|
||||
component.setPointerVisible(visible);
|
||||
component.confinePointer(!visible);
|
||||
lockPosition.set(lastKnownLocation.getX(), lastKnownLocation.getY());
|
||||
hack_confinePointer();
|
||||
}
|
||||
|
||||
private void hack_confinePointer() {
|
||||
if (component.hasFocus() && component.isPointerConfined() && !component.isPointerVisible()) {
|
||||
if (component.hasFocus() && !component.isPointerVisible()) {
|
||||
recenterMouse(component);
|
||||
}
|
||||
}
|
||||
@ -215,7 +214,9 @@ public class NewtMouseInput implements MouseInput, MouseListener {
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent newtEvt) {
|
||||
MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(newtEvt), true, newtEvt.getX(), component.getSurfaceHeight() - newtEvt.getY());
|
||||
mousePressedX = newtEvt.getX();
|
||||
mousePressedY = component.getSurfaceHeight() - newtEvt.getY();
|
||||
MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(newtEvt), true, mousePressedX, mousePressedY);
|
||||
evt.setTime(newtEvt.getWhen());
|
||||
synchronized (eventQueue) {
|
||||
eventQueue.add(evt);
|
||||
@ -261,7 +262,7 @@ public class NewtMouseInput implements MouseInput, MouseListener {
|
||||
// MHenze (cylab) Fix Issue 35:
|
||||
// As long as the MouseInput is in recentering mode, nothing is done until the mouse is entered in the component
|
||||
// by the events generated by the robot. If this happens, the last known location is resetted.
|
||||
if ((centerLocation.getX() == awtEvt.getX() && centerLocation.getY() == awtEvt.getY()) || eventsSinceRecenter++ == 5) {
|
||||
if ((lockPosition.getX() == awtEvt.getX() && lockPosition.getY() == awtEvt.getY()) || eventsSinceRecenter++ == 5) {
|
||||
lastKnownLocation.setX(awtEvt.getX());
|
||||
lastKnownLocation.setY(awtEvt.getY());
|
||||
isRecentering = false;
|
||||
@ -285,12 +286,7 @@ public class NewtMouseInput implements MouseInput, MouseListener {
|
||||
private void recenterMouse(final GLWindow component) {
|
||||
eventsSinceRecenter = 0;
|
||||
isRecentering = true;
|
||||
centerLocation.setX(component.getSurfaceWidth() / 2);
|
||||
centerLocation.setY(component.getSurfaceHeight() / 2);
|
||||
centerLocationOnScreen.setX(centerLocation.getX());
|
||||
centerLocationOnScreen.setY(centerLocation.getY());
|
||||
|
||||
component.warpPointer(centerLocationOnScreen.getX(), centerLocationOnScreen.getY());
|
||||
component.warpPointer(lockPosition.getX(), lockPosition.getY());
|
||||
}
|
||||
|
||||
private int getJMEButtonIndex(MouseEvent awtEvt) {
|
||||
@ -321,11 +317,17 @@ public class NewtMouseInput implements MouseInput, MouseListener {
|
||||
|
||||
@Override
|
||||
public void setNativeCursor(JmeCursor cursor) {
|
||||
final ByteBuffer pixels = Buffers.copyIntBufferAsByteBuffer(cursor.getImagesData());
|
||||
final DimensionImmutable size = new Dimension(cursor.getWidth(), cursor.getHeight());
|
||||
final PixelFormat pixFormat = PixelFormat.RGBA8888;
|
||||
final PixelRectangle.GenericPixelRect rec = new PixelRectangle.GenericPixelRect(pixFormat, size, 0, true, pixels);
|
||||
final PointerIcon joglCursor = component.getScreen().getDisplay().createPointerIcon(rec, cursor.getXHotSpot(), cursor.getHeight() - cursor.getYHotSpot());
|
||||
component.setPointerIcon(joglCursor);
|
||||
PointerIcon pointerIcon = null;
|
||||
if (cursor != null) {
|
||||
final ByteBuffer pixels = Buffers.copyIntBufferAsByteBuffer(cursor.getImagesData());
|
||||
final DimensionImmutable size = new Dimension(cursor.getWidth(), cursor.getHeight());
|
||||
final PixelFormat pixFormat = PixelFormat.RGBA8888;
|
||||
final PixelRectangle.GenericPixelRect rec =
|
||||
new PixelRectangle.GenericPixelRect(pixFormat, size, 0, true, pixels);
|
||||
pointerIcon = component.getScreen().getDisplay()
|
||||
.createPointerIcon(rec, cursor.getXHotSpot(), cursor.getHeight() - cursor.getYHotSpot());
|
||||
}
|
||||
|
||||
component.setPointerIcon(pointerIcon);
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ import com.jme3.input.event.MouseButtonEvent;
|
||||
import com.jme3.input.event.MouseMotionEvent;
|
||||
import com.jme3.system.lwjgl.LwjglAbstractDisplay;
|
||||
import com.jme3.system.lwjgl.LwjglTimer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.lwjgl.LWJGLException;
|
||||
@ -57,6 +59,12 @@ public class LwjglMouseInput implements MouseInput {
|
||||
private boolean supportHardwareCursor = false;
|
||||
private boolean cursorVisible = true;
|
||||
|
||||
/**
|
||||
* We need to cache the cursors
|
||||
* (https://github.com/jMonkeyEngine/jmonkeyengine/issues/537)
|
||||
*/
|
||||
private Map<JmeCursor, Cursor> cursorMap = new HashMap<JmeCursor, Cursor>();
|
||||
|
||||
private int curX, curY, curWheel;
|
||||
|
||||
public LwjglMouseInput(LwjglAbstractDisplay context){
|
||||
@ -120,7 +128,7 @@ public class LwjglMouseInput implements MouseInput {
|
||||
}
|
||||
if (btn != -1){
|
||||
MouseButtonEvent evt = new MouseButtonEvent(btn,
|
||||
Mouse.getEventButtonState(), x, y);
|
||||
Mouse.getEventButtonState(), x, y);
|
||||
evt.setTime(Mouse.getEventNanoseconds());
|
||||
listener.onMouseButtonEvent(evt);
|
||||
}
|
||||
@ -132,6 +140,13 @@ public class LwjglMouseInput implements MouseInput {
|
||||
return;
|
||||
|
||||
Mouse.destroy();
|
||||
|
||||
// Destroy the cursor cache
|
||||
for (Cursor cursor : cursorMap.values()) {
|
||||
cursor.destroy();
|
||||
}
|
||||
cursorMap.clear();
|
||||
|
||||
logger.fine("Mouse destroyed.");
|
||||
}
|
||||
|
||||
@ -155,14 +170,20 @@ public class LwjglMouseInput implements MouseInput {
|
||||
try {
|
||||
Cursor newCursor = null;
|
||||
if (jmeCursor != null) {
|
||||
newCursor = new Cursor(
|
||||
jmeCursor.getWidth(),
|
||||
jmeCursor.getHeight(),
|
||||
jmeCursor.getXHotSpot(),
|
||||
jmeCursor.getYHotSpot(),
|
||||
jmeCursor.getNumImages(),
|
||||
jmeCursor.getImagesData(),
|
||||
jmeCursor.getImagesDelay());
|
||||
newCursor = cursorMap.get(jmeCursor);
|
||||
if (newCursor == null) {
|
||||
newCursor = new Cursor(
|
||||
jmeCursor.getWidth(),
|
||||
jmeCursor.getHeight(),
|
||||
jmeCursor.getXHotSpot(),
|
||||
jmeCursor.getYHotSpot(),
|
||||
jmeCursor.getNumImages(),
|
||||
jmeCursor.getImagesData(),
|
||||
jmeCursor.getImagesDelay());
|
||||
|
||||
// Add to cache
|
||||
cursorMap.put(jmeCursor, newCursor);
|
||||
}
|
||||
}
|
||||
Mouse.setNativeCursor(newCursor);
|
||||
} catch (LWJGLException ex) {
|
||||
|
@ -2,28 +2,40 @@ if (!hasProperty('mainClass')) {
|
||||
ext.mainClass = ''
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven{
|
||||
url 'http://nifty-gui.sourceforge.net/nifty-maven-repo'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':jme3-core')
|
||||
compile 'lessvoid:nifty:1.4.1'
|
||||
compile 'lessvoid:nifty-default-controls:1.4.1'
|
||||
compile 'lessvoid:nifty-style-black:1.4.1'
|
||||
compile 'com.github.nifty-gui:nifty:1.4.2'
|
||||
compile 'com.github.nifty-gui:nifty-default-controls:1.4.2'
|
||||
compile 'com.github.nifty-gui:nifty-style-black:1.4.2'
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories.mavenDeployer {
|
||||
pom.project {
|
||||
repositories {
|
||||
repository {
|
||||
id "nifty-maven-repo.sourceforge.net"
|
||||
url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
|
||||
}
|
||||
}
|
||||
ext.pomConfig = {
|
||||
name POM_NAME
|
||||
description POM_DESCRIPTION
|
||||
url POM_URL
|
||||
inceptionYear POM_INCEPTION_YEAR
|
||||
scm {
|
||||
url POM_SCM_URL
|
||||
connection POM_SCM_CONNECTION
|
||||
developerConnection POM_SCM_DEVELOPER_CONNECTION
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name POM_LICENSE_NAME
|
||||
url POM_LICENSE_URL
|
||||
distribution POM_LICENSE_DISTRIBUTION
|
||||
}
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
name 'jMonkeyEngine Team'
|
||||
id 'jMonkeyEngine'
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
repository {
|
||||
id "nifty-maven-repo.sourceforge.net"
|
||||
url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
Version Info Examples
|
||||
=====================
|
||||
|
||||
|
||||
Nightly Build Snapshot
|
||||
* git tag:
|
||||
* Full Version: 3.1-5124
|
||||
@ -22,14 +22,14 @@
|
||||
* POM Version: 3.1.0-alpha1
|
||||
* NBM Revision: 0
|
||||
* NBM UC Suffix: stable/3.1/plugins
|
||||
|
||||
|
||||
Final Release
|
||||
* git tag: v3.1.0
|
||||
* Full Version: 3.1
|
||||
* POM Version: 3.1.0
|
||||
* NBM Revision: 0
|
||||
* NBM UC Suffix: stable/3.1/plugins
|
||||
*/
|
||||
*/
|
||||
|
||||
import java.text.SimpleDateFormat
|
||||
import org.ajoberstar.grgit.*
|
||||
@ -45,7 +45,6 @@ buildscript {
|
||||
|
||||
ext {
|
||||
jmeRevision = 0
|
||||
jmeNbmRevision = 0
|
||||
jmeGitHash = ""
|
||||
jmeGitTag = ""
|
||||
jmeShortGitHash = ""
|
||||
@ -53,7 +52,6 @@ ext {
|
||||
jmeBranchName = "unknown"
|
||||
jmeFullVersion = "${jmeVersion}-UNKNOWN"
|
||||
jmePomVersion = "unknown"
|
||||
jmeNbmUcSuffix = "unknown"
|
||||
}
|
||||
|
||||
def getReleaseInfo(String tag) {
|
||||
@ -122,7 +120,7 @@ task configureVersionInfo {
|
||||
jmeShortGitHash = head.abbreviatedId
|
||||
jmeBranchName = grgit.branch.current.name
|
||||
jmeGitTag = grgit.tag.list().find { it.commit == head }
|
||||
|
||||
|
||||
if (jmeGitTag != null) {
|
||||
jmeGitTag = jmeGitTag.name
|
||||
} else {
|
||||
@ -133,8 +131,6 @@ task configureVersionInfo {
|
||||
if (releaseInfo != null) {
|
||||
jmeFullVersion = "${releaseInfo.baseVersion}${releaseInfo.releaseSuffix}"
|
||||
jmePomVersion = "${releaseInfo.mainVersion}${releaseInfo.releaseSuffix}"
|
||||
jmeNbmRevision = "0"
|
||||
jmeNbmUcSuffix = "stable/${releaseInfo.baseVersion}/plugins"
|
||||
} else {
|
||||
// SNAPSHOT
|
||||
jmeFullVersion = jmeMainVersion
|
||||
@ -142,27 +138,20 @@ task configureVersionInfo {
|
||||
if (System.env.TRAVIS_BRANCH != null) {
|
||||
jmeBranchName = System.env.TRAVIS_BRANCH
|
||||
}
|
||||
if (System.env.TRAVIS_PULL_REQUEST != null &&
|
||||
if (System.env.TRAVIS_PULL_REQUEST != null &&
|
||||
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}-"
|
||||
} else {
|
||||
jmeNbmUcSuffix = ""
|
||||
}
|
||||
jmeNbmUcSuffix += "nightly/" + jmeMainVersion + "/plugins"
|
||||
jmeFullVersion += "-${jmeRevision}"
|
||||
jmePomVersion += "-SNAPSHOT"
|
||||
jmeNbmRevision = jmeRevision
|
||||
}
|
||||
|
||||
|
||||
logger.warn("Full Version: ${jmeFullVersion}")
|
||||
logger.warn("POM Version: ${jmePomVersion}")
|
||||
logger.warn("NBM Revision: ${jmeNbmRevision}")
|
||||
logger.warn("NBM UC Suffix: ${jmeNbmUcSuffix}")
|
||||
} catch (ex) {
|
||||
// Failed to get repo info
|
||||
logger.warn("Failed to get repository info: " + ex.message + ". " + \
|
||||
|
Loading…
x
Reference in New Issue
Block a user