Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

Commit

Permalink
OVR Mobile SDK 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuya Matsuo committed Mar 30, 2017
1 parent aefd307 commit 4d9d8e6
Show file tree
Hide file tree
Showing 137 changed files with 5,361 additions and 4,890 deletions.
73 changes: 30 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,58 +1,45 @@
# OVR Mobile SDK
ovr_sdk_mobile/bin
ovr_sdk_mobile/gradle
ovr_sdk_mobile/sdcard_SDK
ovr_sdk_mobile/SourceAssets
ovr_sdk_mobile/Tools
ovr_sdk_mobile/VrCapture
ovr_sdk_mobile/VrSamples
ovr_sdk_mobile/gradlew*
ovr_sdk_mobile/*.gradle
ovr_sdk_mobile/*.apk
ovr_sdk_mobile/*.py
ovr_sdk_mobile/*.bat
ovr_sdk_mobile/*.json
ovr_sdk_mobile/*.properties
ovr_sdk_mobile/1stParty/OpenGL_Loader/Projects
ovr_sdk_mobile/LibOVRKernel/Projects
ovr_sdk_mobile/VrAppFramework/Libs/Android/aar
ovr_sdk_mobile/VrAppFramework/Projects
ovr_sdk_mobile/VrAppSupport/VrGUI
ovr_sdk_mobile/VrAppSupport/VrLocale
ovr_sdk_mobile/VrAppSupport/VrModel
ovr_sdk_mobile/VrAppSupport/VrSound

/////////////////////////
// Ignored Folders /
/////////////////////////
bin/
gen/
obj/
ovr_mobile_sdk/
.metadata/
.recommenders/
repository/

////////////////////////
// Ignored Extensions /
////////////////////////
*.prefs

/////////////////////////
// Ignored Files /
/////////////////////////

lint.xml
oculussig_*
proguard-project.txt

# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Gradle files
.gradle/
build/
/*/build/
.gradle/
.idea/

# OSIG files
oculussig_*

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log
libs/armeabi-v7a/
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
# Hidden files
.DS_Store
/build
/captures
*.iml
.idea/*
.*
2 changes: 1 addition & 1 deletion library/src/main/jni/GearVRActivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ovrFrameResult GearVRActivity::Frame(const ovrFrameInput &frame) {

frameParms = vrapi_DefaultFrameParms(java, VRAPI_FRAME_INIT_DEFAULT,
vrapi_GetTimeInSeconds(), nullptr);
ovrFrameLayer &layer = frameParms.Layers[VRAPI_FRAME_LAYER_TYPE_WORLD];
ovrFrameLayer &layer = frameParms.Layers[0];

for (int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; eye++) {
res.FrameMatrices.EyeView[eye] = vrapi_GetEyeViewMatrix(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../Include

LOCAL_STATIC_LIBRARIES := openglloader

# GL platform interface
LOCAL_EXPORT_LDLIBS += -lEGL

# NOTE: This check is added to prevent the following error when running a "make clean" where
# the prebuilt lib may have been deleted: "LOCAL_SRC_FILES points to a missing file"
ifneq (,$(wildcard $(LOCAL_PATH)/$(LOCAL_SRC_FILES)))
Expand Down
17 changes: 12 additions & 5 deletions ovr_sdk_mobile/Application.mk
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# Common build settings for all VR apps
ifeq ($(OVR_DEBUG),1)
BUILDTYPE := Debug
else
BUILDTYPE := Release
endif

# This needs to be defined to get the right header directories for egl / etc
APP_PLATFORM := android-19

# This needs to be defined to avoid compile errors like:
# Error: selected processor does not support ARM mode `ldrex r0,[r3]'
APP_ABI := armeabi-v7a
ifeq ($(OVR_TEST_ARM64),1)
# 32+64 bit support... experimental!
APP_ABI := armeabi-v7a,arm64-v8a
else
# 32-bit only mode
APP_ABI := armeabi-v7a
endif

# Statically link the GNU STL. This may not be safe for multi-so libraries but
# we don't know of any problems yet.
Expand All @@ -14,8 +23,6 @@ APP_STL := gnustl_static
# Make sure every shared lib includes a .note.gnu.build-id header, for crash reporting
APP_LDFLAGS := -Wl,--build-id

# Explicitly use GCC 4.9 as our toolchain. The previous default, 4.8, is
# deprecated as of r11.
NDK_TOOLCHAIN_VERSION := clang

# Define the directories for $(import-module, ...) to look in
Expand Down
398 changes: 221 additions & 177 deletions ovr_sdk_mobile/LICENSE.txt

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ include $(CLEAR_VARS)

LOCAL_MODULE := libovrkernel

LOCAL_SRC_FILES := ../../../Libs/Android/$(TARGET_ARCH_ABI)/libovrkernel.a
LOCAL_SRC_FILES := ../../../Libs/Android/$(TARGET_ARCH_ABI)/$(BUILDTYPE)/libovrkernel.a

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../Include \
$(LOCAL_PATH)/../../../Src

LOCAL_STATIC_LIBRARIES := openglloader

# NOTE: This check is added to prevent the following error when running a "make clean" where
# the prebuilt lib may have been deleted: "LOCAL_SRC_FILES points to a missing file"
ifneq (,$(wildcard $(LOCAL_PATH)/$(LOCAL_SRC_FILES)))
include $(PREBUILT_STATIC_LIBRARY)
endif
$(call import-module,1stParty/OpenGL_Loader/Projects/AndroidPrebuilt/jni)
40 changes: 38 additions & 2 deletions ovr_sdk_mobile/LibOVRKernel/Src/Android/JniUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ enum
ANDROID_KITKAT_WATCH = 20, // Build.VERSION_CODES.KITKAT_WATCH
ANDROID_LOLLIPOP = 21, // Build.VERSION_CODES.LOLLIPOP
ANDROID_LOLLIPOP_MR1 = 22, // Build.VERSION_CODES.LOLLIPOP_MR1
ANDROID_MARSHMALLOW = 23 // Build.VERSION_CODES.M
ANDROID_MARSHMALLOW = 23, // Build.VERSION_CODES.M
ANDROID_NOUGAT = 24, // Build.VERSION_CODES.N
};

int ovr_GetBuildVersionSDK( JNIEnv * jni );
Expand Down Expand Up @@ -105,7 +106,8 @@ class TempJniEnv
}
else
{
LOG( "Using caller's JNIEnv" );
// Current thread is attached to the VM.
//LOG( "Using caller's JNIEnv" );
}
}
~TempJniEnv()
Expand Down Expand Up @@ -188,6 +190,40 @@ class JavaClass : public JavaObject
jclass GetJClass() const { return static_cast< jclass >( GetJObject() ); }
};

#if defined( OVR_OS_ANDROID )
//==============================================================
// JavaFloatArray
//
// Releases a java float array local reference on destruction.
//==============================================================
class JavaFloatArray : public JavaObject
{
public:
JavaFloatArray( JNIEnv * jni_, jfloatArray const floatArray_ ) :
JavaObject( jni_, floatArray_ )
{
}

jfloatArray GetJFloatArray() const { return static_cast< jfloatArray >( GetJObject() ); }
};

//==============================================================
// JavaObjectArray
//
// Releases a java float array local reference on destruction.
//==============================================================
class JavaObjectArray : public JavaObject
{
public:
JavaObjectArray( JNIEnv * jni_, jobjectArray const floatArray_ ) :
JavaObject( jni_, floatArray_ )
{
}

jobjectArray GetJobjectArray() const { return static_cast< jobjectArray >( GetJObject() ); }
};
#endif

//==============================================================
// JavaString
//
Expand Down
2 changes: 2 additions & 0 deletions ovr_sdk_mobile/LibOVRKernel/Src/Kernel/OVR_Allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ class Allocator

// *** Standard Alignment Alloc/Free

virtual ~Allocator() { }

// Allocate memory of specified size with default alignment.
// Alloc of size==0 will allocate a tiny block & return a valid pointer;
// this makes it suitable for new operator.
Expand Down
2 changes: 0 additions & 2 deletions ovr_sdk_mobile/LibOVRKernel/Src/Kernel/OVR_File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ limitations under the License.
**************************************************************************/

#define GFILE_CXX

// Standard C library (Captain Obvious guarantees!)
#include <stdio.h>

Expand Down
2 changes: 0 additions & 2 deletions ovr_sdk_mobile/LibOVRKernel/Src/Kernel/OVR_FileFILE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ limitations under the License.
**************************************************************************/

#define GFILE_CXX

#include "OVR_Types.h"
#include "OVR_Log.h"

Expand Down
8 changes: 4 additions & 4 deletions ovr_sdk_mobile/LibOVRKernel/Src/Kernel/OVR_Geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Copyright : Copyright 2014 Oculus VR, LLC. All Rights reserved.
*************************************************************************************/

#include <math.h>
#include <assert.h>

#include "Kernel/OVR_Math.h"
#include "Kernel/OVR_Alg.h"
#include "OVR_Types.h"
#include "OVR_Math.h"
#include "OVR_Alg.h"

namespace OVR
{
Expand Down Expand Up @@ -52,7 +52,7 @@ bool Intersect_RayTriangle( const Vector3f & rayStart, const Vector3f & rayDir,
const Vector3f & v0, const Vector3f & v1, const Vector3f & v2,
float & t0, float & u, float & v )
{
assert( rayDir.IsNormalized() );
OVR_ASSERT( rayDir.IsNormalized() );

const Vector3f edge1 = v1 - v0;
const Vector3f edge2 = v2 - v0;
Expand Down
83 changes: 77 additions & 6 deletions ovr_sdk_mobile/LibOVRKernel/Src/Kernel/OVR_Lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ of patent rights can be found in the PATENTS file in the same directory.

#include "OVR_Lexer.h"

#include "Kernel/OVR_Std.h"
#include "Kernel/OVR_UTF8Util.h"
#include "Kernel/OVR_LogUtils.h"
#include "Kernel/OVR_MemBuffer.h"
#include "OVR_Std.h"
#include "OVR_UTF8Util.h"
#include "OVR_LogUtils.h"
#include "OVR_MemBuffer.h"
#include <cstdlib> // for strto* functions
#include <errno.h>
#include <utility>

namespace OVR {

Expand Down Expand Up @@ -67,6 +68,20 @@ ovrLexer::ovrLexer( MemBufferT< uint8_t > const & source, char const * punctuati
{
}

//==============================
// ovrLexer::ovrLexer
ovrLexer::ovrLexer( const ovrLexer & other )
{
operator=( other );
}

//==============================
// ovrLexer::ovrLexer
ovrLexer::ovrLexer( ovrLexer && other )
{
operator=( std::move(other) );
}

//==============================
// ovrLexer::~ovrLexer
ovrLexer::~ovrLexer()
Expand All @@ -76,6 +91,60 @@ ovrLexer::~ovrLexer()
Punctuation = NULL;
}

//==============================
// ovrLexer::operator=
ovrLexer & ovrLexer::operator=( const ovrLexer & other )
{
//self assignment
if ( this == &other )
{
return *this;
}

Source = other.Source;
SourceLength = other.SourceLength;
p = other.p;
Error = other.Error;

size_t len = other.Punctuation == NULL ? 0 : OVR_strlen( other.Punctuation );
if ( len == 0 )
{
Punctuation = new char[16];
Punctuation[0] = '\0';
}
else
{
Punctuation = new char[len + 1];
OVR_strcpy( Punctuation, len + 1, other.Punctuation );
}

return *this;
}

//==============================
// ovrLexer::operator=
ovrLexer & ovrLexer::operator=( ovrLexer && other )
{
//self assignment
if ( this == &other )
{
return *this;
}

Source = other.Source;
SourceLength = other.SourceLength;
p = other.p;
Error = other.Error;
Punctuation = other.Punctuation;

other.Source = nullptr;
other.SourceLength = 0;
other.p = nullptr;
other.Punctuation = nullptr;

return *this;
}

//==============================
// ovrLexer::FindChar
bool ovrLexer::FindChar( char const * buffer, uint32_t const ch )
Expand Down Expand Up @@ -257,6 +326,8 @@ ovrLexer::ovrResult ovrLexer::NextToken( char * token, size_t const maxTokenSize
return LEX_RESULT_ERROR;
}

token[0] = '\0';

size_t const BUFF_SIZE = 8192;
char buffer[BUFF_SIZE];

Expand Down Expand Up @@ -602,7 +673,7 @@ ovrLexer::ovrResult ovrLexer::ParseFloat( float & value, float const defaultVal
}

// Did we hit a non-digit character before the end of the string?
if ( *endptr != '\0' )
if ( *endptr != '\0' && *endptr != 'f' )
{
value = defaultVal;
return LEX_RESULT_UNEXPECTED_TOKEN;
Expand Down Expand Up @@ -798,4 +869,4 @@ static ovrLexerUnitTest unitTest;

#endif

} // namespace OVR
} // namespace OVR
Loading

0 comments on commit 4d9d8e6

Please sign in to comment.