Compare commits
118 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
607e24b2fa | ||
|
92e85f9012 | ||
|
b1727b9772 | ||
|
088419eef0 | ||
|
9ba574e584 | ||
|
c154a47b02 | ||
|
10b23db94d | ||
|
479392f6fd | ||
|
5470abb2b0 | ||
|
8214346e8b | ||
|
a87db2c117 | ||
|
0f93df648e | ||
|
af04bf9d22 | ||
|
2761bc3677 | ||
|
1ae6e98d05 | ||
|
69cd160956 | ||
|
789daa6295 | ||
|
659ed8fd23 | ||
|
f3e2925bd8 | ||
|
5d2c89f040 | ||
|
ac8eb4d40a | ||
|
aae6170cc5 | ||
|
7ecb81c230 | ||
|
63e8c9c485 | ||
|
975954fb17 | ||
|
e60d67b1bb | ||
|
92b5d40003 | ||
|
4952ad0cb5 | ||
|
a13a3a7f09 | ||
|
735397f16e | ||
|
c1764bc425 | ||
|
da1b7da329 | ||
|
e879a0e142 | ||
|
e3bd122519 | ||
|
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 |
25
.travis.yml
25
.travis.yml
@ -1,16 +1,16 @@
|
||||
language: java
|
||||
sudo: false
|
||||
env:
|
||||
- GRADLE_USER_HOME=gradle-cache
|
||||
|
||||
addons:
|
||||
ssh_known_hosts: updates.jmonkeyengine.org
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- gradle-cache
|
||||
- netbeans
|
||||
|
||||
# branches:
|
||||
# only:
|
||||
# - master
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
|
||||
notifications:
|
||||
slack:
|
||||
@ -20,13 +20,13 @@ notifications:
|
||||
secure: "PWEk4+VL986c3gAjWp12nqyifvxCjBqKoESG9d7zWh1uiTLadTHhZJRMdsye36FCpz/c/Jt7zCRO/5y7FaubQptnRrkrRfjp5f99MJRzQVXnUAM+y385qVkXKRKd/PLpM7XPm4AvjvxHCyvzX2wamRvul/TekaXKB9Ti5FCN87s="
|
||||
|
||||
install:
|
||||
- ./gradlew assemble
|
||||
- ./gradlew assemble
|
||||
|
||||
script:
|
||||
- ./gradlew check
|
||||
- ./gradlew createZipDistribution
|
||||
|
||||
before_deploy:
|
||||
- ./gradlew createZipDistribution
|
||||
- export RELEASE_DIST=$(ls build/distributions/*.zip)
|
||||
|
||||
deploy:
|
||||
@ -55,5 +55,6 @@ before_install:
|
||||
# export ANDROID_NDK=`pwd`/android-ndk-r10c
|
||||
|
||||
after_success:
|
||||
- '[ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew uploadArchives || :'
|
||||
- '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew uploadArchives bintrayUpload || :'
|
||||
- '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew bintrayUpload || :'
|
||||
# - '[ "$TRAVIS_BRANCH" == "v3.1" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew uploadArchives || :'
|
||||
# - '[ -n "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ./gradlew uploadArchives bintrayUpload || :'
|
||||
|
@ -1,59 +0,0 @@
|
||||
# How to contribute to jMonkeyEngine
|
||||
|
||||
First and foremost, you have to familiarize yourself with Git & GitHub. Dig through
|
||||
[help.github.com](https://help.github.com/), [try.github.io](http://try.github.io/) and the [gh cheat sheet](https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.md) if these are new topics for you. If you'd like to contribute with something other than code, just tell us about it on the forum.
|
||||
|
||||
## Communication
|
||||
|
||||
Communication always comes first. **All** code changes and other contributions should start with the [forum](http://hub.jmonkeyengine.org/). Make a thread to explain your change and show us the important bits of your code. If the code is too long to be posted within the forum’s code tags, please paste your code in a Gist or pastebin and link to the submission in your thread. You are required to register on our website in order to create threads. (We do support login via GitHub though).
|
||||
|
||||
### New Contributors
|
||||
|
||||
When you're ready to submit your code, just make a [pull request](https://help.github.com/articles/using-pull-requests).
|
||||
|
||||
- Do not commit your code until you have received proper feedback.
|
||||
- In your commit log message, please refer back to the originating forum thread (example) for a ‘full circle’ reference. Also please [reference related issues](https://help.github.com/articles/closing-issues-via-commit-messages) by typing the issue hashtag.
|
||||
- When committing, always be sure to run an update before you commit. If there is a conflict between the latest revision and your patch after the update, then it is your responsibility to track down the update that caused the conflict and determine the issue (and fix it). In the case where the breaking commit has no thread linked (and one cannot be found in the forum), then the contributor should contact an administrator and wait for feedback before committing.
|
||||
- If your code is committed and it introduces new functionality, please edit the wiki accordingly. We can easily roll back to previous revisions, so just do your best; point us to it and we’ll see if it sticks!
|
||||
|
||||
p.s. We will try hold ourselves to a [certain standard](http://www.defmacro.org/2013/04/03/issue-etiquette.html) when it comes to GitHub etiquette. If at any point we fail to uphold this standard, let us know.
|
||||
|
||||
#### Core Contributors
|
||||
|
||||
Developers in the Contributors team can push directly to Main instead of submitting pull requests, however for new features it is often a good idea to do a pull request as a means to get a last code review.
|
||||
|
||||
## Building the engine
|
||||
|
||||
1. Install [Gradle](http://www.gradle.org/)
|
||||
2. Navigate to the project directory and run 'gradle build' from command line to build the engine.
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Git essentials
|
||||
|
||||
- [Creating good pull requests](http://seesparkbox.com/foundry/creating_good_pull_requests)
|
||||
- [How to write the perfect pull request](https://github.com/blog/1943-how-to-write-the-perfect-pull-request?utm_content=buffer0eb16&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer)
|
||||
|
||||
### Testing
|
||||
|
||||
general testing tips? WIP
|
||||
|
||||
### Code Quality
|
||||
|
||||
We generally abide by the standard Java Code Conventions. Besides that, just make an effort to write elegant code:
|
||||
|
||||
1. Handles errors gracefully
|
||||
2. Only reinvents the wheel when there is a measurable benefit in doing so.
|
||||
3. Has consistent naming conventions.
|
||||
4. Has comments around ugly code explaining why it is ugly.
|
||||
5. Compiles (or runs if interpreted) without warnings.
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
1. Start by searching the [forum](http://hub.jmonkeyengine.org) and GH issue tracker for duplicates.
|
||||
2. Create a new issue, explaining the problem in proper detail (templates pending).
|
||||
|
||||
## Documentation
|
||||
|
||||
- How to edit the wiki - WIP
|
||||
- How to edit JavaDocs - WIP
|
48
README.md
48
README.md
@ -1,48 +0,0 @@
|
||||
jMonkeyEngine
|
||||
=============
|
||||
|
||||
[](https://travis-ci.org/jMonkeyEngine/jmonkeyengine)
|
||||
|
||||
jMonkeyEngine is a 3D game engine for adventurous Java developers. It’s open source, cross platform and cutting edge. And it is all beautifully documented. The 3.0 branch is the latest stable version of the jMonkeyEngine 3 SDK, a complete game development suite. We'll be frequently submitting stable 3.0.x updates until the major 3.1 version arrives.
|
||||
|
||||
The engine is used by several commercial game studios and computer-science courses. Here's a taste:
|
||||
|
||||

|
||||
|
||||
- [jME powered games on IndieDB](http://www.indiedb.com/engines/jmonkeyengine/games)
|
||||
- [Maker's Tale](http://steamcommunity.com/sharedfiles/filedetails/?id=93461954t)
|
||||
- [Boardtastic 2](https://play.google.com/store/apps/details?id=com.boardtastic.skateboarding)
|
||||
- [Copod](http://herebeben.com/copod)
|
||||
- [Attack of the Gelatinous Blob](http://attackofthegelatinousblob.com/)
|
||||
- [Chaos](http://4realms.net/)
|
||||
- [Mythruna](https://mythruna.com/)
|
||||
- [PirateHell](http://www.desura.com/games/piratehell)
|
||||
- [3089 (on steam)](http://store.steampowered.com/app/263360/)
|
||||
- [3079 (on steam)](http://store.steampowered.com/app/259620/)
|
||||
|
||||
## Getting started
|
||||
|
||||
Go to http://hub.jmonkeyengine.org/downloads/ to download the jMonkeyEngine SDK.
|
||||
[Read the wiki](http://hub.jmonkeyengine.org/wiki/doku.php) for a complete install guide. Power up with some SDK Plugins and AssetPacks and you are off to the races. At this point you're gonna want to [join the forum](http://hub.jmonkeyengine.org/) so our tribe can grow stronger.
|
||||
|
||||
Note: The master branch on GitHub is a development version of the engine and is NOT MEANT TO BE USED IN PRODUCTION, it will break constantly during development of the stable jME versions!
|
||||
|
||||
### Technology Stack
|
||||
|
||||
- Java
|
||||
- NetBeans Platform
|
||||
- Gradle
|
||||
|
||||
Plus a bunch of awesome libraries & tight integrations like Bullet, Blender, NiftyGUI and other goodies.
|
||||
|
||||
### Documentation
|
||||
|
||||
Did you miss it? Don't sweat it, [here it is again](http://hub.jmonkeyengine.org/wiki/doku.php).
|
||||
|
||||
### Contributing
|
||||
|
||||
Read our [contribution guide](https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/CONTRIBUTING.md).
|
||||
|
||||
### License
|
||||
|
||||
New BSD (3-clause) License. In other words, you do whatever makes you happy!
|
@ -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'
|
||||
@ -10,4 +10,4 @@ repositories {
|
||||
maven {
|
||||
url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,11 +67,11 @@ task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
def pomConfig = {
|
||||
ext.pomConfig = {
|
||||
name POM_NAME
|
||||
description POM_DESCRIPTION
|
||||
url POM_URL
|
||||
inceptionYear '2016'
|
||||
inceptionYear POM_INCEPTION_YEAR
|
||||
scm {
|
||||
url POM_SCM_URL
|
||||
connection POM_SCM_CONNECTION
|
||||
@ -84,7 +84,6 @@ def pomConfig = {
|
||||
distribution POM_LICENSE_DISTRIBUTION
|
||||
}
|
||||
}
|
||||
// from http://hub.jmonkeyengine.org/introduction/team/
|
||||
developers {
|
||||
developer {
|
||||
name 'jMonkeyEngine Team'
|
||||
@ -103,6 +102,7 @@ task writeFullPom {
|
||||
}.writeTo(pomFile)
|
||||
}
|
||||
}
|
||||
|
||||
assemble.dependsOn(writeFullPom)
|
||||
install.dependsOn(writeFullPom)
|
||||
uploadArchives.dependsOn(writeFullPom)
|
||||
@ -110,7 +110,7 @@ uploadArchives.dependsOn(writeFullPom)
|
||||
artifacts {
|
||||
archives jar
|
||||
archives sourcesJar
|
||||
if(buildJavaDoc == "true"){
|
||||
if (buildJavaDoc == "true") {
|
||||
archives javadocJar
|
||||
}
|
||||
archives writeFullPom.outputs.files[0]
|
||||
@ -130,12 +130,3 @@ uploadArchives {
|
||||
pom.project pomConfig
|
||||
}
|
||||
}
|
||||
|
||||
task createFolders(description: 'Creates the source folders if they do not exist.') doLast {
|
||||
// sourceSets*.allSource*.srcDirs*.each { File srcDir ->
|
||||
// if (!srcDir.isDirectory()) {
|
||||
// println "Creating source folder: ${srcDir}"
|
||||
// srcDir.mkdirs()
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -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=
|
||||
|
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
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.jme3.asset.plugins;
|
||||
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.content.res.Resources;
|
||||
import com.jme3.asset.*;
|
||||
import com.jme3.system.android.JmeAndroidSystem;
|
||||
import java.io.IOException;
|
||||
@ -12,26 +13,89 @@ public class AndroidLocator implements AssetLocator {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AndroidLocator.class.getName());
|
||||
|
||||
private android.content.res.AssetManager androidManager;
|
||||
private String rootPath = "";
|
||||
|
||||
public AndroidLocator() {
|
||||
}
|
||||
|
||||
public void setRootPath(String rootPath) {
|
||||
this.rootPath = rootPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssetInfo locate(AssetManager manager, AssetKey key) {
|
||||
String assetPath = rootPath + key.getName();
|
||||
// Fix path issues
|
||||
if (assetPath.startsWith("/")) {
|
||||
// Remove leading /
|
||||
assetPath = assetPath.substring(1);
|
||||
}
|
||||
assetPath = assetPath.replace("//", "/");
|
||||
|
||||
// Not making this a property and storing for future use in case the view stored in JmeAndroidSystem
|
||||
// is replaced due to device orientation change. Not sure it is necessary to do this yet, but am for now.
|
||||
android.content.res.Resources androidResources = JmeAndroidSystem.getView().getContext().getResources();
|
||||
String androidPackageName = JmeAndroidSystem.getView().getContext().getPackageName();
|
||||
|
||||
// logger.log(Level.INFO, "Asset Key: {0}", key);
|
||||
// logger.log(Level.INFO, "Asset Name: {0}", key.getName());
|
||||
// logger.log(Level.INFO, "Asset Path: {0}", assetPath);
|
||||
// logger.log(Level.INFO, "Asset Extension: {0}", key.getExtension());
|
||||
// logger.log(Level.INFO, "Asset Key Class: {0}", key.getClass().getName());
|
||||
// logger.log(Level.INFO, "androidPackageName: {0}", androidPackageName);
|
||||
// logger.log(Level.INFO, "Resource Name: {0}", getResourceName(assetPath));
|
||||
|
||||
// check the assets directory for the asset using assetPath
|
||||
try {
|
||||
InputStream in = androidResources.getAssets().open(assetPath);
|
||||
if (in != null){
|
||||
return new AndroidAssetInfo(manager, key, assetPath, in, 0);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
// allow to fall through to the other checks in the resources directories.
|
||||
// logger.log(Level.INFO, "Resource[{0}] not found in assets directory.", assetPath);
|
||||
}
|
||||
|
||||
// if not found in the assets directory, check the drawable and mipmap directories (only valid for images)
|
||||
String resourceName = getResourceName(assetPath);
|
||||
int resourceId = androidResources.getIdentifier(resourceName, "drawable", androidPackageName);
|
||||
// logger.log(Level.INFO, "drawable resourceId: {0}", resourceId);
|
||||
if (resourceId == 0) { // drawable resource not found, check mipmap resource type
|
||||
resourceId = androidResources.getIdentifier(resourceName, "mipmap", androidPackageName);
|
||||
// logger.log(Level.INFO, "mipmap resourceId: {0}", resourceId);
|
||||
}
|
||||
if (resourceId == 0) { // not found in resource directories, return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
// try to open a stream with the resourceId returned by Android
|
||||
try {
|
||||
InputStream in = androidResources.openRawResource(resourceId);
|
||||
if (in != null){
|
||||
// logger.log(Level.INFO, "Creating new AndroidResourceInfo.");
|
||||
return new AndroidAssetInfo(manager, key, assetPath, in, resourceId);
|
||||
}
|
||||
} catch (Resources.NotFoundException ex) {
|
||||
// input stream failed to open, return null
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class AndroidAssetInfo extends AssetInfo {
|
||||
|
||||
private InputStream in;
|
||||
private final String assetPath;
|
||||
private int resourceId;
|
||||
|
||||
public AndroidAssetInfo(com.jme3.asset.AssetManager assetManager, AssetKey<?> key, String assetPath, InputStream in) {
|
||||
AndroidAssetInfo(AssetManager assetManager, AssetKey<?> key, String assetPath, InputStream in, int resourceId) {
|
||||
super(assetManager, key);
|
||||
this.assetPath = assetPath;
|
||||
this.in = in;
|
||||
}
|
||||
|
||||
public AssetFileDescriptor openFileDescriptor() {
|
||||
try {
|
||||
return androidManager.openFd(assetPath);
|
||||
} catch (IOException ex) {
|
||||
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
|
||||
}
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,55 +107,47 @@ public class AndroidLocator implements AssetLocator {
|
||||
return in2;
|
||||
}else{
|
||||
// Create a new stream for subsequent invocations.
|
||||
android.content.res.Resources androidResources = JmeAndroidSystem.getView().getContext().getResources();
|
||||
if (resourceId == 0) {
|
||||
try {
|
||||
return androidResources.getAssets().open(assetPath);
|
||||
} catch (IOException ex) {
|
||||
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return androidResources.openRawResource(resourceId);
|
||||
} catch (Resources.NotFoundException ex) {
|
||||
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AssetFileDescriptor openFileDescriptor() {
|
||||
android.content.res.Resources androidResources = JmeAndroidSystem.getView().getContext().getResources();
|
||||
if (resourceId == 0) {
|
||||
try {
|
||||
return androidManager.open(assetPath);
|
||||
return androidResources.getAssets().openFd(assetPath);
|
||||
} catch (IOException ex) {
|
||||
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return androidResources.openRawResourceFd(resourceId);
|
||||
} catch (Resources.NotFoundException ex) {
|
||||
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private AndroidAssetInfo create(AssetManager assetManager, AssetKey key, String assetPath) throws IOException {
|
||||
try {
|
||||
InputStream in = androidManager.open(assetPath);
|
||||
if (in == null){
|
||||
return null;
|
||||
}else{
|
||||
return new AndroidAssetInfo(assetManager, key, assetPath, in);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
// XXX: Prefer to show warning here?
|
||||
// Should only surpress exceptions for "file missing" type errors.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public AndroidLocator() {
|
||||
androidManager = JmeAndroidSystem.getView().getContext().getAssets();
|
||||
}
|
||||
|
||||
public void setRootPath(String rootPath) {
|
||||
this.rootPath = rootPath;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public AssetInfo locate(com.jme3.asset.AssetManager manager, AssetKey key) {
|
||||
String assetPath = rootPath + key.getName();
|
||||
// Fix path issues
|
||||
if (assetPath.startsWith("/")) {
|
||||
// Remove leading /
|
||||
assetPath = assetPath.substring(1);
|
||||
}
|
||||
assetPath = assetPath.replace("//", "/");
|
||||
try {
|
||||
return create(manager, key, assetPath);
|
||||
} catch (IOException ex) {
|
||||
// This is different handling than URL locator
|
||||
// since classpath locating would return null at the getResource()
|
||||
// call, otherwise there's a more critical error...
|
||||
throw new AssetLoadException("Failed to open asset " + assetPath, ex);
|
||||
private String getResourceName(String name) {
|
||||
int idx = name.lastIndexOf('.');
|
||||
if (idx <= 0 || idx == name.length() - 1) {
|
||||
return name;
|
||||
} else {
|
||||
return name.substring(0, idx).toLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,8 +139,10 @@ public class AndroidInputHandler14 extends AndroidInputHandler implements View.O
|
||||
boolean isJoystick =
|
||||
((source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) ||
|
||||
((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK);
|
||||
boolean isUnknown =
|
||||
(source & android.view.InputDevice.SOURCE_UNKNOWN) == android.view.InputDevice.SOURCE_UNKNOWN;
|
||||
|
||||
if (isTouch && touchInput != null) {
|
||||
if (touchInput != null && (isTouch || (isUnknown && this.touchInput.isSimulateKeyboard()))) {
|
||||
// logger.log(Level.INFO, "onKey source: {0}, isTouch: {1}",
|
||||
// new Object[]{source, isTouch});
|
||||
consumed = touchInput.onKey(event);
|
||||
|
@ -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
|
||||
|
@ -86,7 +86,9 @@ public class CylinderCollisionShape extends CollisionShape {
|
||||
*/
|
||||
@Override
|
||||
public void setScale(Vector3f scale) {
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "CylinderCollisionShape cannot be scaled");
|
||||
if (!scale.equals(Vector3f.UNIT_XYZ)) {
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "CylinderCollisionShape cannot be scaled");
|
||||
}
|
||||
}
|
||||
|
||||
public void write(JmeExporter ex) throws IOException {
|
||||
|
@ -122,7 +122,7 @@ public class MeshCollisionShape extends CollisionShape {
|
||||
this.vertexStride = 12;
|
||||
this.triangleIndexStride = 12;
|
||||
this.memoryOptimized = memoryOptimized;
|
||||
this.createShape(true);
|
||||
this.createShape(null);
|
||||
}
|
||||
|
||||
private void createCollisionMesh(Mesh mesh) {
|
||||
@ -150,7 +150,7 @@ public class MeshCollisionShape extends CollisionShape {
|
||||
vertices.rewind();
|
||||
vertices.clear();
|
||||
|
||||
this.createShape(true);
|
||||
this.createShape(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -191,25 +191,19 @@ public class MeshCollisionShape extends CollisionShape {
|
||||
this.vertexBase = BufferUtils.createByteBuffer(capsule.readByteArray(MeshCollisionShape.VERTEX_BASE, null));
|
||||
|
||||
byte[] nativeBvh = capsule.readByteArray(MeshCollisionShape.NATIVE_BVH, null);
|
||||
if (nativeBvh == null) {
|
||||
// Either using non memory optimized BVH or old J3O file
|
||||
memoryOptimized = false;
|
||||
createShape(true);
|
||||
} else {
|
||||
// Using memory optimized BVH, load from J3O, then assign it.
|
||||
memoryOptimized = true;
|
||||
createShape(false);
|
||||
nativeBVHBuffer = setBVH(nativeBvh, this.objectId);
|
||||
}
|
||||
memoryOptimized=nativeBvh != null;
|
||||
createShape(nativeBvh);
|
||||
}
|
||||
|
||||
private void createShape(boolean buildBvt) {
|
||||
private void createShape(byte bvh[]) {
|
||||
boolean buildBvh=bvh==null||bvh.length==0;
|
||||
this.meshId = NativeMeshUtil.createTriangleIndexVertexArray(this.triangleIndexBase, this.vertexBase, this.numTriangles, this.numVertices, this.vertexStride, this.triangleIndexStride);
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Created Mesh {0}", Long.toHexString(this.meshId));
|
||||
this.objectId = createShape(memoryOptimized, buildBvt, this.meshId);
|
||||
this.objectId = createShape(memoryOptimized, buildBvh, this.meshId);
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Created Shape {0}", Long.toHexString(this.objectId));
|
||||
if(!buildBvh) nativeBVHBuffer = setBVH(bvh, this.objectId);
|
||||
this.setScale(this.scale);
|
||||
this.setMargin(this.margin);
|
||||
this.setMargin(this.margin);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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 {
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ import com.jme3.export.*;
|
||||
import com.jme3.math.*;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.util.TempVars;
|
||||
import com.jme3.util.clone.JmeCloneable;
|
||||
import com.jme3.util.clone.Cloner;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -62,13 +64,13 @@ import java.util.ArrayList;
|
||||
* @author Kirill Vainer
|
||||
* @author Rémy Bouquet
|
||||
*/
|
||||
public final class Bone implements Savable {
|
||||
public final class Bone implements Savable, JmeCloneable {
|
||||
|
||||
// Version #2: Changed naming of transforms as they were misleading
|
||||
public static final int SAVABLE_VERSION = 2;
|
||||
private String name;
|
||||
private Bone parent;
|
||||
private final ArrayList<Bone> children = new ArrayList<Bone>();
|
||||
private ArrayList<Bone> children = new ArrayList<Bone>();
|
||||
/**
|
||||
* If enabled, user can control bone transform with setUserTransforms.
|
||||
* Animation transforms are not applied to this bone when enabled.
|
||||
@ -167,6 +169,43 @@ public final class Bone implements Savable {
|
||||
*/
|
||||
public Bone() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object jmeClone() {
|
||||
try {
|
||||
Bone clone = (Bone)super.clone();
|
||||
return clone;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cloneFields( Cloner cloner, Object original ) {
|
||||
|
||||
this.parent = cloner.clone(parent);
|
||||
this.children = cloner.clone(children);
|
||||
|
||||
this.attachNode = cloner.clone(attachNode);
|
||||
|
||||
this.bindPos = cloner.clone(bindPos);
|
||||
this.bindRot = cloner.clone(bindRot);
|
||||
this.bindScale = cloner.clone(bindScale);
|
||||
|
||||
this.modelBindInversePos = cloner.clone(modelBindInversePos);
|
||||
this.modelBindInverseRot = cloner.clone(modelBindInverseRot);
|
||||
this.modelBindInverseScale = cloner.clone(modelBindInverseScale);
|
||||
|
||||
this.localPos = cloner.clone(localPos);
|
||||
this.localRot = cloner.clone(localRot);
|
||||
this.localScale = cloner.clone(localScale);
|
||||
|
||||
this.modelPos = cloner.clone(modelPos);
|
||||
this.modelRot = cloner.clone(modelRot);
|
||||
this.modelScale = cloner.clone(modelScale);
|
||||
|
||||
this.tmpTransform = cloner.clone(tmpTransform);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the bone, set in the constructor.
|
||||
|
@ -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());
|
||||
|
||||
BoundingBox bbox = (BoundingBox) this.getMesh().getBound();
|
||||
bbox.setMinMax(min, max);
|
||||
this.setBoundRefresh();
|
||||
//This check avoids a NaN bounds when all the particles are dead during the first update.
|
||||
if (!min.equals(Vector3f.POSITIVE_INFINITY) && !max.equals(Vector3f.NEGATIVE_INFINITY)) {
|
||||
BoundingBox bbox = (BoundingBox) this.getMesh().getBound();
|
||||
bbox.setMinMax(min, max);
|
||||
this.setBoundRefresh();
|
||||
}
|
||||
|
||||
vars.release();
|
||||
}
|
||||
|
@ -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();
|
||||
@ -172,22 +173,6 @@ class StringBlock implements Cloneable {
|
||||
void setLineWrapMode(LineWrapMode wrap) {
|
||||
this.wrapType = wrap;
|
||||
}
|
||||
|
||||
void setTabWidth(float tabWidth) {
|
||||
this.tabWidth = tabWidth;
|
||||
}
|
||||
|
||||
void setTabPosition(float[] tabs) {
|
||||
this.tabPos = tabs;
|
||||
}
|
||||
|
||||
float getTabWidth() {
|
||||
return tabWidth;
|
||||
}
|
||||
|
||||
float[] getTabPosition() {
|
||||
return tabPos;
|
||||
}
|
||||
|
||||
void setEllipsisChar(char c) {
|
||||
this.ellipsisChar = c;
|
||||
@ -196,4 +181,30 @@ class StringBlock implements Cloneable {
|
||||
int getEllipsisChar() {
|
||||
return ellipsisChar;
|
||||
}
|
||||
|
||||
void setTabWidth(float tabWidth) {
|
||||
this.tabWidth = tabWidth;
|
||||
}
|
||||
|
||||
void setTabPosition(float[] tabs) {
|
||||
if(tabs != null && tabs.length > 0) {
|
||||
this.tabPos = tabs.clone();
|
||||
} else {
|
||||
this.tabPos = null;
|
||||
}
|
||||
}
|
||||
|
||||
float calcNextTabPosition(float posX) {
|
||||
// If there is an upcoming user-set tab stop, use that one.
|
||||
if (tabPos != null && posX < tabPos[tabPos.length-1]) {
|
||||
for (int i = 0; i < tabPos.length; i++) {
|
||||
if (posX < tabPos[i]) {
|
||||
return tabPos[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No upcoming tab stops available, use default tab width.
|
||||
return (float)Math.floor(posX / tabWidth) * tabWidth + tabWidth;
|
||||
}
|
||||
}
|
@ -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,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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
@ -126,6 +131,20 @@ public class Quad extends Mesh {
|
||||
updateBound();
|
||||
setStatic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(JmeImporter e) throws IOException {
|
||||
super.read(e);
|
||||
InputCapsule capsule = e.getCapsule(this);
|
||||
width = capsule.readFloat("width", 0);
|
||||
height = capsule.readFloat("height", 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(JmeExporter e) throws IOException {
|
||||
super.write(e);
|
||||
OutputCapsule capsule = e.getCapsule(this);
|
||||
capsule.write(width, "width", 0);
|
||||
capsule.write(height, "height", 0);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -38,14 +38,14 @@ import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Pulls in version info from the version.properties file.
|
||||
*
|
||||
*
|
||||
* @author Kirill Vainer
|
||||
*/
|
||||
public class JmeVersion {
|
||||
|
||||
|
||||
private static final Logger logger = Logger.getLogger(JmeVersion.class.getName());
|
||||
private static final Properties props = new Properties();
|
||||
|
||||
|
||||
static {
|
||||
try {
|
||||
props.load(JmeVersion.class.getResourceAsStream("version.properties"));
|
||||
@ -53,12 +53,12 @@ public class JmeVersion {
|
||||
logger.log(Level.WARNING, "Unable to read version info!", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final String BUILD_DATE = props.getProperty("build.date", "1900-01-01");
|
||||
public static final String BRANCH_NAME = props.getProperty("git.branch", "unknown");
|
||||
public static final String GIT_HASH = props.getProperty("git.hash", "");
|
||||
public static final String GIT_SHORT_HASH = props.getProperty("git.hash.short", "");
|
||||
public static final String GIT_TAG = props.getProperty("git.tag", "");
|
||||
public static final String GIT_TAG = props.getProperty("git.tag", "3.1-unknown");
|
||||
public static final String VERSION_NUMBER = props.getProperty("version.number", "");
|
||||
public static final String VERSION_TAG = props.getProperty("version.tag", "");
|
||||
public static final String VERSION_FULL = props.getProperty("version.full", "");
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -21,13 +21,10 @@ public class MikkTSpaceImpl implements MikkTSpaceContext {
|
||||
|
||||
public MikkTSpaceImpl(Mesh mesh) {
|
||||
this.mesh = mesh;
|
||||
VertexBuffer tangentBuffer = mesh.getBuffer(VertexBuffer.Type.Tangent);
|
||||
if(tangentBuffer == null){
|
||||
FloatBuffer fb = BufferUtils.createFloatBuffer(mesh.getVertexCount() * 4);
|
||||
mesh.setBuffer(VertexBuffer.Type.Tangent, 4, fb);
|
||||
}
|
||||
|
||||
//TODO ensure the Tangent buffer exists, else create one.
|
||||
//replacing any existing tangent buffer, if you came here you want them new.
|
||||
mesh.clearBuffer(VertexBuffer.Type.Tangent);
|
||||
FloatBuffer fb = BufferUtils.createFloatBuffer(mesh.getVertexCount() * 4);
|
||||
mesh.setBuffer(VertexBuffer.Type.Tangent, 4, fb);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,9 +7,9 @@ package com.jme3.util.mikktspace;
|
||||
|
||||
import com.jme3.math.FastMath;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.*;
|
||||
import com.jme3.util.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -84,6 +84,7 @@ public class MikktspaceTangentGenerator {
|
||||
if(!genTangSpaceDefault(context)){
|
||||
Logger.getLogger(MikktspaceTangentGenerator.class.getName()).log(Level.SEVERE, "Failed to generate tangents for geometry " + g.getName());
|
||||
}
|
||||
TangentUtils.generateBindPoseTangentsIfNecessary(g.getMesh());
|
||||
}
|
||||
}
|
||||
|
||||
@ -511,7 +512,7 @@ public class MikktspaceTangentGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO Nehon : Not used...seemsit's used in the original version if the structure to store the data in the regular method failed...
|
||||
//TODO Nehon : Not used...seems it's used in the original version if the structure to store the data in the regular method failed...
|
||||
static void generateSharedVerticesIndexListSlow(int piTriList_in_and_out[], final MikkTSpaceContext mikkTSpace, final int iNrTrianglesIn) {
|
||||
int iNumUniqueVerts = 0;
|
||||
for (int t = 0; t < iNrTrianglesIn; t++) {
|
||||
|
@ -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
|
||||
WorldViewProjectionMatrix
|
||||
WorldViewMatrix
|
||||
ViewProjectionMatrix
|
||||
ViewMatrix
|
||||
}
|
||||
|
||||
Defines {
|
||||
USE_TEXTURE : Texture
|
||||
PRE_SHADOW
|
||||
COLOR_MAP : Texture
|
||||
}
|
||||
|
||||
ForcedRenderState {
|
||||
DepthWrite On
|
||||
ColorWrite Off
|
||||
FaceCull Off
|
||||
DepthTest On
|
||||
DepthWrite On
|
||||
PolyOffset 5 3
|
||||
ColorWrite Off
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Technique SoftParticles{
|
||||
@ -140,14 +143,6 @@ MaterialDef Point Sprite {
|
||||
}
|
||||
}
|
||||
|
||||
Technique {
|
||||
RenderState {
|
||||
Blend AlphaAdditive
|
||||
// DepthWrite Off
|
||||
// AlphaTestFalloff 0.01
|
||||
}
|
||||
}
|
||||
|
||||
Technique Glow {
|
||||
|
||||
VertexShader GLSL100: Common/MatDefs/Misc/Unshaded.vert
|
||||
|
@ -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
|
||||
|
@ -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,9 +90,11 @@ public class CylinderCollisionShape extends CollisionShape {
|
||||
*/
|
||||
@Override
|
||||
public void setScale(Vector3f scale) {
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "CylinderCollisionShape cannot be scaled");
|
||||
if (!scale.equals(Vector3f.UNIT_XYZ)) {
|
||||
Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "CylinderCollisionShape cannot be scaled");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void write(JmeExporter ex) throws IOException {
|
||||
super.write(ex);
|
||||
OutputCapsule capsule = ex.getCapsule(this);
|
||||
|
@ -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) {
|
||||
|
@ -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,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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,6 +150,7 @@ varying vec2 texCoord;
|
||||
|
||||
vec4 calculateDiffuseBlend(in vec2 texCoord) {
|
||||
vec4 alphaBlend = texture2D( m_AlphaMap, texCoord.xy );
|
||||
vec4 diffuseColor = vec4(1.0);
|
||||
|
||||
#ifdef ALPHAMAP_1
|
||||
vec4 alphaBlend1 = texture2D( m_AlphaMap_1, texCoord.xy );
|
||||
@ -157,9 +158,10 @@ varying vec2 texCoord;
|
||||
#ifdef ALPHAMAP_2
|
||||
vec4 alphaBlend2 = texture2D( m_AlphaMap_2, texCoord.xy );
|
||||
#endif
|
||||
|
||||
vec4 diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
|
||||
diffuseColor *= alphaBlend.r;
|
||||
#ifdef DIFFUSEMAP
|
||||
diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
|
||||
diffuseColor *= alphaBlend.r;
|
||||
#endif
|
||||
#ifdef DIFFUSEMAP_1
|
||||
vec4 diffuseColor1 = texture2D(m_DiffuseMap_1, texCoord * m_DiffuseMap_1_scale);
|
||||
diffuseColor = mix( diffuseColor, diffuseColor1, alphaBlend.g );
|
||||
|
@ -151,6 +151,7 @@ varying vec3 lightVec;
|
||||
|
||||
vec4 calculateDiffuseBlend(in vec2 texCoord) {
|
||||
vec4 alphaBlend = texture2D( m_AlphaMap, texCoord.xy );
|
||||
vec4 diffuseColor = vec4(1.0);
|
||||
|
||||
#ifdef ALPHAMAP_1
|
||||
vec4 alphaBlend1 = texture2D( m_AlphaMap_1, texCoord.xy );
|
||||
@ -158,9 +159,10 @@ varying vec3 lightVec;
|
||||
#ifdef ALPHAMAP_2
|
||||
vec4 alphaBlend2 = texture2D( m_AlphaMap_2, texCoord.xy );
|
||||
#endif
|
||||
|
||||
vec4 diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
|
||||
diffuseColor *= alphaBlend.r;
|
||||
#ifdef DIFFUSEMAP
|
||||
diffuseColor = texture2D(m_DiffuseMap, texCoord * m_DiffuseMap_0_scale);
|
||||
diffuseColor *= alphaBlend.r;
|
||||
#endif
|
||||
#ifdef DIFFUSEMAP_1
|
||||
vec4 diffuseColor1 = texture2D(m_DiffuseMap_1, texCoord * m_DiffuseMap_1_scale);
|
||||
diffuseColor = mix( diffuseColor, diffuseColor1, alphaBlend.g );
|
||||
|
@ -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…
x
Reference in New Issue
Block a user