diff --git a/AndroidManifest.xml b/AndroidManifest.xml index d05a21e..596b1db 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -16,8 +16,8 @@ --> + android:versionCode="140626" + android:versionName="14.06.26" > @@ -32,7 +32,7 @@ = 3.1) +devices though it has been tested only on Android (>= 4.0). The module includes direct support for +the [OUYA][4] gaming console and other devices using OUYA gamepads. + +### Module installation and usage. ### + +Install the NxtAR-core_XXXXXX.apk file on your device. To use you need additionally an Android (>= 3.0) +phone and a LEGO Mindstorms NXT robot with the [LejOS][5] firmware installed. The [NxtAR-cam][6] module must be +installed on the device and the [NxtAR-bot][7] module must be installed on the robot. Then, to start the compiled +scenario follow these steps: + +* Start the NxtAR-core application. +* Start the NxtAR-bot program on the robot. +* Calibrate the robot's light sensor following the on-screen instructions. +* When the robot displays *"Waiting for connection"* start the NxtAR-cam application and connect it with the robot. +* Press the *"Start video streaming"* button on the NxtAR-cam application. +* Press the *"Calibrate camera"* button on the NxtAR-core application and point the camera of the device running NxtAR-cam to an OpenCV checkerboard camera calibration pattern. + +The camera calibration step can be repeated if needed. + + [1]: http://www.lego.com/en-us/mindstorms/?domainredir=mindstorms.lego.com + [2]: http://libgdx.badlogicgames.com/ + [3]: http://opencv.org/ + [4]: https://www.ouya.tv/ + [5]: http://www.lejos.org/nxj.php + [6]: https://github.com/sagge-miky/NxtAR-cam + [7]: https://github.com/sagge-miky/NxtAR-bot diff --git a/assets/data/gfx/bomb_game/Anonymous_heart_1.png b/assets/data/gfx/bomb_game/Anonymous_heart_1.png new file mode 100644 index 0000000..289e086 Binary files /dev/null and b/assets/data/gfx/bomb_game/Anonymous_heart_1.png differ diff --git a/assets/data/gfx/bomb_game/comb_bomb.png b/assets/data/gfx/bomb_game/comb_bomb.png new file mode 100644 index 0000000..a6a4093 Binary files /dev/null and b/assets/data/gfx/bomb_game/comb_bomb.png differ diff --git a/assets/data/gfx/bomb_game/incl_bomb.png b/assets/data/gfx/bomb_game/incl_bomb.png new file mode 100644 index 0000000..103b94d Binary files /dev/null and b/assets/data/gfx/bomb_game/incl_bomb.png differ diff --git a/assets/data/gfx/bomb_game/wire_bomb.png b/assets/data/gfx/bomb_game/wire_bomb.png new file mode 100644 index 0000000..9187e5a Binary files /dev/null and b/assets/data/gfx/bomb_game/wire_bomb.png differ diff --git a/assets/data/gfx/gui/Anonymous_Button_Cyan.png b/assets/data/gfx/gui/Anonymous_Button_Cyan.png new file mode 100644 index 0000000..6309ef9 Binary files /dev/null and b/assets/data/gfx/gui/Anonymous_Button_Cyan.png differ diff --git a/assets/data/gfx/gui/arm.png b/assets/data/gfx/gui/arm.png new file mode 100644 index 0000000..38d422e Binary files /dev/null and b/assets/data/gfx/gui/arm.png differ diff --git a/assets/data/gfx/gui/down_button.png b/assets/data/gfx/gui/down_button.png new file mode 100644 index 0000000..c098a5a Binary files /dev/null and b/assets/data/gfx/gui/down_button.png differ diff --git a/assets/data/gfx/gui/help.png b/assets/data/gfx/gui/help.png new file mode 100644 index 0000000..cee4155 Binary files /dev/null and b/assets/data/gfx/gui/help.png differ diff --git a/assets/data/gfx/gui/left_button.png b/assets/data/gfx/gui/left_button.png new file mode 100644 index 0000000..61e6bb2 Binary files /dev/null and b/assets/data/gfx/gui/left_button.png differ diff --git a/assets/data/gfx/gui/right_button.png b/assets/data/gfx/gui/right_button.png new file mode 100644 index 0000000..c29c9f3 Binary files /dev/null and b/assets/data/gfx/gui/right_button.png differ diff --git a/assets/data/gfx/gui/slider_black.png b/assets/data/gfx/gui/slider_black.png new file mode 100644 index 0000000..91236e0 Binary files /dev/null and b/assets/data/gfx/gui/slider_black.png differ diff --git a/assets/data/gfx/gui/up_button.png b/assets/data/gfx/gui/up_button.png new file mode 100644 index 0000000..4a6d6dc Binary files /dev/null and b/assets/data/gfx/gui/up_button.png differ diff --git a/assets/data/gfx/gui/wheel.png b/assets/data/gfx/gui/wheel.png new file mode 100644 index 0000000..efc5ab3 Binary files /dev/null and b/assets/data/gfx/gui/wheel.png differ diff --git a/assets/models/collision_models/bomb_game/big_btn_col.g3db b/assets/models/collision_models/bomb_game/big_btn_col.g3db new file mode 100644 index 0000000..ca10e40 Binary files /dev/null and b/assets/models/collision_models/bomb_game/big_btn_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/bomb_1_body_col.g3db b/assets/models/collision_models/bomb_game/bomb_1_body_col.g3db new file mode 100644 index 0000000..edcec54 Binary files /dev/null and b/assets/models/collision_models/bomb_game/bomb_1_body_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/bomb_2_body_col.g3db b/assets/models/collision_models/bomb_game/bomb_2_body_col.g3db new file mode 100644 index 0000000..b7db1e4 Binary files /dev/null and b/assets/models/collision_models/bomb_game/bomb_2_body_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/bomb_3_body_col.g3db b/assets/models/collision_models/bomb_game/bomb_3_body_col.g3db new file mode 100644 index 0000000..ec8476e Binary files /dev/null and b/assets/models/collision_models/bomb_game/bomb_3_body_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/bomb_3_btn_1_col.g3db b/assets/models/collision_models/bomb_game/bomb_3_btn_1_col.g3db new file mode 100644 index 0000000..2a80fbf Binary files /dev/null and b/assets/models/collision_models/bomb_game/bomb_3_btn_1_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/bomb_3_btn_2_col.g3db b/assets/models/collision_models/bomb_game/bomb_3_btn_2_col.g3db new file mode 100644 index 0000000..723f599 Binary files /dev/null and b/assets/models/collision_models/bomb_game/bomb_3_btn_2_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/bomb_3_btn_3_col.g3db b/assets/models/collision_models/bomb_game/bomb_3_btn_3_col.g3db new file mode 100644 index 0000000..fe8c707 Binary files /dev/null and b/assets/models/collision_models/bomb_game/bomb_3_btn_3_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/bomb_3_btn_4_col.g3db b/assets/models/collision_models/bomb_game/bomb_3_btn_4_col.g3db new file mode 100644 index 0000000..87de686 Binary files /dev/null and b/assets/models/collision_models/bomb_game/bomb_3_btn_4_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/cable_1_col.g3db b/assets/models/collision_models/bomb_game/cable_1_col.g3db new file mode 100644 index 0000000..2ae2287 Binary files /dev/null and b/assets/models/collision_models/bomb_game/cable_1_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/cable_2_col.g3db b/assets/models/collision_models/bomb_game/cable_2_col.g3db new file mode 100644 index 0000000..d6dbf9a Binary files /dev/null and b/assets/models/collision_models/bomb_game/cable_2_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/cable_3_col.g3db b/assets/models/collision_models/bomb_game/cable_3_col.g3db new file mode 100644 index 0000000..65b86c1 Binary files /dev/null and b/assets/models/collision_models/bomb_game/cable_3_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/door_col.g3db b/assets/models/collision_models/bomb_game/door_col.g3db new file mode 100644 index 0000000..422c38d Binary files /dev/null and b/assets/models/collision_models/bomb_game/door_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/door_frame1_col.g3db b/assets/models/collision_models/bomb_game/door_frame1_col.g3db new file mode 100644 index 0000000..3e8ccc1 Binary files /dev/null and b/assets/models/collision_models/bomb_game/door_frame1_col.g3db differ diff --git a/assets/models/collision_models/bomb_game/robot_arm_col.g3db b/assets/models/collision_models/bomb_game/robot_arm_col.g3db new file mode 100644 index 0000000..9b31fef Binary files /dev/null and b/assets/models/collision_models/bomb_game/robot_arm_col.g3db differ diff --git a/assets/models/render_models/bomb_game/big_btn.g3db b/assets/models/render_models/bomb_game/big_btn.g3db new file mode 100644 index 0000000..833ae49 Binary files /dev/null and b/assets/models/render_models/bomb_game/big_btn.g3db differ diff --git a/assets/models/render_models/bomb_game/bomb_1_body.g3db b/assets/models/render_models/bomb_game/bomb_1_body.g3db new file mode 100644 index 0000000..b687019 Binary files /dev/null and b/assets/models/render_models/bomb_game/bomb_1_body.g3db differ diff --git a/assets/models/render_models/bomb_game/bomb_2_body.g3db b/assets/models/render_models/bomb_game/bomb_2_body.g3db new file mode 100644 index 0000000..c7c57a9 Binary files /dev/null and b/assets/models/render_models/bomb_game/bomb_2_body.g3db differ diff --git a/assets/models/render_models/bomb_game/bomb_3_body.g3db b/assets/models/render_models/bomb_game/bomb_3_body.g3db new file mode 100644 index 0000000..b698eb8 Binary files /dev/null and b/assets/models/render_models/bomb_game/bomb_3_body.g3db differ diff --git a/assets/models/render_models/bomb_game/bomb_3_btn_1.g3db b/assets/models/render_models/bomb_game/bomb_3_btn_1.g3db new file mode 100644 index 0000000..8d89a65 Binary files /dev/null and b/assets/models/render_models/bomb_game/bomb_3_btn_1.g3db differ diff --git a/assets/models/render_models/bomb_game/bomb_3_btn_2.g3db b/assets/models/render_models/bomb_game/bomb_3_btn_2.g3db new file mode 100644 index 0000000..327254a Binary files /dev/null and b/assets/models/render_models/bomb_game/bomb_3_btn_2.g3db differ diff --git a/assets/models/render_models/bomb_game/bomb_3_btn_3.g3db b/assets/models/render_models/bomb_game/bomb_3_btn_3.g3db new file mode 100644 index 0000000..c9d044e Binary files /dev/null and b/assets/models/render_models/bomb_game/bomb_3_btn_3.g3db differ diff --git a/assets/models/render_models/bomb_game/bomb_3_btn_4.g3db b/assets/models/render_models/bomb_game/bomb_3_btn_4.g3db new file mode 100644 index 0000000..a4d0ee1 Binary files /dev/null and b/assets/models/render_models/bomb_game/bomb_3_btn_4.g3db differ diff --git a/assets/models/render_models/bomb_game/cable_1.g3db b/assets/models/render_models/bomb_game/cable_1.g3db new file mode 100644 index 0000000..9f4bf72 Binary files /dev/null and b/assets/models/render_models/bomb_game/cable_1.g3db differ diff --git a/assets/models/render_models/bomb_game/cable_2.g3db b/assets/models/render_models/bomb_game/cable_2.g3db new file mode 100644 index 0000000..1de05e5 Binary files /dev/null and b/assets/models/render_models/bomb_game/cable_2.g3db differ diff --git a/assets/models/render_models/bomb_game/cable_3.g3db b/assets/models/render_models/bomb_game/cable_3.g3db new file mode 100644 index 0000000..924e763 Binary files /dev/null and b/assets/models/render_models/bomb_game/cable_3.g3db differ diff --git a/assets/models/render_models/bomb_game/door.g3db b/assets/models/render_models/bomb_game/door.g3db new file mode 100644 index 0000000..1a1819c Binary files /dev/null and b/assets/models/render_models/bomb_game/door.g3db differ diff --git a/assets/models/render_models/bomb_game/door_frame1.g3db b/assets/models/render_models/bomb_game/door_frame1.g3db new file mode 100644 index 0000000..5b65a9e Binary files /dev/null and b/assets/models/render_models/bomb_game/door_frame1.g3db differ diff --git a/assets/models/render_models/bomb_game/monkey.g3db b/assets/models/render_models/bomb_game/monkey.g3db new file mode 100644 index 0000000..1063b92 Binary files /dev/null and b/assets/models/render_models/bomb_game/monkey.g3db differ diff --git a/assets/models/render_models/bomb_game/robot_arm.g3db b/assets/models/render_models/bomb_game/robot_arm.g3db new file mode 100644 index 0000000..4e09189 Binary files /dev/null and b/assets/models/render_models/bomb_game/robot_arm.g3db differ diff --git a/assets/shaders/alphaSprite/alpha_frag.glsl b/assets/shaders/alphaSprite/alpha_frag.glsl new file mode 100644 index 0000000..9cf7003 --- /dev/null +++ b/assets/shaders/alphaSprite/alpha_frag.glsl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2014 Miguel Angel Astor Romero + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifdef GL_ES +precision mediump float; +#endif + +uniform sampler2D u_texture; + +varying vec2 v_texCoords; + +void main(){ + vec4 texColor = texture2D(u_texture, v_texCoords); + if(texColor.a > 0.0) + texColor.a = 0.5; + gl_FragColor = texColor; +} \ No newline at end of file diff --git a/assets/shaders/alphaSprite/alpha_vert.glsl b/assets/shaders/alphaSprite/alpha_vert.glsl new file mode 100644 index 0000000..156bef0 --- /dev/null +++ b/assets/shaders/alphaSprite/alpha_vert.glsl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2014 Miguel Angel Astor Romero + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +uniform mat4 u_projTrans; + +attribute vec4 a_position; +attribute vec2 a_texCoord0; + +varying vec2 v_texCoords; + +void main(){ + v_texCoords = a_texCoord0; + gl_Position = u_projTrans * a_position; +} \ No newline at end of file diff --git a/assets/shaders/bckg/bckg_frag.glsl b/assets/shaders/bckg/bckg_frag.glsl index 5ecaf92..b9724cd 100644 --- a/assets/shaders/bckg/bckg_frag.glsl +++ b/assets/shaders/bckg/bckg_frag.glsl @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2014 Miguel Angel Astor Romero + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifdef GL_ES precision mediump float; #endif diff --git a/assets/shaders/bckg/bckg_vert.glsl b/assets/shaders/bckg/bckg_vert.glsl index 191d740..156bef0 100644 --- a/assets/shaders/bckg/bckg_vert.glsl +++ b/assets/shaders/bckg/bckg_vert.glsl @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2014 Miguel Angel Astor Romero + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ uniform mat4 u_projTrans; attribute vec4 a_position; diff --git a/assets/shaders/directionalPerPixelSingleLight/directionalPerPixel_vert.glsl b/assets/shaders/directionalPerPixelSingleLight/directionalPerPixel_vert.glsl index 72974ec..3338afb 100644 --- a/assets/shaders/directionalPerPixelSingleLight/directionalPerPixel_vert.glsl +++ b/assets/shaders/directionalPerPixelSingleLight/directionalPerPixel_vert.glsl @@ -80,17 +80,61 @@ void main(){ #ifdef SKINNING // Do the skinning. - mat4 bones[4]; - bones[0] = u_bone0; - bones[1] = u_bone1; - bones[2] = u_bone2; - bones[3] = u_bone3; + mat4 bones0; + mat4 bones1; + mat4 bones2; + mat4 bones3; + bones0 = u_bone0; + bones1 = u_bone1; + bones2 = u_bone2; + bones3 = u_bone3; + int index; mat4 skinning = mat4(0.0); - skinning += (a_boneWeight0.y) * bones[int(a_boneWeight0.x)]; - skinning += (a_boneWeight1.y) * bones[int(a_boneWeight1.x)]; - skinning += (a_boneWeight2.y) * bones[int(a_boneWeight2.x)]; - skinning += (a_boneWeight3.y) * bones[int(a_boneWeight3.x)]; + + index = int(a_boneWeight0.x); + if(index == 0){ + skinning += (a_boneWeight0.y) * bones0; + }else if(index == 1){ + skinning += (a_boneWeight0.y) * bones1; + }else if(index == 2){ + skinning += (a_boneWeight0.y) * bones2; + }else if(index == 3){ + skinning += (a_boneWeight0.y) * bones3; + } + + index = int(a_boneWeight1.x); + if(index == 0){ + skinning += (a_boneWeight1.y) * bones0; + }else if(index == 1){ + skinning += (a_boneWeight1.y) * bones1; + }else if(index == 2){ + skinning += (a_boneWeight1.y) * bones2; + }else if(index == 3){ + skinning += (a_boneWeight1.y) * bones3; + } + + index = int(a_boneWeight2.x); + if(index == 0){ + skinning += (a_boneWeight2.y) * bones0; + }else if(index == 1){ + skinning += (a_boneWeight2.y) * bones1; + }else if(index == 2){ + skinning += (a_boneWeight2.y) * bones2; + }else if(index == 3){ + skinning += (a_boneWeight2.y) * bones3; + } + + index = int(a_boneWeight3.x); + if(index == 0){ + skinning += (a_boneWeight3.y) * bones0; + }else if(index == 1){ + skinning += (a_boneWeight3.y) * bones1; + }else if(index == 2){ + skinning += (a_boneWeight3.y) * bones2; + }else if(index == 3){ + skinning += (a_boneWeight3.y) * bones3; + } // Transform the model. transformedPosition = u_geomTrans * skinning * a_position; diff --git a/assets/shaders/movingBckg/movingBckg_frag.glsl b/assets/shaders/movingBckg/movingBckg_frag.glsl new file mode 100644 index 0000000..b9724cd --- /dev/null +++ b/assets/shaders/movingBckg/movingBckg_frag.glsl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2014 Miguel Angel Astor Romero + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifdef GL_ES +precision mediump float; +#endif + +uniform sampler2D u_texture; +uniform vec2 u_scaling; + +varying vec2 v_texCoords; + +void main(){ + gl_FragColor = texture2D(u_texture, v_texCoords * u_scaling); +} \ No newline at end of file diff --git a/assets/shaders/movingBckg/movingBckg_vert.glsl b/assets/shaders/movingBckg/movingBckg_vert.glsl new file mode 100644 index 0000000..fbd2548 --- /dev/null +++ b/assets/shaders/movingBckg/movingBckg_vert.glsl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2014 Miguel Angel Astor Romero + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +uniform mat4 u_projTrans; +uniform float u_displacement; + +attribute vec4 a_position; +attribute vec2 a_texCoord0; + +varying vec2 v_texCoords; + +void main(){ + v_texCoords = a_texCoord0 + u_displacement; + gl_Position = u_projTrans * a_position; +} \ No newline at end of file diff --git a/ic_nxtar_core_launcher-web.png b/ic_nxtar_core_launcher-web.png new file mode 100644 index 0000000..61bf159 Binary files /dev/null and b/ic_nxtar_core_launcher-web.png differ diff --git a/jni/Android.mk b/jni/Android.mk index 8c132e2..c5b830b 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -5,7 +5,6 @@ include $(CLEAR_VARS) OPENCV_CAMERA_MODULES:=off OPENCV_LIB_TYPE:=STATIC #SHARED include C:\Users\miguel.astor\Documents\OpenCV-2.4.8-android-sdk\sdk\native\jni\OpenCV.mk -#include C:\NVPACK\OpenCV-2.4.5-Tegra-sdk-r2\sdk\native\jni\OpenCV-tegra3.mk LOCAL_MODULE := cvproc LOCAL_SRC_FILES := cv_proc.cpp marker.cpp @@ -31,62 +30,62 @@ include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ocv_tegra_java -LOCAL_SRC_FILES := C:\NVPACK\OpenCV-2.4.5-Tegra-sdk-r2\sdk\native\libs\tegra3\libopencv_java.so +LOCAL_SRC_FILES := C:\\Users\\miguel.astor\\Documents\\OpenCV-2.4.8-android-sdk\\sdk\\native\\libs\\armeabi-v7a\\libopencv_java.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ocv_tegra_info -LOCAL_SRC_FILES := C:\NVPACK\OpenCV-2.4.5-Tegra-sdk-r2\sdk\native\libs\tegra3\libopencv_info.so +LOCAL_SRC_FILES := C:\\Users\\miguel.astor\\Documents\\OpenCV-2.4.8-android-sdk\\sdk\\native\\libs\\armeabi-v7a\\libopencv_info.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ocv_tegra_native_camera_220 -LOCAL_SRC_FILES := C:\NVPACK\OpenCV-2.4.5-Tegra-sdk-r2\sdk\native\libs\tegra3\libnative_camera_r2.2.0.so +LOCAL_SRC_FILES := C:\\Users\\miguel.astor\\Documents\\OpenCV-2.4.8-android-sdk\\sdk\\native\\libs\\armeabi-v7a\\libnative_camera_r2.2.0.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ocv_tegra_native_camera_233 -LOCAL_SRC_FILES := C:\NVPACK\OpenCV-2.4.5-Tegra-sdk-r2\sdk\native\libs\tegra3\libnative_camera_r2.3.3.so +LOCAL_SRC_FILES := C:\\Users\\miguel.astor\\Documents\\OpenCV-2.4.8-android-sdk\\sdk\\native\\libs\\armeabi-v7a\\libnative_camera_r2.3.3.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ocv_tegra_native_camera_301 -LOCAL_SRC_FILES := C:\NVPACK\OpenCV-2.4.5-Tegra-sdk-r2\sdk\native\libs\tegra3\libnative_camera_r3.0.1.so +LOCAL_SRC_FILES := C:\\Users\\miguel.astor\\Documents\\OpenCV-2.4.8-android-sdk\\sdk\\native\\libs\\armeabi-v7a\\libnative_camera_r3.0.1.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ocv_tegra_native_camera_400 -LOCAL_SRC_FILES := C:\NVPACK\OpenCV-2.4.5-Tegra-sdk-r2\sdk\native\libs\tegra3\libnative_camera_r4.0.0.so +LOCAL_SRC_FILES := C:\\Users\\miguel.astor\\Documents\\OpenCV-2.4.8-android-sdk\\sdk\\native\\libs\\armeabi-v7a\\libnative_camera_r4.0.0.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ocv_tegra_native_camera_403 -LOCAL_SRC_FILES := C:\NVPACK\OpenCV-2.4.5-Tegra-sdk-r2\sdk\native\libs\tegra3\libnative_camera_r4.0.3.so +LOCAL_SRC_FILES := C:\\Users\\miguel.astor\\Documents\\OpenCV-2.4.8-android-sdk\\sdk\\native\\libs\\armeabi-v7a\\libnative_camera_r4.0.3.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ocv_tegra_native_camera_411 -LOCAL_SRC_FILES := C:\NVPACK\OpenCV-2.4.5-Tegra-sdk-r2\sdk\native\libs\tegra3\libnative_camera_r4.1.1.so +LOCAL_SRC_FILES := C:\\Users\\miguel.astor\\Documents\\OpenCV-2.4.8-android-sdk\\sdk\\native\\libs\\armeabi-v7a\\libnative_camera_r4.1.1.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ocv_tegra_native_camera_420 -LOCAL_SRC_FILES := C:\NVPACK\OpenCV-2.4.5-Tegra-sdk-r2\sdk\native\libs\tegra3\libnative_camera_r4.2.0.so +LOCAL_SRC_FILES := C:\\Users\\miguel.astor\\Documents\\OpenCV-2.4.8-android-sdk\\sdk\\native\\libs\\armeabi-v7a\\libnative_camera_r4.2.0.so include $(PREBUILT_SHARED_LIBRARY) diff --git a/jni/marker.cpp b/jni/marker.cpp index ba51285..79941ac 100644 --- a/jni/marker.cpp +++ b/jni/marker.cpp @@ -77,7 +77,7 @@ int hammDistMarker(cv::Mat); cv::Mat rotate(cv::Mat); -int decodeMarker(cv::Mat &); +int decodeMarker(cv::Mat &, int &); void renderMarkers(markers_vector &, cv::Mat &); @@ -92,9 +92,11 @@ void warpMarker(Marker &, cv::Mat &, cv::Mat &); ******************************************************************************/ void getAllMarkers(markers_vector & valid_markers, cv::Mat & img){ + int rotations = 0; cv::Mat gray, thresh, cont, mark; contours_vector contours; markers_vector markers; + cv::Point2f point; #ifdef DESKTOP std::ostringstream oss; #endif @@ -116,10 +118,32 @@ void getAllMarkers(markers_vector & valid_markers, cv::Mat & img){ for(int i = 0; i < markers.size(); i++){ warpMarker(markers[i], gray, mark); - int code = decodeMarker(mark); + int code = decodeMarker(mark, rotations); if(code != -1){ markers[i].code = code; + + // If the decoder detected the marker is rotated then reorder the points + // so that the orientation calculations always use the correct top of the marker. + if(rotations > 0){ + while(rotations > 0){ + for(int r = 0; r < 1; r++){ + point = markers[i].points.at(markers[i].points.size() - 1); + markers[i].points.pop_back(); + markers[i].points.insert(markers[i].points.begin(), point); + } + + rotations--; + } + } + + // Rotate 180 degrees. + for(int r = 0; r < 2; r++){ + point = markers[i].points.at(markers[i].points.size() - 1); + markers[i].points.pop_back(); + markers[i].points.insert(markers[i].points.begin(), point); + } + valid_markers.push_back(markers[i]); } } @@ -434,11 +458,13 @@ cv::Mat rotate(cv::Mat in){ * Decode a marker image and return it's code. Returns -1 if the image is * not a valid marker. */ -int decodeMarker(cv::Mat & marker){ +int decodeMarker(cv::Mat & marker, int & rotations){ bool found = false; int code = 0; cv::Mat bits; + rotations = 0; + // Verify that the outer rim of marker cells are all black. for(int y = 0; y < 7; y++){ int inc = (y == 0 || y == 6) ? 1 : 6; @@ -478,6 +504,7 @@ int decodeMarker(cv::Mat & marker){ if(hammDistMarker(bits) != 0){ for(int r = 1; r < 4; r++){ bits = rotate(bits); + rotations++; if(hammDistMarker(bits) != 0) continue; else{ found = true; break;} } diff --git a/res/drawable-hdpi/ic_nxtar_core_launcher.png b/res/drawable-hdpi/ic_nxtar_core_launcher.png new file mode 100644 index 0000000..6676c9f Binary files /dev/null and b/res/drawable-hdpi/ic_nxtar_core_launcher.png differ diff --git a/res/drawable-mdpi/ic_nxtar_core_launcher.png b/res/drawable-mdpi/ic_nxtar_core_launcher.png new file mode 100644 index 0000000..9bed742 Binary files /dev/null and b/res/drawable-mdpi/ic_nxtar_core_launcher.png differ diff --git a/res/drawable-xhdpi/ic_nxtar_core_launcher.png b/res/drawable-xhdpi/ic_nxtar_core_launcher.png new file mode 100644 index 0000000..558ed06 Binary files /dev/null and b/res/drawable-xhdpi/ic_nxtar_core_launcher.png differ diff --git a/res/drawable-xhdpi/ouya_icon.png b/res/drawable-xhdpi/ouya_icon.png new file mode 100644 index 0000000..1a93ef4 Binary files /dev/null and b/res/drawable-xhdpi/ouya_icon.png differ diff --git a/res/drawable-xxhdpi/ic_nxtar_core_launcher.png b/res/drawable-xxhdpi/ic_nxtar_core_launcher.png new file mode 100644 index 0000000..0aa21c4 Binary files /dev/null and b/res/drawable-xxhdpi/ic_nxtar_core_launcher.png differ diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index a6b32aa..01105a4 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -15,7 +15,7 @@ * limitations under the License. --> - NxtAR - No se pudo inicializar OpenCV - OpenCV inicializado con exito + NxtAR-core + Error al inicializar OpenCV + OpenCV inicializado con éxito \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index a7c755b..d5baa35 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -15,7 +15,7 @@ * limitations under the License. --> - NxtAR + NxtAR-core Failed to initialize OpenCV OpenCV initialized successfully \ No newline at end of file diff --git a/src/ve/ucv/ciens/ccg/nxtar/MainActivity.java b/src/ve/ucv/ciens/ccg/nxtar/MainActivity.java index aea4194..d09a469 100644 --- a/src/ve/ucv/ciens/ccg/nxtar/MainActivity.java +++ b/src/ve/ucv/ciens/ccg/nxtar/MainActivity.java @@ -231,8 +231,8 @@ public class MainActivity extends AndroidApplication implements ActionResolver, // Configure LibGDX. AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); - cfg.useAccelerometer = false; - cfg.useCompass = false; + cfg.useAccelerometer = true; + cfg.useCompass = true; cfg.useWakelock = true; // Launch the LibGDX core game class.