├── .gitignore
├── LICENSE.txt
├── README.md
├── RajawaliVR
├── .gitignore
├── build.gradle
├── deps.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── rajawalivr
│ ├── .gitignore
│ ├── build.gradle
│ ├── gradle.properties
│ ├── libs
│ │ ├── armeabi-v7a
│ │ │ ├── libvraudio_engine.so
│ │ │ └── libvrtoolkit.so
│ │ ├── audio.jar
│ │ └── cardboard.jar
│ ├── maven_push.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── vr
│ │ │ └── rajawali3d
│ │ │ └── org
│ │ │ └── rajawalivr
│ │ │ └── ApplicationTest.java
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── org
│ │ │ └── rajawali3d
│ │ │ └── vr
│ │ │ ├── RajawaliVRActivity.java
│ │ │ ├── materials
│ │ │ └── shaders
│ │ │ │ ├── HotspotFragmentShader.java
│ │ │ │ └── HotspotMaterial.java
│ │ │ ├── renderer
│ │ │ └── RajawaliVRRenderer.java
│ │ │ └── surface
│ │ │ └── RajawaliVRSurfaceView.java
│ │ └── res
│ │ └── values
│ │ └── strings.xml
└── settings.gradle
└── RajawaliVRExample
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ ├── sonar.wav
│ └── spaceship.wav
│ ├── java
│ └── org
│ │ └── rajawali3d
│ │ └── vr
│ │ └── example
│ │ ├── RajawaliVRExampleActivity.java
│ │ └── RajawaliVRExampleRenderer.java
│ └── res
│ ├── drawable-nodpi
│ ├── dark_fighter_6_color.png
│ ├── ground.png
│ ├── groundnor.jpg
│ ├── hulln.bmp
│ ├── hullw.jpg
│ ├── negx.jpg
│ ├── negy.jpg
│ ├── negz.jpg
│ ├── posx.jpg
│ ├── posy.jpg
│ ├── posz.jpg
│ ├── space_cruiser_4_color_1.jpg
│ └── terrain.jpg
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── raw
│ ├── capital.awd
│ ├── dark_fighter.awd
│ └── space_cruiser.awd
│ └── values
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | /*/build/
3 | build/
4 |
5 | # Crashlytics configuations
6 | com_crashlytics_export_strings.xml
7 |
8 | # Local configuration file (sdk path, etc)
9 | local.properties
10 | local.gradle
11 |
12 | # Gradle generated files
13 | .gradle/
14 |
15 | # Signing files
16 | .signing/
17 |
18 | # User-specific configurations
19 | RajawaliVR/.idea/
20 | RajawaliVRExample/.idea/
21 | .idea/
22 | *.iml
23 |
24 | # OS-specific files
25 | .DS_Store
26 | .DS_Store?
27 | ._*
28 | .Spotlight-V100
29 | .Trashes
30 | ehthumbs.db
31 | Thumbs.db
32 | bin/
33 | gen/
34 | .idea/dictionaries/dennis.xml
35 | local.properties~
36 | RajawaliVRExample/.idea/libraries/rajawali_1_0_0_SNAPSHOT.xml
37 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | RAJAWALI license:
2 |
3 | Copyright 2011 Dennis Ippel
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | ---------------------------------------------------------------------------
18 |
19 | VUFORIA license:
20 |
21 | https://developer.vuforia.com/legal/license
22 |
23 | To view the release notes, go to https://developer.vuforia.com/resources/sdk
24 |
25 |
26 | /*============================================================================
27 | Copyright (c) 2010-2013 QUALCOMM Austria Research Center GmbH.
28 | All Rights Reserved.
29 | Qualcomm Confidential and Proprietary
30 | ============================================================================*/
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Rajawali + Virtual Reality
2 |
3 | ## ATTENTION
4 |
5 | As of 03/17/2016, this module/example is fully integrated to the examples application which has been moved to the main Rajawali repository: https://github.com/Rajawali/Rajawali. This repository will remain for historical reference but **it is effectively abandoned and no responses from the maintainers should be expected.**
6 |
7 | ==============================================================
8 |
9 | This project integrates the [Rajawali 3D framework](https://github.com/MasDennis/Rajawali) with the [Google Cardboard SDK v0.6.0](https://developers.google.com/cardboard/).
10 |
11 | [https://www.youtube.com/watch?v=UIRTKSEnRF0&feature=youtu.be](https://www.youtube.com/watch?v=UIRTKSEnRF0&feature=youtu.be)
12 |
13 | ## Virtual Reality Headset
14 |
15 | You'll need a virtual reality headset for smartphones:
16 | - [Get your Cardboard](hhttps://www.google.com/get/cardboard/get-cardboard/)
17 |
18 | #How To Run The Example
19 |
20 | You need a local build of the latest RajawaliVR Framework. Currently RajawaliVR is not available on maven so a local build must be created. To build a local release of RajawaliVR simply perform a checkout of the library then run the gradle tasks ```clean assembleRelease uploadArchives```.
21 |
22 | ## Linux
23 | ```
24 | git clone https://github.com/Rajawali/RajawaliVR.git
25 | ./RajawaliVR/RajawaliVR/gradlew clean assembleRelease uploadArchives
26 | ```
27 |
28 | ## Windows
29 | ```
30 | git clone https://github.com/Rajawali/RajawaliVR.git
31 | ./RajawaliVR/RajawaliVR/gradlew.bat clean assembleRelease uploadArchives
32 | ```
33 |
34 |
--------------------------------------------------------------------------------
/RajawaliVR/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 |
--------------------------------------------------------------------------------
/RajawaliVR/build.gradle:
--------------------------------------------------------------------------------
1 | apply from: 'deps.gradle'
2 | if (file('local.gradle').exists()) {
3 | apply from: 'local.gradle'
4 | }
5 |
6 | buildscript {
7 | repositories {
8 | jcenter()
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:2.0.0-beta6'
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | mavenLocal()
18 | jcenter()
19 | maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/RajawaliVR/deps.gradle:
--------------------------------------------------------------------------------
1 | project.ext.set('depRajawali', 'org.rajawali3d:rajawali:1.0.325@aar')
2 |
--------------------------------------------------------------------------------
/RajawaliVR/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/RajawaliVR/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVR/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/RajawaliVR/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Feb 29 17:06:43 EET 2016
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/RajawaliVR/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/RajawaliVR/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'signing'
3 |
4 | group = GROUP
5 | version = VERSION_NAME
6 | status = 'debug'
7 |
8 | android {
9 | compileSdkVersion 23
10 | buildToolsVersion "23.0.2"
11 |
12 | defaultConfig {
13 | minSdkVersion 16
14 | targetSdkVersion 23
15 | versionCode 1
16 | versionName "1.0"
17 | }
18 | buildTypes {
19 | release {
20 | status = 'release'
21 | }
22 | }
23 | sourceSets {
24 | main {
25 | jniLibs.srcDir new File(buildDir, 'native-libs')
26 | }
27 | }
28 | }
29 |
30 | dependencies {
31 | compile fileTree(dir: 'libs', include: ['*.jar'])
32 | compile project.depRajawali
33 | compile 'com.android.support:appcompat-v7:23.1.1'
34 | }
35 |
36 | task copyNativeLibs(type: Copy) {
37 | from(new File(project(':rajawalivr').getProjectDir(), 'libs')) { include '**/*.so' }
38 | into new File(buildDir, 'native-libs')
39 | }
40 |
41 | tasks.withType(JavaCompile) {
42 | compileTask -> compileTask.dependsOn copyNativeLibs
43 | }
44 |
45 | clean.dependsOn 'cleanCopyNativeLibs'
46 |
47 | apply from: 'maven_push.gradle'
48 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/gradle.properties:
--------------------------------------------------------------------------------
1 | VERSION_NAME = 1.0.0-SNAPSHOT
2 | VERSION_CODE = 1
3 | GROUP = org.rajawali3d.vr
4 |
5 | POM_NAME=RajawaliVR
6 | POM_ARTIFACT_ID=rajawalivr
7 | POM_PACKAGING=aar
8 | POM_DESCRIPTION=Android OpenGL ES 2.0 Engine, Cardboard Binding
9 | POM_URL=https://github.com/Rajawali/RajawaliVR
10 | POM_SCM_URL=https://github.com/Rajawali/RajawaliVR.git
11 | POM_SCM_CONNECTION=scm:git@github.com:MasDennis/RajawaliVR.git
12 | POM_SCM_DEV_CONNECTION=scm:git@github.com:MasDennis/RajawaliVR.git
13 | POM_LICENCE_NAME=The Apache Software License, Version 2.0
14 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
15 | POM_LICENCE_DIST=repo
16 | POM_DEVELOPER_ID=MasDennis
17 | POM_DEVELOPER_NAME=Dennis Ippel
18 | POM_DEVELOPER_EMAIL=info@rozengain.com
19 | POM_DEVELOPER_ORGANIZATION=Rajawali
20 | POM_DEVELOPER_ORGANIZATION_URL=https://plus.google.com/u/0/communities/116529974266844528013
21 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/libs/armeabi-v7a/libvraudio_engine.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVR/rajawalivr/libs/armeabi-v7a/libvraudio_engine.so
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/libs/armeabi-v7a/libvrtoolkit.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVR/rajawalivr/libs/armeabi-v7a/libvrtoolkit.so
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/libs/audio.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVR/rajawalivr/libs/audio.jar
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/libs/cardboard.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVR/rajawalivr/libs/cardboard.jar
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/maven_push.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'maven'
2 | apply plugin: 'signing'
3 |
4 | def getRepositoryUsername() {
5 | return hasProperty('sonatype_user') ? sonatype_user : ""
6 | }
7 |
8 | def getRepositoryPassword() {
9 | return hasProperty('sonatype_pass') ? sonatype_pass : ""
10 | }
11 |
12 | boolean isRelease() {
13 | return VERSION_NAME.contains("SNAPSHOT") == false
14 | }
15 |
16 | afterEvaluate { project ->
17 | uploadArchives {
18 | repositories {
19 | mavenDeployer {
20 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
21 |
22 | pom.artifactId = POM_ARTIFACT_ID
23 |
24 | repository(url: isRelease() ? "https://oss.sonatype.org/service/local/staging/deploy/maven2/" : mavenLocal().url) {
25 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
26 | }
27 |
28 | snapshotRepository(url: isRelease() ? "https://oss.sonatype.org/content/repositories/snapshots" : mavenLocal().url) {
29 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
30 | }
31 |
32 | pom.project {
33 | name POM_NAME
34 | packaging POM_PACKAGING
35 | description POM_DESCRIPTION
36 | url POM_URL
37 |
38 | scm {
39 | url POM_SCM_URL
40 | connection POM_SCM_CONNECTION
41 | developerConnection POM_SCM_DEV_CONNECTION
42 | }
43 |
44 | licenses {
45 | license {
46 | name POM_LICENCE_NAME
47 | url POM_LICENCE_URL
48 | distribution POM_LICENCE_DIST
49 | }
50 | }
51 |
52 | developers {
53 | developer {
54 | id POM_DEVELOPER_ID
55 | name POM_DEVELOPER_NAME
56 | email POM_DEVELOPER_EMAIL
57 | organization POM_DEVELOPER_ORGANIZATION
58 | organizationUrl POM_DEVELOPER_ORGANIZATION_URL
59 | }
60 | }
61 | }
62 | }
63 | }
64 | }
65 |
66 | signing {
67 | required { isRelease() && gradle.taskGraph.hasTask("uploadArchives") }
68 | sign configurations.archives
69 | }
70 |
71 | task androidJavadocs(type: Javadoc) {
72 | source = android.sourceSets.main.java.sourceFiles
73 | }
74 |
75 | task androidJavadocsJar(type: Jar) {
76 | classifier = 'javadoc'
77 | from androidJavadocs.destinationDir
78 | }
79 |
80 | task androidSourcesJar(type: Jar) {
81 | classifier = 'sources'
82 | from android.sourceSets.main.java.sourceFiles
83 | }
84 |
85 | artifacts {
86 | archives androidSourcesJar
87 | archives androidJavadocsJar
88 | }
89 | }
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /home/dennis/Android/Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/src/androidTest/java/vr/rajawali3d/org/rajawalivr/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package vr.rajawali3d.org.rajawalivr;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/src/main/java/org/rajawali3d/vr/RajawaliVRActivity.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2015 Dennis Ippel
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 | * the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 | * specific language governing permissions and limitations under the License.
12 | */
13 | package org.rajawali3d.vr;
14 |
15 | import android.app.ActionBar;
16 | import android.hardware.SensorManager;
17 | import android.os.Bundle;
18 | import android.view.Display;
19 | import android.view.View;
20 | import android.view.ViewGroup;
21 | import android.view.WindowManager;
22 |
23 | import com.google.vrtoolkit.cardboard.CardboardActivity;
24 | import com.google.vrtoolkit.cardboard.CardboardView;
25 |
26 | import org.rajawali3d.vr.renderer.RajawaliVRRenderer;
27 | import org.rajawali3d.vr.surface.RajawaliVRSurfaceView;
28 |
29 | /**
30 | * @author dennis.ippel
31 | */
32 | public class RajawaliVRActivity extends CardboardActivity {
33 | private CardboardView mSurfaceView;
34 |
35 | @Override
36 | public void onCreate(Bundle savedInstanceState) {
37 | super.onCreate(savedInstanceState);
38 |
39 | mSurfaceView = new CardboardView(this);
40 |
41 | addContentView(mSurfaceView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT));
42 |
43 | mSurfaceView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
44 | | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
45 | | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
46 | | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
47 | | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
48 | | View.SYSTEM_UI_FLAG_IMMERSIVE);
49 |
50 | setCardboardView(mSurfaceView);
51 | }
52 |
53 | protected void setRenderer(RajawaliVRRenderer renderer) {
54 | mSurfaceView.setRenderer(renderer);
55 | }
56 |
57 | public CardboardView getSurfaceView() {
58 | return mSurfaceView;
59 | }
60 |
61 | @Override
62 | public void onResume() {
63 | super.onResume();
64 | }
65 |
66 | @Override
67 | public void onPause() {
68 | super.onPause();
69 | }
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/src/main/java/org/rajawali3d/vr/materials/shaders/HotspotFragmentShader.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2015 Dennis Ippel
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 | * the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 | * specific language governing permissions and limitations under the License.
12 | */
13 |
14 | package org.rajawali3d.vr.materials.shaders;
15 |
16 | import android.graphics.Color;
17 | import android.opengl.GLES20;
18 |
19 | import org.rajawali3d.materials.shaders.FragmentShader;
20 | import org.rajawali3d.math.vector.Vector2;
21 |
22 | /**
23 | * @author dennis.ippel
24 | */
25 | public class HotspotFragmentShader extends FragmentShader {
26 | private RFloat mcPI;
27 | private RFloat mcTwoPI;
28 |
29 | private RVec2 muCircleCenter;
30 | private RVec2 mvTextureCoord;
31 |
32 | private RVec4 muTrackColor;
33 | private RVec4 muProgressColor;
34 |
35 | private RFloat muCircleRadius;
36 | private RFloat muBorderThickness;
37 | private RFloat muTextureRotationSpeed;
38 | private RFloat muProgress;
39 | private RFloat muTime;
40 |
41 | private RSampler2D muTexture;
42 |
43 | private float[] mCircleCenter = new float[] { 0.5f, 0.5f };
44 | private float[] mTrackColor = new float[] { 0.7f, 0.7f, 0.7f, 1.0f };
45 | private float[] mProgressColor = new float[] { 1.0f, 1.0f, 1.0f, 1.0f };
46 |
47 | private float mCircleRadius = 0.4f;
48 | private float mBorderThickness = 0.05f;
49 | private float mTextureRotationSpeed = 2.0f;
50 | private float mProgress;
51 |
52 | private int muCircleCenterHandle;
53 | private int muTrackColorHandle;
54 | private int muProgressColorHandle;
55 | private int muCircleRadiusHandle;
56 | private int muBorderThicknessHandle;
57 | private int muTextureRotationSpeedHandle;
58 | private int muProgressHandle;
59 | private int muTextureHandle;
60 |
61 | private boolean mUseTexture;
62 | private boolean mDiscardAlpha;
63 |
64 | public HotspotFragmentShader(boolean useTexture) {
65 | this(useTexture, false);
66 | }
67 |
68 | public HotspotFragmentShader(boolean useTexture, boolean discardalpha) {
69 | super();
70 |
71 | mUseTexture = useTexture;
72 | mDiscardAlpha = discardalpha;
73 |
74 | initialize();
75 | }
76 |
77 | @Override
78 | public void initialize() {
79 | super.initialize();
80 |
81 | addPrecisionQualifier(DataType.FLOAT, Precision.MEDIUMP);
82 |
83 | mcPI = (RFloat) addConst("PI", Math.PI);
84 | mcTwoPI = (RFloat) addConst("TWO_PI", Math.PI * 2.0);
85 |
86 | mvTextureCoord = (RVec2) addVarying(DefaultShaderVar.V_TEXTURE_COORD);
87 |
88 | muCircleCenter = (RVec2) addUniform("uCircleCenter", DataType.VEC2);
89 |
90 | muTrackColor = (RVec4) addUniform("uTrackColor", DataType.VEC4);
91 | muProgressColor = (RVec4) addUniform("uProgressColor", DataType.VEC4);
92 |
93 | muCircleRadius = (RFloat) addUniform("uCircleRadius", DataType.FLOAT);
94 | muBorderThickness = (RFloat) addUniform("uBorderThickness", DataType.FLOAT);
95 | muProgress = (RFloat) addUniform("uProgress", DataType.FLOAT);
96 |
97 | muTime = (RFloat) addUniform(DefaultShaderVar.U_TIME);
98 |
99 | muTexture = (RSampler2D) addUniform("uProgressTexture", DataType.SAMPLER2D);
100 |
101 | if(mUseTexture)
102 | muTextureRotationSpeed = (RFloat) addUniform("uTextureRotationSpeed", DataType.FLOAT);
103 | }
104 |
105 | @Override
106 | public void main() {
107 | // vec2 uv = fragCoord.xy / iResolution.xy;
108 | RVec2 uv = new RVec2("uv", mvTextureCoord);
109 | // float circleBorderHalf = circleBorder * 0.5;
110 | RFloat circleBorderHalf = new RFloat("circleBorderHalf");
111 | circleBorderHalf.assign(muBorderThickness.multiply(0.5f));
112 |
113 | // float dist = distance(uv, circleCenter);
114 | ShaderVar dist = distance(uv, muCircleCenter);
115 |
116 | RVec4 outColor = new RVec4("outColor", new RVec4("vec4(0.0)"));
117 | //outColor.a().assign(0.0f);
118 |
119 | if(mUseTexture) {
120 | // float yScale = sin(iGlobalTime * textureRotationSpeed) * 0.5 + 0.5;
121 | ShaderVar yScale = sin(muTime.multiply(muTextureRotationSpeed)).multiply(0.5f).add(0.5f);
122 | RFloat one = new RFloat("one", new RFloat(1.0f));
123 | //one.assign(1.0f);
124 | // vec2 uvAnim = vec2(uv.x, uv.y - 0.5);
125 | RVec2 uvAnim = new RVec2("uvAnim", new RVec2("vec2(0.0)"));
126 | uvAnim.x().assign(uv.x());
127 | uvAnim.y().assign(uv.y().subtract(0.5f));
128 | // uvAnim.y *= 1.0 / yScale;
129 | uvAnim.y().assignMultiply(one.divide(yScale));
130 | // uvAnim.y += 0.5;
131 | uvAnim.y().assignAdd(0.5f);
132 | // outColor = texture2D(iChannel0, uvAnim);
133 | RVec4 color = (RVec4)getGlobal(DefaultShaderVar.G_COLOR);
134 | outColor.assign(texture2D(muTexture, uvAnim));
135 | }
136 |
137 | // if(dist < circleRadius + circleBorderHalf && dist > circleRadius - circleBorderHalf) {
138 | startif(
139 | new Condition(dist, Operator.LESS_THAN, muCircleRadius.add(circleBorderHalf)),
140 | new Condition(Operator.AND, dist, Operator.GREATER_THAN, muCircleRadius.subtract(circleBorderHalf))
141 | );
142 | {
143 | // outColor = trackColor;
144 | outColor.assign(muTrackColor);
145 | // float startAngle = 0.0;
146 | RFloat startAngle = new RFloat("startAngle", new RFloat(0));
147 | // float endAngle = startAngle + mod(iGlobalTime * 2.0, PI_2);
148 | RFloat endAngle = new RFloat("endAngle", startAngle.add(muProgress.multiply(mcTwoPI)));
149 | // uv -= circleCenter;
150 | uv.assignSubtract(muCircleCenter);
151 | // float angle = -1.0 * atan(uv.y, uv.x) + PI;
152 | RFloat angle = new RFloat("angle", atan(uv.y(), uv.x()).multiply(-1));
153 | angle.assignAdd(mcPI);
154 |
155 | // if(angle >= startAngle && angle <= endAngle) {
156 | startif(new Condition(angle, Operator.GREATER_THAN_EQUALS, startAngle),
157 | new Condition(Operator.AND, angle, Operator.LESS_THAN_EQUALS, endAngle));
158 | {
159 | // outColor = progressColor;
160 | outColor.assign(muProgressColor);
161 | }
162 | endif();
163 | }
164 | endif();
165 |
166 | if(mDiscardAlpha) {
167 | startif(new Condition(outColor.a(), Operator.EQUALS, 0));
168 | {
169 | discard();
170 | }
171 | endif();
172 | }
173 |
174 | // fragColor = outColor;
175 | GL_FRAG_COLOR.assign(outColor.getName());
176 | }
177 |
178 | @Override
179 | public void setLocations(final int programHandle) {
180 | super.setLocations(programHandle);
181 |
182 | muCircleCenterHandle = getUniformLocation(programHandle, "uCircleCenter");
183 | muTrackColorHandle = getUniformLocation(programHandle, "uTrackColor");
184 | muProgressColorHandle = getUniformLocation(programHandle, "uProgressColor");
185 | muCircleRadiusHandle = getUniformLocation(programHandle, "uCircleRadius");
186 | muBorderThicknessHandle = getUniformLocation(programHandle, "uBorderThickness");
187 | muTextureRotationSpeedHandle = getUniformLocation(programHandle, "uTextureRotationSpeed");
188 | muProgressHandle = getUniformLocation(programHandle, "uProgress");
189 | muTextureHandle = getUniformLocation(programHandle, "uProgressTexture");
190 | }
191 |
192 | @Override
193 | public void applyParams() {
194 | super.applyParams();
195 |
196 | GLES20.glUniform2fv(muCircleCenterHandle, 1, mCircleCenter, 0);
197 | GLES20.glUniform4fv(muTrackColorHandle, 1, mTrackColor, 0);
198 | GLES20.glUniform4fv(muProgressColorHandle, 1, mProgressColor, 0);
199 | GLES20.glUniform1f(muCircleRadiusHandle, mCircleRadius);
200 | GLES20.glUniform1f(muBorderThicknessHandle, mBorderThickness);
201 | GLES20.glUniform1f(muTextureRotationSpeedHandle, mTextureRotationSpeed);
202 | GLES20.glUniform1f(muProgressHandle, mProgress);
203 | }
204 |
205 | public void setCircleCenter(Vector2 center) {
206 | mCircleCenter[0] = (float)center.getX();
207 | mCircleCenter[1] = (float)center.getY();
208 | }
209 |
210 | public void setTrackColor(int color) {
211 | mTrackColor[0] = (float) Color.red(color) / 255.f;
212 | mTrackColor[1] = (float) Color.green(color) / 255.f;
213 | mTrackColor[2] = (float) Color.blue(color) / 255.f;
214 | mTrackColor[3] = (float) Color.alpha(color) / 255.f;
215 | }
216 |
217 | public void setProgressColor(int color) {
218 | mProgressColor[0] = (float) Color.red(color) / 255.f;
219 | mProgressColor[1] = (float) Color.green(color) / 255.f;
220 | mProgressColor[2] = (float) Color.blue(color) / 255.f;
221 | mProgressColor[3] = (float) Color.alpha(color) / 255.f;
222 | }
223 |
224 | public void setCircleRadius(float circleRadius) {
225 | mCircleRadius = circleRadius;
226 | }
227 |
228 | public void setBorderThickness(float borderThickness) {
229 | mBorderThickness = borderThickness;
230 | }
231 |
232 | public void setTextureRotationSpeed(float textureRotationSpeed) {
233 | mTextureRotationSpeed = textureRotationSpeed;
234 | }
235 |
236 | public void setProgress(float progress) {
237 | mProgress = progress;
238 | }
239 |
240 | public float getProgress() {
241 | return mProgress;
242 | }
243 | }
244 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/src/main/java/org/rajawali3d/vr/materials/shaders/HotspotMaterial.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2015 Dennis Ippel
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 | * the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 | * specific language governing permissions and limitations under the License.
12 | */
13 |
14 | package org.rajawali3d.vr.materials.shaders;
15 |
16 | import org.rajawali3d.materials.Material;
17 | import org.rajawali3d.materials.shaders.VertexShader;
18 | import org.rajawali3d.math.vector.Vector2;
19 | import org.rajawali3d.vr.R;
20 |
21 | /**
22 | * @author dennis.ippel
23 | */
24 | public class HotspotMaterial extends Material {
25 | private HotspotFragmentShader mHotspotShader;
26 |
27 | public HotspotMaterial(boolean useTexture) {
28 | this(useTexture, false);
29 | }
30 |
31 | public HotspotMaterial(boolean useTexture, boolean discardAlpha) {
32 | super(new VertexShader(R.raw.minimal_vertex_shader), new HotspotFragmentShader(useTexture, discardAlpha));
33 | mHotspotShader = (HotspotFragmentShader)mCustomFragmentShader;
34 | }
35 |
36 | public void setCircleCenter(Vector2 center) {
37 | mHotspotShader.setCircleCenter(center);
38 | }
39 |
40 | public void setTrackColor(int color) {
41 | mHotspotShader.setTrackColor(color);
42 | }
43 |
44 | public void setProgressColor(int color) {
45 | mHotspotShader.setProgressColor(color);
46 | }
47 |
48 | public void setCircleRadius(float circleRadius) {
49 | mHotspotShader.setCircleRadius(circleRadius);
50 | }
51 |
52 | public void setBorderThickness(float borderThickness) {
53 | mHotspotShader.setBorderThickness(borderThickness);
54 | }
55 |
56 | public void setTextureRotationSpeed(float textureRotationSpeed) {
57 | mHotspotShader.setTextureRotationSpeed(textureRotationSpeed);
58 | }
59 |
60 | public void setProgress(float progress) {
61 | mHotspotShader.setProgress(progress);
62 | }
63 |
64 | public float getProgress() {
65 | return mHotspotShader.getProgress();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/src/main/java/org/rajawali3d/vr/renderer/RajawaliVRRenderer.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2015 Dennis Ippel
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 | * the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 | * specific language governing permissions and limitations under the License.
12 | */
13 |
14 | package org.rajawali3d.vr.renderer;
15 |
16 | import android.content.Context;
17 | import android.view.MotionEvent;
18 |
19 | import com.google.vrtoolkit.cardboard.CardboardView;
20 | import com.google.vrtoolkit.cardboard.Eye;
21 | import com.google.vrtoolkit.cardboard.HeadTransform;
22 | import com.google.vrtoolkit.cardboard.Viewport;
23 |
24 | import org.rajawali3d.Object3D;
25 | import org.rajawali3d.math.Matrix4;
26 | import org.rajawali3d.math.Quaternion;
27 | import org.rajawali3d.math.vector.Vector3;
28 | import org.rajawali3d.renderer.RajawaliRenderer;
29 |
30 | import javax.microedition.khronos.egl.EGLConfig;
31 |
32 | /**
33 | * @author dennis.ippel
34 | */
35 | public class RajawaliVRRenderer extends RajawaliRenderer implements CardboardView.StereoRenderer {
36 | private static final float MAX_LOOKAT_ANGLE = 10;
37 |
38 | protected Matrix4 mCurrentEyeMatrix;
39 | protected Matrix4 mHeadViewMatrix;
40 | protected Quaternion mCurrentEyeOrientation;
41 | protected Quaternion mHeadViewQuaternion;
42 | protected Vector3 mCameraPosition;
43 | private Vector3 mForwardVec;
44 | private Vector3 mHeadTranslation;
45 |
46 |
47 | private Matrix4 mLookingAtMatrix;
48 | private float[] mHeadView;
49 |
50 | public RajawaliVRRenderer(Context context) {
51 | super(context);
52 | mCurrentEyeMatrix = new Matrix4();
53 | mHeadViewMatrix = new Matrix4();
54 | mLookingAtMatrix = new Matrix4();
55 | mCurrentEyeOrientation = new Quaternion();
56 | mHeadViewQuaternion = new Quaternion();
57 | mHeadView = new float[16];
58 | mCameraPosition = new Vector3();
59 | mForwardVec = new Vector3();
60 | mHeadTranslation = new Vector3();
61 | }
62 |
63 | @Override
64 | public void initScene() {
65 |
66 | }
67 |
68 | @Override
69 | public void onRender(long elapsedTime, double deltaTime) {
70 | super.onRender(elapsedTime, deltaTime);
71 | }
72 |
73 | @Override
74 | public void onOffsetsChanged(float v, float v2, float v3, float v4, int i, int i2) {
75 |
76 | }
77 |
78 | @Override
79 | public void onTouchEvent(MotionEvent motionEvent) {
80 |
81 | }
82 |
83 | @Override
84 | public void onNewFrame(HeadTransform headTransform) {
85 | headTransform.getHeadView(mHeadView, 0);
86 | mHeadViewMatrix.setAll(mHeadView);
87 | }
88 |
89 | @Override
90 | public void onDrawEye(Eye eye) {
91 | getCurrentCamera().updatePerspective(
92 | eye.getFov().getLeft(),
93 | eye.getFov().getRight(),
94 | eye.getFov().getBottom(),
95 | eye.getFov().getTop());
96 | mCurrentEyeMatrix.setAll(eye.getEyeView());
97 | mCurrentEyeOrientation.fromMatrix(mCurrentEyeMatrix);
98 | getCurrentCamera().setOrientation(mCurrentEyeOrientation);
99 | getCurrentCamera().setPosition(mCameraPosition);
100 | getCurrentCamera().getPosition().add(mCurrentEyeMatrix.getTranslation().inverse());
101 | super.onRenderFrame(null);
102 | }
103 |
104 | @Override
105 | public void onFinishFrame(Viewport viewport) {
106 |
107 | }
108 |
109 | @Override
110 | public void onSurfaceChanged(int width, int height) {
111 | super.onRenderSurfaceSizeChanged(null, width, height);
112 | }
113 |
114 | @Override
115 | public void onSurfaceCreated(EGLConfig eglConfig) {
116 | super.onRenderSurfaceCreated(eglConfig, null, -1, -1);
117 | }
118 |
119 | @Override
120 | public void onRendererShutdown() {
121 | super.onRenderSurfaceDestroyed(null);
122 | }
123 |
124 | public boolean isLookingAtObject(Object3D target) {
125 | return this.isLookingAtObject(target, MAX_LOOKAT_ANGLE);
126 | }
127 |
128 | public boolean isLookingAtObject(Object3D target, float maxAngle) {
129 | mHeadViewQuaternion.fromMatrix(mHeadViewMatrix);
130 | mHeadViewQuaternion.inverse();
131 | mForwardVec.setAll(0, 0, 1);
132 | mForwardVec.transform(mHeadViewQuaternion);
133 |
134 | mHeadTranslation.setAll(mHeadViewMatrix.getTranslation());
135 | mHeadTranslation.subtract(target.getPosition());
136 | mHeadTranslation.normalize();
137 |
138 | return mHeadTranslation.angle(mForwardVec) < maxAngle;
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/src/main/java/org/rajawali3d/vr/surface/RajawaliVRSurfaceView.java:
--------------------------------------------------------------------------------
1 | package org.rajawali3d.vr.surface;
2 |
3 | /**
4 | * Copyright 2015 Dennis Ippel
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
12 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | * specific language governing permissions and limitations under the License.
14 | */
15 |
16 | import android.content.Context;
17 | import android.graphics.PixelFormat;
18 | import android.util.AttributeSet;
19 | import android.view.View;
20 |
21 | import com.google.vrtoolkit.cardboard.CardboardView;
22 |
23 | import org.rajawali3d.surface.IRajawaliSurface;
24 | import org.rajawali3d.surface.IRajawaliSurfaceRenderer;
25 | import org.rajawali3d.util.Capabilities;
26 | import org.rajawali3d.util.egl.RajawaliEGLConfigChooser;
27 |
28 | /**
29 | *
30 | */
31 | public class RajawaliVRSurfaceView extends CardboardView implements IRajawaliSurface {
32 |
33 | public RajawaliVRSurfaceView(Context context) {
34 | super(context);
35 | }
36 |
37 | public RajawaliVRSurfaceView(Context context, AttributeSet attrs)
38 | {
39 | super(context, attrs);
40 | }
41 |
42 | @Override
43 | protected void onVisibilityChanged(View changedView, int visibility) {
44 | if (visibility == View.GONE || visibility == View.INVISIBLE) {
45 | onPause();
46 | } else {
47 | onResume();
48 | }
49 | super.onVisibilityChanged(changedView, visibility);
50 | }
51 |
52 | @Override
53 | protected void onAttachedToWindow() {
54 | super.onAttachedToWindow();
55 | onResume();
56 | }
57 |
58 | @Override
59 | public void setFrameRate(double v) {
60 |
61 | }
62 |
63 | @Override
64 | public void setAntiAliasingMode(ANTI_ALIASING_CONFIG anti_aliasing_config) {
65 |
66 | }
67 |
68 | @Override
69 | public void setSampleCount(int i) {
70 |
71 | }
72 |
73 | @Override
74 | public void setSurfaceRenderer(IRajawaliSurfaceRenderer iRajawaliSurfaceRenderer) throws IllegalStateException {
75 |
76 | }
77 |
78 | @Override
79 | public void requestRenderUpdate() {
80 | requestRender();
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/RajawaliVR/rajawalivr/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RajawaliVR
3 |
4 |
--------------------------------------------------------------------------------
/RajawaliVR/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':rajawalivr'
2 |
--------------------------------------------------------------------------------
/RajawaliVRExample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/RajawaliVRExample/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 | defaultConfig {
7 | applicationId 'org.rajawali3d.vr.example2'
8 | minSdkVersion 16
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | productFlavors {
20 | }
21 | }
22 |
23 | dependencies {
24 | compile fileTree(dir: 'libs', include: ['*.jar'])
25 | compile 'com.android.support:appcompat-v7:23.2.0'
26 | compile 'org.rajawali3d.vr:rajawalivr:1.0.0-SNAPSHOT'
27 | }
28 |
--------------------------------------------------------------------------------
/RajawaliVRExample/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /home/dennis/Android/Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
19 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/assets/sonar.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/assets/sonar.wav
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/assets/spaceship.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/assets/spaceship.wav
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/java/org/rajawali3d/vr/example/RajawaliVRExampleActivity.java:
--------------------------------------------------------------------------------
1 | package org.rajawali3d.vr.example;
2 |
3 | import org.rajawali3d.util.RajLog;
4 | import org.rajawali3d.vr.RajawaliVRActivity;
5 | import android.content.pm.ActivityInfo;
6 | import android.os.Bundle;
7 | import android.view.Window;
8 | import android.view.WindowManager;
9 |
10 | public class RajawaliVRExampleActivity extends RajawaliVRActivity {
11 | private RajawaliVRExampleRenderer mRenderer;
12 |
13 | @Override
14 | public void onCreate(Bundle savedInstanceState) {
15 | requestWindowFeature(Window.FEATURE_NO_TITLE);
16 | getWindow().setFlags(
17 | WindowManager.LayoutParams.FLAG_FULLSCREEN
18 | | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
19 | WindowManager.LayoutParams.FLAG_FULLSCREEN
20 | | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
21 |
22 | super.onCreate(savedInstanceState);
23 |
24 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
25 |
26 | mRenderer = new RajawaliVRExampleRenderer(this);
27 | setRenderer(mRenderer);
28 |
29 | setConvertTapIntoTrigger(true);
30 | }
31 |
32 | /**
33 | * Called when the Cardboard trigger is pulled.
34 | */
35 | @Override
36 | public void onCardboardTrigger() {
37 | RajLog.i("onCardboardTrigger");
38 | }
39 |
40 | @Override
41 | public void onPause() {
42 | mRenderer.pauseAudio();
43 | super.onPause();
44 | }
45 |
46 | @Override
47 | public void onResume() {
48 | super.onResume();
49 | mRenderer.resumeAudio();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/java/org/rajawali3d/vr/example/RajawaliVRExampleRenderer.java:
--------------------------------------------------------------------------------
1 | package org.rajawali3d.vr.example;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapFactory;
6 | import android.graphics.Color;
7 |
8 | import com.google.vrtoolkit.cardboard.audio.CardboardAudioEngine;
9 |
10 | import org.rajawali3d.Object3D;
11 | import org.rajawali3d.animation.Animation.RepeatMode;
12 | import org.rajawali3d.animation.SplineTranslateAnimation3D;
13 | import org.rajawali3d.curves.CatmullRomCurve3D;
14 | import org.rajawali3d.lights.DirectionalLight;
15 | import org.rajawali3d.loader.LoaderAWD;
16 | import org.rajawali3d.materials.Material;
17 | import org.rajawali3d.materials.methods.DiffuseMethod;
18 | import org.rajawali3d.materials.textures.ATexture.TextureException;
19 | import org.rajawali3d.materials.textures.NormalMapTexture;
20 | import org.rajawali3d.materials.textures.Texture;
21 | import org.rajawali3d.math.vector.Vector3;
22 | import org.rajawali3d.primitives.Sphere;
23 | import org.rajawali3d.terrain.SquareTerrain;
24 | import org.rajawali3d.terrain.TerrainGenerator;
25 | import org.rajawali3d.vr.renderer.RajawaliVRRenderer;
26 |
27 | public class RajawaliVRExampleRenderer extends RajawaliVRRenderer {
28 | private SquareTerrain terrain;
29 | private Sphere lookatSphere;
30 | private Object3D capital;
31 | private CardboardAudioEngine cardboardAudioEngine;
32 | private volatile int spaceShipSoundId = CardboardAudioEngine.INVALID_ID;
33 | private volatile int sonarSoundId = CardboardAudioEngine.INVALID_ID;
34 |
35 | public RajawaliVRExampleRenderer(Context context) {
36 | super(context);
37 | }
38 |
39 | @Override
40 | public void initScene() {
41 | DirectionalLight light = new DirectionalLight(0.2f, -1f, 0f);
42 | light.setPower(.7f);
43 | getCurrentScene().addLight(light);
44 |
45 | light = new DirectionalLight(0.2f, 1f, 0f);
46 | light.setPower(1f);
47 | getCurrentScene().addLight(light);
48 |
49 | getCurrentCamera().setFarPlane(1000);
50 |
51 | getCurrentScene().setBackgroundColor(0xdddddd);
52 |
53 | createTerrain();
54 |
55 | try {
56 | getCurrentScene().setSkybox(R.drawable.posx, R.drawable.negx, R.drawable.posy, R.drawable.negy, R.drawable.posz, R.drawable.negz);
57 |
58 | LoaderAWD loader = new LoaderAWD(getContext().getResources(), getTextureManager(), R.raw.space_cruiser);
59 | loader.parse();
60 |
61 | Material cruiserMaterial = new Material();
62 | cruiserMaterial.setDiffuseMethod(new DiffuseMethod.Lambert());
63 | cruiserMaterial.setColorInfluence(0);
64 | cruiserMaterial.enableLighting(true);
65 | cruiserMaterial.addTexture(new Texture("spaceCruiserTex", R.drawable.space_cruiser_4_color_1));
66 |
67 | Object3D spaceCruiser = loader.getParsedObject();
68 | spaceCruiser.setMaterial(cruiserMaterial);
69 | spaceCruiser.setZ(-6);
70 | spaceCruiser.setY(1);
71 | getCurrentScene().addChild(spaceCruiser);
72 |
73 | spaceCruiser = spaceCruiser.clone(true);
74 | spaceCruiser.setZ(-12);
75 | spaceCruiser.setY(-3);
76 | spaceCruiser.setRotY(180);
77 | getCurrentScene().addChild(spaceCruiser);
78 |
79 | loader = new LoaderAWD(getContext().getResources(), getTextureManager(), R.raw.dark_fighter);
80 | loader.parse();
81 |
82 | Material darkFighterMaterial = new Material();
83 | darkFighterMaterial.setDiffuseMethod(new DiffuseMethod.Lambert());
84 | darkFighterMaterial.setColorInfluence(0);
85 | darkFighterMaterial.enableLighting(true);
86 | darkFighterMaterial.addTexture(new Texture("darkFighterTex", R.drawable.dark_fighter_6_color));
87 |
88 | Object3D darkFighter = loader.getParsedObject();
89 | darkFighter.setMaterial(darkFighterMaterial);
90 | darkFighter.setZ(-6);
91 | getCurrentScene().addChild(darkFighter);
92 |
93 | CatmullRomCurve3D path = new CatmullRomCurve3D();
94 | path.addPoint(new Vector3(0, -5, -10));
95 | path.addPoint(new Vector3(10, -5, 0));
96 | path.addPoint(new Vector3(0, -4, 8));
97 | path.addPoint(new Vector3(-16, -6, 0));
98 | path.isClosedCurve(true);
99 |
100 | SplineTranslateAnimation3D anim = new SplineTranslateAnimation3D(path);
101 | anim.setDurationMilliseconds(44000);
102 | anim.setRepeatMode(RepeatMode.INFINITE);
103 | // -- orient to path
104 | anim.setOrientToPath(true);
105 | anim.setTransformable3D(darkFighter);
106 | getCurrentScene().registerAnimation(anim);
107 | anim.play();
108 |
109 | loader = new LoaderAWD(getContext().getResources(), getTextureManager(), R.raw.capital);
110 | loader.parse();
111 |
112 | Material capitalMaterial = new Material();
113 | capitalMaterial.setDiffuseMethod(new DiffuseMethod.Lambert());
114 | capitalMaterial.setColorInfluence(0);
115 | capitalMaterial.enableLighting(true);
116 | capitalMaterial.addTexture(new Texture("capitalTex", R.drawable.hullw));
117 | capitalMaterial.addTexture(new NormalMapTexture("capitalNormTex", R.drawable.hulln));
118 |
119 | capital = loader.getParsedObject();
120 | capital.setMaterial(capitalMaterial);
121 | capital.setScale(18);
122 | getCurrentScene().addChild(capital);
123 |
124 | path = new CatmullRomCurve3D();
125 | path.addPoint(new Vector3(0, 13, 34));
126 | path.addPoint(new Vector3(34, 13, 0));
127 | path.addPoint(new Vector3(0, 13, -34));
128 | path.addPoint(new Vector3(-34, 13, 0));
129 | path.isClosedCurve(true);
130 |
131 | anim = new SplineTranslateAnimation3D(path);
132 | anim.setDurationMilliseconds(60000);
133 | anim.setRepeatMode(RepeatMode.INFINITE);
134 | anim.setOrientToPath(true);
135 | anim.setTransformable3D(capital);
136 | getCurrentScene().registerAnimation(anim);
137 | anim.play();
138 | } catch (Exception e) {
139 | e.printStackTrace();
140 | }
141 |
142 | lookatSphere = new Sphere(1, 12, 12);
143 | Material sphereMaterial = new Material();
144 | sphereMaterial.setDiffuseMethod(new DiffuseMethod.Lambert());
145 | sphereMaterial.enableLighting(true);
146 | lookatSphere.setMaterial(sphereMaterial);
147 | lookatSphere.setColor(Color.YELLOW);
148 | lookatSphere.setPosition(0, 0, -6);
149 | getCurrentScene().addChild(lookatSphere);
150 |
151 | initAudio();
152 |
153 | super.initScene();
154 | }
155 |
156 | private void initAudio() {
157 | cardboardAudioEngine =
158 | new CardboardAudioEngine(getContext().getAssets(), CardboardAudioEngine.RenderingQuality.HIGH);
159 |
160 | new Thread(
161 | new Runnable() {
162 | public void run() {
163 | cardboardAudioEngine.preloadSoundFile("spaceship.wav");
164 | spaceShipSoundId = cardboardAudioEngine.createSoundObject("spaceship.wav");
165 | cardboardAudioEngine.setSoundObjectPosition(
166 | spaceShipSoundId, (float)capital.getX(), (float)capital.getY(), (float)capital.getZ()
167 | );
168 | cardboardAudioEngine.playSound(spaceShipSoundId, true);
169 |
170 | cardboardAudioEngine.preloadSoundFile("sonar.wav");
171 | sonarSoundId = cardboardAudioEngine.createSoundObject("sonar.wav");
172 | cardboardAudioEngine.setSoundObjectPosition(
173 | sonarSoundId, (float) lookatSphere.getX(), (float) lookatSphere.getY(), (float) lookatSphere.getZ()
174 | );
175 | cardboardAudioEngine.playSound(sonarSoundId, true);
176 | }
177 | })
178 | .start();
179 | }
180 |
181 | public void pauseAudio() {
182 | if(cardboardAudioEngine != null) {
183 | cardboardAudioEngine.pause();
184 | }
185 | }
186 |
187 | public void resumeAudio() {
188 | if(cardboardAudioEngine != null) {
189 | cardboardAudioEngine.resume();
190 | }
191 | }
192 |
193 | public void createTerrain() {
194 | //
195 | // -- Load a bitmap that represents the terrain. Its color values will
196 | // be used to generate heights.
197 | //
198 |
199 | Bitmap bmp = BitmapFactory.decodeResource(getContext().getResources(),
200 | R.drawable.terrain);
201 |
202 | try {
203 | SquareTerrain.Parameters terrainParams = SquareTerrain.createParameters(bmp);
204 | // -- set terrain scale
205 | terrainParams.setScale(4f, 54f, 4f);
206 | // -- the number of plane subdivisions
207 | terrainParams.setDivisions(128);
208 | // -- the number of times the textures should be repeated
209 | terrainParams.setTextureMult(4);
210 | //
211 | // -- Terrain colors can be set by manually specifying base, middle and
212 | // top colors.
213 | //
214 | // -- terrainParams.setBasecolor(Color.argb(255, 0, 0, 0));
215 | // terrainParams.setMiddleColor(Color.argb(255, 200, 200, 200));
216 | // terrainParams.setUpColor(Color.argb(255, 0, 30, 0));
217 | //
218 | // -- However, for this example we'll use a bitmap
219 | //
220 | terrainParams.setColorMapBitmap(bmp);
221 | //
222 | // -- create the terrain
223 | //
224 | terrain = TerrainGenerator.createSquareTerrainFromBitmap(terrainParams, true);
225 | } catch (Exception e) {
226 | e.printStackTrace();
227 | }
228 |
229 | //
230 | // -- The bitmap won't be used anymore, so get rid of it.
231 | //
232 | bmp.recycle();
233 |
234 | //
235 | // -- A normal map material will give the terrain a bit more detail.
236 | //
237 | Material material = new Material();
238 | material.enableLighting(true);
239 | material.useVertexColors(true);
240 | material.setDiffuseMethod(new DiffuseMethod.Lambert());
241 | try {
242 | Texture groundTexture = new Texture("ground", R.drawable.ground);
243 | groundTexture.setInfluence(.5f);
244 | material.addTexture(groundTexture);
245 | material.addTexture(new NormalMapTexture("groundNormalMap", R.drawable.groundnor));
246 | material.setColorInfluence(0);
247 | } catch (TextureException e) {
248 | e.printStackTrace();
249 | }
250 |
251 | //
252 | // -- Blend the texture with the vertex colors
253 | //
254 | material.setColorInfluence(.5f);
255 | terrain.setY(-100);
256 | terrain.setMaterial(material);
257 |
258 | getCurrentScene().addChild(terrain);
259 | }
260 |
261 | @Override
262 | public void onRender(long elapsedTime, double deltaTime) {
263 | super.onRender(elapsedTime, deltaTime);
264 | boolean isLookingAt = isLookingAtObject(lookatSphere);
265 | if(isLookingAt) {
266 | lookatSphere.setColor(Color.RED);
267 | } else {
268 | lookatSphere.setColor(Color.YELLOW);
269 | }
270 |
271 | if(spaceShipSoundId != CardboardAudioEngine.INVALID_ID) {
272 | cardboardAudioEngine.setSoundObjectPosition(
273 | spaceShipSoundId, (float) capital.getX(), (float) capital.getY(), (float) capital.getZ());
274 | }
275 | if(sonarSoundId != CardboardAudioEngine.INVALID_ID) {
276 | cardboardAudioEngine.setSoundObjectPosition(
277 | sonarSoundId, (float) lookatSphere.getX(), (float) lookatSphere.getY(), (float) lookatSphere.getZ()
278 | );
279 | }
280 |
281 | cardboardAudioEngine.setHeadRotation(
282 | (float)mHeadViewQuaternion.x, (float)mHeadViewQuaternion.y, (float)mHeadViewQuaternion.z, (float)mHeadViewQuaternion.w);
283 | }
284 | }
285 |
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/dark_fighter_6_color.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/dark_fighter_6_color.png
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/ground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/ground.png
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/groundnor.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/groundnor.jpg
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/hulln.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/hulln.bmp
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/hullw.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/hullw.jpg
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/negx.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/negx.jpg
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/negy.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/negy.jpg
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/negz.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/negz.jpg
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/posx.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/posx.jpg
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/posy.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/posy.jpg
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/posz.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/posz.jpg
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/space_cruiser_4_color_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/space_cruiser_4_color_1.jpg
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/drawable-nodpi/terrain.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/drawable-nodpi/terrain.jpg
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/raw/capital.awd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/raw/capital.awd
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/raw/dark_fighter.awd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/raw/dark_fighter.awd
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/raw/space_cruiser.awd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/app/src/main/res/raw/space_cruiser.awd
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RajawaliVRExample
3 |
4 |
--------------------------------------------------------------------------------
/RajawaliVRExample/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/RajawaliVRExample/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | }
5 | dependencies {
6 | classpath 'com.android.tools.build:gradle:2.0.0-beta6'
7 | }
8 | }
9 |
10 | allprojects {
11 | repositories {
12 | mavenLocal()
13 | jcenter()
14 | maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/RajawaliVRExample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/RajawaliVRExample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Rajawali/RajawaliVR/64c895cff13d260049a301b9edc0119ba804dca7/RajawaliVRExample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/RajawaliVRExample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/RajawaliVRExample/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/RajawaliVRExample/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/RajawaliVRExample/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------