Changes of Revision 8

sview.changes Changed
x
 
1
@@ -1,4 +1,13 @@
2
 -------------------------------------------------------------------
3
+Fri Oct  6 05:05:51 UTC 2017 - avvissu@yandex.by
4
+
5
+- Update to 17.04:
6
+  * update FFmpeg to 3.3, read panorama information from video files
7
+  * fixed too long opening File Info dialog on some JPEG files with 
8
+    binary data present as metadata (coming from FFmpeg decoder)
9
+- Drop 0001-Makefile-sort-input-files.patch (fixed)
10
+
11
+-------------------------------------------------------------------
12
 Sat Feb 11 08:26:52 UTC 2017 - olaf@aepfle.de
13
 
14
 - Sort wildcard lists with 0001-Makefile-sort-input-files.patch
15
sview.spec Changed
36
 
1
@@ -16,18 +16,17 @@
2
 #
3
 
4
 
5
-%define src_ver 16_06
6
+%define src_ver 17_04
7
 %define src_name sView
8
 %define ffmpeg_includedir %(pkg-config --variable=includedir libavcodec)
9
 Name:           sview
10
-Version:        16.06
11
+Version:        17.04
12
 Release:        0
13
 Summary:        Stereoscopic media player
14
 License:        GPL-3.0+ and LGPL-3.0+
15
 Group:          Productivity/Multimedia/Video/Players
16
 Url:            http://www.sview.ru/en/
17
 Source:         https://github.com/gkv311/sview/archive/%{src_ver}.tar.gz#/%{name}-%{src_ver}.tar.gz
18
-Patch0:         0001-Makefile-sort-input-files.patch
19
 BuildRequires:  dos2unix
20
 BuildRequires:  gcc-c++
21
 BuildRequires:  fdupes
22
@@ -56,10 +55,12 @@
23
 
24
 %prep
25
 %setup -q -n %{name}-%{src_ver}
26
-%patch0 -p1
27
 
28
 dos2unix -k license-gpl* license-lgpl*
29
 
30
+# Fix build for Factory
31
+sed -i 's/xlocale\.h/locale.h/' $(grep -rwl xlocale)
32
+
33
 %build
34
 sed -e '/^INC/s|$|\ -I%{ffmpeg_includedir}|' \
35
     -e '/^CFLAGS/s/$/\ %{optflags}/' \
36
0001-Makefile-sort-input-files.patch Deleted
193
 
1
@@ -1,191 +0,0 @@
2
-From 1c7f107a903a57908e1ff0682457433a4930422b Mon Sep 17 00:00:00 2001
3
-From: Olaf Hering <olaf@aepfle.de>
4
-Date: Sat, 11 Feb 2017 08:19:43 +0100
5
-Subject: Makefile -- sort input files
6
-
7
-Sorting input files helps with what Debian sells as reproducilbe builds.
8
-
9
-Signed-off-by: Olaf Hering <olaf@aepfle.de>
10
----
11
- Makefile | 44 ++++++++++++++++++++++----------------------
12
- 1 file changed, 22 insertions(+), 22 deletions(-)
13
-
14
-diff --git a/Makefile b/Makefile
15
-index 8f1e1c46..2c8472e9 100644
16
---- a/Makefile
17
-+++ b/Makefile
18
-@@ -307,12 +307,12 @@ pre_all:
19
-   cp -f -r textures/* $(BUILD_ROOT)/textures/
20
- 
21
- # StShared shared library
22
--aStShared_SRCS1 := $(wildcard $(SRCDIR)/StShared/*.cpp)
23
-+aStShared_SRCS1 := $(sort $(wildcard $(SRCDIR)/StShared/*.cpp))
24
- aStShared_OBJS1 := ${aStShared_SRCS1:.cpp=.o}
25
- aStShared_SRCS2 :=
26
- aStShared_OBJS2 :=
27
- ifeq ($(TARGET_OS),osx)
28
--aStShared_SRCS2 := $(wildcard $(SRCDIR)/StShared/*.mm)
29
-+aStShared_SRCS2 := $(sort $(wildcard $(SRCDIR)/StShared/*.mm))
30
- aStShared_OBJS2 := ${aStShared_SRCS2:.mm=.o}
31
- endif
32
- aStShared_LIB  := $(LIB) $(LIB_GLX) $(LIB_GTK) $(LIB_ANDROID) -lavutil -lavformat -lavcodec -lswscale -lfreetype $(LIB_CONFIG) $(LIB_PTHREAD)
33
-@@ -323,7 +323,7 @@ clean_StShared:
34
-   rm -rf StShared/*.o
35
- 
36
- # StGLWidgets shared library
37
--aStGLWidgets_SRCS := $(wildcard $(SRCDIR)/StGLWidgets/*.cpp)
38
-+aStGLWidgets_SRCS := $(sort $(wildcard $(SRCDIR)/StGLWidgets/*.cpp))
39
- aStGLWidgets_OBJS := ${aStGLWidgets_SRCS:.cpp=.o}
40
- aStGLWidgets_LIB  := $(LIB) -lStShared $(LIB_GLX)
41
- $(aStGLWidgets) : pre_StGLWidgets $(aStShared) $(aStGLWidgets_OBJS)
42
-@@ -335,12 +335,12 @@ clean_StGLWidgets:
43
-   rm -rf StGLWidgets/*.o
44
- 
45
- # StCore library
46
--aStCore_SRCS1 := $(wildcard $(SRCDIR)/StCore/*.cpp)
47
-+aStCore_SRCS1 := $(sort $(wildcard $(SRCDIR)/StCore/*.cpp))
48
- aStCore_OBJS1 := ${aStCore_SRCS1:.cpp=.o}
49
- aStCore_SRCS2 :=
50
- aStCore_OBJS2 :=
51
- ifeq ($(TARGET_OS),osx)
52
--aStCore_SRCS2 := $(wildcard $(SRCDIR)/StCore/*.mm)
53
-+aStCore_SRCS2 := $(sort $(wildcard $(SRCDIR)/StCore/*.mm))
54
- aStCore_OBJS2 := ${aStCore_SRCS2:.mm=.o}
55
- endif
56
- aStCore_LIB  := $(LIB) -lStShared $(LIB_GLX) $(LIB_GTK) $(LIB_PTHREAD) $(LIB_XLIB) $(LIB_ANDROID) $(LIB_IOKIT)
57
-@@ -351,7 +351,7 @@ clean_StCore:
58
-   rm -rf StCore/*.o
59
- 
60
- # StOutAnaglyph library (Anaglyph output)
61
--aStOutAnaglyph_SRCS := $(wildcard $(SRCDIR)/StOutAnaglyph/*.cpp)
62
-+aStOutAnaglyph_SRCS := $(sort $(wildcard $(SRCDIR)/StOutAnaglyph/*.cpp))
63
- aStOutAnaglyph_OBJS := ${aStOutAnaglyph_SRCS:.cpp=.o}
64
- aStOutAnaglyph_LIB  := $(LIB) -lStShared -lStCore $(LIB_GLX) $(LIB_GTK) $(LIB_PTHREAD)
65
- $(aStOutAnaglyph) : pre_StOutAnaglyph $(aStCore) $(aStOutAnaglyph_OBJS)
66
-@@ -373,7 +373,7 @@ clean_StOutAnaglyph:
67
-   rm -rf $(BUILD_ROOT)/lang/*/StOutAnaglyph.lng
68
- 
69
- # StOutDual library (Dual output)
70
--aStOutDual_SRCS := $(wildcard $(SRCDIR)/StOutDual/*.cpp)
71
-+aStOutDual_SRCS := $(sort $(wildcard $(SRCDIR)/StOutDual/*.cpp))
72
- aStOutDual_OBJS := ${aStOutDual_SRCS:.cpp=.o}
73
- aStOutDual_LIB  := $(LIB) -lStShared -lStCore $(LIB_GLX) $(LIB_GTK) $(LIB_PTHREAD)
74
- $(aStOutDual) : pre_StOutDual $(aStCore) $(aStOutDual_OBJS)
75
-@@ -392,7 +392,7 @@ clean_StOutDual:
76
-   rm -rf $(BUILD_ROOT)/lang/*/StOutDual.lng
77
- 
78
- # StOutIZ3D library (iZ3D monitor)
79
--aStOutIZ3D_SRCS := $(wildcard $(SRCDIR)/StOutIZ3D/*.cpp)
80
-+aStOutIZ3D_SRCS := $(sort $(wildcard $(SRCDIR)/StOutIZ3D/*.cpp))
81
- aStOutIZ3D_OBJS := ${aStOutIZ3D_SRCS:.cpp=.o}
82
- aStOutIZ3D_LIB  := $(LIB) -lStShared -lStCore $(LIB_GLX) $(LIB_GTK) $(LIB_PTHREAD)
83
- $(aStOutIZ3D) : pre_StOutIZ3D $(aStCore) $(aStOutIZ3D_OBJS)
84
-@@ -414,7 +414,7 @@ clean_StOutIZ3D:
85
-   rm -rf $(BUILD_ROOT)/lang/*/StOutIZ3D.lng
86
- 
87
- # StOutInterlace library (Interlaced output)
88
--aStOutInterlace_SRCS := $(wildcard $(SRCDIR)/StOutInterlace/*.cpp)
89
-+aStOutInterlace_SRCS := $(sort $(wildcard $(SRCDIR)/StOutInterlace/*.cpp))
90
- aStOutInterlace_OBJS := ${aStOutInterlace_SRCS:.cpp=.o}
91
- aStOutInterlace_LIB  := $(LIB) -lStShared -lStCore $(LIB_GLX) $(LIB_GTK) $(LIB_PTHREAD)
92
- $(aStOutInterlace) : pre_StOutInterlace $(aStCore) $(aStOutInterlace_OBJS)
93
-@@ -436,12 +436,12 @@ clean_StOutInterlace:
94
-   rm -rf $(BUILD_ROOT)/lang/*/StOutInterlace.lng
95
- 
96
- # StOutPageFlip library (Shutter glasses output)
97
--aStOutPageFlip_SRCS1 := $(wildcard $(SRCDIR)/StOutPageFlip/*.cpp)
98
-+aStOutPageFlip_SRCS1 := $(sort $(wildcard $(SRCDIR)/StOutPageFlip/*.cpp))
99
- aStOutPageFlip_OBJS1 := ${aStOutPageFlip_SRCS1:.cpp=.o}
100
- aStOutPageFlip_SRCS2 :=
101
- aStOutPageFlip_OBJS2 :=
102
- ifeq ($(TARGET_OS),osx)
103
--aStOutPageFlip_SRCS2 := $(wildcard $(SRCDIR)/StOutPageFlip/*.mm)
104
-+aStOutPageFlip_SRCS2 := $(sort $(wildcard $(SRCDIR)/StOutPageFlip/*.mm))
105
- aStOutPageFlip_OBJS2 := ${aStOutPageFlip_SRCS2:.mm=.o}
106
- endif
107
- aStOutPageFlip_LIB  := $(LIB) -lStShared -lStCore $(LIB_GLX) $(LIB_GTK) $(LIB_PTHREAD)
108
-@@ -461,7 +461,7 @@ clean_StOutPageFlip:
109
-   rm -rf $(BUILD_ROOT)/lang/*/StOutPageFlip.lng
110
- 
111
- # StOutDistorted library
112
--aStOutDistorted_SRCS := $(wildcard $(SRCDIR)/StOutDistorted/*.cpp)
113
-+aStOutDistorted_SRCS := $(sort $(wildcard $(SRCDIR)/StOutDistorted/*.cpp))
114
- aStOutDistorted_OBJS := ${aStOutDistorted_SRCS:.cpp=.o}
115
- aStOutDistorted_LIB  := $(LIB) -lStShared -lStCore $(LIB_GLX) $(LIB_GTK) $(LIB_PTHREAD)
116
- $(aStOutDistorted) : pre_StOutDistorted $(aStCore) $(aStOutDistorted_OBJS)
117
-@@ -480,7 +480,7 @@ clean_StOutDistorted:
118
-   rm -rf $(BUILD_ROOT)/lang/*/StOutDistorted.lng
119
- 
120
- # StImageViewer library (Image Viewer)
121
--aStImageViewer_SRCS := $(wildcard $(SRCDIR)/StImageViewer/*.cpp)
122
-+aStImageViewer_SRCS := $(sort $(wildcard $(SRCDIR)/StImageViewer/*.cpp))
123
- aStImageViewer_OBJS := ${aStImageViewer_SRCS:.cpp=.o}
124
- aStImageViewer_LIB  := $(LIB) -lStGLWidgets -lStShared -lStCore $(LIB_OUTPUTS) $(LIB_GLX) $(LIB_GTK) $(LIB_PTHREAD)
125
- $(aStImageViewer) : pre_StImageViewer $(aStGLWidgets) outputs_all $(aStImageViewer_OBJS)
126
-@@ -499,11 +499,11 @@ clean_StImageViewer:
127
-   rm -rf $(BUILD_ROOT)/lang/*/StImageViewer.lng
128
- 
129
- # StMoviePlayer library (Image Viewer)
130
--aStMoviePlayer_SRCS1 := $(wildcard $(SRCDIR)/StMoviePlayer/*.cpp)
131
-+aStMoviePlayer_SRCS1 := $(sort $(wildcard $(SRCDIR)/StMoviePlayer/*.cpp))
132
- aStMoviePlayer_OBJS1 := ${aStMoviePlayer_SRCS1:.cpp=.o}
133
--aStMoviePlayer_SRCS2 := $(wildcard $(SRCDIR)/StMoviePlayer/StVideo/*.cpp)
134
-+aStMoviePlayer_SRCS2 := $(sort $(wildcard $(SRCDIR)/StMoviePlayer/StVideo/*.cpp))
135
- aStMoviePlayer_OBJS2 := ${aStMoviePlayer_SRCS2:.cpp=.o}
136
--aStMoviePlayer_SRCS3 := $(wildcard $(SRCDIR)/StMoviePlayer/*.c)
137
-+aStMoviePlayer_SRCS3 := $(sort $(wildcard $(SRCDIR)/StMoviePlayer/*.c))
138
- aStMoviePlayer_OBJS3 := ${aStMoviePlayer_SRCS3:.c=.o}
139
- aStMoviePlayer_LIB   := $(LIB) -lStGLWidgets -lStShared -lStCore $(LIB_OUTPUTS) $(LIB_GLX) $(LIB_GTK) -lavutil -lavformat -lavcodec -lswscale $(LIB_OPENAL) $(LIB_PTHREAD)
140
- $(aStMoviePlayer) : pre_StMoviePlayer $(aStGLWidgets) outputs_all $(aStMoviePlayer_OBJS1) $(aStMoviePlayer_OBJS2) $(aStMoviePlayer_OBJS3)
141
-@@ -525,7 +525,7 @@ clean_StMoviePlayer:
142
-   rm -rf $(BUILD_ROOT)/web/*
143
- 
144
- # StDiagnostics library
145
--aStDiagnostics_SRCS := $(wildcard $(SRCDIR)/StDiagnostics/*.cpp)
146
-+aStDiagnostics_SRCS := $(sort $(wildcard $(SRCDIR)/StDiagnostics/*.cpp))
147
- aStDiagnostics_OBJS := ${aStDiagnostics_SRCS:.cpp=.o}
148
- aStDiagnostics_LIB  := $(LIB) -lStGLWidgets -lStShared -lStCore $(LIB_OUTPUTS) $(LIB_GLX) $(LIB_GTK) $(LIB_PTHREAD)
149
- $(aStDiagnostics) : pre_StDiagnostics $(aStGLWidgets) outputs_all $(aStDiagnostics_OBJS)
150
-@@ -544,7 +544,7 @@ clean_StDiagnostics:
151
-   rm -rf $(BUILD_ROOT)/lang/*/StDiagnostics.lng
152
- 
153
- # sView CAD Android JNI executable
154
--sViewAndroidCad_SRCS := $(wildcard $(SRCDIR)/StCADViewer/*.cpp)
155
-+sViewAndroidCad_SRCS := $(sort $(wildcard $(SRCDIR)/StCADViewer/*.cpp))
156
- sViewAndroidCad_OBJS := ${sViewAndroidCad_SRCS:.cpp=.o}
157
- sViewAndroidCad_LIB  := $(LIB) -lStGLWidgets -lStShared -lStCore $(LIB_OUTPUTS) $(LIB_OCCT) -lfreetype -llog -landroid -lEGL -lGLESv2 -lc
158
- $(sViewAndroidCad) : pre_StCADViewer $(aStGLWidgets) outputs_all $(sViewAndroidCad_OBJS)
159
-@@ -555,7 +555,7 @@ clean_sViewAndroidCad:
160
-   rm -rf $(BUILD_ROOT)/lang/*/StCADViewer.lng
161
- 
162
- # StCADViewer library
163
--aStCADViewer_SRCS := $(wildcard $(SRCDIR)/StCADViewer/*.cpp)
164
-+aStCADViewer_SRCS := $(sort $(wildcard $(SRCDIR)/StCADViewer/*.cpp))
165
- aStCADViewer_OBJS := ${aStCADViewer_SRCS:.cpp=.o}
166
- aStCADViewer_LIB  := $(LIB) -lStGLWidgets -lStShared -lStCore $(LIB_OUTPUTS) $(LIB_GLX) $(LIB_GTK) $(LIB_PTHREAD)
167
- aStCADViewer_LIB  += $(LIB_OCCT)
168
-@@ -575,7 +575,7 @@ clean_StCADViewer:
169
-   rm -rf $(BUILD_ROOT)/lang/*/StCADViewer.lng
170
- 
171
- # sView Android JNI executable
172
--sViewAndroid_SRCS := $(wildcard $(SRCDIR)/sview/jni/*.cpp)
173
-+sViewAndroid_SRCS := $(sort $(wildcard $(SRCDIR)/sview/jni/*.cpp))
174
- sViewAndroid_OBJS := ${sViewAndroid_SRCS:.cpp=.o}
175
- sViewAndroid_LIB  := $(LIB) -lStShared -lStCore -lStImageViewer -lStMoviePlayer -llog -landroid -lEGL -lGLESv2 -lc
176
- $(sViewAndroid) : $(aStImageViewer) $(aStMoviePlayer) $(sViewAndroid_OBJS)
177
-@@ -585,13 +585,13 @@ clean_sViewAndroid:
178
-   rm -rf sview/jni/*.o
179
- 
180
- # sView executable
181
--sView_SRCS1 := $(wildcard $(SRCDIR)/sview/*.cpp)
182
-+sView_SRCS1 := $(sort $(wildcard $(SRCDIR)/sview/*.cpp))
183
- sView_OBJS1 := ${sView_SRCS1:.cpp=.o}
184
- sView_SRCS2 :=
185
- sView_OBJS2 :=
186
- sView_LIB_DEPS = -lX11 -ldl -lgthread-2.0
187
- ifeq ($(TARGET_OS),osx)
188
--sView_SRCS2 := $(wildcard $(SRCDIR)/sview/*.mm)
189
-+sView_SRCS2 := $(sort $(wildcard $(SRCDIR)/sview/*.mm))
190
- sView_OBJS2 := ${sView_SRCS2:.mm=.o}
191
- sView_LIB_DEPS = -framework Appkit
192
- endif
193
sview-16_06.tar.gz/3rdparty/libconfig/rebuild.sh Deleted
20
 
1
@@ -1,18 +0,0 @@
2
-#!/bin/bash
3
-
4
-# small help to build libconfig for Android
5
-# http://www.hyperrealm.com/libconfig/
6
-
7
-# place up-to-date config.sub to libconfig-1.4.9/aux-build
8
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree
9
-#wget http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
10
-#wget http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
11
-
12
-#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/develop/android15-armv7a --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=arm-linux-androideabi-4.9
13
-#export PATH=$HOME/develop/android15-armv7a/bin:$PATH
14
-
15
-export CC=arm-linux-androideabi-gcc
16
-export CXX=arm-linux-androideabi-g++
17
-export "CFLAGS=-march=armv7-a -mfloat-abi=softfp"
18
-export "CXXFLAGS=-march=armv7-a -mfloat-abi=softfp"
19
-./configure --host arm-linux-androideabi
20
sview-16_06.tar.gz/3rdparty/openal-soft/openal-android.sh Deleted
64
 
1
@@ -1,62 +0,0 @@
2
-#!/bin/bash
3
-
4
-# go to the script directory
5
-anOpenAlSrc=${BASH_SOURCE%/*}
6
-if [ -d "$anOpenAlSrc" ]; then cd "$anOpenAlSrc"; fi
7
-anOpenAlSrc="$PWD"
8
-
9
-#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/develop/android15-armv7a --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=arm-linux-androideabi-4.9
10
-
11
-aToolchain=$HOME/develop/android-cmake/android.toolchain.cmake
12
-
13
-anApi="15"
14
-anAbi="armeabi-v7a"
15
-aPlatformAndCompiler=android-$anAbi
16
-aWorkDir=build/${aPlatformAndCompiler}-make
17
-aLogFile=$anOpenAlSrc/build-${aPlatformAndCompiler}.log
18
-
19
-aNbJobs=1
20
-
21
-mkdir -p $aWorkDir
22
-rm    -f $aLogFile
23
-
24
-pushd $aWorkDir
25
-
26
-set -o pipefail
27
-
28
-echo Configuring OpenAL-soft for Android...
29
-cmake -G "Unix Makefiles" \
30
- -D CMAKE_TOOLCHAIN_FILE:FILEPATH="$aToolchain" \
31
- -D ANDROID_STANDALONE_TOOLCHAIN:FILEPATH="$HOME/develop/android15-armv7a" \
32
- -D CMAKE_BUILD_TYPE:STRING="Release" \
33
- -D BUILD_LIBRARY_TYPE:STRING="Shared" \
34
- -D ALSOFT_BACKEND_OPENSL:BOOL="ON" \
35
- -D ALSOFT_REQUIRE_OPENSL:BOOL="ON" \
36
- -D ALSOFT_BACKEND_WAVE:BOOL="OFF" \
37
- -D ALSOFT_EXAMPLES:BOOL="OFF" \
38
- -D ALSOFT_TESTS:BOOL="OFF" \
39
- -D ALSOFT_UTILS:BOOL="OFF" \
40
- -D ALSOFT_NO_CONFIG_UTIL:BOOL="ON" \
41
- -D ANDROID_ABI:STRING="$anAbi" \
42
- -D ANDROID_NATIVE_API_LEVEL:STRING="$anApi" \
43
- -D ANDROID_STL:STRING="gnustl_shared" \
44
- -D CMAKE_INSTALL_PREFIX:PATH="$anOpenAlSrc/build/$aPlatformAndCompiler" \
45
- "$anOpenAlSrc" | tee -a $aLogFile
46
-
47
-#-D ANDROID_NDK:FILEPATH="$HOME/develop/android-ndk-r12b"
48
-
49
-aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
50
-
51
-# make clean build
52
-make clean
53
-
54
-echo Building OpenAL-soft...
55
-make -j $aNbJobs | tee -a $aLogFile
56
-aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
57
-
58
-echo Installing OCCT into $anOpenAlSrc/work/$aPlatformAndCompiler...
59
-make install | tee -a $aLogFile
60
-
61
-#$HOME/develop/android-ndk-r12b/ndk-depends $anOpenAlSrc/build/$aPlatformAndCompiler/libopenal.so
62
-
63
-popd
64
sview-16_06.tar.gz/.gitattributes -> sview-17_04.tar.gz/.gitattributes Changed
8
 
1
@@ -35,5 +35,6 @@
2
 *.icns      binary
3
 *.std       binary
4
 *.gz        binary
5
+*.mhr       binary
6
 .gitignore     eol=lf
7
 .gitattributes eol=lf
8
sview-16_06.tar.gz/.gitignore -> sview-17_04.tar.gz/.gitignore Changed
24
 
1
@@ -1,10 +1,14 @@
2
 *.o
3
 *.obj
4
 *.a
5
+*.vcxproj.user
6
+sView.Cpp.Custom.props
7
 *.pdb
8
 *.suo
9
 *.sdf
10
 *.opensdf
11
+*.VC.db
12
+*.VC.opendb
13
 *.ipch
14
 *.depend
15
 *.layout
16
@@ -39,6 +43,7 @@
17
 3rdparty/include/ft2build.h
18
 3rdparty/include/OVR*
19
 3rdparty/include/Extras/OVR*
20
+3rdparty/include/rapidjson
21
 build/
22
 bin/
23
 lib/
24
sview-16_06.tar.gz/3rdparty/FFmpeg/rebuild.sh -> sview-17_04.tar.gz/3rdparty/FFmpeg/rebuild.sh Changed
96
 
1
@@ -153,7 +153,12 @@
2
   # WinAPI threads are used only partially in FFmpeg
3
   # you should use with --enable-pthreads instead to enable full multithreading support!
4
   #configArguments="$configArguments --enable-w32threads"
5
-  configArguments="$configArguments --enable-avisynth"
6
+  configArguments="$configArguments --disable-w32threads"
7
+  if [ "$rebuildLicense" == "GPL" ]; then
8
+    configArguments="$configArguments --enable-avisynth"
9
+  fi
10
+
11
+  configArguments="$configArguments --enable-libopenjpeg"
12
 
13
   # avoid dynamic linkage with libgcc_s_sjlj-1.dll
14
   configArguments="$configArguments --extra-ldflags=-static-libgcc"
15
@@ -173,7 +178,7 @@
16
     targetFlags="--cross-prefix=$compilerPrefix --sysroot=${androidNdkRoot}/platforms/android-15/arch-arm --arch=arm"
17
   fi
18
 
19
-  configArguments="$configArguments --enable-cross-compile --target-os=linux $targetFlags"
20
+  configArguments="$configArguments --enable-cross-compile --target-os=android $targetFlags"
21
   #configArguments="$configArguments --extra-cflags='-fno-builtin-sin -fno-builtin-sinf'"
22
 
23
   configArguments="$configArguments --enable-jni --enable-mediacodec"
24
@@ -204,7 +209,7 @@
25
 fi
26
 
27
 # redirect error state from tee
28
-set -i pipefail
29
+set -o pipefail
30
 
31
 aNbJobs="$(getconf _NPROCESSORS_ONLN)"
32
 
33
@@ -236,6 +241,8 @@
34
   cp -f libavcodec/*.lib $OUTPUT_FOLDER_LIB &>/dev/null
35
 elif [ -f libavcodec/libavcodec.dylib ]; then
36
   cp -f -p -R libavcodec/*.dylib* $OUTPUT_FOLDER_LIB
37
+elif [ "$rebuildAndroid" == "true" ]; then
38
+  cp -f -L libavcodec/*.so $OUTPUT_FOLDER_LIB
39
 else
40
   cp -f -d libavcodec/*.so* $OUTPUT_FOLDER_LIB
41
 fi
42
@@ -245,6 +252,8 @@
43
   cp -f libavdevice/*.lib $OUTPUT_FOLDER_LIB &>/dev/null
44
 elif [ -f libavdevice/libavdevice.dylib ]; then
45
   cp -f -p -R libavdevice/*.dylib* $OUTPUT_FOLDER_LIB
46
+elif [ "$rebuildAndroid" == "true" ]; then
47
+  cp -f -L libavdevice/*.so $OUTPUT_FOLDER_LIB
48
 else
49
   cp -f -d libavdevice/*.so* $OUTPUT_FOLDER_LIB
50
 fi
51
@@ -254,6 +263,8 @@
52
   cp -f libavfilter/*.lib $OUTPUT_FOLDER_LIB &>/dev/null
53
 elif [ -f libavfilter/libavfilter.dylib ]; then
54
   cp -f -p -R libavfilter/*.dylib* $OUTPUT_FOLDER_LIB
55
+elif [ "$rebuildAndroid" == "true" ]; then
56
+  cp -f -L libavfilter/*.so $OUTPUT_FOLDER_LIB
57
 else
58
   cp -f -d libavfilter/*.so* $OUTPUT_FOLDER_LIB
59
 fi
60
@@ -263,6 +274,8 @@
61
   cp -f libavformat/*.lib $OUTPUT_FOLDER_LIB &>/dev/null
62
 elif [ -f libavformat/libavformat.dylib ]; then
63
   cp -f -p -R libavformat/*.dylib* $OUTPUT_FOLDER_LIB
64
+elif [ "$rebuildAndroid" == "true" ]; then
65
+  cp -f -L libavformat/*.so $OUTPUT_FOLDER_LIB
66
 else
67
   cp -f -d libavformat/*.so* $OUTPUT_FOLDER_LIB
68
 fi
69
@@ -272,6 +285,8 @@
70
   cp -f libavutil/*.lib $OUTPUT_FOLDER_LIB &>/dev/null
71
 elif [ -f libavutil/libavutil.dylib ]; then
72
   cp -f -p -R libavutil/*.dylib* $OUTPUT_FOLDER_LIB
73
+elif [ "$rebuildAndroid" == "true" ]; then
74
+  cp -f -L libavutil/*.so $OUTPUT_FOLDER_LIB
75
 else
76
   cp -f -d libavutil/*.so* $OUTPUT_FOLDER_LIB
77
 fi
78
@@ -281,6 +296,8 @@
79
   cp -f libswscale/*.lib $OUTPUT_FOLDER_LIB &>/dev/null
80
 elif [ -f libswscale/libswscale.dylib ]; then
81
   cp -f -p -R libswscale/*.dylib* $OUTPUT_FOLDER_LIB
82
+elif [ "$rebuildAndroid" == "true" ]; then
83
+  cp -f -L libswscale/*.so $OUTPUT_FOLDER_LIB
84
 else
85
   cp -f -d libswscale/*.so* $OUTPUT_FOLDER_LIB
86
 fi
87
@@ -290,6 +307,8 @@
88
   cp -f libswresample/*.lib $OUTPUT_FOLDER_LIB &>/dev/null
89
 elif [ -f libswresample/libswresample.dylib ]; then
90
   cp -f -p -R libswresample/*.dylib* $OUTPUT_FOLDER_LIB
91
+elif [ "$rebuildAndroid" == "true" ]; then
92
+  cp -f -L libswresample/*.so $OUTPUT_FOLDER_LIB
93
 else
94
   cp -f -d libswresample/*.so* $OUTPUT_FOLDER_LIB
95
 fi
96
sview-17_04.tar.gz/3rdparty/FFmpeg/sview_bzip_build_mingw.sh Added
65
 
1
@@ -0,0 +1,63 @@
2
+#!/bin/bash
3
+
4
+# small help to build bzip for MinGW [for sView project]
5
+# http://www.bzip.org/
6
+
7
+# go to the script directory
8
+aScriptPath=${BASH_SOURCE%/*}
9
+if [ -d "$aScriptPath" ]; then
10
+  cd "$aScriptPath"
11
+fi
12
+
13
+# define number of jobs from available CPU cores
14
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
15
+set -o pipefail
16
+
17
+aPathBak="$PATH"
18
+aLibRoot="$PWD"
19
+
20
+# apply the patch
21
+if grep -q 'sys\\stat.h' $aLibRoot/bzip2.c; then
22
+  cp -f $aLibRoot/bzip2.c $aLibRoot/bzip2.c.bak
23
+  sed -i 's/sys\\stat.h/sys\/stat.h/g' bzip2.c
24
+fi
25
+
26
+# 32-bit
27
+OUTPUT_FOLDER="$aLibRoot/install/bzip-mingw-win32"
28
+aPrefix=i686-w64-mingw32
29
+rm -f -r "$OUTPUT_FOLDER"
30
+mkdir -p "$OUTPUT_FOLDER/include"
31
+mkdir -p "$OUTPUT_FOLDER/lib"
32
+cp -f    "$aLibRoot/LICENSE" "$OUTPUT_FOLDER"
33
+cp -f    "$aLibRoot/README"  "$OUTPUT_FOLDER"
34
+cp -f    "$aLibRoot/bzlib.h" "$OUTPUT_FOLDER/include"
35
+
36
+echo "Output directory 32-bit: $OUTPUT_FOLDER"
37
+make clean
38
+make libbz2.a -j$aNbJobs CC=${aPrefix}-gcc AR=${aPrefix}-ar RANLIB=${aPrefix}-ranlib
39
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
40
+cp -f "$aLibRoot/libbz2.a" "$OUTPUT_FOLDER/lib"
41
+
42
+rm $OUTPUT_FOLDER/../bzip-mingw-win32.7z &>/dev/null
43
+7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../bzip-mingw-win32.7z $OUTPUT_FOLDER
44
+
45
+# 64-bit
46
+OUTPUT_FOLDER="$aLibRoot/install/bzip-mingw-win64"
47
+aPrefix=x86_64-w64-mingw32
48
+rm -f -r "$OUTPUT_FOLDER"
49
+mkdir -p "$OUTPUT_FOLDER/include"
50
+mkdir -p "$OUTPUT_FOLDER/lib"
51
+cp -f    "$aLibRoot/LICENSE" "$OUTPUT_FOLDER"
52
+cp -f    "$aLibRoot/README"  "$OUTPUT_FOLDER"
53
+cp -f    "$aLibRoot/bzlib.h" "$OUTPUT_FOLDER/include"
54
+
55
+echo "Output directory 64-bit: $OUTPUT_FOLDER"
56
+make clean
57
+make libbz2.a -j$aNbJobs CC=${aPrefix}-gcc AR=${aPrefix}-ar RANLIB=${aPrefix}-ranlib
58
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
59
+cp -f "$aLibRoot/libbz2.a" "$OUTPUT_FOLDER/lib"
60
+
61
+rm $OUTPUT_FOLDER/../bzip-mingw-win64.7z &>/dev/null
62
+7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../bzip-mingw-win64.7z $OUTPUT_FOLDER
63
+
64
+export "PATH=$aPathBak"
65
sview-17_04.tar.gz/3rdparty/FFmpeg/sview_zlib_build_mingw.sh Added
65
 
1
@@ -0,0 +1,63 @@
2
+#!/bin/bash
3
+
4
+# small help to build zlib for MinGW [for sView project]
5
+# http://zlib.net/
6
+
7
+# go to the script directory
8
+aScriptPath=${BASH_SOURCE%/*}
9
+if [ -d "$aScriptPath" ]; then
10
+  cd "$aScriptPath"
11
+fi
12
+
13
+# define number of jobs from available CPU cores
14
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
15
+set -o pipefail
16
+
17
+aPathBak="$PATH"
18
+aLibRoot="$PWD"
19
+
20
+# 32-bit
21
+OUTPUT_FOLDER="$aLibRoot/install/zlib-mingw-win32"
22
+aPrefix=i686-w64-mingw32
23
+rm -f -r "$OUTPUT_FOLDER"
24
+mkdir -p "$OUTPUT_FOLDER/include"
25
+mkdir -p "$OUTPUT_FOLDER/lib"
26
+cp -f    "$aLibRoot/README" "$OUTPUT_FOLDER"
27
+cp -f     $aLibRoot/*.h     "$OUTPUT_FOLDER/include"
28
+
29
+echo "Output directory 32-bit: $OUTPUT_FOLDER"
30
+export CC=${aPrefix}-gcc
31
+export AR=${aPrefix}-ar
32
+export RANLIB=${aPrefix}-ranlib
33
+./configure --static
34
+make clean
35
+make -j$aNbJobs
36
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
37
+cp -f "$aLibRoot/libz.a" "$OUTPUT_FOLDER/lib"
38
+
39
+rm $OUTPUT_FOLDER/../zlib-mingw-win32.7z &>/dev/null
40
+7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../zlib-mingw-win32.7z $OUTPUT_FOLDER
41
+
42
+# 64-bit
43
+OUTPUT_FOLDER="$aLibRoot/install/zlib-mingw-win64"
44
+aPrefix=x86_64-w64-mingw32
45
+rm -f -r "$OUTPUT_FOLDER"
46
+mkdir -p "$OUTPUT_FOLDER/include"
47
+mkdir -p "$OUTPUT_FOLDER/lib"
48
+cp -f    "$aLibRoot/README" "$OUTPUT_FOLDER"
49
+cp -f     $aLibRoot/*.h     "$OUTPUT_FOLDER/include"
50
+
51
+echo "Output directory 64-bit: $OUTPUT_FOLDER"
52
+export CC=${aPrefix}-gcc
53
+export AR=${aPrefix}-ar
54
+export RANLIB=${aPrefix}-ranlib
55
+./configure --static
56
+make clean
57
+make -j$aNbJobs
58
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
59
+cp -f "$aLibRoot/libz.a" "$OUTPUT_FOLDER/lib"
60
+
61
+rm $OUTPUT_FOLDER/../zlib-mingw-win64.7z &>/dev/null
62
+7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../zlib-mingw-win64.7z $OUTPUT_FOLDER
63
+
64
+export "PATH=$aPathBak"
65
sview-17_04.tar.gz/3rdparty/freetype Added
2
 
1
+(directory)
2
sview-17_04.tar.gz/3rdparty/freetype/sview_freetype_build_android.sh Added
90
 
1
@@ -0,0 +1,88 @@
2
+#!/bin/bash
3
+
4
+# small help to build FreeType for Android [for sView project]
5
+# https://www.freetype.org
6
+
7
+#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/develop/android15-armv7a  --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=arm-linux-androideabi-4.9
8
+#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=$HOME/develop/android21-aarch64 --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=aarch64-linux-android-4.9
9
+#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/develop/android15-x86     --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=x86-4.9
10
+
11
+# go to the script directory
12
+aScriptPath=${BASH_SOURCE%/*}
13
+if [ -d "$aScriptPath" ]; then
14
+  cd "$aScriptPath"
15
+fi
16
+
17
+# define number of jobs from available CPU cores
18
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
19
+set -o pipefail
20
+
21
+aPathBak="$PATH"
22
+aLibRoot="$PWD"
23
+aCFlagsArmv7a="-O2 -march=armv7-a -mfloat-abi=softfp"
24
+aCFlagsArmv8a="-O2 -march=armv8-a"
25
+aCFlagsx86="-O2 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32"
26
+aCPrefixArmv7a="arm-linux-androideabi-"
27
+aCPrefixArmv8a="aarch64-linux-android-"
28
+aCPrefixx86="i686-linux-android-"
29
+
30
+OUTPUT_FOLDER="$aLibRoot/install/freetype-android"
31
+rm -f -r "$OUTPUT_FOLDER"
32
+mkdir -p "$OUTPUT_FOLDER/include"
33
+mkdir -p "$OUTPUT_FOLDER/libs/armeabi-v7a"
34
+mkdir -p "$OUTPUT_FOLDER/libs/x86"
35
+mkdir -p "$OUTPUT_FOLDER/libs/arm64-v8a"
36
+cp -f    "$aLibRoot/README"         "$OUTPUT_FOLDER"
37
+cp -f    "$aLibRoot/docs/FTL.TXT"   "$OUTPUT_FOLDER"
38
+cp -f    "$aLibRoot/docs/GPLv2.TXT" "$OUTPUT_FOLDER"
39
+cp -f    "$aLibRoot/docs/CHANGES"   "$OUTPUT_FOLDER"
40
+cp -f -r "$aLibRoot/include"        "$OUTPUT_FOLDER"
41
+rm -f -r "$OUTPUT_FOLDER/include/freetype/internal"
42
+echo "Output directory: $OUTPUT_FOLDER"
43
+
44
+# armv7a
45
+export "PATH=$HOME/develop/android15-armv7a/bin:$aPathBak"
46
+export "CC=${aCPrefixArmv7a}gcc"
47
+export "CXX=${aCPrefixArmv7a}g++"
48
+export "CFLAGS=$aCFlagsArmv7a"
49
+./configure --host arm-linux-androideabi --enable-shared --with-png=no --with-harfbuzz=no 2>&1 | tee $OUTPUT_FOLDER/config-armv7a.log
50
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
51
+make clean
52
+make -j$aNbJobs
53
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
54
+cp -f "$aLibRoot/objs/.libs/libfreetype.so" "$OUTPUT_FOLDER/libs/armeabi-v7a"
55
+${aCPrefixArmv7a}strip --strip-unneeded     "$OUTPUT_FOLDER/libs/armeabi-v7a/libfreetype.so"
56
+#cp -f "$aLibRoot/objs/.libs/libfreetype.a" "$OUTPUT_FOLDER/libs/armeabi-v7a"
57
+
58
+# x86
59
+export "PATH=$HOME/develop/android15-x86/bin:$aPathBak"
60
+export "CC=${aCPrefixx86}gcc"
61
+export "CXX=${aCPrefixx86}g++"
62
+export "CFLAGS=$aCFlagsx86"
63
+./configure --host i686-linux-android --enable-shared --with-png=no --with-harfbuzz=no 2>&1 | tee $OUTPUT_FOLDER/config-x86.log
64
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
65
+make clean
66
+make -j$aNbJobs
67
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
68
+cp -f "$aLibRoot/objs/.libs/libfreetype.so" "$OUTPUT_FOLDER/libs/x86"
69
+${aCPrefixx86}strip --strip-unneeded        "$OUTPUT_FOLDER/libs/x86/libfreetype.so"
70
+#cp -f "$aLibRoot/objs/.libs/libfreetype.a" "$OUTPUT_FOLDER/libs/x86"
71
+
72
+# armv8a
73
+export "PATH=$HOME/develop/android21-aarch64/bin:$aPathBak"
74
+export "CC=${aCPrefixArmv8a}gcc"
75
+export "CXX=${aCPrefixArmv8a}g++"
76
+export "CFLAGS=$aCFlagsArmv8a"
77
+./configure --host aarch64-linux-android --enable-shared --with-png=no --with-harfbuzz=no 2>&1 | tee $OUTPUT_FOLDER/config-aarch64.log
78
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
79
+make clean
80
+make -j$aNbJobs
81
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
82
+cp -f "$aLibRoot/objs/.libs/libfreetype.so" "$OUTPUT_FOLDER/libs/arm64-v8a"
83
+${aCPrefixArmv8a}strip --strip-unneeded     "$OUTPUT_FOLDER/libs/arm64-v8a/libfreetype.so"
84
+#cp -f "$aLibRoot/objs/.libs/libfreetype.a" "$OUTPUT_FOLDER/libs/arm64-v8a"
85
+
86
+export "PATH=$aPathBak"
87
+
88
+rm $OUTPUT_FOLDER/../freetype-android.7z &>/dev/null
89
+7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../freetype-android.7z $OUTPUT_FOLDER
90
sview-17_04.tar.gz/3rdparty/libconfig/sview_libconfig_build_android.sh Added
93
 
1
@@ -0,0 +1,91 @@
2
+#!/bin/bash
3
+
4
+# small help to build libconfig for Android [for sView project]
5
+# http://www.hyperrealm.com/libconfig/
6
+
7
+# place up-to-date config.sub to libconfig-1.4.9/aux-build
8
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree
9
+#wget http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
10
+#wget http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
11
+
12
+#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/develop/android15-armv7a  --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=arm-linux-androideabi-4.9
13
+#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=$HOME/develop/android21-aarch64 --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=aarch64-linux-android-4.9
14
+#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/develop/android15-x86     --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=x86-4.9
15
+
16
+# go to the script directory
17
+aScriptPath=${BASH_SOURCE%/*}
18
+if [ -d "$aScriptPath" ]; then
19
+  cd "$aScriptPath"
20
+fi
21
+
22
+# define number of jobs from available CPU cores
23
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
24
+set -o pipefail
25
+
26
+aPathBak="$PATH"
27
+aLibRoot="$PWD"
28
+aCFlagsArmv7a="-O2 -march=armv7-a -mfloat-abi=softfp"
29
+aCFlagsArmv8a="-O2 -march=armv8-a"
30
+aCFlagsx86="-O2 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32"
31
+
32
+OUTPUT_FOLDER="$aLibRoot/install/libconfig-android"
33
+rm -f -r "$OUTPUT_FOLDER"
34
+mkdir -p "$OUTPUT_FOLDER/include"
35
+mkdir -p "$OUTPUT_FOLDER/libs/armeabi-v7a"
36
+mkdir -p "$OUTPUT_FOLDER/libs/x86"
37
+mkdir -p "$OUTPUT_FOLDER/libs/arm64-v8a"
38
+cp -f    "$aLibRoot/COPYING.LIB"       "$OUTPUT_FOLDER"
39
+cp -f    "$aLibRoot/README"            "$OUTPUT_FOLDER"
40
+cp -f    "$aLibRoot/lib/libconfig.h"   "$OUTPUT_FOLDER/include"
41
+cp -f    "$aLibRoot/lib/libconfig.h++" "$OUTPUT_FOLDER/include"
42
+echo "Output directory: $OUTPUT_FOLDER"
43
+
44
+# armv7a
45
+export "PATH=$HOME/develop/android15-armv7a/bin:$aPathBak"
46
+export "CC=arm-linux-androideabi-gcc"
47
+export "CXX=arm-linux-androideabi-g++"
48
+export "CFLAGS=$aCFlagsArmv7a"
49
+export "CXXFLAGS=$aCFlagsArmv7a"
50
+./configure --host arm-linux-androideabi 2>&1 | tee $OUTPUT_FOLDER/config-armv7a.log
51
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
52
+make clean
53
+make -j$aNbJobs
54
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
55
+#cp -f "$aLibRoot/lib/.libs/libconfig++.so" "$OUTPUT_FOLDER/libs/armeabi-v7a"
56
+cp -f "$aLibRoot/lib/.libs/libconfig.a"   "$OUTPUT_FOLDER/libs/armeabi-v7a"
57
+cp -f "$aLibRoot/lib/.libs/libconfig++.a" "$OUTPUT_FOLDER/libs/armeabi-v7a"
58
+
59
+# x86
60
+export "PATH=$HOME/develop/android15-x86/bin:$aPathBak"
61
+export "CC=i686-linux-android-gcc"
62
+export "CXX=i686-linux-android-g++"
63
+export "CFLAGS=$aCFlagsx86"
64
+export "CXXFLAGS=$aCFlagsx86"
65
+./configure --host i686-linux-android 2>&1 | tee $OUTPUT_FOLDER/config-x86.log
66
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
67
+make clean
68
+make -j$aNbJobs
69
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
70
+#cp -f "$aLibRoot/lib/.libs/libconfig++.so" "$OUTPUT_FOLDER/libs/x86"
71
+cp -f "$aLibRoot/lib/.libs/libconfig.a"   "$OUTPUT_FOLDER/libs/x86"
72
+cp -f "$aLibRoot/lib/.libs/libconfig++.a" "$OUTPUT_FOLDER/libs/x86"
73
+
74
+# armv8a
75
+export "PATH=$HOME/develop/android21-aarch64/bin:$aPathBak"
76
+export "CC=aarch64-linux-android-gcc"
77
+export "CXX=aarch64-linux-android-g++"
78
+export "CFLAGS=$aCFlagsArmv8a"
79
+export "CXXFLAGS=$aCFlagsArmv8a"
80
+./configure --host aarch64-linux-android 2>&1 | tee $OUTPUT_FOLDER/config-aarch64.log
81
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
82
+make clean
83
+make -j$aNbJobs
84
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
85
+#cp -f "$aLibRoot/lib/.libs/libconfig++.so" "$OUTPUT_FOLDER/libs/arm64-v8a"
86
+cp -f "$aLibRoot/lib/.libs/libconfig.a"   "$OUTPUT_FOLDER/libs/arm64-v8a"
87
+cp -f "$aLibRoot/lib/.libs/libconfig++.a" "$OUTPUT_FOLDER/libs/arm64-v8a"
88
+
89
+export "PATH=$aPathBak"
90
+
91
+rm $OUTPUT_FOLDER/../libconfig-android.7z &>/dev/null
92
+7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../libconfig-android.7z $OUTPUT_FOLDER
93
sview-17_04.tar.gz/3rdparty/openal-soft/sview_openal_build_android.sh Added
86
 
1
@@ -0,0 +1,84 @@
2
+#!/bin/bash
3
+
4
+# go to the script directory
5
+anOpenAlSrc=${BASH_SOURCE%/*}
6
+if [ -d "$anOpenAlSrc" ]; then cd "$anOpenAlSrc"; fi
7
+anOpenAlSrc="$PWD"
8
+
9
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
10
+
11
+anNdkPath=$HOME/develop/android-ndk-r12b
12
+aToolchain=$HOME/develop/android-cmake/android.toolchain.cmake
13
+
14
+# remove SO version from library - unsupported by Android
15
+if grep -q PROPERTIES\ VERSION $anOpenAlSrc/CMakeLists.txt; then
16
+  cp -f $anOpenAlSrc/CMakeLists.txt $anOpenAlSrc/CMakeLists.bak.txt
17
+  sed -i '/PROPERTIES\ VERSION/,+1 d' CMakeLists.txt
18
+fi
19
+
20
+cmakeBuildOpenAl() {
21
+  anApi="$1"
22
+  anAbi="$2"
23
+  aPlatformAndCompiler=android-$anAbi
24
+  aWorkDir=build/${aPlatformAndCompiler}-make
25
+  aLogFile=$anOpenAlSrc/build-${aPlatformAndCompiler}.log
26
+
27
+  mkdir -p $aWorkDir
28
+  rm    -f $aLogFile
29
+
30
+  pushd $aWorkDir
31
+
32
+  set -o pipefail
33
+
34
+  echo Configuring OpenAL-soft for Android...
35
+  cmake -G "Unix Makefiles" \
36
+ -D CMAKE_TOOLCHAIN_FILE:FILEPATH="$aToolchain" \
37
+ -D ANDROID_NDK:FILEPATH="$anNdkPath" \
38
+ -D ANDROID_ABI:STRING="$anAbi" \
39
+ -D ANDROID_NATIVE_API_LEVEL:STRING="$anApi" \
40
+ -D ANDROID_STL:STRING="gnustl_shared" \
41
+ -D CMAKE_BUILD_TYPE:STRING="Release" \
42
+ -D BUILD_LIBRARY_TYPE:STRING="Shared" \
43
+ -D ALSOFT_BACKEND_OPENSL:BOOL="ON" \
44
+ -D ALSOFT_REQUIRE_OPENSL:BOOL="ON" \
45
+ -D ALSOFT_BACKEND_WAVE:BOOL="OFF" \
46
+ -D ALSOFT_EXAMPLES:BOOL="OFF" \
47
+ -D ALSOFT_TESTS:BOOL="OFF" \
48
+ -D ALSOFT_UTILS:BOOL="OFF" \
49
+ -D ALSOFT_NO_CONFIG_UTIL:BOOL="ON" \
50
+ -D CMAKE_INSTALL_PREFIX:PATH="$anOpenAlSrc/build/$aPlatformAndCompiler" \
51
+ "$anOpenAlSrc" | tee -a $aLogFile
52
+
53
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
54
+  make clean
55
+
56
+  echo Building OpenAL-soft...
57
+  make -j$aNbJobs | tee -a $aLogFile
58
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
59
+
60
+  echo Installing OpenAL into $anOpenAlSrc/work/$aPlatformAndCompiler...
61
+  make install | tee -a $aLogFile
62
+
63
+  popd
64
+}
65
+
66
+cmakeBuildOpenAl "15" "armeabi-v7a"
67
+cmakeBuildOpenAl "15" "x86"
68
+cmakeBuildOpenAl "21" "arm64-v8a"
69
+
70
+OUTPUT_FOLDER="$anOpenAlSrc/install/openal-soft-android"
71
+rm -f -r "$OUTPUT_FOLDER"
72
+mkdir -p "$OUTPUT_FOLDER/include"
73
+mkdir -p "$OUTPUT_FOLDER/libs/armeabi-v7a"
74
+mkdir -p "$OUTPUT_FOLDER/libs/x86"
75
+mkdir -p "$OUTPUT_FOLDER/libs/arm64-v8a"
76
+cp -f    "$anOpenAlSrc/COPYING"           "$OUTPUT_FOLDER"
77
+cp -f    "$anOpenAlSrc/README"            "$OUTPUT_FOLDER"
78
+cp -f -r "$anOpenAlSrc/build/android-armeabi-v7a/include"          "$OUTPUT_FOLDER"
79
+cp -f -r "$anOpenAlSrc/build/android-armeabi-v7a/share"            "$OUTPUT_FOLDER"
80
+cp -f -L "$anOpenAlSrc/build/android-armeabi-v7a/lib/libopenal.so" "$OUTPUT_FOLDER/libs/armeabi-v7a"
81
+cp -f -L "$anOpenAlSrc/build/android-x86/lib/libopenal.so"         "$OUTPUT_FOLDER/libs/x86"
82
+cp -f -L "$anOpenAlSrc/build/android-arm64-v8a/lib/libopenal.so"   "$OUTPUT_FOLDER/libs/arm64-v8a"
83
+
84
+rm $OUTPUT_FOLDER/../openal-soft-android.7z &>/dev/null
85
+7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../openal-soft-android.7z $OUTPUT_FOLDER
86
sview-16_06.tar.gz/Makefile -> sview-17_04.tar.gz/Makefile Changed
201
 
1
@@ -15,7 +15,7 @@
2
 
3
 TARGET_OS = linux
4
 
5
-#ANDROID_NDK = /home/kirill/develop/android-ndk-r10
6
+#ANDROID_NDK = $(HOME)/develop/android-ndk-r12b
7
 ifeq ($(OS),Windows_NT)
8
 TARGET_OS = wnt
9
 else
10
@@ -40,8 +40,6 @@
11
 BUILD_ROOT = $(BUILD_ROOT_BUNDLE)/Contents/MacOS
12
 endif
13
 
14
-# folder containing OCCT resources ($CASROOT/src)
15
-OCCT_RES =
16
 FFMPEG_ROOT =
17
 FREETYPE_ROOT =
18
 OPENAL_ROOT =
19
@@ -88,7 +86,22 @@
20
 
21
 # Android libraries
22
 ifdef ANDROID_NDK
23
-TOOLCHAIN = $(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/arm-linux-androideabi/bin/
24
+ANDROID_EABI = armeabi-v7a
25
+ifeq ($(ANDROID_EABI),arm64-v8a)
26
+  TOOLCHAIN = $(ANDROID_NDK)/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-
27
+  ANDROID_SYSROOT = --sysroot=$(ANDROID_NDK)/platforms/android-21/arch-arm64
28
+  ANDROID_MARCH   = -march=armv8-a
29
+else ifeq ($(ANDROID_EABI),x86)
30
+  TOOLCHAIN = $(ANDROID_NDK)/toolchains/i686-linux-android-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-
31
+  ANDROID_SYSROOT = --sysroot=$(ANDROID_NDK)/platforms/android-15/arch-x86
32
+  ANDROID_MARCH   = -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32
33
+else
34
+  # armeabi-v7a
35
+  TOOLCHAIN = $(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
36
+  ANDROID_SYSROOT = --sysroot=$(ANDROID_NDK)/platforms/android-15/arch-arm
37
+  ANDROID_MARCH   = -march=armv7-a -mfloat-abi=softfp
38
+endif
39
+
40
 HAVE_MONGOOSE =
41
 LIB_PTHREAD = -lc
42
 LIB_GLX = -lEGL -lGLESv2
43
@@ -103,6 +116,8 @@
44
 CXX = $(TOOLCHAIN)g++
45
 AR  = $(TOOLCHAIN)ar
46
 LD  = $(TOOLCHAIN)g++
47
+STRIP = $(TOOLCHAIN)strip
48
+STRIPFLAGS = --strip-unneeded
49
 
50
 LDSTRIP = -s
51
 LDZDEF = -z defs
52
@@ -115,17 +130,19 @@
53
 
54
 # to activate debug build
55
 #EXTRA_CXXFLAGS = -DST_DEBUG_LOG_TO_FILE=\"/sdcard/Android/data/com.sview/files/sview.log\" -DST_DEBUG
56
+#EXTRA_CXXFLAGS += -DST_DEBUG_GL
57
 #EXTRA_CXXFLAGS += -DST_DEBUG_FFMPEG_VERBOSE
58
 #EXTRA_CXXFLAGS += -DST_DEBUG_SYSLOG
59
 #EXTRA_CXXFLAGS += -DST_DEBUG_THREADID
60
 #LDSTRIP =
61
+#STRIPFLAGS = --info
62
 
63
 ifdef ANDROID_NDK
64
-ANDROID_EABI = armeabi-v7a
65
 LIBSUBFOLDER = libs/$(ANDROID_EABI)
66
-EXTRA_CFLAGS   += --sysroot=$(ANDROID_NDK)/platforms/android-15/arch-arm -march=armv7-a -mfloat-abi=softfp
67
-EXTRA_CXXFLAGS += --sysroot=$(ANDROID_NDK)/platforms/android-15/arch-arm -march=armv7-a -mfloat-abi=softfp -I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.8/include -I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.8/libs/$(ANDROID_EABI)/include -DST_HAVE_EGL -DST_NO_UPDATES_CHECK
68
-EXTRA_LDFLAGS  += --sysroot=$(ANDROID_NDK)/platforms/android-15/arch-arm -L$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.8/libs/$(ANDROID_EABI) -lstdc++ -lgnustl_shared
69
+EXTRA_CFLAGS   += $(ANDROID_SYSROOT) $(ANDROID_MARCH)
70
+EXTRA_CXXFLAGS += $(ANDROID_SYSROOT) $(ANDROID_MARCH)
71
+EXTRA_CXXFLAGS += -I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/include -I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(ANDROID_EABI)/include -DST_HAVE_EGL -DST_NO_UPDATES_CHECK
72
+EXTRA_LDFLAGS  += $(ANDROID_SYSROOT) -L$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(ANDROID_EABI) -lstdc++ -lgnustl_shared
73
 else
74
 EXTRA_CFLAGS   += -mmmx -msse
75
 EXTRA_CXXFLAGS += -mmmx -msse
76
@@ -251,56 +268,47 @@
77
    cp -f -r $(BUILD_ROOT)/textures/*      $(aDestAndroid)/assets/textures/
78
    cp -f    license-gpl-3.0.txt           $(aDestAndroid)/assets/info/license.txt
79
 
80
-install_android_libs:
81
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStShared)       $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStShared)
82
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStGLWidgets)    $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStGLWidgets)
83
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStCore)         $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStCore)
84
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStOutAnaglyph)  $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStOutAnaglyph)
85
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStOutInterlace) $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStOutInterlace)
86
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStOutDistorted) $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStOutDistorted)
87
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStImageViewer)  $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStImageViewer)
88
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStMoviePlayer)  $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStMoviePlayer)
89
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(sViewAndroid)    $(aDestAndroid)/libs/$(ANDROID_EABI)/$(sViewAndroid)
90
-   cp -f $(FREETYPE_ROOT)/libs/$(ANDROID_EABI)/libfreetype.so      $(aDestAndroid)/libs/$(ANDROID_EABI)/
91
-   cp -f $(OPENAL_ROOT)/libs/$(ANDROID_EABI)/libopenal.so          $(aDestAndroid)/libs/$(ANDROID_EABI)/
92
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavcodec-*.so       $(aDestAndroid)/libs/$(ANDROID_EABI)/
93
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavdevice-*.so      $(aDestAndroid)/libs/$(ANDROID_EABI)/
94
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavformat-*.so      $(aDestAndroid)/libs/$(ANDROID_EABI)/
95
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavutil-*.so        $(aDestAndroid)/libs/$(ANDROID_EABI)/
96
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libswresample-*.so    $(aDestAndroid)/libs/$(ANDROID_EABI)/
97
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libswscale-*.so       $(aDestAndroid)/libs/$(ANDROID_EABI)/
98
-
99
-install_android_cad_libs:
100
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStShared)       $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStShared)
101
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStGLWidgets)    $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStGLWidgets)
102
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStCore)         $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStCore)
103
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStOutAnaglyph)  $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStOutAnaglyph)
104
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStOutInterlace) $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStOutInterlace)
105
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStOutDistorted) $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStOutDistorted)
106
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStImageViewer)  $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStImageViewer)
107
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(aStMoviePlayer)  $(aDestAndroid)/libs/$(ANDROID_EABI)/$(aStMoviePlayer)
108
-   ln --force --symbolic ../../../$(BUILD_ROOT)/$(sViewAndroidCad) $(aDestAndroid)/libs/$(ANDROID_EABI)/$(sViewAndroid)
109
-   cp -f $(FREETYPE_ROOT)/libs/$(ANDROID_EABI)/libfreetype.so      $(aDestAndroid)/libs/$(ANDROID_EABI)/
110
-   cp -f $(OPENAL_ROOT)/libs/$(ANDROID_EABI)/libopenal.so          $(aDestAndroid)/libs/$(ANDROID_EABI)/
111
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavcodec-*.so       $(aDestAndroid)/libs/$(ANDROID_EABI)/
112
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavdevice-*.so      $(aDestAndroid)/libs/$(ANDROID_EABI)/
113
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavformat-*.so      $(aDestAndroid)/libs/$(ANDROID_EABI)/
114
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavutil-*.so        $(aDestAndroid)/libs/$(ANDROID_EABI)/
115
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libswresample-*.so    $(aDestAndroid)/libs/$(ANDROID_EABI)/
116
-   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libswscale-*.so       $(aDestAndroid)/libs/$(ANDROID_EABI)/
117
+install_android_libs: $(aStShared) $(aStGLWidgets) $(aStCore) $(aStOutAnaglyph) $(aStOutInterlace) $(aStOutDistorted) $(aStImageViewer) $(aStMoviePlayer) $(sViewAndroid)
118
+   cp -f $(BUILD_ROOT)/$(aStShared)       $(aDestAndroid)/libs/$(ANDROID_EABI)/
119
+   cp -f $(BUILD_ROOT)/$(aStGLWidgets)    $(aDestAndroid)/libs/$(ANDROID_EABI)/
120
+   cp -f $(BUILD_ROOT)/$(aStCore)         $(aDestAndroid)/libs/$(ANDROID_EABI)/
121
+   cp -f $(BUILD_ROOT)/$(aStOutAnaglyph)  $(aDestAndroid)/libs/$(ANDROID_EABI)/
122
+   cp -f $(BUILD_ROOT)/$(aStOutInterlace) $(aDestAndroid)/libs/$(ANDROID_EABI)/
123
+   cp -f $(BUILD_ROOT)/$(aStOutDistorted) $(aDestAndroid)/libs/$(ANDROID_EABI)/
124
+   cp -f $(BUILD_ROOT)/$(aStImageViewer)  $(aDestAndroid)/libs/$(ANDROID_EABI)/
125
+   cp -f $(BUILD_ROOT)/$(aStMoviePlayer)  $(aDestAndroid)/libs/$(ANDROID_EABI)/
126
+   cp -f $(BUILD_ROOT)/$(sViewAndroid)    $(aDestAndroid)/libs/$(ANDROID_EABI)/
127
+   cp -f $(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(ANDROID_EABI)/libgnustl_shared.so $(aDestAndroid)/libs/$(ANDROID_EABI)/
128
+   $(STRIP) $(STRIPFLAGS) $(aDestAndroid)/libs/$(ANDROID_EABI)/libgnustl_shared.so
129
+   cp -f $(FREETYPE_ROOT)/libs/$(ANDROID_EABI)/libfreetype.so    $(aDestAndroid)/libs/$(ANDROID_EABI)/
130
+   cp -f $(OPENAL_ROOT)/libs/$(ANDROID_EABI)/libopenal.so        $(aDestAndroid)/libs/$(ANDROID_EABI)/
131
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavcodec.so       $(aDestAndroid)/libs/$(ANDROID_EABI)/
132
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavdevice.so      $(aDestAndroid)/libs/$(ANDROID_EABI)/
133
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavformat.so      $(aDestAndroid)/libs/$(ANDROID_EABI)/
134
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavutil.so        $(aDestAndroid)/libs/$(ANDROID_EABI)/
135
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libswresample.so    $(aDestAndroid)/libs/$(ANDROID_EABI)/
136
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libswscale.so       $(aDestAndroid)/libs/$(ANDROID_EABI)/
137
+
138
+install_android_cad_libs: $(aStShared) $(aStGLWidgets) $(aStCore) $(aStOutAnaglyph) $(aStOutInterlace) $(aStOutDistorted) $(aStImageViewer) $(aStMoviePlayer) $(sViewAndroidCad)
139
+   cp -f $(BUILD_ROOT)/$(aStShared)       $(aDestAndroid)/libs/$(ANDROID_EABI)/
140
+   cp -f $(BUILD_ROOT)/$(aStGLWidgets)    $(aDestAndroid)/libs/$(ANDROID_EABI)/
141
+   cp -f $(BUILD_ROOT)/$(aStCore)         $(aDestAndroid)/libs/$(ANDROID_EABI)/
142
+   cp -f $(BUILD_ROOT)/$(aStOutAnaglyph)  $(aDestAndroid)/libs/$(ANDROID_EABI)/
143
+   cp -f $(BUILD_ROOT)/$(aStOutInterlace) $(aDestAndroid)/libs/$(ANDROID_EABI)/
144
+   cp -f $(BUILD_ROOT)/$(aStOutDistorted) $(aDestAndroid)/libs/$(ANDROID_EABI)/
145
+   cp -f $(BUILD_ROOT)/$(aStImageViewer)  $(aDestAndroid)/libs/$(ANDROID_EABI)/
146
+   cp -f $(BUILD_ROOT)/$(aStMoviePlayer)  $(aDestAndroid)/libs/$(ANDROID_EABI)/
147
+   cp -f $(BUILD_ROOT)/$(sViewAndroidCad) $(aDestAndroid)/libs/$(ANDROID_EABI)/
148
+   cp -f $(FREETYPE_ROOT)/libs/$(ANDROID_EABI)/libfreetype.so    $(aDestAndroid)/libs/$(ANDROID_EABI)/
149
+   cp -f $(OPENAL_ROOT)/libs/$(ANDROID_EABI)/libopenal.so        $(aDestAndroid)/libs/$(ANDROID_EABI)/
150
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavcodec.so       $(aDestAndroid)/libs/$(ANDROID_EABI)/
151
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavdevice.so      $(aDestAndroid)/libs/$(ANDROID_EABI)/
152
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavformat.so      $(aDestAndroid)/libs/$(ANDROID_EABI)/
153
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libavutil.so        $(aDestAndroid)/libs/$(ANDROID_EABI)/
154
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libswresample.so    $(aDestAndroid)/libs/$(ANDROID_EABI)/
155
+   cp -f $(FFMPEG_ROOT)/libs/$(ANDROID_EABI)/libswscale.so       $(aDestAndroid)/libs/$(ANDROID_EABI)/
156
    mkdir -p $(aDestAndroid)/assets/shaders
157
-   mkdir -p $(aDestAndroid)/assets/shaders/occt
158
-   mkdir -p $(aDestAndroid)/assets/res
159
    mkdir -p $(aDestAndroid)/assets/lang
160
-   cp -f $(OCCT_RES)/Shaders/Declarations.glsl     $(aDestAndroid)/assets/shaders/occt/
161
-   cp -f $(OCCT_RES)/Shaders/DeclarationsImpl.glsl $(aDestAndroid)/assets/shaders/occt/
162
-   cp -f $(OCCT_RES)/UnitsAPI/Lexi_Expr.dat        $(aDestAndroid)/assets/res/
163
-   cp -f $(OCCT_RES)/UnitsAPI/Units.dat            $(aDestAndroid)/assets/res/
164
-   cp -f $(OCCT_RES)/SHMessage/*.*                 $(aDestAndroid)/assets/lang/
165
-   cp -f $(OCCT_RES)/XSMessage/*.*                 $(aDestAndroid)/assets/lang/
166
-   cp -f $(OCCT_RES)/TObj/*.msg                    $(aDestAndroid)/assets/lang/
167
-   cp -f $(OCCT_RES)/StdResource/*                 $(aDestAndroid)/assets/res/
168
-   cp -f $(OCCT_RES)/XSTEPResource/*               $(aDestAndroid)/assets/res/
169
 
170
 pre_all:
171
    mkdir -p $(BUILD_ROOT)/lang/English
172
@@ -317,12 +325,12 @@
173
    cp -f -r textures/* $(BUILD_ROOT)/textures/
174
 
175
 # StShared shared library
176
-aStShared_SRCS1 := $(wildcard $(SRCDIR)/StShared/*.cpp)
177
+aStShared_SRCS1 := $(sort $(wildcard $(SRCDIR)/StShared/*.cpp))
178
 aStShared_OBJS1 := ${aStShared_SRCS1:.cpp=.o}
179
 aStShared_SRCS2 :=
180
 aStShared_OBJS2 :=
181
 ifeq ($(TARGET_OS),osx)
182
-aStShared_SRCS2 := $(wildcard $(SRCDIR)/StShared/*.mm)
183
+aStShared_SRCS2 := $(sort $(wildcard $(SRCDIR)/StShared/*.mm))
184
 aStShared_OBJS2 := ${aStShared_SRCS2:.mm=.o}
185
 endif
186
 aStShared_LIB  := $(LIB) $(LIB_GLX) $(LIB_GTK) $(LIB_ANDROID) -lavutil -lavformat -lavcodec -lswscale -lfreetype $(LIB_CONFIG) $(LIB_PTHREAD)
187
@@ -333,7 +341,7 @@
188
    rm -rf StShared/*.o
189
 
190
 # StGLWidgets shared library
191
-aStGLWidgets_SRCS := $(wildcard $(SRCDIR)/StGLWidgets/*.cpp)
192
+aStGLWidgets_SRCS := $(sort $(wildcard $(SRCDIR)/StGLWidgets/*.cpp))
193
 aStGLWidgets_OBJS := ${aStGLWidgets_SRCS:.cpp=.o}
194
 aStGLWidgets_LIB  := $(LIB) -lStShared $(LIB_GLX)
195
 $(aStGLWidgets) : pre_StGLWidgets $(aStShared) $(aStGLWidgets_OBJS)
196
@@ -345,12 +353,12 @@
197
    rm -rf StGLWidgets/*.o
198
 
199
 # StCore library
200
-aStCore_SRCS1 := $(wildcard $(SRCDIR)/StCore/*.cpp)
201
sview-16_06.tar.gz/StCADViewer/AndroidManifest.xml -> sview-17_04.tar.gz/StCADViewer/AndroidManifest.xml Changed
73
 
1
@@ -2,7 +2,8 @@
2
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
           package="com.sview.cadviewer"
4
           android:versionCode="1"
5
-          android:versionName="16.03">
6
+          android:versionName="16.12"
7
+          android:installLocation="auto">
8
     <application android:label="@string/app_name"
9
                  android:hasCode="true"
10
                  android:icon="@drawable/ic_launcher">
11
@@ -26,6 +27,8 @@
12
 
13
                 <data android:mimeType="model/iges"/>
14
                 <data android:mimeType="model/step"/>
15
+                <data android:mimeType="model/gltf+json"/>
16
+                <data android:mimeType="model/gltf.binary"/>
17
 
18
                 <data android:mimeType="application/iges"/>
19
                 <data android:mimeType="application/step"/>
20
@@ -56,6 +59,19 @@
21
                 <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.brep"/>
22
                 <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.BREP"/>
23
 
24
+                <data android:pathPattern=".*\\.xbf"/>
25
+                <data android:pathPattern=".*\\.XBF"/>
26
+                <data android:pathPattern=".*\\..*\\.xbf"/>
27
+                <data android:pathPattern=".*\\..*\\.XBF"/>
28
+                <data android:pathPattern=".*\\..*\\..*\\.xbf"/>
29
+                <data android:pathPattern=".*\\..*\\..*\\.XBF"/>
30
+                <data android:pathPattern=".*\\..*\\..*\\..*\\.xbf"/>
31
+                <data android:pathPattern=".*\\..*\\..*\\..*\\.XBF"/>
32
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.xbf"/>
33
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.XBF"/>
34
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.xbf"/>
35
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.XBF"/>
36
+
37
                 <data android:pathPattern=".*\\.rle"/>
38
                 <data android:pathPattern=".*\\.RLE"/>
39
                 <data android:pathPattern=".*\\..*\\.rle"/>
40
@@ -120,6 +136,32 @@
41
                 <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.IGES"/>
42
                 <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.iges"/>
43
                 <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.IGES"/>
44
+
45
+                <data android:pathPattern=".*\\.gltf"/>
46
+                <data android:pathPattern=".*\\.GLTF"/>
47
+                <data android:pathPattern=".*\\..*\\.gltf"/>
48
+                <data android:pathPattern=".*\\..*\\.GLTF"/>
49
+                <data android:pathPattern=".*\\..*\\..*\\.gltf"/>
50
+                <data android:pathPattern=".*\\..*\\..*\\.GLTF"/>
51
+                <data android:pathPattern=".*\\..*\\..*\\..*\\.gltf"/>
52
+                <data android:pathPattern=".*\\..*\\..*\\..*\\.GLTF"/>
53
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.gltf"/>
54
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.GLTF"/>
55
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.gltf"/>
56
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.GLTF"/>
57
+
58
+                <data android:pathPattern=".*\\.glb"/>
59
+                <data android:pathPattern=".*\\.GLB"/>
60
+                <data android:pathPattern=".*\\..*\\.glb"/>
61
+                <data android:pathPattern=".*\\..*\\.GLB"/>
62
+                <data android:pathPattern=".*\\..*\\..*\\.glb"/>
63
+                <data android:pathPattern=".*\\..*\\..*\\.GLB"/>
64
+                <data android:pathPattern=".*\\..*\\..*\\..*\\.glb"/>
65
+                <data android:pathPattern=".*\\..*\\..*\\..*\\.GLB"/>
66
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.glb"/>
67
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.GLB"/>
68
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.glb"/>
69
+                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.GLB"/>
70
             </intent-filter>
71
         </activity>
72
     </application>
73
sview-17_04.tar.gz/StCADViewer/StAssetDocument.cpp Added
14
 
1
@@ -0,0 +1,12 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#include "StAssetDocument.h"
9
+
10
+StAssetDocument::StAssetDocument()
11
+: StDocObjectNode() {
12
+    //
13
+}
14
sview-17_04.tar.gz/StCADViewer/StAssetDocument.h Added
144
 
1
@@ -0,0 +1,142 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#ifndef __StAssetDocument_h_
9
+#define __StAssetDocument_h_
10
+
11
+#include "StPrimArray.h"
12
+
13
+#include <NCollection_Vector.hxx>
14
+#include <NCollection_Sequence.hxx>
15
+
16
+/**
17
+ * Type of the document node.
18
+ */
19
+enum StDocNodeType {
20
+    StDocNodeType_Node,   //!< general node type containing child of any type
21
+    StDocNodeType_Object, //!< object node type
22
+    StDocNodeType_Mesh,   //!< mesh node
23
+    StDocNodeType_Unknown //!< invalid node type
24
+};
25
+
26
+/**
27
+ * Basic document node.
28
+ */
29
+class StDocNode : public Standard_Transient {
30
+
31
+    DEFINE_STANDARD_RTTI_INLINE(StDocNode, Standard_Transient)
32
+
33
+        public:
34
+
35
+    /**
36
+     * Return node type.
37
+     */
38
+    StDocNodeType nodeType() const { return myNodeType; }
39
+
40
+    /**
41
+     * Return node name.
42
+     */
43
+    const StString& nodeName() const { return myNodeName; }
44
+
45
+    /**
46
+     * Assign node name.
47
+     */
48
+    void setNodeName(const StString& theName) { myNodeName = theName; }
49
+
50
+    /**
51
+     * Return node local transformation (relative to the parent node).
52
+     */
53
+    const gp_Trsf& nodeTransformation() const { return myTrsf; }
54
+
55
+    /**
56
+     * Assign node local transformation.
57
+     */
58
+    void setNodeTransformation(const gp_Trsf& theTrsf) { myTrsf = theTrsf; }
59
+
60
+    /**
61
+     * Access child nodes.
62
+     */
63
+    const NCollection_Sequence<Handle(StDocNode)>& Children() const { return myChildren; }
64
+
65
+    /**
66
+     * Modify child nodes.
67
+     */
68
+    NCollection_Sequence<Handle(StDocNode)>& ChangeChildren() { return myChildren; }
69
+
70
+        protected:
71
+
72
+    /**
73
+     * Protected constructor.
74
+     */
75
+    StDocNode(StDocNodeType theNodeType) : myNodeType(theNodeType) {}
76
+
77
+        protected:
78
+
79
+    NCollection_Sequence<Handle(StDocNode)> myChildren; //!< child nodes
80
+    StString      myNodeName; //!< node name
81
+    StDocNodeType myNodeType; //!< node type
82
+    gp_Trsf       myTrsf;     //!< node local transformation
83
+
84
+};
85
+
86
+/**
87
+ * The document node holding object(s).
88
+ */
89
+class StDocObjectNode : public StDocNode {
90
+
91
+    DEFINE_STANDARD_RTTI_INLINE(StDocObjectNode, StDocNode)
92
+
93
+        public:
94
+
95
+    /**
96
+     * Empty constructor.
97
+     */
98
+    StDocObjectNode() : StDocNode(StDocNodeType_Object) {}
99
+
100
+};
101
+
102
+/**
103
+ * The document node holding Mesh object (list of primitive arrays).
104
+ */
105
+class StDocMeshNode : public StDocNode {
106
+
107
+    DEFINE_STANDARD_RTTI_INLINE(StDocMeshNode, StDocNode)
108
+
109
+        public:
110
+
111
+    /**
112
+     * Empty constructor.
113
+     */
114
+    StDocMeshNode() : StDocNode(StDocNodeType_Mesh) {}
115
+
116
+    /**
117
+     * Access primitive arrays.
118
+     */
119
+    const NCollection_Sequence<Handle(StPrimArray)>& PrimitiveArrays() const { return myPrimArrays; }
120
+
121
+    /**
122
+     * Modify primitive arrays.
123
+     */
124
+    NCollection_Sequence<Handle(StPrimArray)>& ChangePrimitiveArrays() { return myPrimArrays; }
125
+
126
+        protected:
127
+
128
+    NCollection_Sequence<Handle(StPrimArray)> myPrimArrays; //!< primitive arrays
129
+
130
+};
131
+
132
+/**
133
+ * Document definition.
134
+ */
135
+class StAssetDocument : public StDocObjectNode {
136
+
137
+        public:
138
+
139
+    ST_LOCAL StAssetDocument();
140
+
141
+};
142
+
143
+#endif //__StAssetDocument_h_
144
sview-17_04.tar.gz/StCADViewer/StAssetImportGltf.cpp Added
201
 
1
@@ -0,0 +1,1465 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016-2017
6
+ */
7
+
8
+#ifdef _WIN32
9
+    #define NOMINMAX
10
+#endif
11
+
12
+#include "StAssetImportGltf.h"
13
+
14
+#include "StImageOcct.h"
15
+
16
+#include <StStrings/StLogger.h>
17
+#include <StTemplates/StArrayStreamBuffer.h>
18
+
19
+#include <Graphic3d_Mat4d.hxx>
20
+#include <Graphic3d_Vec.hxx>
21
+#include <gp_Quaternion.hxx>
22
+#include <NCollection_Buffer.hxx>
23
+#include <OSD_OpenFile.hxx>
24
+#include <Precision.hxx>
25
+
26
+namespace
27
+{
28
+    /**
29
+     * Material extension.
30
+     */
31
+    const char THE_KHR_materials_common[] = "KHR_materials_common";
32
+    const char THE_KHR_binary_glTF[]      = "KHR_binary_glTF";
33
+
34
+    //! Look-up table for decoding base64 stream.
35
+    static const stUByte_t THE_BASE64_FROM[128] = {
36
+        255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
37
+        255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
38
+        255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,  62, 255,  62, 255,  63,
39
+         52,  53,  54,  55,  56,  57,  58,  59,  60,  61, 255, 255,   0, 255, 255, 255,
40
+        255,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,
41
+         15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25, 255, 255, 255, 255,  63,
42
+        255,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,
43
+         41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51, 255, 255, 255, 255, 255
44
+    };
45
+
46
+    /**
47
+     * Function decoding base64 stream.
48
+     */
49
+    Handle(NCollection_Buffer) decodeBase64(const stUByte_t* theStr,
50
+                                            const size_t theLen) {
51
+        Handle(NCollection_Buffer) aData = new NCollection_Buffer(NCollection_BaseAllocator::CommonBaseAllocator());
52
+        if(!aData->Allocate (3 * theLen / 4)) {
53
+            ST_ERROR_LOG("Fail to allocate memory.");
54
+            return Handle(NCollection_Buffer)();
55
+        }
56
+
57
+        stUByte_t* aDataPtr = aData->ChangeData();
58
+        const stUByte_t* anEnd = theStr + theLen;
59
+        for(const stUByte_t* aByteIter = theStr; aByteIter < anEnd; aByteIter += 4) {
60
+            // get values for each group of four base 64 characters
61
+            const stUByte_t b4[4] = {
62
+                aByteIter + 0 < anEnd && aByteIter[0] <= 'z' ? THE_BASE64_FROM[aByteIter[0]] : stUByte_t(0xFF),
63
+                aByteIter + 1 < anEnd && aByteIter[1] <= 'z' ? THE_BASE64_FROM[aByteIter[1]] : stUByte_t(0xFF),
64
+                aByteIter + 2 < anEnd && aByteIter[2] <= 'z' ? THE_BASE64_FROM[aByteIter[2]] : stUByte_t(0xFF),
65
+                aByteIter + 3 < anEnd && aByteIter[3] <= 'z' ? THE_BASE64_FROM[aByteIter[3]] : stUByte_t(0xFF)
66
+            };
67
+
68
+            // transform into a group of three bytes
69
+            const stUByte_t b3[3] = {
70
+                stUByte_t(((b4[0] & 0x3F) << 2) + ((b4[1] & 0x30) >> 4)),
71
+                stUByte_t(((b4[1] & 0x0F) << 4) + ((b4[2] & 0x3C) >> 2)),
72
+                stUByte_t(((b4[2] & 0x03) << 6) + ((b4[3] & 0x3F) >> 0))
73
+            };
74
+
75
+            // add the byte to the return value if it isn't part of an '=' character (indicated by 0xFF)
76
+            if(b4[1] != 0xFF) {
77
+                *aDataPtr = b3[0];
78
+                ++aDataPtr;
79
+            }
80
+            if(b4[2] != 0xFF) {
81
+                *aDataPtr = b3[1];
82
+                ++aDataPtr;
83
+            }
84
+            if(b4[3] != 0xFF) {
85
+                *aDataPtr = b3[2];
86
+                ++aDataPtr;
87
+            }
88
+        }
89
+
90
+        return aData;
91
+    }
92
+
93
+    /**
94
+     * Find member of the object in a safe way.
95
+     */
96
+    static const rapidjson::Document::GenericValue* findObjectMember(const rapidjson::Document::GenericValue& theObject,
97
+                                                                     const char*  theName) {
98
+        if(!theObject.IsObject()) {
99
+            return NULL;
100
+        }
101
+
102
+        rapidjson::Document::ConstMemberIterator anIter = theObject.FindMember(theName);
103
+        return anIter != theObject.MemberEnd()
104
+             ? &anIter->value
105
+             : NULL;
106
+    }
107
+
108
+}
109
+
110
+/**
111
+ * Image texture embedded into binary glTF file.
112
+ */
113
+class StGltfBinTexture : public StAssetTexture {
114
+
115
+    DEFINE_STANDARD_RTTI_INLINE(StGltfBinTexture, StAssetTexture)
116
+
117
+        public:
118
+
119
+    /**
120
+     * Constructor.
121
+     */
122
+    StGltfBinTexture(const StString& theUri,
123
+                     const StString& theMime,
124
+                     const int64_t theStart,
125
+                     const int theLen)
126
+    : StAssetTexture(theUri),
127
+      myStart(theStart),
128
+      myLen(theLen),
129
+      myMime(theMime) {
130
+        if(!theUri.isEmpty()) {
131
+            const StString anId = StString("texture://") + theUri + "@offset=" + StString(theStart) + "@len=" + StString(theLen);
132
+            myTexId = anId.toCString();
133
+        }
134
+    }
135
+
136
+    /**
137
+     * Constructor.
138
+     */
139
+    StGltfBinTexture(const StString& theUri,
140
+                     const StString& theMime,
141
+                     const Handle(NCollection_Buffer)& theBuffer)
142
+    : StAssetTexture(theUri),
143
+      myStart(0),
144
+      myLen(0),
145
+      myBuffer(theBuffer),
146
+      myMime(theMime) {
147
+        if(!theUri.isEmpty()) {
148
+            const StString anId = StString("texture://") + theUri + "@base64";
149
+            myTexId = anId.toCString();
150
+        }
151
+    }
152
+
153
+    /**
154
+     * Image getter.
155
+     */
156
+    virtual Handle(Image_PixMap) GetImage() const Standard_OVERRIDE {
157
+        Handle(Image_PixMap) anImage;
158
+        if(!myBuffer.IsNull()) {
159
+            Handle(StImageOcct) anStImage = new StImageOcct();
160
+            if(anStImage->Load(myImageUri, StMIME(myMime, StString(), StString()), myBuffer->ChangeData(), (int )myBuffer->Size())) {
161
+                anImage = anStImage;
162
+            }
163
+        } else {
164
+            std::ifstream aFile;
165
+            OSD_OpenStream(aFile, myImageUri.toCString(), std::ios::in | std::ios::binary);
166
+            if(!aFile.is_open() || !aFile.good()) {
167
+                ST_ERROR_LOG(StString() + "Texture points to non existing file '" + myImageUri.toCString() + "'");
168
+                return false;
169
+            }
170
+
171
+            aFile.seekg(myStart, std::ios_base::beg);
172
+            if(!aFile.good()) {
173
+                aFile.close();
174
+                ST_ERROR_LOG(StString() + "Texture refers to non-existing location");
175
+                return false;
176
+            }
177
+
178
+            Handle(NCollection_Buffer) aData = new NCollection_Buffer(NCollection_BaseAllocator::CommonBaseAllocator());
179
+            if(!aData->Allocate(myLen)) {
180
+                ST_ERROR_LOG("Fail to allocate memory.");
181
+                return false;
182
+            }
183
+
184
+            if(!aFile.read((char* )aData->ChangeData(), myLen)) {
185
+                ST_ERROR_LOG(StString() + "Texture refers to non-existing location");
186
+                return false;
187
+            }
188
+
189
+            Handle(StImageOcct) anStImage = new StImageOcct();
190
+            if(anStImage->Load(myImageUri, StMIME(myMime, StString(), StString()), aData->ChangeData(), myLen)) {
191
+                anImage = anStImage;
192
+            }
193
+        }
194
+
195
+        if(anImage.IsNull()) {
196
+            return Handle(Image_PixMap)();
197
+        }
198
+        return anImage;
199
+    }
200
+
201
sview-17_04.tar.gz/StCADViewer/StAssetImportGltf.h Added
201
 
1
@@ -0,0 +1,554 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016-2017
6
+ */
7
+
8
+#ifndef __StAssetImportGltf_h_
9
+#define __StAssetImportGltf_h_
10
+
11
+//#define RAPIDJSON_ASSERT
12
+#include <rapidjson/document.h>
13
+#include <rapidjson/writer.h>
14
+#include <rapidjson/stringbuffer.h>
15
+#include <rapidjson/istreamwrapper.h>
16
+
17
+#include <StStrings/StString.h>
18
+#include <StFile/StFileNode.h>
19
+#include <StSlots/StSignal.h>
20
+
21
+#include <NCollection_DataMap.hxx>
22
+#include <TCollection_AsciiString.hxx>
23
+
24
+#include "StAssetDocument.h"
25
+
26
+/**
27
+ * Root elements within glTF JSON document.
28
+ */
29
+enum GltfRootElement {
30
+    GltfRootElement_Asset,        //!< "asset"       element, mandatory
31
+    GltfRootElement_Scenes,       //!< "scenes"      element, mandatory
32
+    GltfRootElement_Scene,        //!< "scene"       element, mandatory
33
+    GltfRootElement_Nodes,        //!< "nodes"       element, mandatory
34
+    GltfRootElement_Meshes,       //!< "meshes"      element, mandatory
35
+    GltfRootElement_Accessors,    //!< "accessors"   element, mandatory
36
+    GltfRootElement_BufferViews,  //!< "bufferViews" element, mandatory
37
+    GltfRootElement_Buffers,      //!< "buffers"     element, mandatory
38
+    GltfRootElement_NB_MANDATORY, //!< number of mandatory elements
39
+    // optional elements
40
+    GltfRootElement_Animations = GltfRootElement_NB_MANDATORY,  //!< "animations" element
41
+    GltfRootElement_Materials,    //!< "materials"  element,
42
+    GltfRootElement_Programs,     //!< "programs"   element,
43
+    GltfRootElement_Shaders,      //!< "shaders"    element,
44
+    GltfRootElement_Skins,        //!< "skins"      element,
45
+    GltfRootElement_Techniques,   //!< "techniques" element,
46
+    GltfRootElement_Textures,     //!< "textures"   element,
47
+    GltfRootElement_Images,       //!< "images"     element,
48
+    GltfRootElement_NB            //!< overall number of elements
49
+};
50
+
51
+/**
52
+ * Root elements within glTF JSON document - names array.
53
+ */
54
+static const char* GltfRootElementNames[GltfRootElement_NB] = {
55
+    "asset",
56
+    "scenes",
57
+    "scene",
58
+    "nodes",
59
+    "meshes",
60
+    "accessors",
61
+    "bufferViews",
62
+    "buffers",
63
+    "animations",
64
+    "materials",
65
+    "programs",
66
+    "shaders",
67
+    "skins",
68
+    "techniques",
69
+    "textures",
70
+    "images",
71
+};
72
+
73
+enum GltfPrimitiveMode {
74
+    GltfPrimitiveMode_UNKNOWN       = -1, //!< unknown or invalid type
75
+    GltfPrimitiveMode_Points        =  0, //!< GL_POINTS
76
+    GltfPrimitiveMode_Lines         =  1, //!< GL_LINES
77
+    GltfPrimitiveMode_LineLoop      =  2, //!< GL_LINE_LOOP
78
+    GltfPrimitiveMode_LineStrip     =  3, //!< GL_LINE_STRIP
79
+    GltfPrimitiveMode_Triangles     =  4, //!< GL_TRIANGLES
80
+    GltfPrimitiveMode_TriangleStrip =  5, //!< GL_TRIANGLE_STRIP
81
+    GltfPrimitiveMode_TriangleFan   =  6, //!< GL_TRIANGLE_FAN
82
+};
83
+
84
+enum GltfArrayType {
85
+    GltfArrayType_UNKNOWN,  //!< unknown or invalid type
86
+    GltfArrayType_Indices,  //!< "indices"    within "primitive"  element
87
+    GltfArrayType_Position, //!< "POSITION"   within "attributes" element
88
+    GltfArrayType_Normal,   //!< "NORMAL"     within "attributes" element
89
+    GltfArrayType_Color,    //!< "COLOR"      within "attributes" element
90
+    GltfArrayType_TCoord0,  //!< "TEXCOORD_0" within "attributes" element
91
+    GltfArrayType_TCoord1,  //!< "TEXCOORD_1" within "attributes" element
92
+    GltfArrayType_Joint,    //!< "JOINT"      within "attributes" element
93
+    GltfArrayType_Weight,   //!< "WEIGHT"     within "attributes" element
94
+};
95
+
96
+/**
97
+ * Similar to Graphic3d_TypeOfData but does not define actual type and includes matrices.
98
+ */
99
+enum GltfAccessorLayout {
100
+    GltfAccessorLayout_UNKNOWN, //!< unknown or invalid type
101
+    GltfAccessorLayout_Scalar,  //!< "SCALAR"
102
+    GltfAccessorLayout_Vec2,    //!< "VEC2"
103
+    GltfAccessorLayout_Vec3,    //!< "VEC3"
104
+    GltfAccessorLayout_Vec4,    //!< "VEC4"
105
+    GltfAccessorLayout_Mat2,    //!< "MAT2"
106
+    GltfAccessorLayout_Mat3,    //!< "MAT3"
107
+    GltfAccessorLayout_Mat4,    //!< "MAT4"
108
+};
109
+
110
+/**
111
+ * Accessor component type.
112
+ */
113
+enum GltfAccessorCompType {
114
+    GltfAccessorCompType_UNKNOWN, //!< unknown or invalid type
115
+    GltfAccessorCompType_Int8    = 5120, //!< GL_BYTE
116
+    GltfAccessorCompType_UInt8   = 5121, //!< GL_UNSIGNED_BYTE
117
+    GltfAccessorCompType_Int16   = 5122, //!< GL_SHORT
118
+    GltfAccessorCompType_UInt16  = 5123, //!< GL_UNSIGNED_SHORT
119
+    GltfAccessorCompType_UInt32  = 5125, //!< GL_UNSIGNED_INT
120
+    GltfAccessorCompType_Float32 = 5126, //!< GL_FLOAT
121
+};
122
+
123
+/**
124
+ * Accessor component type.
125
+ */
126
+enum GltfBufferViewTarget {
127
+    GltfBufferViewTarget_UNKNOWN,                      //!< unknown or invalid type
128
+    GltfBufferViewTarget_ARRAY_BUFFER         = 34962, //!< GL_ARRAY_BUFFER
129
+    GltfBufferViewTarget_ELEMENT_ARRAY_BUFFER = 34963, //!< GL_ELEMENT_ARRAY_BUFFER
130
+};
131
+
132
+/**
133
+ * Accessor structure.
134
+ */
135
+struct GltfAccessor {
136
+    int64_t              ByteOffset;
137
+    int32_t              ByteStride; // [0, 255]
138
+    int64_t              Count;
139
+    GltfAccessorLayout   Type;
140
+    GltfAccessorCompType ComponentType;
141
+
142
+    GltfAccessor() : ByteOffset(0), ByteStride(0), Count(0), Type(GltfAccessorLayout_UNKNOWN), ComponentType(GltfAccessorCompType_UNKNOWN) {}
143
+};
144
+
145
+/**
146
+ * BufferView structure.
147
+ */
148
+struct GltfBufferView {
149
+    int64_t ByteOffset;
150
+    int64_t ByteLength;
151
+    GltfBufferViewTarget Target;
152
+
153
+    GltfBufferView() : ByteOffset(0), ByteLength(0), Target(GltfBufferViewTarget_UNKNOWN) {}
154
+};
155
+
156
+/**
157
+ * Tool for importing asset from GLTF file.
158
+ */
159
+class StAssetImportGltf : public rapidjson::Document {
160
+
161
+        public:
162
+
163
+    /**
164
+     * Detect file format from the file header.
165
+     */
166
+    ST_LOCAL static bool probeFormatFromHeader(const char* theHeader,
167
+                                               const StString& theExt);
168
+
169
+    /**
170
+     * Detect file format from the file header.
171
+     */
172
+    ST_LOCAL static bool probeFormatFromExtension(const StString& theExt);
173
+
174
+        public:
175
+
176
+    /**
177
+     * Empty constructor.
178
+     */
179
+    ST_LOCAL StAssetImportGltf();
180
+
181
+    /**
182
+     * Perform the import.
183
+     */
184
+    ST_LOCAL bool load(const Handle(StDocNode)& theParentNode,
185
+                       const StString& theFile);
186
+
187
+    /**
188
+     * Parse glTF document.
189
+     */
190
+    ST_LOCAL bool gltfParse(const Handle(StDocNode)& theParentNode) {
191
+        if(!gltfParseRoots()) {
192
+            return false;
193
+        }
194
+
195
+        gltfParseAsset();
196
+        gltfParseMaterials();
197
+        return gltfParseScene(theParentNode);
198
+    }
199
+
200
+        protected:
201
sview-17_04.tar.gz/StCADViewer/StAssetImportShape.cpp Added
201
 
1
@@ -0,0 +1,568 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2011-2016
6
+ */
7
+
8
+#include "StAssetImportShape.h"
9
+
10
+#include <StStrings/StLogger.h>
11
+
12
+#include <BRep_Builder.hxx>
13
+#include <BRepLProp_SLProps.hxx>
14
+#include <BRepMesh_IncrementalMesh.hxx>
15
+#include <BRepTools.hxx>
16
+#include <BinTools.hxx>
17
+#include <BinXCAFDrivers.hxx>
18
+#include <IGESCAFControl_Reader.hxx>
19
+#include <IGESControl_Controller.hxx>
20
+#include <Interface_Static.hxx>
21
+#include <Prs3d.hxx>
22
+#include <STEPCAFControl_Reader.hxx>
23
+#include <STEPControl_Controller.hxx>
24
+#include <StdPrs_ShadedShape.hxx>
25
+#include <TDF_Tool.hxx>
26
+#include <TDF_ChildIterator.hxx>
27
+#include <TDataStd_Name.hxx>
28
+#include <TDocStd_Document.hxx>
29
+#include <Transfer_TransientProcess.hxx>
30
+#include <TopExp_Explorer.hxx>
31
+#include <TopoDS.hxx>
32
+#include <XCAFApp_Application.hxx>
33
+#include <XCAFDoc_ColorTool.hxx>
34
+#include <XCAFDoc_DocumentTool.hxx>
35
+#include <XCAFDoc_ShapeTool.hxx>
36
+#include <XCAFPrs_Style.hxx>
37
+#include <XCAFPrs.hxx>
38
+#include <XSControl_TransferReader.hxx>
39
+#include <XSControl_WorkSession.hxx>
40
+
41
+namespace {
42
+    static StString formatError(const StString& theFilePath,
43
+                                const StString& theLibDescr) {
44
+        StString aFileName, aFolderName;
45
+        StFileNode::getFolderAndFile(theFilePath, aFolderName, aFileName);
46
+        ST_ERROR_LOG("Can not load model from file \"" + theFilePath + "\" (" + theLibDescr + ')');
47
+        return StString("Can not load model from file\n\"") + aFileName + "\"\n" + theLibDescr;
48
+    }
49
+
50
+    // Check if specified data stream starts with specified header.
51
+    #define findFileHeader(theData, theHeader) (::strncmp(theData, theHeader, sizeof(theHeader) - 1) == 0)
52
+}
53
+
54
+void StAssetImportShape::initStatic() {
55
+    STEPControl_Controller::Init();
56
+    IGESControl_Controller::Init();
57
+    // STEP import
58
+    Interface_Static::SetIVal("read.step.assembly.level", 2);
59
+    Interface_Static::SetIVal("read.step.product.mode", 0);
60
+    Interface_Static::SetIVal("read.surfacecurve.mode", 0);
61
+    Interface_Static::SetIVal("read.step.shape.repr", 1);
62
+    Interface_Static::SetIVal("read.step.product.context", 1);
63
+    Interface_Static::SetIVal("read.step.shape.aspect", true);
64
+    Interface_Static::SetIVal("read.step.shape.relationship", true);
65
+    // STEP export
66
+    Interface_Static::SetCVal("write.step.schema", "AP214IS");
67
+    Interface_Static::SetIVal("write.surfacecurve.mode", 1);
68
+    Interface_Static::SetIVal("write.step.unit", 6); // meters
69
+    // IGES import
70
+    Interface_Static::SetIVal("read.iges.bspline.continuity", 0);
71
+    Interface_Static::SetIVal("read.surfacecurve.mode", 0);
72
+    Interface_Static::SetIVal("read.iges.onlyvisible", 0);
73
+    // IGES export
74
+    Interface_Static::SetIVal("write.iges.unit", 6); // meters
75
+    Interface_Static::SetIVal("write.iges.brep.mode", 0); // V5_1
76
+}
77
+
78
+StAssetImportShape::FileFormat StAssetImportShape::probeFormatFromHeader(const char* theHeader,
79
+                                                                         const StString& theExt) {
80
+    // suspect STEP if string "ISO-10303-21" is present
81
+    if(findFileHeader(theHeader, "ISO-10303-21")) {
82
+        // double-check by presence of "FILE_SHEMA" statement
83
+        if(::strstr(theHeader, "FILE_SCHEMA") != NULL) {
84
+            return FileFormat_STEP;
85
+        }
86
+    } else if(findFileHeader(theHeader, "DBRep_DrawableShape")
87
+           || findFileHeader(theHeader, "CASCADE Topology V1")) {
88
+        return FileFormat_BREP;
89
+    } else if(findFileHeader(theHeader, "\nOpen CASCADE Topology V3")) {
90
+        return FileFormat_BINBREP;
91
+    } else if(findFileHeader(theHeader, "BINFILE") && theExt.isEqualsIgnoreCase(stCString("xbf"))) {
92
+        return FileFormat_XBF;
93
+    }
94
+
95
+    if(theHeader[72] == 'S') {
96
+        const char *aPtr = theHeader + 73;
97
+        while(aPtr < theHeader + 80 && (*aPtr == ' ' || *aPtr == '0')) {
98
+            ++aPtr;
99
+        }
100
+        if(*aPtr == '1' && !::isalnum ((unsigned char )*++aPtr)) {
101
+            return FileFormat_IGES;
102
+        }
103
+    }
104
+    return FileFormat_UNKNOWN;
105
+}
106
+
107
+StAssetImportShape::FileFormat StAssetImportShape::probeFormatFromExtension(const StString& theExt) {
108
+    if(theExt.isEqualsIgnoreCase(stCString("igs")) || theExt.isEqualsIgnoreCase(stCString("iges"))) {
109
+        return FileFormat_IGES;
110
+    } else if(theExt.isEqualsIgnoreCase(stCString("stp")) || theExt.isEqualsIgnoreCase(stCString("step"))) {
111
+        return FileFormat_STEP;
112
+    } else if(theExt.isEqualsIgnoreCase(stCString("brep")) || theExt.isEqualsIgnoreCase(stCString("rle"))) {
113
+        return FileFormat_BREP;
114
+    } else if(theExt.isEqualsIgnoreCase(stCString("xbf"))) {
115
+        return FileFormat_XBF;
116
+    }
117
+    return FileFormat_UNKNOWN;
118
+}
119
+
120
+StAssetImportShape::StAssetImportShape()
121
+: myXCAFApp(new TDocStd_Application()) {
122
+    BinXCAFDrivers::DefineFormat(myXCAFApp);
123
+    //StdLDrivers::DefineFormat(myXCAFApp);
124
+    //BinLDrivers::DefineFormat(myXCAFApp);
125
+    //XmlLDrivers::DefineFormat(myXCAFApp);
126
+    //StdDrivers::DefineFormat(myXCAFApp);
127
+    //BinDrivers::DefineFormat(myXCAFApp);
128
+    //XmlDrivers::DefineFormat(myXCAFApp);
129
+    reset();
130
+}
131
+
132
+void StAssetImportShape::reset() {
133
+    // close old document
134
+    if(!myXCAFDoc.IsNull()) {
135
+        if(myXCAFDoc->HasOpenCommand()) {
136
+            myXCAFDoc->AbortCommand();
137
+        }
138
+
139
+        myXCAFDoc->Main().Root().ForgetAllAttributes(Standard_True);
140
+        myXCAFApp->Close(myXCAFDoc);
141
+        myXCAFDoc.Nullify();
142
+    }
143
+
144
+    // create new document
145
+    myXCAFApp->NewDocument(TCollection_ExtendedString("BinXCAF"), myXCAFDoc);
146
+    if(!myXCAFDoc.IsNull()) {
147
+        // Set the maximum number of available "undo" actions
148
+        myXCAFDoc->SetUndoLimit(10);
149
+    }
150
+}
151
+
152
+void StAssetImportShape::clearSession(const Handle(XSControl_WorkSession)& theWorkSession) {
153
+    if(theWorkSession.IsNull()) {
154
+        return;
155
+    }
156
+
157
+    // at first clear transient process
158
+    Handle(Transfer_TransientProcess) aMapReader = theWorkSession->TransferReader()->TransientProcess();
159
+    if(!aMapReader.IsNull()) {
160
+        aMapReader->Clear();
161
+    }
162
+
163
+    // at second clear transfer reader
164
+    Handle(XSControl_TransferReader) aTransferReader = theWorkSession->TransferReader();
165
+    if(!aTransferReader.IsNull()) {
166
+        aTransferReader->Clear(-1);
167
+    }
168
+}
169
+
170
+bool StAssetImportShape::load(const Handle(StDocNode)& theParentNode,
171
+                              const StString& theFile,
172
+                              const FileFormat theFormat) {
173
+    switch(theFormat) {
174
+        case FileFormat_STEP: {
175
+            if(!loadSTEP(theFile)) {
176
+                return false;
177
+            }
178
+            break;
179
+        }
180
+        case FileFormat_IGES: {
181
+            if(!loadIGES(theFile)) {
182
+                return false;
183
+            }
184
+            break;
185
+        }
186
+        case FileFormat_BREP:
187
+        case FileFormat_BINBREP: {
188
+            BRep_Builder aBuilder;
189
+            TopoDS_Shape aShape;
190
+            if(theFormat == FileFormat_BINBREP
191
+            && !BinTools::Read(aShape, theFile.toCString())) {
192
+                signals.onError(formatError(theFile, "BREP loading failed"));
193
+                return false;
194
+            } else if(!BRepTools::Read(aShape, theFile.toCString(), aBuilder)) {
195
+                signals.onError(formatError(theFile, "BREP loading failed"));
196
+                return false;
197
+            }
198
+
199
+            if(aShape.IsNull()) {
200
+                signals.onError(formatError(theFile, "No shapes found in the BREP file"));
201
sview-17_04.tar.gz/StCADViewer/StAssetImportShape.h Added
135
 
1
@@ -0,0 +1,133 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2011-2016
6
+ */
7
+
8
+#ifndef __StAssetImportShape_h_
9
+#define __StAssetImportShape_h_
10
+
11
+#include <StStrings/StString.h>
12
+#include <StFile/StFileNode.h>
13
+#include <StSlots/StSignal.h>
14
+
15
+#include <Standard_Type.hxx>
16
+
17
+#include "StAssetDocument.h"
18
+
19
+class TDF_Label;
20
+class TDocStd_Document;
21
+class TopLoc_Location;
22
+class TopoDS_Shape;
23
+class TDocStd_Application;
24
+class XCAFDoc_ColorTool;
25
+class XCAFPrs_Style;
26
+class XSControl_WorkSession;
27
+
28
+/**
29
+ * Tool for importing asset from BRep shape.
30
+ */
31
+class StAssetImportShape {
32
+
33
+        public:
34
+
35
+    /**
36
+     * Supported file formats.
37
+     */
38
+    enum FileFormat {
39
+        FileFormat_UNKNOWN,
40
+        FileFormat_BREP,
41
+        FileFormat_BINBREP,
42
+        FileFormat_XBF,
43
+        FileFormat_STEP,
44
+        FileFormat_IGES,
45
+    };
46
+
47
+        public:
48
+
49
+    /**
50
+     * Detect file format from the file header.
51
+     */
52
+    ST_LOCAL static FileFormat probeFormatFromHeader(const char* theHeader,
53
+                                                     const StString& theExt);
54
+
55
+    /**
56
+     * Detect file format from the file header.
57
+     */
58
+    ST_LOCAL static FileFormat probeFormatFromExtension(const StString& theExt);
59
+
60
+    /**
61
+     * Initialize global data exchange parameters.
62
+     */
63
+    ST_LOCAL static void initStatic();
64
+
65
+        public:
66
+
67
+    /**
68
+     * Empty constructor.
69
+     */
70
+    ST_LOCAL StAssetImportShape();
71
+
72
+    /**
73
+     * Perform the import.
74
+     */
75
+    ST_LOCAL bool load(const Handle(StDocNode)& theParentNode,
76
+                       const StString& theFile,
77
+                       const FileFormat theFormat);
78
+
79
+        protected:
80
+
81
+    /**
82
+     * Fill in XDE document from IGES file.
83
+     */
84
+    ST_LOCAL bool loadIGES(const StString& theFile);
85
+
86
+    /**
87
+     * Fill in XDE document from STEP file.
88
+     */
89
+    ST_LOCAL bool loadSTEP(const StString& theFile);
90
+
91
+    /**
92
+     * Add the XDE label into Asset document.
93
+     */
94
+    ST_LOCAL void addNodeRecursive(const Handle(StDocNode)& theParentTreeItem,
95
+                                   XCAFDoc_ColorTool&       theColorTool,
96
+                                   const TDF_Label&         theLabel,
97
+                                   const TopLoc_Location&   theParentTrsf,
98
+                                   const XCAFPrs_Style&     theParentStyle);
99
+
100
+    /**
101
+     * Add the BRep shape into Asset document.
102
+     */
103
+    ST_LOCAL bool addMeshNode(const Handle(StDocNode)& theParentTreeItem,
104
+                              const TDF_Label&         theShapeLabel,
105
+                              const XCAFPrs_Style&     theParentStyle);
106
+
107
+    /**
108
+     * Reset XDE document.
109
+     */
110
+    ST_LOCAL void reset();
111
+
112
+    /**
113
+     * Clear working session.
114
+     */
115
+    ST_LOCAL void clearSession(const Handle(XSControl_WorkSession)& theWorkSession);
116
+
117
+        public:
118
+
119
+    struct {
120
+        /**
121
+         * Emit callback Slot on error.
122
+         * @param theUserData (const StString& ) - error description.
123
+         */
124
+        StSignal<void (const StCString& )> onError;
125
+    } signals;
126
+
127
+        protected:
128
+
129
+    Handle(TDocStd_Application) myXCAFApp;
130
+    Handle(TDocStd_Document)    myXCAFDoc;
131
+
132
+};
133
+
134
+#endif // __StAssetImportShape_h_
135
sview-17_04.tar.gz/StCADViewer/StAssetNodeIterator.h Added
178
 
1
@@ -0,0 +1,176 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#ifndef __StAssetNodeIterator_h_
9
+#define __StAssetNodeIterator_h_
10
+
11
+#include "StAssetNodeIterator.h"
12
+
13
+/**
14
+ * Smart document iterator through nodes of requested type.
15
+ */
16
+class StAssetNodeIterator {
17
+
18
+        public:
19
+
20
+    /**
21
+     * Main constructor.
22
+     */
23
+    StAssetNodeIterator(const Handle(StDocNode)& theRoot,
24
+                        const StDocNodeType theToFind)
25
+    : myTop(-1), myToFind(theToFind), myToAvoid(StDocNodeType_Unknown), myHasMore(false) {
26
+        init(theRoot, theToFind);
27
+    }
28
+
29
+    /**
30
+     * Initialize the iterator.
31
+     */
32
+    void init(const Handle(StDocNode)& theRoot,
33
+              const StDocNodeType theToFind) {
34
+        for(int aStackIter = 0; aStackIter <= myTop; ++aStackIter) {
35
+            myNodeStack.SetValue(aStackIter, NCollection_Sequence<Handle(StDocNode)>::Iterator());
36
+        }
37
+        myTrsf    = gp_Trsf();
38
+        myTop    = -1;
39
+        myRoot   = theRoot;
40
+        myToFind = theToFind;
41
+        if(theRoot.IsNull()
42
+        || myToFind == StDocNodeType_Unknown) {
43
+            myHasMore = false;
44
+            return;
45
+        }
46
+
47
+        const StDocNodeType aRootNodeType = theRoot->nodeType();
48
+        if(isLessComplexNodeType(aRootNodeType, theToFind)) {
49
+            // the first Shape is less complex, nothing to find
50
+            myHasMore = false;
51
+        } else if(!isSameNodeType(aRootNodeType, theToFind)) {
52
+            // type is more complex search inside
53
+            myHasMore = true;
54
+            next();
55
+        } else {
56
+            // type is found
57
+            myHasMore = true;
58
+            myTrsf = theRoot->nodeTransformation();
59
+        }
60
+    }
61
+
62
+    /**
63
+     * Return true, if iterator points to the valid node.
64
+     */
65
+    bool more() const { return myHasMore; }
66
+
67
+    /**
68
+     * Return the current node.
69
+     */
70
+    const Handle(StDocNode)& value() const {
71
+        if(!myHasMore) {
72
+            //
73
+        }
74
+        if(myTop >= 0) {
75
+            return myNodeStack.Value(myTop).Value();
76
+        } else {
77
+            return myRoot;
78
+        }
79
+    }
80
+
81
+    /**
82
+     * Return transformation to the current node.
83
+     */
84
+    const gp_Trsf& location() const {
85
+        return myTrsf;
86
+    }
87
+
88
+    /**
89
+     * Go to the next node.
90
+     */
91
+    void next() {
92
+        if(!myHasMore) {
93
+            // assert
94
+            return;
95
+        }
96
+
97
+        if(myTop < 0) {
98
+            const StDocNodeType aNodeType = myRoot->nodeType();
99
+            if(isSameNodeType(myToFind, aNodeType)) {
100
+                // already visited once
101
+                myHasMore = false;
102
+                return;
103
+            } else if(toAvoidNodeType(myToAvoid, aNodeType)) {
104
+                // avoid the top-level
105
+                myHasMore = false;
106
+                return;
107
+            } else {
108
+                // push and try to find
109
+                myTop = 0;
110
+                myNodeStack.SetValue(0, NCollection_Sequence<Handle(StDocNode)>::Iterator(myRoot->Children()));
111
+            }
112
+        } else {
113
+            myNodeStack.ChangeValue(myTop).Next();
114
+        }
115
+
116
+        for(;;) {
117
+            if(myNodeStack.Value(myTop).More()) {
118
+                const Handle(StDocNode)& aNodeTop = myNodeStack.Value(myTop).Value();
119
+                const StDocNodeType aNodeType = aNodeTop->nodeType();
120
+                if(isSameNodeType(myToFind, aNodeType)) {
121
+                    myHasMore = true;
122
+
123
+                    myTrsf = gp_Trsf();
124
+                    for(int aStackIter = 0; aStackIter <= myTop; ++aStackIter) {
125
+                        const Handle(StDocNode)& aNode = myNodeStack.Value(aStackIter).Value();
126
+                        myTrsf = myTrsf * aNode->nodeTransformation();
127
+                    }
128
+                    return;
129
+                } else if(isLessComplexNodeType(myToFind, aNodeType)
130
+                      && !toAvoidNodeType(myToAvoid, aNodeType)) {
131
+                    ++myTop;
132
+                    myNodeStack.SetValue(myTop, NCollection_Sequence<Handle(StDocNode)>::Iterator(aNodeTop->Children()));
133
+                } else {
134
+                    myNodeStack.ChangeValue(myTop).Next();
135
+                }
136
+            } else {
137
+                myNodeStack.SetValue(myTop, NCollection_Sequence<Handle(StDocNode)>::Iterator());
138
+                --myTop;
139
+                if(myTop < 0) {
140
+                    break;
141
+                }
142
+
143
+                myNodeStack.ChangeValue(myTop).Next();
144
+            }
145
+        }
146
+        myHasMore = false;
147
+    }
148
+
149
+        protected:
150
+
151
+    //! Function to compare two types of nodes
152
+    static bool isSameNodeType(StDocNodeType theType1, StDocNodeType theType2) {
153
+        return theType1 == theType2;
154
+    }
155
+
156
+    static bool toAvoidNodeType(StDocNodeType theType1, StDocNodeType theType2) {
157
+        return theType1 != StDocNodeType_Unknown
158
+            && theType1 == theType2;
159
+    }
160
+
161
+    static bool isLessComplexNodeType(StDocNodeType theType1, StDocNodeType theType2) {
162
+        return theType1 > theType2;
163
+    }
164
+
165
+        protected:
166
+
167
+    Handle(StDocNode) myRoot;
168
+    NCollection_Vector<NCollection_Sequence<Handle(StDocNode)>::Iterator> myNodeStack;
169
+    int           myTop;
170
+    StDocNodeType myToFind;
171
+    StDocNodeType myToAvoid;
172
+    bool          myHasMore;
173
+    gp_Trsf       myTrsf;
174
+
175
+};
176
+
177
+#endif // __StAssetNodeIterator_h_
178
sview-17_04.tar.gz/StCADViewer/StAssetPresentation.cpp Added
154
 
1
@@ -0,0 +1,152 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#include "StAssetPresentation.h"
9
+
10
+#include <Graphic3d_ArrayOfTriangles.hxx>
11
+#include <NCollection_IndexedDataMap.hxx>
12
+
13
+/**
14
+ * Auxiliary structure for grouping primitive arrays by common material.
15
+ */
16
+struct StLocatedPrimArray {
17
+    Handle(StPrimArray) PrimArray;
18
+    gp_Trsf             NodeTrsf;
19
+
20
+    StLocatedPrimArray() {}
21
+    StLocatedPrimArray(const Handle(StPrimArray)& thePrimArray,
22
+                       const gp_Trsf& theNodeTrsf) : PrimArray(thePrimArray), NodeTrsf(theNodeTrsf) {}
23
+};
24
+
25
+/**
26
+ * Auxiliary structure for grouping primitive arrays by common material.
27
+ */
28
+struct StPrsPart {
29
+    NCollection_Sequence<StLocatedPrimArray> PrimArrays;
30
+    size_t NbNodes;
31
+    size_t NbTris;
32
+    bool   HasTexCoord0;
33
+
34
+    StPrsPart() : NbNodes(0), NbTris(0), HasTexCoord0(false) {}
35
+};
36
+
37
+void StAssetPresentation::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
38
+                                   const Handle(Prs3d_Presentation)& thePrs,
39
+                                   const int theMode) {
40
+    (void )thePrsMgr;
41
+    if(theMode != 0) {
42
+        return;
43
+    }
44
+
45
+    const StPrsPart anEmptyPart;
46
+    NCollection_IndexedDataMap<Handle(StGLMaterial), StPrsPart, StGLMaterial> aStyleMap;
47
+
48
+    for(NCollection_Sequence<StDocLocatedMeshNode>::Iterator aDocNodeIter(myDocNodes); aDocNodeIter.More(); aDocNodeIter.Next()) {
49
+        const Handle(StDocMeshNode)& aDocNode = aDocNodeIter.Value().Mesh;
50
+        const gp_Trsf& aMeshTrsf = aDocNodeIter.Value().Trsf;
51
+        for(NCollection_Sequence<Handle(StPrimArray)>::Iterator aPrimIter(aDocNode->PrimitiveArrays()); aPrimIter.More(); aPrimIter.Next()) {
52
+            const Handle(StPrimArray)& aPrims = aPrimIter.Value();
53
+            const int anIndex = aStyleMap.Add(aPrims->Material, anEmptyPart);
54
+            StPrsPart& aPrsPart = aStyleMap.ChangeFromIndex(anIndex);
55
+            aPrsPart.NbNodes += aPrims->Positions.size();
56
+            aPrsPart.NbTris  += aPrims->Indices.size() / 3;
57
+            aPrsPart.HasTexCoord0 = aPrsPart.HasTexCoord0 || !aPrims->TexCoords0.empty();
58
+            aPrsPart.PrimArrays.Append(StLocatedPrimArray(aPrims, aMeshTrsf));
59
+        }
60
+    }
61
+
62
+    for(NCollection_IndexedDataMap<Handle(StGLMaterial), StPrsPart, StGLMaterial>::Iterator aStyleIter(aStyleMap); aStyleIter.More(); aStyleIter.Next()) {
63
+        const StPrsPart& aPrsPart = aStyleIter.Value();
64
+        Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles(int(aPrsPart.NbNodes), int(aPrsPart.NbTris * 3), true, false, aPrsPart.HasTexCoord0);
65
+        for(NCollection_Sequence<StLocatedPrimArray>::Iterator aPrimIter(aPrsPart.PrimArrays); aPrimIter.More(); aPrimIter.Next()) {
66
+            const Handle(StPrimArray)& aPrims = aPrimIter.Value().PrimArray;
67
+            const gp_Trsf& aMeshTrsf = aPrimIter.Value().NodeTrsf;
68
+
69
+            const int aLowerVertex = aTris->VertexNumber() + 1;
70
+
71
+            const size_t aNbPrimNodes = aPrims->Positions.size();
72
+            const gp_Trsf aTrsf = aMeshTrsf * aPrims->Trsf;
73
+            if(aTrsf.Form() != gp_Identity) {
74
+                for(size_t aNodeIter = 0; aNodeIter < aNbPrimNodes; ++aNodeIter) {
75
+                    const StGLVec3& aPos = aPrims->Positions[aNodeIter];
76
+                    StGLVec3 aNorm = aPrims->Normals[aNodeIter];
77
+                    if(aNorm.modulus() != 0.0f) {
78
+                        gp_Dir aNormTrsf(aNorm.x(), aNorm.y(), aNorm.z());
79
+                        aNormTrsf.Transform(aTrsf);
80
+                        aNorm.x() = (float )aNormTrsf.X();
81
+                        aNorm.y() = (float )aNormTrsf.Y();
82
+                        aNorm.z() = (float )aNormTrsf.Z();
83
+                    }
84
+
85
+                    gp_Pnt aPosTrsf(aPos.x(),  aPos.y(),  aPos.z());
86
+                    aPosTrsf.Transform(aTrsf);
87
+                    aTris->AddVertex((float )aPosTrsf.X(), (float )aPosTrsf.Y(), (float )aPosTrsf.Z(),
88
+                                     aNorm.x(), aNorm.y(), aNorm.z());
89
+                }
90
+            } else {
91
+                for(size_t aNodeIter = 0; aNodeIter < aNbPrimNodes; ++aNodeIter) {
92
+                    const StGLVec3& aPos  = aPrims->Positions[aNodeIter];
93
+                    const StGLVec3& aNorm = aPrims->Normals  [aNodeIter];
94
+                    aTris->AddVertex(aPos.x(),  aPos.y(),  aPos.z(),
95
+                                     aNorm.x(), aNorm.y(), aNorm.z());
96
+                }
97
+            }
98
+
99
+            if(aPrsPart.HasTexCoord0
100
+            && aPrims->TexCoords0.size() == aPrims->Positions.size()) {
101
+                for(size_t aNodeIter = 0; aNodeIter < aNbPrimNodes; ++aNodeIter) {
102
+                    const StGLVec2& aTexCoord = aPrims->TexCoords0[aNodeIter];
103
+                    aTris->SetVertexTexel(aLowerVertex + int(aNodeIter), aTexCoord.x(), aTexCoord.y());
104
+                }
105
+            }
106
+
107
+            const size_t aNbPrimIndices = aPrims->Indices.size();
108
+            for(size_t anIndexIter = 0; anIndexIter < aNbPrimIndices; ++anIndexIter) {
109
+                aTris->AddEdge(aLowerVertex + aPrims->Indices[anIndexIter]);
110
+            }
111
+        }
112
+
113
+        const Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
114
+        Graphic3d_MaterialAspect aMat(Graphic3d_NOM_SILVER);
115
+        const Handle(StGLMaterial)& anStMat = aStyleIter.Key();
116
+        if(!anStMat.IsNull()) {
117
+            aMat = Graphic3d_MaterialAspect();
118
+            aMat.SetMaterialType(Graphic3d_MATERIAL_PHYSIC);
119
+            aMat.SetDiffuse (1.0f);
120
+            aMat.SetAmbient (1.0f);
121
+            aMat.SetSpecular(1.0f);
122
+            aMat.SetEmissive(1.0f);
123
+            if(anStMat->EmissiveColor.rgb() != StGLVec3(0.0f, 0.0f, 0.0f)) {
124
+                aMat.SetReflectionModeOn(Graphic3d_TOR_EMISSION);
125
+            }
126
+            aMat.SetDiffuseColor (Quantity_Color(anStMat->DiffuseColor.r(),  anStMat->DiffuseColor.g(),  anStMat->DiffuseColor.b(),  Quantity_TOC_RGB));
127
+            aMat.SetTransparency (float(1.0 - anStMat->DiffuseColor.a()));
128
+            aMat.SetAmbientColor (Quantity_Color(anStMat->AmbientColor.r(),  anStMat->AmbientColor.g(),  anStMat->AmbientColor.b(),  Quantity_TOC_RGB));
129
+            aMat.SetSpecularColor(Quantity_Color(anStMat->SpecularColor.r(), anStMat->SpecularColor.g(), anStMat->SpecularColor.b(), Quantity_TOC_RGB));
130
+            aMat.SetEmissiveColor(Quantity_Color(anStMat->EmissiveColor.r(), anStMat->EmissiveColor.g(), anStMat->EmissiveColor.b(), Quantity_TOC_RGB));
131
+            aMat.SetShininess(anStMat->Shine());
132
+            aMat.SetMaterialName(anStMat->Name.toCString());
133
+        }
134
+
135
+        Handle(Graphic3d_AspectFillArea3d) anAspect = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID, aMat.Color(), aMat.Color(), Aspect_TOL_EMPTY, 1.0, aMat, aMat);
136
+        if(!anStMat.IsNull()) {
137
+            if(!anStMat->Texture.IsNull()) {
138
+                anAspect->SetTextureMap(anStMat->Texture);
139
+                anAspect->SetTextureMapOn();
140
+            }
141
+            anAspect->SetSuppressBackFaces(anStMat->ToCullBackFaces());
142
+            if(anStMat->ToCullBackFaces()) {
143
+                aGroup->SetClosed(true);
144
+            }
145
+        }
146
+
147
+        aGroup->SetGroupPrimitivesAspect(anAspect);
148
+        aGroup->AddPrimitiveArray(aTris);
149
+    }
150
+}
151
+
152
+void StAssetPresentation::ComputeSelection (const Handle(SelectMgr_Selection)& ,
153
+                                            const int ) {}
154
sview-17_04.tar.gz/StCADViewer/StAssetPresentation.h Added
60
 
1
@@ -0,0 +1,58 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#ifndef __StAssetPresentation_h_
9
+#define __StAssetPresentation_h_
10
+
11
+#include "StAssetDocument.h"
12
+
13
+#include <AIS_InteractiveObject.hxx>
14
+
15
+/**
16
+ * Document node with cumulative transformation (including parent nodes).
17
+ */
18
+struct StDocLocatedMeshNode {
19
+    Handle(StDocMeshNode) Mesh;
20
+    gp_Trsf               Trsf;
21
+
22
+    StDocLocatedMeshNode(const Handle(StDocMeshNode)& theMesh, const gp_Trsf& theTrsf) : Mesh(theMesh), Trsf(theTrsf) {}
23
+    StDocLocatedMeshNode() {}
24
+};
25
+
26
+/**
27
+ * Custom interactive object for mesh data.
28
+ */
29
+class StAssetPresentation : public AIS_InteractiveObject {
30
+
31
+    DEFINE_STANDARD_RTTI_INLINE(StAssetPresentation, AIS_InteractiveObject)
32
+
33
+        public:
34
+
35
+    StAssetPresentation() {
36
+        SetDisplayMode(0);
37
+    }
38
+
39
+    virtual bool AcceptDisplayMode(const int theMode) const Standard_OVERRIDE { return theMode == 0; }
40
+
41
+    //! Redefined method to compute presentation.
42
+    ST_LOCAL virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
43
+                                  const Handle(Prs3d_Presentation)& thePrs,
44
+                                  const int theMode) Standard_OVERRIDE;
45
+
46
+    //! Compute selection.
47
+    ST_LOCAL virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
48
+                                           const int theMode) Standard_OVERRIDE;
49
+
50
+    void AddMeshNode(const Handle(StDocMeshNode)& theNode,
51
+                     const gp_Trsf& theTrsf) { myDocNodes.Append(StDocLocatedMeshNode(theNode, theTrsf)); }
52
+
53
+        protected:
54
+
55
+    NCollection_Sequence<StDocLocatedMeshNode> myDocNodes;
56
+
57
+};
58
+
59
+#endif // __StAssetPresentation_h_
60
sview-17_04.tar.gz/StCADViewer/StAssetTexture.cpp Added
29
 
1
@@ -0,0 +1,27 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#include "StImageOcct.h"
9
+
10
+#include "StAssetTexture.h"
11
+
12
+#include <StFile/StMIME.h>
13
+
14
+Handle(Image_PixMap) StAssetTexture::GetImage() const {
15
+    Handle(Image_PixMap) anImage;
16
+    {
17
+        Handle(StImageOcct) anStImage = new StImageOcct();
18
+        if(anStImage->Load(myImageUri, StMIME())) {
19
+            anImage = anStImage;
20
+        }
21
+    }
22
+    //anImage = Graphic3d_Texture2Dmanual::GetImage();
23
+
24
+    if(anImage.IsNull()) {
25
+        return Handle(Image_PixMap)();
26
+    }
27
+    return anImage;
28
+}
29
sview-17_04.tar.gz/StCADViewer/StAssetTexture.h Added
70
 
1
@@ -0,0 +1,68 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#ifndef __StAssetTexture_h_
9
+#define __StAssetTexture_h_
10
+
11
+#include <Graphic3d_Texture2Dmanual.hxx>
12
+
13
+#include <StStrings/StString.h>
14
+
15
+/**
16
+ * Image texture provide with equality check.
17
+ */
18
+class StAssetTexture : public Graphic3d_Texture2Dmanual {
19
+
20
+    DEFINE_STANDARD_RTTI_INLINE(StAssetTexture, Graphic3d_Texture2Dmanual)
21
+
22
+        public:
23
+
24
+    /**
25
+     * Constructor.
26
+     */
27
+    StAssetTexture(const StString& theUri)
28
+    : Graphic3d_Texture2Dmanual(theUri.toCString()),
29
+      myImageUri(theUri) {
30
+        if(!theUri.isEmpty()) {
31
+            myTexId = TCollection_AsciiString("texture://") + theUri.toCString();
32
+        }
33
+    }
34
+
35
+    /**
36
+     * Image getter.
37
+     */
38
+    ST_LOCAL virtual Handle(Image_PixMap) GetImage() const Standard_OVERRIDE;
39
+
40
+    /**
41
+     * Compare with another texture.
42
+     */
43
+    virtual bool isEqual(const StAssetTexture& theOther) const {
44
+        return myImageUri == theOther.myImageUri;
45
+    }
46
+
47
+        public:
48
+
49
+    /**
50
+     * Compare to textures.
51
+     */
52
+    static bool IsEqual(const Handle(StAssetTexture)& theTex1,
53
+                        const Handle(StAssetTexture)& theTex2) {
54
+        if(theTex1 == theTex2) {
55
+            return true;
56
+        }
57
+
58
+        return !theTex1.IsNull()
59
+            && !theTex2.IsNull()
60
+            &&  theTex1->isEqual(*theTex2);
61
+    }
62
+
63
+        protected:
64
+
65
+    StString myImageUri;
66
+
67
+};
68
+
69
+#endif // __StAssetTexture_h_
70
sview-16_06.tar.gz/StCADViewer/StCADLoader.cpp -> sview-17_04.tar.gz/StCADViewer/StCADLoader.cpp Changed
201
 
1
@@ -4,62 +4,25 @@
2
  * Copyright © Kirill Gavrilov, 2011-2016
3
  */
4
 
5
+#include "StAssetImportGltf.h"
6
+
7
 #ifdef ST_HAVE_STCONFIG
8
     #include <stconfig.conf>
9
 #endif
10
 
11
 #include "StCADLoader.h"
12
 #include "StCADPluginInfo.h"
13
+#include "StAssetPresentation.h"
14
+#include "StAssetImportShape.h"
15
+#include "StAssetNodeIterator.h"
16
 
17
 #include <StStrings/StLangMap.h>
18
-
19
-#include <AIS_Shape.hxx>
20
-#include <BRep_Tool.hxx>
21
-#include <BRep_Builder.hxx>
22
-#include <BRepTools.hxx>
23
-#include <BRepBuilderAPI_Sewing.hxx>
24
-#include <BRepMesh_IncrementalMesh.hxx>
25
-#include <BRepMesh.hxx>
26
-#include <BRepLProp_SLProps.hxx>
27
-#include <IGESControl_Reader.hxx>
28
-#include <STEPControl_Reader.hxx>
29
-#include <XSControl_WorkSession.hxx>
30
-#include <ShapeFix_Shape.hxx>
31
-
32
-#include <Prs3d.hxx>
33
-#include <TopoDS.hxx>
34
-#include <TopoDS_Shape.hxx>
35
-#include <TopExp_Explorer.hxx>
36
+#include <StFile/StRawFile.h>
37
 
38
 const StString StCADLoader::ST_CAD_MIME_STRING(ST_CAD_PLUGIN_MIME_CHAR);
39
 const StMIMEList StCADLoader::ST_CAD_MIME_LIST(StCADLoader::ST_CAD_MIME_STRING);
40
 const StArrayList<StString> StCADLoader::ST_CAD_EXTENSIONS_LIST(StCADLoader::ST_CAD_MIME_LIST.getExtensionsList());
41
 
42
-StCADDocument::StCADDocument()
43
-: myXCAFApp(XCAFApp_Application::GetApplication()) {
44
-    reset();
45
-}
46
-
47
-void StCADDocument::reset() {
48
-    // close old document
49
-    if(!myXCAFDoc.IsNull()) {
50
-        if(myXCAFDoc->HasOpenCommand()) {
51
-            myXCAFDoc->AbortCommand();
52
-        }
53
-
54
-        myXCAFDoc->Main().Root().ForgetAllAttributes(Standard_True);
55
-        myXCAFApp->Close(myXCAFDoc);
56
-        myXCAFDoc.Nullify();
57
-    }
58
-
59
-    // create new document
60
-    myXCAFApp->NewDocument(TCollection_ExtendedString("BinXCAF"), myXCAFDoc);
61
-    if(!myXCAFDoc.IsNull()) {
62
-        // Set the maximum number of available "undo" actions
63
-        myXCAFDoc->SetUndoLimit(10);
64
-    }
65
-}
66
-
67
 StCADLoader::StCADLoader(const StHandle<StLangMap>&  theLangMap,
68
                          const StHandle<StPlayList>& thePlayList,
69
                          const bool                  theToStartThread)
70
@@ -83,152 +46,54 @@
71
     ///ST_DEBUG_LOG_AT("Destructor done");
72
 }
73
 
74
-static StString formatError(const StString& theFilePath,
75
-                            const StString& theLibDescr) {
76
-    StString aFileName, aFolderName;
77
-    StFileNode::getFolderAndFile(theFilePath, aFolderName, aFileName);
78
-    ST_ERROR_LOG("Can not load CAD model from file \"" + theFilePath + "\" (" + theLibDescr + ')');
79
-    return StString("Can not load CAD model from file\n\"") + aFileName + "\"\n" + theLibDescr;
80
-}
81
-
82
-TopoDS_Shape StCADLoader::loadIGES(const StString& theFileToLoadPath) {
83
-    TopoDS_Shape aShape;
84
-    IGESControl_Reader aReader;
85
-    IFSelect_ReturnStatus aReadStatus = IFSelect_RetFail;
86
-    StString aFilePath = StFileNode::getCompatibleName(theFileToLoadPath);
87
-
88
-    try {
89
-        aReadStatus = aReader.ReadFile(aFilePath.toCString());
90
-    } catch(Standard_Failure) {
91
-        signals.onError(formatError(theFileToLoadPath, "IGES reader, computation error"));
92
-        return aShape;
93
-    }
94
-    if(aReadStatus != IFSelect_RetDone) {
95
-        signals.onError(formatError(theFileToLoadPath, "IGES reader, bad file format"));
96
-        return aShape;
97
-    }
98
-
99
-    // now perform the translation
100
-    aReader.TransferRoots();
101
-    if(aReader.NbShapes() <= 0) {
102
-        Handle(XSControl_WorkSession) aWorkSession = new XSControl_WorkSession();
103
-        aWorkSession->SelectNorm("IGES");
104
-        aReader.SetWS(aWorkSession, Standard_True);
105
-        aReader.SetReadVisible(Standard_False);
106
-        aReader.TransferRoots();
107
-    }
108
-    if(aReader.NbShapes() <= 0) {
109
-        signals.onError(formatError(theFileToLoadPath, "No shapes found in the IGES file"));
110
-        return aShape;
111
-    }
112
-    TopoDS_Shape anImportedShape = aReader.OneShape();
113
-
114
-    // apply sewing on the imported shape
115
-    BRepBuilderAPI_Sewing aTool(0.0);
116
-    aTool.SetNonManifoldMode(Standard_False);
117
-    aTool.SetFloatingEdgesMode(Standard_True);
118
-    aTool.Load(anImportedShape);
119
-    aTool.Perform();
120
-    TopoDS_Shape aSewedShape = aTool.SewedShape();
121
-
122
-    if(aSewedShape.IsNull()) {
123
-        signals.onError(formatError(theFileToLoadPath, "Sewing result is empty"));
124
-        return aShape;
125
-    }
126
-    if(aSewedShape.IsSame(anImportedShape)) {
127
-        aShape = anImportedShape;
128
-    } else {
129
-        // apply shape healing
130
-        ShapeFix_Shape aShapeFixer(aSewedShape);
131
-        aShapeFixer.FixSolidMode() = 1;
132
-        aShapeFixer.FixFreeShellMode() = 1;
133
-        aShapeFixer.FixFreeFaceMode() = 1;
134
-        aShapeFixer.FixFreeWireMode() = 0;
135
-        aShapeFixer.FixSameParameterMode() = 0;
136
-        aShapeFixer.FixVertexPositionMode() = 0;
137
-        aShape = aShapeFixer.Perform() ? aShapeFixer.Shape() : aSewedShape;
138
-    }
139
-    return aShape;
140
-}
141
-
142
-TopoDS_Shape StCADLoader::loadSTEP(const StString& theFileToLoadPath) {
143
-    STEPControl_Reader aReader;
144
-    IFSelect_ReturnStatus aReadStatus = IFSelect_RetFail;
145
-    StString aFilePath = StFileNode::getCompatibleName(theFileToLoadPath);
146
-    try {
147
-        aReadStatus = aReader.ReadFile(aFilePath.toCString());
148
-    } catch(Standard_Failure) {
149
-        signals.onError(formatError(theFileToLoadPath, "STEP reader, computation error"));
150
-        return TopoDS_Shape();
151
-    }
152
-    if(aReadStatus != IFSelect_RetDone) {
153
-        signals.onError(formatError(theFileToLoadPath, "STEP reader, bad file format"));
154
-        return TopoDS_Shape();
155
-    } else if(aReader.NbRootsForTransfer() <= 0) {
156
-        signals.onError(formatError(theFileToLoadPath, "STEP reader, shape is empty"));
157
-        return TopoDS_Shape();
158
-    }
159
-    // now perform the translation
160
-    aReader.TransferRoots();
161
-    return aReader.OneShape();
162
-}
163
-
164
 bool StCADLoader::loadModel(const StHandle<StFileNode>& theSource) {
165
     const StMIME stMIMEType = theSource->getMIME();
166
     const StString aFileToLoadPath = theSource->getPath();
167
     const StString anExt = !stMIMEType.isEmpty() ? stMIMEType.getExtension() : StFileNode::getExtension(aFileToLoadPath);
168
-
169
-    StHandle<StGLMesh> aMesh;
170
-    TopoDS_Shape aShape;
171
-    if(anExt.isEqualsIgnoreCase(stCString(ST_IGS_EXT)) || anExt.isEqualsIgnoreCase(stCString(ST_IGES_EXT))) {
172
-        aShape = loadIGES(aFileToLoadPath);
173
-    } else if(anExt.isEqualsIgnoreCase(stCString(ST_STP_EXT)) || anExt.isEqualsIgnoreCase(stCString(ST_STEP_EXT))) {
174
-        aShape = loadSTEP(aFileToLoadPath);
175
-    } else if(anExt.isEqualsIgnoreCase(stCString(ST_BREP_EXT)) || anExt.isEqualsIgnoreCase(stCString(ST_RLE_EXT))) {
176
-        StString aFilePath = StFileNode::getCompatibleName(aFileToLoadPath);
177
-        BRep_Builder aBuilder;
178
-        if(!BRepTools::Read(aShape, aFilePath.toCString(), aBuilder)) {
179
-            signals.onError(formatError(aFileToLoadPath, "BREP loading failed"));
180
-        } else if(aShape.IsNull()) {
181
-            signals.onError(formatError(aFileToLoadPath, "No shapes found in the BREP file"));
182
-        }
183
+    bool isGltf = false;
184
+    StAssetImportShape::FileFormat aShapeFormat = StAssetImportShape::FileFormat_UNKNOWN;
185
+    {
186
+      StRawFile aRawFile;
187
+      if(aRawFile.readFile(aFileToLoadPath, -1, 2048)) {
188
+          aShapeFormat = StAssetImportShape::probeFormatFromHeader((const char* )aRawFile.getBuffer(), anExt);
189
+      }
190
+      isGltf = StAssetImportGltf::probeFormatFromHeader((const char* )aRawFile.getBuffer(), anExt);
191
+    }
192
+
193
+    myDoc = new StAssetDocument();
194
+    bool isRead = false;
195
+    if(isGltf) {
196
+        StAssetImportGltf aReader;
197
+        aReader.signals.onError.connect(this, &StCADLoader::doOnErrorRedirect);
198
+        isRead = aReader.load(myDoc, aFileToLoadPath);
199
     } else {
200
-        signals.onError(formatError(aFileToLoadPath, "Format doesn't supported"));
201
sview-16_06.tar.gz/StCADViewer/StCADLoader.h -> sview-17_04.tar.gz/StCADViewer/StCADLoader.h Changed
78
 
1
@@ -13,9 +13,6 @@
2
 
3
 #include <AIS_InteractiveObject.hxx>
4
 #include <NCollection_Sequence.hxx>
5
-#include <TopoDS_Shape.hxx>
6
-#include <TDocStd_Document.hxx>
7
-#include <XCAFApp_Application.hxx>
8
 
9
 #include <StStrings/StString.h>
10
 #include <StFile/StMIMEList.h>
11
@@ -24,27 +21,11 @@
12
 #include <StSlots/StSignal.h>
13
 #include <StThreads/StThread.h>
14
 
15
+#include "StAssetDocument.h"
16
+
17
 class StLangMap;
18
 class StThread;
19
 
20
-class StCADDocument {
21
-
22
-        public:
23
-
24
-    ST_LOCAL StCADDocument();
25
-    ST_LOCAL void reset();
26
-
27
-    const Handle(XCAFApp_Application)& getXCAFApp() const { return myXCAFApp; }
28
-    const Handle(TDocStd_Document)&    getXCAFDoc() const { return myXCAFDoc; }
29
-    Handle(TDocStd_Document)&          changeXCAFDoc()    { return myXCAFDoc; }
30
-
31
-        protected:
32
-
33
-    Handle(XCAFApp_Application) myXCAFApp;
34
-    Handle(TDocStd_Document)    myXCAFDoc;
35
-
36
-};
37
-
38
 class StCADLoader {
39
 
40
         public:
41
@@ -65,7 +46,7 @@
42
     }
43
 
44
     ST_LOCAL virtual bool getNextDoc(NCollection_Sequence<Handle(AIS_InteractiveObject)>& thePrsList,
45
-                                     StHandle<StCADDocument>& theDoc);
46
+                                     Handle(StAssetDocument)& theDoc);
47
 
48
         public:  //!< Signals
49
 
50
@@ -79,11 +60,14 @@
51
 
52
         protected:
53
 
54
-    ST_LOCAL TopoDS_Shape loadIGES(const StString& theFileToLoadPath);
55
-    ST_LOCAL TopoDS_Shape loadSTEP(const StString& theFileToLoadPath);
56
-
57
     ST_LOCAL virtual bool loadModel(const StHandle<StFileNode>& theSource);
58
-    ST_LOCAL virtual bool computeMesh(const TopoDS_Shape& theShape);
59
+
60
+    /**
61
+     * Just redirect callback slot.
62
+     */
63
+    ST_LOCAL void doOnErrorRedirect(const StCString& theMsgText) {
64
+        signals.onError(theMsgText);
65
+    }
66
 
67
     static SV_THREAD_FUNCTION threadFunction(void* theLoader) {
68
         StCADLoader* aCADLoader = (StCADLoader* )theLoader;
69
@@ -97,7 +81,7 @@
70
     StHandle<StLangMap>  myLangMap;
71
     StHandle<StPlayList> myPlayList;
72
     StCondition          myEvLoadNext;
73
-    StHandle<StCADDocument>  myDoc;
74
+    Handle(StAssetDocument) myDoc;
75
     NCollection_Sequence<Handle(AIS_InteractiveObject)> myPrsList;
76
     Graphic3d_MaterialAspect myDefaultMat;
77
     StMutex              myResultLock;
78
sview-16_06.tar.gz/StCADViewer/StCADPluginInfo.h -> sview-17_04.tar.gz/StCADViewer/StCADPluginInfo.h Changed
38
 
1
@@ -41,6 +41,27 @@
2
 #define ST_RLE_MIME_STRING  ST_RLE_MIME  ":" ST_RLE_EXT  ":" ST_BREP_DESC
3
 
4
 /**
5
+ *.xbf - OCAF Binary model file
6
+ */
7
+#define ST_XBF_MIME "model/xbf"
8
+#define ST_XBF_EXT  "xbf"
9
+#define ST_XBF_DESC "XBF - CAD model file (OCCT framework)"
10
+#define ST_XBF_MIME_STRING ST_XBF_MIME ":" ST_XBF_EXT ":" ST_XBF_DESC
11
+
12
+/**
13
+ *.gltf, *.glb - glTF mesh format
14
+ */
15
+#define ST_GLTF_MIME "model/gltf+json"
16
+#define ST_GLTF_DESC "glTF - GL Transmission Format"
17
+#define ST_GLTF_EXT  "gltf"
18
+#define ST_GLTF_MIME_STRING ST_GLTF_MIME ":" ST_GLTF_EXT ":" ST_GLTF_DESC
19
+
20
+#define ST_GLB_MIME "model/gltf.binary"
21
+#define ST_GLB_DESC "glTF - GL Transmission Format (Binary)"
22
+#define ST_GLB_EXT  "glb"
23
+#define ST_GLB_MIME_STRING  ST_GLB_MIME ":" ST_GLB_EXT  ":" ST_GLB_DESC
24
+
25
+/**
26
  *.obj - simplest triangulation exchange format
27
  */
28
 /*#define ST_OBJ_MIME "model/obj"
29
@@ -70,6 +91,8 @@
30
 #define ST_CAD_PLUGIN_MIME_CHAR ST_IGS_MIME_STRING ";" ST_IGES_MIME_STRING ";" \
31
 ST_STP_MIME_STRING  ";" ST_STEP_MIME_STRING ";" \
32
 ST_BREP_MIME_STRING ";" ST_RLE_MIME_STRING  ";" \
33
+ST_XBF_MIME_STRING ";" \
34
+ST_GLTF_MIME_STRING ";" ST_GLB_MIME_STRING ";" \
35
 "\000"
36
 
37
 #endif //__StCADPluginInfo_h_
38
sview-16_06.tar.gz/StCADViewer/StCADViewer.cbp -> sview-17_04.tar.gz/StCADViewer/StCADViewer.cbp Changed
30
 
1
@@ -262,6 +262,17 @@
2
            <Add directory="../bin/$(TARGET_NAME)" />
3
        </Linker>
4
        <Unit filename="main.cpp" />
5
+       <Unit filename="StAssetDocument.cpp" />
6
+       <Unit filename="StAssetDocument.h" />
7
+       <Unit filename="StAssetTexture.cpp" />
8
+       <Unit filename="StAssetTexture.h" />
9
+       <Unit filename="StAssetImportGltf.cpp" />
10
+       <Unit filename="StAssetImportGltf.h" />
11
+       <Unit filename="StAssetImportShape.cpp" />
12
+       <Unit filename="StAssetImportShape.h" />
13
+       <Unit filename="StAssetNodeIterator.h" />
14
+       <Unit filename="StAssetPresentation.cpp" />
15
+       <Unit filename="StAssetPresentation.h" />
16
        <Unit filename="StCADLoader.cpp" />
17
        <Unit filename="StCADLoader.h" />
18
        <Unit filename="StCADMsgPrinter.cpp" />
19
@@ -279,6 +290,10 @@
20
        <Unit filename="StCADViewerGUI.h" />
21
        <Unit filename="StCADViewerStrings.cpp" />
22
        <Unit filename="StCADViewerStrings.h" />
23
+       <Unit filename="StGLMaterial.h" />
24
+       <Unit filename="StImageOcct.cpp" />
25
+       <Unit filename="StImageOcct.h" />
26
+       <Unit filename="StPrimArray.h" />
27
        <Unit filename="lang/english/StCADViewer.lng">
28
            <Option target="&lt;{~None~}&gt;" />
29
        </Unit>
30
sview-16_06.tar.gz/StCADViewer/StCADViewer.cpp -> sview-17_04.tar.gz/StCADViewer/StCADViewer.cpp Changed
201
 
1
@@ -119,6 +119,17 @@
2
     addRenderer(new StOutPageFlipExt(myResMgr, theParentWin));
3
 #endif
4
 
5
+    // need Depth buffer
6
+    const StWinAttr anAttribs[] = {
7
+        StWinAttr_GlDepthSize,   (StWinAttr )24,
8
+        StWinAttr_GlStencilSize, (StWinAttr )8,
9
+        StWinAttr_NULL
10
+    };
11
+    for(size_t aRendIter = 0; aRendIter < myRenderers.size(); ++aRendIter) {
12
+        StHandle<StWindow>& aRend = myRenderers[aRendIter];
13
+        aRend->setAttributes(anAttribs);
14
+    }
15
+
16
     // create actions
17
     StHandle<StAction> anAction;
18
     anAction = new StActionBool(stCString("DoFullscreen"), params.IsFullscreen);
19
@@ -312,9 +323,8 @@
20
     }
21
 #endif
22
 
23
-    myViewer = new V3d_Viewer(aDriver, TCollection_ExtendedString("Viewer").ToExtString(), "", 1000.0,
24
-                              V3d_XposYnegZpos, Quantity_NOC_BLACK, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
25
-                              Standard_True, Standard_False);
26
+    myViewer = new V3d_Viewer(aDriver);
27
+    myViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
28
     Handle(V3d_DirectionalLight) aLightDir = new V3d_DirectionalLight(myViewer, V3d_Zneg, Quantity_NOC_WHITE, Standard_True);
29
     Handle(V3d_AmbientLight)     aLightAmb = new V3d_AmbientLight(myViewer);
30
     aLightDir->SetDirection ( 1.0, -2.0, -10.0);
31
@@ -322,10 +332,8 @@
32
     myViewer->SetLightOn (aLightAmb);
33
 
34
     myAisContext = new AIS_InteractiveContext(myViewer);
35
-    myAisContext->SetDisplayMode(AIS_Shaded);
36
+    myAisContext->SetDisplayMode(0, false);
37
     myAisContext->SetAutoActivateSelection(Standard_False);
38
-    myAisContext->SetHilightColor(Quantity_NOC_CYAN1);
39
-    myAisContext->SelectionColor (Quantity_NOC_WHITE);
40
     const Handle(Prs3d_Drawer)& aDrawer = myAisContext->DefaultDrawer();
41
     aDrawer->SetAutoTriangulation (Standard_False);
42
 #ifdef __ANDROID__
43
@@ -349,7 +357,6 @@
44
     myView->SetWindow(aWindow, (Aspect_RenderingContext )aRendCtx);
45
 #endif
46
 
47
-    myView->SetSurfaceDetail(V3d_TEX_ALL);
48
     return true;
49
 }
50
 
51
@@ -371,7 +378,7 @@
52
     mySettings->loadParam(params.ProjectMode);
53
 
54
     myGUI->stglInit();
55
-    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER));
56
+    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER), myWindow->getMargins(), (float )myWindow->stglAspectRatio());
57
 
58
     registerHotKeys();
59
     return true;
60
@@ -421,8 +428,7 @@
61
         myGUI.nullify();
62
         return false;
63
     }
64
-
65
-    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER));
66
+    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER), myWindow->getMargins(), (float )myWindow->stglAspectRatio());
67
 
68
     // create working threads
69
     if(!isReset) {
70
@@ -488,9 +494,9 @@
71
         return;
72
     }
73
 
74
-    const StGLBoxPx aWinRect = myWindow->stglViewport(ST_WIN_MASTER);
75
-    myGUI->stglResize(aWinRect);
76
-    myProjection.resize(*myContext, aWinRect.width(), aWinRect.height());
77
+    const double anAspect = myWindow->stglAspectRatio();
78
+    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER), myWindow->getMargins(), (float )anAspect);
79
+    myProjection.resize((float )anAspect);
80
 }
81
 
82
 void StCADViewer::doMouseDown(const StClickEvent& theEvent) {
83
@@ -547,7 +553,7 @@
84
         }
85
         case ST_MOUSE_MIDDLE: {
86
             if(!myIsCtrlPressed && !isItemUnclicked) {
87
-                params.IsFullscreen->reverse();
88
+                //params.IsFullscreen->reverse();
89
             }
90
             myIsMiddleHold = false;
91
             break;
92
@@ -617,17 +623,18 @@
93
         return;
94
     }
95
 
96
+    const StPointD_t aCursor(theEvent.PointX, theEvent.PointY);
97
     if(theEvent.StepsY >= 1) {
98
         if(myIsCtrlPressed) {
99
             doStereoZFocusCloser(0.05);
100
         } else {
101
-            doZoomIn(0.1);
102
+            scaleAt(aCursor, 10);
103
         }
104
     } else if(theEvent.StepsY <= -1) {
105
         if(myIsCtrlPressed) {
106
             doStereoZFocusFarther(0.05);
107
         } else {
108
-            doZoomOut(0.1);
109
+            scaleAt(aCursor, -10);
110
         }
111
     }
112
 }
113
@@ -714,11 +721,11 @@
114
     }
115
 
116
     const StString aFilePath = theEvent.Files[0];
117
-    if(myPlayList->checkExtension(aFilePath)) {
118
+    //if(myPlayList->checkExtension(aFilePath)) {
119
         myPlayList->open(aFilePath);
120
         doUpdateStateLoading();
121
         myCADLoader->doLoadNext();
122
-    }
123
+    //}
124
 }
125
 
126
 void StCADViewer::doNavigate(const StNavigEvent& theEvent) {
127
@@ -738,7 +745,8 @@
128
     Handle(Graphic3d_Camera) aCam = !myView.IsNull()
129
                                   ?  myView->Camera()
130
                                   : Handle(Graphic3d_Camera)();
131
-    if(myIsMiddleHold && myIsCtrlPressed && !aCam.IsNull()) {
132
+    //if(myIsMiddleHold && myIsCtrlPressed && !aCam.IsNull()) {
133
+    if(myIsMiddleHold && !aCam.IsNull()) {
134
         // move
135
         StPointD_t aPt = myWindow->getMousePos();
136
         gp_Vec2d aFlatMove( 2.0 * (aPt.x() - myPrevMouse.x()),
137
@@ -772,20 +780,9 @@
138
     if(!myAisContext.IsNull()) {
139
         NCollection_Sequence<Handle(AIS_InteractiveObject)> aNewPrsList;
140
         if(myCADLoader->getNextDoc(aNewPrsList, myDoc)) {
141
-            myAisContext->RemoveAll(Standard_False);
142
+            myAisContext->RemoveAll(false);
143
             for(NCollection_Sequence<Handle(AIS_InteractiveObject)>::Iterator aPrsIter(aNewPrsList); aPrsIter.More(); aPrsIter.Next()) {
144
-                Handle(AIS_Shape)                aShapePrs     = Handle(AIS_Shape)::DownCast (aPrsIter.Value());
145
-                Handle(AIS_ConnectedInteractive) aConnectedPrs = Handle(AIS_ConnectedInteractive)::DownCast (aPrsIter.Value());
146
-                if(!aConnectedPrs.IsNull()) {
147
-                    aShapePrs = Handle(AIS_Shape)::DownCast (aConnectedPrs->ConnectedTo());
148
-                }
149
-                if(!aShapePrs.IsNull()) {
150
-                    aShapePrs->SetDisplayMode(1);
151
-                    if(!aConnectedPrs.IsNull()) {
152
-                        aConnectedPrs->SetDisplayMode(1);
153
-                    }
154
-                }
155
-                myAisContext->Display(aPrsIter.Value(), aPrsIter.Value()->DisplayMode(), 0, Standard_False);
156
+                myAisContext->Display(aPrsIter.Value(), aPrsIter.Value()->DisplayMode(), -1, false);
157
             }
158
 
159
             doFitAll();
160
@@ -794,7 +791,7 @@
161
     }
162
 
163
     myGUI->setVisibility(myWindow->getMousePos(), true);
164
-    myGUI->stglUpdate(myWindow->getMousePos());
165
+    myGUI->stglUpdate(myWindow->getMousePos(), myWindow->isPreciseCursor());
166
 
167
     // recreate menu event
168
     if(myToRecreateMenu) {
169
@@ -819,7 +816,7 @@
170
         }
171
 
172
         if(params.ToShowTrihedron->getValue()) {
173
-          myView->TriedronDisplay(Aspect_TOTP_RIGHT_LOWER, Quantity_NOC_WHITE, 0.08, V3d_ZBUFFER);
174
+          myView->TriedronDisplay(Aspect_TOTP_RIGHT_LOWER, Quantity_NOC_WHITE, 0.1, V3d_ZBUFFER);
175
         } else {
176
           myView->TriedronErase();
177
         }
178
@@ -846,8 +843,7 @@
179
         if(anFboWrapper->GetVPSizeX() > 0
180
         && anFboWrapper->GetVPSizeY() > 0
181
         && aWindow->SetSize(anFboWrapper->GetVPSizeX(), anFboWrapper->GetVPSizeY())) {
182
-            StRectI_t aWinRect = myWindow->getPlacement();
183
-            Standard_Real aRatio = double(aWinRect.width()) / double(aWinRect.height());
184
+            const double aRatio = myWindow->stglAspectRatio();
185
             myView->Camera()->SetAspect(aRatio);
186
             myView->View()->Resized();
187
         }
188
@@ -872,7 +868,7 @@
189
         myContext->core11fwd->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
190
     }
191
 
192
-    myGUI->getCamera()->setView(theView);
193
+    myGUI->changeCamera()->setView(theView);
194
     myProjection.setView(theView);
195
 
196
     // draw GUI
197
@@ -980,6 +976,21 @@
198
     }
199
 }
200
 
201
sview-16_06.tar.gz/StCADViewer/StCADViewer.h -> sview-17_04.tar.gz/StCADViewer/StCADViewer.h Changed
28
 
1
@@ -38,7 +38,7 @@
2
 class StSettings;
3
 class StCADViewerGUI;
4
 class StCADLoader;
5
-class StCADDocument;
6
+class StAssetDocument;
7
 
8
 /**
9
  * CAD Viewer application.
10
@@ -189,6 +189,8 @@
11
     ST_LOCAL virtual void doChangeLanguage(const int32_t theNewLang) ST_ATTR_OVERRIDE;
12
     ST_LOCAL void doFullscreen(const bool theIsFullscreen);
13
     ST_LOCAL void doChangeProjection(const int32_t theProj);
14
+    ST_LOCAL void scaleAt(const StPointD_t& thePoint,
15
+                          const float       theStep);
16
     ST_LOCAL void doZoomIn (const double theValue);
17
     ST_LOCAL void doZoomOut(const double theValue);
18
     ST_LOCAL void doStereoZFocusCloser(const double theValue);
19
@@ -241,7 +243,7 @@
20
     Handle(V3d_View)               myView;       //!< main view
21
     Handle(AIS_InteractiveContext) myAisContext; //!< interactive context containing displayed objects
22
 
23
-    StHandle<StCADDocument>        myDoc;
24
+    Handle(StAssetDocument)        myDoc;
25
 
26
         private:
27
 
28
sview-16_06.tar.gz/StCADViewer/StCADViewer.rc -> sview-17_04.tar.gz/StCADViewer/StCADViewer.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "Stereoscopic CAD Viewer\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2011-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2011-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StCADViewer\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StCADViewer/StCADViewer.vcxproj -> sview-17_04.tar.gz/StCADViewer/StCADViewer.vcxproj Changed
144
 
1
@@ -100,7 +100,7 @@
2
       <PreprocessorDefinitions>ST_HAVE_STCONFIG;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
3
     </ResourceCompile>
4
     <Link>
5
-      <AdditionalDependencies>opengl32.lib;user32.lib;gdi32.lib;Advapi32.lib;Comdlg32.lib;Shell32.lib;avutil.lib;avformat.lib;avcodec.lib;swscale.lib;freetype.lib;StGLWidgets.lib;StShared.lib;StCore.lib;StOutAnaglyph.lib;StOutDual.lib;StOutIZ3D.lib;StOutInterlace.lib;StOutPageFlip.lib;StOutDistorted.lib;TKMeshVS.lib;TKXDESTEP.lib;TKSTEP.lib;TKSTEPAttr.lib;TKSTEP209.lib;TKSTEPBase.lib;TKXDEIGES.lib;TKIGES.lib;TKXSBase.lib;TKOpenGl.lib;TKXCAF.lib;TKCAF.lib;TKV3d.lib;TKHLR.lib;TKMesh.lib;TKService.lib;TKOffset.lib;TKFillet.lib;TKShHealing.lib;TKBool.lib;TKBO.lib;TKPrim.lib;TKTopAlgo.lib;TKGeomAlgo.lib;TKBRep.lib;TKGeomBase.lib;TKG3d.lib;TKG2d.lib;TKMath.lib;TKLCAF.lib;TKCDF.lib;TKernel.lib;%(AdditionalDependencies)</AdditionalDependencies>
6
+      <AdditionalDependencies>opengl32.lib;user32.lib;gdi32.lib;Advapi32.lib;Comdlg32.lib;Shell32.lib;avutil.lib;avformat.lib;avcodec.lib;swscale.lib;freetype.lib;StGLWidgets.lib;StShared.lib;StCore.lib;StOutAnaglyph.lib;StOutDual.lib;StOutIZ3D.lib;StOutInterlace.lib;StOutPageFlip.lib;StOutDistorted.lib;TKBinXCAF.lib;TKMeshVS.lib;TKXDESTEP.lib;TKSTEP.lib;TKSTEPAttr.lib;TKSTEP209.lib;TKSTEPBase.lib;TKXDEIGES.lib;TKIGES.lib;TKXSBase.lib;TKOpenGl.lib;TKXCAF.lib;TKCAF.lib;TKV3d.lib;TKHLR.lib;TKMesh.lib;TKService.lib;TKOffset.lib;TKFillet.lib;TKShHealing.lib;TKBool.lib;TKBO.lib;TKPrim.lib;TKTopAlgo.lib;TKGeomAlgo.lib;TKBRep.lib;TKGeomBase.lib;TKG3d.lib;TKG2d.lib;TKMath.lib;TKLCAF.lib;TKCDF.lib;TKernel.lib;%(AdditionalDependencies)</AdditionalDependencies>
7
       <SuppressStartupBanner>true</SuppressStartupBanner>
8
       <AdditionalLibraryDirectories>..\3rdparty\lib\WIN_vc_x86;..\lib\WIN_vc_x86;$(StOcctLib32);$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
9
       <SubSystem>Windows</SubSystem>
10
@@ -109,16 +109,7 @@
11
       <EnableDpiAwareness>false</EnableDpiAwareness>
12
     </Manifest>
13
     <PostBuildEvent>
14
-      <Command>xcopy /Y "$(StOcctRes)\UnitsAPI\Lexi_Expr.dat" "$(TargetDir)\res\"
15
-xcopy /Y "$(StOcctRes)\UnitsAPI\Units.dat" "$(TargetDir)\res\"
16
-xcopy /Y "$(StOcctRes)\SHMessage\*.*" "$(TargetDir)\lang\"
17
-xcopy /Y "$(StOcctRes)\XSMessage\*.*" "$(TargetDir)\lang\"
18
-xcopy /Y "$(StOcctRes)\Shaders\*.*" "$(TargetDir)\shaders\StCADViewer\"
19
-xcopy /Y "$(StOcctRes)\TObj\*.msg" "$(TargetDir)\lang\"
20
-xcopy /Y "$(StOcctRes)\StdResource\*" "$(TargetDir)\res\"
21
-xcopy /Y "$(StOcctRes)\XSTEPResource\*" "$(TargetDir)\res\"
22
-xcopy /Y "$(StOcctRes)\XmlOcafResource\*.*" "$(TargetDir)\res\"
23
-cmd /c call ..\copy_res.bat $(TargetDir) $(TargetName)
24
+      <Command>cmd /c call ..\copy_res.bat $(TargetDir) $(TargetName)
25
 </Command>
26
     </PostBuildEvent>
27
   </ItemDefinitionGroup>
28
@@ -150,7 +141,7 @@
29
       <PreprocessorDefinitions>ST_HAVE_STCONFIG;_CRT_SECURE_NO_WARNINGS;_DEBUG;ST_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
30
     </ResourceCompile>
31
     <Link>
32
-      <AdditionalDependencies>opengl32.lib;user32.lib;gdi32.lib;Advapi32.lib;Comdlg32.lib;Shell32.lib;avutil.lib;avformat.lib;avcodec.lib;swscale.lib;freetype.lib;StGLWidgets.lib;StShared.lib;StCore.lib;StOutAnaglyph.lib;StOutDual.lib;StOutIZ3D.lib;StOutInterlace.lib;StOutPageFlip.lib;StOutDistorted.lib;TKMeshVS.lib;TKXDESTEP.lib;TKSTEP.lib;TKSTEPAttr.lib;TKSTEP209.lib;TKSTEPBase.lib;TKXDEIGES.lib;TKIGES.lib;TKXSBase.lib;TKOpenGl.lib;TKXCAF.lib;TKCAF.lib;TKV3d.lib;TKHLR.lib;TKMesh.lib;TKService.lib;TKOffset.lib;TKFillet.lib;TKShHealing.lib;TKBool.lib;TKBO.lib;TKPrim.lib;TKTopAlgo.lib;TKGeomAlgo.lib;TKBRep.lib;TKGeomBase.lib;TKG3d.lib;TKG2d.lib;TKMath.lib;TKLCAF.lib;TKCDF.lib;TKernel.lib;%(AdditionalDependencies)</AdditionalDependencies>
33
+      <AdditionalDependencies>opengl32.lib;user32.lib;gdi32.lib;Advapi32.lib;Comdlg32.lib;Shell32.lib;avutil.lib;avformat.lib;avcodec.lib;swscale.lib;freetype.lib;StGLWidgets.lib;StShared.lib;StCore.lib;StOutAnaglyph.lib;StOutDual.lib;StOutIZ3D.lib;StOutInterlace.lib;StOutPageFlip.lib;StOutDistorted.lib;TKBinXCAF.lib;TKMeshVS.lib;TKXDESTEP.lib;TKSTEP.lib;TKSTEPAttr.lib;TKSTEP209.lib;TKSTEPBase.lib;TKXDEIGES.lib;TKIGES.lib;TKXSBase.lib;TKOpenGl.lib;TKXCAF.lib;TKCAF.lib;TKV3d.lib;TKHLR.lib;TKMesh.lib;TKService.lib;TKOffset.lib;TKFillet.lib;TKShHealing.lib;TKBool.lib;TKBO.lib;TKPrim.lib;TKTopAlgo.lib;TKGeomAlgo.lib;TKBRep.lib;TKGeomBase.lib;TKG3d.lib;TKG2d.lib;TKMath.lib;TKLCAF.lib;TKCDF.lib;TKernel.lib;%(AdditionalDependencies)</AdditionalDependencies>
34
       <SuppressStartupBanner>true</SuppressStartupBanner>
35
       <AdditionalLibraryDirectories>..\3rdparty\lib\WIN_vc_x86_DEBUG;..\lib\WIN_vc_x86_DEBUG;$(StOcctLib32d);$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
36
       <GenerateDebugInformation>true</GenerateDebugInformation>
37
@@ -160,16 +151,7 @@
38
       <EnableDpiAwareness>false</EnableDpiAwareness>
39
     </Manifest>
40
     <PostBuildEvent>
41
-      <Command>xcopy /Y "$(StOcctRes)\UnitsAPI\Lexi_Expr.dat" "$(TargetDir)\res\"
42
-xcopy /Y "$(StOcctRes)\UnitsAPI\Units.dat" "$(TargetDir)\res\"
43
-xcopy /Y "$(StOcctRes)\SHMessage\*.*" "$(TargetDir)\lang\"
44
-xcopy /Y "$(StOcctRes)\XSMessage\*.*" "$(TargetDir)\lang\"
45
-xcopy /Y "$(StOcctRes)\Shaders\*.*" "$(TargetDir)\shaders\StCADViewer\"
46
-xcopy /Y "$(StOcctRes)\TObj\*.msg" "$(TargetDir)\lang\"
47
-xcopy /Y "$(StOcctRes)\StdResource\*" "$(TargetDir)\res\"
48
-xcopy /Y "$(StOcctRes)\XSTEPResource\*" "$(TargetDir)\res\"
49
-xcopy /Y "$(StOcctRes)\XmlOcafResource\*.*" "$(TargetDir)\res\"
50
-cmd /c call ..\copy_res.bat $(TargetDir) $(TargetName)
51
+      <Command>cmd /c call ..\copy_res.bat $(TargetDir) $(TargetName)
52
 </Command>
53
     </PostBuildEvent>
54
   </ItemDefinitionGroup>
55
@@ -200,7 +182,7 @@
56
       <PreprocessorDefinitions>ST_HAVE_STCONFIG;_CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
57
     </ResourceCompile>
58
     <Link>
59
-      <AdditionalDependencies>opengl32.lib;user32.lib;gdi32.lib;Advapi32.lib;Comdlg32.lib;Shell32.lib;avutil.lib;avformat.lib;avcodec.lib;swscale.lib;freetype.lib;StGLWidgets.lib;StShared.lib;StCore.lib;StOutAnaglyph.lib;StOutDual.lib;StOutIZ3D.lib;StOutInterlace.lib;StOutPageFlip.lib;StOutDistorted.lib;TKMeshVS.lib;TKXDESTEP.lib;TKSTEP.lib;TKSTEPAttr.lib;TKSTEP209.lib;TKSTEPBase.lib;TKXDEIGES.lib;TKIGES.lib;TKXSBase.lib;TKOpenGl.lib;TKXCAF.lib;TKCAF.lib;TKV3d.lib;TKHLR.lib;TKMesh.lib;TKService.lib;TKOffset.lib;TKFillet.lib;TKShHealing.lib;TKBool.lib;TKBO.lib;TKPrim.lib;TKTopAlgo.lib;TKGeomAlgo.lib;TKBRep.lib;TKGeomBase.lib;TKG3d.lib;TKG2d.lib;TKMath.lib;TKLCAF.lib;TKCDF.lib;TKernel.lib;%(AdditionalDependencies)</AdditionalDependencies>
60
+      <AdditionalDependencies>opengl32.lib;user32.lib;gdi32.lib;Advapi32.lib;Comdlg32.lib;Shell32.lib;avutil.lib;avformat.lib;avcodec.lib;swscale.lib;freetype.lib;StGLWidgets.lib;StShared.lib;StCore.lib;StOutAnaglyph.lib;StOutDual.lib;StOutIZ3D.lib;StOutInterlace.lib;StOutPageFlip.lib;StOutDistorted.lib;TKBinXCAF.lib;TKMeshVS.lib;TKXDESTEP.lib;TKSTEP.lib;TKSTEPAttr.lib;TKSTEP209.lib;TKSTEPBase.lib;TKXDEIGES.lib;TKIGES.lib;TKXSBase.lib;TKOpenGl.lib;TKXCAF.lib;TKCAF.lib;TKV3d.lib;TKHLR.lib;TKMesh.lib;TKService.lib;TKOffset.lib;TKFillet.lib;TKShHealing.lib;TKBool.lib;TKBO.lib;TKPrim.lib;TKTopAlgo.lib;TKGeomAlgo.lib;TKBRep.lib;TKGeomBase.lib;TKG3d.lib;TKG2d.lib;TKMath.lib;TKLCAF.lib;TKCDF.lib;TKernel.lib;%(AdditionalDependencies)</AdditionalDependencies>
61
       <SuppressStartupBanner>true</SuppressStartupBanner>
62
       <AdditionalLibraryDirectories>..\3rdparty\lib\WIN_vc_AMD64;..\lib\WIN_vc_AMD64;$(StOcctLib64);$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
63
       <SubSystem>Windows</SubSystem>
64
@@ -209,16 +191,7 @@
65
       <EnableDpiAwareness>false</EnableDpiAwareness>
66
     </Manifest>
67
     <PostBuildEvent>
68
-      <Command>xcopy /Y "$(StOcctRes)\UnitsAPI\Lexi_Expr.dat" "$(TargetDir)\res\"
69
-xcopy /Y "$(StOcctRes)\UnitsAPI\Units.dat" "$(TargetDir)\res\"
70
-xcopy /Y "$(StOcctRes)\SHMessage\*.*" "$(TargetDir)\lang\"
71
-xcopy /Y "$(StOcctRes)\XSMessage\*.*" "$(TargetDir)\lang\"
72
-xcopy /Y "$(StOcctRes)\Shaders\*.*" "$(TargetDir)\shaders\StCADViewer\"
73
-xcopy /Y "$(StOcctRes)\TObj\*.msg" "$(TargetDir)\lang\"
74
-xcopy /Y "$(StOcctRes)\StdResource\*" "$(TargetDir)\res\"
75
-xcopy /Y "$(StOcctRes)\XSTEPResource\*" "$(TargetDir)\res\"
76
-xcopy /Y "$(StOcctRes)\XmlOcafResource\*.*" "$(TargetDir)\res\"
77
-cmd /c call ..\copy_res.bat $(TargetDir) $(TargetName)
78
+      <Command>cmd /c call ..\copy_res.bat $(TargetDir) $(TargetName)
79
 </Command>
80
     </PostBuildEvent>
81
   </ItemDefinitionGroup>
82
@@ -250,7 +223,7 @@
83
       <PreprocessorDefinitions>ST_HAVE_STCONFIG;_CRT_SECURE_NO_WARNINGS;_DEBUG;ST_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
84
     </ResourceCompile>
85
     <Link>
86
-      <AdditionalDependencies>opengl32.lib;user32.lib;gdi32.lib;Advapi32.lib;Comdlg32.lib;Shell32.lib;avutil.lib;avformat.lib;avcodec.lib;swscale.lib;freetype.lib;StGLWidgets.lib;StShared.lib;StCore.lib;StOutAnaglyph.lib;StOutDual.lib;StOutIZ3D.lib;StOutInterlace.lib;StOutPageFlip.lib;StOutDistorted.lib;TKMeshVS.lib;TKXDESTEP.lib;TKSTEP.lib;TKSTEPAttr.lib;TKSTEP209.lib;TKSTEPBase.lib;TKXDEIGES.lib;TKIGES.lib;TKXSBase.lib;TKOpenGl.lib;TKXCAF.lib;TKCAF.lib;TKV3d.lib;TKHLR.lib;TKMesh.lib;TKService.lib;TKOffset.lib;TKFillet.lib;TKShHealing.lib;TKBool.lib;TKBO.lib;TKPrim.lib;TKTopAlgo.lib;TKGeomAlgo.lib;TKBRep.lib;TKGeomBase.lib;TKG3d.lib;TKG2d.lib;TKMath.lib;TKLCAF.lib;TKCDF.lib;TKernel.lib;%(AdditionalDependencies)</AdditionalDependencies>
87
+      <AdditionalDependencies>opengl32.lib;user32.lib;gdi32.lib;Advapi32.lib;Comdlg32.lib;Shell32.lib;avutil.lib;avformat.lib;avcodec.lib;swscale.lib;freetype.lib;StGLWidgets.lib;StShared.lib;StCore.lib;StOutAnaglyph.lib;StOutDual.lib;StOutIZ3D.lib;StOutInterlace.lib;StOutPageFlip.lib;StOutDistorted.lib;TKBinXCAF.lib;TKMeshVS.lib;TKXDESTEP.lib;TKSTEP.lib;TKSTEPAttr.lib;TKSTEP209.lib;TKSTEPBase.lib;TKXDEIGES.lib;TKIGES.lib;TKXSBase.lib;TKOpenGl.lib;TKXCAF.lib;TKCAF.lib;TKV3d.lib;TKHLR.lib;TKMesh.lib;TKService.lib;TKOffset.lib;TKFillet.lib;TKShHealing.lib;TKBool.lib;TKBO.lib;TKPrim.lib;TKTopAlgo.lib;TKGeomAlgo.lib;TKBRep.lib;TKGeomBase.lib;TKG3d.lib;TKG2d.lib;TKMath.lib;TKLCAF.lib;TKCDF.lib;TKernel.lib;%(AdditionalDependencies)</AdditionalDependencies>
88
       <SuppressStartupBanner>true</SuppressStartupBanner>
89
       <AdditionalLibraryDirectories>..\3rdparty\lib\WIN_vc_AMD64_DEBUG;..\lib\WIN_vc_AMD64_DEBUG;$(StOcctLib64d);$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
90
       <GenerateDebugInformation>true</GenerateDebugInformation>
91
@@ -260,29 +233,32 @@
92
       <EnableDpiAwareness>false</EnableDpiAwareness>
93
     </Manifest>
94
     <PostBuildEvent>
95
-      <Command>xcopy /Y "$(StOcctRes)\UnitsAPI\Lexi_Expr.dat" "$(TargetDir)\res\"
96
-xcopy /Y "$(StOcctRes)\UnitsAPI\Units.dat" "$(TargetDir)\res\"
97
-xcopy /Y "$(StOcctRes)\SHMessage\*.*" "$(TargetDir)\lang\"
98
-xcopy /Y "$(StOcctRes)\XSMessage\*.*" "$(TargetDir)\lang\"
99
-xcopy /Y "$(StOcctRes)\Shaders\*.*" "$(TargetDir)\shaders\StCADViewer\"
100
-xcopy /Y "$(StOcctRes)\TObj\*.msg" "$(TargetDir)\lang\"
101
-xcopy /Y "$(StOcctRes)\StdResource\*" "$(TargetDir)\res\"
102
-xcopy /Y "$(StOcctRes)\XSTEPResource\*" "$(TargetDir)\res\"
103
-xcopy /Y "$(StOcctRes)\XmlOcafResource\*.*" "$(TargetDir)\res\"
104
-cmd /c call ..\copy_res.bat $(TargetDir) $(TargetName)
105
+      <Command>cmd /c call ..\copy_res.bat $(TargetDir) $(TargetName)
106
 </Command>
107
     </PostBuildEvent>
108
   </ItemDefinitionGroup>
109
   <ItemGroup>
110
     <ClCompile Include="main.cpp" />
111
+    <ClCompile Include="StAssetImportGltf.cpp" />
112
+    <ClCompile Include="StAssetImportShape.cpp" />
113
+    <ClCompile Include="StAssetPresentation.cpp" />
114
+    <ClCompile Include="StAssetDocument.cpp" />
115
+    <ClCompile Include="StAssetTexture.cpp" />
116
     <ClCompile Include="StCADFrameBuffer.cpp" />
117
     <ClCompile Include="StCADLoader.cpp" />
118
     <ClCompile Include="StCADMsgPrinter.cpp" />
119
     <ClCompile Include="StCADViewer.cpp" />
120
     <ClCompile Include="StCADViewerGUI.cpp" />
121
     <ClCompile Include="StCADViewerStrings.cpp" />
122
+    <ClCompile Include="StImageOcct.cpp" />
123
   </ItemGroup>
124
   <ItemGroup>
125
+    <ClInclude Include="StAssetImportGltf.h" />
126
+    <ClInclude Include="StAssetImportShape.h" />
127
+    <ClInclude Include="StAssetNodeIterator.h" />
128
+    <ClInclude Include="StAssetPresentation.h" />
129
+    <ClInclude Include="StAssetDocument.h" />
130
+    <ClInclude Include="StAssetTexture.h" />
131
     <ClInclude Include="StCADFrameBuffer.h" />
132
     <ClInclude Include="StCADLoader.h" />
133
     <ClInclude Include="StCADMsgPrinter.h" />
134
@@ -291,6 +267,9 @@
135
     <ClInclude Include="StCADViewerGUI.h" />
136
     <ClInclude Include="StCADViewerStrings.h" />
137
     <ClInclude Include="StCADWindow.h" />
138
+    <ClInclude Include="StGLMaterial.h" />
139
+    <ClInclude Include="StImageOcct.h" />
140
+    <ClInclude Include="StPrimArray.h" />
141
   </ItemGroup>
142
   <ItemGroup>
143
     <ResourceCompile Include="StCADViewer.rc" />
144
sview-16_06.tar.gz/StCADViewer/StCADViewer.vcxproj.filters -> sview-17_04.tar.gz/StCADViewer/StCADViewer.vcxproj.filters Changed
130
 
1
@@ -20,4 +20,127 @@
2
   <ItemGroup>
3
     <Manifest Include="..\dpiAware.manifest" />
4
   </ItemGroup>
5
+  <ItemGroup>
6
+    <ClCompile Include="main.cpp">
7
+      <Filter>Source Files</Filter>
8
+    </ClCompile>
9
+    <ClCompile Include="StCADFrameBuffer.cpp">
10
+      <Filter>Source Files</Filter>
11
+    </ClCompile>
12
+    <ClCompile Include="StCADLoader.cpp">
13
+      <Filter>Source Files</Filter>
14
+    </ClCompile>
15
+    <ClCompile Include="StCADMsgPrinter.cpp">
16
+      <Filter>Source Files</Filter>
17
+    </ClCompile>
18
+    <ClCompile Include="StCADViewer.cpp">
19
+      <Filter>Source Files</Filter>
20
+    </ClCompile>
21
+    <ClCompile Include="StCADViewerGUI.cpp">
22
+      <Filter>Source Files</Filter>
23
+    </ClCompile>
24
+    <ClCompile Include="StCADViewerStrings.cpp">
25
+      <Filter>Source Files</Filter>
26
+    </ClCompile>
27
+    <ClCompile Include="StAssetPresentation.cpp">
28
+      <Filter>Source Files</Filter>
29
+    </ClCompile>
30
+    <ClCompile Include="StAssetImportShape.cpp">
31
+      <Filter>Source Files</Filter>
32
+    </ClCompile>
33
+    <ClCompile Include="StAssetDocument.cpp">
34
+      <Filter>Source Files</Filter>
35
+    </ClCompile>
36
+    <ClCompile Include="StAssetImportGltf.cpp">
37
+      <Filter>Source Files</Filter>
38
+    </ClCompile>
39
+    <ClCompile Include="StImageOcct.cpp">
40
+      <Filter>Source Files</Filter>
41
+    </ClCompile>
42
+    <ClCompile Include="StAssetTexture.cpp">
43
+      <Filter>Source Files</Filter>
44
+    </ClCompile>
45
+  </ItemGroup>
46
+  <ItemGroup>
47
+    <ClInclude Include="StCADFrameBuffer.h">
48
+      <Filter>Header Files</Filter>
49
+    </ClInclude>
50
+    <ClInclude Include="StCADLoader.h">
51
+      <Filter>Header Files</Filter>
52
+    </ClInclude>
53
+    <ClInclude Include="StCADMsgPrinter.h">
54
+      <Filter>Header Files</Filter>
55
+    </ClInclude>
56
+    <ClInclude Include="StCADPluginInfo.h">
57
+      <Filter>Header Files</Filter>
58
+    </ClInclude>
59
+    <ClInclude Include="StCADViewer.h">
60
+      <Filter>Header Files</Filter>
61
+    </ClInclude>
62
+    <ClInclude Include="StCADViewerGUI.h">
63
+      <Filter>Header Files</Filter>
64
+    </ClInclude>
65
+    <ClInclude Include="StCADViewerStrings.h">
66
+      <Filter>Header Files</Filter>
67
+    </ClInclude>
68
+    <ClInclude Include="StCADWindow.h">
69
+      <Filter>Header Files</Filter>
70
+    </ClInclude>
71
+    <ClInclude Include="StAssetPresentation.h">
72
+      <Filter>Header Files</Filter>
73
+    </ClInclude>
74
+    <ClInclude Include="StAssetImportShape.h">
75
+      <Filter>Header Files</Filter>
76
+    </ClInclude>
77
+    <ClInclude Include="StAssetDocument.h">
78
+      <Filter>Header Files</Filter>
79
+    </ClInclude>
80
+    <ClInclude Include="StAssetNodeIterator.h">
81
+      <Filter>Header Files</Filter>
82
+    </ClInclude>
83
+    <ClInclude Include="StAssetImportGltf.h">
84
+      <Filter>Header Files</Filter>
85
+    </ClInclude>
86
+    <ClInclude Include="StImageOcct.h">
87
+      <Filter>Header Files</Filter>
88
+    </ClInclude>
89
+    <ClInclude Include="StAssetTexture.h">
90
+      <Filter>Header Files</Filter>
91
+    </ClInclude>
92
+    <ClInclude Include="StGLMaterial.h">
93
+      <Filter>Header Files</Filter>
94
+    </ClInclude>
95
+    <ClInclude Include="StPrimArray.h">
96
+      <Filter>Header Files</Filter>
97
+    </ClInclude>
98
+  </ItemGroup>
99
+  <ItemGroup>
100
+    <None Include="lang\chinese\language.lng">
101
+      <Filter>Translation Files</Filter>
102
+    </None>
103
+    <None Include="lang\chinese\StCADViewer.lng">
104
+      <Filter>Translation Files</Filter>
105
+    </None>
106
+    <None Include="lang\czech\language.lng">
107
+      <Filter>Translation Files</Filter>
108
+    </None>
109
+    <None Include="lang\czech\StCADViewer.lng">
110
+      <Filter>Translation Files</Filter>
111
+    </None>
112
+    <None Include="lang\english\StCADViewer.lng">
113
+      <Filter>Translation Files</Filter>
114
+    </None>
115
+    <None Include="lang\french\StCADViewer.lng">
116
+      <Filter>Translation Files</Filter>
117
+    </None>
118
+    <None Include="lang\german\StCADViewer.lng">
119
+      <Filter>Translation Files</Filter>
120
+    </None>
121
+    <None Include="lang\korean\StCADViewer.lng">
122
+      <Filter>Translation Files</Filter>
123
+    </None>
124
+    <None Include="lang\russian\StCADViewer.lng">
125
+      <Filter>Translation Files</Filter>
126
+    </None>
127
+  </ItemGroup>
128
 </Project>
129
\ No newline at end of file
130
sview-16_06.tar.gz/StCADViewer/StCADViewerGUI.cpp -> sview-17_04.tar.gz/StCADViewer/StCADViewerGUI.cpp Changed
121
 
1
@@ -1,7 +1,7 @@
2
 /**
3
  * This source is a part of sView program.
4
  *
5
- * Copyright © Kirill Gavrilov, 2011-2016
6
+ * Copyright © Kirill Gavrilov, 2011-2017
7
  */
8
 
9
 #include "StCADViewerGUI.h"
10
@@ -42,8 +42,7 @@
11
     const int      anIconStep = scale(56);
12
     aButtonMargins.extend(scale(12));
13
 
14
-    const StMarginsI& aRootMargins = getRootMargins();
15
-    myPanelUpper = new StGLContainer(this, aRootMargins.left, aRootMargins.top, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), scale(4096), scale(56));
16
+    myPanelUpper = new StGLContainer(this, 0, 0, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), scale(4096), scale(56));
17
 
18
     // left side
19
     {
20
@@ -73,8 +72,7 @@
21
     const int      anIconStep = scale(56);
22
     aButtonMargins.extend(scale(12));
23
 
24
-    const StMarginsI& aRootMargins = getRootMargins();
25
-    myPanelBottom = new StGLContainer(this, aRootMargins.left, -aRootMargins.bottom, StGLCorner(ST_VCORNER_BOTTOM, ST_HCORNER_LEFT), scale(4096), scale(56));
26
+    myPanelBottom = new StGLContainer(this, 0, 0, StGLCorner(ST_VCORNER_BOTTOM, ST_HCORNER_LEFT), scale(4096), scale(56));
27
 
28
     // left side
29
     {
30
@@ -285,7 +283,6 @@
31
     const GLfloat aScale = myPlugin->myWindow->getScaleFactor();
32
     setScale(aScale, StGLRootWidget::ScaleAdjust_Normal);
33
     setMobile(StWindow::isMobile());
34
-    changeRootMargins() = myPlugin->myWindow->getMargins();
35
 
36
     myPlugin->params.ToShowFps->signals.onChanged.connect(this, &StCADViewerGUI::doShowFPS);
37
 
38
@@ -308,7 +305,6 @@
39
     myZFocusBar->setCorner(StGLCorner(ST_VCORNER_BOTTOM, ST_HCORNER_LEFT));
40
     myZFocusBar->signals.onSeekClick  = stSlot(this, &StCADViewerGUI::doZFocusSet);
41
     myZFocusBar->signals.onSeekScroll = stSlot(this, &StCADViewerGUI::doZFocusScroll);
42
-    myZFocusBar->setMoveTolerance(1);
43
     myZFocusBar->changeMargins().left  = scale(8);
44
     myZFocusBar->changeMargins().right = scale(8);
45
 
46
@@ -327,7 +323,6 @@
47
     myStereoIODBar->setCorner(StGLCorner(ST_VCORNER_BOTTOM, ST_HCORNER_LEFT));
48
     myStereoIODBar->signals.onSeekClick  = stSlot(this, &StCADViewerGUI::doStereoIODSet);
49
     myStereoIODBar->signals.onSeekScroll = stSlot(this, &StCADViewerGUI::doStereoIODScroll);
50
-    myStereoIODBar->setMoveTolerance(1);
51
     myStereoIODBar->changeMargins().left  = scale(8);
52
     myStereoIODBar->changeMargins().right = scale(8);
53
 
54
@@ -380,8 +375,9 @@
55
     }
56
 }
57
 
58
-void StCADViewerGUI::stglUpdate(const StPointD_t& theCursorZo) {
59
-    StGLRootWidget::stglUpdate(theCursorZo);
60
+void StCADViewerGUI::stglUpdate(const StPointD_t& theCursorZo,
61
+                                bool theIsPreciseInput) {
62
+    StGLRootWidget::stglUpdate(theCursorZo, theIsPreciseInput);
63
     if(myMouseDescr != NULL) {
64
         myMouseDescr->setPoint(theCursorZo);
65
     }
66
@@ -401,37 +397,18 @@
67
     }
68
 }
69
 
70
-void StCADViewerGUI::stglResize(const StGLBoxPx& theRectPx) {
71
-    const int aSizeX = theRectPx.width();
72
-    const StMarginsI& aMargins = myPlugin->getMainWindow()->getMargins();
73
-    const bool areNewMargins = aMargins != getRootMargins();
74
-    if(areNewMargins) {
75
-        changeRootMargins() = aMargins;
76
-    }
77
-
78
+void StCADViewerGUI::stglResize(const StGLBoxPx&  theViewPort,
79
+                                const StMarginsI& theMargins,
80
+                                float theAspect) {
81
+    const int aNewSizeX  = theViewPort.width();
82
+    const int aWorkRight = stMax(aNewSizeX - theMargins.right, 2);
83
     if(myPanelUpper != NULL) {
84
-        myPanelUpper->changeRectPx().right() = aSizeX;
85
+        myPanelUpper->changeRectPx().right() = aWorkRight;
86
     }
87
     if(myPanelBottom != NULL) {
88
-        myPanelBottom->changeRectPx().right() = aSizeX;
89
+        myPanelBottom->changeRectPx().right() = aWorkRight;
90
     }
91
-    if(areNewMargins) {
92
-        if(myPanelUpper != NULL) {
93
-            myPanelUpper->changeRectPx().left() = aMargins.left;
94
-            myPanelUpper->changeRectPx().top()  = aMargins.top;
95
-        }
96
-        if(myPanelBottom != NULL) {
97
-            myPanelBottom->changeRectPx().left() = aMargins.left;
98
-            myPanelBottom->changeRectPx().top()  = aMargins.top;
99
-        }
100
-        if(myMenu0Root != NULL) {
101
-            myMenu0Root->changeRectPx().left() = aMargins.left;
102
-            myMenu0Root->changeRectPx().top()  = aMargins.top;
103
-            myMenu0Root->stglUpdateSubmenuLayout();
104
-        }
105
-    }
106
-
107
-    StGLRootWidget::stglResize(theRectPx);
108
+    StGLRootWidget::stglResize(theViewPort, theMargins, theAspect);
109
 }
110
 
111
 void StCADViewerGUI::stglDraw(unsigned int theView) {
112
@@ -449,7 +426,7 @@
113
     const StGLVec3 THE_WHITE(1.0f, 1.0f, 1.0f);
114
     const StString anAbout = tr(ABOUT_DPLUGIN_NAME) + '\n'
115
                            + tr(ABOUT_VERSION) + " " + StVersionInfo::getSDKVersionString()
116
-                           + "\n \n" + tr(ABOUT_DESCRIPTION).format("2011-2016", "kirill@sview.ru", "www.sview.ru");
117
+                           + "\n \n" + tr(ABOUT_DESCRIPTION).format("2011-2017", "kirill@sview.ru", "www.sview.ru");
118
 
119
     StArgumentsMap anInfo;
120
     anInfo.add(StDictEntry("CPU cores", StString(StThread::countLogicalProcessors()) + StString(" logical processor(s)")));
121
sview-16_06.tar.gz/StCADViewer/StCADViewerGUI.h -> sview-17_04.tar.gz/StCADViewer/StCADViewerGUI.h Changed
24
 
1
@@ -1,7 +1,7 @@
2
 /**
3
  * This source is a part of sView program.
4
  *
5
- * Copyright © Kirill Gavrilov, 2011-2016
6
+ * Copyright © Kirill Gavrilov, 2011-2017
7
  */
8
 
9
 #ifndef __StCADViewerGUI_h_
10
@@ -54,8 +54,11 @@
11
                             StTranslations* theLangMap,
12
                             const StHandle<StPlayList>& thePlayList);
13
     ST_LOCAL virtual ~StCADViewerGUI();
14
-    ST_LOCAL virtual void stglUpdate(const StPointD_t& theCursorZo) ST_ATTR_OVERRIDE;
15
-    ST_LOCAL virtual void stglResize(const StGLBoxPx&  theRectPx) ST_ATTR_OVERRIDE;
16
+    ST_LOCAL virtual void stglUpdate(const StPointD_t& theCursorZo,
17
+                                     bool theIsPreciseInput) ST_ATTR_OVERRIDE;
18
+    ST_LOCAL virtual void stglResize(const StGLBoxPx&  theViewPort,
19
+                                     const StMarginsI& theMargins,
20
+                                     float theAspect) ST_ATTR_OVERRIDE;
21
     ST_LOCAL virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
22
 
23
     ST_LOCAL void setVisibility(const StPointD_t& theCursorZo, bool );
24
sview-17_04.tar.gz/StCADViewer/StGLMaterial.h Added
112
 
1
@@ -0,0 +1,110 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#ifndef __StGLMaterial_h_
9
+#define __StGLMaterial_h_
10
+
11
+#include "StAssetTexture.h"
12
+
13
+#include <StStrings/StString.h>
14
+#include <StGL/StGLVec.h>
15
+
16
+/**
17
+ * Material definition.
18
+ */
19
+class StGLMaterial : public Standard_Transient {
20
+
21
+    DEFINE_STANDARD_RTTI_INLINE(StGLMaterial, Standard_Transient)
22
+
23
+        public:
24
+
25
+    StGLVec4 DiffuseColor;
26
+    StGLVec4 AmbientColor;
27
+    StGLVec4 SpecularColor;
28
+    StGLVec4 EmissiveColor;
29
+    StGLVec4 Params;
30
+    Handle(StAssetTexture) Texture;
31
+    StString Name;
32
+
33
+        public:
34
+
35
+    float  Shine()        const { return Params.x(); }
36
+    float& ChangeShine()        { return Params.x(); }
37
+
38
+    float  Transparency() const { return Params.y(); }
39
+    float& ChangeTransparency() { return Params.y(); }
40
+
41
+    bool ToCullBackFaces() const { return Params.z() != 0.0f; }
42
+    void SetCullBackFaces(bool theToCull) { Params.z() = theToCull ? 1.0f : 0.0f; }
43
+
44
+    StGLMaterial()
45
+    : DiffuseColor (0.8f, 0.8f, 0.8f, 1.0f),
46
+      AmbientColor (0.1f, 0.1f, 0.1f, 1.0f),
47
+      SpecularColor(0.2f, 0.2f, 0.2f, 1.0f),
48
+      EmissiveColor(0.0f, 0.0f, 0.0f, 1.0f),
49
+      Params(0.039f, 0.0f, 0.0f, 0.0f) {}
50
+
51
+        public:
52
+
53
+    /**
54
+     * Check this vector with another material for equality.
55
+     */
56
+    bool isEqual(const StGLMaterial& theOther) const {
57
+        return DiffuseColor  == theOther.DiffuseColor
58
+            && AmbientColor  == theOther.AmbientColor
59
+            && SpecularColor == theOther.SpecularColor
60
+            && EmissiveColor == theOther.EmissiveColor
61
+            && Params        == theOther.Params
62
+            && StAssetTexture::IsEqual(Texture, theOther.Texture);
63
+    }
64
+
65
+    /**
66
+     * Check this vector with another vector for equality.
67
+     */
68
+    bool operator==(const StGLMaterial& theOther)       { return isEqual(theOther); }
69
+    bool operator==(const StGLMaterial& theOther) const { return isEqual(theOther); }
70
+
71
+    /**
72
+     * Check this vector with another vector for non-equality.
73
+     */
74
+    bool operator!=(const StGLMaterial& theOther)       { return !isEqual(theOther); }
75
+    bool operator!=(const StGLMaterial& theOther) const { return !isEqual(theOther); }
76
+
77
+        public:
78
+
79
+    /**
80
+     * Compute hash code for data map.
81
+     */
82
+    static int HashCode(const Handle(StGLMaterial)& theKey,
83
+                        const int theUpper) {
84
+        if(theKey.IsNull()) {
85
+            return 0;
86
+        }
87
+
88
+        int aHashCode = ::HashCode(::HashCodes((Standard_CString )theKey.get(), sizeof(StGLVec4) * 5), theUpper);
89
+        if(!theKey->Texture.IsNull()) {
90
+            aHashCode = aHashCode ^ ::HashCode(theKey->Texture->GetId(), theUpper);
91
+        }
92
+        return ::HashCode(aHashCode, theUpper);
93
+    }
94
+
95
+    /**
96
+     * Compare two materials
97
+     */
98
+    static bool IsEqual(const Handle(StGLMaterial)& theKey1,
99
+                        const Handle(StGLMaterial)& theKey2) {
100
+        if(theKey1 == theKey2) {
101
+            return true;
102
+        }
103
+
104
+        return !theKey1.IsNull()
105
+            && !theKey2.IsNull()
106
+            && theKey1->isEqual(*theKey2);
107
+    }
108
+
109
+};
110
+
111
+#endif // __StGLMaterial_h_
112
sview-17_04.tar.gz/StCADViewer/StImageOcct.cpp Added
66
 
1
@@ -0,0 +1,64 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#include "StImageOcct.h"
9
+
10
+StImageOcct::StImageOcct() {
11
+    //
12
+}
13
+
14
+StImageOcct::~StImageOcct() {
15
+    //
16
+}
17
+
18
+void StImageOcct::Clear() {
19
+    Image_PixMap::Clear();
20
+    myStImage.nullify();
21
+}
22
+
23
+bool StImageOcct::Load(const StString& theFileName,
24
+                       const StMIME& theMime,
25
+                       uint8_t* theDataPtr, int theDataSize) {
26
+    Clear();
27
+
28
+    const StImageFile::ImageType anImgType = StImageFile::guessImageType(theFileName, theMime);
29
+    StHandle<StImageFile> anStImage = StImageFile::create(StImageFile::ST_LIBAV, anImgType);
30
+    if(anStImage.isNull()) {
31
+        return false;
32
+    }
33
+
34
+    if(!anStImage->loadExtra(theFileName, anImgType, theDataPtr, theDataSize, true)) {
35
+        return false;
36
+    }
37
+
38
+    SetTopDown(true);
39
+    Image_PixMap::ImgFormat aFormat = Image_PixMap::ImgUNKNOWN;
40
+    switch(anStImage->getPlane().getFormat()) {
41
+        case StImagePlane::ImgBGR:   aFormat = Image_PixMap::ImgBGR;   break;
42
+        case StImagePlane::ImgBGR32: aFormat = Image_PixMap::ImgBGR32; break;
43
+        case StImagePlane::ImgRGB:   aFormat = Image_PixMap::ImgRGB;   break;
44
+        case StImagePlane::ImgRGB32: aFormat = Image_PixMap::ImgRGB32; break;
45
+        case StImagePlane::ImgBGRA:  aFormat = Image_PixMap::ImgBGRA;  break;
46
+        case StImagePlane::ImgRGBA:  aFormat = Image_PixMap::ImgRGBA;  break;
47
+        case StImagePlane::ImgBGRF:  aFormat = Image_PixMap::ImgBGRF;  break;
48
+        case StImagePlane::ImgRGBF:  aFormat = Image_PixMap::ImgRGBF;  break;
49
+        case StImagePlane::ImgBGRAF: aFormat = Image_PixMap::ImgBGRAF; break;
50
+        case StImagePlane::ImgRGBAF: aFormat = Image_PixMap::ImgRGBAF; break;
51
+        case StImagePlane::ImgGray:  aFormat = Image_PixMap::ImgGray;  break;
52
+        case StImagePlane::ImgGrayF: aFormat = Image_PixMap::ImgGrayF; break;
53
+        default: {
54
+            Clear();
55
+            return false;
56
+        }
57
+    }
58
+
59
+    if(!Image_PixMap::InitWrapper(aFormat, anStImage->changePlane().changeData(), anStImage->getSizeX(), anStImage->getSizeY(), anStImage->getPlane().getSizeRowBytes())) {
60
+        return false;
61
+    }
62
+
63
+    myStImage = anStImage;
64
+    return true;
65
+}
66
sview-17_04.tar.gz/StCADViewer/StImageOcct.h Added
67
 
1
@@ -0,0 +1,65 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#ifndef __StImageOcct_h_
9
+#define __StImageOcct_h_
10
+
11
+#include <StImage/StImageFile.h>
12
+
13
+#include <Image_PixMap.hxx>
14
+
15
+/**
16
+ * OCCT image wrapper over StImage.
17
+ */
18
+class StImageOcct : public Image_PixMap {
19
+
20
+    DEFINE_STANDARD_RTTI_INLINE(StImageOcct, Image_PixMap)
21
+
22
+        public:
23
+
24
+    /**
25
+     * Empty constructor.
26
+     */
27
+    ST_LOCAL StImageOcct();
28
+
29
+    /**
30
+     * Destructor.
31
+     */
32
+    ST_LOCAL virtual ~StImageOcct();
33
+
34
+    /**
35
+     * Clear the image.
36
+     */
37
+    ST_LOCAL virtual void Clear() Standard_OVERRIDE;
38
+
39
+    /**
40
+     * Initialize image plane with required dimensions.
41
+     * theSizeRowBytes - will be ignored by this class and required alignment will be used instead!
42
+     */
43
+    virtual bool InitTrash(ImgFormat           thePixelFormat,
44
+                           const Standard_Size theSizeX,
45
+                           const Standard_Size theSizeY,
46
+                           const Standard_Size theSizeRowBytes = 0) Standard_OVERRIDE {
47
+        (void )thePixelFormat;
48
+        (void )theSizeX;
49
+        (void )theSizeY;
50
+        (void )theSizeRowBytes;
51
+        Clear();
52
+        return false;
53
+    }
54
+
55
+    //! Load image from file.
56
+    ST_LOCAL bool Load(const StString& theFileName,
57
+                       const StMIME& theMime,
58
+                       uint8_t* theDataPtr = NULL, int theDataSize = 0);
59
+
60
+        private:
61
+
62
+    StHandle<StImageFile> myStImage;
63
+
64
+};
65
+
66
+#endif // __StImageOcct_h_
67
sview-17_04.tar.gz/StCADViewer/StPrimArray.h Added
79
 
1
@@ -0,0 +1,77 @@
2
+/**
3
+ * This source is a part of sView program.
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2016
6
+ */
7
+
8
+#ifndef __StPrimArray_h_
9
+#define __StPrimArray_h_
10
+
11
+#include "StGLMaterial.h"
12
+
13
+#include <gp_Trsf.hxx>
14
+
15
+#include <vector>
16
+
17
+/**
18
+ * Definition of primitive array within the document.
19
+ */
20
+class StPrimArray : public Standard_Transient {
21
+
22
+    DEFINE_STANDARD_RTTI_INLINE(StPrimArray, Standard_Transient)
23
+
24
+        public:
25
+
26
+    std::vector<StGLVec3> Positions;
27
+    std::vector<StGLVec3> Normals;
28
+    std::vector<StGLVec2> TexCoords0;
29
+    std::vector<GLuint>   Indices;
30
+    Handle(StGLMaterial)  Material;
31
+    gp_Trsf               Trsf;
32
+
33
+        public:
34
+
35
+    StPrimArray() {}
36
+
37
+        public:
38
+
39
+    /**
40
+     * Generate normals from triangles.
41
+     * Considers the normals are initialized by ZEROs.
42
+     */
43
+    void reconstructNormals() {
44
+        const size_t aNbNodes = Positions.size();
45
+        if(Normals.size() != Positions.size()) {
46
+            Normals.resize(aNbNodes);
47
+        }
48
+
49
+        const size_t aNbTris = Indices.size() / 3;
50
+        int anElem[3] = {0, 0, 0};
51
+        for(size_t aTriIter = 0; aTriIter < aNbTris; ++aTriIter) {
52
+            anElem[0] = Indices[aTriIter * 3 + 0];
53
+            anElem[1] = Indices[aTriIter * 3 + 1];
54
+            anElem[2] = Indices[aTriIter * 3 + 2];
55
+            const StGLVec3& aNode0 = Positions[anElem[0]];
56
+            const StGLVec3& aNode1 = Positions[anElem[1]];
57
+            const StGLVec3& aNode2 = Positions[anElem[2]];
58
+
59
+            const StGLVec3 aVec01 = aNode1 - aNode0;
60
+            const StGLVec3 aVec02 = aNode2 - aNode0;
61
+            const StGLVec3 aTriNorm = StGLVec3::cross(aVec01, aVec02);
62
+            for(int aNodeIter = 0; aNodeIter < 3; ++aNodeIter) {
63
+                const int aNodeIndex = anElem[aNodeIter];
64
+                StGLVec3& aNorm = Normals[aNodeIndex];
65
+                aNorm += aTriNorm;
66
+            }
67
+        }
68
+
69
+        // normalize
70
+        for(int aNodeIter = 0; aNodeIter < aNbNodes; ++aNodeIter) {
71
+            StGLVec3& aNorm = Normals[aNodeIter];
72
+            aNorm.normalize();
73
+        }
74
+    }
75
+
76
+};
77
+
78
+#endif // __StPrimArray_h_
79
sview-16_06.tar.gz/StCADViewer/main.cpp -> sview-17_04.tar.gz/StCADViewer/main.cpp Changed
120
 
1
@@ -4,6 +4,29 @@
2
  * Copyright © Kirill Gavrilov, 2016
3
  */
4
 
5
+namespace
6
+{
7
+  /**
8
+   * The list of OCCT environment variable to be reset.
9
+   */
10
+  const char* THE_OCCT_ENV_DEF[] =
11
+  {
12
+    "CSF_ShadersDirectory",
13
+    "CSF_SHMessage",
14
+    "CSF_XSMessage",
15
+    "CSF_StandardDefaults",
16
+    "CSF_PluginDefaults",
17
+    "CSF_XCAFDefaults",
18
+    "CSF_TObjDefaults",
19
+    "CSF_StandardLiteDefaults",
20
+    "CSF_IGESDefaults",
21
+    "CSF_STEPDefaults",
22
+    "CSF_XmlOcafResource",
23
+    "CSF_MIGRATION_TYPES",
24
+    0
25
+  };
26
+}
27
+
28
 #if defined(__APPLE__)
29
     //
30
 #elif defined(__ANDROID__)
31
@@ -29,34 +52,6 @@
32
     : StAndroidGlue(theActivity, theSavedState, theSavedStateSize) {}
33
 
34
     /**
35
-     * Copy OCCT resource file.
36
-     */
37
-    ST_LOCAL bool copyResource(const StHandle<StResourceManager>& theResMgr,
38
-                               const StString& theResFolder,
39
-                               const StString& theDestFolder,
40
-                               const StString& theFileName) {
41
-        StString aFileResPath = theResFolder + SYS_FS_SPLITTER + theFileName;
42
-        StHandle<StResource> aRes = theResMgr->getResource(aFileResPath);
43
-        if( aRes.isNull()
44
-        || !aRes->read()) {
45
-            ST_ERROR_LOG(StString("Can not read resource file ") + aFileResPath);
46
-            return false;
47
-        }
48
-
49
-        StRawFile aFileOut;
50
-        StString  aFileOutPath = theDestFolder + SYS_FS_SPLITTER + theFileName;
51
-        if(!aFileOut.openFile(StRawFile::WRITE, aFileOutPath)) {
52
-            ST_ERROR_LOG(StString("Can not create resource file ") + aFileOutPath);
53
-            return false;
54
-        }
55
-        if(!aFileOut.write((const char* )aRes->getData(), aRes->getSize()) != aRes->getSize()) {
56
-            ST_ERROR_LOG(StString("Can not write resource file ") + aFileOutPath);
57
-            return false;
58
-        }
59
-        return true;
60
-    }
61
-
62
-    /**
63
      * Instantiate StApplication.
64
      */
65
     ST_LOCAL virtual void createApplication() override {
66
@@ -78,32 +73,10 @@
67
         aResMgr->setFolder(StResourceManager::FolderId_Photos,
68
                            getStoragePath(myThJniEnv, "DCIM"));
69
 
70
-        StString anOcctResFolder = aResMgr->getUserDataFolder();
71
-        copyResource(aResMgr, "lang", anOcctResFolder, "IGES.us");
72
-        copyResource(aResMgr, "lang", anOcctResFolder, "IGES.fr");
73
-        copyResource(aResMgr, "lang", anOcctResFolder, "SHAPE.us");
74
-        copyResource(aResMgr, "lang", anOcctResFolder, "SHAPE.fr");
75
-        copyResource(aResMgr, "lang", anOcctResFolder, "XSTEP.us");
76
-        copyResource(aResMgr, "lang", anOcctResFolder, "XSTEP.fr");
77
-        copyResource(aResMgr, "lang", anOcctResFolder, "TObj.msg");
78
-
79
-        copyResource(aResMgr, "res",  anOcctResFolder, "Units.dat");
80
-        copyResource(aResMgr, "res",  anOcctResFolder, "Lexi_Expr.dat");
81
-        copyResource(aResMgr, "res",  anOcctResFolder, "IGES");
82
-        copyResource(aResMgr, "res",  anOcctResFolder, "STEP");
83
-        //copyResource(aResMgr, "res",  anOcctResFolder, "TObj");
84
-        //copyResource(aResMgr, "res",  anOcctResFolder, "XCAF");
85
-        //copyResource(aResMgr, "res",  anOcctResFolder, "Plugin");
86
-        //copyResource(aResMgr, "res",  anOcctResFolder, "Standard");
87
-        //copyResource(aResMgr, "res",  anOcctResFolder, "StandardLite");
88
-
89
-        copyResource(aResMgr, "shaders/occt", anOcctResFolder, "Declarations.glsl");
90
-        copyResource(aResMgr, "shaders/occt", anOcctResFolder, "DeclarationsImpl.glsl");
91
-
92
-        StProcess::setEnv("CSF_UnitsLexicon",     anOcctResFolder + "/Lexi_Expr.dat");
93
-        StProcess::setEnv("CSF_UnitsDefinition",  anOcctResFolder + "/Units.dat");
94
-        StProcess::setEnv("CSF_ShadersDirectory", anOcctResFolder);
95
-        StProcess::setEnv("CSF_SHMessage",        anOcctResFolder);
96
+        // force using embedded OCCT resources
97
+        for(const char** anEnvIter = THE_OCCT_ENV_DEF; *anEnvIter != NULL; ++anEnvIter) {
98
+            StProcess::setEnv(*anEnvIter, "");
99
+        }
100
 
101
         if(myStAppClass.isEmpty()) {
102
             myStAppClass = "cad";
103
@@ -184,12 +157,10 @@
104
         StProcess::setEnv("StShare", aProcessUpPath);
105
     }
106
 
107
-    StString aResDir = StProcess::getStShareFolder();
108
-    StProcess::setEnv("CSF_UnitsLexicon",          aResDir + "UnitsAPI" ST_FILE_SPLITTER "Lexi_Expr.dat");
109
-    StProcess::setEnv("CSF_UnitsDefinition",       aResDir + "UnitsAPI" ST_FILE_SPLITTER "Units.dat");
110
-    StProcess::setEnv("CSF_ShadersDirectory",      aResDir + "shaders" ST_FILE_SPLITTER "StCADViewer");
111
-    StProcess::setEnv("CSF_SHMessage",             aResDir + "lang");
112
-    StProcess::setEnv("CSF_MDTVTexturesDirectory", aResDir + "textures");
113
+    // force using embedded OCCT resources
114
+    for(const char** anEnvIter = THE_OCCT_ENV_DEF; *anEnvIter != NULL; ++anEnvIter) {
115
+        StProcess::setEnv(*anEnvIter, "");
116
+    }
117
 
118
     StHandle<StOpenInfo> anInfo;
119
     if(anInfo.isNull()
120
sview-16_06.tar.gz/StCore/StAndroidGlue.cpp -> sview-17_04.tar.gz/StCore/StAndroidGlue.cpp Changed
78
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StCore, window system independent C++ toolkit for writing OpenGL applications.
4
- * Copyright © 2014-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2014-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -184,6 +184,9 @@
10
   myHasOrientSensor(false),
11
   myIsPoorOrient(false),
12
   myToTrackOrient(false),
13
+  myToHideStatusBar(true),
14
+  myToHideNavBar(true),
15
+  myToSwapEyesHW(false),
16
   myIsRunning(false),
17
   myIsStateSaved(false),
18
   myToDestroy(false) {
19
@@ -291,9 +294,11 @@
20
 }
21
 
22
 void StAndroidGlue::fetchState(StString&             theNewFile,
23
-                               StQuaternion<double>& theQuaternion) {
24
+                               StQuaternion<double>& theQuaternion,
25
+                               bool&                 theToSwapEyes) {
26
     StMutexAuto aLock(myFetchLock);
27
     theQuaternion = myQuaternion;
28
+    theToSwapEyes = myToSwapEyesHW;
29
     if(!myDndPath.isEmpty()) {
30
         theNewFile = myDndPath;
31
         myDndPath.clear();
32
@@ -855,6 +860,23 @@
33
     myToTrackOrient = theToTrack;
34
 }
35
 
36
+void StAndroidGlue::setHideSystemBars(bool theToHideStatusBar,
37
+                                      bool theToHideNavBar) {
38
+    if((myToHideStatusBar == theToHideStatusBar && myToHideNavBar == theToHideNavBar)
39
+    || myActivity == NULL
40
+    || myThJniEnv == NULL) {
41
+        return;
42
+    }
43
+
44
+    jclass    aJClassActivity = myThJniEnv->GetObjectClass(myActivity->clazz);
45
+    jmethodID aJMet           = myThJniEnv->GetMethodID(aJClassActivity, "setHideSystemBars", "(ZZ)V");
46
+    myThJniEnv->CallVoidMethod(myActivity->clazz, aJMet,
47
+                               (jboolean )(theToHideStatusBar ? JNI_TRUE : JNI_FALSE),
48
+                               (jboolean )(theToHideNavBar    ? JNI_TRUE : JNI_FALSE));
49
+    myToHideStatusBar = theToHideStatusBar;
50
+    myToHideNavBar    = theToHideNavBar;
51
+}
52
+
53
 void StAndroidGlue::setQuaternion(const StQuaternion<float>& theQ, const float theScreenRotDeg) {
54
     // do the magic - convert quaternion from Android coordinate system to sView coordinate system
55
     const StQuaternion<double> anOriPitch = StQuaternion<double>(StVec3<double>::DX(), stToRadians(90.0));
56
@@ -878,6 +900,11 @@
57
     myQuaternion = anOri;
58
 }
59
 
60
+void StAndroidGlue::setSwapEyes(bool theToSwapLR) {
61
+    StMutexAuto aLock(myFetchLock);
62
+    myToSwapEyesHW = theToSwapLR;
63
+}
64
+
65
 jexp void JNICALL Java_com_sview_StActivity_cppSetOpenPath(JNIEnv* theEnv, jobject theObj, jlong theCppPtr,
66
                                                            jstring theOpenPath, jstring theMimeType, jboolean theIsLaunchedFromHistory) {
67
     ((StAndroidGlue* )theCppPtr)->setOpenPath(theOpenPath, theMimeType, theIsLaunchedFromHistory);
68
@@ -908,4 +935,9 @@
69
     ((StAndroidGlue* )theCppPtr)->setOrientation(theAzimuthDeg, thePitchDeg, theRollDeg, theScreenRotDeg);
70
 }
71
 
72
+jexp void JNICALL Java_com_sview_StActivity_cppSetSwapEyes(JNIEnv* theEnv, jobject theObj, jlong theCppPtr,
73
+                                                           jboolean theToSwap) {
74
+    ((StAndroidGlue* )theCppPtr)->setSwapEyes(theToSwap == JNI_TRUE);
75
+}
76
+
77
 #endif // __ANDROID__
78
sview-16_06.tar.gz/StCore/StApplication.cpp -> sview-17_04.tar.gz/StCore/StApplication.cpp Changed
21
 
1
@@ -499,6 +499,7 @@
2
     const StString ARGUMENT_FILE              = "file";
3
     const StString ARGUMENT_LEFT_VIEW         = "left";
4
     const StString ARGUMENT_RIGHT_VIEW        = "right";
5
+    const StString ARGUMENT_DEMO              = "demo";
6
     // parse extra parameters
7
     for(size_t aParamIter = 1; aParamIter < anArguments.size(); ++aParamIter) {
8
         StString aParam = anArguments[aParamIter];
9
@@ -531,6 +532,11 @@
10
                 if(!anInfo->hasPath()) {
11
                     anInfo->setPath(anArg.getValue());
12
                 }
13
+            } else if(anArg.getKey().isEqualsIgnoreCase(ARGUMENT_DEMO)) {
14
+                StString aFilePath = StProcess::getAbsolutePath(anArg.getValue());
15
+                anArg.setValue(aFilePath);
16
+                anInfo->setPath(aFilePath);
17
+                anOpenFileArgs.add(anArg);
18
             } else {
19
                 // pass argument unchanged
20
                 anOpenFileArgs.add(anArg);
21
sview-16_06.tar.gz/StCore/StCore.rc -> sview-17_04.tar.gz/StCore/StCore.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "sView core library\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2007-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2007-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StCore\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StCore/StWinHandles.ObjC.mm -> sview-17_04.tar.gz/StCore/StWinHandles.ObjC.mm Changed
9
 
1
@@ -41,6 +41,7 @@
2
 int StWinHandles::glCreateContext(StWinHandles*    theSlave,
3
                                   const StRectI_t& theRect,
4
                                   const int        theDepthSize,
5
+                                  const int        theStencilSize,
6
                                   const bool       theIsQuadStereo,
7
                                   const bool       theDebugCtx) {
8
     return STWIN_INIT_SUCCESS;
9
sview-16_06.tar.gz/StCore/StWinHandles.cpp -> sview-17_04.tar.gz/StCore/StWinHandles.cpp Changed
201
 
1
@@ -21,7 +21,8 @@
2
 
3
 StWinGlrc::StWinGlrc(EGLDisplay theDisplay,
4
                      const bool theDebugCtx,
5
-                     int8_t     theGlDepthSize)
6
+                     int8_t     theGlDepthSize,
7
+                     int8_t     theGlStencilSize)
8
 : myDisplay(theDisplay),
9
   myConfig(NULL),
10
   myRC(EGL_NO_CONTEXT) {
11
@@ -41,12 +42,13 @@
12
                + "  Client APIs: " + eglQueryString(myDisplay, EGL_CLIENT_APIS) + "\n"
13
                + "  Extensions:  " + eglQueryString(myDisplay, EGL_EXTENSIONS));
14
 
15
-    const EGLint aConfigAttribs[] = {
16
+    EGLint aConfigAttribs[] = {
17
         EGL_RED_SIZE,   8,
18
         EGL_GREEN_SIZE, 8,
19
         EGL_BLUE_SIZE,  8,
20
         EGL_ALPHA_SIZE, 0,
21
-        EGL_DEPTH_SIZE, theGlDepthSize,
22
+        EGL_DEPTH_SIZE,   theGlDepthSize,
23
+        EGL_STENCIL_SIZE, theGlStencilSize,
24
     #if defined(GL_ES_VERSION_2_0)
25
         EGL_CONFORMANT,      EGL_OPENGL_ES2_BIT,
26
         EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
27
@@ -58,9 +60,21 @@
28
     };
29
 
30
     EGLint aNbConfigs = 0;
31
-    if(eglChooseConfig(myDisplay, aConfigAttribs, &myConfig, 1, &aNbConfigs) != EGL_TRUE) {
32
-        ST_ERROR_LOG("EGL, eglChooseConfig FAILED");
33
-        return;
34
+    if(eglChooseConfig(myDisplay, aConfigAttribs, &myConfig, 1, &aNbConfigs) != EGL_TRUE
35
+    || myConfig == NULL) {
36
+        if(theGlDepthSize <= 16) {
37
+            ST_ERROR_LOG("EGL, eglChooseConfig FAILED");
38
+            return;
39
+        }
40
+
41
+        eglGetError();
42
+        aConfigAttribs[4 * 2 + 1] = 16; // try config with smaller depth buffer
43
+        aConfigAttribs[5 * 2 + 1] = 0;
44
+        if(eglChooseConfig(myDisplay, aConfigAttribs, &myConfig, 1, &aNbConfigs) != EGL_TRUE
45
+        || myConfig == NULL) {
46
+            ST_ERROR_LOG("EGL, eglChooseConfig FAILED");
47
+            return;
48
+        }
49
     }
50
 
51
     /*EGLenum aEglApi = eglQueryAPI();
52
@@ -359,8 +373,10 @@
53
 int StWinHandles::glCreateContext(StWinHandles*    theSlave,
54
                                   const StRectI_t& theRect,
55
                                   const int        theDepthSize,
56
+                                  const int        theStencilSize,
57
                                   const bool       theIsQuadStereo,
58
                                   const bool       theDebugCtx) {
59
+    (void )theRect;
60
 #ifdef _WIN32
61
     ThreadGL = StThread::getCurrentThreadId();
62
     ST_DEBUG_LOG("WinAPI, glCreateContext, ThreadGL= " + ThreadGL + ", ThreadWnd= " + ThreadWnd);
63
@@ -374,97 +390,113 @@
64
                           "WinAPI, Can't create Slave GL Device Context");
65
     }
66
 
67
-    PIXELFORMATDESCRIPTOR aPixFrmtDesc = THE_PIXELFRMT_DOUBLE;
68
-    aPixFrmtDesc.cDepthBits = (BYTE )theDepthSize;
69
-    if(theIsQuadStereo) {
70
-        aPixFrmtDesc.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL
71
-                             | PFD_DOUBLEBUFFER | PFD_STEREO;
72
-    }
73
-    int aPixFrmtId = ChoosePixelFormat(hDC, &aPixFrmtDesc);
74
-    ST_GL_ERROR_CHECK(aPixFrmtId != 0, STWIN_ERROR_WIN32_PIXELFORMATF,
75
-                      "WinAPI, Can't find a suitable PixelFormat for Master");
76
-    if(theSlave != NULL
77
-    && ChoosePixelFormat(theSlave->hDC, &aPixFrmtDesc) != aPixFrmtId) {
78
-        ST_ERROR_LOG("Slave window returns another pixel format! Try to ignore...");
79
-    }
80
-
81
-    if(theIsQuadStereo) {
82
-        DescribePixelFormat(hDC, aPixFrmtId, sizeof(PIXELFORMATDESCRIPTOR), &aPixFrmtDesc);
83
-        if((aPixFrmtDesc.dwFlags & PFD_STEREO) == 0) {
84
-            ST_ERROR_LOG("WinAPI, Quad Buffered stereo not supported");
85
-        } else {
86
-            //bool isVistaPlus = StSys::isVistaPlus();
87
-            //bool isWin8Plus  = StSys::isWin8Plus();
88
-            ///myNeedsFullscr
89
-        }
90
-    }
91
-
92
-    HMODULE aModule = GetModuleHandleW(NULL);
93
-    hWinTmp = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE | WS_EX_NOACTIVATE,
94
-                              ClassTmp.toCString(), L"TmpWnd",
95
-                              WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_DISABLED,
96
-                              theRect.left() + 2, theRect.top() + 2, 4, 4,
97
-                              NULL, NULL, aModule, NULL);
98
-    ST_GL_ERROR_CHECK(hWinTmp != NULL, STWIN_ERROR_WIN32_GLDC,
99
-                      "WinAPI, Temporary window creation error");
100
-
101
-    HDC aDevCtxTmp = GetDC(hWinTmp);
102
-    ST_GL_ERROR_CHECK(aPixFrmtId != 0, STWIN_ERROR_WIN32_PIXELFORMATF,
103
-                      "WinAPI, Can't find a suitable PixelFormat for Tmp");
104
-
105
-    ST_GL_ERROR_CHECK(SetPixelFormat(aDevCtxTmp, aPixFrmtId, &aPixFrmtDesc),
106
-                      STWIN_ERROR_WIN32_PIXELFORMATS, "WinAPI, Can't set the PixelFormat for Master");
107
-    StWinGlrcH aRendCtxTmp = new StWinGlrc(aDevCtxTmp, NULL);
108
-    ST_GL_ERROR_CHECK(aRendCtxTmp->isValid(),
109
-                      STWIN_ERROR_WIN32_GLRC_CREATE, "WinAPI, Can't create GL Rendering Context");
110
-    ST_GL_ERROR_CHECK(aRendCtxTmp->makeCurrent(aDevCtxTmp),
111
-                      STWIN_ERROR_WIN32_GLRC_ACTIVATE, "WinAPI, Can't activate Tmp GL Rendering Context");
112
-
113
-    StGLContext aCtx(false);
114
-    ST_GL_ERROR_CHECK(aCtx.stglInit(),
115
-                      STWIN_ERROR_WIN32_GLRC_ACTIVATE, "WinAPI, Broken Tmp GL Rendering Context");
116
-
117
-    if(aCtx.extAll->wglChoosePixelFormatARB != NULL) {
118
-        const int aPixAttribs[] = {
119
-            WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
120
-            WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
121
-            WGL_DOUBLE_BUFFER_ARB,  GL_TRUE,
122
-            WGL_STEREO_ARB,         theIsQuadStereo ? GL_TRUE : GL_FALSE,
123
-            WGL_PIXEL_TYPE_ARB,     WGL_TYPE_RGBA_ARB,
124
-            //WGL_SAMPLE_BUFFERS_ARB, 1,
125
-            //WGL_SAMPLES_ARB,        8,
126
-            // WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB       0x00000004
127
-            WGL_COLOR_BITS_ARB,     24,
128
-            WGL_DEPTH_BITS_ARB,     theDepthSize,
129
-            WGL_STENCIL_BITS_ARB,   0,
130
-            0, 0,
131
-        };
132
-        unsigned int aFrmtsNb = 0;
133
-        aCtx.extAll->wglChoosePixelFormatARB(hDC, aPixAttribs, NULL, 1, &aPixFrmtId, &aFrmtsNb);
134
-    }
135
-    ST_GL_ERROR_CHECK(SetPixelFormat(hDC, aPixFrmtId, &aPixFrmtDesc),
136
-                      STWIN_ERROR_WIN32_PIXELFORMATS, "WinAPI, Can't set the PixelFormat for Master");
137
-    ST_GL_ERROR_CHECK(theSlave == NULL || SetPixelFormat(theSlave->hDC, aPixFrmtId, &aPixFrmtDesc),
138
-                      STWIN_ERROR_WIN32_PIXELFORMATS, "WinAPI, Can't set the PixelFormat for Slave");
139
-
140
     HGLRC aRendCtx = NULL;
141
-    if(aCtx.extAll->wglCreateContextAttribsARB != NULL) {
142
-        // Beware! NVIDIA drivers reject context creation when WGL_CONTEXT_PROFILE_MASK_ARB are specified
143
-        // but not WGL_CONTEXT_MAJOR_VERSION_ARB/WGL_CONTEXT_MINOR_VERSION_ARB
144
-        int aCtxAttribs[] = {
145
-            //WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
146
-            //WGL_CONTEXT_MINOR_VERSION_ARB, 2,
147
-            //WGL_CONTEXT_PROFILE_MASK_ARB,  WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, //WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
148
-            WGL_CONTEXT_FLAGS_ARB,         theDebugCtx ? WGL_CONTEXT_DEBUG_BIT_ARB : 0,
149
-            0, 0
150
-        };
151
-
152
-        aRendCtx = aCtx.extAll->wglCreateContextAttribsARB(hDC, NULL, aCtxAttribs);
153
+    {
154
+      PIXELFORMATDESCRIPTOR aPixFrmtDesc = THE_PIXELFRMT_DOUBLE;
155
+      aPixFrmtDesc.cDepthBits   = (BYTE )theDepthSize;
156
+      aPixFrmtDesc.cStencilBits = (BYTE )theStencilSize;
157
+      if(theIsQuadStereo) {
158
+          aPixFrmtDesc.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL
159
+                               | PFD_DOUBLEBUFFER | PFD_STEREO;
160
+      }
161
+
162
+      HMODULE aModule = GetModuleHandleW(NULL);
163
+      hWinTmp = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE | WS_EX_NOACTIVATE,
164
+                                ClassTmp.toCString(), L"TmpWnd",
165
+                                WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_DISABLED,
166
+                                // always create temporary window on main screen
167
+                                // to workaround sporadic bugs (access violation) in AMD Catalyst drivers
168
+                                2, 2, 4, 4, //theRect.left() + 2, theRect.top() + 2, 4, 4,
169
+                                NULL, NULL, aModule, NULL);
170
+      ST_GL_ERROR_CHECK(hWinTmp != NULL, STWIN_ERROR_WIN32_GLDC,
171
+                        "WinAPI, Temporary window creation error");
172
+
173
+      HDC aDevCtxTmp = GetDC(hWinTmp);
174
+      int aPixFrmtIdTmp = ChoosePixelFormat(aDevCtxTmp, &aPixFrmtDesc);
175
+      ST_GL_ERROR_CHECK(aPixFrmtIdTmp != 0, STWIN_ERROR_WIN32_PIXELFORMATF,
176
+                        "WinAPI, Can't find a suitable PixelFormat for Tmp");
177
+
178
+      ST_GL_ERROR_CHECK(SetPixelFormat(aDevCtxTmp, aPixFrmtIdTmp, &aPixFrmtDesc),
179
+                        STWIN_ERROR_WIN32_PIXELFORMATS, "WinAPI, Can't set the PixelFormat for Master");
180
+      StWinGlrcH aRendCtxTmp = new StWinGlrc(aDevCtxTmp, NULL);
181
+      ST_GL_ERROR_CHECK(aRendCtxTmp->isValid(),
182
+                        STWIN_ERROR_WIN32_GLRC_CREATE, "WinAPI, Can't create GL Rendering Context");
183
+      ST_GL_ERROR_CHECK(aRendCtxTmp->makeCurrent(aDevCtxTmp),
184
+                        STWIN_ERROR_WIN32_GLRC_ACTIVATE, "WinAPI, Can't activate Tmp GL Rendering Context");
185
+
186
+      StGLContext aCtx(false);
187
+      ST_GL_ERROR_CHECK(aCtx.stglInit(),
188
+                        STWIN_ERROR_WIN32_GLRC_ACTIVATE, "WinAPI, Broken Tmp GL Rendering Context");
189
+
190
+      int aPixFrmtId = 0;
191
+      if(aCtx.extAll->wglChoosePixelFormatARB != NULL) {
192
+          for(bool toTryQuadBuffer = theIsQuadStereo;;) {
193
+              const int aPixAttribs[] = {
194
+                  WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
195
+                  WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
196
+                  WGL_DOUBLE_BUFFER_ARB,  GL_TRUE,
197
+                  WGL_STEREO_ARB,         toTryQuadBuffer ? GL_TRUE : GL_FALSE,
198
+                  WGL_PIXEL_TYPE_ARB,     WGL_TYPE_RGBA_ARB,
199
+                  //WGL_SAMPLE_BUFFERS_ARB, 1,
200
+                  //WGL_SAMPLES_ARB,        8,
201
sview-16_06.tar.gz/StCore/StWinHandles.h -> sview-17_04.tar.gz/StCore/StWinHandles.h Changed
19
 
1
@@ -46,7 +46,8 @@
2
 #if defined(ST_HAVE_EGL) || defined(__ANDROID__)
3
     ST_LOCAL StWinGlrc(EGLDisplay theDisplay,
4
                        const bool theDebugCtx,
5
-                       int8_t     theGlDepthSize);
6
+                       int8_t     theGlDepthSize,
7
+                       int8_t     theGlStencilSize);
8
 #elif defined(_WIN32)
9
     ST_LOCAL StWinGlrc(HDC theDC, HGLRC theRC);
10
 #else
11
@@ -161,6 +162,7 @@
12
     ST_LOCAL int glCreateContext(StWinHandles*    theSlave,
13
                                  const StRectI_t& theRect,
14
                                  const int        theDepthSize,
15
+                                 const int        theStencilSize,
16
                                  const bool       theIsQuadStereo,
17
                                  const bool       theDebugCtx);
18
 
19
sview-16_06.tar.gz/StCore/StWindow.cpp -> sview-17_04.tar.gz/StCore/StWindow.cpp Changed
82
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StCore, window system independent C++ toolkit for writing OpenGL applications.
4
- * Copyright © 2007-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -120,6 +120,10 @@
10
     //
11
 }
12
 
13
+bool StWindow::isStereoFullscreenOnly() const {
14
+    return false;
15
+}
16
+
17
 bool StWindow::isStereoOutput() const {
18
     return myIsForcedStereo || myWin->isStereoOutput();
19
 }
20
@@ -205,14 +209,18 @@
21
     myWin->setPlacement(theRect, theMoveToScreen);
22
 }
23
 
24
-const StMarginsI& StWindow::getMargins() const {
25
-    return myMargins;
26
+StMarginsI StWindow::getMargins() const {
27
+    return StMarginsI();
28
 }
29
 
30
 StPointD_t StWindow::getMousePos() const {
31
     return myWin->getMousePos();
32
 }
33
 
34
+bool StWindow::isPreciseCursor() const {
35
+    return myWin->isPreciseCursor();
36
+}
37
+
38
 bool StWindow::create() {
39
     myWasUsed = true;
40
     return myWin->create();
41
@@ -339,6 +347,19 @@
42
     return aRect;
43
 }
44
 
45
+double StWindow::stglAspectRatio() const {
46
+    if(myWin->myForcedAspect > 0.0) {
47
+        return myWin->myForcedAspect;
48
+    }
49
+
50
+    const StGLBoxPx aVPMaster = StWindow::stglViewport(ST_WIN_MASTER);
51
+    return double(aVPMaster.width() != 0 ? aVPMaster.width() : 1) / double(aVPMaster.height() != 0 ? aVPMaster.height() : 1);
52
+}
53
+
54
+void StWindow::setForcedAspect(double theAspect) {
55
+    myWin->myForcedAspect = theAspect;
56
+}
57
+
58
 void* StWindow::getNativeOglWin() const {
59
 #ifdef _WIN32
60
     return (void* )myWin->myMaster.hWindowGl;
61
@@ -398,6 +419,12 @@
62
     }
63
 }
64
 
65
+void StWindow::setHideSystemBars(bool theToHideStatusBar,
66
+                                 bool theToHideNavBar) {
67
+    myWin->myToHideStatusBar = theToHideStatusBar;
68
+    myWin->myToHideNavBar    = theToHideNavBar;
69
+}
70
+
71
 StQuaternion<double> StWindow::getDeviceOrientation() const {
72
     if(myWin->myToTrackOrient
73
     && myWin->myHasOrientSensor) {
74
@@ -405,3 +432,7 @@
75
     }
76
     return StQuaternion<double>();
77
 }
78
+
79
+bool StWindow::toSwapEyesHW() const {
80
+    return myWin->myToSwapEyesHW;
81
+}
82
sview-16_06.tar.gz/StCore/StWindowImpl.cpp -> sview-17_04.tar.gz/StCore/StWindowImpl.cpp Changed
201
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StCore, window system independent C++ toolkit for writing OpenGL applications.
4
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -51,7 +51,11 @@
10
   myHasOrientSensor(false),
11
   myIsPoorOrient(false),
12
   myToTrackOrient(false),
13
+  myToHideStatusBar(true),
14
+  myToHideNavBar(true),
15
+  myToSwapEyesHW(false),
16
   myMousePt(0.5, 0.5),
17
+  myIsPreciseCursor(true),
18
   myNbTouchesMax(0),
19
   myRectNorm(128, 512, 128, 512),
20
   myRectFull(128, 512, 128, 512),
21
@@ -61,6 +65,7 @@
22
   myWinOnMonitorId(0),
23
   myWinMonScaleId(0),
24
   myTiledCfg(TiledCfg_Separate),
25
+  myForcedAspect(-1.0),
26
 #ifdef _WIN32
27
   myRegisterTouchWindow(NULL),
28
   myUnregisterTouchWindow(NULL),
29
@@ -73,7 +78,6 @@
30
   myEventQuit(false),
31
   myEventCursorShow(false),
32
   myEventCursorHide(false),
33
-  myIsVistaPlus(StSys::isVistaPlus()),
34
 #elif (defined(__APPLE__))
35
   mySleepAssert(0),
36
 #endif
37
@@ -84,6 +88,10 @@
38
   myBlockSleep(BlockSleep_OFF),
39
   myIsSystemLocked(false),
40
   myIsDispChanged(false),
41
+  myAlignDL(0),
42
+  myAlignDR(0),
43
+  myAlignDT(0),
44
+  myAlignDB(0),
45
   myLastEventsTime(0.0),
46
   myEventsThreaded(false),
47
   myIsMouseMoved(false) {
48
@@ -94,6 +102,7 @@
49
     attribs.IsGlStereo     = false;
50
     attribs.IsGlDebug      = false;
51
     attribs.GlDepthSize    = 16;
52
+    attribs.GlStencilSize  = 0;
53
 #if defined(__ANDROID__)
54
     attribs.IsFullScreen   = true;
55
 #else
56
@@ -128,15 +137,6 @@
57
 #ifdef _WIN32
58
     myEventsThreaded = true; // events loop is always performed in dedicated thread
59
 
60
-    HMODULE aUser32Module = GetModuleHandleW(L"User32");
61
-    if(aUser32Module != NULL) {
62
-        // User32 should be already loaded
63
-        myRegisterTouchWindow   = (RegisterTouchWindow_t   )GetProcAddress(aUser32Module, "RegisterTouchWindow");
64
-        myUnregisterTouchWindow = (UnregisterTouchWindow_t )GetProcAddress(aUser32Module, "UnregisterTouchWindow");
65
-        myGetTouchInputInfo     = (GetTouchInputInfo_t     )GetProcAddress(aUser32Module, "GetTouchInputInfo");
66
-        myCloseTouchInputHandle = (CloseTouchInputHandle_t )GetProcAddress(aUser32Module, "CloseTouchInputHandle");
67
-    }
68
-
69
     // Adjust system timer
70
     // By default Windows2K+ timer has ugly precision
71
     // Thus - Sleep(1) may be long 14ms!
72
@@ -164,19 +164,13 @@
73
 
74
 void StWindowImpl::StSyncTimer::initUpTime() {
75
 #if defined(_WIN32)
76
-    myGetTick64 = NULL;
77
-    if(StSys::isVistaPlus()) {
78
-        HMODULE aKern32 = GetModuleHandleW(L"kernel32");
79
-        myGetTick64 = (GetTickCount64_t )GetProcAddress(aKern32, "GetTickCount64");
80
-    }
81
-
82
     // Spin waiting for a change in system time (should take up to 15 ms on modern systems).
83
     // Alternatively timeGetTime() might be used instead which handle time in 1 ms precision
84
     // when used in combination with timeBeginPeriod(1).
85
-    const uint64_t anUptime0 = (myGetTick64 != NULL) ? myGetTick64() : (uint64_t )GetTickCount();
86
+    const uint64_t anUptime0 = GetTickCount64();
87
     uint64_t anUptime1 = 0;
88
     do {
89
-        anUptime1 = (myGetTick64 != NULL) ? myGetTick64() : (uint64_t )GetTickCount();
90
+        anUptime1 = GetTickCount64();
91
         fillCounter(myCounterStart);
92
     } while(anUptime0 == anUptime1);
93
     myTimeInMicroSec = anUptime1 * 1000.0; // convert to microseconds
94
@@ -195,11 +189,11 @@
95
 void StWindowImpl::StSyncTimer::resyncUpTime() {
96
 #if defined(_WIN32)
97
     // spin waiting for a change in system time (should take up to 15 ms on modern systems)
98
-    const uint64_t anUptime0 = (myGetTick64 != NULL) ? myGetTick64() : (uint64_t )GetTickCount();
99
+    const uint64_t anUptime0 = GetTickCount64();
100
     uint64_t anUptime1 = 0;
101
     double aTimerValue = 0.0;
102
     do {
103
-        anUptime1   = (myGetTick64 != NULL) ? myGetTick64() : (uint64_t )GetTickCount();
104
+        anUptime1   = GetTickCount64();
105
         aTimerValue = getElapsedTimeInMicroSec();
106
     } while(anUptime0 == anUptime1);
107
     mySyncMicroSec     = float(anUptime1 * 1000.0 - aTimerValue);
108
@@ -363,6 +357,9 @@
109
             case StWinAttr_GlDepthSize:
110
                 anIter[1] = (StWinAttr )attribs.GlDepthSize;
111
                 break;
112
+            case StWinAttr_GlStencilSize:
113
+                anIter[1] = (StWinAttr )attribs.GlStencilSize;
114
+                break;
115
             case StWinAttr_ToBlockSleepSystem:
116
                 anIter[1] = (StWinAttr )attribs.ToBlockSleepSystem;
117
                 break;
118
@@ -408,6 +405,9 @@
119
             case StWinAttr_GlDepthSize:
120
                 attribs.GlDepthSize = (int8_t )anIter[1];
121
                 break;
122
+            case StWinAttr_GlStencilSize:
123
+                attribs.GlStencilSize = (int8_t )anIter[1];
124
+                break;
125
             case StWinAttr_ToBlockSleepSystem:
126
                 attribs.ToBlockSleepSystem = (anIter[1] == 1);
127
                 break;
128
@@ -429,17 +429,39 @@
129
                 if(attribs.Split != (StWinSplit )anIter[1]
130
                 && attribs.IsFullScreen) {
131
                     switch(attribs.Split) {
132
-                        case StWinSlave_splitHorizontal:   myRectFull.right()  += myRectFull.width();  break;
133
-                        case StWinSlave_splitVertical:     myRectFull.bottom() += myRectFull.height(); break;
134
-                        case StWinSlave_splitVertHdmi720:  myRectFull.bottom() += 720  + 30; break;
135
-                        case StWinSlave_splitVertHdmi1080: myRectFull.bottom() += 1080 + 45; break;
136
-                        default: break;
137
+                        case StWinSlave_splitHorizontal:
138
+                        case StWinSlave_splitVertical:
139
+                        case StWinSlave_splitVertHdmi720:
140
+                        case StWinSlave_splitVertHdmi1080: {
141
+                            if(myRectFullInit.width() != 0) {
142
+                                // restore rectangle
143
+                                myRectFull = myRectFullInit;
144
+                            }
145
+                            break;
146
+                        }
147
+                        case StWinSlave_splitOff: {
148
+                            // remember rectangle
149
+                            myRectFullInit = myRectFull;
150
+                            break;
151
+                        }
152
                     }
153
 
154
                     switch((StWinSplit )anIter[1]) {
155
                         case StWinSlave_splitHorizontal: {
156
                             myTiledCfg = TiledCfg_MasterSlaveX;
157
-                            myRectFull.right() -= myRectFull.width() / 2;
158
+                            if(myForcedAspect > 0.0) {
159
+                                const int aNewSizeY = int(double(myRectFull.width()) / myForcedAspect);
160
+                                const int aDY       = aNewSizeY - myRectFull.height();
161
+                                if(aDY <= 0) {
162
+                                    myRectFull.bottom() += aDY;
163
+                                } else {
164
+                                    const int aNewSizeX = int(double(myRectFull.height()) * myForcedAspect);
165
+                                    const int aDX       = aNewSizeX - myRectFull.width();
166
+                                    myRectFull.right() += aDX;
167
+                                }
168
+                            } else {
169
+                                myRectFull.right() -= myRectFull.width() / 2;
170
+                            }
171
                             break;
172
                         }
173
                         case StWinSlave_splitVertical: {
174
@@ -462,10 +484,7 @@
175
                             break;
176
                         }
177
                     }
178
-                    myStEventAux.Type       = stEvent_Size;
179
-                    myStEventAux.Size.Time  = getEventTime();
180
-                    myStEventAux.Size.SizeX = myRectFull.width();
181
-                    myStEventAux.Size.SizeY = myRectFull.height();
182
+                    myStEventAux.Size.init(getEventTime(), myRectFull.width(), myRectFull.height(), myForcedAspect);
183
                     signals.onResize->emit(myStEventAux.Size);
184
                 }
185
                 attribs.Split = (StWinSplit )anIter[1];
186
@@ -499,10 +518,8 @@
187
     if(attribs.ToBlockSleepDisplay
188
     && !myIsSystemLocked) {
189
         // prevent display sleep - call this periodically
190
-        EXECUTION_STATE aState = ES_CONTINUOUS | ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED;
191
-        if(myIsVistaPlus) {
192
-            aState = aState | ES_AWAYMODE_REQUIRED;
193
-        }
194
+        EXECUTION_STATE aState = ES_CONTINUOUS | ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED
195
+                               | ES_AWAYMODE_REQUIRED;
196
         SetThreadExecutionState(aState);
197
 
198
         if(myBlockSleep == BlockSleep_DISPLAY) {
199
@@ -523,10 +540,8 @@
200
         myBlockSleep = BlockSleep_DISPLAY;
201
sview-16_06.tar.gz/StCore/StWindowImpl.h -> sview-17_04.tar.gz/StCore/StWindowImpl.h Changed
103
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StCore, window system independent C++ toolkit for writing OpenGL applications.
4
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -67,6 +67,7 @@
10
     ST_LOCAL void setPlacement(const StRectI_t& theRect,
11
                                const bool       theMoveToScreen);
12
     ST_LOCAL StPointD_t getMousePos();
13
+    ST_LOCAL bool isPreciseCursor() const { return myIsPreciseCursor; }
14
     ST_LOCAL bool create();
15
     ST_LOCAL void stglSwap(const int& theWinId);
16
     ST_LOCAL bool stglMakeCurrent(const int theWinId);
17
@@ -277,13 +278,18 @@
18
     bool               myHasOrientSensor; //!< flag indicating that device has orientation sensors
19
     bool               myIsPoorOrient;    //!< flag indicating that available orientation sensor provides imprecise values
20
     bool               myToTrackOrient;   //!< track device orientation
21
+    bool               myToHideStatusBar; //!< hide system-provided status bar
22
+    bool               myToHideNavBar;    //!< hide system-provided navigation bar
23
+    bool               myToSwapEyesHW;    //!< flag to swap LR views on external event
24
 
25
     StPointD_t         myMousePt;         //!< mouse coordinates to track activity
26
+    bool               myIsPreciseCursor; //!< flag indicating that last mouse cursor position was updated by precise input device
27
     StTouchEvent       myTouches;         //!< current state of touch screen
28
     StTouchEvent       myTap1Touch;       //!< previous tap touch
29
     int                myNbTouchesMax;    //!< maximum touches within current sequence
30
     StRectI_t          myRectNorm;        //!< master window coordinates in normal     state
31
     StRectI_t          myRectFull;        //!< master window coordinates in fullscreen state
32
+    StRectI_t          myRectFullInit;    //!< fullscreen rectangle before applying tiling
33
     StRectI_t          myRectNormPrev;    //!< window rectangle to track changes
34
     StMarginsI         myDecMargins;      //!< decoration margins
35
 
36
@@ -294,6 +300,7 @@
37
     int                myWinOnMonitorId;  //!< monitor id where window is placed
38
     int                myWinMonScaleId;   //!< monitor id from which scale factor is applied
39
     TiledCfg           myTiledCfg;        //!< tiles configuration (multiple viewports within the same window)
40
+    double             myForcedAspect;    //!< forced window aspect ratio (negative number if not forced)
41
 
42
 #ifdef _WIN32
43
     // available since Win7 (not in Vista!)
44
@@ -320,7 +327,6 @@
45
     StCondition        myEventCursorShow;
46
     StCondition        myEventCursorHide;
47
     MSG                myEvent;           //!< message for windows' message loop
48
-    bool               myIsVistaPlus;     //!< system is Vista+
49
 #elif defined(__APPLE__)
50
     StCocoaCoords      myCocoaCoords;
51
     IOPMAssertionLevel mySleepAssert;     //!< prevent system going to sleep
52
@@ -349,6 +355,7 @@
53
         bool       IsGlStereo;         //!< request OpenGL hardware accelerated QuadBuffer
54
         bool       IsGlDebug;          //!< request OpenGL debug context
55
         int8_t     GlDepthSize;        //!< OpenGL Depth Buffer size
56
+        int8_t     GlStencilSize;      //!< OpenGL Stencil Buffer size
57
         bool       IsFullScreen;       //!< to show in fullscreen mode
58
         bool       IsExclusiveFullScr; //!< use exclusive fullscreen mode (improve performance, prevent other applications)
59
         bool       IsHidden;           //!< to hide the window
60
@@ -392,9 +399,7 @@
61
         : StTimer(),
62
           myLastSyncMicroSec(0.0),
63
           mySyncMicroSec(0.0f) {
64
-        #if defined(_WIN32)
65
-            myGetTick64 = NULL;
66
-        #elif defined(__APPLE__)
67
+        #if defined(__APPLE__)
68
             (void )::mach_timebase_info(&myTimebaseInfo);
69
         #endif
70
         }
71
@@ -444,7 +449,7 @@
72
          */
73
         ST_LOCAL double getUpTimeFromSystem() const {
74
         #ifdef _WIN32
75
-            const uint64_t anUptime = (myGetTick64 != NULL) ? myGetTick64() : (uint64_t )GetTickCount();
76
+            const uint64_t anUptime = GetTickCount64();
77
             return double(anUptime) * 0.001;
78
         #elif defined(__APPLE__)
79
             // use function from CoreServices to retrieve system uptime
80
@@ -458,10 +463,7 @@
81
         #endif
82
         }
83
 
84
-    #ifdef _WIN32
85
-        typedef ULONGLONG (WINAPI *GetTickCount64_t)();
86
-        GetTickCount64_t   myGetTick64;
87
-    #elif defined(__APPLE__)
88
+    #if defined(__APPLE__)
89
         mach_timebase_info_data_t myTimebaseInfo;
90
     #endif
91
         double             myLastSyncMicroSec; //!< timestamp of last synchronization
92
@@ -475,6 +477,10 @@
93
     StEvent        myStEvent;          //!< temporary event object (to be used in message loop thread)
94
     StEvent        myStEvent2;         //!< temporary event object (to be used in message loop thread)
95
     StEvent        myStEventAux;       //!< extra temporary event object (to be used in StWindow creation thread)
96
+    int            myAlignDL;          //!< extra window shift applied for alignment (left)
97
+    int            myAlignDR;          //!< extra window shift applied for alignment (right)
98
+    int            myAlignDT;          //!< extra window shift applied for alignment (top)
99
+    int            myAlignDB;          //!< extra window shift applied for alignment (bottom)
100
     double         myLastEventsTime;   //!< time when processEvents() was last called
101
     bool           myEventsThreaded;
102
     bool           myIsMouseMoved;
103
sview-16_06.tar.gz/StCore/StWindowImplAnd.cpp -> sview-17_04.tar.gz/StCore/StWindowImplAnd.cpp Changed
115
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StCore, window system independent C++ toolkit for writing OpenGL applications.
4
- * Copyright © 2014-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2014-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -88,10 +88,7 @@
10
             myIsUpdated    = true;
11
 
12
             const StRectI_t& aRect = attribs.IsFullScreen ? myRectFull : myRectNorm;
13
-            myStEvent.Type       = stEvent_Size;
14
-            myStEvent.Size.Time  = getEventTime();
15
-            myStEvent.Size.SizeX = aRect.width();
16
-            myStEvent.Size.SizeY = aRect.height();
17
+            myStEvent.Size.init(getEventTime(), aRect.width(), aRect.height(), myForcedAspect);
18
             signals.onResize->emit(myStEvent.Size);
19
         }
20
     }
21
@@ -128,10 +125,7 @@
22
     myRectNorm.bottom() = myRectNorm.top()  + aHeight;
23
     myRectFull = myRectNorm;
24
 
25
-    myStEvent.Type       = stEvent_Size;
26
-    myStEvent.Size.Time  = getEventTime();
27
-    myStEvent.Size.SizeX = myRectNorm.width();
28
-    myStEvent.Size.SizeY = myRectNorm.height();
29
+    myStEvent.Size.init(getEventTime(), myRectNorm.width(), myRectNorm.height(), myForcedAspect);
30
     signals.onResize->emit(myStEvent.Size);
31
 }
32
 
33
@@ -219,6 +213,7 @@
34
                             if(aNbTouches == 1) {
35
                                 // simulate mouse click
36
                                 myMousePt = aPos0;
37
+                                myIsPreciseCursor = false;
38
                                 myStEvent.Type = stEvent_MouseDown;
39
                                 myStEvent.Button.Button  = ST_MOUSE_LEFT;
40
                                 myStEvent.Button.Buttons = 0;
41
@@ -241,6 +236,7 @@
42
                             if(aNbTouches == 1) {
43
                                 // simulate mouse move
44
                                 myMousePt = aPos0;
45
+                                myIsPreciseCursor = false;
46
                             }
47
                             doTouch(myStEvent.Touch);
48
                             break;
49
@@ -252,6 +248,7 @@
50
                             if(aNbTouches == 1) {
51
                                 // simulate mouse unclick
52
                                 myMousePt = aPos0;
53
+                                myIsPreciseCursor = false;
54
                                 myStEvent.Type = stEvent_MouseUp;
55
                                 myStEvent.Button.Button  = ST_MOUSE_LEFT;
56
                                 myStEvent.Button.Buttons = 0;
57
@@ -272,6 +269,7 @@
58
             }
59
 
60
             myMousePt = aPos0;
61
+            myIsPreciseCursor = aSource == AINPUT_SOURCE_MOUSE; // || AINPUT_SOURCE_STYLUS
62
 
63
             StVirtButton aMouseBtn = ST_MOUSE_LEFT;
64
             myStEvent.Button.Button  = aMouseBtn;
65
@@ -336,16 +334,13 @@
66
 
67
         myInitState = STWIN_INIT_SUCCESS;
68
         if(isResized) {
69
-            myStEvent.Type       = stEvent_Size;
70
-            myStEvent.Size.Time  = getEventTime();
71
-            myStEvent.Size.SizeX = myRectNorm.width();
72
-            myStEvent.Size.SizeY = myRectNorm.height();
73
+            myStEvent.Size.init(getEventTime(), myRectNorm.width(), myRectNorm.height(), myForcedAspect);
74
             signals.onResize->emit(myStEvent.Size);
75
         }
76
         return true;
77
     }
78
 
79
-    myMaster.hRC = new StWinGlrc(eglGetDisplay(EGL_DEFAULT_DISPLAY), attribs.IsGlDebug, attribs.GlDepthSize);
80
+    myMaster.hRC = new StWinGlrc(eglGetDisplay(EGL_DEFAULT_DISPLAY), attribs.IsGlDebug, attribs.GlDepthSize, attribs.GlStencilSize);
81
     if(!myMaster.hRC->isValid()) {
82
         myMaster.close();
83
         mySlave.close();
84
@@ -354,7 +349,7 @@
85
     }
86
 
87
     myMaster.hWindowGl = myParentWin->getWindow();
88
-    myInitState = myMaster.glCreateContext(NULL, myRectNorm, attribs.GlDepthSize, attribs.IsGlStereo, attribs.IsGlDebug);
89
+    myInitState = myMaster.glCreateContext(NULL, myRectNorm, attribs.GlDepthSize, attribs.GlStencilSize, attribs.IsGlStereo, attribs.IsGlDebug);
90
     if(myInitState != STWIN_INIT_SUCCESS) {
91
         return false;
92
     }
93
@@ -454,10 +449,8 @@
94
             // do not handle resize event here - screen might be not yet resized
95
             updateMonitors();
96
 
97
+            myStEvent.Size.init(getEventTime(), myRectNorm.width(), myRectNorm.height(), myForcedAspect);
98
             myStEvent.Type  = stEvent_NewMonitor;
99
-            myStEvent.Size.Time  = getEventTime();
100
-            myStEvent.Size.SizeX = myRectNorm.width();
101
-            myStEvent.Size.SizeY = myRectNorm.height();
102
             //myWinOnMonitorId = 0;
103
             signals.onAnotherMonitor->emit(myStEvent.Size);
104
             return;
105
@@ -484,7 +477,8 @@
106
     StString aDndFile;
107
     myParentWin->setHardwareStereoOn(myToEnableStereoHW);
108
     myParentWin->setTrackOrientation(myToTrackOrient);
109
-    myParentWin->fetchState(aDndFile, myQuaternion);
110
+    myParentWin->setHideSystemBars(myToHideStatusBar, myToHideNavBar);
111
+    myParentWin->fetchState(aDndFile, myQuaternion, myToSwapEyesHW);
112
     if(!aDndFile.isEmpty()) {
113
         std::vector<const char*> aDndList;
114
         aDndList.push_back(aDndFile.toCString());
115
sview-16_06.tar.gz/StCore/StWindowImplLin.cpp -> sview-17_04.tar.gz/StCore/StWindowImplLin.cpp Changed
84
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StCore, window system independent C++ toolkit for writing OpenGL applications.
4
- * Copyright © 2007-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -109,7 +109,7 @@
10
     Display* hDisplay = stXDisplay->hDisplay;
11
 
12
 #if defined(ST_HAVE_EGL)
13
-    myMaster.hRC = new StWinGlrc(eglGetDisplay(hDisplay), attribs.IsGlDebug, attribs.GlDepthSize);
14
+    myMaster.hRC = new StWinGlrc(eglGetDisplay(hDisplay), attribs.IsGlDebug, attribs.GlDepthSize, attribs.GlStencilSize);
15
     if(!myMaster.hRC->isValid()) {
16
         myMaster.close();
17
         mySlave.close();
18
@@ -153,7 +153,7 @@
19
         GLX_BLUE_SIZE,     8,
20
         GLX_ALPHA_SIZE,    0,
21
         GLX_DEPTH_SIZE,    attribs.GlDepthSize,
22
-        GLX_STENCIL_SIZE,  0,
23
+        GLX_STENCIL_SIZE,  attribs.GlStencilSize,
24
         GLX_DOUBLEBUFFER,  True,
25
         //GLX_SAMPLE_BUFFERS, 1,
26
         //GLX_SAMPLES,        4,
27
@@ -320,6 +320,7 @@
28
     int isGlCtx = myMaster.glCreateContext(attribs.Slave != StWinSlave_slaveOff ? &mySlave : NULL,
29
                                            myRectNorm,
30
                                            attribs.GlDepthSize,
31
+                                           attribs.GlStencilSize,
32
                                            attribs.IsGlStereo,
33
                                            attribs.IsGlDebug);
34
     if(isGlCtx != STWIN_INIT_SUCCESS) {
35
@@ -426,10 +427,7 @@
36
             myIsUpdated    = true;
37
 
38
             const StRectI_t& aRect = attribs.IsFullScreen ? myRectFull : myRectNorm;
39
-            myStEvent.Type       = stEvent_Size;
40
-            myStEvent.Size.Time  = getEventTime();
41
-            myStEvent.Size.SizeX = aRect.width();
42
-            myStEvent.Size.SizeY = aRect.height();
43
+            myStEvent.Size.init(getEventTime(), aRect.width(), aRect.height(), myForcedAspect);
44
             signals.onResize->emit(myStEvent.Size);
45
         }
46
     }
47
@@ -584,10 +582,7 @@
48
     XSetInputFocus(hDisplay, myMaster.hWindowGl, RevertToParent, CurrentTime);
49
 
50
     const StRectI_t& aRect = attribs.IsFullScreen ? myRectFull : myRectNorm;
51
-    myStEvent.Type       = stEvent_Size;
52
-    myStEvent.Size.Time  = getEventTime();
53
-    myStEvent.Size.SizeX = aRect.width();
54
-    myStEvent.Size.SizeY = aRect.height();
55
+    myStEvent.Size.init(getEventTime(), aRect.width(), aRect.height(), myForcedAspect);
56
     signals.onResize->emit(myStEvent.Size);
57
 
58
     // flushes the output buffer, most client apps needn't use this cause buffer is automatically flushed as needed by calls to XNextEvent()...
59
@@ -786,10 +781,7 @@
60
     }
61
 
62
     const StRectI_t& aRect = attribs.IsFullScreen ? myRectFull : myRectNorm;
63
-    myStEvent.Type       = stEvent_Size;
64
-    myStEvent.Size.Time  = getEventTime();
65
-    myStEvent.Size.SizeX = aRect.width();
66
-    myStEvent.Size.SizeY = aRect.height();
67
+    myStEvent.Size.init(getEventTime(), aRect.width(), aRect.height(), myForcedAspect);
68
     signals.onResize->emit(myStEvent.Size);
69
 
70
     // force input focus to Master
71
@@ -799,10 +791,8 @@
72
     if(!attribs.IsFullScreen && myMonitors.size() > 1) {
73
         int aNewMonId = myMonitors[myRectNorm.center()].getId();
74
         if(myWinOnMonitorId != aNewMonId) {
75
-            myStEventAux.Type  = stEvent_NewMonitor;
76
-            myStEventAux.Size.Time  = getEventTime();
77
-            myStEventAux.Size.SizeX = myRectNorm.width();
78
-            myStEventAux.Size.SizeY = myRectNorm.height();
79
+            myStEventAux.Size.init(getEventTime(), myRectNorm.width(), myRectNorm.height(), myForcedAspect);
80
+            myStEventAux.Type = stEvent_NewMonitor;
81
             myWinOnMonitorId = aNewMonId;
82
             signals.onAnotherMonitor->emit(myStEventAux.Size);
83
         }
84
sview-16_06.tar.gz/StCore/StWindowImplMac.mm -> sview-17_04.tar.gz/StCore/StWindowImplMac.mm Changed
46
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StCore, window system independent C++ toolkit for writing OpenGL applications.
4
- * Copyright © 2011-2014 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2011-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -448,10 +448,8 @@
10
     if(!attribs.IsFullScreen && myMonitors.size() > 1) {
11
         int aNewMonId = myMonitors[myRectNorm.center()].getId();
12
         if(myWinOnMonitorId != aNewMonId) {
13
-            myStEventAux.Type  = stEvent_NewMonitor;
14
-            myStEventAux.Size.Time  = getEventTime();
15
-            myStEventAux.Size.SizeX = myRectNorm.width();
16
-            myStEventAux.Size.SizeY = myRectNorm.height();
17
+            myStEventAux.Size.init(getEventTime(), myRectNorm.width(), myRectNorm.height(), myForcedAspect);
18
+            myStEventAux.Type = stEvent_NewMonitor;
19
             myWinOnMonitorId = aNewMonId;
20
             signals.onAnotherMonitor->emit(myStEventAux.Size);
21
         }
22
@@ -475,10 +473,7 @@
23
             myRectNormPrev = myRectFull;
24
             myIsUpdated    = true;
25
 
26
-            myStEvent.Type       = stEvent_Size;
27
-            myStEvent.Size.Time  = getEventTime();
28
-            myStEvent.Size.SizeX = myRectFull.width();
29
-            myStEvent.Size.SizeY = myRectFull.height();
30
+            myStEvent.Size.init(getEventTime(), myRectFull.width(), myRectFull.height(), myForcedAspect);
31
             signals.onResize->emit(myStEvent.Size);
32
         }
33
     } else {
34
@@ -488,10 +483,7 @@
35
             myRectNormPrev = aWinRectNew;
36
             myIsUpdated    = true;
37
 
38
-            myStEvent.Type       = stEvent_Size;
39
-            myStEvent.Size.Time  = getEventTime();
40
-            myStEvent.Size.SizeX = myRectNorm.width();
41
-            myStEvent.Size.SizeY = myRectNorm.height();
42
+            myStEvent.Size.init(getEventTime(), myRectNorm.width(), myRectNorm.height(), myForcedAspect);
43
             signals.onResize->emit(myStEvent.Size);
44
         }
45
     }
46
sview-16_06.tar.gz/StCore/StWindowImplWin.cpp -> sview-17_04.tar.gz/StCore/StWindowImplWin.cpp Changed
201
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StCore, window system independent C++ toolkit for writing OpenGL applications.
4
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -28,6 +28,20 @@
10
                                          UINT   theMsg,
11
                                          WPARAM theParamW,
12
                                          LPARAM theParamL) {
13
+    if(theMsg == WM_NCCREATE) {
14
+        HMODULE aUser32Module = GetModuleHandleW(L"User32"); // User32 should be already loaded
15
+        if(aUser32Module != NULL) {
16
+            // available since Win10 (update from '2016)
17
+            typedef BOOL (WINAPI *EnableNonClientDpiScaling_t)(HWND hwnd);
18
+            EnableNonClientDpiScaling_t aEnableNonClientDpiScaling = (EnableNonClientDpiScaling_t )GetProcAddress(aUser32Module, "EnableNonClientDpiScaling");
19
+            if(aEnableNonClientDpiScaling != NULL) {
20
+                // ask Windows 10 to resize title bar... awkward thing
21
+                BOOL aRes = aEnableNonClientDpiScaling(theWnd);
22
+                (void )aRes;
23
+            }
24
+        }
25
+    }
26
+
27
     if(theMsg == WM_CREATE) {
28
         // save pointer to our class instance (sent on window create) to window storage
29
         CREATESTRUCTW* aCreateInfo = (CREATESTRUCTW* )theParamL;
30
@@ -48,6 +62,17 @@
31
 }
32
 
33
 bool StWindowImpl::create() {
34
+    if(myRegisterTouchWindow == NULL) {
35
+        HMODULE aUser32Module = GetModuleHandleW(L"User32");
36
+        if(aUser32Module != NULL) {
37
+            // User32 should be already loaded
38
+            myRegisterTouchWindow   = (RegisterTouchWindow_t   )GetProcAddress(aUser32Module, "RegisterTouchWindow");
39
+            myUnregisterTouchWindow = (UnregisterTouchWindow_t )GetProcAddress(aUser32Module, "UnregisterTouchWindow");
40
+            myGetTouchInputInfo     = (GetTouchInputInfo_t     )GetProcAddress(aUser32Module, "GetTouchInputInfo");
41
+            myCloseTouchInputHandle = (CloseTouchInputHandle_t )GetProcAddress(aUser32Module, "CloseTouchInputHandle");
42
+        }
43
+    }
44
+
45
     myKeysState.reset();
46
     myInitState = STWIN_INITNOTSTART;
47
 
48
@@ -64,6 +89,7 @@
49
     int isGlCtx = myMaster.glCreateContext(attribs.Slave != StWinSlave_slaveOff ? &mySlave : NULL,
50
                                            myRectNorm,
51
                                            attribs.GlDepthSize,
52
+                                           attribs.GlStencilSize,
53
                                            attribs.IsGlStereo,
54
                                            attribs.IsGlDebug);
55
     myEventInitGl.set();
56
@@ -411,24 +437,11 @@
57
         myRectNorm.right()  = aRect.right;
58
         myRectNorm.bottom() = aRect.bottom;
59
 
60
-        myStEventAux.Type       = stEvent_Size;
61
-        myStEventAux.Size.Time  = getEventTime();
62
-        myStEventAux.Size.SizeX = myRectNorm.width();
63
-        myStEventAux.Size.SizeY = myRectNorm.height();
64
+        myStEventAux.Size.init(getEventTime(), myRectNorm.width(), myRectNorm.height(), myForcedAspect);
65
         signals.onResize->emit(myStEventAux.Size);
66
     }
67
 }
68
 
69
-/**
70
- * @return normalized delta (-1 or 0 or +1)
71
- */
72
-inline int getDirNorm(const int theFrom,
73
-                      const int theTo) {
74
-    return theFrom > theTo
75
-         ? -1
76
-         : (theFrom < theTo ? 1 : 0);
77
-}
78
-
79
 LRESULT StWindowImpl::stWndProc(HWND theWin, UINT uMsg, WPARAM wParam, LPARAM lParam) {
80
     switch(uMsg) {                 // Check For Windows Messages
81
         case WM_ACTIVATE: {        // Watch For Window Activate Message
82
@@ -513,6 +526,123 @@
83
             }
84
             break;
85
         }
86
+        case WM_WINDOWPOSCHANGED: {
87
+            if(attribs.IsFullScreen || myParentWin != NULL) {
88
+                //return 0;
89
+                break;
90
+            } else if(theWin != myMaster.hWindow) {
91
+                break;
92
+            }
93
+
94
+            RECT aRect;
95
+            GetClientRect(theWin, &aRect);
96
+            ClientToScreen(theWin,  (POINT* )&aRect);
97
+            ClientToScreen(theWin, ((POINT* )&aRect) + 1);
98
+
99
+            // update decoration margins - AdjustWindowRectEx() does not work with per-monitor DPI and EnableNonClientDpiScaling()
100
+            WINDOWPOS* aPos = (WINDOWPOS* )lParam;
101
+            myDecMargins.left   = aRect.left - aPos->x;
102
+            myDecMargins.right  = (aPos->x + aPos->cx) - aRect.right;
103
+            myDecMargins.top    = aRect.top  - aPos->y;
104
+            myDecMargins.bottom = (aPos->y + aPos->cy) - aRect.bottom;
105
+
106
+            // WM_WINDOWPOSCHANGED is no good for checking client size changes
107
+            // just ask DefWindowProcW() to generate WM_MOVE and WM_SIZE events
108
+            break;
109
+
110
+            /*StRectI_t aNewRect;
111
+            aNewRect.left()   = aRect.left;
112
+            aNewRect.top()    = aRect.top;
113
+            aNewRect.right()  = aRect.right;
114
+            aNewRect.bottom() = aRect.bottom;
115
+
116
+            const bool isMoved = aNewRect.left()   != myRectNorm.left()
117
+                              || aNewRect.top()    != myRectNorm.top();
118
+            const bool isSized = aNewRect.width()  != myRectNorm.width()
119
+                              || aNewRect.height() != myRectNorm.height();
120
+            if(!isMoved && !isSized) {
121
+                // nothing has changed
122
+                return 0;
123
+            }
124
+
125
+            myRectNorm = aNewRect;
126
+            myIsUpdated = true;
127
+            if(isSized) {
128
+                myStEvent.Size.init(getEventTime(myEvent.time), myRectNorm.width(), myRectNorm.height(), myForcedAspect);
129
+                myEventsBuffer.append(myStEvent);
130
+            }
131
+            return 0; // we don't want to receive also WM_MOVE and WM_SIZE events generated by DefWindowProcW()
132
+            */
133
+        }
134
+        // WM_WINDOWPOSCHANGING can be used only within WM_WINDOWPOSCHANGED
135
+        /*case WM_WINDOWPOSCHANGING: {
136
+            if(attribs.IsFullScreen || myParentWin != NULL) {
137
+                return 0;
138
+            } else if(theWin != myMaster.hWindow) {
139
+                break;
140
+            }
141
+
142
+            WINDOWPOS* aDragRect = (WINDOWPOS* )lParam;
143
+            StRectI_t aNewRect;
144
+            aNewRect.left()   = aDragRect->x                 + myDecMargins.left;
145
+            aNewRect.right()  = aDragRect->x + aDragRect->cx - myDecMargins.right;
146
+            aNewRect.top()    = aDragRect->y                 + myDecMargins.top;
147
+            aNewRect.bottom() = aDragRect->y + aDragRect->cy - myDecMargins.bottom;
148
+            const StRectI_t aPrevRect = myRectNorm;
149
+            if(attribs.ToAlignEven) {
150
+                // adjust window position to ensure alignment
151
+                const int aDL = getDirNorm(aPrevRect.left(),   aNewRect.left());
152
+                const int aDR = getDirNorm(aPrevRect.right(),  aNewRect.right());
153
+                const int aDT = getDirNorm(aPrevRect.top(),    aNewRect.top());
154
+                const int aDB = getDirNorm(aPrevRect.bottom(), aNewRect.bottom());
155
+                if(isOddNumber(aNewRect.left())) {
156
+                    aNewRect.left() += aDL;
157
+                    aDragRect->x    += aDL;
158
+                    aDragRect->cx   -= aDL;
159
+                }
160
+                if(isEvenNumber(aNewRect.right())) {
161
+                    aNewRect.right()  += aDR;
162
+                    aDragRect->cx     += aDR;
163
+                }
164
+                if(isOddNumber(aNewRect.top())) {
165
+                    aNewRect.top()    += aDT;
166
+                    aDragRect->y      += aDT;
167
+                    aDragRect->cy     -= aDT;
168
+                }
169
+                if(isEvenNumber(aNewRect.bottom())) {
170
+                    aNewRect.bottom() += aDB;
171
+                    aDragRect->cy     += aDB;
172
+                }
173
+            }
174
+
175
+            // determine monitor scale factor change
176
+            const bool isMoved   = myRectNorm.left()   != aNewRect.left()
177
+                                || myRectNorm.top()    != aNewRect.top();
178
+            const bool isResized = myRectNorm.width()  != aNewRect.width()
179
+                                || myRectNorm.height() != aNewRect.height();
180
+            myRectNorm = aNewRect;
181
+            if(isMoved || isResized) {
182
+                myIsUpdated = true;
183
+            }
184
+            if(isResized) {
185
+                myStEvent.Size.init(getEventTime(myEvent.time), myRectNorm.width(), myRectNorm.height(), myForcedAspect);
186
+                myEventsBuffer.append(myStEvent);
187
+            }
188
+            return 0;
189
+        }*/
190
+        case 0x02E0: { // WM_DPICHANGED
191
+            if(attribs.IsFullScreen || myParentWin != NULL) {
192
+                break;
193
+            } else if(theWin != myMaster.hWindow) {
194
+                break;
195
+            }
196
+
197
+            RECT* aNewRect = (RECT* )lParam;
198
+            SetWindowPos(theWin, NULL,
199
+                         aNewRect->left, aNewRect ->top, aNewRect->right - aNewRect->left, aNewRect->bottom - aNewRect->top,
200
+                         SWP_NOZORDER | SWP_NOACTIVATE);
201
sview-16_06.tar.gz/StDiagnostics/StDiagnostics.cpp -> sview-17_04.tar.gz/StDiagnostics/StDiagnostics.cpp Changed
33
 
1
@@ -97,7 +97,8 @@
2
         myGUI.nullify();
3
         return false;
4
     }
5
-    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER));
6
+    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER), myWindow->getMargins(), (float )myWindow->stglAspectRatio());
7
+
8
     registerHotKeys();
9
     return true;
10
 }
11
@@ -107,7 +108,7 @@
12
         return;
13
     }
14
 
15
-    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER));
16
+    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER), myWindow->getMargins(), (float )myWindow->stglAspectRatio());
17
 }
18
 
19
 void StDiagnostics::doMouseDown(const StClickEvent& theEvent) {
20
@@ -182,10 +183,10 @@
21
         return;
22
     }
23
 
24
-    myGUI->getCamera()->setView(theView);
25
+    myGUI->changeCamera()->setView(theView);
26
     if(theView == ST_DRAW_LEFT
27
     || theView == ST_DRAW_MONO) {
28
-        myGUI->stglUpdate(myWindow->getMousePos());
29
+        myGUI->stglUpdate(myWindow->getMousePos(), myWindow->isPreciseCursor());
30
     }
31
 
32
     // draw GUI
33
sview-16_06.tar.gz/StDiagnostics/StDiagnostics.rc -> sview-17_04.tar.gz/StDiagnostics/StDiagnostics.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "Stereoscopic Device Diagnostics\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2010-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2010-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StDiagnostics\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StDiagnostics/StDiagnosticsGUI.cpp -> sview-17_04.tar.gz/StDiagnostics/StDiagnosticsGUI.cpp Changed
13
 
1
@@ -73,8 +73,9 @@
2
     myCntWidgetBR->setText(aCntString);
3
 }
4
 
5
-void StDiagnosticsGUI::stglUpdate(const StPointD_t& thePointZo) {
6
-    StGLRootWidget::stglUpdate(thePointZo);
7
+void StDiagnosticsGUI::stglUpdate(const StPointD_t& thePointZo,
8
+                                  bool theIsPreciseInput) {
9
+    StGLRootWidget::stglUpdate(thePointZo, theIsPreciseInput);
10
 }
11
 
12
 void StDiagnosticsGUI::stglDraw(unsigned int theView) {
13
sview-16_06.tar.gz/StDiagnostics/StDiagnosticsGUI.h -> sview-17_04.tar.gz/StDiagnostics/StDiagnosticsGUI.h Changed
11
 
1
@@ -49,7 +49,8 @@
2
 
3
     ST_LOCAL StDiagnosticsGUI(StDiagnostics* thePlugin);
4
     ST_LOCAL virtual ~StDiagnosticsGUI();
5
-    ST_LOCAL virtual void stglUpdate(const StPointD_t& thePointZo) ST_ATTR_OVERRIDE;
6
+    ST_LOCAL virtual void stglUpdate(const StPointD_t& thePointZo,
7
+                                     bool theIsPreciseInput) ST_ATTR_OVERRIDE;
8
     ST_LOCAL virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
9
 
10
     ST_LOCAL void setVisibility(const StPointD_t& , bool );
11
sview-16_06.tar.gz/StGLWidgets/StGLCheckboxTextured.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLCheckboxTextured.cpp Changed
16
 
1
@@ -28,11 +28,12 @@
2
     //
3
 }
4
 
5
-void StGLCheckboxTextured::stglUpdate(const StPointD_t& theCursorZo) {
6
+void StGLCheckboxTextured::stglUpdate(const StPointD_t& theCursorZo,
7
+                                      bool theIsPreciseInput) {
8
     const bool isOn = myTrackValue->getValue();
9
     setFaceId(isOn ? 1 : 0);
10
     myOpacityScale = isOn ? myTrueOpacity : myFalseOpacity;
11
-    StGLTextureButton::stglUpdate(theCursorZo);
12
+    StGLTextureButton::stglUpdate(theCursorZo, theIsPreciseInput);
13
 }
14
 
15
 void StGLCheckboxTextured::doClick(const size_t ) {
16
sview-16_06.tar.gz/StGLWidgets/StGLCombobox.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLCombobox.cpp Changed
64
 
1
@@ -13,6 +13,25 @@
2
 #include <StGLWidgets/StGLMessageBox.h>
3
 #include <StGLWidgets/StGLRootWidget.h>
4
 
5
+/**
6
+ * Auxiliary widget covering entire screen.
7
+ */
8
+class StGLContextBackground : public StGLMessageBox {
9
+
10
+        public:
11
+
12
+    StGLContextBackground(StGLRootWidget* theParent)
13
+    : StGLMessageBox(theParent) {
14
+        myIsContextual = true;
15
+        const int aWidth  = myRoot->getRootFullSizeX();
16
+        const int aHeight = myRoot->getRootFullSizeY();
17
+        changeRectPx().right()  = aWidth;
18
+        changeRectPx().bottom() = aHeight;
19
+        create(StString(), StString(), aWidth, aHeight);
20
+    }
21
+
22
+};
23
+
24
 StGLCombobox::StGLCombobox(StGLWidget* theParent,
25
                            const int   theLeft,
26
                            const int   theTop,
27
@@ -39,9 +58,7 @@
28
     StGLRootWidget* aRoot       = theParent->getRoot();
29
     StGLWidget*     aMenuParent = aRoot;
30
     if(aRoot->isMobile()) {
31
-        myBack = new StGLMessageBox(aRoot, "", "",
32
-                                    aRoot->getRectPx().width(), aRoot->getRectPx().height());
33
-        myBack->setContextual(true);
34
+        myBack = new StGLContextBackground(aRoot);
35
         aMenuParent = myBack;
36
     }
37
 
38
@@ -71,12 +88,12 @@
39
         const int aRootY = aRoot->getRectPx().height();
40
         if(aRect.width()  >= aRootX) {
41
             myMenu->changeRectPx().moveLeftTo(0);
42
-        } else if(aRect.right() > aRootX) {
43
+        } else if(aRect.right() > aRoot->getRectPx().right()) {
44
             myMenu->changeRectPx().moveRightTo(aRootX);
45
         }
46
         if(aRect.height() >= aRootY) {
47
             myMenu->changeRectPx().moveTopTo(0);
48
-        } else if(aRect.bottom() > aRootY) {
49
+        } else if(aRect.bottom() > aRoot->getRectPx().bottom()) {
50
             myMenu->changeRectPx().moveBottomTo(aRootY);
51
         }
52
 
53
@@ -90,8 +107,8 @@
54
             StRectI_t& aSubRectNew = anItem->getSubMenu()->changeRectPx();
55
             if(aSubRect.width() >= aRootX) {
56
                 aSubRectNew.moveLeftTo(0);
57
-            } else if(aSubRect.right() > aRootX) {
58
-                aSubRectNew.moveRightTo(myMenu->getRectPxAbsolute().left() + aRoot->scale(10));
59
+            } else if(aSubRect.right() > aRoot->getRectPx().right()) {
60
+                aSubRectNew.moveRightTo(myMenu->getRectPx().left() + aRoot->scale(10));
61
             }
62
         }
63
         aRoot->setFocus(myMenu); // take input focus
64
sview-16_06.tar.gz/StGLWidgets/StGLDescription.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLDescription.cpp Changed
60
 
1
@@ -10,7 +10,7 @@
2
 #include <StGLWidgets/StGLDescription.h>
3
 #include <StGLWidgets/StGLRootWidget.h>
4
 
5
-StGLDescription::StGLDescription(StGLWidget* theParent)
6
+StGLDescription::StGLDescription(StGLRootWidget* theParent)
7
 : StGLTextArea(theParent, 0, 0, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT),
8
                theParent->getRoot()->scale(256),
9
                theParent->getRoot()->scale(96)) {
10
@@ -19,8 +19,8 @@
11
     setBorder(true);
12
 }
13
 
14
-StGLDescription::StGLDescription(StGLWidget* theParent,
15
-                                 const int   theWidth)
16
+StGLDescription::StGLDescription(StGLRootWidget* theParent,
17
+                                 const int theWidth)
18
 : StGLTextArea(theParent, 0, 0, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT),
19
                theWidth,
20
                theParent->getRoot()->scale(96)) {
21
@@ -34,28 +34,29 @@
22
 }
23
 
24
 void StGLDescription::setPoint(const StPointD_t& thePointZo) {
25
-    const StRectI_t& aRootRectPx = StGLWidget::getParent()->getRectPx();
26
-    const int aRootSizeX = aRootRectPx.width();
27
-    const int aRootSizeY = aRootRectPx.height();
28
+    const StRectI_t& aRootRectPx = myRoot->getRectPx();
29
     const int aSizeX = StGLWidget::getRectPx().width();
30
     const int aSizeY = StGLWidget::getRectPx().height();
31
 
32
+    const int aPntInRootX = int(thePointZo.x() * (double )myRoot->getRectPx().width());
33
+    const int aPntInRootY = int(thePointZo.y() * (double )myRoot->getRectPx().height());
34
+
35
     StRectI_t aRect;
36
-    aRect.left()   = int(thePointZo.x() * (double )aRootSizeX) + 16;
37
+    aRect.left()   = aPntInRootX + 16;
38
     aRect.right()  = aRect.left() + aSizeX;
39
-    aRect.top()    = int(thePointZo.y() * (double )aRootSizeY) + 16;
40
+    aRect.top()    = aPntInRootY + 16;
41
     aRect.bottom() = aRect.top()  + aSizeY;
42
 
43
     StGLVCorner aCornerY = ST_VCORNER_TOP;
44
     StGLHCorner aCornerX = ST_HCORNER_LEFT;
45
     if(aRect.right() > aRootRectPx.width()) {
46
-        aRect.left()  -= aRootSizeX + 32;
47
-        aRect.right() -= aRootSizeX + 32;
48
+        aRect.left()  -= aRootRectPx.width() + 32;
49
+        aRect.right() -= aRootRectPx.width() + 32;
50
         aCornerX = ST_HCORNER_RIGHT;
51
     }
52
     if(aRect.bottom() > aRootRectPx.height()) {
53
-        aRect.top()    -= aRootSizeY + 32;
54
-        aRect.bottom() -= aRootSizeY + 32;
55
+        aRect.top()    -= aRootRectPx.height() + 32;
56
+        aRect.bottom() -= aRootRectPx.height() + 32;
57
         myFormatter.setupAlignment(StGLTextFormatter::ST_ALIGN_X_CENTER,
58
                                    StGLTextFormatter::ST_ALIGN_Y_BOTTOM);
59
         aCornerY = ST_VCORNER_BOTTOM;
60
sview-16_06.tar.gz/StGLWidgets/StGLImageProgram.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLImageProgram.cpp Changed
111
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2010-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2010-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -104,12 +104,12 @@
10
     // color conversion shaders
11
     registerFragmentShaderPart(FragSection_ToRgb, FragToRgb_FromXyz,
12
        // XYZ to sRGB matrix
13
-       "mat4 THE_XYZ2RGB_MAT = mat4(3.2404542, -0.9692660,  0.0556434, 0.0,"
14
-       "                           -1.5371385,  1.8760108, -0.2040259, 0.0,"
15
-       "                           -0.4985314,  0.0415560,  1.0572252, 0.0,"
16
-       "                                  0.0,        0.0,        0.0, 1.0);"
17
-       "vec4 THE_GAMMA_XYZ =       vec4(2.6, 2.6, 2.6, 1.0);"
18
-       "vec4 THE_GAMMA_RGB = 1.0 / vec4(2.2, 2.2, 2.2, 1.0);"
19
+       "const mat4 THE_XYZ2RGB_MAT = mat4(3.2404542, -0.9692660,  0.0556434, 0.0,"
20
+       "                                 -1.5371385,  1.8760108, -0.2040259, 0.0,"
21
+       "                                 -0.4985314,  0.0415560,  1.0572252, 0.0,"
22
+       "                                        0.0,        0.0,        0.0, 1.0);"
23
+       "const vec4 THE_GAMMA_XYZ =       vec4(2.6, 2.6, 2.6, 1.0);"
24
+       "const vec4 THE_GAMMA_RGB = 1.0 / vec4(2.2, 2.2, 2.2, 1.0);"
25
        "void convertToRGB(inout vec4 theColor, in vec3 texCoord) {\n"
26
        "    vec4 aColor = pow(theColor, THE_GAMMA_XYZ);"
27
        "    aColor = THE_XYZ2RGB_MAT * aColor;\n"
28
@@ -203,21 +203,26 @@
29
         + "const float TheRangeBits = 1.0;\n"
30
         + F_SHADER_YUVNV2RGB_MPEG);
31
 
32
-    params.gamma = new StFloat32Param(   1.0f,         // initial value
33
-                                        0.05f, 99.0f, // min, max values
34
-                                         1.0f,         // default value
35
-                                        0.05f,         // incremental step
36
-                                      0.0001f);        // equality tolerance
37
-    params.brightness = new StFloat32Param(   1.0f,         // initial value
38
-                                              0.0f, 99.0f, // min, max values
39
-                                              1.0f,         // default value
40
-                                             0.05f,         // incremental step
41
-                                           0.0001f);        // equality tolerance
42
-    params.saturation = new StFloat32Param(   1.0f,         // initial value
43
-                                            -10.0f, 99.0f, // min, max values
44
-                                              1.0f,         // default value
45
-                                             0.05f,         // incremental step
46
-                                           0.0001f);        // equality tolerance
47
+    params.gamma = new StFloat32Param(1.0f);
48
+    params.gamma->setMinMaxValues(0.05f, 99.0f);
49
+    params.gamma->setEffectiveMinMaxValues(0.05f, 2.0f);
50
+    params.gamma->setDefValue(1.0f);
51
+    params.gamma->setStep(0.05f);
52
+    params.gamma->setTolerance(0.0001f);
53
+
54
+    params.brightness = new StFloat32Param(1.0f);
55
+    params.brightness->setMinMaxValues(0.0f, 99.0f);
56
+    params.brightness->setDefValue(1.0f);
57
+    params.brightness->setEffectiveMinMaxValues(0.0f, 5.0f);
58
+    params.brightness->setStep(0.05f);
59
+    params.brightness->setTolerance(0.0001f);
60
+
61
+    params.saturation = new StFloat32Param(1.0f);
62
+    params.saturation->setMinMaxValues(-10.0f, 99.0f);
63
+    params.saturation->setEffectiveMinMaxValues(0.0f, 2.0f);
64
+    params.saturation->setDefValue(1.0f);
65
+    params.saturation->setStep(0.05f);
66
+    params.saturation->setTolerance(0.0001f);
67
 
68
     // main shader parts
69
     const char V_SHADER_FLAT[] =
70
@@ -243,6 +248,7 @@
71
        "uniform mat4 uModelMat;\n"
72
        "uniform vec4 uTexData;\n"
73
        "uniform vec4 uTexUVData;\n"
74
+       "uniform float uTexCubeFlipZ;\n"
75
 
76
        "attribute vec4 vVertex;\n"
77
        "attribute vec2 vTexCoord;\n"
78
@@ -252,8 +258,10 @@
79
 
80
        "void main(void) {\n"
81
        "    gl_Position = vec4(vVertex.x, vVertex.y, 0.0, 1.0);\n"
82
-       "    fTexCoord   = (uProjMat * gl_Position).xyz;"
83
-       "    fTexUVCoord = (uProjMat * gl_Position).xyz;"
84
+       "    vec3 aTCoord = (uProjMat * gl_Position).xyz;"
85
+       "    aTCoord.z  *= uTexCubeFlipZ;"
86
+       "    fTexCoord   = aTCoord;"
87
+       "    fTexUVCoord = aTCoord;"
88
        "}\n";
89
 
90
     const char F_SHADER_FLAT[] =
91
@@ -304,6 +312,11 @@
92
     theCtx.core20fwd->glUniform4fv(uniTexUVDataLoc, 1, theTexDataVec4);
93
 }
94
 
95
+void StGLImageProgram::setCubeTextureFlipZ(StGLContext& theCtx,
96
+                                           bool theToFlip) {
97
+    theCtx.core20fwd->glUniform1f(uniTexCubeFlipZLoc, theToFlip ? 1.0f : -1.0f);
98
+}
99
+
100
 void StGLImageProgram::setupCorrection(StGLContext& theCtx) {
101
     if(getFragmentShaderPart(FragSection_Correct) == FragCorrect_Off) {
102
         return;
103
@@ -383,6 +396,7 @@
104
         uniTexUVDataLoc       = myActiveProgram->getUniformLocation(theCtx, "uTexUVData");
105
         uniTexSizePxLoc       = myActiveProgram->getUniformLocation(theCtx, "uTexSizePx");
106
         uniTexelSizePxLoc     = myActiveProgram->getUniformLocation(theCtx, "uTexelSize");
107
+        uniTexCubeFlipZLoc    = myActiveProgram->getUniformLocation(theCtx, "uTexCubeFlipZ");
108
         uniColorProcessingLoc = myActiveProgram->getUniformLocation(theCtx, "uColorProcessing");
109
         uniGammaLoc           = myActiveProgram->getUniformLocation(theCtx, "uGamma");
110
         myActiveProgram->atrVVertexLoc  = myActiveProgram->getAttribLocation(theCtx, "vVertex");
111
sview-16_06.tar.gz/StGLWidgets/StGLImageRegion.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLImageRegion.cpp Changed
201
 
1
@@ -75,7 +75,7 @@
2
             || aParams->ViewingMode == theValue) {
3
                 return false;
4
             }
5
-            aParams->ViewingMode = (StStereoParams::ViewMode )theValue;
6
+            aParams->ViewingMode = (StViewSurface )theValue;
7
             signals.onChanged(theValue);
8
             return true;
9
         }
10
@@ -111,22 +111,22 @@
11
             const float THE_SEP_STEP_PX = 2.0f;
12
             switch(myParamId) {
13
                 case StereoParamId_SepDX: {
14
-                    setMinValue(-100.0f);
15
-                    setMaxValue( 100.0f);
16
+                    setMinMaxValues(-500.0f, 500.0f);
17
+                    setEffectiveMinMaxValues(-100.0f, 100.0f);
18
                     setStep(THE_SEP_STEP_PX);
19
                     setTolerance(0.5f);
20
                     break;
21
                 }
22
                 case StereoParamId_SepDY: {
23
-                    setMinValue(-100.0f);
24
-                    setMaxValue( 100.0f);
25
+                    setMinMaxValues(-500.0f, 500.0f);
26
+                    setEffectiveMinMaxValues(-100.0f, 100.0f);
27
                     setStep(THE_SEP_STEP_PX);
28
                     setTolerance(0.5f);
29
                     break;
30
                 }
31
                 case StereoParamId_SepRot: {
32
-                    setMinValue(-180.0f);
33
-                    setMaxValue( 180.0f);
34
+                    setMinMaxValues(-180.0f, 180.0f);
35
+                    setEffectiveMinMaxValues(-5.0f, 5.0f);
36
                     setStep(0.1f);
37
                     setTolerance(0.001f);
38
                     break;
39
@@ -201,8 +201,8 @@
40
     };
41
 
42
     // we use negative scale factor to show sphere inside out!
43
-    static const GLfloat SPHERE_RADIUS     = -10.0f;
44
-    static const GLfloat PANORAMA_DEF_ZOOM = 0.45f;
45
+    static const float THE_SPHERE_RADIUS     = -10.0f;
46
+    static const float THE_PANORAMA_DEF_ZOOM = 0.45f;
47
 
48
 }
49
 
50
@@ -412,8 +412,9 @@
51
     myTextureQueue->stglUpdateStTextures(getContext());
52
 }
53
 
54
-void StGLImageRegion::stglUpdate(const StPointD_t& pointZo) {
55
-    StGLWidget::stglUpdate(pointZo);
56
+void StGLImageRegion::stglUpdate(const StPointD_t& thePointZo,
57
+                                 bool theIsPreciseInput) {
58
+    StGLWidget::stglUpdate(thePointZo, theIsPreciseInput);
59
     if(myIsInitialized) {
60
         myHasVideoStream = myTextureQueue->stglUpdateStTextures(getContext()) || myTextureQueue->hasConnectedStream();
61
         StHandle<StStereoParams> aFileParams = myTextureQueue->getQTexture().getFront(StGLQuadTexture::LEFT_TEXTURE).getSource();
62
@@ -434,6 +435,7 @@
63
     if(!myProgram.init(aCtx, StImage::ImgColor_RGB, StImage::ImgScale_Full, StGLImageProgram::FragGetColor_Normal)) {
64
         return false;
65
     } else if(!myQuad.initScreen(aCtx)) {
66
+        aCtx.pushError(StString("Fail to init StGLQuad"));
67
         ST_ERROR_LOG("Fail to init StGLQuad");
68
         return false;
69
     } else if(!myUVSphere.initVBOs(aCtx)) {
70
@@ -448,28 +450,71 @@
71
 }
72
 
73
 StGLVec2 StGLImageRegion::getMouseMoveFlat(const StPointD_t& theCursorZoFrom,
74
-                                           const StPointD_t& theCursorZoTo) {
75
-    return StGLVec2( 2.0f * GLfloat(theCursorZoTo.x() - theCursorZoFrom.x()),
76
-                    -2.0f * GLfloat(theCursorZoTo.y() - theCursorZoFrom.y()));
77
+                                           const StPointD_t& theCursorZoTo) const {
78
+    // apply scale factor in case of working area margins
79
+    const double aVrScale = 1.0 / myRoot->getVrZoomOut();
80
+    const double aScaleX  = double(myRoot->getRectPx().width())  / double(myRoot->getRootFullSizeX());
81
+    const double aScaleY  = double(myRoot->getRectPx().height()) / double(myRoot->getRootFullSizeY());
82
+    return StGLVec2(float( 2.0 * double(theCursorZoTo.x() - theCursorZoFrom.x()) * aScaleX * aVrScale),
83
+                    float(-2.0 * double(theCursorZoTo.y() - theCursorZoFrom.y()) * aScaleY * aVrScale));
84
 }
85
 
86
 StGLVec2 StGLImageRegion::getMouseMoveSphere(const StPointD_t& theCursorZoFrom,
87
-                                             const StPointD_t& theCursorZoTo) {
88
+                                             const StPointD_t& theCursorZoTo) const {
89
     StGLVec2 aVec = getMouseMoveFlat(theCursorZoFrom, theCursorZoTo);
90
-    GLfloat aSphereScale = SPHERE_RADIUS * PANORAMA_DEF_ZOOM * getSource()->ScaleFactor;
91
+    float aSphereScale = THE_SPHERE_RADIUS * THE_PANORAMA_DEF_ZOOM * params.stereoFile->ScaleFactor;
92
     StRectD_t aZParams;
93
     getCamera()->getZParams(getCamera()->getZNear(), aZParams);
94
-    aVec.x() *= -90.0f * GLfloat(aZParams.right() - aZParams.left()) / aSphereScale;
95
-    aVec.y() *=  90.0f * GLfloat(aZParams.bottom() - aZParams.top()) / aSphereScale;
96
+    aVec.x() *= -90.0f * float(aZParams.right() - aZParams.left()) / aSphereScale;
97
+    aVec.y() *=  90.0f * float(aZParams.bottom() - aZParams.top()) / aSphereScale;
98
     return aVec;
99
 }
100
 
101
-StGLVec2 StGLImageRegion::getMouseMoveSphere() {
102
+StGLVec2 StGLImageRegion::getMouseMoveSphere() const {
103
     return isClicked(ST_MOUSE_LEFT)
104
-         ? getMouseMoveSphere(myClickPntZo, getRoot()->getCursorZo())
105
+         ? getMouseMoveSphere(myClickPntZo, myRoot->getCursorZo())
106
          : StGLVec2();
107
 }
108
 
109
+bool StGLImageRegion::getHeadOrientation(StGLQuaternion& theOrient,
110
+                                         unsigned int theView,
111
+                                         const bool theToApplyDefShift) const {
112
+    StHandle<StStereoParams> aParams = params.stereoFile;
113
+    if(aParams.isNull()
114
+    || aParams->ViewingMode == StViewSurface_Plain) {
115
+        theOrient = StGLQuaternion();
116
+        return false;
117
+    }
118
+
119
+    const float aYawShift = theToApplyDefShift ? stToRadians(90.0f) : 0.0f;
120
+    StGLVec2 aMouseMove = getMouseMoveSphere();
121
+    float aYaw   = -stToRadians(aParams->getPanYaw() + aMouseMove.x()) + aYawShift;
122
+    float aPitch =  stToRadians(StStereoParams::clipPitch(aParams->getPanPitch() + aMouseMove.y()));
123
+    float aRoll  =  stToRadians(aParams->getZRotate());
124
+
125
+    // apply separation
126
+    const float aSepDeltaX = GLfloat(aParams->getSeparationDx()) * 0.05f;
127
+    const float aSepDeltaY = GLfloat(aParams->getSeparationDy()) * 0.05f;
128
+    if(theView == ST_DRAW_LEFT) {
129
+        aYaw   +=  stToRadians(aSepDeltaX);
130
+        aPitch += -stToRadians(aSepDeltaY);
131
+        aRoll  += -stToRadians(aParams->getSepRotation());
132
+    } else if(theView == ST_DRAW_RIGHT) {
133
+        aYaw   += -stToRadians(aSepDeltaX);
134
+        aPitch +=  stToRadians(aSepDeltaY);
135
+        aRoll  +=  stToRadians(aParams->getSepRotation());
136
+    }
137
+
138
+    const StGLQuaternion anOriYaw   = StGLQuaternion(StGLVec3::DY(), aYaw);
139
+    const StGLQuaternion anOriPitch = StGLQuaternion(StGLVec3::DX(), aPitch);
140
+    const StGLQuaternion anOriRoll  = StGLQuaternion(StGLVec3::DZ(), aRoll);
141
+    StGLQuaternion anOri = StGLQuaternion::multiply(anOriPitch, anOriYaw);
142
+    anOri = StGLQuaternion::multiply(anOriRoll,    anOri);
143
+    anOri = StGLQuaternion::multiply(myDeviceQuat, anOri);
144
+    theOrient = anOri;
145
+    return true;
146
+}
147
+
148
 void StGLImageRegion::stglDraw(unsigned int theView) {
149
     StHandle<StStereoParams> aParams = getSource();
150
     if(!myIsInitialized || !isVisible() || aParams.isNull()
151
@@ -635,11 +680,13 @@
152
     const GLfloat  aScaleBack = aParams->ScaleFactor;
153
     const StGLVec2 aPanBack   = aParams->PanCenter;
154
 
155
-    StStereoParams::ViewMode aViewMode = aParams->ViewingMode;
156
+    const float aVrScale = float(myRoot->getVrZoomOut());
157
+
158
+    StViewSurface aViewMode = aParams->ViewingMode;
159
     if(aTextures.getPlane(0).getTarget() == GL_TEXTURE_CUBE_MAP) {
160
-        aViewMode = StStereoParams::PANORAMA_CUBEMAP;
161
-    } else if(aViewMode == StStereoParams::PANORAMA_CUBEMAP) {
162
-        aViewMode = StStereoParams::FLAT_IMAGE;
163
+        aViewMode = StViewSurface_Cubemap;
164
+    } else if(aViewMode == StViewSurface_Cubemap) {
165
+        aViewMode = StViewSurface_Plain;
166
     }
167
 
168
     myProgram.setColorScale(aColorScale); // apply de-anaglyph color filter
169
@@ -647,8 +694,7 @@
170
                                                 ? StGLImageProgram::FragGetColor_Blend
171
                                                 : StGLImageProgram::FragGetColor_Normal;
172
     switch(aViewMode) {
173
-        default:
174
-        case StStereoParams::FLAT_IMAGE: {
175
+        case StViewSurface_Plain: {
176
             if(!myProgram.init(aCtx, aTextures.getColorModel(), aTextures.getColorScale(), aColorGetter)) {
177
                 break;
178
             }
179
@@ -660,14 +706,6 @@
180
             myProgram.setTextureMainDataSize(aCtx, aClampVec);
181
             myProgram.setTextureUVDataSize  (aCtx, aClampUV);
182
 
183
-            // lenses center correction
184
-            const GLfloat aLestDisp = getRoot()->getLensDist() * GLfloat(getRoot()->getRectPx().ratio());
185
-            if(theView == ST_DRAW_LEFT) {
186
-                aModelMat.translate(StGLVec3( aLestDisp, 0.0f, 0.0f));
187
-            } else {
188
-                aModelMat.translate(StGLVec3(-aLestDisp, 0.0f, 0.0f));
189
-            }
190
-
191
             // handle dragging timer
192
             if( isClicked(ST_MOUSE_LEFT)
193
             && !myIsClickAborted
194
@@ -710,7 +748,7 @@
195
             }
196
 
197
             // apply scale
198
-            aModelMat.scale(aParams->ScaleFactor, aParams->ScaleFactor, 1.0f);
199
+            aModelMat.scale(aParams->ScaleFactor * aVrScale, aParams->ScaleFactor * aVrScale, 1.0f);
200
 
201
sview-16_06.tar.gz/StGLWidgets/StGLMenu.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLMenu.cpp Changed
31
 
1
@@ -137,13 +137,14 @@
2
         } else {
3
             myWidth = stMax(myWidth, anItemW);
4
         }
5
-        if(anItem->getSubMenu() != NULL) {
6
+        if(StGLMenu* aSubMenu = anItem->getSubMenu()) {
7
             if(myOrient == MENU_HORIZONTAL) {
8
-                anItem->getSubMenu()->changeRectPx().moveTopLeftTo(anItem->getRectPxAbsolute().left(), anItem->getRectPxAbsolute().bottom());
9
+                aSubMenu->changeRectPx().moveTopLeftTo(anItem->getRectPxAbsolute().left()   - myRoot->getRectPx().left(),
10
+                                                       anItem->getRectPxAbsolute().bottom() - myRoot->getRectPx().top());
11
             } else if(myOrient == MENU_VERTICAL
12
                    || myOrient == MENU_VERTICAL_COMPACT) {
13
-                anItem->getSubMenu()->changeRectPx().moveTopLeftTo(anItem->getRectPxAbsolute().right() - myRoot->scale(10),
14
-                                                                   anItem->getRectPxAbsolute().top());
15
+                aSubMenu->changeRectPx().moveTopLeftTo(anItem->getRectPxAbsolute().right() - myRoot->scale(10) - myRoot->getRectPx().left(),
16
+                                                       anItem->getRectPxAbsolute().top() - myRoot->getRectPx().top());
17
             }
18
         }
19
     }
20
@@ -163,8 +164,8 @@
21
             anItem->changeRectPx().right() = anItem->getRectPx().left() + aWidth;
22
             anItem->setTextWidth(aWidth);
23
             if(anItem->getSubMenu() != NULL) {
24
-                anItem->getSubMenu()->changeRectPx().moveTopLeftTo(getRectPxAbsolute().right() - myRoot->scale(10),
25
-                                                                   anItem->getRectPxAbsolute().top());
26
+                anItem->getSubMenu()->changeRectPx().moveTopLeftTo(getRectPxAbsolute().right() - myRoot->scale(10) - myRoot->getRectPx().left(),
27
+                                                                   anItem->getRectPxAbsolute().top() - myRoot->getRectPx().top());
28
             }
29
         }
30
         changeRectPx().bottom() = getRectPx().top() + anItemCount * myItemHeight;
31
sview-16_06.tar.gz/StGLWidgets/StGLMenuItem.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLMenuItem.cpp Changed
25
 
1
@@ -154,8 +154,9 @@
2
     StGLTextArea::stglResize();
3
 }
4
 
5
-void StGLMenuItem::stglUpdate(const StPointD_t& theCursorZo) {
6
-    StGLTextArea::stglUpdate(theCursorZo);
7
+void StGLMenuItem::stglUpdate(const StPointD_t& theCursorZo,
8
+                              bool theIsPreciseInput) {
9
+    StGLTextArea::stglUpdate(theCursorZo, theIsPreciseInput);
10
     if(!myIsInitialized || !isVisible()) {
11
         return;
12
     }
13
@@ -324,8 +325,9 @@
14
     //
15
 }
16
 
17
-void StGLPassiveMenuItem::stglUpdate(const StPointD_t& theCursorZo) {
18
-    stglUpdateTextArea(theCursorZo);
19
+void StGLPassiveMenuItem::stglUpdate(const StPointD_t& theCursorZo,
20
+                                     bool theIsPreciseInput) {
21
+    stglUpdateTextArea(theCursorZo, theIsPreciseInput);
22
     if(!myIsInitialized || !isVisible()) {
23
         return;
24
     }
25
sview-16_06.tar.gz/StGLWidgets/StGLMsgStack.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLMsgStack.cpp Changed
13
 
1
@@ -29,8 +29,9 @@
2
     StGLWidget::stglResize();
3
 }
4
 
5
-void StGLMsgStack::stglUpdate(const StPointD_t& thePointZo) {
6
-    StGLWidget::stglUpdate(thePointZo);
7
+void StGLMsgStack::stglUpdate(const StPointD_t& thePointZo,
8
+                              bool theIsPreciseInput) {
9
+    StGLWidget::stglUpdate(thePointZo, theIsPreciseInput);
10
 
11
     // check messages stack
12
     while(myMsgQueue->pop(myMsgTmp)) {
13
sview-16_06.tar.gz/StGLWidgets/StGLOpenFile.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLOpenFile.cpp Changed
13
 
1
@@ -53,9 +53,9 @@
2
     myList->setColor(StGLVec4(0.0f, 0.0f, 0.0f, 0.0f));
3
     myList->setItemWidthMin(myContent->getRectPx().width());
4
 
5
-    if(!myRoot->isMobile()) {
6
+    //if(!myRoot->isMobile()) {
7
         addButton(theCloseText);
8
-    }
9
+    //}
10
 }
11
 
12
 StGLOpenFile::~StGLOpenFile() {
13
sview-16_06.tar.gz/StGLWidgets/StGLPlayList.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLPlayList.cpp Changed
32
 
1
@@ -114,7 +114,7 @@
2
         && anItem->isPointIn(myClickPntZo)) {
3
             // stick to the center
4
             const StRectI_t aRect = anItem->getRectPxAbsolute();
5
-            myClickPntZo.y() = double(aRect.top() + aRect.height() / 2) / double(myRoot->getRectPx().height());
6
+            myClickPntZo.y() = double(aRect.top() + aRect.height() / 2 - myRoot->getRectPx().top()) / double(myRoot->getRectPx().height());
7
             if(toAbort) {
8
                 anItem->setClicked(theBtnId, false);
9
             }
10
@@ -278,9 +278,10 @@
11
     aCtx.core20fwd->glDisable(GL_BLEND);
12
 }
13
 
14
-void StGLPlayList::stglUpdate(const StPointD_t& theCursorZo) {
15
+void StGLPlayList::stglUpdate(const StPointD_t& theCursorZo,
16
+                              bool theIsPreciseInput) {
17
     if(!isVisible()) {
18
-        StGLWidget::stglUpdate(theCursorZo);
19
+        StGLWidget::stglUpdate(theCursorZo, theIsPreciseInput);
20
         return;
21
     }
22
 
23
@@ -345,7 +346,7 @@
24
         }
25
     }
26
 
27
-    StGLWidget::stglUpdate(theCursorZo);
28
+    StGLWidget::stglUpdate(theCursorZo, theIsPreciseInput);
29
 }
30
 
31
 void StGLPlayList::stglDraw(unsigned int theView) {
32
sview-16_06.tar.gz/StGLWidgets/StGLRangeFieldFloat32.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLRangeFieldFloat32.cpp Changed
182
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2013-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2013-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -15,13 +15,27 @@
10
 
11
 StGLRangeFieldFloat32::StGLRangeFieldFloat32(StGLWidget* theParent,
12
                                              const StHandle<StFloat32Param>& theTrackedValue,
13
-                                             const int theLeft, const int theTop,
14
-                                             const StGLCorner theCorner)
15
-: StGLWidget(theParent, theLeft, theTop, theCorner),
16
+                                             int theLeft, int theTop,
17
+                                             StGLCorner theCorner,
18
+                                             RangeStyle theStyle,
19
+                                             int theMargin)
20
+: StGLSeekBar(theParent, theTop, theMargin, theCorner),
21
   myTrackValue(theTrackedValue),
22
   myValueText(NULL),
23
-  myFormat(stCString("%+01.3f")) {
24
-    myTrackValue->signals.onChanged   += stSlot(this, &StGLRangeFieldFloat32::onValueChange);
25
+  myFormat(stCString("%+01.3f")),
26
+  myRangeStyle(theStyle) {
27
+    myRectPx.left()  = theLeft;
28
+    myRectPx.right() = theLeft + 32;
29
+
30
+    if(theStyle == RangeStyle_Seekbar) {
31
+        myColors[FieldColor_Default]  = StGLVec3(1.0f, 1.0f, 1.0f);
32
+        myColors[FieldColor_Positive] = StGLVec3(1.0f, 1.0f, 1.0f);
33
+        myColors[FieldColor_Negative] = StGLVec3(1.0f, 1.0f, 1.0f);
34
+
35
+        signals.onSeekClick = stSlot(this, &StGLRangeFieldFloat32::doSeekClick);
36
+    }
37
+
38
+    myTrackValue->signals.onChanged += stSlot(this, &StGLRangeFieldFloat32::onValueChange);
39
 }
40
 
41
 StGLRangeFieldFloat32::~StGLRangeFieldFloat32() {
42
@@ -33,7 +47,6 @@
43
         return true;
44
     }
45
 
46
-    myValueText = new StGLTextArea(this, 0, 0, StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT), -myRoot->scale(1), myRoot->scale(10));
47
     float aLongVal = 0.0f;
48
     if(myTrackValue->hasMaxValue()) {
49
         aLongVal = myTrackValue->getMaxValue();
50
@@ -42,37 +55,84 @@
51
     && std::abs(myTrackValue->getMinValue()) >= aLongVal) {
52
         aLongVal = myTrackValue->getMinValue();
53
     }
54
-    onValueChange(aLongVal);
55
-    myValueText->setTextColor(StGLVec3(1.0f, 1.0f, 1.0f));
56
-    if(!myValueText->stglInitAutoHeightWidth()) {
57
-        delete myValueText; myValueText = NULL;
58
-        return false;
59
-    }
60
 
61
-    myValueText->changeRectPx().right() += myRoot->scale(10);
62
-    myValueText->setTextWidth(myValueText->getRectPx().width());
63
-    myValueText->setupAlignment(StGLTextFormatter::ST_ALIGN_X_RIGHT, StGLTextFormatter::ST_ALIGN_Y_TOP);
64
-    onValueChange(myTrackValue->getValue());
65
-    const GLint aHeight = myValueText->getRectPx().height();
66
-
67
-    StGLButton* aButDec = new StGLButton(this, 0, 0, "-");
68
-    aButDec->setCorner(StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT));
69
-    aButDec->setHeight(aHeight);
70
-    aButDec->setWidth(myRoot->scale(15));
71
-    aButDec->signals.onBtnClick += stSlot(this, &StGLRangeFieldFloat32::doDecrement);
72
-
73
-    myValueText->changeRectPx().moveLeftTo(aButDec->getRectPx().right() - myRoot->scale(5));
74
-
75
-    StGLButton* aButInc = new StGLButton(this, myValueText->getRectPx().right() + myRoot->scale(5), 0, "+");
76
-    aButInc->setCorner(StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT));
77
-    aButInc->setHeight(aHeight);
78
-    aButInc->setWidth(myRoot->scale(15));
79
-    aButInc->signals.onBtnClick += stSlot(this, &StGLRangeFieldFloat32::doIncrement);
80
+    switch(myRangeStyle) {
81
+        case RangeStyle_PlusMinus: {
82
+            myValueText = new StGLTextArea(this, 0, 0, StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT), -myRoot->scale(1), myRoot->scale(10));
83
+            onValueChange(aLongVal);
84
+            myValueText->setTextColor(StGLVec3(1.0f, 1.0f, 1.0f));
85
+            if(!myValueText->stglInitAutoHeightWidth()) {
86
+                delete myValueText; myValueText = NULL;
87
+                return false;
88
+            }
89
+
90
+            myValueText->changeRectPx().right() += myRoot->scale(10);
91
+            myValueText->setTextWidth(myValueText->getRectPx().width());
92
+            myValueText->setupAlignment(StGLTextFormatter::ST_ALIGN_X_RIGHT, StGLTextFormatter::ST_ALIGN_Y_TOP);
93
+            onValueChange(myTrackValue->getValue());
94
+            const GLint aHeight = myValueText->getRectPx().height();
95
+
96
+            StGLButton* aButDec = new StGLButton(this, 0, 0, "-");
97
+            aButDec->setCorner(StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT));
98
+            aButDec->setHeight(aHeight);
99
+            aButDec->setWidth(myRoot->scale(15));
100
+            aButDec->signals.onBtnClick += stSlot(this, &StGLRangeFieldFloat32::doDecrement);
101
+
102
+            myValueText->changeRectPx().moveLeftTo(aButDec->getRectPx().right() - myRoot->scale(5));
103
+
104
+            StGLButton* aButInc = new StGLButton(this, myValueText->getRectPx().right() + myRoot->scale(5), 0, "+");
105
+            aButInc->setCorner(StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT));
106
+            aButInc->setHeight(aHeight);
107
+            aButInc->setWidth(myRoot->scale(15));
108
+            aButInc->signals.onBtnClick += stSlot(this, &StGLRangeFieldFloat32::doIncrement);
109
+
110
+            changeRectPx().right()  = getRectPx().left() + aButInc->getRectPx().right();
111
+            changeRectPx().bottom() = getRectPx().top()  + aHeight;
112
+
113
+            if(!StGLWidget::stglInit()) {
114
+                return false;
115
+            }
116
+            break;
117
+        }
118
+        case RangeStyle_Seekbar: {
119
+            myValueText = new StGLTextArea(this, 0, 0, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT),
120
+                                           myRectPx.width(), myRectPx.height(), StGLTextArea::SIZE_NORMAL);
121
+            myValueText->setBorder(false);
122
+            myValueText->setDrawShadow(true);
123
+
124
+            onValueChange(aLongVal);
125
+            myValueText->setTextColor(StGLVec3(1.0f, 1.0f, 1.0f));
126
+            myValueText->setupAlignment(StGLTextFormatter::ST_ALIGN_X_CENTER, StGLTextFormatter::ST_ALIGN_Y_CENTER);
127
+            if(!myValueText->stglInit()) {
128
+                delete myValueText; myValueText = NULL;
129
+                return false;
130
+            }
131
+
132
+            onValueChange(myTrackValue->getValue());
133
+
134
+            if(!StGLSeekBar::stglInit()) {
135
+                return false;
136
+            }
137
+            break;
138
+        }
139
+    }
140
+    return true;
141
+}
142
 
143
-    changeRectPx().right()  = getRectPx().left() + aButInc->getRectPx().right();
144
-    changeRectPx().bottom() = getRectPx().top()  + aHeight;
145
+void StGLRangeFieldFloat32::stglResize() {
146
+    if(myRangeStyle == RangeStyle_Seekbar) {
147
+        StGLSeekBar::stglResize();
148
+    } else {
149
+        StGLWidget::stglResize();
150
+    }
151
+}
152
 
153
-    return StGLWidget::stglInit();
154
+void StGLRangeFieldFloat32::stglDraw(unsigned int theView) {
155
+    if(myRangeStyle == RangeStyle_Seekbar) {
156
+        StGLSeekBar::stglDraw(theView);
157
+    } else {
158
+        StGLWidget::stglDraw(theView);
159
+    }
160
 }
161
 
162
 void StGLRangeFieldFloat32::onValueChange(const float theValue) {
163
@@ -88,6 +148,7 @@
164
             myValueText->setTextColor(myColors[FieldColor_Negative]);
165
         }
166
     }
167
+    setProgress(myTrackValue->getNormalizedValue());
168
 }
169
 
170
 void StGLRangeFieldFloat32::doResetValue(const size_t ) {
171
@@ -110,3 +171,10 @@
172
     }
173
     return true;
174
 }
175
+
176
+void StGLRangeFieldFloat32::doSeekClick(const int    theMouseBtn,
177
+                                        const double theValue) {
178
+    if(theMouseBtn == ST_MOUSE_LEFT) {
179
+        myTrackValue->setNormalizedValue((float )theValue, true);
180
+    }
181
+}
182
sview-16_06.tar.gz/StGLWidgets/StGLRootWidget.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLRootWidget.cpp Changed
177
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2009-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -61,12 +61,14 @@
10
   myScaleGlY(1.0),
11
   myScaleGUI(1.0f),
12
   myResolution(72),
13
-  cursorZo(0.0, 0.0),
14
+  myCursorZo(0.0, 0.0),
15
   myFocusWidget(NULL),
16
   myModalDialog(NULL),
17
   myIsMenuPressed(false),
18
   myMenuIconSize(IconSize_16),
19
   myClickThreshold(3) {
20
+    myRectPxFull = getRectPx();
21
+
22
     // unify access
23
     StGLWidget::myRoot = this;
24
     myViewport[0] = 0;
25
@@ -264,11 +266,11 @@
26
     switch(theView) {
27
         case ST_DRAW_LEFT:
28
             myScrDispX   =             myLensDist * GLfloat(0.5 * myRectGl.width());
29
-            myScrDispXPx =  int(double(myLensDist) * 0.5 * double(rectPx.width()));
30
+            myScrDispXPx =  int(double(myLensDist) * 0.5 * double(myRectPxFull.width()));
31
             break;
32
         case ST_DRAW_RIGHT:
33
             myScrDispX   =            -myLensDist * GLfloat(0.5 * myRectGl.width());
34
-            myScrDispXPx = -int(double(myLensDist) * 0.5 * double(rectPx.width()));
35
+            myScrDispXPx = -int(double(myLensDist) * 0.5 * double(myRectPxFull.width()));
36
             break;
37
         case ST_DRAW_MONO:
38
         default:
39
@@ -306,17 +308,18 @@
40
     return myShareArray[theResId];
41
 }
42
 
43
-void StGLRootWidget::stglUpdate(const StPointD_t& theCursorZo) {
44
-    cursorZo = theCursorZo;
45
-    StGLWidget::stglUpdate(theCursorZo);
46
+void StGLRootWidget::stglUpdate(const StPointD_t& theCursorZo,
47
+                                bool theIsPreciseInput) {
48
+    myCursorZo = theCursorZo;
49
+    StGLWidget::stglUpdate(theCursorZo, theIsPreciseInput);
50
 }
51
 
52
 void StGLRootWidget::stglScissorRect(const StRectI_t& theRect,
53
                                      StGLBoxPx&       theScissorRect) const {
54
     const GLint aVPortWidth  = myViewport[2];
55
     const GLint aVPortHeight = myViewport[3];
56
-    const GLint aRootWidth   = getRectPx().width();
57
-    const GLint aRootHeight  = getRectPx().height();
58
+    const GLint aRootWidth   = myRectPxFull.width();
59
+    const GLint aRootHeight  = myRectPxFull.height();
60
     if(aRootWidth <= 0 || aRootHeight <= 0) {
61
         // just prevent division by zero - should never happen
62
         stMemZero(&theScissorRect, sizeof(StGLBoxPx));
63
@@ -327,25 +330,37 @@
64
     const GLdouble aWidthFactor  = GLdouble(aVPortWidth)  / GLdouble(aRootWidth);
65
     const GLdouble aHeightFactor = GLdouble(aVPortHeight) / GLdouble(aRootHeight);
66
 
67
-    theScissorRect.x() = myViewport[0] + GLint(aWidthFactor  * GLdouble(theRect.left())) + myScrDispXPx;
68
+    theScissorRect.x() = myViewport[0] + GLint(aWidthFactor  * GLdouble(theRect.left() + myScrDispXPx));
69
     theScissorRect.y() = myViewport[1] + GLint(aHeightFactor * GLdouble(aRootHeight - theRect.bottom()));
70
 
71
     theScissorRect.width()  = GLint(aWidthFactor  * GLdouble(theRect.width()));
72
     theScissorRect.height() = GLint(aHeightFactor * GLdouble(theRect.height()));
73
 }
74
 
75
-void StGLRootWidget::stglResize(const StGLBoxPx& theRectPx) {
76
-    const bool isChanged = getRectPx().right()  != theRectPx.width()
77
-                        || getRectPx().bottom() != theRectPx.height();
78
-
79
-    myProjCamera.resize(theRectPx.width(), theRectPx.height());
80
-
81
-    changeRectPx().right()  = theRectPx.width();  // (left, top) forced to zero point (0, 0)
82
-    changeRectPx().bottom() = theRectPx.height();
83
+void StGLRootWidget::stglResize(const StGLBoxPx& theViewPort,
84
+                                const StMarginsI& theMargins,
85
+                                float theAspect) {
86
+    const int  aNewSizeX = theViewPort.width();
87
+    const int  aNewSizeY = theViewPort.height();
88
+    const bool isChanged = myRectPxFull.right()  != aNewSizeX
89
+                        || myRectPxFull.bottom() != aNewSizeY
90
+                        || myMarginsPx != theMargins
91
+                        || myProjCamera.getAspect() != theAspect;
92
+    myMarginsPx = theMargins;
93
+    myProjCamera.resize(theAspect);
94
+    myRectPxFull.right()  = aNewSizeX; // (left, top) forced to zero point (0, 0)
95
+    myRectPxFull.bottom() = aNewSizeY;
96
+
97
+    // define working area (shift by margins)
98
+    changeRectPx().left()   = myMarginsPx.left;
99
+    changeRectPx().right()  = aNewSizeX - myMarginsPx.right;
100
+    changeRectPx().top()    = myMarginsPx.top;
101
+    changeRectPx().bottom() = aNewSizeY - myMarginsPx.bottom;
102
 
103
     myProjCamera.getZParams(myRectGl);
104
-    myScaleGlX = (myRectGl.right() - myRectGl.left()) / GLdouble(getRectPx().width());
105
-    myScaleGlY = (myRectGl.top() - myRectGl.bottom()) / GLdouble(getRectPx().height());
106
+    myScaleGlX = (myRectGl.right() - myRectGl.left()) / GLdouble(aNewSizeX);
107
+    myScaleGlY = (myRectGl.top() - myRectGl.bottom()) / GLdouble(aNewSizeY);
108
+    myRectWorkGl = getRectGl(getRectPx());
109
 
110
     myScrProjMat = myProjCamera.getProjMatrix();
111
     myScrProjMat.translate(StGLVec3(0.0f, 0.0f, -myProjCamera.getZScreen()));
112
@@ -383,37 +398,52 @@
113
 
114
 bool StGLRootWidget::tryClick(const StClickEvent& theEvent,
115
                               bool&               theIsItemClicked) {
116
-    const StPointD_t aCursorBack = cursorZo;
117
-    cursorZo = StPointD_t(theEvent.PointX, theEvent.PointY);
118
-    if(isPointIn(cursorZo)) {
119
+    const StPointD_t aCursorBack = myCursorZo;
120
+    myCursorZo = StPointD_t(theEvent.PointX, theEvent.PointY);
121
+    if(isPointIn(myCursorZo)) {
122
         setClicked(theEvent.Button, true);
123
     }
124
-    const bool aResult = StGLWidget::tryClick(theEvent, theIsItemClicked);
125
-    cursorZo = aCursorBack;
126
+
127
+    bool toIgnore = false;
128
+    if(theEvent.Button == ST_MOUSE_LEFT // && theEvent.IsSynthesized
129
+    && myIsMobile) {
130
+        StPointI_t aCursorPx(int(myRoot->getRectPx().width()  * theEvent.PointX),
131
+                             int(myRoot->getRectPx().height() * theEvent.PointY));
132
+        const int aToler = myRoot->scale(8);
133
+        if(aCursorPx.x() < aToler || aCursorPx.x() > (myRoot->getRectPx().width()  - aToler)
134
+        || aCursorPx.y() < aToler || aCursorPx.y() > (myRoot->getRectPx().height() - aToler)) {
135
+            // disallow clicks at the very front of mobile screens;
136
+            // this area is usually handled by special system gestures (e.g. to reveal system bars)
137
+            toIgnore = true;
138
+        }
139
+    }
140
+
141
+    const bool aResult = !toIgnore ? StGLWidget::tryClick(theEvent, theIsItemClicked) : false;
142
+    myCursorZo = aCursorBack;
143
     return aResult;
144
 }
145
 
146
 bool StGLRootWidget::tryUnClick(const StClickEvent& theEvent,
147
                                 bool&               theIsItemUnclicked) {
148
-    const StPointD_t aCursorBack = cursorZo;
149
-    cursorZo = StPointD_t(theEvent.PointX, theEvent.PointY);
150
-    if(isPointIn(cursorZo)) {
151
+    const StPointD_t aCursorBack = myCursorZo;
152
+    myCursorZo = StPointD_t(theEvent.PointX, theEvent.PointY);
153
+    if(isPointIn(myCursorZo)) {
154
         setClicked(theEvent.Button, false);
155
     }
156
 
157
     const bool aResult = StGLWidget::tryUnClick(theEvent, theIsItemUnclicked);
158
     clearDestroyList();
159
-    cursorZo = aCursorBack;
160
+    myCursorZo = aCursorBack;
161
     return aResult;
162
 }
163
 
164
 bool StGLRootWidget::doScroll(const StScrollEvent& theEvent) {
165
-    const StPointD_t aCursorBack = cursorZo;
166
-    cursorZo = StPointD_t(theEvent.PointX, theEvent.PointY);
167
+    const StPointD_t aCursorBack = myCursorZo;
168
+    myCursorZo = StPointD_t(theEvent.PointX, theEvent.PointY);
169
 
170
     const bool aResult = StGLWidget::doScroll(theEvent);
171
     clearDestroyList();
172
-    cursorZo = aCursorBack;
173
+    myCursorZo = aCursorBack;
174
     return aResult;
175
 }
176
 
177
sview-16_06.tar.gz/StGLWidgets/StGLScrollArea.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLScrollArea.cpp Changed
23
 
1
@@ -101,9 +101,10 @@
2
     }
3
 }
4
 
5
-void StGLScrollArea::stglUpdate(const StPointD_t& theCursorZo) {
6
+void StGLScrollArea::stglUpdate(const StPointD_t& theCursorZo,
7
+                                bool theIsPreciseInput) {
8
     if(!isVisible()) {
9
-        StGLWidget::stglUpdate(theCursorZo);
10
+        StGLWidget::stglUpdate(theCursorZo, theIsPreciseInput);
11
         return;
12
     }
13
 
14
@@ -152,7 +153,7 @@
15
         }
16
     }
17
 
18
-    StGLWidget::stglUpdate(theCursorZo);
19
+    StGLWidget::stglUpdate(theCursorZo, theIsPreciseInput);
20
 }
21
 
22
 void StGLScrollArea::stglDraw(unsigned int theView) {
23
sview-16_06.tar.gz/StGLWidgets/StGLSeekBar.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLSeekBar.cpp Changed
46
 
1
@@ -96,16 +96,17 @@
2
 };
3
 
4
 StGLSeekBar::StGLSeekBar(StGLWidget* theParent,
5
-                         const int   theTop,
6
-                         const int   theMargin)
7
-: StGLWidget(theParent, 0, theTop, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT),
8
+                         int theTop,
9
+                         int theMargin,
10
+                         StGLCorner theCorner)
11
+: StGLWidget(theParent, 0, theTop, theCorner,
12
              theParent->getRoot()->scale(512),
13
              theParent->getRoot()->scale(12) + theMargin * 2),
14
   myProgram(new StProgramSB()),
15
   myProgress(0.0f),
16
   myProgressPx(0),
17
   myClickPos(-1),
18
-  myMoveTolerPx(myRoot->scale(myRoot->isMobile() ? 16 : 8)) {
19
+  myMoveTolerPx(0) {
20
     StGLWidget::signals.onMouseClick  .connect(this, &StGLSeekBar::doMouseClick);
21
     StGLWidget::signals.onMouseUnclick.connect(this, &StGLSeekBar::doMouseUnclick);
22
     myMargins.top    = theMargin;
23
@@ -225,16 +226,19 @@
24
     StGLWidget::stglDraw(theView);
25
 }
26
 
27
-void StGLSeekBar::stglUpdate(const StPointD_t& theCursor) {
28
-    StGLWidget::stglUpdate(theCursor);
29
+void StGLSeekBar::stglUpdate(const StPointD_t& theCursor,
30
+                             bool theIsPreciseInput) {
31
+    StGLWidget::stglUpdate(theCursor, theIsPreciseInput);
32
     if(!isClicked(ST_MOUSE_LEFT)) {
33
         return;
34
     }
35
 
36
     const double aPos   = stMin(stMax(getPointInEx(theCursor), 0.0), 1.0);
37
     const int    aPosPx = int(aPos * double(getRectPx().width()));
38
+
39
+    const int aMoveTolerPx = myMoveTolerPx > 0 ? myMoveTolerPx : myRoot->scale(theIsPreciseInput ? 1 : 2);
40
     if(myClickPos >= 0
41
-    && std::abs(aPosPx - myClickPos) < myMoveTolerPx) {
42
+    && std::abs(aPosPx - myClickPos) < aMoveTolerPx) {
43
         return;
44
     }
45
 
46
sview-16_06.tar.gz/StGLWidgets/StGLSubtitles.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLSubtitles.cpp Changed
29
 
1
@@ -229,7 +229,8 @@
2
     return StGLTextArea::stglInit();
3
 }
4
 
5
-void StGLSubtitles::stglUpdate(const StPointD_t& ) {
6
+void StGLSubtitles::stglUpdate(const StPointD_t& ,
7
+                               bool ) {
8
     bool isChanged = myShowItems.pop(myPTS);
9
     for(StHandle<StSubItem> aNewSubItem = myQueue->pop(myPTS); !aNewSubItem.isNull(); aNewSubItem = myQueue->pop(myPTS)) {
10
         isChanged = true;
11
@@ -241,7 +242,7 @@
12
     myCorner.v = aCorner;
13
     switch(myCorner.v) {
14
         case ST_VCORNER_TOP: {
15
-            const int aDisp = myRoot->scale((int )myTopDY->getValue());
16
+            const int aDisp = myRoot->scale((int )myTopDY->getValue()) + myRoot->getRootMargins().top;
17
             if(getRectPx().top() != aDisp) {
18
                 toResize = true;
19
                 changeRectPx().moveTopTo(aDisp);
20
@@ -260,7 +261,7 @@
21
             break;
22
         }
23
         case ST_VCORNER_BOTTOM: {
24
-            const int aDisp = -myRoot->scale((int )myBottomDY->getValue());
25
+            const int aDisp = -myRoot->scale((int )myBottomDY->getValue()) - myRoot->getRootMargins().bottom;
26
             if(getRectPx().top() != aDisp) {
27
                 toResize = true;
28
                 changeRectPx().moveTopTo(aDisp);
29
sview-16_06.tar.gz/StGLWidgets/StGLTextArea.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLTextArea.cpp Changed
27
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -179,7 +179,7 @@
10
         || !myFont->changeFont()->getFont()->isValid()) {
11
             return false; // critical error
12
         } else if(!myFont->stglInit(aCtx)) {
13
-            ST_ERROR_LOG("Could not initialize OpenGL resources for font");
14
+            aCtx.pushError(StString("Could not initialize OpenGL resources for font"));
15
             return false;
16
         }
17
     } else if(!myFont->changeFont()->isValid()) {
18
@@ -274,7 +274,7 @@
19
 
20
     // size corrector for FTGL
21
     StRectD_t zparams; getCamera()->getZParams(zparams);
22
-    GLfloat aSizeOut = 2.0f * GLfloat(zparams.top()) / GLfloat(getRoot()->getRectPx().height());
23
+    GLfloat aSizeOut = 2.0f * GLfloat(zparams.top()) / GLfloat(getRoot()->getRootFullSizeY());
24
 
25
     StGLMatrix aModelMat;
26
     aModelMat.translate(StGLVec3(getRoot()->getScreenDispX() + myTextDX, 0.0f, -getCamera()->getZScreen()));
27
sview-16_06.tar.gz/StGLWidgets/StGLTextureButton.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLTextureButton.cpp Changed
57
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -16,6 +16,7 @@
10
 #include <StGLCore/StGLCore20.h>
11
 
12
 #include <StAV/StAVImage.h>
13
+#include <StSlots/StAction.h>
14
 #include <StThreads/StProcess.h>
15
 
16
 /**
17
@@ -304,6 +305,10 @@
18
     }
19
 }
20
 
21
+void StGLTextureButton::setAction(const StHandle<StAction>& theAction) {
22
+    myAction = theAction;
23
+}
24
+
25
 void StGLTextureButton::setTexturePath(const StString* theTexturesPaths,
26
                                        const size_t    theCount) {
27
     const size_t aNbTextures = (theCount > myTextures->size()) ? myTextures->size() : theCount;
28
@@ -443,7 +448,8 @@
29
     return true;
30
 }
31
 
32
-void StGLTextureButton::stglUpdate(const StPointD_t& theCursorZo) {
33
+void StGLTextureButton::stglUpdate(const StPointD_t& theCursorZo,
34
+                                   bool theIsPreciseInput) {
35
     if(!isVisible()) {
36
         return;
37
     }
38
@@ -474,7 +480,7 @@
39
             myAnimTime = 0.0f;
40
         }
41
     }
42
-    StGLWidget::stglUpdate(theCursorZo);
43
+    StGLWidget::stglUpdate(theCursorZo, theIsPreciseInput);
44
 }
45
 
46
 void StGLTextureButton::stglDraw(unsigned int ) {
47
@@ -545,6 +551,9 @@
48
 
49
 void StGLTextureButton::doMouseUnclick(const int theBtnId) {
50
     if(theBtnId == ST_MOUSE_LEFT) {
51
+        if(!myAction.isNull()) {
52
+            myAction->doTrigger(NULL);
53
+        }
54
         signals.onBtnClick(getUserData());
55
     }
56
 }
57
sview-16_06.tar.gz/StGLWidgets/StGLWidget.cpp -> sview-17_04.tar.gz/StGLWidgets/StGLWidget.cpp Changed
201
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -26,8 +26,8 @@
10
   myChildren(),
11
   myPrev(NULL),
12
   myNext(NULL),
13
-  userData(0),
14
-  rectPx(theTop, theTop + theHeight, theLeft, theLeft + theWidth),
15
+  myUserData(0),
16
+  myRectPx(theTop, theTop + theHeight, theLeft, theLeft + theWidth),
17
   myCorner(theCorner),
18
   myOpacity(1.0f),
19
   myIsResized(true),
20
@@ -36,7 +36,7 @@
21
     if(myParent != NULL) {
22
         myParent->getChildren()->add(this);
23
     }
24
-    stMemSet(mouseClicked, 0, sizeof(mouseClicked));
25
+    stMemSet(myMouseClicked, 0, sizeof(myMouseClicked));
26
 }
27
 
28
 StGLWidget::~StGLWidget() {
29
@@ -54,10 +54,10 @@
30
 
31
 void StGLWidget::destroyChildren() {
32
     // remove own children
33
-    for(StGLWidget *child(myChildren.getStart()), *deleteChild(NULL); child != NULL;) {
34
-        deleteChild = child;
35
-        child = child->getNext();
36
-        delete deleteChild;
37
+    for(StGLWidget* aChildIter = myChildren.getStart(); aChildIter != NULL;) {
38
+        const StGLWidget* aDeleteChild = aChildIter;
39
+        aChildIter = aChildIter->getNext();
40
+        delete aDeleteChild;
41
     }
42
 }
43
 
44
@@ -118,10 +118,10 @@
45
 
46
 /**
47
  * Helper function to convert relative coordinates to absolute.
48
- * @param theParentRect (const StRectI_t& ) - parent widget absolute position;
49
- * @param theChildRect  (const StRectI_t& ) - child widget position relative to parent;
50
- * @param theCorner     (const StGLCorner ) - corner modifier for child widget relative to parent;
51
- * @return child widget absolute position.
52
+ * @param theParentRect parent widget absolute position
53
+ * @param theChildRect  child widget position relative to parent
54
+ * @param theCorner     corner modifier for child widget relative to parent
55
+ * @return child widget absolute position
56
  */
57
 inline StRectI_t computeAbsolutePos(const StRectI_t& theParentRect,
58
                                     const StRectI_t& theChildRect,
59
@@ -157,9 +157,9 @@
60
 
61
 StRectI_t StGLWidget::getRectPxAbsolute() const {
62
     if(myParent == NULL) {
63
-        return rectPx;
64
+        return myRectPx;
65
     }
66
-    return computeAbsolutePos(myParent->getRectPxAbsolute(), rectPx, myCorner);
67
+    return computeAbsolutePos(myParent->getRectPxAbsolute(), myRectPx, myCorner);
68
 }
69
 
70
 StRectI_t StGLWidget::getAbsolute(const StRectI_t& theRectPx) const {
71
@@ -174,8 +174,8 @@
72
 }
73
 
74
 StPointD_t StGLWidget::getPointGl(const StPointD_t& thePointZo) const {
75
-    double oglWidth  = myRoot->getRootRectGl().right() - myRoot->getRootRectGl().left();
76
-    double oglHeight = myRoot->getRootRectGl().top() - myRoot->getRootRectGl().bottom();
77
+    double oglWidth  = myRoot->getRootWorkRectGl().right() - myRoot->getRootWorkRectGl().left();
78
+    double oglHeight = myRoot->getRootWorkRectGl().top() - myRoot->getRootWorkRectGl().bottom();
79
     return StPointD_t((thePointZo.x() - 0.5) * oglWidth,
80
                       (0.5 - thePointZo.y()) * oglHeight);
81
 }
82
@@ -209,63 +209,64 @@
83
     return myValue;
84
 }
85
 
86
-void StGLWidget::stglUpdate(const StPointD_t& cursorZo) {
87
+void StGLWidget::stglUpdate(const StPointD_t& theCursorZo,
88
+                            bool theIsPreciseInput) {
89
     if(!isVisible()) {
90
         return;
91
     }
92
 
93
-    for(StGLWidget *child(myChildren.getStart()), *childActive(NULL); child != NULL;) {
94
-        childActive = child;
95
-        child = child->getNext();
96
-        childActive->stglUpdate(cursorZo);
97
+    for(StGLWidget* aChildIter = myChildren.getStart(); aChildIter != NULL;) {
98
+        StGLWidget* aChildActive = aChildIter;
99
+        aChildIter = aChildIter->getNext();
100
+        aChildActive->stglUpdate(theCursorZo, theIsPreciseInput);
101
     }
102
 }
103
 
104
 void StGLWidget::stglResize() {
105
-    for(StGLWidget *child(myChildren.getStart()), *childActive(NULL); child != NULL;) {
106
-        childActive = child;
107
-        child = child->getNext();
108
-        childActive->stglResize();
109
+    for(StGLWidget* aChildIter = myChildren.getStart(); aChildIter != NULL;) {
110
+        StGLWidget* aChildActive = aChildIter;
111
+        aChildIter = aChildIter->getNext();
112
+        aChildActive->stglResize();
113
     }
114
     myIsResized = false;
115
 }
116
 
117
 bool StGLWidget::stglInit() {
118
-    bool success = true;
119
-    for(StGLWidget *child(myChildren.getStart()), *childActive(NULL); child != NULL;) {
120
-        childActive = child;
121
-        child = child->getNext();
122
-        success = childActive->stglInit() && success;
123
+    bool isSuccess = true;
124
+    for(StGLWidget* aChildIter = myChildren.getStart(); aChildIter != NULL;) {
125
+        StGLWidget* aChildActive = aChildIter;
126
+        aChildIter = aChildIter->getNext();
127
+        isSuccess = aChildActive->stglInit() && isSuccess;
128
     }
129
-    return success;
130
+    return isSuccess;
131
 }
132
 
133
-void StGLWidget::stglDraw(unsigned int view) {
134
+void StGLWidget::stglDraw(unsigned int theView) {
135
     if(!isVisible()) {
136
         return;
137
     }
138
-    for(StGLWidget *child(myChildren.getStart()), *childActive(NULL); child != NULL;) {
139
-        childActive = child;
140
-        child = child->getNext();
141
-        childActive->stglDraw(view);
142
+    for(StGLWidget* aChildIter = myChildren.getStart(); aChildIter != NULL;) {
143
+        StGLWidget* aChildActive = aChildIter;
144
+        aChildIter = aChildIter->getNext();
145
+        aChildActive->stglDraw(theView);
146
     }
147
 }
148
 
149
-bool StGLWidget::isClicked(const int& mouseBtn) const {
150
-    if(mouseBtn > ST_MOUSE_MAX_ID) {
151
+bool StGLWidget::isClicked(int theMouseBtn) const {
152
+    if(theMouseBtn > ST_MOUSE_MAX_ID) {
153
         // ignore out of range buttons
154
         return false;
155
     }
156
-    return mouseClicked[mouseBtn];
157
+    return myMouseClicked[theMouseBtn];
158
 }
159
 
160
-void StGLWidget::setClicked(const int& mouseBtn, bool isClicked) {
161
-    if(mouseBtn > ST_MOUSE_MAX_ID) {
162
+void StGLWidget::setClicked(int theMouseBtn, bool theIsClicked) {
163
+    if(theMouseBtn > ST_MOUSE_MAX_ID) {
164
         // ignore out of range buttons
165
-        ST_DEBUG_LOG("StGLWidget, mouse button click #" + mouseBtn + " ignored!");
166
+        ST_DEBUG_LOG("StGLWidget, mouse button click #" + theMouseBtn + " ignored!");
167
         return;
168
     }
169
-    mouseClicked[mouseBtn] = isClicked;
170
+    myMouseClicked[theMouseBtn] = theIsClicked;
171
 }
172
 
173
 bool StGLWidget::tryClick(const StClickEvent& theEvent,
174
@@ -274,9 +275,9 @@
175
         return false;
176
     }
177
 
178
-    for(StGLWidget *aChildIter(myChildren.getLast()), *aChildActive(NULL); aChildIter != NULL;) {
179
-        aChildActive = aChildIter;
180
-        aChildIter   = aChildIter->getPrev();
181
+    for(StGLWidget* aChildIter = myChildren.getLast(); aChildIter != NULL;) {
182
+        StGLWidget* aChildActive = aChildIter;
183
+        aChildIter = aChildIter->getPrev();
184
         aChildActive->tryClick(theEvent, theIsItemClicked);
185
     }
186
     if(!theIsItemClicked && isPointIn(StPointD_t(theEvent.PointX, theEvent.PointY))) {
187
@@ -293,8 +294,8 @@
188
         return false;
189
     }
190
 
191
-    for(StGLWidget *aChildIter(myChildren.getLast()), *aChildActive(NULL); aChildIter != NULL;) {
192
-        aChildActive = aChildIter;
193
+    for(StGLWidget* aChildIter = myChildren.getLast(); aChildIter != NULL;) {
194
+        StGLWidget* aChildActive = aChildIter;
195
         aChildIter   = aChildIter->getPrev();
196
         aChildActive->tryUnClick(theEvent, theIsItemUnclicked);
197
     }
198
@@ -328,9 +329,9 @@
199
     }
200
 
201
sview-16_06.tar.gz/StGLWidgets/StGLWidgets.rc -> sview-17_04.tar.gz/StGLWidgets/StGLWidgets.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "OpenGL Widgets library\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2009-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2009-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StGLWidgets\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StImageViewer/StImageLoader.cpp -> sview-17_04.tar.gz/StImageViewer/StImageLoader.cpp Changed
72
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StImageViewer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -63,7 +63,10 @@
9
   myTextureQueue(theTextureQueue),
10
   myMsgQueue(theMsgQueue),
11
   myImageLib(theImageLib),
12
-  myAction(Action_NONE) {
13
+  myAction(Action_NONE),
14
+  myToStickPano360(false),
15
+  myToFlipCubeZ6x1(false),
16
+  myToFlipCubeZ3x2(false) {
17
       myPlayList->setExtensions(myMimeList.getExtensionsList());
18
       myThread = new StThread(threadFunction, (void* )this, "StImageLoader");
19
 }
20
@@ -235,7 +238,6 @@
21
 
22
     StTimer aLoadTimer(true);
23
     StFormat  aSrcFormatCurr = myStFormatByUser;
24
-    StCubemap aSrcCubemap    = theParams->ViewingMode == StStereoParams::PANORAMA_CUBEMAP ? StCubemap_Packed : StCubemap_OFF;
25
     if(anImgType == StImageFile::ST_TYPE_MPO
26
     || anImgType == StImageFile::ST_TYPE_JPEG
27
     || anImgType == StImageFile::ST_TYPE_JPS) {
28
@@ -422,14 +424,32 @@
29
             aSizeY1   /= 2;
30
         }
31
     }
32
+
33
+    if(!anImageFileR->isNull()) {
34
+        aSrcFormatCurr = StFormat_SeparateFrames;
35
+    }
36
+
37
+    if(myToStickPano360
38
+    && theParams->ViewingMode == StViewSurface_Plain) {
39
+        StPanorama aPano = st::probePanorama(aSrcFormatCurr,
40
+                                             theParams->Src1SizeX, theParams->Src1SizeY,
41
+                                             theParams->Src2SizeX, theParams->Src2SizeY);
42
+        theParams->ViewingMode = (aPano == StPanorama_Cubemap6_1 || aPano == StPanorama_Cubemap3_2)
43
+                               ? StViewSurface_Cubemap
44
+                               : StViewSurface_Sphere;
45
+    }
46
+    StCubemap aSrcCubemap = theParams->ViewingMode == StViewSurface_Cubemap ? StCubemap_Packed : StCubemap_OFF;
47
+
48
     size_t aCubeCoeffs[2] = {0, 0};
49
     if(aSrcCubemap == StCubemap_Packed) {
50
         if(aSizeX1 / 6 == aSizeY1) {
51
             aCubeCoeffs[0] = 6;
52
             aCubeCoeffs[1] = 1;
53
+            theParams->ToFlipCubeZ = myToFlipCubeZ6x1;
54
         } else if(aSizeX1 / 3 == aSizeY1 / 2) {
55
             aCubeCoeffs[0] = 3;
56
             aCubeCoeffs[1] = 2;
57
+            theParams->ToFlipCubeZ = myToFlipCubeZ3x2;
58
         }
59
         if(!anImageFileR->isNull()
60
         && (aSizeX1 != aSizeX2 || aSizeY1 != aSizeY2)) {
61
@@ -467,10 +487,6 @@
62
     // finally push image data in Texture Queue
63
     myTextureQueue->setConnectedStream(true);
64
 
65
-    if(!anImageR->isNull()) {
66
-        aSrcFormatCurr = StFormat_SeparateFrames;
67
-    }
68
-
69
     {
70
         StImage anImageRefL, anImageRefR;
71
         StHandle<StBufferCounter> aRefL = new StImageFileCounter(anImageL);
72
sview-16_06.tar.gz/StImageViewer/StImageLoader.h -> sview-17_04.tar.gz/StImageViewer/StImageLoader.h Changed
46
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StImageViewer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -134,6 +134,27 @@
9
      */
10
     ST_LOCAL void setCompressMemory(const bool theToCompress);
11
 
12
+    /**
13
+     * Stick to panorama 360 mode.
14
+     */
15
+    ST_LOCAL void setStickPano360(bool theToStick) {
16
+        myToStickPano360 = theToStick;
17
+    }
18
+
19
+    /**
20
+     * Flip Z within 6x1 cubemap input.
21
+     */
22
+    ST_LOCAL void setFlipCubeZ6x1(bool theToFlip) {
23
+        myToFlipCubeZ6x1 = theToFlip;
24
+    }
25
+
26
+    /**
27
+     * Flip Z within 3x2 cubemap input.
28
+     */
29
+    ST_LOCAL void setFlipCubeZ3x2(bool theToFlip) {
30
+        myToFlipCubeZ3x2 = theToFlip;
31
+    }
32
+
33
         public:  //! @name Signals
34
 
35
     struct {
36
@@ -191,6 +212,9 @@
37
 
38
     volatile StImageFile::ImageClass myImageLib;
39
     volatile Action            myAction;
40
+    volatile bool              myToStickPano360; //!< stick to panorama 360 mode
41
+    volatile bool              myToFlipCubeZ6x1; //!< flip Z within 6x1 cubemap input
42
+    volatile bool              myToFlipCubeZ3x2; //!< flip Z within 3x2 cubemap input
43
 
44
         private: //! @name no copies, please
45
 
46
sview-16_06.tar.gz/StImageViewer/StImageViewer.cpp -> sview-17_04.tar.gz/StImageViewer/StImageViewer.cpp Changed
201
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StImageViewer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -66,6 +66,7 @@
9
     static const char ST_ARGUMENT_FILE_LEFT[]  = "left";
10
     static const char ST_ARGUMENT_FILE_RIGHT[] = "right";
11
     static const char ST_ARGUMENT_FILE_LAST[]  = "last";
12
+    static const char ST_ARGUMENT_FILE_DEMO[]  = "demo";
13
 
14
     static const char ST_ARGUMENT_MONITOR[]    = "monitorId";
15
     static const char ST_ARGUMENT_WINLEFT[]    = "windowLeft";
16
@@ -100,12 +101,19 @@
17
     params.LastUpdateDay->setName(tr(MENU_HELP_UPDATES));
18
     params.SrcStereoFormat->setName(tr(MENU_MEDIA_SRC_FORMAT));
19
     params.ToShowPlayList->setName(tr(PLAYLIST));
20
+    params.ToShowAdjustImage->setName(tr(MENU_VIEW_IMAGE_ADJUST));
21
+    params.ToStickPanorama->setName(tr(MENU_VIEW_STICK_PANORAMA360));
22
+    params.ToFlipCubeZ6x1->setName(tr(MENU_VIEW_FLIPZ_CUBE6x1));
23
+    params.ToFlipCubeZ3x2->setName(tr(MENU_VIEW_FLIPZ_CUBE3x2));
24
     params.ToTrackHead->setName(tr(MENU_VIEW_TRACK_HEAD));
25
     params.ToShowFps->setName(tr(MENU_SHOW_FPS));
26
     params.ToShowMenu->setName(stCString("Show main menu"));
27
     params.ToShowTopbar->setName(stCString("Show top toolbar"));
28
     params.IsMobileUI->setName(stCString("Mobile UI"));
29
+    params.ToHideStatusBar->setName("Hide system status bar");
30
+    params.ToHideNavBar   ->setName(tr(OPTION_HIDE_NAVIGATION_BAR));
31
     params.IsVSyncOn->setName(tr(MENU_VSYNC));
32
+    params.ToOpenLast->setName(tr(OPTION_OPEN_LAST_ON_STARTUP));
33
     params.ToSaveRecent->setName(stCString("Remember recent file"));
34
     params.TargetFps->setName(stCString("FPS Target"));
35
     myLangMap->params.language->setName(tr(MENU_HELP_LANGS));
36
@@ -156,15 +164,30 @@
37
     params.SrcStereoFormat->signals.onChanged.connect(this, &StImageViewer::doSwitchSrcFormat);
38
     params.ToShowPlayList   = new StBoolParamNamed(false, stCString("showPlaylist"));
39
     params.ToShowPlayList->signals.onChanged = stSlot(this, &StImageViewer::doShowPlayList);
40
+    params.ToShowAdjustImage = new StBoolParamNamed(false, stCString("showAdjustImage"));
41
+    params.ToShowAdjustImage->signals.onChanged = stSlot(this, &StImageViewer::doShowAdjustImage);
42
+    params.ToStickPanorama = new StBoolParamNamed(false, stCString("toStickPano360"));
43
+    params.ToStickPanorama->signals.onChanged = stSlot(this, &StImageViewer::doChangeStickPano360);
44
+    params.ToFlipCubeZ6x1= new StBoolParamNamed(true,  stCString("toFlipCube6x1"));
45
+    params.ToFlipCubeZ6x1->signals.onChanged = stSlot(this, &StImageViewer::doChangeFlipCubeZ);
46
+    params.ToFlipCubeZ3x2= new StBoolParamNamed(false, stCString("toFlipCube3x2"));
47
+    params.ToFlipCubeZ3x2->signals.onChanged = stSlot(this, &StImageViewer::doChangeFlipCubeZ);
48
     params.ToTrackHead   = new StBoolParamNamed(true,  stCString("toTrackHead"));
49
     params.ToShowFps     = new StBoolParamNamed(false, stCString("toShowFps"));
50
     params.ToShowMenu    = new StBoolParamNamed(true,  stCString("toShowMenu"));
51
     params.ToShowTopbar  = new StBoolParamNamed(true,  stCString("toShowTopbar"));
52
     params.IsMobileUI    = new StBoolParamNamed(StWindow::isMobile(), stCString("isMobileUI"));
53
-    params.IsMobileUI->signals.onChanged = stSlot(this, &StImageViewer::doScaleHiDPI);
54
+    params.IsMobileUI->signals.onChanged = stSlot(this, &StImageViewer::doChangeMobileUI);
55
+    params.IsMobileUISwitch = new StBoolParam(params.IsMobileUI->getValue());
56
+    params.IsMobileUISwitch->signals.onChanged = stSlot(this, &StImageViewer::doScaleHiDPI);
57
+    params.ToHideStatusBar = new StBoolParamNamed(true, stCString("toHideStatusBar"));
58
+    params.ToHideStatusBar->signals.onChanged = stSlot(this, &StImageViewer::doHideSystemBars);
59
+    params.ToHideNavBar    = new StBoolParamNamed(true, stCString("toHideNavBar"));
60
+    params.ToHideNavBar   ->signals.onChanged = stSlot(this, &StImageViewer::doHideSystemBars);
61
     params.IsVSyncOn     = new StBoolParamNamed(true,  stCString("vsync"));
62
     params.IsVSyncOn->signals.onChanged = stSlot(this, &StImageViewer::doSwitchVSync);
63
     StApplication::params.VSyncMode->setValue(StGLContext::VSync_ON);
64
+    params.ToOpenLast   = new StBoolParamNamed(false, stCString("toOpenLast"));
65
     params.ToSaveRecent = new StBoolParamNamed(false, stCString("toSaveRecent"));
66
     params.imageLib = StImageFile::ST_LIBAV,
67
     params.TargetFps = new StInt32ParamNamed(0, stCString("fpsTarget"));
68
@@ -179,11 +202,18 @@
69
     mySettings->loadString(ST_SETTING_LAST_FOLDER,        params.lastFolder);
70
     mySettings->loadParam (params.LastUpdateDay);
71
     mySettings->loadParam (params.CheckUpdatesDays);
72
+    mySettings->loadParam (params.ToStickPanorama);
73
+    mySettings->loadParam (params.ToFlipCubeZ6x1);
74
+    mySettings->loadParam (params.ToFlipCubeZ3x2);
75
     myToCheckPoorOrient = !mySettings->loadParam(params.ToTrackHead);
76
     mySettings->loadParam (params.ToShowFps);
77
     mySettings->loadParam (params.IsMobileUI);
78
+    mySettings->loadParam (params.ToHideStatusBar);
79
+    mySettings->loadParam (params.ToHideNavBar);
80
+    mySettings->loadParam (params.ToOpenLast);
81
     mySettings->loadParam (params.IsVSyncOn);
82
     mySettings->loadParam (params.ToShowPlayList);
83
+    mySettings->loadParam (params.ToShowAdjustImage);
84
 
85
     int32_t aSlideShowDelayInt = int32_t(mySlideShowDelay);
86
     mySettings->loadInt32 (ST_SETTING_SLIDESHOW_DELAY,    aSlideShowDelayInt);
87
@@ -204,7 +234,8 @@
88
 
89
     // no need in Depth buffer
90
     const StWinAttr anAttribs[] = {
91
-        StWinAttr_GlDepthSize, (StWinAttr )0,
92
+        StWinAttr_GlDepthSize,   (StWinAttr )0,
93
+        StWinAttr_GlStencilSize, (StWinAttr )0,
94
         StWinAttr_NULL
95
     };
96
     for(size_t aRendIter = 0; aRendIter < myRenderers.size(); ++aRendIter) {
97
@@ -314,11 +345,18 @@
98
         mySettings->saveParam(params.LastUpdateDay);
99
         mySettings->saveParam(params.CheckUpdatesDays);
100
         mySettings->saveString(ST_SETTING_IMAGELIB,  StImageFile::imgLibToString(params.imageLib));
101
+        mySettings->saveParam (params.ToStickPanorama);
102
+        mySettings->saveParam (params.ToFlipCubeZ6x1);
103
+        mySettings->saveParam (params.ToFlipCubeZ3x2);
104
         mySettings->saveParam (params.ToTrackHead);
105
         mySettings->saveParam (params.ToShowFps);
106
         mySettings->saveParam (params.IsMobileUI);
107
+        mySettings->saveParam (params.ToHideStatusBar);
108
+        mySettings->saveParam (params.ToHideNavBar);
109
+        mySettings->saveParam (params.ToOpenLast);
110
         mySettings->saveParam (params.IsVSyncOn);
111
         mySettings->saveParam (params.ToShowPlayList);
112
+        mySettings->saveParam (params.ToShowAdjustImage);
113
         if(myToSaveSrcFormat) {
114
             mySettings->saveParam(params.SrcStereoFormat);
115
         }
116
@@ -332,7 +370,7 @@
117
 
118
     StString aLastL, aLastR;
119
     StHandle<StFileNode> aFile = myPlayList->getCurrentFile();
120
-    if(params.ToSaveRecent->getValue()
121
+    if((params.ToSaveRecent->getValue() || params.ToOpenLast->getValue())
122
     && !aFile.isNull()) {
123
         if(aFile->isEmpty()) {
124
             aLastL = aFile->getPath();
125
@@ -389,6 +427,7 @@
126
     myGUI->myImage->getTextureQueue()->setDeviceCaps(aDevCaps);
127
 
128
     // load settings
129
+    doChangeMobileUI(params.IsMobileUI->getValue());
130
     myWindow->setTargetFps(double(params.TargetFps->getValue()));
131
     mySettings->loadParam (myGUI->myImage->params.DisplayMode);
132
     mySettings->loadParam (myGUI->myImage->params.TextureFilter);
133
@@ -407,7 +446,7 @@
134
         return false;
135
     }
136
     myGUI->stglInit();
137
-    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER));
138
+    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER), myWindow->getMargins(), (float )myWindow->stglAspectRatio());
139
 
140
     for(size_t anIter = 0; anIter < myGUI->myImage->getActions().size(); ++anIter) {
141
         StHandle<StAction>& anAction = myGUI->myImage->changeActions()[anIter];
142
@@ -457,6 +496,7 @@
143
     }
144
 
145
     // create the image loader thread
146
+    myWindow->setHideSystemBars(params.ToHideStatusBar->getValue(), params.ToHideNavBar->getValue());
147
     if(isReset) {
148
         if(params.IsFullscreen->getValue()) {
149
             myWindow->setFullScreen(true);
150
@@ -471,6 +511,9 @@
151
                                  myGUI->myImage->getTextureQueue(), myContext->getMaxTextureSize());
152
     myLoader->signals.onLoaded.connect(this, &StImageViewer::doLoaded);
153
     myLoader->setCompressMemory(myWindow->isMobile());
154
+    myLoader->setStickPano360(params.ToStickPanorama->getValue());
155
+    myLoader->setFlipCubeZ6x1(params.ToFlipCubeZ6x1->getValue());
156
+    myLoader->setFlipCubeZ3x2(params.ToFlipCubeZ3x2->getValue());
157
 
158
     // load this parameter AFTER image thread creation
159
     mySettings->loadParam(params.SrcStereoFormat);
160
@@ -606,9 +649,11 @@
161
 
162
     parseArguments(myOpenFileInfo->getArgumentsMap());
163
     const StMIME anOpenMIME = myOpenFileInfo->getMIME();
164
-    if(myOpenFileInfo->getPath().isEmpty()) {
165
-        const StArgument anArgLast = myOpenFileInfo->getArgumentsMap()[ST_ARGUMENT_FILE_LAST];
166
-        if(anArgLast.isValid() && !anArgLast.isValueOff()) {
167
+    const StArgument anArgLast     = myOpenFileInfo->getArgumentsMap()[ST_ARGUMENT_FILE_LAST];
168
+    const StArgument anArgFileDemo = myOpenFileInfo->getArgumentsMap()[ST_ARGUMENT_FILE_DEMO];
169
+    const bool toOpenLast = anArgLast.isValid() ? !anArgLast.isValueOff() : params.ToOpenLast->getValue();
170
+    if(myOpenFileInfo->getPath().isEmpty() || (toOpenLast && anArgFileDemo.isValid())) {
171
+        if(toOpenLast) {
172
             StString aLastL, aLastR;
173
             mySettings->loadString(ST_SETTING_RECENT_L, aLastL);
174
             mySettings->loadString(ST_SETTING_RECENT_R, aLastR);
175
@@ -672,7 +717,14 @@
176
         return;
177
     }
178
 
179
-    myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER));
180
+    const StMarginsI& aMargins = myWindow->getMargins();
181
+    const bool wasMobileGui = myGUI->isMobile();
182
+    const bool toMobileGui  = toUseMobileUI(aMargins);
183
+    if(toMobileGui != wasMobileGui) {
184
+        doChangeMobileUI(params.IsMobileUI->getValue());
185
+    } else {
186
+        myGUI->stglResize(myWindow->stglViewport(ST_WIN_MASTER), myWindow->getMargins(), (float )myWindow->stglAspectRatio());
187
+    }
188
 }
189
 
190
 void StImageViewer::doImageAdjustReset(const size_t ) {
191
@@ -995,14 +1047,15 @@
192
 }
193
 
194
 void StImageViewer::stglDraw(unsigned int theView) {
195
-    if( myContext.isNull()
196
-    || !myContext->isBound()) {
197
+    const bool hasCtx = !myContext.isNull() && myContext->isBound();
198
+    if(!hasCtx || myWindow->isPaused()) {
199
         if(theView == ST_DRAW_LEFT
200
         || theView == ST_DRAW_MONO) {
201
sview-16_06.tar.gz/StImageViewer/StImageViewer.h -> sview-17_04.tar.gz/StImageViewer/StImageViewer.h Changed
81
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StImageViewer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -93,7 +93,7 @@
9
         public: //! @name callback Slots
10
 
11
     ST_LOCAL void doOpen1FileFromGui(StHandle<StString> thePath);
12
-    ST_LOCAL void doOpen1FileDialog(const size_t dummy = 0);
13
+    ST_LOCAL void doOpen1FileAction(const size_t dummy = 0);
14
     ST_LOCAL void doOpen2FilesDialog(const size_t dummy = 0);
15
     ST_LOCAL void doSaveImageAs(const size_t theImgType) { myLoader->doSaveImageAs(theImgType); }
16
     ST_LOCAL void doSaveImageInfo(const size_t theToSave);
17
@@ -131,13 +131,21 @@
18
         StHandle<StEnumParam>         CheckUpdatesDays; //!< days count between updates checks
19
         StHandle<StInt32ParamNamed>   LastUpdateDay;    //!< the last time update has been checked
20
         StHandle<StInt32ParamNamed>   SrcStereoFormat;  //!< source format
21
+        StHandle<StBoolParamNamed>    ToStickPanorama;  //!< force panorama input for all files
22
+        StHandle<StBoolParamNamed>    ToFlipCubeZ6x1;   //!< flip Z coordinate within Cube map 6x1
23
+        StHandle<StBoolParamNamed>    ToFlipCubeZ3x2;   //!< flip Z coordinate within Cube map 3x2
24
         StHandle<StBoolParamNamed>    ToTrackHead;      //!< enable/disable head-tracking
25
         StHandle<StBoolParamNamed>    ToShowMenu;       //!< show main menu
26
         StHandle<StBoolParamNamed>    ToShowTopbar;     //!< show topbar
27
         StHandle<StBoolParamNamed>    ToShowPlayList;   //!< display playlist
28
+        StHandle<StBoolParamNamed>    ToShowAdjustImage;//!< display image adjustment overlay
29
         StHandle<StBoolParamNamed>    ToShowFps;        //!< display FPS meter
30
-        StHandle<StBoolParamNamed>    IsMobileUI;       //!< display mobile interface
31
+        StHandle<StBoolParamNamed>    IsMobileUI;       //!< display mobile interface (user option)
32
+        StHandle<StBoolParam>         IsMobileUISwitch; //!< display mobile interface (actual value)
33
+        StHandle<StBoolParamNamed>    ToHideStatusBar;  //!< hide system-provided status bar
34
+        StHandle<StBoolParamNamed>    ToHideNavBar;     //!< hide system-provided navigation bar
35
         StHandle<StBoolParamNamed>    IsVSyncOn;        //!< flag to use VSync
36
+        StHandle<StBoolParamNamed>    ToOpenLast;       //!< option to open last file from recent list by default
37
         StHandle<StBoolParamNamed>    ToSaveRecent;     //!< load/save recent file
38
         StString                      lastFolder;       //!< laster folder used to open / save file
39
         StImageFile::ImageClass       imageLib;         //!< preferred image library
40
@@ -146,6 +154,21 @@
41
     } params;
42
 
43
     /**
44
+     * Return true if mobile UI should be enabled considering user option and window margins.
45
+     */
46
+    ST_LOCAL bool toUseMobileUI() const {
47
+        return toUseMobileUI(!myWindow.isNull() ? myWindow->getMargins() : StMarginsI());
48
+    }
49
+
50
+    /**
51
+     * Return true if mobile UI should be enabled considering user option and window margins.
52
+     */
53
+    ST_LOCAL bool toUseMobileUI(const StMarginsI& theMargins) const {
54
+        return params.IsMobileUI->getValue()
55
+            || theMargins.top > 0;
56
+    }
57
+
58
+    /**
59
      * Retrieve current playlist item.
60
      */
61
     ST_LOCAL bool getCurrentFile(StHandle<StFileNode>&     theFileNode,
62
@@ -156,13 +179,18 @@
63
 
64
     ST_LOCAL virtual void doChangeLanguage(const int32_t ) ST_ATTR_OVERRIDE;
65
     ST_LOCAL void doScaleGui(const int32_t );
66
+    ST_LOCAL void doChangeMobileUI(const bool theIsOn);
67
+    ST_LOCAL void doHideSystemBars(const bool theToHide);
68
     ST_LOCAL void doScaleHiDPI(const bool );
69
     ST_LOCAL void doSwitchVSync(const bool theValue);
70
     ST_LOCAL void doFullscreen(const bool theIsFullscreen);
71
     ST_LOCAL void doSwitchSrcFormat(const int32_t theSrcFormat);
72
     ST_LOCAL void doSwitchViewMode(const int32_t theMode);
73
     ST_LOCAL void doPanoramaOnOff(const size_t );
74
+    ST_LOCAL void doChangeStickPano360(const bool );
75
+    ST_LOCAL void doChangeFlipCubeZ(const bool );
76
     ST_LOCAL void doShowPlayList(const bool theToShow);
77
+    ST_LOCAL void doShowAdjustImage(const bool theToShow);
78
     ST_LOCAL void doFileNext();
79
 
80
         public:
81
sview-16_06.tar.gz/StImageViewer/StImageViewer.rc -> sview-17_04.tar.gz/StImageViewer/StImageViewer.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "Stereoscopic Image Viewer\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2007-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2007-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StImageViewer\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StImageViewer/StImageViewer.vcxproj.user -> sview-17_04.tar.gz/StImageViewer/StImageViewer.vcxproj.user Changed
10
 
1
@@ -3,6 +3,6 @@
2
   <PropertyGroup>
3
     <LocalDebuggerCommand>$(OutDir)\sView.exe</LocalDebuggerCommand>
4
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
5
-    <LocalDebuggerCommandArguments>--in=image ..\share\sView\demo\demo.jps</LocalDebuggerCommandArguments>
6
+    <LocalDebuggerCommandArguments>--in=image "c:\Storage\My Movies\Panorama\PanoramaFULL.jps"</LocalDebuggerCommandArguments>
7
   </PropertyGroup>
8
 </Project>
9
\ No newline at end of file
10
sview-16_06.tar.gz/StImageViewer/StImageViewerGUI.cpp -> sview-17_04.tar.gz/StImageViewer/StImageViewerGUI.cpp Changed
201
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StImageViewer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -74,25 +74,30 @@
9
         myFpsWidget = new StGLFpsLabel(this);
10
     }
11
 
12
+    createImageAdjustments();
13
     createUpperToolbar();
14
 
15
-    const StMarginsI& aRootMargins = getRootMargins();
16
     StMarginsI aButtonMargins;
17
     const IconSize anIconSize = scaleIcon(32, aButtonMargins);
18
     const int      anIconStep = scale(32);
19
 
20
-    myPanelBottom = new StGLContainer(this, aRootMargins.left, -aRootMargins.bottom, StGLCorner(ST_VCORNER_BOTTOM, ST_HCORNER_LEFT), scale(4096), scale(32));
21
+    myPanelBottom = new StGLContainer(this, 0, 0, StGLCorner(ST_VCORNER_BOTTOM, ST_HCORNER_LEFT), scale(4096), scale(32));
22
     int aBottomBarNbRight = 0;
23
     const int aRight  = -scale(8);
24
     const int aBottom = -scale(8);
25
     if(myWindow->hasFullscreenMode()) {
26
-        myBtnFull = new StGLCheckboxTextured(myPanelBottom, myPlugin->params.IsFullscreen,
27
-                                             iconTexture(stCString("actionVideoFullscreenOff"), anIconSize),
28
-                                             iconTexture(stCString("actionVideoFullscreenOn"),  anIconSize),
29
-                                             (aBottomBarNbRight++) * (-anIconStep) + aRight, aBottom,
30
-                                             StGLCorner(ST_VCORNER_TOP, ST_HCORNER_RIGHT));
31
+        myBtnFull = new StGLTextureButton(myPanelBottom, (aBottomBarNbRight++) * (-anIconStep) + aRight, aBottom,
32
+                                          StGLCorner(ST_VCORNER_TOP, ST_HCORNER_RIGHT), 4);
33
+        myBtnFull->setAction(myPlugin->getAction(StImageViewer::Action_Fullscreen));
34
+        const StString aSrcTextures[4] = {
35
+            iconTexture(stCString("actionVideoFullscreenOff"),   anIconSize),
36
+            iconTexture(stCString("actionVideoFullscreenOn"),    anIconSize),
37
+            iconTexture(stCString("actionVideoFullscreen3dOff"), anIconSize),
38
+            iconTexture(stCString("actionVideoFullscreen3dOn"),  anIconSize)
39
+        };
40
+        myBtnFull->setTexturePath(aSrcTextures, 4);
41
+
42
         myBtnFull->setDrawShadow(true);
43
-        myBtnFull->setFalseOpacity(1.0f);
44
         myBtnFull->changeMargins() = aButtonMargins;
45
     }
46
 
47
@@ -130,12 +135,11 @@
48
     const int      anIconStep = scale(48);
49
     aButtonMargins.extend(scale(8));
50
 
51
-    const StMarginsI& aMargins = getRootMargins();
52
-    myPanelUpper = new StGLContainer(this, aMargins.left, aMargins.top, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), scale(4096), scale(128));
53
+    myPanelUpper = new StGLContainer(this, 0, 0, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), scale(4096), scale(128));
54
 
55
     // append textured buttons
56
     myBtnOpen   = new StGLTextureButton(myPanelUpper, aLeft + (aBtnIter++) * anIconStep, aTop);
57
-    myBtnOpen->signals.onBtnClick.connect(myPlugin, &StImageViewer::doOpen1FileDialog);
58
+    myBtnOpen->signals.onBtnClick.connect(myPlugin, &StImageViewer::doOpen1FileAction);
59
     myBtnOpen->setTexturePath(iconTexture(stCString("actionOpen"), anIconSize));
60
     myBtnOpen->setDrawShadow(true);
61
     myBtnOpen->changeMargins() = aButtonMargins;
62
@@ -198,14 +202,21 @@
63
     myBtnPanorama->signals.onBtnClick += stSlot(this, &StImageViewerGUI::doPanoramaCombo);
64
     myBtnPanorama->setDrawShadow(true);
65
     myBtnPanorama->changeMargins() = aButtonMargins;
66
+
67
+    myBtnAdjust = new StGLCheckboxTextured(myPanelUpper, myPlugin->params.ToShowAdjustImage,
68
+                                           iconTexture(stCString("actionColorAdjustOff"), anIconSize),
69
+                                           iconTexture(stCString("actionColorAdjust"),    anIconSize),
70
+                                           aLeft + (aBtnIter++) * anIconStep, aTop,
71
+                                           StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT));
72
+    myBtnAdjust->setDrawShadow(true);
73
+    myBtnAdjust->changeMargins() = aButtonMargins;
74
 }
75
 
76
 /**
77
  * Main menu
78
  */
79
 void StImageViewerGUI::createMainMenu() {
80
-    const StMarginsI& aMargins = getRootMargins();
81
-    myMenuRoot = new StGLMenu(this, aMargins.left, aMargins.top, StGLMenu::MENU_HORIZONTAL, true);
82
+    myMenuRoot = new StGLMenu(this, 0, 0, StGLMenu::MENU_HORIZONTAL, true);
83
 
84
     StGLMenu* aMenuMedia   = createMediaMenu();  // Root -> Media  menu
85
     StGLMenu* aMenuView    = createViewMenu();   // Root -> View   menu
86
@@ -252,7 +263,7 @@
87
 StGLMenu* StImageViewerGUI::createOpenImageMenu() {
88
     StGLMenu* menu = new StGLMenu(this, 0, 0, StGLMenu::MENU_VERTICAL);
89
     menu->addItem(tr(MENU_MEDIA_OPEN_IMAGE_1), 1)
90
-        ->signals.onItemClick.connect(myPlugin, &StImageViewer::doOpen1FileDialog);
91
+        ->signals.onItemClick.connect(myPlugin, &StImageViewer::doOpen1FileAction);
92
     menu->addItem(tr(MENU_MEDIA_OPEN_IMAGE_2), 2)
93
         ->signals.onItemClick.connect(myPlugin, &StImageViewer::doOpen2FilesDialog);
94
     return menu;
95
@@ -380,15 +391,16 @@
96
 
97
 void StImageViewerGUI::fillPanoramaMenu(StGLMenu* theMenu) {
98
     theMenu->addItem(tr(MENU_VIEW_SURFACE_PLANE),
99
-                     myImage->params.ViewMode, StStereoParams::FLAT_IMAGE);
100
+                     myImage->params.ViewMode, StViewSurface_Plain);
101
     theMenu->addItem(tr(MENU_VIEW_SURFACE_SPHERE),
102
-                     myImage->params.ViewMode, StStereoParams::PANORAMA_SPHERE);
103
+                     myImage->params.ViewMode, StViewSurface_Sphere);
104
     theMenu->addItem(tr(MENU_VIEW_SURFACE_CUBEMAP),
105
-                     myImage->params.ViewMode, StStereoParams::PANORAMA_CUBEMAP);
106
+                     myImage->params.ViewMode, StViewSurface_Cubemap);
107
     if(myWindow->hasOrientationSensor()) {
108
         theMenu->addItem(tr(myWindow->isPoorOrientationSensor() ? MENU_VIEW_TRACK_HEAD_POOR : MENU_VIEW_TRACK_HEAD),
109
                          myPlugin->params.ToTrackHead);
110
     }
111
+    theMenu->addItem(myPlugin->params.ToStickPanorama);
112
 }
113
 
114
 void StImageViewerGUI::doPanoramaCombo(const size_t ) {
115
@@ -534,7 +546,7 @@
116
     const StGLVec3 THE_WHITE(1.0f, 1.0f, 1.0f);
117
     const StString anAbout = tr(ABOUT_DPLUGIN_NAME) + '\n'
118
                            + tr(ABOUT_VERSION) + " " + StVersionInfo::getSDKVersionString()
119
-                           + "\n \n" + tr(ABOUT_DESCRIPTION).format("2007-2016", "kirill@sview.ru", "www.sview.ru");
120
+                           + "\n \n" + tr(ABOUT_DESCRIPTION).format("2007-2017", "kirill@sview.ru", "www.sview.ru");
121
 
122
     StArgumentsMap anInfo;
123
     anInfo.add(StDictEntry("CPU cores", StString(StThread::countLogicalProcessors()) + StString(" logical processor(s)")));
124
@@ -589,7 +601,12 @@
125
     // translate known metadata tag names
126
     for(size_t aMapIter = 0; aMapIter < anExtraInfo->Info.size(); ++aMapIter) {
127
         StDictEntry& anEntry = anExtraInfo->Info.changeValue(aMapIter);
128
+        const size_t aSize = anEntry.getValue().getSize();
129
         anEntry.changeName() = myLangMap->getValue(anEntry.getKey());
130
+        if(aSize > 16384) {
131
+            // cut too long strings
132
+            anEntry.changeValue() = anEntry.getValue().subString(0, 128) + "\n...[" + (aSize / 1024) + " KiB]";
133
+        }
134
     }
135
     const int aWidthMax  = aDialog->getContent()->getRectPx().width();
136
     int       aRowLast   = (int )anExtraInfo->Info.size();
137
@@ -765,9 +782,18 @@
138
     aParams.add(myPlugin->StApplication::params.ActiveDevice);
139
     aParams.add(myImage->params.DisplayMode);
140
     aRend->getOptions(aParams);
141
+    aParams.add(myPlugin->params.ToStickPanorama);
142
+    aParams.add(myPlugin->params.ToFlipCubeZ6x1);
143
+    aParams.add(myPlugin->params.ToFlipCubeZ3x2);
144
     aParams.add(myPlugin->params.ToShowFps);
145
     aParams.add(myLangMap->params.language);
146
     aParams.add(myPlugin->params.IsMobileUI);
147
+    if(isMobile()) {
148
+        //aParams.add(myPlugin->params.ToHideStatusBar);
149
+        aParams.add(myPlugin->params.ToHideNavBar);
150
+    } else {
151
+        aParams.add(myPlugin->params.ToOpenLast);
152
+    }
153
     aParams.add(myPlugin->params.ExitOnEscape);
154
 #if !defined(ST_NO_UPDATES_CHECK)
155
     aParams.add(myPlugin->params.CheckUpdatesDays);
156
@@ -853,6 +879,7 @@
157
 }
158
 
159
 void StImageViewerGUI::createMobileUI(const StHandle<StPlayList>& thePlayList) {
160
+    createImageAdjustments();
161
     createMobileUpperToolbar();
162
     createMobileBottomToolbar();
163
 
164
@@ -878,8 +905,7 @@
165
     const int      anIconStep = scale(56);
166
     aButtonMargins.extend(scale(12));
167
 
168
-    const StMarginsI& aRootMargins = getRootMargins();
169
-    myPanelUpper = new StGLContainer(this, aRootMargins.left, aRootMargins.top, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), scale(4096), scale(56));
170
+    myPanelUpper = new StGLContainer(this, 0, 0, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), scale(4096), scale(56));
171
 
172
     int aBtnIter = 0;
173
 
174
@@ -930,6 +956,14 @@
175
     myBtnPanorama->setDrawShadow(true);
176
     myBtnPanorama->changeMargins() = aButtonMargins;
177
 
178
+    myBtnAdjust = new StGLCheckboxTextured(myPanelUpper, myPlugin->params.ToShowAdjustImage,
179
+                                           iconTexture(stCString("actionColorAdjustOff"), anIconSize),
180
+                                           iconTexture(stCString("actionColorAdjust"),    anIconSize),
181
+                                           (aBtnIter++) * anIconStep, 0,
182
+                                           StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT));
183
+    myBtnAdjust->setDrawShadow(true);
184
+    myBtnAdjust->changeMargins() = aButtonMargins;
185
+
186
     aBtnIter = 0;
187
     StGLTextureButton* aBtnEx = new StGLTextureButton(myPanelUpper, (aBtnIter--) * (-anIconStep), 0,
188
                                                       StGLCorner(ST_VCORNER_TOP, ST_HCORNER_RIGHT));
189
@@ -948,8 +982,7 @@
190
     const int      anIconStep = scale(56);
191
     aButtonMargins.extend(scale(12));
192
 
193
-    const StMarginsI& aRootMargins = getRootMargins();
194
-    myPanelBottom = new StGLContainer(this, aRootMargins.left, -aRootMargins.bottom, StGLCorner(ST_VCORNER_BOTTOM, ST_HCORNER_LEFT), scale(4096), scale(56));
195
+    myPanelBottom = new StGLContainer(this, 0, 0, StGLCorner(ST_VCORNER_BOTTOM, ST_HCORNER_LEFT), scale(4096), scale(56));
196
 
197
     int aBtnIter = 0;
198
     myBtnPrev = new StGLTextureButton(myPanelBottom, (aBtnIter++) * anIconStep, 0);
199
@@ -971,6 +1004,21 @@
200
     myBtnInfo->changeMargins() = aButtonMargins;
201
sview-16_06.tar.gz/StImageViewer/StImageViewerGUI.h -> sview-17_04.tar.gz/StImageViewer/StImageViewerGUI.h Changed
65
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StImageViewer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -38,6 +38,7 @@
9
 class StGLFpsLabel;
10
 class StGLTable;
11
 class StGLPlayList;
12
+class StGLRangeFieldFloat32;
13
 class StPlayList;
14
 class StWindow;
15
 
16
@@ -94,8 +95,11 @@
17
                               const StHandle<StPlayList>&       thePlayList,
18
                               const StHandle<StGLTextureQueue>& theTextureQueue);
19
     ST_LOCAL virtual ~StImageViewerGUI();
20
-    ST_LOCAL virtual void stglUpdate(const StPointD_t& thePointZo) ST_ATTR_OVERRIDE;
21
-    ST_LOCAL virtual void stglResize(const StGLBoxPx& theRectPx) ST_ATTR_OVERRIDE;
22
+    ST_LOCAL virtual void stglUpdate(const StPointD_t& thePointZo,
23
+                                     bool theIsPreciseInput) ST_ATTR_OVERRIDE;
24
+    ST_LOCAL virtual void stglResize(const StGLBoxPx& theViewPort,
25
+                                     const StMarginsI& theMargins,
26
+                                     float theAspect) ST_ATTR_OVERRIDE;
27
     ST_LOCAL virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
28
 
29
     ST_LOCAL void setVisibility(const StPointD_t& theCursor,
30
@@ -168,6 +172,7 @@
31
 
32
     ST_LOCAL void      createMobileUpperToolbar();
33
     ST_LOCAL void      createMobileBottomToolbar();
34
+    ST_LOCAL void      createImageAdjustments();
35
 
36
         private: //! @name callback Slots
37
 
38
@@ -209,15 +214,25 @@
39
 
40
     StGLWidget*         myPanelUpper;       //!< upper  toolbar
41
     StGLWidget*         myPanelBottom;      //!< bottom toolbar
42
+
43
+    StGLWidget*         myAdjustOverlay;    //!< image adjustments control
44
+    StGLRangeFieldFloat32* myBtnSepDx;
45
+    StGLRangeFieldFloat32* myBtnSepDy;
46
+    StGLRangeFieldFloat32* myBtnSepRot;
47
+    StGLTextureButton*     myBtnReset3d;
48
+    StGLTextureButton*     myBtnResetColor1;
49
+    StGLTextureButton*     myBtnResetColor2;
50
+
51
     StGLTextureButton*  myBtnOpen;
52
     StGLTextureButton*  myBtnPrev;
53
     StGLTextureButton*  myBtnNext;
54
     StGLTextureButton*  myBtnInfo;
55
+    StGLTextureButton*  myBtnAdjust;
56
     StGLTextureButton*  myBtnSwapLR;
57
     StGLCheckboxTextured* myBtnPanorama;
58
     StGLTextureButton*  myBtnSrcFrmt;
59
     StGLTextureButton*  myBtnList;
60
-    StGLCheckboxTextured* myBtnFull;
61
+    StGLTextureButton*  myBtnFull;
62
     StGLFpsLabel*       myFpsWidget;
63
 
64
     StGLTable*          myHKeysTable;
65
sview-16_06.tar.gz/StImageViewer/StImageViewerStrings.cpp -> sview-17_04.tar.gz/StImageViewer/StImageViewerStrings.cpp Changed
55
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2013-2015 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2013-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StImageViewer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -21,6 +21,9 @@
9
 #include "StImageViewer.h"
10
 #include <StStrings/StLangMap.h>
11
 
12
+// Degree sign in UTF-8 encoding.
13
+#define THE_DEGREE_SIGN "\xC2\xB0"
14
+
15
 namespace StImageViewerStrings {
16
 
17
 inline void addAction(StLangMap&              theStrings,
18
@@ -124,6 +127,12 @@
19
                "Track orientation");
20
     theStrings(MENU_VIEW_TRACK_HEAD_POOR,
21
                "Track orientation (poor)");
22
+    theStrings(MENU_VIEW_STICK_PANORAMA360,
23
+               "Stick at panorama 360" THE_DEGREE_SIGN);
24
+    theStrings(MENU_VIEW_FLIPZ_CUBE6x1,
25
+               "Cubemap 6x1 - flip Z");
26
+    theStrings(MENU_VIEW_FLIPZ_CUBE3x2,
27
+               "Cubemap 3x2 - flip Z");
28
     theStrings(MENU_VIEW_DISPLAY_MODE_STEREO,
29
                "Stereo");
30
     theStrings(MENU_VIEW_DISPLAY_MODE_LEFT,
31
@@ -224,6 +233,10 @@
32
                "Double click");
33
     theStrings(OPTION_EXIT_ON_ESCAPE_WINDOWED,
34
                "When windowed");
35
+    theStrings(OPTION_HIDE_NAVIGATION_BAR,
36
+               "Hide system navigation bar");
37
+    theStrings(OPTION_OPEN_LAST_ON_STARTUP,
38
+               "Open last viewed file on startup");
39
 
40
     theStrings(UPDATES_NOTIFY,
41
                "A new version of sView is available on the official site www.sview.ru.\n"
42
@@ -390,10 +403,10 @@
43
               "Angular separation - increase");
44
     addAction(theStrings, StImageViewer::Action_StereoParamsBegin + StGLImageRegion::Action_Rot90Counter,
45
               "DoParamsRotZ90Dec",
46
-              "Rotate 90 degrees counterclockwise");
47
+              "Rotate 90" THE_DEGREE_SIGN " counterclockwise");
48
     addAction(theStrings, StImageViewer::Action_StereoParamsBegin + StGLImageRegion::Action_Rot90Clockwise,
49
               "DoParamsRotZ90Inc",
50
-              "Rotate 90 degrees clockwise");
51
+              "Rotate 90" THE_DEGREE_SIGN " clockwise");
52
     addAction(theStrings, StImageViewer::Action_StereoParamsBegin + StGLImageRegion::Action_RotCounter,
53
               "DoParamsRotZDec",
54
               "Rotate counterclockwise");
55
sview-16_06.tar.gz/StImageViewer/StImageViewerStrings.h -> sview-17_04.tar.gz/StImageViewer/StImageViewerStrings.h Changed
27
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StImageViewer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -96,6 +96,9 @@
9
         MENU_VIEW_SURFACE_CUBEMAP   = 1283,
10
         MENU_VIEW_TRACK_HEAD        = 1285,
11
         MENU_VIEW_TRACK_HEAD_POOR   = 1286,
12
+        MENU_VIEW_STICK_PANORAMA360 = 1288,
13
+        MENU_VIEW_FLIPZ_CUBE6x1     = 1291,
14
+        MENU_VIEW_FLIPZ_CUBE3x2     = 1292,
15
 
16
         // Root -> Output -> Change Device menu
17
         MENU_CHANGE_DEVICE  = 1400,
18
@@ -133,6 +136,8 @@
19
         OPTION_EXIT_ON_ESCAPE_ONE_CLICK    = 1703,
20
         OPTION_EXIT_ON_ESCAPE_DOUBLE_CLICK = 1704,
21
         OPTION_EXIT_ON_ESCAPE_WINDOWED     = 1705,
22
+        OPTION_HIDE_NAVIGATION_BAR         = 1710,
23
+        OPTION_OPEN_LAST_ON_STARTUP        = 1711,
24
 
25
         // Open/Save dialogs
26
         DIALOG_OPEN_FILE       = 2000,
27
sview-16_06.tar.gz/StImageViewer/lang/chinese/StImageViewer.lng -> sview-17_04.tar.gz/StImageViewer/lang/chinese/StImageViewer.lng Changed
31
 
1
@@ -57,6 +57,9 @@
2
 ?1283=Cubemap
3
 ?1285=Track orientation
4
 ?1286=Track orientation (poor)
5
+?1288=Stick at panorama 360°
6
+?1291=Cubemap 6x1 - flip Z
7
+?1292=Cubemap 3x2 - flip Z
8
 1400=改变设备
9
 1401=关于插件...
10
 1402=显示 FPS
11
@@ -85,6 +88,8 @@
12
 ?1703=On one click
13
 ?1704=On double click
14
 ?1705=On one click windowed mode
15
+?1710=Hide system navigation bar
16
+?1711=Open last viewed file on startup
17
 2000=选择图片文件打开
18
 2001=选择左画面图片打开
19
 2002=选择右画面图片文件打开
20
@@ -156,8 +161,8 @@
21
 ?6024=DY separation - increase
22
 ?6025=Angular separation - decrease
23
 ?6026=Angular separation - increase
24
-?6027=Rotate 90 degrees counterclockwise
25
-?6028=Rotate 90 degrees clockwise
26
+?6027=Rotate 90° counterclockwise
27
+?6028=Rotate 90° clockwise
28
 ?6029=Rotate counterclockwise
29
 ?6030=Rotate clockwise
30
 ?6031=Select next view mode
31
sview-16_06.tar.gz/StImageViewer/lang/czech/StImageViewer.lng -> sview-17_04.tar.gz/StImageViewer/lang/czech/StImageViewer.lng Changed
35
 
1
@@ -56,8 +56,11 @@
2
 1281=Koule
3
 1282=Válec
4
 ?1283=Cubemap
5
-?1285="Track orientation"
6
-?1286="Track orientation (poor)"
7
+?1285=Track orientation
8
+?1286=Track orientation (poor)
9
+?1288=Stick at panorama 360°
10
+?1291=Cubemap 6x1 - flip Z
11
+?1292=Cubemap 3x2 - flip Z
12
 1400=Zobrazovací zařizení
13
 1401=O modulu
14
 1402=Zobrazovat snímkování (fps)
15
@@ -86,6 +89,8 @@
16
 ?1703=On one click
17
 ?1704=On double click
18
 ?1705=On one click windowed mode
19
+?1710=Hide system navigation bar
20
+?1711=Open last viewed file on startup
21
 2000=Otevřít
22
 2001=Otevřít LEVÝ
23
 2002=Otevřít PRAVÝ
24
@@ -157,8 +162,8 @@
25
 ?6024=DY separation - increase
26
 ?6025=Angular separation - decrease
27
 ?6026=Angular separation - increase
28
-?6027=Rotate 90 degrees counterclockwise
29
-?6028=Rotate 90 degrees clockwise
30
+?6027=Rotate 90° counterclockwise
31
+?6028=Rotate 90° clockwise
32
 ?6029=Rotate counterclockwise
33
 ?6030=Rotate clockwise
34
 ?6031=Select next view mode
35
sview-16_06.tar.gz/StImageViewer/lang/english/StImageViewer.lng -> sview-17_04.tar.gz/StImageViewer/lang/english/StImageViewer.lng Changed
31
 
1
@@ -57,6 +57,9 @@
2
 1283=Cubemap
3
 1285=Track orientation
4
 1286=Track orientation (poor)
5
+1288=Stick at panorama 360°
6
+1291=Cubemap 6x1 - flip Z
7
+1292=Cubemap 3x2 - flip Z
8
 1400=Change device
9
 1401=About Plugin...
10
 1402=Show FPS
11
@@ -85,6 +88,8 @@
12
 1703=On one click
13
 1704=On double click
14
 1705=On one click windowed mode
15
+1710=Hide system navigation bar
16
+1711=Open last viewed file on startup
17
 2000=Choose the image file to open
18
 2001=Choose LEFT image file to open
19
 2002=Choose RIGHT image file to open
20
@@ -156,8 +161,8 @@
21
 6024=DY separation - increase
22
 6025=Angular separation - decrease
23
 6026=Angular separation - increase
24
-6027=Rotate 90 degrees counterclockwise
25
-6028=Rotate 90 degrees clockwise
26
+6027=Rotate 90° counterclockwise
27
+6028=Rotate 90° clockwise
28
 6029=Rotate counterclockwise
29
 6030=Rotate clockwise
30
 6031=Select next view mode
31
sview-16_06.tar.gz/StImageViewer/lang/french/StImageViewer.lng -> sview-17_04.tar.gz/StImageViewer/lang/french/StImageViewer.lng Changed
31
 
1
@@ -57,6 +57,9 @@
2
 1283=Cubemap
3
 ?1285=Track orientation
4
 ?1286=Track orientation (poor)
5
+?1288=Stick at panorama 360°
6
+?1291=Cubemap 6x1 - flip Z
7
+?1292=Cubemap 3x2 - flip Z
8
 1400=Changer la sortie
9
 1401=A propos du Plugin...
10
 1402=Voir I/S
11
@@ -85,6 +88,8 @@
12
 ?1703=On one click
13
 ?1704=On double click
14
 ?1705=On one click windowed mode
15
+?1710=Hide system navigation bar
16
+?1711=Open last viewed file on startup
17
 2000=Choix du fichier image à ouvrir
18
 2001=Choix du fichier image Gauche à ouvrir
19
 2002=Choix du fichier image Droite à ouvrir
20
@@ -156,8 +161,8 @@
21
 ?6024=DY separation - increase
22
 ?6025=Angular separation - decrease
23
 ?6026=Angular separation - increase
24
-6027=Faire pivoter un objet de 90 degrés vers la gauche
25
-6028=Faire pivoter un objet de 90 degrés vers la droite
26
+6027=Faire pivoter un objet de 90° vers la gauche
27
+6028=Faire pivoter un objet de 90° vers la droite
28
 6029=Sens inverse des aiguilles d’une montre
29
 6030=Sens des aiguilles d’une montre
30
 ?6031=Select next view mode
31
sview-16_06.tar.gz/StImageViewer/lang/german/StImageViewer.lng -> sview-17_04.tar.gz/StImageViewer/lang/german/StImageViewer.lng Changed
31
 
1
@@ -57,6 +57,9 @@
2
 1283=Cubemap
3
 ?1285=Track orientation
4
 ?1286=Track orientation (poor)
5
+?1288=Stick at panorama 360°
6
+?1291=Cubemap 6x1 - flip Z
7
+?1292=Cubemap 3x2 - flip Z
8
 1400=Gerät ändern
9
 1401=Über Plugin...
10
 1402=FPS anzeigen
11
@@ -85,6 +88,8 @@
12
 1703=Auf einen Klick
13
 1704=Auf Doppelklick
14
 ?1705=Only when windowed
15
+1710=Navigationsleiste ausblenden
16
+?1711=Open last viewed file on startup
17
 2000=Wählen die Bilddatei zu öffnen
18
 2001=Wählen die linke Bilddatei zu öffnen
19
 2002=Wählen die rechte Bilddatei zu öffnen
20
@@ -156,8 +161,8 @@
21
 6024=DY Trennung - erhöhen
22
 6025=Winkelabstand - verringern
23
 6026=Winkelabstand - erhöhen
24
-6027=Um 90 Grad gegen Uhrzeigersinn drehen
25
-6028=Um 90 Grad im Uhrzeigersinn drehen
26
+6027=Um 90° gegen Uhrzeigersinn drehen
27
+6028=Um 90° im Uhrzeigersinn drehen
28
 6029=Drehen gegen den Uhrzeigersinn
29
 6030=Im Uhrzeigersinn drehen
30
 ?6031=Select next view mode
31
sview-16_06.tar.gz/StImageViewer/lang/korean/StImageViewer.lng -> sview-17_04.tar.gz/StImageViewer/lang/korean/StImageViewer.lng Changed
31
 
1
@@ -58,6 +58,9 @@
2
 ?1283=Cubemap
3
 ?1285=Track orientation
4
 ?1286=Track orientation (poor)
5
+?1288=Stick at panorama 360°
6
+?1291=Cubemap 6x1 - flip Z
7
+?1292=Cubemap 3x2 - flip Z
8
 1400=장치 변경
9
 ?1401=About Plugin...
10
 ?1402=Show FPS
11
@@ -86,6 +89,8 @@
12
 ?1703=On one click
13
 ?1704=On double click
14
 ?1705=On one click windowed mode
15
+?1710=Hide system navigation bar
16
+?1711=Open last viewed file on startup
17
 2000=열어볼 이미지 파일 선택
18
 2001=왼쪽 이미지 선택
19
 2002=오른쪽 이미지 선택
20
@@ -157,8 +162,8 @@
21
 ?6024=DY separation - increase
22
 ?6025=Angular separation - decrease
23
 ?6026=Angular separation - increase
24
-?6027=Rotate 90 degrees counterclockwise
25
-?6028=Rotate 90 degrees clockwise
26
+?6027=Rotate 90° counterclockwise
27
+?6028=Rotate 90° clockwise
28
 ?6029=Rotate counterclockwise
29
 ?6030=Rotate clockwise
30
 ?6031=Select next view mode
31
sview-16_06.tar.gz/StImageViewer/lang/russian/StImageViewer.lng -> sview-17_04.tar.gz/StImageViewer/lang/russian/StImageViewer.lng Changed
31
 
1
@@ -57,6 +57,9 @@
2
 1283=Куб
3
 1285=Отслеживать ориентацию
4
 1286=Отслеживать ориентацию (poor)
5
+1288=Закрепить панорамный режим 360°
6
+1291=Кубмапа 6x1 - инвертировать Z
7
+1292=Кубмапа 3x2 - инвертировать Z
8
 1400=Выбрать устройство
9
 1401=О модуле...
10
 1402=Отображать FPS
11
@@ -85,6 +88,8 @@
12
 1703=Одно нажатие
13
 1704=Двойное нажатие
14
 1705=Только в оконном режиме
15
+1710=Скрыть панель навигации
16
+1711=Открывать последний файл при старте
17
 2000=Выберите картинку
18
 2001=Выберите файл с ЛЕВЫМ ракурсом
19
 2002=Выберите файл с ПРАВЫМ ракурсом
20
@@ -156,8 +161,8 @@
21
 6024=DY разделение ракурсов - увеличить
22
 6025=Угловое разделение ракурсов - уменьшить
23
 6026=Угловое разделение ракурсов - увеличить
24
-6027=Поворот на 90 градусов против часовой стрелки
25
-6028=Поворот на 90 градусов по часовой стрелке
26
+6027=Поворот на 90° против часовой стрелки
27
+6028=Поворот на 90° по часовой стрелке
28
 6029=Поворот против часовой стрелки
29
 6030=Поворот по часовой стрелке
30
 6031=Выбрать следующий режим
31
sview-16_06.tar.gz/StMoviePlayer/StMoviePlayer.cbp -> sview-17_04.tar.gz/StMoviePlayer/StMoviePlayer.cbp Changed
19
 
1
@@ -211,7 +211,7 @@
2
                    <Add option="-Wl,-install_name,@executable_path/$(TARGET_OUTPUT_BASENAME).dylib" />
3
                    <Add option="-framework Appkit" />
4
                    <Add option="-framework OpenGL" />
5
-                   <Add option="-framework OpenAL" />
6
+                   <Add library="openal" />
7
                    <Add library="objc" />
8
                </Linker>
9
                <ExtraCommands>
10
@@ -239,7 +239,7 @@
11
                    <Add option="-Wl,-install_name,@executable_path/$(TARGET_OUTPUT_BASENAME).dylib" />
12
                    <Add option="-framework Appkit" />
13
                    <Add option="-framework OpenGL" />
14
-                   <Add option="-framework OpenAL" />
15
+                   <Add library="openal" />
16
                    <Add library="objc" />
17
                </Linker>
18
                <ExtraCommands>
19
sview-16_06.tar.gz/StMoviePlayer/StMoviePlayer.cpp -> sview-17_04.tar.gz/StMoviePlayer/StMoviePlayer.cpp Changed
201
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -72,6 +72,7 @@
9
     static const char ST_ARGUMENT_FILE_LEFT[]  = "left";
10
     static const char ST_ARGUMENT_FILE_RIGHT[] = "right";
11
     static const char ST_ARGUMENT_FILE_LAST[]  = "last";
12
+    static const char ST_ARGUMENT_FILE_DEMO[]  = "demo";
13
     static const char ST_ARGUMENT_FILE_PAUSE[] = "pause";
14
     static const char ST_ARGUMENT_FILE_PAUSED[]= "paused";
15
     static const char ST_ARGUMENT_MONITOR[]    = "monitorId";
16
@@ -106,6 +107,10 @@
17
     params.SubtitlesParser->setName(tr(MENU_SUBTITLES_PARSER));
18
     params.SubtitlesParser->defineOption(0, tr(MENU_SUBTITLES_PLAIN_TEXT));
19
     params.SubtitlesParser->defineOption(1, tr(MENU_SUBTITLES_LITE_HTML));
20
+    params.AudioAlHrtf->setName(stCString("Audio HRTF mixing"));
21
+    params.AudioAlHrtf->defineOption(0, stCString("Auto"));
22
+    params.AudioAlHrtf->defineOption(1, stCString("Forced ON"));
23
+    params.AudioAlHrtf->defineOption(2, stCString("Forced OFF"));
24
     params.AudioMute->setName(stCString("Mute Audio"));
25
     params.IsFullscreen->setName(tr(MENU_VIEW_FULLSCREEN));
26
 
27
@@ -127,7 +132,11 @@
28
     params.LastUpdateDay->setName(tr(MENU_HELP_UPDATES));
29
     params.SrcStereoFormat->setName(tr(MENU_MEDIA_SRC_FORMAT));
30
     params.ToShowPlayList->setName(tr(VIDEO_LIST));
31
+    params.ToShowAdjustImage->setName(tr(MENU_VIEW_IMAGE_ADJUST));
32
+    params.ToStickPanorama->setName(tr(MENU_VIEW_STICK_PANORAMA360));
33
     params.ToTrackHead->setName(tr(MENU_VIEW_TRACK_HEAD));
34
+    params.ToTrackHeadAudio->setName(tr(MENU_VIEW_TRACK_HEAD_AUDIO));
35
+    params.ToForceBFormat->setName(stCString("Force B-Format"));
36
     params.ToShowFps->setName(tr(MENU_FPS_METER));
37
     params.ToShowMenu->setName(stCString("Show main menu"));
38
     params.ToShowTopbar->setName(stCString("Show top toolbar"));
39
@@ -146,6 +155,9 @@
40
     params.BlockSleeping->defineOption(BLOCK_SLEEP_ALWAYS,     tr(MENU_HELP_BLOCKSLP_ALWAYS));
41
     params.BlockSleeping->defineOption(BLOCK_SLEEP_PLAYBACK,   tr(MENU_HELP_BLOCKSLP_PLAYBACK));
42
     params.BlockSleeping->defineOption(BLOCK_SLEEP_FULLSCREEN, tr(MENU_HELP_BLOCKSLP_FULLSCR));
43
+    params.ToHideStatusBar->setName("Hide system status bar");
44
+    params.ToHideNavBar   ->setName(tr(OPTION_HIDE_NAVIGATION_BAR));
45
+    params.ToOpenLast     ->setName(tr(OPTION_OPEN_LAST_ON_STARTUP));
46
     params.ToShowExtra->setName(tr(MENU_HELP_EXPERIMENTAL));
47
     params.TargetFps->setName(stCString("FPS Target"));
48
 
49
@@ -218,6 +230,7 @@
50
     params.ToSearchSubs = new StBoolParamNamed(true, stCString("toSearchSubs"));
51
     params.SubtitlesParser = new StEnumParam(1, stCString("subsParser"));
52
     params.AudioAlDevice = new StALDeviceParam();
53
+    params.AudioAlHrtf   = new StEnumParam(0, stCString("alHrtfRequest"));
54
     params.AudioGain = new StFloat32Param( 0.0f, // sound is unattenuated
55
                                          -50.0f, // almost mute
56
                                           10.0f, // max amplification
57
@@ -243,12 +256,20 @@
58
     params.SrcStereoFormat->signals.onChanged = stSlot(this, &StMoviePlayer::doSwitchSrcFormat);
59
     params.ToShowPlayList   = new StBoolParamNamed(false, stCString("showPlaylist"));
60
     params.ToShowPlayList->signals.onChanged = stSlot(this, &StMoviePlayer::doShowPlayList);
61
-    params.ToTrackHead = new StBoolParamNamed(true,  stCString("toTrackHead"));
62
+    params.ToShowAdjustImage = new StBoolParamNamed(false, stCString("showAdjustImage"));
63
+    params.ToShowAdjustImage->signals.onChanged = stSlot(this, &StMoviePlayer::doShowAdjustImage);
64
+    params.ToStickPanorama  = new StBoolParamNamed(false, stCString("toStickPano360"));
65
+    params.ToStickPanorama->signals.onChanged = stSlot(this, &StMoviePlayer::doChangeStickPano360);
66
+    params.ToTrackHead      = new StBoolParamNamed(true,  stCString("toTrackHead"));
67
+    params.ToTrackHeadAudio = new StBoolParamNamed(true,  stCString("toTrackHeadAudio"));
68
+    params.ToForceBFormat   = new StBoolParamNamed(false, stCString("toForceBFormat"));
69
     params.ToShowFps   = new StBoolParamNamed(false, stCString("toShowFps"));
70
     params.ToShowMenu  = new StBoolParamNamed(true,  stCString("toShowMenu"));
71
     params.ToShowTopbar= new StBoolParamNamed(true,  stCString("toShowTopbar"));
72
     params.IsMobileUI  = new StBoolParamNamed(StWindow::isMobile(), stCString("isMobileUI"));
73
-    params.IsMobileUI->signals.onChanged = stSlot(this, &StMoviePlayer::doScaleHiDPI);
74
+    params.IsMobileUI->signals.onChanged = stSlot(this, &StMoviePlayer::doChangeMobileUI);
75
+    params.IsMobileUISwitch = new StBoolParam(params.IsMobileUI->getValue());
76
+    params.IsMobileUISwitch->signals.onChanged = stSlot(this, &StMoviePlayer::doScaleHiDPI);
77
     params.IsVSyncOn   = new StBoolParamNamed(true, stCString("vsync"));
78
     params.IsVSyncOn->signals.onChanged = stSlot(this, &StMoviePlayer::doSwitchVSync);
79
     StApplication::params.VSyncMode->setValue(StGLContext::VSync_ON);
80
@@ -262,6 +283,11 @@
81
     params.SubtitlesStream = new StInt32Param(-1);
82
     params.SubtitlesStream->signals.onChanged = stSlot(this, &StMoviePlayer::doSwitchSubtitlesStream);
83
     params.BlockSleeping = new StEnumParam(StMoviePlayer::BLOCK_SLEEP_PLAYBACK, stCString("blockSleep"));
84
+    params.ToHideStatusBar = new StBoolParamNamed(true, stCString("toHideStatusBar"));
85
+    params.ToHideStatusBar->signals.onChanged = stSlot(this, &StMoviePlayer::doHideSystemBars);
86
+    params.ToHideNavBar    = new StBoolParamNamed(true, stCString("toHideNavBar"));
87
+    params.ToHideNavBar   ->signals.onChanged = stSlot(this, &StMoviePlayer::doHideSystemBars);
88
+    params.ToOpenLast    = new StBoolParamNamed(false, stCString("toOpenLast"));
89
     params.ToShowExtra   = new StBoolParamNamed(false, stCString("experimental"));
90
     // set rendering FPS as twice as average video FPS
91
     params.TargetFps = new StInt32ParamNamed(2, stCString("fpsTarget"));
92
@@ -289,6 +315,7 @@
93
     mySettings->loadParam (params.ToLoopSingle);
94
     mySettings->loadParam (params.AreGlobalMKeys);
95
     mySettings->loadParam (params.ToShowPlayList);
96
+    mySettings->loadParam (params.ToShowAdjustImage);
97
     mySettings->loadParam (params.SubtitlesPlace);
98
     mySettings->loadParam (params.SubtitlesTopDY);
99
     mySettings->loadParam (params.SubtitlesBottomDY);
100
@@ -298,6 +325,10 @@
101
     mySettings->loadParam (params.ToSearchSubs);
102
 
103
     myToCheckPoorOrient = !mySettings->loadParam(params.ToTrackHead);
104
+    mySettings->loadParam (params.ToStickPanorama);
105
+    mySettings->loadParam (params.ToTrackHeadAudio);
106
+    mySettings->loadParam (params.ToForceBFormat);
107
+    mySettings->loadParam (params.AudioAlHrtf);
108
     mySettings->loadParam (params.ToShowFps);
109
     mySettings->loadParam (params.IsMobileUI);
110
     mySettings->loadParam (params.IsVSyncOn);
111
@@ -310,11 +341,13 @@
112
     mySettings->loadParam (params.ToPrintWebErrors);
113
     mySettings->loadParam (params.SnapshotImgType);
114
     mySettings->loadParam (params.BlockSleeping);
115
+    mySettings->loadParam (params.ToHideStatusBar);
116
+    mySettings->loadParam (params.ToHideNavBar);
117
+    mySettings->loadParam (params.ToOpenLast);
118
     mySettings->loadParam (params.ToShowExtra);
119
     if(params.StartWebUI->getValue() == WEBUI_ONCE) {
120
         params.StartWebUI->setValue(WEBUI_OFF);
121
     }
122
-    params.StartWebUI->signals.onChanged += stSlot(this, &StMoviePlayer::doSwitchWebUI);
123
 
124
     StString aSavedALDevice;
125
     mySettings->loadString(params.AudioAlDevice->getKey(), aSavedALDevice);
126
@@ -323,6 +356,8 @@
127
     params.IsShuffle    ->signals.onChanged.connect(this, &StMoviePlayer::doSwitchShuffle);
128
     params.ToLoopSingle ->signals.onChanged.connect(this, &StMoviePlayer::doSwitchLoopSingle);
129
     params.AudioAlDevice->signals.onChanged.connect(this, &StMoviePlayer::doSwitchAudioDevice);
130
+    params.AudioAlHrtf  ->signals.onChanged.connect(this, &StMoviePlayer::doSwitchAudioAlHrtf);
131
+    params.ToForceBFormat->signals.onChanged = stSlot(this, &StMoviePlayer::doSetForceBFormat);
132
 
133
 #if defined(__ANDROID__)
134
     addRenderer(new StOutInterlace  (myResMgr, theParentWin));
135
@@ -339,7 +374,8 @@
136
 
137
     // no need in Depth buffer
138
     const StWinAttr anAttribs[] = {
139
-        StWinAttr_GlDepthSize, (StWinAttr )0,
140
+        StWinAttr_GlDepthSize,   (StWinAttr )0,
141
+        StWinAttr_GlStencilSize, (StWinAttr )0,
142
         StWinAttr_NULL
143
     };
144
     for(size_t aRendIter = 0; aRendIter < myRenderers.size(); ++aRendIter) {
145
@@ -404,7 +440,7 @@
146
     anAction = new StActionIntSlot(stCString("DoSeekRight"), stSlot(this, &StMoviePlayer::doSeekRight), 0);
147
     addAction(Action_SeekRight5, anAction, ST_VK_RIGHT);
148
 
149
-    anAction = new StActionIntSlot(stCString("DoOpen1File"), stSlot(this, &StMoviePlayer::doOpen1File), 0);
150
+    anAction = new StActionIntSlot(stCString("DoOpen1File"), stSlot(this, &StMoviePlayer::doOpen1FileAction), 0);
151
 #ifdef __APPLE__
152
     addAction(Action_Open1File, anAction, ST_VK_O | ST_VF_CONTROL, ST_VK_O | ST_VF_COMMAND);
153
 #else
154
@@ -511,6 +547,7 @@
155
         mySettings->saveParam (params.ToSearchSubs);
156
         mySettings->saveParam (params.TargetFps);
157
         mySettings->saveString(params.AudioAlDevice->getKey(), params.AudioAlDevice->getUtfTitle());
158
+        mySettings->saveParam (params.AudioAlHrtf);
159
         mySettings->saveParam (params.LastUpdateDay);
160
         mySettings->saveParam (params.CheckUpdatesDays);
161
         mySettings->saveParam (params.SrcStereoFormat);
162
@@ -518,22 +555,28 @@
163
         mySettings->saveParam (params.ToLoopSingle);
164
         mySettings->saveParam (params.AreGlobalMKeys);
165
         mySettings->saveParam (params.ToShowPlayList);
166
+        mySettings->saveParam (params.ToShowAdjustImage);
167
 
168
+        mySettings->saveParam (params.ToStickPanorama);
169
         mySettings->saveParam (params.ToTrackHead);
170
+        mySettings->saveParam (params.ToTrackHeadAudio);
171
+        mySettings->saveParam (params.ToForceBFormat);
172
         mySettings->saveParam (params.ToShowFps);
173
         mySettings->saveParam (params.IsMobileUI);
174
         mySettings->saveParam (params.IsVSyncOn);
175
         mySettings->saveParam (params.ToLimitFps);
176
         mySettings->saveParam (params.UseGpu);
177
         mySettings->saveParam (params.UseOpenJpeg);
178
-
179
-        mySettings->saveParam (params.StartWebUI);
180
         if(!params.IsLocalWebUI->getValue()) {
181
             mySettings->saveParam(params.WebUIPort);
182
+            mySettings->saveParam(params.StartWebUI);
183
         }
184
         mySettings->saveParam (params.ToPrintWebErrors);
185
         mySettings->saveParam (params.SnapshotImgType);
186
         mySettings->saveParam (params.BlockSleeping);
187
+        mySettings->saveParam (params.ToHideStatusBar);
188
+        mySettings->saveParam (params.ToHideNavBar);
189
+        mySettings->saveParam (params.ToOpenLast);
190
         mySettings->saveParam (params.ToShowExtra);
191
 
192
         // store hot-keys
193
@@ -586,6 +629,7 @@
194
     }
195
 
196
     params.ScaleHiDPI->setValue(myWindow->getScaleFactor());
197
+    doChangeMobileUI(params.IsMobileUI->getValue());
198
     myGUI = new StMoviePlayerGUI(this, myWindow.access(), myLangMap.access(), myPlayList, theTextureQueue, theSubQueue);
199
     myGUI->setContext(myContext);
200
     theTextureQueue->setDeviceCaps(myContext->getDeviceCaps());
201
sview-16_06.tar.gz/StMoviePlayer/StMoviePlayer.h -> sview-17_04.tar.gz/StMoviePlayer/StMoviePlayer.h Changed
110
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -129,7 +129,7 @@
9
 
10
     ST_LOCAL void doFileNext();
11
     ST_LOCAL void doOpen1FileFromGui(StHandle<StString> thePath);
12
-    ST_LOCAL void doOpen1File(const size_t dummy = 0);
13
+    ST_LOCAL void doOpen1FileAction(const size_t dummy = 0);
14
     ST_LOCAL void doOpen2Files(const size_t dummy = 0);
15
     ST_LOCAL void doSaveFileInfo(const size_t theToSave);
16
     ST_LOCAL void doOpenRecent(const size_t theItemId);
17
@@ -154,6 +154,26 @@
18
 
19
     ST_LOCAL void getRecentList(StArrayList<StString>& theList);
20
 
21
+    /**
22
+     * Return true if mobile UI should be enabled considering user option and window margins.
23
+     */
24
+    ST_LOCAL bool toUseMobileUI() const {
25
+        return toUseMobileUI(!myWindow.isNull() ? myWindow->getMargins() : StMarginsI());
26
+    }
27
+
28
+    /**
29
+     * Return true if mobile UI should be enabled considering user option and window margins.
30
+     */
31
+    ST_LOCAL bool toUseMobileUI(const StMarginsI& theMargins) const {
32
+        return params.IsMobileUI->getValue()
33
+            || theMargins.top > 0;
34
+    }
35
+
36
+    /**
37
+     * Return TRUE if OpenAL implementation provides HRTF mixing feature.
38
+     */
39
+    ST_CPPEXPORT bool hasAlHrtf() const;
40
+
41
     struct {
42
 
43
         StHandle<StEnumParam>         ScaleAdjust;       //!< adjust GUI size, see StGLRootWidget::ScaleAdjust
44
@@ -167,6 +187,7 @@
45
         StHandle<StBoolParamNamed>    ToSearchSubs;      //!< automatically search for additional subtitles/audio track files nearby video file
46
         StHandle<StEnumParam>         SubtitlesParser;   //!< subtitles parser
47
         StHandle<StALDeviceParam>     AudioAlDevice;     //!< active OpenAL device
48
+        StHandle<StEnumParam>         AudioAlHrtf;       //!< OpenAL HRTF flag
49
         StHandle<StFloat32Param>      AudioGain;         //!< volume factor
50
         StHandle<StBoolParamNamed>    AudioMute;         //!< volume mute flag
51
         StHandle<StFloat32Param>      AudioDelay;        //!< audio/video synchronization delay
52
@@ -179,12 +200,17 @@
53
         StHandle<StEnumParam>         CheckUpdatesDays;  //!< days count between updates checks
54
         StHandle<StInt32ParamNamed>   LastUpdateDay;     //!< the last time update has been checked
55
         StHandle<StInt32ParamNamed>   SrcStereoFormat;   //!< source format
56
+        StHandle<StBoolParamNamed>    ToStickPanorama;   //!< force panorama input for all files
57
         StHandle<StBoolParamNamed>    ToTrackHead;       //!< enable/disable head-tracking
58
+        StHandle<StBoolParamNamed>    ToTrackHeadAudio;  //!< enable/disable head-tracking for audio listener
59
+        StHandle<StBoolParamNamed>    ToForceBFormat;    //!< force B-Format for any 4-channels audio stream
60
         StHandle<StBoolParamNamed>    ToShowPlayList;    //!< display playlist
61
+        StHandle<StBoolParamNamed>    ToShowAdjustImage; //!< display image adjustment overlay
62
         StHandle<StBoolParamNamed>    ToShowFps;         //!< display FPS meter
63
         StHandle<StBoolParamNamed>    ToShowMenu;        //!< show main menu
64
         StHandle<StBoolParamNamed>    ToShowTopbar;      //!< show topbar
65
-        StHandle<StBoolParamNamed>    IsMobileUI;        //!< display mobile interface
66
+        StHandle<StBoolParamNamed>    IsMobileUI;        //!< display mobile interface (user option)
67
+        StHandle<StBoolParam>         IsMobileUISwitch;  //!< display mobile interface (actual value)
68
         StHandle<StBoolParamNamed>    ToLimitFps;        //!< limit CPU usage or not
69
         StHandle<StBoolParamNamed>    IsVSyncOn;         //!< flag to use VSync
70
         StHandle<StEnumParam>         StartWebUI;        //!< to start Web UI or not
71
@@ -194,6 +220,9 @@
72
         StHandle<StInt32Param>        AudioStream;       //!< active Audio stream
73
         StHandle<StInt32Param>        SubtitlesStream;   //!< active Subtitles stream
74
         StHandle<StEnumParam>         BlockSleeping;     //!< active Audio stream
75
+        StHandle<StBoolParamNamed>    ToHideStatusBar;   //!< hide system-provided status bar
76
+        StHandle<StBoolParamNamed>    ToHideNavBar;      //!< hide system-provided navigation bar
77
+        StHandle<StBoolParamNamed>    ToOpenLast;        //!< option to open last file from recent list by default
78
         StHandle<StBoolParamNamed>    ToShowExtra;       //!< show experimental menu items
79
         StHandle<StInt32ParamNamed>   SnapshotImgType;   //!< default snapshot image type
80
         StString                      lastFolder;        //!< laster folder used to open / save file
81
@@ -254,9 +283,12 @@
82
 
83
     ST_LOCAL virtual void doChangeLanguage(const int32_t theNewLang) ST_ATTR_OVERRIDE;
84
     ST_LOCAL void doScaleGui(const int32_t );
85
+    ST_LOCAL void doChangeMobileUI(const bool );
86
     ST_LOCAL void doScaleHiDPI(const bool );
87
     ST_LOCAL void doSwitchVSync(const bool theValue);
88
     ST_LOCAL void doSwitchAudioDevice(const int32_t theDevId);
89
+    ST_LOCAL void doSwitchAudioAlHrtf(const int32_t theValue);
90
+    ST_LOCAL void doSetForceBFormat(const bool theToForce);
91
     ST_LOCAL void doSetAudioVolume(const float theGain);
92
     ST_LOCAL void doSetAudioMute(const bool theToMute);
93
     ST_LOCAL void doSetAudioDelay(const float theDelaySec);
94
@@ -265,12 +297,15 @@
95
     ST_LOCAL void doFullscreen(const bool theIsFullscreen);
96
     ST_LOCAL void doSwitchSrcFormat(const int32_t theSrcFormat);
97
     ST_LOCAL void doPanoramaOnOff(const size_t );
98
+    ST_LOCAL void doChangeStickPano360(const bool );
99
     ST_LOCAL void doSwitchAudioStream(const int32_t theStreamId);
100
     ST_LOCAL void doSwitchSubtitlesStream(const int32_t theStreamId);
101
     ST_LOCAL void doShowPlayList(const bool theToShow);
102
+    ST_LOCAL void doShowAdjustImage(const bool theToShow);
103
     ST_LOCAL void doUpdateStateLoading();
104
     ST_LOCAL void doUpdateStateLoaded();
105
     ST_LOCAL void doImageAdjustReset(const size_t dummy = 0);
106
+    ST_LOCAL void doHideSystemBars(const bool theToHide);
107
     ST_LOCAL void doSetBenchmark(const bool theValue);
108
 
109
         public:
110
sview-16_06.tar.gz/StMoviePlayer/StMoviePlayer.rc -> sview-17_04.tar.gz/StMoviePlayer/StMoviePlayer.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "Stereoscopic Movie Player\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2007-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2007-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StMoviePlayer\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StMoviePlayer/StMoviePlayerGUI.cpp -> sview-17_04.tar.gz/StMoviePlayer/StMoviePlayerGUI.cpp Changed
201
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -72,10 +72,12 @@
9
 }
10
 
11
 void StMoviePlayerGUI::createDesktopUI(const StHandle<StPlayList>& thePlayList) {
12
+    createImageAdjustments();
13
     createUpperToolbar();
14
     createBottomToolbar(64, 32);
15
 
16
     mySeekBar = new StGLSeekBar(myPanelBottom, 0, scale(18));
17
+    mySeekBar->setMoveTolerance(scale(isMobile() ? 16 : 8));
18
     mySeekBar->signals.onSeekClick.connect(myPlugin, &StMoviePlayer::doSeek);
19
 
20
     myTimeBox = new StTimeBox(myPanelBottom, myBottomBarNbLeft * myIconStep, 0,
21
@@ -128,12 +130,11 @@
22
     const int      anIconStep = scale(48);
23
     aButtonMargins.extend(scale(8));
24
 
25
-    const StMarginsI& aMargins = getRootMargins();
26
-    myPanelUpper = new StGLContainer(this, aMargins.left, aMargins.top, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), scale(4096), scale(128));
27
+    myPanelUpper = new StGLContainer(this, 0, 0, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), scale(4096), scale(128));
28
 
29
     // append the textured buttons
30
     myBtnOpen = new StGLTextureButton(myPanelUpper, aLeft + (aBtnIter++) * anIconStep, aTop);
31
-    myBtnOpen->signals.onBtnClick.connect(myPlugin, &StMoviePlayer::doOpen1File);
32
+    myBtnOpen->signals.onBtnClick.connect(myPlugin, &StMoviePlayer::doOpen1FileAction);
33
     myBtnOpen->setTexturePath(iconTexture(stCString("actionOpen"), anIconSize));
34
     myBtnOpen->setDrawShadow(true);
35
     myBtnOpen->changeMargins() = aButtonMargins;
36
@@ -186,6 +187,14 @@
37
     myBtnPanorama->setDrawShadow(true);
38
     myBtnPanorama->changeMargins() = aButtonMargins;
39
 
40
+    myBtnAdjust = new StGLCheckboxTextured(myPanelUpper, myPlugin->params.ToShowAdjustImage,
41
+                                           iconTexture(stCString("actionColorAdjustOff"), anIconSize),
42
+                                           iconTexture(stCString("actionColorAdjust"),    anIconSize),
43
+                                           aLeft + (aBtnIter++) * anIconStep, aTop,
44
+                                           StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT));
45
+    myBtnAdjust->setDrawShadow(true);
46
+    myBtnAdjust->changeMargins() = aButtonMargins;
47
+
48
     // right buttons
49
     StHandle<StBoolParam> aTrackedSubs = new StBoolParam(false);
50
     myBtnSubs = new StGLCheckboxTextured(myPanelUpper, aTrackedSubs,
51
@@ -213,7 +222,6 @@
52
  */
53
 void StMoviePlayerGUI::createBottomToolbar(const int theIconSize,
54
                                            const int theIconSizeSmall) {
55
-    const StMarginsI& aMargins = getRootMargins();
56
     StMarginsI aButtonMargins, aButtonMarginsSmall;
57
     const IconSize anIconSize      = scaleIcon(theIconSize,      aButtonMargins);
58
     const IconSize anIconSizeSmall = scaleIcon(theIconSizeSmall, aButtonMarginsSmall);
59
@@ -221,9 +229,7 @@
60
 
61
     myBottomBarNbLeft  = 0;
62
     myBottomBarNbRight = 0;
63
-    myPanelBottom = new StGLContainer(this,
64
-                                       aMargins.left   + scale(DISPL_X_REGION_BOTTOM),
65
-                                      -aMargins.bottom,
66
+    myPanelBottom = new StGLContainer(this, scale(DISPL_X_REGION_BOTTOM), 0,
67
                                       StGLCorner(ST_VCORNER_BOTTOM, ST_HCORNER_LEFT),
68
                                       scale(4096), anIconStep);
69
 
70
@@ -240,13 +246,17 @@
71
     myBtnPlay->changeMargins() = aButtonMargins;
72
 
73
     if(myWindow->hasFullscreenMode()) {
74
-        myBtnFullScr = new StGLCheckboxTextured(myPanelBottom, myPlugin->params.IsFullscreen,
75
-                                                iconTexture(stCString("actionVideoFullscreenOff"), anIconSize),
76
-                                                iconTexture(stCString("actionVideoFullscreenOn"),  anIconSize),
77
-                                                (myBottomBarNbRight++) * (-anIconStep), 0,
78
-                                                StGLCorner(ST_VCORNER_TOP, ST_HCORNER_RIGHT));
79
+        myBtnFullScr = new StGLTextureButton(myPanelBottom, (myBottomBarNbRight++) * (-anIconStep), 0,
80
+                                             StGLCorner(ST_VCORNER_TOP, ST_HCORNER_RIGHT), 4);
81
+        myBtnFullScr->setAction(myPlugin->getAction(StMoviePlayer::Action_Fullscreen));
82
+        const StString aSrcTextures[4] = {
83
+            iconTexture(stCString("actionVideoFullscreenOff"),   anIconSize),
84
+            iconTexture(stCString("actionVideoFullscreenOn"),    anIconSize),
85
+            iconTexture(stCString("actionVideoFullscreen3dOff"), anIconSize),
86
+            iconTexture(stCString("actionVideoFullscreen3dOn"),  anIconSize)
87
+        };
88
+        myBtnFullScr->setTexturePath(aSrcTextures, 4);
89
         myBtnFullScr->setDrawShadow(true);
90
-        myBtnFullScr->setFalseOpacity(1.0f);
91
         myBtnFullScr->changeMargins() = aButtonMargins;
92
     }
93
 
94
@@ -279,7 +289,6 @@
95
     myVolumeBar->setCorner(StGLCorner(ST_VCORNER_TOP, ST_HCORNER_RIGHT));
96
     myVolumeBar->signals.onSeekClick  = stSlot(this, &StMoviePlayerGUI::doAudioGain);
97
     myVolumeBar->signals.onSeekScroll = stSlot(this, &StMoviePlayerGUI::doAudioGainScroll);
98
-    myVolumeBar->setMoveTolerance(1);
99
     myVolumeBar->changeMargins().left  = scale(8);
100
     myVolumeBar->changeMargins().right = scale(8);
101
 
102
@@ -307,8 +316,7 @@
103
  * Main menu
104
  */
105
 void StMoviePlayerGUI::createMainMenu() {
106
-    const StMarginsI& aMargins = getRootMargins();
107
-    myMenuRoot = new StGLMenu(this, aMargins.left, aMargins.top, StGLMenu::MENU_HORIZONTAL, true);
108
+    myMenuRoot = new StGLMenu(this, 0, 0, StGLMenu::MENU_HORIZONTAL, true);
109
 
110
     StGLMenu* aMenuMedia   = createMediaMenu();     // Root -> Media menu
111
     StGLMenu* aMenuView    = createViewMenu();      // Root -> View menu
112
@@ -489,6 +497,7 @@
113
     StArrayList<StString> aList;
114
     myPlugin->getRecentList(aList);
115
 
116
+    theMenu->addItem(myPlugin->params.ToOpenLast);
117
     theMenu->addItem(tr(MENU_MEDIA_RECENT_CLEAR))
118
            ->signals.onItemClick.connect(myPlugin, &StMoviePlayer::doClearRecent);
119
     for(size_t anIter = 0; anIter < aList.size(); ++anIter) {
120
@@ -610,15 +619,18 @@
121
 
122
 void StMoviePlayerGUI::fillPanoramaMenu(StGLMenu* theMenu) {
123
     theMenu->addItem(tr(MENU_VIEW_SURFACE_PLANE),
124
-                     myImage->params.ViewMode, StStereoParams::FLAT_IMAGE);
125
+                     myImage->params.ViewMode, StViewSurface_Plain);
126
     theMenu->addItem(tr(MENU_VIEW_SURFACE_SPHERE),
127
-                     myImage->params.ViewMode, StStereoParams::PANORAMA_SPHERE);
128
+                     myImage->params.ViewMode, StViewSurface_Sphere);
129
     theMenu->addItem(tr(MENU_VIEW_SURFACE_CUBEMAP),
130
-                     myImage->params.ViewMode, StStereoParams::PANORAMA_CUBEMAP);
131
+                     myImage->params.ViewMode, StViewSurface_Cubemap);
132
     if(myWindow->hasOrientationSensor()) {
133
         theMenu->addItem(tr(myWindow->isPoorOrientationSensor() ? MENU_VIEW_TRACK_HEAD_POOR : MENU_VIEW_TRACK_HEAD),
134
                          myPlugin->params.ToTrackHead);
135
     }
136
+    theMenu->addItem(tr(MENU_VIEW_TRACK_HEAD_AUDIO),
137
+                     myPlugin->params.ToTrackHeadAudio);
138
+    theMenu->addItem(myPlugin->params.ToStickPanorama);
139
 }
140
 
141
 void StMoviePlayerGUI::doPanoramaCombo(const size_t ) {
142
@@ -891,17 +903,20 @@
143
     const StGLVec3 THE_WHITE(1.0f, 1.0f, 1.0f);
144
     const StString anAbout = tr(ABOUT_DPLUGIN_NAME) + '\n'
145
                            + tr(ABOUT_VERSION) + " " + StVersionInfo::getSDKVersionString()
146
-                           + "\n \n" + tr(ABOUT_DESCRIPTION).format("2007-2016", "kirill@sview.ru", "www.sview.ru")
147
+                           + "\n \n" + tr(ABOUT_DESCRIPTION).format("2007-2017", "kirill@sview.ru", "www.sview.ru")
148
                            + "\n\n<b><i>Used projects</i></b>"
149
                            + "\n \nFFmpeg " + stAV::getVersionInfo() + " (" + stAV::getLicenseInfo() + ")\nhttps://ffmpeg.org/"
150
                            + "\n \nOpenAL Soft (LGPL)\nhttp://kcat.strangesoft.net/openal.html"
151
                            + "\n \nFreeType \nhttp://freetype.org/";
152
 
153
-    StArgumentsMap anInfo;
154
+    StDictionary anInfo;
155
     anInfo.add(StDictEntry("CPU cores", StString(StThread::countLogicalProcessors()) + StString(" logical processor(s)")));
156
     getContext().stglFullInfo(anInfo);
157
     anInfo.add(StDictEntry("Display Scale", StString(myWindow->getMonitors()[myWindow->getPlacement().center()].getScale()) + "x"));
158
 
159
+    // OpenAL info
160
+    myPlugin->myVideo->getAlInfo(anInfo);
161
+
162
     StGLMessageBox* aDialog = new StGLMessageBox(this, tr(MENU_HELP_ABOUT), "", scale(512), scale(300));
163
     StGLTable* aTable = new StGLTable(aDialog->getContent(), 0, 0, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_CENTER));
164
     aTable->setupTable((int )anInfo.size() + 1, 2);
165
@@ -979,7 +994,12 @@
166
     for(size_t aMapIter = 0; aMapIter < anExtraInfo->Info.size(); ++aMapIter) {
167
         StDictEntry& anEntry = anExtraInfo->Info.changeValue(aMapIter);
168
         StString     aKey    = anEntry.getKey().lowerCased();
169
+        const size_t aSize = anEntry.getValue().getSize();
170
         anEntry.changeName() = myLangMap->getValue(aKey);
171
+        if(aSize > 16384) {
172
+            // cut too long strings
173
+            anEntry.changeValue() = anEntry.getValue().subString(0, 128) + "\n...[" + (aSize / 1024) + " KiB]";
174
+        }
175
     }
176
 
177
     const StGLVec3 aWhite(1.0f, 1.0f, 1.0f);
178
@@ -1136,6 +1156,7 @@
179
 }
180
 
181
 void StMoviePlayerGUI::createMobileUI(const StHandle<StPlayList>& thePlayList) {
182
+    createImageAdjustments();
183
     createMobileUpperToolbar();
184
     createMobileBottomToolbar();
185
 
186
@@ -1173,8 +1194,7 @@
187
     const IconSize anIconSize = scaleIcon(32, aButtonMargins);
188
     aButtonMargins.extend(scale(12));
189
 
190
-    const StMarginsI& aRootMargins = getRootMargins();
191
-    myPanelUpper = new StGLContainer(this, aRootMargins.left, aRootMargins.top, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), scale(4096), scale(56));
192
+    myPanelUpper = new StGLContainer(this, 0, 0, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), scale(4096), scale(56));
193
 
194
     int aBtnIter = 0;
195
 
196
@@ -1226,6 +1246,14 @@
197
     myBtnPanorama->setDrawShadow(true);
198
     myBtnPanorama->changeMargins() = aButtonMargins;
199
 
200
+    myBtnAdjust = new StGLCheckboxTextured(myPanelUpper, myPlugin->params.ToShowAdjustImage,
201
sview-16_06.tar.gz/StMoviePlayer/StMoviePlayerGUI.h -> sview-17_04.tar.gz/StMoviePlayer/StMoviePlayerGUI.h Changed
59
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -107,9 +107,13 @@
9
                               const StHandle<StGLTextureQueue>& theTextureQueue,
10
                               const StHandle<StSubQueue>&       theSubQueue);
11
     ST_LOCAL virtual ~StMoviePlayerGUI();
12
-    ST_LOCAL virtual void stglResize(const StGLBoxPx& theRectPx) ST_ATTR_OVERRIDE;
13
+
14
+    ST_LOCAL virtual void stglResize(const StGLBoxPx& theViewPort,
15
+                                     const StMarginsI& theMargins,
16
+                                     float theAspect) ST_ATTR_OVERRIDE;
17
     ST_LOCAL virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
18
-    ST_LOCAL virtual void stglUpdate(const StPointD_t& thePointZo) ST_ATTR_OVERRIDE;
19
+    ST_LOCAL virtual void stglUpdate(const StPointD_t& thePointZo,
20
+                                     bool theIsPreciseInput) ST_ATTR_OVERRIDE;
21
 
22
     ST_LOCAL void setVisibility(const StPointD_t& theCursor);
23
 
24
@@ -173,6 +177,7 @@
25
 
26
     ST_LOCAL void createMobileUpperToolbar();
27
     ST_LOCAL void createMobileBottomToolbar();
28
+    ST_LOCAL void createImageAdjustments();
29
 
30
         private: //! @name callback Slots
31
 
32
@@ -221,6 +226,7 @@
33
     StGLWidget*         myPanelUpper;       //!< upper toolbar
34
     StGLTextureButton*  myBtnOpen;
35
     StGLTextureButton*  myBtnInfo;
36
+    StGLTextureButton*  myBtnAdjust;
37
     StGLTextureButton*  myBtnSwapLR;
38
     StGLCheckboxTextured* myBtnPanorama;
39
     StGLTextureButton*  myBtnSrcFrmt;
40
@@ -240,9 +246,17 @@
41
     StGLTextureButton*  myBtnList;
42
     StGLCheckboxTextured* myBtnShuffle;
43
     StGLCheckboxTextured* myBtnLoop;
44
-    StGLCheckboxTextured* myBtnFullScr;
45
+    StGLTextureButton*  myBtnFullScr;
46
     StGLFpsLabel*       myFpsWidget;
47
 
48
+    StGLWidget*            myAdjustOverlay; //!< image adjustments control
49
+    StGLRangeFieldFloat32* myBtnSepDx;
50
+    StGLRangeFieldFloat32* myBtnSepDy;
51
+    StGLRangeFieldFloat32* myBtnSepRot;
52
+    StGLTextureButton*     myBtnReset3d;
53
+    StGLTextureButton*     myBtnResetColor1;
54
+    StGLTextureButton*     myBtnResetColor2;
55
+
56
     StGLTable*          myHKeysTable;
57
 
58
     bool                myIsVisibleGUI;
59
sview-16_06.tar.gz/StMoviePlayer/StMoviePlayerStrings.cpp -> sview-17_04.tar.gz/StMoviePlayer/StMoviePlayerStrings.cpp Changed
53
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2013-2015 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2013-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -21,6 +21,9 @@
9
 #include "StMoviePlayer.h"
10
 #include <StStrings/StLangMap.h>
11
 
12
+// Degree sign in UTF-8 encoding.
13
+#define THE_DEGREE_SIGN "\xC2\xB0"
14
+
15
 namespace StMoviePlayerStrings {
16
 
17
 inline void addAction(StLangMap&              theStrings,
18
@@ -190,6 +193,10 @@
19
                "Track orientation");
20
     theStrings(MENU_VIEW_TRACK_HEAD_POOR,
21
                "Track orientation (poor)");
22
+    theStrings(MENU_VIEW_TRACK_HEAD_AUDIO,
23
+               "Orient audio");
24
+    theStrings(MENU_VIEW_STICK_PANORAMA360,
25
+               "Stick at panorama 360" THE_DEGREE_SIGN);
26
     theStrings(MENU_VIEW_DISPLAY_MODE_STEREO,
27
                "Stereo");
28
     theStrings(MENU_VIEW_DISPLAY_MODE_LEFT,
29
@@ -296,6 +303,10 @@
30
                "Double click");
31
     theStrings(OPTION_EXIT_ON_ESCAPE_WINDOWED,
32
                "When windowed");
33
+    theStrings(OPTION_HIDE_NAVIGATION_BAR,
34
+               "Hide system navigation bar");
35
+    theStrings(OPTION_OPEN_LAST_ON_STARTUP,
36
+               "Open last played file on startup");
37
 
38
     theStrings(FILE_VIDEO_OPEN,
39
                "Open another movie");
40
@@ -584,10 +595,10 @@
41
               "Angular separation - increase");
42
     addAction(theStrings, StMoviePlayer::Action_StereoParamsBegin + StGLImageRegion::Action_Rot90Counter,
43
               "DoParamsRotZ90Dec",
44
-              "Rotate 90 degrees counterclockwise");
45
+              "Rotate 90" THE_DEGREE_SIGN " counterclockwise");
46
     addAction(theStrings, StMoviePlayer::Action_StereoParamsBegin + StGLImageRegion::Action_Rot90Clockwise,
47
               "DoParamsRotZ90Inc",
48
-              "Rotate 90 degrees clockwise");
49
+              "Rotate 90" THE_DEGREE_SIGN " clockwise");
50
     addAction(theStrings, StMoviePlayer::Action_StereoParamsBegin + StGLImageRegion::Action_RotCounter,
51
               "DoParamsRotZDec",
52
               "Rotate counterclockwise");
53
sview-16_06.tar.gz/StMoviePlayer/StMoviePlayerStrings.h -> sview-17_04.tar.gz/StMoviePlayer/StMoviePlayerStrings.h Changed
26
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -115,6 +115,8 @@
9
         MENU_VIEW_SURFACE_CUBEMAP   = 1283,
10
         MENU_VIEW_TRACK_HEAD        = 1285,
11
         MENU_VIEW_TRACK_HEAD_POOR   = 1286,
12
+        MENU_VIEW_TRACK_HEAD_AUDIO  = 1287,
13
+        MENU_VIEW_STICK_PANORAMA360 = 1288,
14
 
15
         // Root -> Audio menu
16
         MENU_AUDIO = 1300,
17
@@ -190,6 +192,8 @@
18
         OPTION_EXIT_ON_ESCAPE_ONE_CLICK    = 1703,
19
         OPTION_EXIT_ON_ESCAPE_DOUBLE_CLICK = 1704,
20
         OPTION_EXIT_ON_ESCAPE_WINDOWED     = 1705,
21
+        OPTION_HIDE_NAVIGATION_BAR         = 1710,
22
+        OPTION_OPEN_LAST_ON_STARTUP        = 1711,
23
 
24
         // Open/Save dialogs
25
         DIALOG_OPEN_FILE       = 2000,
26
sview-16_06.tar.gz/StMoviePlayer/StVideo/StALContext.cpp -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StALContext.cpp Changed
201
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2014 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -17,21 +17,68 @@
9
  */
10
 
11
 #include "StALContext.h"
12
+
13
 #include <StStrings/StLogger.h>
14
+#include <StThreads/StProcess.h>
15
 
16
 #ifndef ALC_CONNECTED
17
     #define ALC_CONNECTED 0x313 // undefined on mac os
18
 #endif
19
 
20
+namespace {
21
+    /**
22
+     * Return string for the status.
23
+     */
24
+    const char* hrtfStatusToString(ALCint theStatus) {
25
+        switch(theStatus) {
26
+            case ALC_HRTF_DISABLED_SOFT:            return "Disabled";
27
+            case ALC_HRTF_ENABLED_SOFT:             return "Enabled";
28
+            case ALC_HRTF_DENIED_SOFT:              return "Denied";
29
+            case ALC_HRTF_REQUIRED_SOFT:            return "Required";
30
+            case ALC_HRTF_HEADPHONES_DETECTED_SOFT: return "Headphones detected";
31
+            case ALC_HRTF_UNSUPPORTED_FORMAT_SOFT:  return "Unsupported format";
32
+        }
33
+        return "UNKNOWN";
34
+    }
35
+
36
+    /**
37
+     * Initialize OpenAL resources.
38
+     */
39
+    bool stalGlobalInit() {
40
+    #ifdef __APPLE__
41
+        static bool isFirstCall = true;
42
+        if(!isFirstCall) {
43
+            return true;
44
+        }
45
+        isFirstCall = false;
46
+
47
+        // append sView resources folder to OpenAL search path
48
+        // so that we can put default hrtf tables into OS X application bundle
49
+        const StString anStResFolder = StProcess::getStShareFolder();
50
+        StString aDataDirs = StProcess::getEnv("XDG_DATA_DIRS");
51
+        if(aDataDirs.isEmpty()) {
52
+            aDataDirs = "/usr/local/share/:/usr/share/";
53
+        }
54
+        aDataDirs = aDataDirs + ":" + anStResFolder;
55
+        StProcess::setEnv("XDG_DATA_DIRS", aDataDirs);
56
+    #endif
57
+        return true;
58
+    }
59
+}
60
+
61
 StALContext::StALContext()
62
 : hasExtEAX2(false),
63
   hasExtFloat32(false),
64
   hasExtFloat64(false),
65
   hasExtMultiChannel(false),
66
+  hasExtBFormat(false),
67
   hasExtDisconnect(false),
68
-  hDevice(NULL),
69
-  hContext(NULL) {
70
-    //
71
+  hasExtSoftHrtf(false),
72
+  alcGetStringiSOFT(NULL),
73
+  alcResetDeviceSOFT(NULL),
74
+  myAlDevice(NULL),
75
+  myAlContext(NULL) {
76
+    stalGlobalInit();
77
 }
78
 
79
 StALContext::~StALContext() {
80
@@ -39,36 +86,44 @@
81
 }
82
 
83
 StString StALContext::toStringExtensions() const {
84
-    StString extList = "OpenAL extensions:\n";
85
+    StString anExtList = "OpenAL extensions: ";
86
     if(hasExtEAX2) {
87
-        extList += " - EAX2.0;\n";
88
+        anExtList += "EAX2.0 ";
89
     }
90
     if(hasExtFloat32) {
91
-        extList += " - float32 mono/stereo formats;\n";
92
+        anExtList += "float32 ";
93
     }
94
     if(hasExtFloat64) {
95
-        extList += " - float64 mono/stereo formats;\n";
96
+        anExtList += "float64 ";
97
     }
98
     if(hasExtMultiChannel) {
99
-        extList += " - multi-channel formats;\n";
100
+        anExtList += "multi-channel ";
101
+    }
102
+    if(hasExtBFormat) {
103
+        anExtList += "B-Format ";
104
     }
105
     if(hasExtDisconnect) {
106
-        extList += " - ALC_EXT_disconnect;\n";
107
+        anExtList += "ALC_EXT_disconnect ";
108
     }
109
-    return extList;
110
+    if(hasExtSoftHrtf) {
111
+        ALCint aHrtfStatus = ALC_HRTF_DISABLED_SOFT;
112
+        alcGetIntegerv(myAlDevice, ALC_HRTF_STATUS_SOFT, 1, &aHrtfStatus);
113
+        anExtList += StString("ALC_SOFT_HRTF [") + hrtfStatusToString(aHrtfStatus) + "] ";
114
+    }
115
+    return anExtList;
116
 }
117
 
118
 bool StALContext::create(const std::string& theDeviceName) {
119
     if(theDeviceName.empty()) {
120
         // open default device
121
-        hDevice = alcOpenDevice(NULL);
122
+        myAlDevice = alcOpenDevice(NULL);
123
     } else {
124
-        hDevice = alcOpenDevice(theDeviceName.c_str());
125
+        myAlDevice = alcOpenDevice(theDeviceName.c_str());
126
     }
127
-    if(hDevice == NULL) {
128
+    if(myAlDevice == NULL) {
129
         return false;
130
     }
131
-    hContext = alcCreateContext(hDevice, NULL);
132
+    myAlContext = alcCreateContext(myAlDevice, NULL);
133
     makeCurrent();
134
 
135
     // check extensions
136
@@ -76,7 +131,14 @@
137
     hasExtFloat32      = alIsExtensionPresent("AL_EXT_float32")   == AL_TRUE;
138
     hasExtFloat64      = alIsExtensionPresent("AL_EXT_double")    == AL_TRUE;
139
     hasExtMultiChannel = alIsExtensionPresent("AL_EXT_MCFORMATS") == AL_TRUE;
140
-    hasExtDisconnect   = alcIsExtensionPresent(hDevice, "ALC_EXT_disconnect") == AL_TRUE;
141
+    hasExtBFormat      = alIsExtensionPresent("AL_EXT_BFORMAT")   == AL_TRUE;
142
+    hasExtDisconnect   = alcIsExtensionPresent(myAlDevice, "ALC_EXT_disconnect") == AL_TRUE;
143
+    if(alcIsExtensionPresent(myAlDevice, "ALC_SOFT_HRTF") == AL_TRUE) {
144
+        alcGetStringiSOFT  = (alcGetStringiSOFT_t  )alcGetProcAddress(myAlDevice, "alcGetStringiSOFT");
145
+        alcResetDeviceSOFT = (alcResetDeviceSOFT_t )alcGetProcAddress(myAlDevice, "alcResetDeviceSOFT");
146
+        hasExtSoftHrtf = alcGetStringiSOFT  != NULL
147
+                      && alcResetDeviceSOFT != NULL;
148
+    }
149
 
150
     // debug info
151
     ST_DEBUG_LOG(toStringExtensions());
152
@@ -84,35 +146,69 @@
153
     return true;
154
 }
155
 
156
+void StALContext::fullInfo(StDictionary& theMap) const {
157
+    StString anExtensions, aHrtfState;
158
+    if(hasExtFloat32) {
159
+        anExtensions += "AL_EXT_float32 ";
160
+    }
161
+    if(hasExtFloat64) {
162
+        anExtensions += "AL_EXT_double ";
163
+    }
164
+    if(hasExtMultiChannel) {
165
+        anExtensions += "AL_EXT_MCFORMATS ";
166
+    }
167
+    if(hasExtBFormat) {
168
+        anExtensions += "AL_EXT_BFORMAT ";
169
+    }
170
+    if(hasExtDisconnect) {
171
+        anExtensions += "ALC_EXT_disconnect ";
172
+    }
173
+    if(hasExtSoftHrtf) {
174
+        ALCint aHrtfStatus = ALC_HRTF_DISABLED_SOFT;
175
+        alcGetIntegerv(myAlDevice, ALC_HRTF_STATUS_SOFT, 1, &aHrtfStatus);
176
+        aHrtfState = hrtfStatusToString(aHrtfStatus);
177
+    }
178
+
179
+    theMap.add(StDictEntry("ALvendor",    (const char* )alGetString(AL_VENDOR)));
180
+    theMap.add(StDictEntry("ALrenderer",  (const char* )alGetString(AL_RENDERER)));
181
+    theMap.add(StDictEntry("ALversion",   (const char* )alGetString(AL_VERSION)));
182
+    theMap.add(StDictEntry("OpenAL extensions", anExtensions));
183
+    theMap.add(StDictEntry("OpenAL HRTF mixing", !aHrtfState.isEmpty() ? aHrtfState : "Not implemented"));
184
+}
185
+
186
 void StALContext::destroy() {
187
     alcMakeContextCurrent(NULL);
188
-    if(hContext != NULL && hDevice != NULL) {
189
-        alcDestroyContext(hContext);
190
-        alcCloseDevice(hDevice);
191
+    if(myAlContext != NULL && myAlDevice != NULL) {
192
+        alcDestroyContext(myAlContext);
193
+        alcCloseDevice(myAlDevice);
194
     }
195
-    hContext = NULL;
196
-    hDevice = NULL;
197
+    myAlContext = NULL;
198
+    myAlDevice = NULL;
199
 
200
     // remove extensions
201
sview-16_06.tar.gz/StMoviePlayer/StVideo/StALContext.h -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StALContext.h Changed
102
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -19,7 +19,7 @@
9
 #ifndef __StALContext_h_
10
 #define __StALContext_h_
11
 
12
-#include <StStrings/StString.h>
13
+#include <StStrings/StDictionary.h>
14
 
15
 // OpenAL headers
16
 #if (defined(__APPLE__))
17
@@ -32,6 +32,36 @@
18
     #include <AL/alext.h>
19
 #endif
20
 
21
+namespace {
22
+    // Accepted as part of the <attrList> parameter of alcCreateContext and alcDeviceResetSOFT(), and as the <paramName> parameter of alcGetIntegerv()
23
+    #define ALC_HRTF_SOFT                            0x1992
24
+
25
+    // Accepted as part of the <attrList> parameter of alcCreateContext() and alcDeviceResetSOFT()
26
+    #define ALC_HRTF_ID_SOFT                         0x1996
27
+
28
+    // Accepted as part of the <attrList> parameter of alcCreateContext() and alcDeviceResetSOFT(), for the ALC_HRTF_SOFT attribute.
29
+    #define ALC_DONT_CARE_SOFT                       0x0002
30
+
31
+    // Accepted as the <paramName> parameter of alcGetIntegerv()
32
+    #define ALC_HRTF_STATUS_SOFT                     0x1993
33
+    #define ALC_NUM_HRTF_SPECIFIERS_SOFT             0x1994
34
+
35
+    // Accepted as the <paramName> parameter of alcGetString() and alcGetStringiSOFT()
36
+    #define ALC_HRTF_SPECIFIER_SOFT                  0x1995
37
+
38
+    // Possible results from a ALC_HRTF_STATUS_SOFT query
39
+    #define ALC_HRTF_DISABLED_SOFT                   0x0000
40
+
41
+    #define ALC_HRTF_ENABLED_SOFT                    0x0001
42
+    #define ALC_HRTF_DENIED_SOFT                     0x0002
43
+    #define ALC_HRTF_REQUIRED_SOFT                   0x0003
44
+    #define ALC_HRTF_HEADPHONES_DETECTED_SOFT        0x0004
45
+    #define ALC_HRTF_UNSUPPORTED_FORMAT_SOFT         0x0005
46
+
47
+    typedef const ALCchar* (ALC_APIENTRY* alcGetStringiSOFT_t )(ALCdevice* device, ALCenum paramName, ALCsizei index);
48
+    typedef ALCboolean     (ALC_APIENTRY* alcResetDeviceSOFT_t)(ALCdevice* device, const ALCint* attrList);
49
+}
50
+
51
 /**
52
  * Wrapper over C-interface to OpenAL library.
53
  * Represent the device context.
54
@@ -44,7 +74,12 @@
55
     bool hasExtFloat32;      //!< has 32bit float formats
56
     bool hasExtFloat64;      //!< has 64bit float formats
57
     bool hasExtMultiChannel; //!< has multichannel formats
58
+    bool hasExtBFormat;      //!< AL_EXT_BFORMAT
59
     bool hasExtDisconnect;   //!< ALC_EXT_disconnect
60
+    bool hasExtSoftHrtf;     //!< ALC_SOFT_HRTF
61
+
62
+    alcGetStringiSOFT_t  alcGetStringiSOFT;
63
+    alcResetDeviceSOFT_t alcResetDeviceSOFT;
64
 
65
         public:
66
 
67
@@ -64,6 +99,11 @@
68
     ST_CPPEXPORT StString toStringExtensions() const;
69
 
70
     /**
71
+     * Retrieve info from OpenAL context.
72
+     */
73
+    ST_CPPEXPORT void fullInfo(StDictionary& theMap) const;
74
+
75
+    /**
76
      * Creates the AL device with specified name.
77
      */
78
     ST_CPPEXPORT bool create(const std::string& theDeviceName);
79
@@ -84,10 +124,20 @@
80
      */
81
     ST_CPPEXPORT bool isConnected() const;
82
 
83
+    /**
84
+     * Return OpenAL device.
85
+     */
86
+    ST_LOCAL ALCdevice* getAlDevice() { return myAlDevice; }
87
+
88
+    /**
89
+     * Return OpenAL context.
90
+     */
91
+    ST_LOCAL ALCcontext* getAlContext() { return myAlContext; }
92
+
93
         private: //!< private fields
94
 
95
-    ALCdevice*  hDevice;
96
-    ALCcontext* hContext;
97
+    ALCdevice*  myAlDevice;
98
+    ALCcontext* myAlContext;
99
 
100
 };
101
 
102
sview-16_06.tar.gz/StMoviePlayer/StVideo/StAVPacketQueue.h -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StAVPacketQueue.h Changed
31
 
1
@@ -59,13 +59,6 @@
2
     ST_LOCAL void clear();
3
 
4
     /**
5
-     * Open stream.
6
-     */
7
-    ST_LOCAL virtual bool init(AVFormatContext*   theFormatCtx,
8
-                               const unsigned int theStreamId,
9
-                               const StString&    theFileName);
10
-
11
-    /**
12
      * Close stream.
13
      */
14
     ST_LOCAL virtual void deinit();
15
@@ -231,6 +224,15 @@
16
         StSignal<void (const StCString& )> onError;
17
     } signals;
18
 
19
+        protected:
20
+
21
+    /**
22
+     * Open stream.
23
+     */
24
+    ST_LOCAL virtual bool init(AVFormatContext*   theFormatCtx,
25
+                               const unsigned int theStreamId,
26
+                               const StString&    theFileName);
27
+
28
         protected: //! @name Fields should be full-controlled by heirs
29
 
30
     StString         myFileName;       //!< file name
31
sview-16_06.tar.gz/StMoviePlayer/StVideo/StAudioQueue.cpp -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StAudioQueue.cpp Changed
201
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -21,37 +21,44 @@
9
 #include <StGL/StGLVec.h>
10
 #include <StThreads/StThread.h>
11
 
12
-/**
13
- * Check OpenAL state.
14
- */
15
-bool stalCheckErrors(const StString& ST_DEBUG_VAR(theProcedure)) {
16
-    ALenum anError = alGetError();
17
-    switch(anError) {
18
-        case AL_NO_ERROR: return true; // alright
19
-        case AL_INVALID_NAME:      ST_DEBUG_LOG(theProcedure + ": AL_INVALID_NAME");      return false;
20
-        case AL_INVALID_ENUM:      ST_DEBUG_LOG(theProcedure + ": AL_INVALID_ENUM");      return false;
21
-        case AL_INVALID_VALUE:     ST_DEBUG_LOG(theProcedure + ": AL_INVALID_VALUE");     return false;
22
-        case AL_INVALID_OPERATION: ST_DEBUG_LOG(theProcedure + ": AL_INVALID_OPERATION"); return false;
23
-        case AL_OUT_OF_MEMORY:     ST_DEBUG_LOG(theProcedure + ": AL_OUT_OF_MEMORY");     return false;
24
-        default:                   ST_DEBUG_LOG(theProcedure + ": OpenAL unknown error"); return false;
25
+namespace {
26
+
27
+    /**
28
+     * Check OpenAL state.
29
+     */
30
+    bool stalCheckErrors(const StString& ST_DEBUG_VAR(theProcedure)) {
31
+        ALenum anError = alGetError();
32
+        switch(anError) {
33
+            case AL_NO_ERROR: return true; // alright
34
+            case AL_INVALID_NAME:      ST_DEBUG_LOG(theProcedure + ": AL_INVALID_NAME");      return false;
35
+            case AL_INVALID_ENUM:      ST_DEBUG_LOG(theProcedure + ": AL_INVALID_ENUM");      return false;
36
+            case AL_INVALID_VALUE:     ST_DEBUG_LOG(theProcedure + ": AL_INVALID_VALUE");     return false;
37
+            case AL_INVALID_OPERATION: ST_DEBUG_LOG(theProcedure + ": AL_INVALID_OPERATION"); return false;
38
+            case AL_OUT_OF_MEMORY:     ST_DEBUG_LOG(theProcedure + ": AL_OUT_OF_MEMORY");     return false;
39
+            default:                   ST_DEBUG_LOG(theProcedure + ": OpenAL unknown error"); return false;
40
+        }
41
     }
42
-}
43
 
44
-static const StGLVec3 POSITION_LEFT         (-1.0f, 0.0f,  0.0f);
45
-static const StGLVec3 POSITION_RIGHT        ( 1.0f, 0.0f,  0.0f);
46
+    static const StGLVec3 THE_POSITION_LEFT         (-1.0f, 0.0f,  0.0f);
47
+    static const StGLVec3 THE_POSITION_RIGHT        ( 1.0f, 0.0f,  0.0f);
48
+
49
+    static const StGLVec3 THE_POSITION_CENTER       ( 0.0f, 0.0f,  0.0f);
50
+    static const StGLVec3 THE_POSITION_FRONT_LEFT   (-1.0f, 0.0f, -1.0f);
51
+    static const StGLVec3 THE_POSITION_FRONT_CENTER ( 0.0f, 0.0f, -1.0f);
52
+    static const StGLVec3 THE_POSITION_FRONT_RIGHT  ( 1.0f, 0.0f, -1.0f);
53
+    static const StGLVec3 THE_POSITION_LFE          ( 0.0f, 0.0f,  0.0f);
54
+    static const StGLVec3 THE_POSITION_REAR_LEFT    (-1.0f, 0.0f,  1.0f);
55
+    static const StGLVec3 THE_POSITION_REAR_RIGHT   ( 1.0f, 0.0f,  1.0f);
56
 
57
-static const StGLVec3 POSITION_CENTER       ( 0.0f, 0.0f,  0.0f);
58
-static const StGLVec3 POSITION_FRONT_LEFT   (-1.0f, 0.0f, -1.0f);
59
-static const StGLVec3 POSITION_FRONT_CENTER ( 0.0f, 0.0f, -1.0f);
60
-static const StGLVec3 POSITION_FRONT_RIGHT  ( 1.0f, 0.0f, -1.0f);
61
-static const StGLVec3 POSITION_LFE          ( 0.0f, 0.0f,  0.0f);
62
-static const StGLVec3 POSITION_REAR_LEFT    (-1.0f, 0.0f,  1.0f);
63
-static const StGLVec3 POSITION_REAR_RIGHT   ( 1.0f, 0.0f,  1.0f);
64
+    static const StGLVec3 THE_POSITION_REAR_LEFT71  (-1.0f, 0.0f,  1.0f);
65
+    static const StGLVec3 THE_POSITION_REAR_RIGHT71 ( 1.0f, 0.0f,  1.0f);
66
+    static const StGLVec3 THE_POSITION_SIDE_LEFT71  (-1.0f, 0.0f,  0.0f);
67
+    static const StGLVec3 THE_POSITION_SIDE_RIGHT71 ( 1.0f, 0.0f,  0.0f);
68
 
69
-static const StGLVec3 POSITION_REAR_LEFT71  (-1.0f, 0.0f,  1.0f);
70
-static const StGLVec3 POSITION_REAR_RIGHT71 ( 1.0f, 0.0f,  1.0f);
71
-static const StGLVec3 POSITION_SIDE_LEFT71  (-1.0f, 0.0f,  0.0f);
72
-static const StGLVec3 POSITION_SIDE_RIGHT71 ( 1.0f, 0.0f,  0.0f);
73
+    static const StGLVec3 THE_LISTENER_FORWARD      ( 0.0f, 0.0f, -1.0f);
74
+    static const StGLVec3 THE_LISTENER_UP           ( 0.0f, 1.0f,  0.0f);
75
+
76
+}
77
 
78
 #if(LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 0, 0))
79
 /**
80
@@ -78,59 +85,59 @@
81
 #endif
82
 
83
 void StAudioQueue::stalConfigureSources1() {
84
-    alSourcefv(myAlSources[0], AL_POSITION, POSITION_CENTER);
85
+    alSourcefv(myAlSources[0], AL_POSITION, THE_POSITION_CENTER);
86
     stalCheckErrors("alSource*1.0");
87
 }
88
 
89
 void StAudioQueue::stalConfigureSources2_0() {
90
-    alSourcefv(myAlSources[0], AL_POSITION, POSITION_LEFT);
91
-    alSourcefv(myAlSources[1], AL_POSITION, POSITION_RIGHT);
92
+    alSourcefv(myAlSources[0], AL_POSITION, THE_POSITION_LEFT);
93
+    alSourcefv(myAlSources[1], AL_POSITION, THE_POSITION_RIGHT);
94
     stalCheckErrors("alSource*2.0");
95
 }
96
 
97
 void StAudioQueue::stalConfigureSources3_0() {
98
-    alSourcefv(myAlSources[0], AL_POSITION, POSITION_LEFT);
99
-    alSourcefv(myAlSources[1], AL_POSITION, POSITION_RIGHT);
100
-    alSourcefv(myAlSources[2], AL_POSITION, POSITION_CENTER);
101
+    alSourcefv(myAlSources[0], AL_POSITION, THE_POSITION_LEFT);
102
+    alSourcefv(myAlSources[1], AL_POSITION, THE_POSITION_RIGHT);
103
+    alSourcefv(myAlSources[2], AL_POSITION, THE_POSITION_CENTER);
104
     stalCheckErrors("alSource*3.0");
105
 }
106
 
107
 void StAudioQueue::stalConfigureSources4_0() {
108
-    alSourcefv(myAlSources[0], AL_POSITION, POSITION_FRONT_LEFT);
109
-    alSourcefv(myAlSources[1], AL_POSITION, POSITION_FRONT_RIGHT);
110
-    alSourcefv(myAlSources[2], AL_POSITION, POSITION_REAR_LEFT);
111
-    alSourcefv(myAlSources[3], AL_POSITION, POSITION_REAR_RIGHT);
112
+    alSourcefv(myAlSources[0], AL_POSITION, THE_POSITION_FRONT_LEFT);
113
+    alSourcefv(myAlSources[1], AL_POSITION, THE_POSITION_FRONT_RIGHT);
114
+    alSourcefv(myAlSources[2], AL_POSITION, THE_POSITION_REAR_LEFT);
115
+    alSourcefv(myAlSources[3], AL_POSITION, THE_POSITION_REAR_RIGHT);
116
     stalCheckErrors("alSource*4.0");
117
 }
118
 
119
 void StAudioQueue::stalConfigureSources5_0() {
120
-    alSourcefv(myAlSources[0], AL_POSITION, POSITION_FRONT_LEFT);
121
-    alSourcefv(myAlSources[1], AL_POSITION, POSITION_FRONT_RIGHT);
122
-    alSourcefv(myAlSources[2], AL_POSITION, POSITION_FRONT_CENTER);
123
-    alSourcefv(myAlSources[3], AL_POSITION, POSITION_REAR_LEFT);
124
-    alSourcefv(myAlSources[4], AL_POSITION, POSITION_REAR_RIGHT);
125
+    alSourcefv(myAlSources[0], AL_POSITION, THE_POSITION_FRONT_LEFT);
126
+    alSourcefv(myAlSources[1], AL_POSITION, THE_POSITION_FRONT_RIGHT);
127
+    alSourcefv(myAlSources[2], AL_POSITION, THE_POSITION_FRONT_CENTER);
128
+    alSourcefv(myAlSources[3], AL_POSITION, THE_POSITION_REAR_LEFT);
129
+    alSourcefv(myAlSources[4], AL_POSITION, THE_POSITION_REAR_RIGHT);
130
     stalCheckErrors("alSource*5.0");
131
 }
132
 
133
 void StAudioQueue::stalConfigureSources5_1() {
134
-    alSourcefv(myAlSources[0], AL_POSITION, POSITION_FRONT_LEFT);
135
-    alSourcefv(myAlSources[1], AL_POSITION, POSITION_FRONT_RIGHT);
136
-    alSourcefv(myAlSources[2], AL_POSITION, POSITION_FRONT_CENTER);
137
-    alSourcefv(myAlSources[3], AL_POSITION, POSITION_LFE);
138
-    alSourcefv(myAlSources[4], AL_POSITION, POSITION_REAR_LEFT);
139
-    alSourcefv(myAlSources[5], AL_POSITION, POSITION_REAR_RIGHT);
140
+    alSourcefv(myAlSources[0], AL_POSITION, THE_POSITION_FRONT_LEFT);
141
+    alSourcefv(myAlSources[1], AL_POSITION, THE_POSITION_FRONT_RIGHT);
142
+    alSourcefv(myAlSources[2], AL_POSITION, THE_POSITION_FRONT_CENTER);
143
+    alSourcefv(myAlSources[3], AL_POSITION, THE_POSITION_LFE);
144
+    alSourcefv(myAlSources[4], AL_POSITION, THE_POSITION_REAR_LEFT);
145
+    alSourcefv(myAlSources[5], AL_POSITION, THE_POSITION_REAR_RIGHT);
146
     stalCheckErrors("alSource*5.1");
147
 }
148
 
149
 void StAudioQueue::stalConfigureSources7_1() {
150
-    alSourcefv(myAlSources[0], AL_POSITION, POSITION_FRONT_LEFT);
151
-    alSourcefv(myAlSources[1], AL_POSITION, POSITION_FRONT_RIGHT);
152
-    alSourcefv(myAlSources[2], AL_POSITION, POSITION_FRONT_CENTER);
153
-    alSourcefv(myAlSources[3], AL_POSITION, POSITION_LFE);
154
-    alSourcefv(myAlSources[4], AL_POSITION, POSITION_REAR_LEFT71);
155
-    alSourcefv(myAlSources[5], AL_POSITION, POSITION_REAR_RIGHT71);
156
-    alSourcefv(myAlSources[6], AL_POSITION, POSITION_SIDE_LEFT71);
157
-    alSourcefv(myAlSources[7], AL_POSITION, POSITION_SIDE_RIGHT71);
158
+    alSourcefv(myAlSources[0], AL_POSITION, THE_POSITION_FRONT_LEFT);
159
+    alSourcefv(myAlSources[1], AL_POSITION, THE_POSITION_FRONT_RIGHT);
160
+    alSourcefv(myAlSources[2], AL_POSITION, THE_POSITION_FRONT_CENTER);
161
+    alSourcefv(myAlSources[3], AL_POSITION, THE_POSITION_LFE);
162
+    alSourcefv(myAlSources[4], AL_POSITION, THE_POSITION_REAR_LEFT71);
163
+    alSourcefv(myAlSources[5], AL_POSITION, THE_POSITION_REAR_RIGHT71);
164
+    alSourcefv(myAlSources[6], AL_POSITION, THE_POSITION_SIDE_LEFT71);
165
+    alSourcefv(myAlSources[7], AL_POSITION, THE_POSITION_SIDE_RIGHT71);
166
     stalCheckErrors("alSource*7.1");
167
 }
168
 
169
@@ -148,64 +155,126 @@
170
         }
171
     }
172
     myAlCtx.makeCurrent();
173
+    stalResetHrtf();
174
+    {
175
+        StMutexAuto aLock(myAlInfoMutex);
176
+        myAlInfo.clear();
177
+        myAlCtx.fullInfo(myAlInfo);
178
+    }
179
 
180
     alGetError(); // clear error code
181
 
182
     // generate the buffers
183
-    for(size_t srcId = 0; srcId < NUM_AL_SOURCES; ++srcId) {
184
-        alGenBuffers(NUM_AL_BUFFERS, &myAlBuffers[srcId][0]);
185
-        stalCheckErrors(StString("alGenBuffers") + srcId);
186
+    for(size_t aSrcId = 0; aSrcId < THE_NUM_AL_SOURCES; ++aSrcId) {
187
+        alGenBuffers(THE_NUM_AL_BUFFERS, &myAlBuffers[aSrcId][0]);
188
+        stalCheckErrors(StString("alGenBuffers") + aSrcId);
189
     }
190
 
191
     // generate the sources
192
-    alGenSources(NUM_AL_SOURCES, myAlSources);
193
+    alGenSources(THE_NUM_AL_SOURCES, myAlSources);
194
     stalCheckErrors("alGenSources");
195
 
196
     // configure sources
197
     const StGLVec3 aZeroVec(0.0f);
198
-    for(size_t srcId = 0; srcId < NUM_AL_SOURCES; ++srcId) {
199
-        alSourcefv(myAlSources[srcId], AL_POSITION,        aZeroVec);
200
-        alSourcefv(myAlSources[srcId], AL_VELOCITY,        aZeroVec);
201
sview-16_06.tar.gz/StMoviePlayer/StVideo/StAudioQueue.h -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StAudioQueue.h Changed
201
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -44,9 +44,18 @@
9
  */
10
 class StAudioQueue : public StAVPacketQueue {
11
 
12
+        public:
13
+
14
+    enum StAlHrtfRequest {
15
+        StAlHrtfRequest_Auto     = 0,
16
+        StAlHrtfRequest_ForceOn  = 1,
17
+        StAlHrtfRequest_ForceOff = 2,
18
+    };
19
+
20
         public: //! @name public API
21
 
22
-    ST_LOCAL StAudioQueue(const std::string& theAlDeviceName);
23
+    ST_LOCAL StAudioQueue(const std::string& theAlDeviceName,
24
+                          StAudioQueue::StAlHrtfRequest theAlHrtf);
25
     ST_LOCAL virtual ~StAudioQueue();
26
 
27
     ST_LOCAL bool isInDowntime() {
28
@@ -98,6 +107,13 @@
29
     }
30
 
31
     /**
32
+     * Setup OpenAL HRTF mixing.
33
+     */
34
+    ST_LOCAL void setAlHrtfRequest(StAlHrtfRequest theAlHrt) {
35
+        myAlHrtf = theAlHrt;
36
+    }
37
+
38
+    /**
39
      * Set audio gain.
40
      */
41
     ST_LOCAL void setAudioVolume(const float theGain) {
42
@@ -105,6 +121,34 @@
43
     }
44
 
45
     /**
46
+     * Set head orientation.
47
+     */
48
+    ST_LOCAL void setHeadOrientation(const StGLQuaternion& theOrient, bool theToTrack) {
49
+        if(!theToTrack) {
50
+            myToOrientListener = false;
51
+            return;
52
+        }
53
+
54
+        StMutexAuto aLock(mySwitchMutex);
55
+        myHeadOrient = theOrient;
56
+        myToOrientListener = true;
57
+    }
58
+
59
+    /**
60
+     * Turn ON/OFF listener head orientation tracking.
61
+     */
62
+    ST_LOCAL void setTrackHeadOrientation(bool theToTrack) {
63
+        myToOrientListener = theToTrack;
64
+    }
65
+
66
+    /**
67
+     * Set forcing B-Format.
68
+     */
69
+    ST_LOCAL void setForceBFormat(bool theToForce) {
70
+        myToForceBFormat = theToForce;
71
+    }
72
+
73
+    /**
74
      * Switch audio device.
75
      */
76
     ST_LOCAL void switchAudioDevice(const std::string& theAlDeviceName) {
77
@@ -114,18 +158,38 @@
78
     }
79
 
80
     /**
81
+     * Return TRUE if OpenAL implementation provides HRTF mixing feature.
82
+     */
83
+    ST_LOCAL bool hasAlHrtf() const {
84
+        return myAlCtx.hasExtSoftHrtf;
85
+    }
86
+
87
+    /**
88
      * @return true if device was disconnected and OpenAL should be re-initialized
89
      */
90
     ST_LOCAL bool isDisconnected() const {
91
         return myIsDisconnected;
92
     }
93
 
94
+    /**
95
+     * Return OpenAL info.
96
+     */
97
+    ST_LOCAL void getAlInfo(StDictionary& theInfo) {
98
+        StMutexAuto aLock(myAlInfoMutex);
99
+        for(size_t aPairIter = 0; aPairIter < myAlInfo.size(); ++aPairIter) {
100
+            theInfo.add(myAlInfo.getFromIndex(aPairIter));
101
+        }
102
+    }
103
+
104
         private: //! @name private methods
105
 
106
     ST_LOCAL bool initBuffers();
107
 
108
     ST_LOCAL bool stalInit();
109
     ST_LOCAL void stalDeinit();
110
+    ST_LOCAL void stalReinitialize();
111
+    ST_LOCAL void stalResetHrtf();
112
+    ST_LOCAL void stalOrientListener();
113
 
114
     ST_LOCAL void stalConfigureSources1();
115
     ST_LOCAL void stalConfigureSources2_0();
116
@@ -167,6 +231,9 @@
117
     //! Initialize 2-channels stream.
118
     ST_LOCAL bool initOutStereo(const bool theIsPlanar);
119
 
120
+    //! Initialize 2.0 stream by configuring 2 sources in 3D.
121
+    ST_LOCAL bool initOut20Soft(const bool theIsPlanar);
122
+
123
     //! Initialize 3.0 stream by configuring 3 sources in 3D.
124
     ST_LOCAL bool initOut30Soft(const bool theIsPlanar);
125
 
126
@@ -176,6 +243,9 @@
127
     //! Initialize 4.0 stream using extension (AL_FORMAT_QUAD).
128
     ST_LOCAL bool initOut40Ext(const bool theIsPlanar);
129
 
130
+    //! Initialize 4.0 Ambisonics WXYZ stream using extension (AL_FORMAT_BFORMAT3D).
131
+    ST_LOCAL bool initOut40BFormat(const bool theIsPlanar);
132
+
133
     //! Initialize 5.0 stream by configuring 5 sources in 3D.
134
     ST_LOCAL bool initOut50Soft(const bool theIsPlanar);
135
 
136
@@ -218,8 +288,8 @@
137
 
138
     // This constant sets count of OpenAL buffers, used in loop
139
     // for gapless playback
140
-    #define NUM_AL_BUFFERS 4
141
-    #define NUM_AL_SOURCES 8
142
+    #define THE_NUM_AL_BUFFERS 4
143
+    #define THE_NUM_AL_SOURCES 8
144
 
145
     /**
146
      * This is help class, used to store buffer-sizes
147
@@ -230,7 +300,7 @@
148
             public:
149
 
150
         ST_LOCAL DataLoop()
151
-        : myLast(NUM_AL_BUFFERS - 1) {
152
+        : myLast(THE_NUM_AL_BUFFERS - 1) {
153
             stMemSet(myDataSizes, 0, sizeof(myDataSizes));
154
         }
155
 
156
@@ -240,7 +310,7 @@
157
 
158
         ST_LOCAL void push(const size_t theDataSize) {
159
             ++myLast;
160
-            if(myLast >= NUM_AL_BUFFERS) {
161
+            if(myLast >= THE_NUM_AL_BUFFERS) {
162
                myLast = 0;
163
             }
164
             myDataSizes[myLast] = theDataSize;
165
@@ -248,7 +318,7 @@
166
 
167
         ST_LOCAL size_t summ() const {
168
             size_t aSumm = 0;
169
-            for(size_t aBuffIter = 0; aBuffIter < NUM_AL_BUFFERS; ++aBuffIter) {
170
+            for(size_t aBuffIter = 0; aBuffIter < THE_NUM_AL_BUFFERS; ++aBuffIter) {
171
                 aSumm += myDataSizes[aBuffIter];
172
             }
173
             return aSumm;
174
@@ -256,7 +326,7 @@
175
 
176
             private:
177
 
178
-        size_t myDataSizes[NUM_AL_BUFFERS];
179
+        size_t myDataSizes[THE_NUM_AL_BUFFERS];
180
         size_t myLast;
181
 
182
     } myAlDataLoop;
183
@@ -281,18 +351,30 @@
184
     StMutex            mySwitchMutex;   //!< switch audio device lock
185
     volatile bool      myToSwitchDev;   //!< switch audio device flag
186
     volatile bool      myIsDisconnected;//!< audio device disconnection flag
187
+    volatile bool      myToOrientListener; //!< track listener orientation
188
+    volatile bool      myToForceBFormat;//!< force using B-Format for any 4-channels input
189
+    StGLQuaternion     myHeadOrient;    //!< head orientation
190
 
191
         private: //! @name OpenAL items
192
 
193
     std::string        myAlDeviceName;  //!< Output audio device name for OpenAL context initialization
194
+    StDictionary       myAlInfo;        //!< OpenAL info
195
+    StMutex            myAlInfoMutex;
196
     StALContext        myAlCtx;         //!< OpenAL context
197
-    ALuint             myAlBuffers[NUM_AL_SOURCES][NUM_AL_BUFFERS]; //!< audio buffers
198
-    ALuint             myAlSources[NUM_AL_SOURCES];                 //!< audio sources
199
+    ALuint             myAlBuffers[THE_NUM_AL_SOURCES][THE_NUM_AL_BUFFERS]; //!< audio buffers
200
+    ALuint             myAlSources[THE_NUM_AL_SOURCES];                     //!< audio sources
201
sview-16_06.tar.gz/StMoviePlayer/StVideo/StPCMBuffer.cpp -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StPCMBuffer.cpp Changed
38
 
1
@@ -51,10 +51,23 @@
2
             return;
3
         case StChannelMap::CH40:
4
             count = 4;
5
-            FL = 0;
6
-            FR = 1;
7
-            RL = 2;
8
-            RR = 3;
9
+            if(theRules == StChannelMap::WYZX) {
10
+                // WYZX -> WXYZ
11
+                Order[0] = 0;
12
+                Order[1] = 3;
13
+                Order[2] = 1;
14
+                Order[3] = 2;
15
+                FL = Order[0];
16
+                FR = Order[1];
17
+                RL = Order[2];
18
+                RR = Order[3];
19
+            } else {
20
+                FL = 0;
21
+                FR = 1;
22
+                RL = 2;
23
+                RR = 3;
24
+            }
25
+
26
             FC = LFE = SL = SR = 0;
27
             return;
28
         case StChannelMap::CH50:
29
@@ -70,6 +83,8 @@
30
             count = 6;
31
             SL = SR = 0;
32
             switch(theRules) {
33
+                case StChannelMap::WYZX:
34
+                    // error
35
                 case StChannelMap::PCM: {
36
                     FL  = 0;
37
                     FR  = 1;
38
sview-16_06.tar.gz/StMoviePlayer/StVideo/StPCMBuffer.h -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StPCMBuffer.h Changed
19
 
1
@@ -93,11 +93,12 @@
2
         CH71
3
     } Channels;
4
 
5
-    typedef enum tagOrderRules {
6
-        PCM, //!< used PCM channel order rules
7
-        AC3, //!< used AC3 channel order rules
8
-        OGG  //!< used OGG Vorbis channel order rules
9
-    } OrderRules;
10
+    enum OrderRules {
11
+        PCM,  //!< used PCM channel order rules
12
+        AC3,  //!< used AC3 channel order rules
13
+        OGG,  //!< used OGG Vorbis channel order rules
14
+        WYZX, //!< YouTube spatial B-Format audio (4 channels)
15
+    };
16
 
17
         public: //!< fields are public for simple access
18
 
19
sview-16_06.tar.gz/StMoviePlayer/StVideo/StVideo.cpp -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StVideo.cpp Changed
103
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -38,6 +38,7 @@
9
 const char* StVideo::ST_VIDEOS_MIME_STRING = ST_VIDEO_PLUGIN_MIME_CHAR;
10
 
11
 StVideo::StVideo(const std::string&                 theALDeviceName,
12
+                 StAudioQueue::StAlHrtfRequest      theAlHrtf,
13
                  const StHandle<StResourceManager>& theResMgr,
14
                  const StHandle<StTranslations>&    theLangMap,
15
                  const StHandle<StPlayList>&        thePlayList,
16
@@ -84,7 +85,7 @@
17
     myVideoSlave  = new StVideoQueue(myTextureQueue, myVideoMaster);
18
     myVideoSlave->signals.onError.connect(this, &StVideo::doOnErrorRedirect);
19
 
20
-    myAudio = new StAudioQueue(theALDeviceName);
21
+    myAudio = new StAudioQueue(theALDeviceName, theAlHrtf);
22
     myAudio->signals.onError.connect(this, &StVideo::doOnErrorRedirect);
23
 
24
     mySubtitles = new StSubtitleQueue(theSubtitlesQueue);
25
@@ -246,6 +247,7 @@
26
 }
27
 
28
 bool StVideo::addFile(const StString& theFileToLoad,
29
+                      const StHandle<StStereoParams>& theNewParams,
30
                       StStreamsInfo&  theInfo) {
31
     // open video file
32
     StString aFileName, aDummy;
33
@@ -337,10 +339,12 @@
34
         if(aStream->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
35
             // video track
36
             if(!myVideoMaster->isInitialized()) {
37
-                myVideoMaster->init(aFormatCtx, aStreamId, aTitleString);
38
+                myVideoMaster->init(aFormatCtx, aStreamId, aTitleString, theNewParams);
39
                 myVideoMaster->setSlave(NULL);
40
 
41
                 if(myVideoMaster->isInitialized()) {
42
+                    myAudio->setTrackHeadOrientation(params.ToTrackHeadAudio->getValue() && theNewParams->ViewingMode != StViewSurface_Plain);
43
+
44
                     const int aSizeX      = myVideoMaster->sizeX();
45
                     const int aSizeY      = myVideoMaster->sizeY();
46
                     const int aCodedSizeX = myVideoMaster->getCodedSizeX();
47
@@ -363,7 +367,7 @@
48
                 }
49
             } else if(!myVideoSlave->isInitialized()
50
                    && !stAV::isAttachedPicture(aStream)) {
51
-                myVideoSlave->init(aFormatCtx, aStreamId, "");
52
+                myVideoSlave->init(aFormatCtx, aStreamId, "", theNewParams);
53
                 if(myVideoSlave->isInitialized()) {
54
                     mySlaveCtx    = aFormatCtx;
55
                     mySlaveStream = aStreamId;
56
@@ -511,6 +515,7 @@
57
     myVideoSlave ->setUseGpu(toUseGpu);
58
     myVideoMaster->setUseOpenJpeg(toUseOpenJpeg);
59
     myVideoSlave ->setUseOpenJpeg(toUseOpenJpeg);
60
+    myAudio->setTrackHeadOrientation(false);
61
 
62
     myFileInfoTmp = new StMovieInfo();
63
 
64
@@ -520,14 +525,14 @@
65
     if(!theNewSource->isEmpty()) {
66
         bool isLoaded = false;
67
         for(size_t aNode = 0; aNode < theNewSource->size(); ++aNode) {
68
-            isLoaded = addFile(theNewSource->getValue(aNode)->getPath(), aStreamsInfo) || isLoaded;
69
+            isLoaded = addFile(theNewSource->getValue(aNode)->getPath(), theNewParams, aStreamsInfo) || isLoaded;
70
         }
71
         if(!isLoaded) {
72
             return false;
73
         }
74
     } else {
75
         const StString aFullPath = theNewSource->getPath();
76
-        if(!addFile(aFullPath, aStreamsInfo)) {
77
+        if(!addFile(aFullPath, theNewParams, aStreamsInfo)) {
78
             return false;
79
         }
80
 
81
@@ -553,7 +558,7 @@
82
                     && aTrackName.isStartsWithIgnoreCase(aName)) {
83
                         //myPlayList->addToNode(aCurrFile, aFilePath);
84
                         //myPlayList->getCurrentFile(theNewSource, theNewParams)
85
-                        addFile(aNode->getPath(), aStreamsInfo);
86
+                        addFile(aNode->getPath(), theNewParams, aStreamsInfo);
87
                     }
88
                 }
89
             }
90
@@ -762,10 +767,10 @@
91
 
92
             myVideoMaster->setUseGpu(toUseGpu, isGpuFailed);
93
             myVideoSlave ->setUseGpu(toUseGpu, isGpuFailed);
94
-            myVideoMaster->init(aCtxMaster, aStreamIdMaster, aFileNameMaster);
95
+            myVideoMaster->init(aCtxMaster, aStreamIdMaster, aFileNameMaster, myCurrParams);
96
             myVideoMaster->setSlave(NULL);
97
             if(toDecodeSlave) {
98
-                myVideoSlave->init(mySlaveCtx, mySlaveStream, "");
99
+                myVideoSlave->init(mySlaveCtx, mySlaveStream, "", myCurrParams);
100
                 myVideoMaster->setSlave(myVideoSlave);
101
             }
102
             myVideoMaster->pushStart();
103
sview-16_06.tar.gz/StMoviePlayer/StVideo/StVideo.h -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StVideo.h Changed
106
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -108,6 +108,7 @@
9
      * Main constructor.
10
      */
11
     ST_LOCAL StVideo(const std::string&                 theALDeviceName,
12
+                     StAudioQueue::StAlHrtfRequest      theAlHrtf,
13
                      const StHandle<StResourceManager>& theResMgr,
14
                      const StHandle<StTranslations>&    theLangMap,
15
                      const StHandle<StPlayList>&        thePlayList,
16
@@ -164,6 +165,13 @@
17
     }
18
 
19
     /**
20
+     * Stick to panorama 360 mode.
21
+     */
22
+    ST_LOCAL void setStickPano360(bool theToStick) {
23
+        myVideoMaster->setStickPano360(theToStick);
24
+    }
25
+
26
+    /**
27
      * Retrieve information about currently played file.
28
      */
29
     ST_LOCAL StHandle<StMovieInfo> getFileInfo(const StHandle<StStereoParams>& theParams) const;
30
@@ -198,6 +206,20 @@
31
     }
32
 
33
     /**
34
+     * Return TRUE if OpenAL implementation provides HRTF mixing feature.
35
+     */
36
+    ST_LOCAL bool hasAlHrtf() const {
37
+        return myAudio->hasAlHrtf();
38
+    }
39
+
40
+    /**
41
+     * Setup OpenAL HRTF mixing.
42
+     */
43
+    ST_LOCAL void setAlHrtfRequest(StAudioQueue::StAlHrtfRequest theAlHrt) {
44
+        myAudio->setAlHrtfRequest(theAlHrt);
45
+    }
46
+
47
+    /**
48
      * @return true if device was disconnected and OpenAL should be re-initialized
49
      */
50
     ST_LOCAL bool isDisconnected() const {
51
@@ -211,8 +233,29 @@
52
         myAudio->setAudioVolume(theGain);
53
     }
54
 
55
+    /**
56
+     * Set head orientation.
57
+     */
58
+    ST_LOCAL void setHeadOrientation(const StGLQuaternion& theOrient, bool theToTrack) {
59
+        myAudio->setHeadOrientation(theOrient, theToTrack);
60
+    }
61
+
62
+    /**
63
+     * Set forcing B-Format.
64
+     */
65
+    ST_LOCAL void setForceBFormat(bool theToForce) {
66
+        myAudio->setForceBFormat(theToForce);
67
+    }
68
+
69
     ST_LOCAL void setAudioDelay(const float theDelaySec);
70
 
71
+    /**
72
+     * Return OpenAL info.
73
+     */
74
+    ST_LOCAL void getAlInfo(StDictionary& theInfo) {
75
+        myAudio->getAlInfo(theInfo);
76
+    }
77
+
78
         public: //! @name Properties
79
 
80
     struct {
81
@@ -220,6 +263,7 @@
82
         StHandle<StBoolParam>         UseGpu;          //!< use video decoding on GPU when available
83
         StHandle<StBoolParam>         UseOpenJpeg;     //!< use OpenJPEG (libopenjpeg) instead of built-in jpeg2000 decoder
84
         StHandle<StBoolParam>         ToSearchSubs;    //!< automatically search for additional subtitles/audio track files nearby video file
85
+        StHandle<StBoolParamNamed>    ToTrackHeadAudio;//!< enable/disable head-tracking for audio listener
86
         StHandle<StParamActiveStream> activeAudio;     //!< active Audio stream
87
         StHandle<StParamActiveStream> activeSubtitles; //!< active Subtitles stream
88
 
89
@@ -312,6 +356,7 @@
90
      * Private method to append one format context (one file).
91
      */
92
     ST_LOCAL bool addFile(const StString& theFileToLoad,
93
+                          const StHandle<StStereoParams>& theNewParams,
94
                           StStreamsInfo&  theInfo);
95
 
96
     ST_LOCAL bool openSource(const StHandle<StFileNode>&     theNewSource,
97
@@ -408,7 +453,7 @@
98
     StHandle<StMovieInfo>         myFileInfo;     //!< info about currently loaded file
99
     StHandle<StMovieInfo>         myFileInfoTmp;
100
     StHandle<StFileNode>          myCurrNode;     //!< active (played) file node
101
-    StHandle<StStereoParams>      myCurrParams;   //!< paramters for active file node
102
+    StHandle<StStereoParams>      myCurrParams;   //!< parameters for active file node
103
     StHandle<StFileNode>          myCurrPlsFile;  //!< active playlist file node
104
     StHandle<StGLTextureQueue>    myTextureQueue; //!< decoded frames queue
105
 
106
sview-16_06.tar.gz/StMoviePlayer/StVideo/StVideoQueue.cpp -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StVideoQueue.cpp Changed
169
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -173,6 +173,8 @@
9
   myAvDiscard(AVDISCARD_DEFAULT),
10
   myFramePts(0.0),
11
   myPixelRatio(1.0f),
12
+  myHParallax(0),
13
+  myRotateDeg(0),
14
   //
15
   myVideoClock(0.0),
16
   //
17
@@ -184,7 +186,8 @@
18
   myWasFlushed(false),
19
   myStFormatByUser(StFormat_AUTO),
20
   myStFormatByName(StFormat_AUTO),
21
-  myStFormatInStream(StFormat_AUTO) {
22
+  myStFormatInStream(StFormat_AUTO),
23
+  myToStickPano360(false) {
24
 #ifdef ST_USE64PTR
25
     myFrame.Frame->opaque = (void* )stAV::NOPTS_VALUE;
26
 #else
27
@@ -218,6 +221,8 @@
28
         const char* name;
29
     };
30
 
31
+    static const StCString THE_ROTATE_KEY       = stCString("rotate");
32
+
33
     static const StCString THE_SRC_MODE_KEY     = stCString("STEREO_MODE");
34
     static const StCString THE_SRC_MODE_KEY_WMV = stCString("StereoscopicLayout");
35
 
36
@@ -286,7 +291,8 @@
37
 
38
 bool StVideoQueue::init(AVFormatContext*   theFormatCtx,
39
                         const unsigned int theStreamId,
40
-                        const StString&    theFileName) {
41
+                        const StString&    theFileName,
42
+                        const StHandle<StStereoParams>& theNewParams) {
43
     if(!StAVPacketQueue::init(theFormatCtx, theStreamId, theFileName)
44
     || myCodecCtx->codec_type != AVMEDIA_TYPE_VIDEO) {
45
         signals.onError(stCString("FFmpeg: invalid stream"));
46
@@ -408,6 +414,52 @@
47
         myHParallax = (int )stStringToLong(aValue.toCString(), 10, aCLocale);
48
     }
49
 
50
+    // we can read information from Display Matrix in side data or from metadata key
51
+    myRotateDeg = 0;
52
+
53
+#ifdef ST_AV_NEWSPHERICAL
54
+    if(const AVSphericalMapping* aSpherical = (AVSphericalMapping* )av_stream_get_side_data(myStream, AV_PKT_DATA_SPHERICAL, NULL)) {
55
+        switch(aSpherical->projection) {
56
+            case AV_SPHERICAL_EQUIRECTANGULAR: {
57
+                theNewParams->ViewingMode = StViewSurface_Sphere;
58
+                break;
59
+            }
60
+            case AV_SPHERICAL_CUBEMAP: {
61
+                theNewParams->ViewingMode = StViewSurface_Cubemap;
62
+                //spherical->padding
63
+                break;
64
+            }
65
+            case AV_SPHERICAL_EQUIRECTANGULAR_TILE: {
66
+                // unsupported
67
+                //av_spherical_tile_bounds(aSpherical, par->width, par->height, &l, &t, &r, &b);
68
+                break;
69
+            }
70
+        }
71
+        if(theNewParams->ViewingMode != StViewSurface_Plain
72
+        && theNewParams->isZeroRotate()) {
73
+            const double aYaw   = (double )aSpherical->yaw   / (1 << 16);
74
+            const double aPitch = (double )aSpherical->pitch / (1 << 16);
75
+            const double aRoll  = (double )aSpherical->roll  / (1 << 16);
76
+            myRotateDeg = (int )-aRoll;
77
+            theNewParams->setRotateZero((float )-aYaw, (float )aPitch, (float )myRotateDeg);
78
+        }
79
+    }
80
+#endif
81
+
82
+#if(LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 0, 0))
83
+    if(const uint8_t* aDispMatrix = av_stream_get_side_data(myStream, AV_PKT_DATA_DISPLAYMATRIX, NULL)) {
84
+        const double aRotDeg = -av_display_rotation_get((const int32_t* )aDispMatrix);
85
+        if(!st::isNaN(aRotDeg)) {
86
+            myRotateDeg = -int(aRotDeg - 360 * std::floor(aRotDeg / 360 + 0.9 / 360));
87
+        }
88
+    }
89
+#else
90
+    if(stAV::meta::readTag(myStream, THE_ROTATE_KEY, aValue)) {
91
+        StCLocale aCLocale;
92
+        myRotateDeg = (int )-stStringToLong(aValue.toCString(), 10, aCLocale);
93
+    }
94
+#endif
95
+
96
     // stereoscopic mode tags
97
     myStFormatInStream = is720in1080 ? StFormat_Tiled4x : StFormat_AUTO;
98
     if(stAV::meta::readTag(myFormatCtx, THE_SRC_MODE_KEY,     aValue)
99
@@ -665,6 +717,16 @@
100
         theStParams->Src2SizeY = 0;
101
     }
102
 
103
+    if(myToStickPano360
104
+    && theStParams->ViewingMode == StViewSurface_Plain) {
105
+        StPanorama aPano = st::probePanorama(theSrcFormat,
106
+                                             theStParams->Src1SizeX, theStParams->Src1SizeY,
107
+                                             theStParams->Src2SizeX, theStParams->Src2SizeY);
108
+        theStParams->ViewingMode = (aPano == StPanorama_Cubemap6_1 || aPano == StPanorama_Cubemap3_2)
109
+                                 ? StViewSurface_Cubemap
110
+                                 : StViewSurface_Sphere;
111
+    }
112
+
113
     myTextureQueue->push(theSrcDataLeft, theSrcDataRight, theStParams, theSrcFormat, theCubemapFormat, theSrcPTS);
114
     myTextureQueue->setConnectedStream(true);
115
     if(myWasFlushed) {
116
@@ -862,15 +924,24 @@
117
 
118
         // we currently allow to override source format stored in metadata
119
     #ifdef ST_AV_NEWSTEREO
120
-        AVFrameSideData* aSideData = av_frame_get_side_data(myFrame.Frame, AV_FRAME_DATA_STEREO3D);
121
-        if(aSideData != NULL) {
122
-            AVStereo3D* aStereo = (AVStereo3D* )aSideData->data;
123
+        if(AVFrameSideData* aSideDataS3d = av_frame_get_side_data(myFrame.Frame, AV_FRAME_DATA_STEREO3D)) {
124
+            AVStereo3D* aStereo = (AVStereo3D* )aSideDataS3d->data;
125
             myStFormatInStream = stAV::stereo3dAvToSt(aStereo->type);
126
             if(aStereo->flags & AV_STEREO3D_FLAG_INVERT) {
127
                 myStFormatInStream = st::formatReversed(myStFormatInStream);
128
             }
129
         }
130
     #endif
131
+    #if(LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 0, 0))
132
+        if(const AVFrameSideData* aSideDataRot = av_frame_get_side_data(myFrame.Frame, AV_FRAME_DATA_DISPLAYMATRIX)) {
133
+            if(aSideDataRot->size >= int(9 * sizeof(int32_t))) {
134
+                const double aRotDeg = -av_display_rotation_get((const int32_t* )aSideDataRot->data);
135
+                if(!st::isNaN(aRotDeg)) {
136
+                    myRotateDeg = -int(aRotDeg - 360 * std::floor(aRotDeg / 360 + 0.9 / 360));
137
+                }
138
+            }
139
+        }
140
+    #endif
141
         if(stAV::meta::readTag(myFrame.Frame, THE_SRC_MODE_KEY, aTagValue)) {
142
             for(size_t aSrcId = 0;; ++aSrcId) {
143
                 const StFFmpegStereoFormat& aFlag = STEREOFLAGS[aSrcId];
144
@@ -885,7 +956,7 @@
145
         }
146
         // override source format stored in metadata
147
         StFormat  aSrcFormat     = myStFormatByUser;
148
-        StCubemap aCubemapFormat = aPacket->getSource()->ViewingMode == StStereoParams::PANORAMA_CUBEMAP ? StCubemap_Packed : StCubemap_OFF;
149
+        StCubemap aCubemapFormat = aPacket->getSource()->ViewingMode == StViewSurface_Cubemap ? StCubemap_Packed : StCubemap_OFF;
150
         if(aSrcFormat == StFormat_AUTO) {
151
             // prefer info stored in the stream itself
152
             aSrcFormat = myStFormatInStream;
153
@@ -907,6 +978,7 @@
154
                 StHandle<StStereoParams> aParams = aPacket->getSource();
155
                 if(!aParams.isNull()) {
156
                     aParams->setSeparationNeutral(myHParallax);
157
+                    aParams->setZRotateZero((float )myRotateDeg);
158
                 }
159
                 isStarted = false;
160
             }
161
@@ -951,6 +1023,7 @@
162
                 StHandle<StStereoParams> aParams = aPacket->getSource();
163
                 if(!aParams.isNull()) {
164
                     aParams->setSeparationNeutral(myHParallax);
165
+                    aParams->setZRotateZero((float )myRotateDeg);
166
                 }
167
                 isStarted = false;
168
             }
169
sview-16_06.tar.gz/StMoviePlayer/StVideo/StVideoQueue.h -> sview-17_04.tar.gz/StMoviePlayer/StVideo/StVideoQueue.h Changed
52
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * StMoviePlayer program is free software: you can redistribute it and/or modify
7
  * it under the terms of the GNU General Public License as published by
8
@@ -197,6 +197,13 @@
9
         return myStFormatByName;
10
     }
11
 
12
+    /**
13
+     * Stick to panorama 360 mode.
14
+     */
15
+    ST_LOCAL void setStickPano360(bool theToStick) {
16
+        myToStickPano360 = theToStick;
17
+    }
18
+
19
     ST_LOCAL StVideoQueue(const StHandle<StGLTextureQueue>& theTextureQueue,
20
                           const StHandle<StVideoQueue>&     theMaster = StHandle<StVideoQueue>());
21
     ST_LOCAL virtual ~StVideoQueue();
22
@@ -207,9 +214,10 @@
23
      * @param theStreamId  stream id in video format context
24
      * @return true if no error
25
      */
26
-    ST_LOCAL virtual bool init(AVFormatContext*   theFormatCtx,
27
-                               const unsigned int theStreamId,
28
-                               const StString&    theFileName) ST_ATTR_OVERRIDE;
29
+    ST_LOCAL bool init(AVFormatContext*   theFormatCtx,
30
+                       const unsigned int theStreamId,
31
+                       const StString&    theFileName,
32
+                       const StHandle<StStereoParams>& theNewParams);
33
 
34
     /**
35
      * Clean function.
36
@@ -378,6 +386,7 @@
37
     double                     myFramePts;
38
     GLfloat                    myPixelRatio;      //!< pixel aspect ratio
39
     int                        myHParallax;       //!< horizontal parallax in pixels stored in metadata
40
+    int                        myRotateDeg;       //!< rotate angle in degrees
41
 
42
     double                     myVideoClock;      //!< synchronization variable
43
 
44
@@ -394,6 +403,7 @@
45
     volatile StFormat          myStFormatByUser;  //!< source format specified by user
46
     volatile StFormat          myStFormatByName;  //!< source format detected from file name
47
     volatile StFormat          myStFormatInStream;//!< source format information retrieved from stream
48
+    volatile bool              myToStickPano360;  //!< stick to panorama 360 mode
49
 
50
 };
51
 
52
sview-16_06.tar.gz/StMoviePlayer/lang/chinese/StMoviePlayer.lng -> sview-17_04.tar.gz/StMoviePlayer/lang/chinese/StMoviePlayer.lng Changed
30
 
1
@@ -72,6 +72,8 @@
2
 ?1283=Cubemap
3
 ?1285=Track orientation
4
 ?1286=Track orientation (poor)
5
+?1287=Orient audio
6
+?1288=Stick at panorama 360°
7
 1300=音频
8
 1301=无
9
 1302=音/视频 延迟
10
@@ -127,6 +129,8 @@
11
 ?1703=On one click
12
 ?1704=On double click
13
 ?1705=On one click windowed mode
14
+?1710=Hide system navigation bar
15
+?1711=Open last played file on startup
16
 2000=选择视频文件打开
17
 2001=选择左视频文件打开
18
 2002=选择右视频文件打开
19
@@ -233,8 +237,8 @@
20
 ?6039=DY separation - increase
21
 ?6040=Angular separation - decrease
22
 ?6041=Angular separation - increase
23
-?6042=Rotate 90 degrees counterclockwise
24
-?6043=Rotate 90 degrees clockwise
25
+?6042=Rotate 90° counterclockwise
26
+?6043=Rotate 90° clockwise
27
 ?6044=Rotate counterclockwise
28
 ?6045=Rotate clockwise
29
 ?6046=Enable/disable panorama mode
30
sview-16_06.tar.gz/StMoviePlayer/lang/czech/StMoviePlayer.lng -> sview-17_04.tar.gz/StMoviePlayer/lang/czech/StMoviePlayer.lng Changed
34
 
1
@@ -71,8 +71,10 @@
2
 1281=Koule
3
 1282=Válec
4
 ?1283=Cubemap
5
-?1285="Track orientation"
6
-?1286="Track orientation (poor)"
7
+?1285=Track orientation
8
+?1286=Track orientation (poor)
9
+?1287=Orient audio
10
+?1288=Stick at panorama 360°
11
 1300=Zvuk
12
 1301=Vypnout zvuk
13
 1302=Zpoždění zvuku
14
@@ -128,6 +130,8 @@
15
 ?1703=On one click
16
 ?1704=On double click
17
 ?1705=On one click windowed mode
18
+?1710=Hide system navigation bar
19
+?1711=Open last played file on startup
20
 2000=Otevřít video
21
 2001=Otevřít video s LEVOU stopou
22
 2002=Otevřít video s PRAVOU stopou
23
@@ -234,8 +238,8 @@
24
 ?6039=DY separation - increase
25
 ?6040=Angular separation - decrease
26
 ?6041=Angular separation - increase
27
-?6042=Rotate 90 degrees counterclockwise
28
-?6043=Rotate 90 degrees clockwise
29
+?6042=Rotate 90° counterclockwise
30
+?6043=Rotate 90° clockwise
31
 ?6044=Rotate counterclockwise
32
 ?6045=Rotate clockwise
33
 ?6046=Enable/disable panorama mode
34
sview-16_06.tar.gz/StMoviePlayer/lang/english/StMoviePlayer.lng -> sview-17_04.tar.gz/StMoviePlayer/lang/english/StMoviePlayer.lng Changed
30
 
1
@@ -72,6 +72,8 @@
2
 1283=Cubemap
3
 1285=Track orientation
4
 1286=Track orientation (poor)
5
+1287=Orient audio
6
+1288=Stick at panorama 360°
7
 1300=Audio
8
 1301=None
9
 1302=Audio/Video delay
10
@@ -127,6 +129,8 @@
11
 1703=On one click
12
 1704=On double click
13
 1705=On one click in windowed mode
14
+1710=Hide system navigation bar
15
+1711=Open last played file on startup
16
 2000=Choose the video file to open
17
 2001=Choose LEFT video file to open
18
 2002=Choose RIGHT video file to open
19
@@ -233,8 +237,8 @@
20
 6039=DY separation - increase
21
 6040=Angular separation - decrease
22
 6041=Angular separation - increase
23
-6042=Rotate 90 degrees counterclockwise
24
-6043=Rotate 90 degrees clockwise
25
+6042=Rotate 90° counterclockwise
26
+6043=Rotate 90° clockwise
27
 6044=Rotate counterclockwise
28
 6045=Rotate clockwise
29
 6046=Enable/disable panorama mode
30
sview-16_06.tar.gz/StMoviePlayer/lang/french/StMoviePlayer.lng -> sview-17_04.tar.gz/StMoviePlayer/lang/french/StMoviePlayer.lng Changed
30
 
1
@@ -72,6 +72,8 @@
2
 1283=Cubemap
3
 ?1285=Track orientation
4
 ?1286=Track orientation (poor)
5
+?1287=Orient audio
6
+?1288=Stick at panorama 360°
7
 1300=Audio
8
 1301=Aucun
9
 1302=Audio/Video delay
10
@@ -127,6 +129,8 @@
11
 ?1703=On one click
12
 ?1704=On double click
13
 ?1705=On one click windowed mode
14
+?1710=Hide system navigation bar
15
+?1711=Open last played file on startup
16
 2000=Choix du fichier vidéo à ouvrir
17
 2001=Choix du fichier vidéo Gauche à ouvrir
18
 2002=Choix du fichier vidéo Droite à ouvrir
19
@@ -233,8 +237,8 @@
20
 ?6039=DY separation - increase
21
 ?6040=Angular separation - decrease
22
 ?6041=Angular separation - increase
23
-6042=Faire pivoter un objet de 90 degrés vers la gauche
24
-6043=Faire pivoter un objet de 90 degrés vers la droite
25
+6042=Faire pivoter un objet de 90° vers la gauche
26
+6043=Faire pivoter un objet de 90° vers la droite
27
 6044=Sens inverse des aiguilles d’une montre
28
 6045=Sens des aiguilles d’une montre
29
 6046=Activer / désactiver le mode panorama
30
sview-16_06.tar.gz/StMoviePlayer/lang/german/StMoviePlayer.lng -> sview-17_04.tar.gz/StMoviePlayer/lang/german/StMoviePlayer.lng Changed
30
 
1
@@ -72,6 +72,8 @@
2
 1283=Cubemap
3
 ?1285=Track orientation
4
 ?1286=Track orientation (poor)
5
+?1287=Orient audio
6
+?1288=Stick at panorama 360°
7
 1300=Audio
8
 1301=keiner
9
 1302=Audio/Video Verzögerung
10
@@ -127,6 +129,8 @@
11
 1703=Auf einen Klick
12
 1704=Auf Doppelklick
13
 ?1705=Only when windowed
14
+1710=Navigationsleiste ausblenden
15
+?1711=Open last played file on startup
16
 2000=Wählen die Videodatei zu öffnen
17
 2001=Wählen die linke Videodatei zu öffnen
18
 2002=Wählen die rechte Videodatei zu öffnen
19
@@ -233,8 +237,8 @@
20
 6039=DY Trennung - erhöhen
21
 6040=Winkelabstand - verringern
22
 6041=Winkelabstand - erhöhen
23
-6042=Um 90 Grad gegen Uhrzeigersinn drehen
24
-6043=Um 90 Grad im Uhrzeigersinn drehen
25
+6042=Um 90° gegen Uhrzeigersinn drehen
26
+6043=Um 90° im Uhrzeigersinn drehen
27
 6044=Drehen gegen den Uhrzeigersinn
28
 6045=Im Uhrzeigersinn drehen
29
 6046=Aktivieren / Deaktivieren der Panorama-Modus
30
sview-16_06.tar.gz/StMoviePlayer/lang/korean/StMoviePlayer.lng -> sview-17_04.tar.gz/StMoviePlayer/lang/korean/StMoviePlayer.lng Changed
30
 
1
@@ -73,6 +73,8 @@
2
 ?1283=Cubemap
3
 ?1285=Track orientation
4
 ?1286=Track orientation (poor)
5
+?1287=Orient audio
6
+?1288=Stick at panorama 360°
7
 ?1300=Audio
8
 1301=없음
9
 1302=오디오/비디오 지연시간
10
@@ -128,6 +130,8 @@
11
 ?1703=On one click
12
 ?1704=On double click
13
 ?1705=On one click windowed mode
14
+?1710=Hide system navigation bar
15
+?1711=Open last played file on startup
16
 2000=재생할 비디오 파일을 선택하시오
17
 2001=좌안 비디오 파일을 선택하시오
18
 2002=우안 비디오 파일을 선택하시오
19
@@ -234,8 +238,8 @@
20
 ?6039=DY separation - increase
21
 ?6040=Angular separation - decrease
22
 ?6041=Angular separation - increase
23
-?6042=Rotate 90 degrees counterclockwise
24
-?6043=Rotate 90 degrees clockwise
25
+?6042=Rotate 90° counterclockwise
26
+?6043=Rotate 90° clockwise
27
 ?6044=Rotate counterclockwise
28
 ?6045=Rotate clockwise
29
 ?6046=Enable/disable panorama mode
30
sview-16_06.tar.gz/StMoviePlayer/lang/russian/StMoviePlayer.lng -> sview-17_04.tar.gz/StMoviePlayer/lang/russian/StMoviePlayer.lng Changed
30
 
1
@@ -73,6 +73,8 @@
2
 1283=Куб
3
 1285=Отслеживать ориентацию
4
 1286=Отслеживать ориентацию (poor)
5
+1287=Ориентировать звук
6
+1288=Закрепить панорамный режим 360°
7
 1300=Аудио
8
 1301=Без звука
9
 1302=Задержка звука
10
@@ -128,6 +130,8 @@
11
 1703=Одно нажатие
12
 1704=Двойное нажатие
13
 1705=Только в оконном режиме
14
+1710=Скрыть панель навигации
15
+1711=Открывать последний файл при старте
16
 2000=Выберите видеофайл
17
 2001=Выберите видеофайл с ЛЕВЫМ ракурсом
18
 2002=Выберите видеофайл с ПРАВЫМ ракурсом
19
@@ -234,8 +238,8 @@
20
 6039=DY разделение ракурсов - увеличить
21
 6040=Угловое разделение ракурсов - уменьшить
22
 6041=Угловое разделение ракурсов - увеличить
23
-6042=Поворот на 90 градусов против часовой стрелки
24
-6043=Поворот на 90 градусов по часовой стрелке
25
+6042=Поворот на 90° против часовой стрелки
26
+6043=Поворот на 90° по часовой стрелке
27
 6044=Поворот против часовой стрелки
28
 6045=Поворот по часовой стрелке
29
 6046=Включить/выключить панорамный режим
30
sview-16_06.tar.gz/StOutAnaglyph/StOutAnaglyph.cpp -> sview-17_04.tar.gz/StOutAnaglyph/StOutAnaglyph.cpp Changed
10
 
1
@@ -115,7 +115,7 @@
2
     StString& aDescr     = aLangMap.changeValueId(STTR_PLUGIN_DESCRIPTION,
3
         "(C) {0} Kirill Gavrilov <{1}>\nOfficial site: {2}\n\nThis library is distributed under LGPL3.0");
4
     myAbout = aTitle + '\n' + aVerString + " " + StVersionInfo::getSDKVersionString() + "\n \n"
5
-            + aDescr.format("2007-2016", "kirill@sview.ru", "www.sview.ru");
6
+            + aDescr.format("2007-2017", "kirill@sview.ru", "www.sview.ru");
7
 }
8
 
9
 StOutAnaglyph::StOutAnaglyph(const StHandle<StResourceManager>& theResMgr,
10
sview-16_06.tar.gz/StOutAnaglyph/StOutAnaglyph.rc -> sview-17_04.tar.gz/StOutAnaglyph/StOutAnaglyph.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "Anaglyph Renderer library\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2007-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2007-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StOutAnaglyph\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StOutAnaglyph/shaders/fAnaglyphGray.shf -> sview-17_04.tar.gz/StOutAnaglyph/shaders/fAnaglyphGray.shf Changed
24
 
1
@@ -13,14 +13,14 @@
2
  * The NTSC weights are only applicable to RGB colors in a gamma 2.2 color space.
3
  * For linear RGB colors the values above are better.
4
  */
5
-mat4 multL = mat4(0.3086,      0,      0,      0,
6
-                  0.6094,      0,      0,      0,
7
-                  0.0820,      0,      0,      0,
8
-                       0,      0,      0,      0);
9
-mat4 multR = mat4(     0, 0.3086, 0.3086,      0,
10
-                       0, 0.6094, 0.6094,      0,
11
-                       0, 0.0820, 0.0820,      0,
12
-                       0,      0,      0,      0);
13
+const mat4 multL = mat4(0.3086,      0,      0,      0,
14
+                        0.6094,      0,      0,      0,
15
+                        0.0820,      0,      0,      0,
16
+                             0,      0,      0,      0);
17
+const mat4 multR = mat4(     0, 0.3086, 0.3086,      0,
18
+                             0, 0.6094, 0.6094,      0,
19
+                             0, 0.0820, 0.0820,      0,
20
+                             0,      0,      0,      0);
21
 
22
 uniform sampler2D texL, texR;
23
 varying vec2 fTexCoord;
24
sview-16_06.tar.gz/StOutAnaglyph/shaders/fAnaglyphOptim.shf -> sview-17_04.tar.gz/StOutAnaglyph/shaders/fAnaglyphOptim.shf Changed
30
 
1
@@ -8,18 +8,18 @@
2
  */
3
 
4
 // http://research.csc.ncsu.edu/stereographics/LS.pdf
5
-mat4 multL = mat4(     0.4154,    -0.0458, -0.0547,      0,
6
-                       0.4710,    -0.0484, -0.0615,      0,
7
-                   0.16666667,    -0.0257,  0.0128,      0,
8
-                            0,          0,       0,      0);
9
-mat4 multR = mat4(-0.01090909,     0.3756, -0.0651,      0,
10
-                  -0.03636364, 0.73333333, -0.1287,      0,
11
-                  -0.00606061, 0.01111111,  1.2971,      0,
12
-                            0,          0,       0,      0);
13
+const mat4 multL = mat4(     0.4154,    -0.0458, -0.0547,      0,
14
+                             0.4710,    -0.0484, -0.0615,      0,
15
+                         0.16666667,    -0.0257,  0.0128,      0,
16
+                                  0,          0,       0,      0);
17
+const mat4 multR = mat4(-0.01090909,     0.3756, -0.0651,      0,
18
+                        -0.03636364, 0.73333333, -0.1287,      0,
19
+                        -0.00606061, 0.01111111,  1.2971,      0,
20
+                                  0,          0,       0,      0);
21
 
22
 // normalize multipliers
23
-vec4 multUp = vec4(2.2, 2.2, 2.2, 1.0);
24
-vec4 multDw = 1.0 / multUp;
25
+const vec4 multUp =       vec4(2.2, 2.2, 2.2, 1.0);
26
+const vec4 multDw = 1.0 / vec4(2.2, 2.2, 2.2, 1.0);
27
 
28
 uniform sampler2D texL, texR;
29
 varying vec2 fTexCoord;
30
sview-16_06.tar.gz/StOutAnaglyph/shaders/fAnaglyphTrue.shf -> sview-17_04.tar.gz/StOutAnaglyph/shaders/fAnaglyphTrue.shf Changed
24
 
1
@@ -12,14 +12,14 @@
2
  * - No color reproduction
3
  * - Little ghosting
4
  */
5
-mat4 multL = mat4(0.299,     0,     0,     0,
6
-                  0.587,     0,     0,     0,
7
-                  0.114,     0,     0,     0,
8
-                      0,     0,     0,     0);
9
-mat4 multR = mat4(    0,     0, 0.299,     0,
10
-                      0,     0, 0.587,     0,
11
-                      0,     0, 0.114,     0,
12
-                      0,     0,     0,     0);
13
+const mat4 multL = mat4(0.299,     0,     0,     0,
14
+                        0.587,     0,     0,     0,
15
+                        0.114,     0,     0,     0,
16
+                            0,     0,     0,     0);
17
+const mat4 multR = mat4(    0,     0, 0.299,     0,
18
+                            0,     0, 0.587,     0,
19
+                            0,     0, 0.114,     0,
20
+                            0,     0,     0,     0);
21
 
22
 uniform sampler2D texL, texR;
23
 varying vec2 fTexCoord;
24
sview-16_06.tar.gz/StOutAnaglyph/shaders/fAnaglyphYellowDubois.shf -> sview-17_04.tar.gz/StOutAnaglyph/shaders/fAnaglyphYellowDubois.shf Changed
30
 
1
@@ -10,18 +10,18 @@
2
 /**
3
  * http://www.site.uottawa.ca/~edubois/anaglyph/
4
  */
5
-mat4 multL = mat4( 1.062, -0.026, -0.038,      0,
6
-                  -0.205,  0.908, -0.173,      0,
7
-                   0.299,  0.068,  0.022,      0,
8
-                       0,      0,      0,      0);
9
-mat4 multR = mat4(-0.016,  0.006,  0.094,      0,
10
-                  -0.123,  0.062,  0.185,      0,
11
-                  -0.017, -0.017,  0.911,      0,
12
-                       0,      0,      0,      0);
13
+const mat4 multL = mat4( 1.062, -0.026, -0.038,      0,
14
+                        -0.205,  0.908, -0.173,      0,
15
+                         0.299,  0.068,  0.022,      0,
16
+                             0,      0,      0,      0);
17
+const mat4 multR = mat4(-0.016,  0.006,  0.094,      0,
18
+                        -0.123,  0.062,  0.185,      0,
19
+                        -0.017, -0.017,  0.911,      0,
20
+                             0,      0,      0,      0);
21
 
22
 // normalize multipliers
23
-vec4 multUp = vec4(2.2, 2.2, 2.2, 1.0);
24
-vec4 multDw = 1.0 / multUp;
25
+const vec4 multUp =       vec4(2.2, 2.2, 2.2, 1.0);
26
+const vec4 multDw = 1.0 / vec4(2.2, 2.2, 2.2, 1.0);
27
 
28
 uniform sampler2D texL, texR;
29
 varying vec2 fTexCoord;
30
sview-16_06.tar.gz/StOutDistorted/StOutDistorted.cpp -> sview-17_04.tar.gz/StOutDistorted/StOutDistorted.cpp Changed
201
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StOutDistorted, class providing stereoscopic output in anamorph side by side format using StCore toolkit.
4
- * Copyright © 2013-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2013-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -18,6 +18,7 @@
10
 #include <StGL/StGLFrameBuffer.h>
11
 #include <StGL/StGLArbFbo.h>
12
 #include <StGLCore/StGLCore20.h>
13
+#include <StGLMesh/StGLTextureQuad.h>
14
 #include <StSettings/StSettings.h>
15
 #include <StSettings/StTranslations.h>
16
 #include <StSettings/StEnumParam.h>
17
@@ -25,15 +26,19 @@
18
 #include <StVersion.h>
19
 #include <StAV/StAVImage.h>
20
 
21
-#ifdef ST_HAVE_LIBOVR
22
-
23
-#include <OVR.h>
24
-#include <OVR_CAPI_GL.h>
25
+#ifdef ST_HAVE_OPENVR
26
+    #include <openvr.h>
27
 
28
-#ifdef _MSC_VER
29
-    #pragma comment(lib, "LibOVR.lib")
30
-#endif
31
+    #ifdef _MSC_VER
32
+        #pragma comment(lib, "openvr_api.lib")
33
+    #endif
34
+#elif defined(ST_HAVE_LIBOVR)
35
+    #include <OVR.h>
36
+    #include <OVR_CAPI_GL.h>
37
 
38
+    #ifdef _MSC_VER
39
+        #pragma comment(lib, "LibOVR.lib")
40
+    #endif
41
 #endif
42
 
43
 namespace {
44
@@ -42,7 +47,6 @@
45
 
46
     static const char ST_SETTING_DEVICE_ID[] = "deviceId";
47
     static const char ST_SETTING_WINDOWPOS[] = "windowPos";
48
-    static const char ST_SETTING_MARGINS[]   = "margins";
49
     static const char ST_SETTING_WARP_COEF[] = "warpCoef";
50
     static const char ST_SETTING_CHROME_AB[] = "chromeAb";
51
 
52
@@ -50,8 +54,8 @@
53
     enum {
54
         STTR_DISTORTED_NAME     = 1000,
55
         STTR_DISTORTED_DESC     = 1001,
56
-        STTR_OCULUS_NAME        = 1002,
57
-        STTR_OCULUS_DESC        = 1003,
58
+        STTR_OPENVR_NAME        = 1002,
59
+        STTR_OPENVR_DESC        = 1003,
60
         STTR_S3DV_NAME          = 1004,
61
         STTR_S3DV_DESC          = 1005,
62
 
63
@@ -71,6 +75,56 @@
64
         STTR_PLUGIN_DESCRIPTION = 2002,
65
     };
66
 
67
+#ifdef ST_HAVE_OPENVR
68
+    static StString getVrTrackedDeviceString(vr::IVRSystem* theHmd,
69
+                                             vr::TrackedDeviceIndex_t theDevice,
70
+                                             vr::TrackedDeviceProperty theProperty,
71
+                                             vr::TrackedPropertyError* theError = NULL) {
72
+      const uint32_t aBuffLen = theHmd->GetStringTrackedDeviceProperty(theDevice, theProperty, NULL, 0, theError);
73
+      if(aBuffLen == 0) {
74
+          return StString();
75
+      }
76
+
77
+      char* aBuffer = new char[aBuffLen + 1];
78
+      theHmd->GetStringTrackedDeviceProperty(theDevice, theProperty, aBuffer, aBuffLen, theError);
79
+      aBuffer[aBuffLen] = '\0';
80
+      const StString aResult(aBuffer);
81
+      delete[] aBuffer;
82
+      return aResult;
83
+    }
84
+
85
+    /**
86
+     * Print OpenVR compositor error.
87
+     */
88
+    StString getVRCompositorError(vr::EVRCompositorError theVRError) {
89
+        switch(theVRError) {
90
+            case vr::VRCompositorError_None:
91
+              return "None";
92
+            case vr::VRCompositorError_RequestFailed:
93
+              return "Compositor Error: Request Failed";
94
+            case vr::VRCompositorError_IncompatibleVersion:
95
+              return "Compositor Error: Incompatible Version";
96
+            case vr::VRCompositorError_DoNotHaveFocus:
97
+              return "Compositor Error: Do not have focus";
98
+            case vr::VRCompositorError_InvalidTexture:
99
+              return "Compositor Error: Invalid Texture";
100
+            case vr::VRCompositorError_IsNotSceneApplication:
101
+              return "Compositor Error: Is not scene application";
102
+            case vr::VRCompositorError_TextureIsOnWrongDevice:
103
+              return "Compositor Error: Texture is on wrong device";
104
+            case vr::VRCompositorError_TextureUsesUnsupportedFormat:
105
+              return "Compositor Error: Texture uses unsupported format";
106
+            case vr::VRCompositorError_SharedTexturesNotSupported:
107
+              return "Compositor Error: Shared textures not supported";
108
+            case vr::VRCompositorError_IndexOutOfRange:
109
+              return "Compositor Error: Index out of range";
110
+            case vr::VRCompositorError_AlreadySubmitted:
111
+              return "Compositor Error: Already submitted";
112
+        }
113
+        return StString("Compositor Error: UNKNOWN #") + int(theVRError);
114
+    }
115
+#endif
116
+
117
 }
118
 
119
 StAtomic<int32_t> StOutDistorted::myInstancesNb(0);
120
@@ -85,7 +139,7 @@
121
 
122
 const char* StOutDistorted::getDeviceId() const {
123
     switch(myDevice) {
124
-        case DEVICE_OCULUS:    return "Oculus";
125
+        case DEVICE_HMD:       return "OpenVR";
126
         case DEVICE_S3DV:      return "S3DV";
127
         case DEVICE_DISTORTED:
128
         default:               return "Distorted";
129
@@ -97,11 +151,11 @@
130
 }
131
 
132
 bool StOutDistorted::setDevice(const StString& theDevice) {
133
-    if(theDevice == "Oculus") {
134
-        if(myDevice != DEVICE_OCULUS) {
135
+    if(theDevice == "OpenVR") {
136
+        if(myDevice != DEVICE_HMD) {
137
             myToResetDevice = true;
138
         }
139
-        myDevice = DEVICE_OCULUS;
140
+        myDevice = DEVICE_HMD;
141
     } else if(theDevice == "S3DV") {
142
         if(myDevice != DEVICE_S3DV) {
143
             myToResetDevice = true;
144
@@ -123,11 +177,13 @@
145
 }
146
 
147
 void StOutDistorted::getOptions(StParamsList& theList) const {
148
-    if(myDevice != DEVICE_OCULUS
149
+    if(myDevice != DEVICE_HMD
150
     && myDevice != DEVICE_S3DV) {
151
         theList.add(params.Layout);
152
     }
153
-    theList.add(params.MonoClone);
154
+    if(myDevice != DEVICE_HMD) {
155
+        theList.add(params.MonoClone);
156
+    }
157
 }
158
 
159
 void StOutDistorted::updateStrings() {
160
@@ -135,8 +191,8 @@
161
 
162
     myDevices[DEVICE_DISTORTED]->Name = aLangMap.changeValueId(STTR_DISTORTED_NAME, "TV (parallel pair)");
163
     myDevices[DEVICE_DISTORTED]->Desc = aLangMap.changeValueId(STTR_DISTORTED_DESC, "Distorted Output");
164
-    myDevices[DEVICE_OCULUS]   ->Name = aLangMap.changeValueId(STTR_OCULUS_NAME, "Oculus Rift");
165
-    myDevices[DEVICE_OCULUS]   ->Desc = aLangMap.changeValueId(STTR_OCULUS_DESC, "Distorted Output");
166
+    myDevices[DEVICE_HMD]->Name       = aLangMap.changeValueId(STTR_OPENVR_NAME,    "OpenVR HMD");
167
+    myDevices[DEVICE_HMD]->Desc       = aLangMap.changeValueId(STTR_OPENVR_DESC,    "Distorted Output");
168
     if(myDevices.size() > DEVICE_S3DV) {
169
         myDevices[DEVICE_S3DV] ->Name = "S3DV";             //aLangMap.changeValueId(STTR_S3DV_NAME, "S3DV");
170
         myDevices[DEVICE_S3DV] ->Desc = "Distorted Output"; //aLangMap.changeValueId(STTR_S3DV_DESC, "Distorted Output");
171
@@ -151,12 +207,23 @@
172
     params.Layout->defineOption(LAYOUT_OVER_UNDER,            aLangMap.changeValueId(STTR_PARAMETER_LAYOUT_OVERUNDER,          "Top-and-Bottom") + (myCanHdmiPack ? " [HDMI]" : ""));
173
 
174
     // about string
175
-    StString& aTitle     = aLangMap.changeValueId(STTR_PLUGIN_TITLE,   "sView - Distorted Output module");
176
-    StString& aVerString = aLangMap.changeValueId(STTR_VERSION_STRING, "version");
177
-    StString& aDescr     = aLangMap.changeValueId(STTR_PLUGIN_DESCRIPTION,
178
-        "(C) {0} Kirill Gavrilov <{1}>\nOfficial site: {2}\n\nThis library is distributed under LGPL3.0");
179
-    myAbout = aTitle + '\n' + aVerString + " " + StVersionInfo::getSDKVersionString() + "\n \n"
180
-            + aDescr.format("2013-2016", "kirill@sview.ru", "www.sview.ru");
181
+    myAboutTitle     = aLangMap.changeValueId(STTR_PLUGIN_TITLE,   "sView - Distorted Output module");
182
+    myAboutVerString = aLangMap.changeValueId(STTR_VERSION_STRING, "version");
183
+    myAboutDescr     = aLangMap.changeValueId(STTR_PLUGIN_DESCRIPTION,
184
+                                              "(C) {0} Kirill Gavrilov <{1}>\nOfficial site: {2}\n\nThis library is distributed under LGPL3.0");
185
+    updateAbout();
186
+}
187
+
188
+void StOutDistorted::updateAbout() {
189
+    myAbout = myAboutTitle + '\n' + myAboutVerString + " " + StVersionInfo::getSDKVersionString() + "\n \n"
190
+            + (!myAboutVrDevice.isEmpty() ? ("Connected hardware: " + myAboutVrDevice + "\n \n") : "")
191
+            + myAboutDescr.format("2013-2017", "kirill@sview.ru", "www.sview.ru");
192
+#ifdef ST_HAVE_OPENVR
193
+    myAbout = myAbout + "\n \n"
194
+            + "This software uses OpenVR library:\n"
195
+            + "https://github.com/ValveSoftware/openvr\n"
196
+            + "\xC2\xA9 2015 Valve Corporation";
197
+#endif
198
 }
199
 
200
 StOutDistorted::StOutDistorted(const StHandle<StResourceManager>& theResMgr,
201
sview-16_06.tar.gz/StOutDistorted/StOutDistorted.h -> sview-17_04.tar.gz/StOutDistorted/StOutDistorted.h Changed
172
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StOutDistorted, class providing stereoscopic output in anamorph side by side format using StCore toolkit.
4
- * Copyright © 2013-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2013-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -14,11 +14,19 @@
10
 #include <StGL/StGLVertexBuffer.h>
11
 #include <StThreads/StFPSControl.h>
12
 
13
+//#define ST_HAVE_OPENVR
14
+
15
 class StSettings;
16
 class StProgramBarrel;
17
 class StProgramFlat;
18
 class StGLFrameBuffer;
19
 class StGLTexture;
20
+class StGLTextureQuad;
21
+
22
+namespace vr {
23
+    class IVRSystem;
24
+    struct TrackedDevicePose_t;
25
+}
26
 
27
 typedef struct ovrHmdStruct* ovrSession;
28
 typedef union ovrGLTexture_s ovrGLTexture;
29
@@ -26,7 +34,7 @@
30
 
31
 /**
32
  * This class implements stereoscopic rendering on displays
33
- * wich require software distortion correction.
34
+ * which require software distortion correction.
35
  */
36
 class StOutDistorted : public StWindow {
37
 
38
@@ -113,6 +121,11 @@
39
     ST_CPPEXPORT virtual void setFullScreen(const bool theFullScreen) ST_ATTR_OVERRIDE;
40
 
41
     /**
42
+     * Return true if 3D output requires fullscreen mode.
43
+     */
44
+    ST_CPPEXPORT virtual bool isStereoFullscreenOnly() const ST_ATTR_OVERRIDE;
45
+
46
+    /**
47
      * Stereo renderer.
48
      */
49
     ST_CPPEXPORT virtual void stglDraw() ST_ATTR_OVERRIDE;
50
@@ -129,10 +142,25 @@
51
     ST_CPPEXPORT virtual bool hasOrientationSensor() const ST_ATTR_OVERRIDE;
52
 
53
     /**
54
+     * Return TRUE if orientation tracking has been activated.
55
+     */
56
+    ST_CPPEXPORT virtual bool toTrackOrientation() const ST_ATTR_OVERRIDE;
57
+
58
+    /**
59
+     * Setup flag indicating that orientation tracking should be enabled
60
+     */
61
+    ST_CPPEXPORT virtual void setTrackOrientation(const bool theToTrack) ST_ATTR_OVERRIDE;
62
+
63
+    /**
64
      * Get head orientation.
65
      */
66
     ST_CPPEXPORT virtual StQuaternion<double> getDeviceOrientation() const ST_ATTR_OVERRIDE;
67
 
68
+    /**
69
+     * Return margins for working area.
70
+     */
71
+    ST_CPPEXPORT virtual StMarginsI getMargins() const ST_ATTR_OVERRIDE;
72
+
73
     ST_CPPEXPORT virtual GLfloat getLensDist() const ST_ATTR_OVERRIDE;
74
 
75
     /**
76
@@ -163,6 +191,11 @@
77
     ST_LOCAL void updateStrings();
78
 
79
     /**
80
+     * Update about text.
81
+     */
82
+    ST_LOCAL void updateAbout();
83
+
84
+    /**
85
      * On/off VSync callback.
86
      */
87
     ST_LOCAL void doSwitchVSync(const int32_t theValue);
88
@@ -171,10 +204,15 @@
89
                                  const unsigned int theView);
90
 
91
     /**
92
-     * Draw stereo-pair using libOVR.
93
+     * Draw stereo-pair for VR.
94
      * To be called from stglDraw().
95
      */
96
-    ST_LOCAL void stglDrawLibOVR();
97
+    ST_LOCAL void stglDrawVR();
98
+
99
+    ST_LOCAL bool isHmdOutput() const {
100
+        return myIsStereoOn
101
+            && myDevice == DEVICE_HMD;
102
+    }
103
 
104
         private:
105
 
106
@@ -185,7 +223,7 @@
107
     enum {
108
         DEVICE_AUTO         =-1,
109
         DEVICE_DISTORTED    = 0, //!< general output
110
-        DEVICE_OCULUS       = 1, //!< Oculus Rift
111
+        DEVICE_HMD          = 1, //!< VR HMD
112
         DEVICE_S3DV         = 2, //!< S3DV
113
         DEVICE_NB,
114
     };
115
@@ -202,7 +240,7 @@
116
      */
117
     Layout getPairLayout() const {
118
         switch(myDevice) {
119
-            case DEVICE_OCULUS:
120
+            case DEVICE_HMD:
121
                 return LAYOUT_SIDE_BY_SIDE;
122
             case DEVICE_S3DV:
123
                 return LAYOUT_SIDE_BY_SIDE_ANAMORPH;
124
@@ -224,6 +262,10 @@
125
     StOutDevicesList          myDevices;
126
     StHandle<StSettings>      mySettings;
127
     StString                  myAbout;           //!< about string
128
+    StString                  myAboutTitle;      //!< title for About dialog
129
+    StString                  myAboutVerString;  //!< version string for About dialog
130
+    StString                  myAboutDescr;      //!< description for About dialog
131
+    StString                  myAboutVrDevice;   //!< HMD info for About dialog
132
 
133
     int                       myDevice;          //!< currently active device
134
     bool                      myToResetDevice;
135
@@ -240,20 +282,28 @@
136
     StGLVec4                  myBarrelCoef;      //!< Barrel distortion coefficients
137
     StGLVec4                  myChromAb;         //!< chrome coefficients
138
 
139
-    StMarginsI                myBarMargins;      //!< GUI margins
140
-
141
-    ovrSession                myOvrHmd;
142
-    int                       myOvrSizeX;
143
-    int                       myOvrSizeY;
144
-    StQuaternion<double>      myOvrOrient;
145
-#ifdef ST_HAVE_LIBOVR
146
+    StQuaternion<double>      myVrOrient;        //!< HMD (head) orientation, excluding translation vector
147
+    double                    myVrMarginsTop;
148
+    double                    myVrMarginsBottom;
149
+    double                    myVrMarginsLeft;
150
+    double                    myVrMarginsRight;
151
+    int                       myVrRendSizeX;     //!< FBO width  for rendering into VR (can be greater then actual HMD resolution to compensate distortion)
152
+    int                       myVrRendSizeY;     //!< FBO height for rendering into VR
153
+    bool                      myVrTrackOrient;   //!< track orientation flag
154
+    bool                      myVrToDrawMsg;
155
+    StHandle<StGLTextureQuad> myVrFullscreenMsg;
156
+    StTimer                   myVrMsgTimer;
157
+#ifdef ST_HAVE_OPENVR
158
+    vr::IVRSystem*            myVrHmd;           //!< OpenVR session object
159
+    vr::TrackedDevicePose_t*  myVrTrackedPoses;  //!< array of tracked devices poses
160
+#elif defined(ST_HAVE_LIBOVR)
161
+    ovrSession                myVrHmd;
162
     ovrSwapTextureSet*        myOvrSwapTexture;
163
     GLuint                    myOvrSwapFbo[2];
164
     ovrGLTexture*             myOvrMirrorTexture;
165
     GLuint                    myOvrMirrorFbo;
166
 #endif
167
 
168
-    bool                      myToReduceGui;     //!< scale down GUI
169
     bool                      myToShowCursor;    //!< cursor visibility flag
170
     bool                      myToCompressMem;   //!< reduce memory usage
171
     bool                      myIsBroken;        //!< special flag for broke state - when FBO can not be allocated
172
sview-16_06.tar.gz/StOutDistorted/StOutDistorted.rc -> sview-17_04.tar.gz/StOutDistorted/StOutDistorted.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "Stereo Distorted Renderer library\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2013-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2013-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StOutDistorted\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StOutDistorted/lang/chinese/StOutDistorted.lng -> sview-17_04.tar.gz/StOutDistorted/lang/chinese/StOutDistorted.lng Changed
10
 
1
@@ -3,7 +3,7 @@
2
 --------
3
 1000=TV (平行配对)
4
 1001=扭曲输出
5
-1002=眼镜裂隙
6
+1002=OpenVR HMD
7
 1003=桶变形
8
 1110=配线
9
 1111=左右并列
10
sview-16_06.tar.gz/StOutDistorted/lang/czech/StOutDistorted.lng -> sview-17_04.tar.gz/StOutDistorted/lang/czech/StOutDistorted.lng Changed
10
 
1
@@ -4,7 +4,7 @@
2
 --------
3
 1000=Paralel vedle sebe
4
 1001=Deformovaný výstup
5
-1002=Oculus Rift
6
+1002=OpenVR HMD
7
 1003=Soudková deformace
8
 1110=Uspořádání dvojice
9
 1111=Vedle sebe
10
sview-16_06.tar.gz/StOutDistorted/lang/english/StOutDistorted.lng -> sview-17_04.tar.gz/StOutDistorted/lang/english/StOutDistorted.lng Changed
10
 
1
@@ -3,7 +3,7 @@
2
 --------
3
 1000=TV (parallel pair)
4
 1001=Distorted Output
5
-1002=Oculus Rift
6
+1002=OpenVR HMD
7
 1003=Barrel distortion
8
 1110=Layout
9
 1111=Side-by-Side
10
sview-16_06.tar.gz/StOutDistorted/lang/french/StOutDistorted.lng -> sview-17_04.tar.gz/StOutDistorted/lang/french/StOutDistorted.lng Changed
10
 
1
@@ -3,7 +3,7 @@
2
 --------
3
 1000=TV (parallel pair)
4
 1001=Distorted Output
5
-1002=Oculus Rift
6
+1002=OpenVR HMD
7
 1003=Barrel distortion
8
 1110=Layout
9
 1111=Side-by-Side
10
sview-16_06.tar.gz/StOutDistorted/lang/german/StOutDistorted.lng -> sview-17_04.tar.gz/StOutDistorted/lang/german/StOutDistorted.lng Changed
10
 
1
@@ -3,7 +3,7 @@
2
 --------
3
 1000=TV (parallel pair)
4
 1001=Distorted Output
5
-1002=Oculus Rift
6
+1002=OpenVR HMD
7
 1003=Barrel distortion
8
 1110=Layout
9
 1111=Side-by-Side
10
sview-16_06.tar.gz/StOutDistorted/lang/korean/StOutDistorted.lng -> sview-17_04.tar.gz/StOutDistorted/lang/korean/StOutDistorted.lng Changed
10
 
1
@@ -3,7 +3,7 @@
2
 --------
3
 ?1000=TV (parallel pair)
4
 ?1001=Distorted Output
5
-?1002=Oculus Rift
6
+?1002=OpenVR HMD
7
 ?1003=Barrel distortion
8
 ?1110=Layout
9
 ?1111=Side-by-Side
10
sview-16_06.tar.gz/StOutDistorted/lang/russian/StOutDistorted.lng -> sview-17_04.tar.gz/StOutDistorted/lang/russian/StOutDistorted.lng Changed
10
 
1
@@ -3,7 +3,7 @@
2
 --------
3
 1000=TV (параллельная пара)
4
 1001=Distorted Output
5
-1002=Oculus Rift
6
+1002=OpenVR HMD
7
 1003=Barrel distortion
8
 1110=Расположение пары
9
 1111=Горизонтальная пара
10
sview-16_06.tar.gz/StOutDual/StOutDual.cpp -> sview-17_04.tar.gz/StOutDual/StOutDual.cpp Changed
27
 
1
@@ -184,7 +184,7 @@
2
     StString& aDescr     = aLangMap.changeValueId(STTR_PLUGIN_DESCRIPTION,
3
         "(C) {0} Kirill Gavrilov <{1}>\nOfficial site: {2}\n\nThis library is distributed under LGPL3.0");
4
     myAbout = aTitle + '\n' + aVerString + " " + StVersionInfo::getSDKVersionString() + "\n \n"
5
-            + aDescr.format("2007-2016", "kirill@sview.ru", "www.sview.ru");
6
+            + aDescr.format("2007-2017", "kirill@sview.ru", "www.sview.ru");
7
 }
8
 
9
 StOutDual::StOutDual(const StHandle<StResourceManager>& theResMgr,
10
@@ -241,6 +241,8 @@
11
     params.SlaveMonId->signals.onChanged.connect(this, &StOutDual::doSlaveMon);
12
 
13
     params.MonoClone = new StBoolParamNamed(false, stCString("monoClone"), stCString("monoClone"));
14
+    updateStrings();
15
+
16
     mySettings->loadParam(params.MonoClone);
17
 
18
     // load window position
19
@@ -251,7 +253,6 @@
20
         }
21
         StWindow::setPlacement(aRect, true);
22
     }
23
-    updateStrings();
24
     StWindow::setTitle("sView - Dual Renderer");
25
 
26
     // load device settings
27
sview-16_06.tar.gz/StOutDual/StOutDual.rc -> sview-17_04.tar.gz/StOutDual/StOutDual.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "Stereo Dual Renderer library\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2007-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2007-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StOutDual\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StOutIZ3D/StOutIZ3D.cpp -> sview-17_04.tar.gz/StOutIZ3D/StOutIZ3D.cpp Changed
27
 
1
@@ -117,7 +117,7 @@
2
     StString& aDescr     = aLangMap.changeValueId(STTR_PLUGIN_DESCRIPTION,
3
         "(C) {0} Kirill Gavrilov <{1}>\nOfficial site: {2}\n\nThis library is distributed under LGPL3.0");
4
     myAbout = aTitle + '\n' + aVerString + " " + StVersionInfo::getSDKVersionString() + "\n \n"
5
-            + aDescr.format("2009-2016", "kirill@sview.ru", "www.sview.ru");
6
+            + aDescr.format("2009-2017", "kirill@sview.ru", "www.sview.ru");
7
 }
8
 
9
 StOutIZ3D::StOutIZ3D(const StHandle<StResourceManager>& theResMgr,
10
@@ -154,6 +154,7 @@
11
     // shader switch option
12
     params.Glasses = new StEnumParam(myShaders.getMode(), stCString("tableId"), stCString("tableId"));
13
     params.Glasses->signals.onChanged.connect(&myShaders, &StOutIZ3DShaders::doSetMode);
14
+    updateStrings();
15
 
16
     // load window position
17
     if(isMovable()) {
18
@@ -163,7 +164,7 @@
19
         }
20
         StWindow::setPlacement(aRect, true);
21
     }
22
-    updateStrings();
23
+
24
     StWindow::setTitle("sView - iZ3D Renderer");
25
 
26
     // load parameters
27
sview-16_06.tar.gz/StOutIZ3D/StOutIZ3D.rc -> sview-17_04.tar.gz/StOutIZ3D/StOutIZ3D.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "IZ3D Renderer library\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2009-2016 Kirill Gavrilov. Copyright \251 iZ3D LLC. All rights for codes for iZ3D conversion reserved for iZ3D LLC 2007-2009\000"
6
+      VALUE "LegalCopyright",  "\251 2009-2017 Kirill Gavrilov. Copyright \251 iZ3D LLC. All rights for codes for iZ3D conversion reserved for iZ3D LLC 2007-2009\000"
7
       VALUE "ProductName",     "StOutIZ3D\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StOutInterlace/StOutInterlace.cpp -> sview-17_04.tar.gz/StOutInterlace/StOutInterlace.cpp Changed
201
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StOutInterlace, class providing stereoscopic output in row interlaced format using StCore toolkit.
4
- * Copyright © 2009-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -17,6 +17,7 @@
10
 #include <StSettings/StTranslations.h>
11
 #include <StSettings/StEnumParam.h>
12
 #include <StCore/StSearchMonitors.h>
13
+#include <StImage/StImagePlane.h>
14
 #include <StVersion.h>
15
 
16
 namespace {
17
@@ -66,6 +67,7 @@
18
         // parameters
19
         STTR_PARAMETER_REVERSE  = 1102,
20
         STTR_PARAMETER_BIND_MON = 1103,
21
+        STTR_PARAMETER_USE_MASK = 1104,
22
 
23
         // about info
24
         STTR_PLUGIN_TITLE       = 2000,
25
@@ -99,10 +101,14 @@
26
     if(!StGLProgram::link(theCtx)) {
27
         return false;
28
     }
29
-    StGLVarLocation aTextureLoc = StGLProgram::getUniformLocation(theCtx, "uTexture");
30
+    StGLVarLocation aTextureLoc  = StGLProgram::getUniformLocation(theCtx, "uTexture");
31
+    StGLVarLocation aTexture2Loc = StGLProgram::getUniformLocation(theCtx, "uMaskTexture");
32
     if(aTextureLoc.isValid()) {
33
         use(theCtx);
34
         theCtx.core20fwd->glUniform1i(aTextureLoc, StGLProgram::TEXTURE_SAMPLE_0); // GL_TEXTURE0
35
+        if(aTexture2Loc.isValid()) {
36
+            theCtx.core20fwd->glUniform1i(aTexture2Loc, StGLProgram::TEXTURE_SAMPLE_1); // GL_TEXTURE1
37
+        }
38
         unuse(theCtx);
39
     }
40
     return aTextureLoc.isValid();
41
@@ -179,6 +185,7 @@
42
 #if !defined(__ANDROID__)
43
     theList.add(params.BindToMon);
44
 #endif
45
+    theList.add(params.ToUseMask);
46
 }
47
 
48
 void StOutInterlace::updateStrings() {
49
@@ -195,6 +202,7 @@
50
 #endif
51
     params.ToReverse->setName(aLangMap.changeValueId(STTR_PARAMETER_REVERSE,  "Reverse Order"));
52
     params.BindToMon->setName(aLangMap.changeValueId(STTR_PARAMETER_BIND_MON, "Bind To Supported Monitor"));
53
+    params.ToUseMask->setName(aLangMap.changeValueId(STTR_PARAMETER_USE_MASK, "Use texture mask (compatibility)"));
54
 
55
     // about string
56
     StString& aTitle     = aLangMap.changeValueId(STTR_PLUGIN_TITLE,   "sView - Interlaced Output library");
57
@@ -202,7 +210,7 @@
58
     StString& aDescr     = aLangMap.changeValueId(STTR_PLUGIN_DESCRIPTION,
59
         "(C) {0} Kirill Gavrilov <{1}>\nOfficial site: {2}\n\nThis library is distributed under LGPL3.0");
60
     myAbout = aTitle + '\n' + aVerString + " " + StVersionInfo::getSDKVersionString() + "\n \n"
61
-            + aDescr.format("2009-2016", "kirill@sview.ru", "www.sview.ru");
62
+            + aDescr.format("2009-2017", "kirill@sview.ru", "www.sview.ru");
63
 }
64
 
65
 StOutInterlace::StOutInterlace(const StHandle<StResourceManager>& theResMgr,
66
@@ -210,6 +218,9 @@
67
 : StWindow(theResMgr, theParentWindow),
68
   mySettings(new StSettings(theResMgr, ST_OUT_PLUGIN_NAME)),
69
   myFrmBuffer(new StGLFrameBuffer()),
70
+  myTextureMask(new StGLTexture(GL_ALPHA)),
71
+  myTexMaskDevice(DEVICE_AUTO),
72
+  myTexMaskReversed(false),
73
   myDevice(DEVICE_AUTO),
74
   myEDTimer(true),
75
   myEDIntelaceOn(new StGLProgram("ED Interlace On")),
76
@@ -221,6 +232,7 @@
77
   myIsEDactive(false),
78
   myIsEDCodeFinished(false),
79
   myToCompressMem(myInstancesNb.increment() > 1),
80
+  myIsFirstDraw(true),
81
   myIsBroken(false) {
82
     myWinRect.left()   = 0;
83
     myWinRect.right()  = 0;
84
@@ -243,6 +255,8 @@
85
     myGlProgramsRev[DEVICE_CHESSBOARD]        = new StProgramFB("Chessboard Inversed");
86
     myGlProgramsRev[DEVICE_ROW_INTERLACED_ED] = myGlProgramsRev[DEVICE_ROW_INTERLACED];
87
 
88
+    myGlProgramMask = new StProgramFB("Interlace Mask");
89
+
90
     // devices list
91
     StHandle<StOutDevice> aDevRow = new StOutDevice();
92
     aDevRow->PluginId = ST_OUT_PLUGIN_NAME;
93
@@ -284,11 +298,13 @@
94
     // options
95
     params.ToReverse = new StBoolParamNamed(false, stCString("reverse"),     stCString("reverse"));
96
     params.BindToMon = new StBoolParamNamed(true,  stCString("bindMonitor"), stCString("bindMonitor"));
97
+    params.ToUseMask = new StBoolParamNamed(false, stCString("useMask"),     stCString("useMask"));
98
+    updateStrings();
99
+
100
     mySettings->loadParam(params.ToReverse);
101
     mySettings->loadParam(params.BindToMon);
102
-
103
+    myIsFirstDraw = !mySettings->loadParam(params.ToUseMask);
104
     params.BindToMon->signals.onChanged.connect(this, &StOutInterlace::doSetBindToMonitor);
105
-    updateStrings();
106
 
107
     // load window position
108
     if(isMovable()) {
109
@@ -354,6 +370,8 @@
110
         myQuadVertBuf.release(*myContext);
111
         myQuadTexCoordBuf.release(*myContext);
112
         myFrmBuffer->release(*myContext);
113
+        myTextureMask->release(*myContext);
114
+        myGlProgramMask->release(*myContext);
115
     }
116
     myContext.nullify();
117
 
118
@@ -382,6 +400,7 @@
119
     }
120
     mySettings->saveParam(params.BindToMon);
121
     mySettings->saveParam(params.ToReverse);
122
+    mySettings->saveParam(params.ToUseMask);
123
     mySettings->saveInt32(ST_SETTING_DEVICE_ID,    myDevice);
124
     mySettings->flush();
125
 
126
@@ -531,11 +550,31 @@
127
                                        .attachShader(*myContext, aShaderChessRev)
128
                                        .link(*myContext);
129
 
130
+    // discard mask texture
131
+    StGLFragmentShader aShaderMask(myGlProgramMask->getTitle());
132
+    StGLAutoRelease aTmp8(*myContext, aShaderMask);
133
+    if(!aShaderMask.init(*myContext,
134
+                         "uniform sampler2D uTexture;\n"
135
+                         "uniform sampler2D uMaskTexture;\n"
136
+                         "varying vec2 fTexCoord;\n"
137
+                         "void main(void) {\n"
138
+                         "  float aMask = texture2D(uMaskTexture, fTexCoord).a;\n"
139
+                         "  if(aMask < 0.5) { discard; }\n"
140
+                         "  gl_FragColor = texture2D(uTexture, fTexCoord);\n"
141
+                         "}\n")) {
142
+        myMsgQueue->pushError(aShadersError);
143
+        myIsBroken = true;
144
+        return true;
145
+    }
146
+    myGlProgramMask->create(*myContext)
147
+                   .attachShader(*myContext, aVertexShader)
148
+                   .attachShader(*myContext, aShaderMask)
149
+                   .link(*myContext);
150
+
151
 #if !defined(__ANDROID__)
152
-    /// TODO (Kirill Gavrilov#3) fix shaders
153
     const StString aShadersRoot = StString("shaders" ST_FILE_SPLITTER) + ST_OUT_PLUGIN_NAME + SYS_FS_SPLITTER;
154
     StGLVertexShader stVShaderED("ED control");
155
-    StGLAutoRelease aTmp8(*myContext, stVShaderED);
156
+    StGLAutoRelease aTmp9(*myContext, stVShaderED);
157
     if(!stVShaderED.initFile(*myContext, aShadersRoot + VSHADER_ED)) {
158
         myMsgQueue->pushError(aShadersError);
159
         myIsBroken = true;
160
@@ -543,7 +582,7 @@
161
     }
162
 
163
     StGLFragmentShader stFInterlaceOn(myEDIntelaceOn->getTitle());
164
-    StGLAutoRelease aTmp9(*myContext, stFInterlaceOn);
165
+    StGLAutoRelease aTmp10(*myContext, stFInterlaceOn);
166
     if(!stFInterlaceOn.initFile(*myContext, aShadersRoot + FSHADER_EDINTERLACE_ON)) {
167
         myMsgQueue->pushError(aShadersError);
168
         myIsBroken = true;
169
@@ -555,7 +594,7 @@
170
                    .link(*myContext);
171
 
172
     StGLFragmentShader stFShaderEDOff(myEDOff->getTitle());
173
-    StGLAutoRelease aTmp10(*myContext, stFShaderEDOff);
174
+    StGLAutoRelease aTmp11(*myContext, stFShaderEDOff);
175
     if(!stFShaderEDOff.initFile(*myContext, aShadersRoot + FSHADER_ED_OFF)) {
176
         myMsgQueue->pushError(aShadersError);
177
         myIsBroken = true;
178
@@ -643,6 +682,73 @@
179
     }
180
 }
181
 
182
+bool StOutInterlace::initTextureMask(int  theDevice,
183
+                                     bool theToReverse,
184
+                                     int  theSizeX,
185
+                                     int  theSizeY) {
186
+    if(myTextureMask->getSizeX() == theSizeX
187
+    && myTextureMask->getSizeY() == theSizeY
188
+    && myTexMaskDevice   == theDevice
189
+    && myTexMaskReversed == theToReverse) {
190
+        return true;
191
+    }
192
+
193
+    StImagePlane anImage;
194
+    if(!anImage.initTrash(StImagePlane::ImgGray, theSizeX, theSizeY)) {
195
+        myMsgQueue->pushError(stCString("Interlace output - critical error:\nNot enough memory for mask image!"));
196
+        myIsBroken = true;
197
+        return false;
198
+    }
199
+
200
+    for(int aRowIter = 0; aRowIter < theSizeY; ++aRowIter) {
201
sview-16_06.tar.gz/StOutInterlace/StOutInterlace.h -> sview-17_04.tar.gz/StOutInterlace/StOutInterlace.h Changed
53
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StOutInterlace, class providing stereoscopic output in row interlaced format using StCore toolkit.
4
- * Copyright © 2009-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -135,6 +135,14 @@
10
     ST_LOCAL void stglDrawEDCodes();
11
 
12
     /**
13
+     * Initialize texture mask.
14
+     */
15
+    ST_LOCAL bool initTextureMask(int  theDevice,
16
+                                  bool theToReverse,
17
+                                  int  theSizeX,
18
+                                  int  theSizeY);
19
+
20
+    /**
21
      * Release GL resources before window closing.
22
      */
23
     ST_LOCAL void releaseResources();
24
@@ -169,6 +177,7 @@
25
 
26
         StHandle<StBoolParamNamed> ToReverse; //!< configurable flag to reverse rows order
27
         StHandle<StBoolParamNamed> BindToMon; //!< flag to bind to monitor
28
+        StHandle<StBoolParamNamed> ToUseMask; //!< use mask texture instead of straightforward discard shader
29
 
30
     } params;
31
 
32
@@ -181,6 +190,12 @@
33
     StHandle<StGLFrameBuffer> myFrmBuffer;                //!< OpenGL frame buffer object
34
     StHandle<StProgramFB>     myGlPrograms[DEVICE_NB];    //!< GLSL programs
35
     StHandle<StProgramFB>     myGlProgramsRev[DEVICE_NB]; //!< GLSL programs with reversed left/right condition
36
+
37
+    StHandle<StProgramFB>     myGlProgramMask;            //!< universal GLSL program which uses mask texture
38
+    StHandle<StGLTexture>     myTextureMask;              //!< texture holding mask for discarding pixels
39
+    int                       myTexMaskDevice;            //!< texture mask device
40
+    bool                      myTexMaskReversed;          //!< texture mask is initialized in reversed state
41
+
42
     StGLVertexBuffer          myQuadVertBuf;
43
     StGLVertexBuffer          myQuadTexCoordBuf;
44
     int                       myDevice;
45
@@ -202,6 +217,7 @@
46
     bool                      myIsEDactive;
47
     bool                      myIsEDCodeFinished;
48
     bool                      myToCompressMem;            //!< reduce memory usage
49
+    bool                      myIsFirstDraw;              //!< first frame draw
50
     bool                      myIsBroken;                 //!< special flag for broke state - when FBO can not be allocated
51
 
52
 };
53
sview-16_06.tar.gz/StOutInterlace/StOutInterlace.rc -> sview-17_04.tar.gz/StOutInterlace/StOutInterlace.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "Interlace Renderer library\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2009-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2009-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StOutInterlace\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StOutInterlace/lang/chinese/StOutInterlace.lng -> sview-17_04.tar.gz/StOutInterlace/lang/chinese/StOutInterlace.lng Changed
9
 
1
@@ -11,6 +11,7 @@
2
 1009=空间交错模式
3
 1102=次序颠倒
4
 1103=强制支持显示器
5
+?1104=Use texture mask (compatibility)
6
 2000=sView - 交错输出模块
7
 2001=版本
8
 ?2002=© {0} Kirill Gavrilov <{1}>\nOfficial site: {2}
9
sview-16_06.tar.gz/StOutInterlace/lang/czech/StOutInterlace.lng -> sview-17_04.tar.gz/StOutInterlace/lang/czech/StOutInterlace.lng Changed
9
 
1
@@ -12,6 +12,7 @@
2
 1009=EDimensional v prokládaném režimu
3
 1102=Přeskládat obráceně
4
 1103=Provázat s monitorem
5
+?1104=Use texture mask (compatibility)
6
 2000=sView - modul prokládaného zobrazování
7
 2001=verze
8
 2002=© {0} Гаврилов Кирилл <{1}>\noficiální strana: {2}
9
sview-16_06.tar.gz/StOutInterlace/lang/english/StOutInterlace.lng -> sview-17_04.tar.gz/StOutInterlace/lang/english/StOutInterlace.lng Changed
9
 
1
@@ -11,6 +11,7 @@
2
 1009=EDimensional in interlaced mode
3
 1102=Reverse Order
4
 1103=Bind to supported monitor
5
+1104=Use texture mask (compatibility)
6
 2000=sView - Interlaced Output module
7
 2001=version
8
 2002=© {0} Kirill Gavrilov <{1}>\nOfficial site: {2}
9
sview-16_06.tar.gz/StOutInterlace/lang/french/StOutInterlace.lng -> sview-17_04.tar.gz/StOutInterlace/lang/french/StOutInterlace.lng Changed
9
 
1
@@ -11,6 +11,7 @@
2
 1009=EDimensional en mode entrelacé
3
 1102=Inverser l'ordre
4
 1103=Lier à écran supporté
5
+?1104=Use texture mask (compatibility)
6
 2000=sView - Interlaced Output module
7
 2001=version
8
 2002=© {0} Kirill Gavrilov <{1}>\nSite Officiel: {2}
9
sview-16_06.tar.gz/StOutInterlace/lang/german/StOutInterlace.lng -> sview-17_04.tar.gz/StOutInterlace/lang/german/StOutInterlace.lng Changed
9
 
1
@@ -11,6 +11,7 @@
2
 1009=EDimensional in interlaced mode
3
 1102=Umgekehrte Reihenfolge
4
 1103=Bind to supported monitor
5
+?1104=Use texture mask (compatibility)
6
 2000=sView - Interlaced Ausgangsmodul
7
 2001=Version
8
 ?2002=© {0} Kirill Gavrilov <{1}>\nOfficial site: {2}
9
sview-16_06.tar.gz/StOutInterlace/lang/korean/StOutInterlace.lng -> sview-17_04.tar.gz/StOutInterlace/lang/korean/StOutInterlace.lng Changed
9
 
1
@@ -11,6 +11,7 @@
2
 ?1009=EDimensional in interlaced mode
3
 ?1102=Reverse Order
4
 ?1103=Bind to supported monitor
5
+?1104=Use texture mask (compatibility)
6
 ?2000=sView - Interlaced Output module
7
 ?2001=version
8
 ?2002=© {0} Kirill Gavrilov <{1}>\nOfficial site: {2}
9
sview-16_06.tar.gz/StOutInterlace/lang/russian/StOutInterlace.lng -> sview-17_04.tar.gz/StOutInterlace/lang/russian/StOutInterlace.lng Changed
11
 
1
@@ -10,7 +10,8 @@
2
 1008=Чересстрочный ED
3
 1009=EDimensional в чересстрочном режиме
4
 1102=Реверсировать порядок
5
-1103=Bind to supported monitor
6
+1103=Открывать окно на совместимом мониторе
7
+?1104=Использовать текстуру-маску (совместимость)
8
 2000=sView - модуль Чересстрочного стереовывода
9
 2001=версия
10
 2002=© {0} Гаврилов Кирилл <{1}>\nОфициальный сайт: {2}
11
sview-16_06.tar.gz/StOutPageFlip/StDXManager.cpp -> sview-17_04.tar.gz/StOutPageFlip/StDXManager.cpp Changed
67
 
1
@@ -83,7 +83,6 @@
2
 : myD3dLib(NULL),
3
   myD3dDevice(NULL),
4
   myRefreshRate(D3DPRESENT_RATE_DEFAULT),
5
-  myIsD3dEx(false),
6
   myWithAqbs(false) {
7
     stMemSet(&myD3dParams, 0, sizeof(myD3dParams));
8
     stMemSet(&myCurrMode,  0, sizeof(myCurrMode));
9
@@ -112,22 +111,7 @@
10
 
11
 bool StDXManager::initDxLib() {
12
     if(myD3dLib == NULL) {
13
-        IDirect3D9Ex* aD3dLibEx = NULL;
14
-        // we link against d3d (using Direct3DCreate9 symbol), thus it should be already loaded
15
-        HMODULE aLib = GetModuleHandleW(L"d3d9");
16
-        if(aLib != NULL) {
17
-            // retrieve D3D9Ex function dynamically (available only since Vista+)
18
-            typedef HRESULT (WINAPI* Direct3DCreate9Ex_t)(UINT , IDirect3D9Ex** );
19
-            Direct3DCreate9Ex_t Direct3DCreate9ExProc = (Direct3DCreate9Ex_t )GetProcAddress(aLib, "Direct3DCreate9Ex");
20
-            if(Direct3DCreate9ExProc != NULL) {
21
-                Direct3DCreate9ExProc(D3D_SDK_VERSION, &aD3dLibEx);
22
-            }
23
-        }
24
-        myD3dLib  = aD3dLibEx;
25
-        myIsD3dEx = aD3dLibEx != NULL;
26
-        if(myD3dLib == NULL) {
27
-            myD3dLib = Direct3DCreate9(D3D_SDK_VERSION);
28
-        }
29
+        Direct3DCreate9Ex(D3D_SDK_VERSION, &myD3dLib);
30
     }
31
     return myD3dLib != NULL;
32
 }
33
@@ -460,33 +444,14 @@
34
         return DefWindowProcW(in_hWnd, uMsg, wParam, lParam);
35
     }
36
 
37
-    static StCondition   THE_DX_INIT_EVENT(true);
38
     static volatile bool ST_DX_HAS_CACHED_INFO = false;
39
     static StDXInfo      ST_DX_CACHED_INFO;
40
 
41
-    SV_THREAD_FUNCTION getInfoThreadFunction(void* ) {
42
-        StDXInfo anInfo;
43
-        StDXManager::getInfo(anInfo, true);
44
-        THE_DX_INIT_EVENT.set();
45
-        return SV_THREAD_RETURN 0;
46
-    }
47
-
48
-}
49
-
50
-void StDXManager::initInfoAsync() {
51
-    if(!THE_DX_INIT_EVENT.check()) {
52
-        return; // already called
53
-    }
54
-
55
-    // start and detach thread
56
-    THE_DX_INIT_EVENT.reset();
57
-    StThread aTestThread(getInfoThreadFunction, NULL);
58
 }
59
 
60
 bool StDXManager::getInfo(StDXInfo&  theInfo,
61
                           const bool theForced) {
62
     if(!theForced) {
63
-        THE_DX_INIT_EVENT.wait();
64
         if(ST_DX_HAS_CACHED_INFO) {
65
             theInfo = ST_DX_CACHED_INFO;
66
             return true;
67
sview-16_06.tar.gz/StOutPageFlip/StDXManager.h -> sview-17_04.tar.gz/StOutPageFlip/StDXManager.h Changed
41
 
1
@@ -30,11 +30,6 @@
2
 
3
         public:
4
 
5
-    /**
6
-     * Launch test in other thread.
7
-     */
8
-    static void initInfoAsync();
9
-
10
     static bool getInfo(StDXInfo&  theInfo,
11
                         const bool theForced = false);
12
 
13
@@ -58,13 +53,6 @@
14
     virtual ~StDXManager();
15
 
16
     /**
17
-     * @return true if IDirect3DDevice9Ex device has been created
18
-     */
19
-    bool isD3dEx() const {
20
-        return myIsD3dEx;
21
-    }
22
-
23
-    /**
24
      * Access Direct3D device instance.
25
      */
26
     IDirect3DDevice9* getDevice() const {
27
@@ -149,12 +137,11 @@
28
 
29
         protected:
30
 
31
-    IDirect3D9*           myD3dLib;      //!< Direct3D library instance
32
+    IDirect3D9Ex*         myD3dLib;      //!< Direct3D library instance
33
     IDirect3DDevice9*     myD3dDevice;   //!< Direct3D device object
34
     D3DPRESENT_PARAMETERS myD3dParams;   //!< parameters for created Direct3D device
35
     D3DDISPLAYMODE        myCurrMode;    //!< temporary variable
36
     UINT                  myRefreshRate;
37
-    bool                  myIsD3dEx;
38
     bool                  myWithAqbs;    //!< indicates that device was created with AQBS flags
39
 
40
 };
41
sview-16_06.tar.gz/StOutPageFlip/StDXNVSurface.cpp -> sview-17_04.tar.gz/StOutPageFlip/StDXNVSurface.cpp Changed
38
 
1
@@ -61,14 +61,11 @@
2
     // those sizes only used for mono (stereo driver off / windowed;
3
     // otherwise NVIDIA driver will ignore them and will use header in surface itself)
4
     // we should used downsized values to prevent render fail
5
-    if(StSys::isVistaPlus()) {
6
-        // only one view shown if we set width/2 here as for WinXP way
7
-        mySrcRect.left = 0; mySrcRect.right = (LONG )theSizeX * 2;
8
-    } else {
9
-        // picture showed with wrong ratio (width/4) in other (like Vista+) way
10
-        mySrcRect.left = 0; mySrcRect.right = (LONG )theSizeX;
11
-    }
12
-    mySrcRect.top = 0; mySrcRect.bottom = (LONG )theSizeY;
13
+
14
+    // only one view shown if we set width/2 here as for WinXP way
15
+    //mySrcRect.left = 0; mySrcRect.right = (LONG )theSizeX; // WinXP
16
+    mySrcRect.left = 0; mySrcRect.right  = (LONG )theSizeX * 2;
17
+    mySrcRect.top  = 0; mySrcRect.bottom = (LONG )theSizeY;
18
 }
19
 
20
 StDXNVSurface::~StDXNVSurface() {
21
@@ -111,14 +108,14 @@
22
     if(theHasWglDx) {
23
         if(theD3d.getDevice()->CreateTexture((UINT )mySizeX, (UINT )mySizeY, 0, 0,
24
                                              aFormat, D3DPOOL_DEFAULT,
25
-                                             &myTextureL, theD3d.isD3dEx() ? &myTextureLShare : NULL) != D3D_OK
26
+                                             &myTextureL, &myTextureLShare) != D3D_OK
27
         || myTextureL->GetSurfaceLevel(0, &mySurfaceL) != D3D_OK) {
28
             release();
29
             return false;
30
         }
31
         if(theD3d.getDevice()->CreateTexture((UINT )mySizeX, (UINT )mySizeY, 0, 0,
32
                                              aFormat, D3DPOOL_DEFAULT,
33
-                                             &myTextureR, theD3d.isD3dEx() ? &myTextureRShare : NULL) != D3D_OK
34
+                                             &myTextureR, &myTextureRShare) != D3D_OK
35
         || myTextureR->GetSurfaceLevel(0, &mySurfaceR) != D3D_OK) {
36
             release();
37
             return false;
38
sview-16_06.tar.gz/StOutPageFlip/StOutPageFlip.cpp -> sview-17_04.tar.gz/StOutPageFlip/StOutPageFlip.cpp Changed
199
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StOutPageFlip, class providing stereoscopic output for Shutter Glasses displays using StCore toolkit.
4
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -17,11 +17,13 @@
10
 #include <StGL/StGLEnums.h>
11
 #include <StGL/StGLContext.h>
12
 #include <StGL/StGLArbFbo.h>
13
+#include <StGLMesh/StGLTextureQuad.h>
14
 #include <StGLCore/StGLCore20.h>
15
 #include <StGLStereo/StGLStereoFrameBuffer.h>
16
 #include <StCore/StSearchMonitors.h>
17
 #include <StSettings/StSettings.h>
18
 #include <StSettings/StTranslations.h>
19
+#include <StThreads/StCondition.h>
20
 #include <StAV/StAVImage.h>
21
 #include <StSys/StSys.h>
22
 #include <stAssert.h>
23
@@ -407,10 +409,34 @@
24
     theList.add(params.ToShowExtra);
25
 }
26
 
27
+namespace {
28
+#if !defined(__APPLE__)
29
+    static StCondition   THE_QB_INIT_EVENT(true);
30
+    static volatile bool IS_QB_SUPPORTED = false;
31
+    static StHandle<StThread> THE_QB_THREAD;
32
+
33
+    SV_THREAD_FUNCTION testQBThreadFunction(void* ) {
34
+        IS_QB_SUPPORTED = StQuadBufferCheck::testQuadBufferSupport();
35
+    #ifdef _WIN32
36
+        StDXInfo anInfo;
37
+        StDXManager::getInfo(anInfo, true);
38
+    #endif
39
+        THE_QB_INIT_EVENT.set();
40
+        return SV_THREAD_RETURN 0;
41
+    }
42
+#endif
43
+}
44
+
45
+
46
 void StOutPageFlip::initGlobalsAsync() {
47
-    StQuadBufferCheck::initAsync();
48
-#ifdef _WIN32
49
-    StDXManager::initInfoAsync();
50
+#if !defined(__APPLE__)
51
+    if(!THE_QB_INIT_EVENT.check()) {
52
+        return; // already called
53
+    }
54
+
55
+    // start and detach thread
56
+    THE_QB_INIT_EVENT.reset();
57
+    THE_QB_THREAD = new StThread(testQBThreadFunction, NULL);
58
 #endif
59
 }
60
 
61
@@ -458,7 +484,7 @@
62
     StString& aDescr     = myLangMap.changeValueId(STTR_PLUGIN_DESCRIPTION,
63
         "(C) {0} Kirill Gavrilov <{1}>\nOfficial site: {2}\n\nThis library is distributed under LGPL3.0");
64
     myAbout = aTitle + '\n' + aVerString + " " + StVersionInfo::getSDKVersionString() + "\n \n"
65
-            + aDescr.format("2007-2016", "kirill@sview.ru", "www.sview.ru");
66
+            + aDescr.format("2007-2017", "kirill@sview.ru", "www.sview.ru");
67
 }
68
 
69
 StOutPageFlip::StOutPageFlip(const StHandle<StResourceManager>& theResMgr,
70
@@ -468,9 +494,6 @@
71
   myLangMap(theResMgr, ST_OUT_PLUGIN_NAME),
72
   myDevice(DEVICE_AUTO),
73
   myToDrawStereo(false),
74
-#ifdef _WIN32
75
-  myIsVistaPlus(StSys::isVistaPlus()),
76
-#endif
77
   myToResetDevice(false) {
78
     StWindow::signals.onAnotherMonitor = stSlot(this, &StOutPageFlip::doNewMonitor);
79
     const StSearchMonitors& aMonitors = StWindow::getMonitors();
80
@@ -484,14 +507,19 @@
81
     if(aMon.getFreqMax() >= 110) {
82
         aSupportLevelShutters = ST_DEVICE_SUPPORT_HIGHT;
83
     }
84
-#ifndef __APPLE__
85
-    // actually almost always available on mac but... is it useful?
86
-    hasQuadBufferGl = StQuadBufferCheck::isSupported();
87
-#endif
88
 
89
-#ifdef _WIN32
90
-    hasQuadBufferD3D = StDXManager::getInfo(myDxInfo) // && !hasQuadBufferGl
91
-                    && (myDxInfo.hasNvStereoSupport || myDxInfo.hasAqbsSupport);
92
+#if !defined(__APPLE__)
93
+    // actually almost always available on mac but... is it useful?
94
+    if(THE_QB_INIT_EVENT.wait(5000)) {
95
+        THE_QB_THREAD.nullify();
96
+        hasQuadBufferGl = IS_QB_SUPPORTED;
97
+    #if defined(_WIN32)
98
+        hasQuadBufferD3D = StDXManager::getInfo(myDxInfo) // && !hasQuadBufferGl
99
+                        && (myDxInfo.hasNvStereoSupport || myDxInfo.hasAqbsSupport);
100
+    #endif
101
+    } else {
102
+        stError("OpenGL driver was not responded in a reasonable time");
103
+    }
104
 #endif
105
     if(hasQuadBufferGl || hasQuadBufferD3D) {
106
         aSupportLevelShutters = ST_DEVICE_SUPPORT_FULL;
107
@@ -870,7 +898,7 @@
108
         aDataSize = aWarnRes->getSize();
109
     }
110
     if(anImage.load(!aWarnRes.isNull() ? aWarnRes->getPath() : StString(), StImageFile::ST_TYPE_PNG, aData, aDataSize)) {
111
-        myWarning = new StGLTexture(GL_RGBA8);
112
+        myWarning = new StGLTextureQuad();
113
         if(!myWarning->init(*myContext, anImage.getPlane())) {
114
             ST_ERROR_LOG(ST_OUT_PLUGIN_NAME + " Plugin, Texture can not be initialized!");
115
             myWarning->release(*myContext);
116
@@ -976,55 +1004,11 @@
117
 #endif
118
 }
119
 
120
-void StOutPageFlip::stglDrawWarning() {
121
-    if(myWarning.isNull()) {
122
-        return;
123
-    }
124
-
125
-#if !defined(GL_ES_VERSION_2_0)
126
-    myContext->core20fwd->glDisable(GL_DEPTH_TEST);
127
-    myContext->core20fwd->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
128
-    myContext->core20fwd->glEnable(GL_BLEND);
129
-    myContext->core11->glEnable(GL_TEXTURE_2D);
130
-
131
-    myWarning->bind(*myContext);
132
-
133
-    const StGLBoxPx aVPort = StWindow::stglViewport(ST_WIN_MASTER);
134
-    const int aWinSizeX = aVPort.width();
135
-    const int aWinSizeY = aVPort.height();
136
-    const GLfloat aWidth  = (aWinSizeX > 0) ?        GLfloat(myWarning->getSizeX()) / GLfloat(aWinSizeX) : 1.0f;
137
-    const GLfloat aBottom = (aWinSizeY > 0) ? 100.0f / GLfloat(aWinSizeY) : 0.0f;
138
-    const GLfloat aHeight = (aWinSizeY > 0) ? 2.0f * GLfloat(myWarning->getSizeY()) / GLfloat(aWinSizeY) : 1.0f;
139
-
140
-    const GLfloat aVerts[] = {
141
-         aWidth, -1.0f + aBottom + aHeight,
142
-         aWidth, -1.0f + aBottom,
143
-        -aWidth, -1.0f + aBottom + aHeight,
144
-        -aWidth, -1.0f + aBottom,
145
-    };
146
-
147
-    const GLfloat aTCrds[] = {
148
-        1.0f, 0.0f, // top-right
149
-        1.0f, 1.0f, // bottom-right
150
-        0.0f, 0.0f, // top-left
151
-        0.0f, 1.0f  // bottom-left
152
-    };
153
-
154
-    myContext->core11->glLoadIdentity();
155
-
156
-    myContext->core11->glEnableClientState(GL_VERTEX_ARRAY);
157
-    myContext->core11->glVertexPointer(2, GL_FLOAT, 0, aVerts);
158
-    myContext->core11->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
159
-    myContext->core11->glTexCoordPointer(2, GL_FLOAT, 0, aTCrds);
160
-
161
-    myContext->core11fwd->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
162
-
163
-    myContext->core11->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
164
-    myContext->core11->glDisableClientState(GL_VERTEX_ARRAY);
165
-
166
-    myWarning->unbind(*myContext);
167
-    myContext->core11->glDisable(GL_TEXTURE_2D);
168
-    myContext->core20fwd->glDisable(GL_BLEND);
169
+bool StOutPageFlip::isStereoFullscreenOnly() const {
170
+#ifdef _WIN32
171
+    return params.QuadBuffer->getValue() == QUADBUFFER_HARD_D3D_ANY;
172
+#else
173
+    return false;
174
 #endif
175
 }
176
 
177
@@ -1106,7 +1090,9 @@
178
             #endif
179
                 StWindow::signals.onRedraw(ST_DRAW_RIGHT);
180
                 StWindow::signals.onRedraw(ST_DRAW_LEFT);
181
-                stglDrawWarning();
182
+                if(!myWarning.isNull()) {
183
+                    myWarning->stglDraw(*myContext);
184
+                }
185
             } else {
186
             #if !defined(GL_ES_VERSION_2_0)
187
                 myContext->core20fwd->glDrawBuffer(GL_BACK_LEFT);
188
@@ -1229,7 +1215,9 @@
189
                 StWindow::signals.onRedraw(ST_DRAW_RIGHT); // reverse order to avoid non-smooth mono->stereo transition
190
                 StWindow::signals.onRedraw(ST_DRAW_LEFT);
191
 
192
-                stglDrawWarning();
193
+                if(!myWarning.isNull()) {
194
+                    myWarning->stglDraw(*myContext);
195
+                }
196
 
197
                 myFPSControl.sleepToTarget();
198
                 StWindow::stglSwap(ST_WIN_MASTER);
199
sview-16_06.tar.gz/StOutPageFlip/StOutPageFlip.h -> sview-17_04.tar.gz/StOutPageFlip/StOutPageFlip.h Changed
54
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StOutPageFlip, class providing stereoscopic output for Shutter Glasses displays using StCore toolkit.
4
- * Copyright © 2007-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -24,6 +24,7 @@
10
 class StWindow;
11
 class StVuzixSDK;
12
 class StGLFrameBuffer;
13
+class StGLTextureQuad;
14
 class StDXNVWindow;
15
 
16
 /**
17
@@ -130,6 +131,11 @@
18
      */
19
     ST_LOCAL virtual void doChangeLanguage() ST_ATTR_OVERRIDE;
20
 
21
+    /**
22
+     * Return true if 3D output requires fullscreen mode.
23
+     */
24
+    ST_CPPEXPORT virtual bool isStereoFullscreenOnly() const ST_ATTR_OVERRIDE;
25
+
26
         protected:
27
 
28
     ST_LOCAL void setupDevice();
29
@@ -175,7 +181,6 @@
30
      */
31
     ST_LOCAL void doSwitchVSync(const int32_t theValue);
32
 
33
-    ST_LOCAL         void stglDrawWarning();
34
     ST_LOCAL virtual void stglDrawExtra(unsigned int theView, int theMode);
35
 
36
         protected:
37
@@ -210,15 +215,12 @@
38
     StString              myAbout;      //!< about string
39
     StHandle<StGLContext> myContext;
40
     StHandle<StVuzixSDK>  myVuzixSDK;   //!< Vuzix HMD control
41
-    StHandle<StGLTexture> myWarning;
42
+    StHandle<StGLTextureQuad> myWarning;
43
     StTranslations        myLangMap;
44
     DeviceEnum            myDevice;
45
     StDXInfo              myDxInfo;
46
     StFPSControl          myFPSControl;
47
     bool                  myToDrawStereo;
48
-#ifdef _WIN32
49
-    bool                  myIsVistaPlus;
50
-#endif
51
     bool                  myToResetDevice;
52
 
53
     class StGLDXFrameBuffer;
54
sview-16_06.tar.gz/StOutPageFlip/StOutPageFlip.rc -> sview-17_04.tar.gz/StOutPageFlip/StOutPageFlip.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "PageFlip Renderer library\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2007-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2007-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StOutPageFlip\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StOutPageFlip/StOutPageFlipExt.cpp -> sview-17_04.tar.gz/StOutPageFlip/StOutPageFlipExt.cpp Changed
42
 
1
@@ -121,14 +121,8 @@
2
 
3
     // request slave
4
     if(params.ControlCode->getValue() != DEVICE_CONTROL_NONE) {
5
-#ifdef _WIN32
6
-    if(myIsVistaPlus) {
7
-#endif
8
         StWindow::setAttribute(StWinAttr_SlaveCfg, StWinSlave_slaveHLineTop);
9
         StWindow::hide(ST_WIN_SLAVE);
10
-#ifdef _WIN32
11
-    }
12
-#endif
13
     }
14
     if(!StOutPageFlip::create()) {
15
         return false;
16
@@ -160,11 +154,7 @@
17
             return;
18
         }
19
 
20
-        if(!StWindow::isFullScreen()
21
-    #ifdef _WIN32
22
-        && myIsVistaPlus
23
-    #endif
24
-        ) {
25
+        if(!StWindow::isFullScreen()) {
26
             const StSearchMonitors& aMonitors = StWindow::getMonitors();
27
             if(myMonitor.isNull()) {
28
                 myMonitor = new StMonitor(aMonitors[aRect.center()]);
29
@@ -195,11 +185,7 @@
30
         return;
31
     }
32
 
33
-    const bool toDrawWindowed = !StWindow::isFullScreen()
34
-#ifdef _WIN32
35
-        && myIsVistaPlus
36
-#endif
37
-    ;
38
+    const bool toDrawWindowed = !StWindow::isFullScreen();
39
     if(!toDrawWindowed) {
40
         StWindow::hide(ST_WIN_SLAVE);
41
     }
42
sview-16_06.tar.gz/StOutPageFlip/StQuadBufferCheck.cpp -> sview-17_04.tar.gz/StOutPageFlip/StQuadBufferCheck.cpp Changed
58
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StOutPageFlip, class providing stereoscopic output for Shutter Glasses displays using StCore toolkit.
4
- * Copyright © 2009-2013 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2016 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -10,7 +10,6 @@
10
 #include "StQuadBufferCheck.h"
11
 
12
 #include <StStrings/StLogger.h>
13
-#include <StThreads/StCondition.h>
14
 #include <StThreads/StThread.h>
15
 
16
 #ifdef _WIN32
17
@@ -55,7 +54,7 @@
18
     HWND aWindow = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE | WS_EX_NOACTIVATE,
19
                                    QUAD_TEST_CLASS.toCString(),
20
                                    L"GL Quad Buffer test",
21
-                                   WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
22
+                                   WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_DISABLED,
23
                                    32, 32, 32, 32,
24
                                    NULL, NULL, anAppInst, NULL);
25
     if(aWindow == NULL) {
26
@@ -116,31 +115,3 @@
27
 }
28
 
29
 #endif // !__APPLE__
30
-
31
-namespace {
32
-
33
-    static StCondition   THE_QB_INIT_EVENT(true);
34
-    static volatile bool IS_QB_SUPPORTED = false;
35
-
36
-    SV_THREAD_FUNCTION testQBThreadFunction(void* ) {
37
-        IS_QB_SUPPORTED = StQuadBufferCheck::testQuadBufferSupport();
38
-        THE_QB_INIT_EVENT.set();
39
-        return SV_THREAD_RETURN 0;
40
-    }
41
-
42
-};
43
-
44
-bool StQuadBufferCheck::isSupported() {
45
-    THE_QB_INIT_EVENT.wait();
46
-    return IS_QB_SUPPORTED;
47
-}
48
-
49
-void StQuadBufferCheck::initAsync() {
50
-    if(!THE_QB_INIT_EVENT.check()) {
51
-        return; // already called
52
-    }
53
-
54
-    // start and detach thread
55
-    THE_QB_INIT_EVENT.reset();
56
-    StThread aTestThread(testQBThreadFunction, NULL);
57
-}
58
sview-16_06.tar.gz/StOutPageFlip/StQuadBufferCheck.h -> sview-17_04.tar.gz/StOutPageFlip/StQuadBufferCheck.h Changed
27
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StOutPageFlip, class providing stereoscopic output for Shutter Glasses displays using StCore toolkit.
4
- * Copyright © 2009-2013 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2016 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -17,17 +17,6 @@
10
         public:
11
 
12
     /**
13
-     * Global flag should be initialized before!
14
-     * @return true if OpenGL Quad Buffer is supported.
15
-     */
16
-    ST_LOCAL static bool isSupported();
17
-
18
-    /**
19
-     * Initialize global flag.
20
-     */
21
-    ST_LOCAL static void initAsync();
22
-
23
-    /**
24
      * Test QB support within thin thread.
25
      */
26
     ST_LOCAL static bool testQuadBufferSupport();
27
sview-16_06.tar.gz/StShared/StAVImage.cpp -> sview-17_04.tar.gz/StShared/StAVImage.cpp Changed
48
 
1
@@ -129,6 +129,11 @@
2
                           StImage& theImageTo,   AVPixelFormat theFormatTo) {
3
     ST_DEBUG_LOG("StAVImage, convert from " + stAV::PIX_FMT::getString(theFormatFrom) + " " + theImageFrom.getSizeX() + "x" + theImageFrom.getSizeY()
4
                + " to " + stAV::PIX_FMT::getString(theFormatTo) + " " + theImageTo.getSizeX() + "x" + theImageTo.getSizeY());
5
+    if(theFormatFrom == stAV::PIX_FMT::NONE
6
+    || theFormatTo   == stAV::PIX_FMT::NONE) {
7
+        return false;
8
+    }
9
+
10
     SwsContext* aCtxToRgb = sws_getContext((int )theImageFrom.getSizeX(), (int )theImageFrom.getSizeY(), theFormatFrom, // source
11
                                            (int )theImageTo.getSizeX(),   (int )theImageTo.getSizeY(),   theFormatTo,   // destination
12
                                            SWS_BICUBIC, NULL, NULL, NULL);
13
@@ -197,13 +202,6 @@
14
     }
15
 }
16
 
17
-bool StAVImage::load(const StString& theFilePath,
18
-                     ImageType       theImageType,
19
-                     uint8_t*        theDataPtr,
20
-                     int             theDataSize) {
21
-    return loadExtra(theFilePath, theImageType, theDataPtr, theDataSize, false);
22
-}
23
-
24
 bool StAVImage::loadExtra(const StString& theFilePath,
25
                           ImageType       theImageType,
26
                           uint8_t*        theDataPtr,
27
@@ -544,6 +542,11 @@
28
     }
29
 
30
     AVPixelFormat aPFormatAV = (AVPixelFormat )getAVPixelFormat(*this);
31
+    if(aPFormatAV == stAV::PIX_FMT::NONE) {
32
+        setState("Specific pixel format convertion is not supported");
33
+        return false;
34
+    }
35
+
36
     StImage anImage;
37
     switch(theImageType) {
38
         case ST_TYPE_PNG:
39
@@ -580,6 +583,8 @@
40
             myCodecCtx->pix_fmt = aPFormatAV;
41
             myCodecCtx->width   = (int )anImage.getSizeX();
42
             myCodecCtx->height  = (int )anImage.getSizeY();
43
+            myCodecCtx->time_base.num = 1;
44
+            myCodecCtx->time_base.den = 1;
45
             myCodecCtx->compression_level = 9; // 0..9
46
             break;
47
         }
48
sview-16_06.tar.gz/StShared/StDevILImage.cpp -> sview-17_04.tar.gz/StShared/StDevILImage.cpp Changed
17
 
1
@@ -309,8 +309,13 @@
2
     }
3
 }
4
 
5
-bool StDevILImage::load(const StString& theFilePath, ImageType theImageType,
6
-                        uint8_t* theDataPtr, int theDataSize) {
7
+bool StDevILImage::loadExtra(const StString& theFilePath,
8
+                             ImageType       theImageType,
9
+                             uint8_t*        theDataPtr,
10
+                             int             theDataSize,
11
+                             bool            theIsOnlyRGB) {
12
+    (void )theIsOnlyRGB;
13
+
14
     // DevIL is not thread-safe! Lock for whole function
15
     StMutexAuto stTempLock(stDevILMutex);
16
     if(!StDevILImage::init()) {
17
sview-16_06.tar.gz/StShared/StFreeImage.cpp -> sview-17_04.tar.gz/StShared/StFreeImage.cpp Changed
16
 
1
@@ -306,8 +306,12 @@
2
     }
3
 }
4
 
5
-bool StFreeImage::load(const StString& theFilePath, ImageType theImageType,
6
-                       uint8_t* theDataPtr, int theDataSize) {
7
+bool StFreeImage::loadExtra(const StString& theFilePath,
8
+                            ImageType       theImageType,
9
+                            uint8_t*        theDataPtr,
10
+                            int             theDataSize,
11
+                            bool            theIsOnlyRGB) {
12
+    (void )theIsOnlyRGB;
13
     if(!StFreeImage::init()) {
14
         setState("FreeImage library is not initialized");
15
         return false;
16
sview-16_06.tar.gz/StShared/StGLContext.cpp -> sview-17_04.tar.gz/StShared/StGLContext.cpp Changed
201
 
1
@@ -145,41 +145,39 @@
2
     //
3
 }
4
 
5
-#if !defined(GL_ES_VERSION_2_0)
6
 static void APIENTRY debugCallbackWrap(unsigned int theSource,
7
                                        unsigned int theType,
8
                                        unsigned int theId,
9
                                        unsigned int theSeverity,
10
-                                       int                 theLength,
11
-                                       const char*   theMessage,
12
-                                       const void*   theUserParam) {
13
+                                       int          theLength,
14
+                                       const char*  theMessage,
15
+                                       const void*  theUserParam) {
16
     ((StGLContext* )theUserParam)->stglDebugCallback(theSource, theType, theId, theSeverity, theLength, theMessage);
17
 }
18
-#endif
19
 
20
 static const StCString THE_DBGMSG_SOURCE_UNKNOWN = stCString("UNKNOWN");
21
 static const StCString THE_DBGMSG_SOURCES[] = {
22
-    stCString("OpenGL"),          // GL_DEBUG_SOURCE_API_ARB
23
-    stCString("Window System"),   // GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB
24
-    stCString("Shader Compiler"), // GL_DEBUG_SOURCE_SHADER_COMPILER_ARB
25
-    stCString("Third Party"),     // GL_DEBUG_SOURCE_THIRD_PARTY_ARB
26
-    stCString("Application"),     // GL_DEBUG_SOURCE_APPLICATION_ARB
27
-    stCString("Other"),           // GL_DEBUG_SOURCE_OTHER_ARB
28
+    stCString("OpenGL"),          // GL_DEBUG_SOURCE_API
29
+    stCString("Window System"),   // GL_DEBUG_SOURCE_WINDOW_SYSTEM
30
+    stCString("Shader Compiler"), // GL_DEBUG_SOURCE_SHADER_COMPILER
31
+    stCString("Third Party"),     // GL_DEBUG_SOURCE_THIRD_PARTY
32
+    stCString("Application"),     // GL_DEBUG_SOURCE_APPLICATION
33
+    stCString("Other"),           // GL_DEBUG_SOURCE_OTHER
34
 };
35
 
36
 static const StCString THE_DBGMSG_TYPE_UNKNOWN = stCString("UNKNOWN");
37
 static const StCString THE_DBGMSG_TYPES[] = {
38
-    stCString("Error"),              // GL_DEBUG_TYPE_ERROR_ARB
39
-    stCString("Deprecated"),         // GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB
40
-    stCString("Undefined behavior"), // GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB
41
-    stCString("Portability"),        // GL_DEBUG_TYPE_PORTABILITY_ARB
42
-    stCString("Performance"),        // GL_DEBUG_TYPE_PERFORMANCE_ARB
43
-    stCString("Other"),              // GL_DEBUG_TYPE_OTHER_ARB
44
+    stCString("Error"),              // GL_DEBUG_TYPE_ERROR
45
+    stCString("Deprecated"),         // GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR
46
+    stCString("Undefined behavior"), // GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR
47
+    stCString("Portability"),        // GL_DEBUG_TYPE_PORTABILITY
48
+    stCString("Performance"),        // GL_DEBUG_TYPE_PERFORMANCE
49
+    stCString("Other"),              // GL_DEBUG_TYPE_OTHER
50
 };
51
 
52
-static const StCString THE_DBGMSG_SEV_HIGH   = stCString("High");   // GL_DEBUG_SEVERITY_HIGH_ARB
53
-static const StCString THE_DBGMSG_SEV_MEDIUM = stCString("Medium"); // GL_DEBUG_SEVERITY_MEDIUM_ARB
54
-static const StCString THE_DBGMSG_SEV_LOW    = stCString("Low");    // GL_DEBUG_SEVERITY_LOW_ARB
55
+static const StCString THE_DBGMSG_SEV_HIGH   = stCString("High");   // GL_DEBUG_SEVERITY_HIGH
56
+static const StCString THE_DBGMSG_SEV_MEDIUM = stCString("Medium"); // GL_DEBUG_SEVERITY_MEDIUM
57
+static const StCString THE_DBGMSG_SEV_LOW    = stCString("Low");    // GL_DEBUG_SEVERITY_LOW
58
 
59
 void StGLContext::stglDebugCallback(unsigned int theSource,
60
                                     unsigned int theType,
61
@@ -187,46 +185,36 @@
62
                                     unsigned int theSeverity,
63
                                     int          /*theLength*/,
64
                                     const char*  theMessage) {
65
-  if(myGlVendor == GlVendor_NVIDIA) {
66
-      // filter too verbose messages
67
-      if(theId == 131185) {
68
-          return;
69
-      }
70
-  }
71
-
72
-#ifdef GL_DEBUG_SOURCE_API_ARB
73
-    const StCString& aSrc = (theSource >= GL_DEBUG_SOURCE_API_ARB
74
-                          && theSource <= GL_DEBUG_SOURCE_OTHER_ARB)
75
-                          ? THE_DBGMSG_SOURCES[theSource - GL_DEBUG_SOURCE_API_ARB]
76
+    if(myGlVendor == GlVendor_NVIDIA) {
77
+        // filter too verbose messages
78
+        if(theId == 131185) {
79
+            return;
80
+        }
81
+    }
82
+
83
+    const StCString& aSrc = (theSource >= GL_DEBUG_SOURCE_API
84
+                          && theSource <= GL_DEBUG_SOURCE_OTHER)
85
+                          ? THE_DBGMSG_SOURCES[theSource - GL_DEBUG_SOURCE_API]
86
                           : THE_DBGMSG_SOURCE_UNKNOWN;
87
-    const StCString& aType = (theType >= GL_DEBUG_TYPE_ERROR_ARB
88
-                           && theType <= GL_DEBUG_TYPE_OTHER_ARB)
89
-                           ? THE_DBGMSG_TYPES[theType - GL_DEBUG_TYPE_ERROR_ARB]
90
+    const StCString& aType = (theType >= GL_DEBUG_TYPE_ERROR
91
+                           && theType <= GL_DEBUG_TYPE_OTHER)
92
+                           ? THE_DBGMSG_TYPES[theType - GL_DEBUG_TYPE_ERROR]
93
                            : THE_DBGMSG_TYPE_UNKNOWN;
94
-    const StCString& aSev = theSeverity == GL_DEBUG_SEVERITY_HIGH_ARB
95
+    const StCString& aSev = theSeverity == GL_DEBUG_SEVERITY_HIGH
96
                           ? THE_DBGMSG_SEV_HIGH
97
-                          : (theSeverity == GL_DEBUG_SEVERITY_MEDIUM_ARB
98
+                          : (theSeverity == GL_DEBUG_SEVERITY_MEDIUM
99
                            ? THE_DBGMSG_SEV_MEDIUM
100
                            : THE_DBGMSG_SEV_LOW);
101
     StString aMsg = StString("Source:")   + aSrc
102
-                + StString(" | Type:")     + aType
103
-                + StString(" | ID:")       + theId
104
-                + StString(" | Severity:") + aSev
105
-                + StString(" | Message:\n  ") + theMessage + "\n";
106
+               + StString(" | Type:")     + aType
107
+               + StString(" | ID:")       + theId
108
+               + StString(" | Severity:") + aSev
109
+               + StString(" | Message:\n  ") + theMessage + "\n";
110
     StLogger::GetDefault().write(aMsg,
111
-        theType == GL_DEBUG_TYPE_ERROR_ARB ? StLogger::ST_ERROR : StLogger::ST_WARNING);
112
+        theType == GL_DEBUG_TYPE_ERROR ? StLogger::ST_ERROR : StLogger::ST_WARNING);
113
     //if(!myMsgQueue.isNull()) {
114
-    //    theType == GL_DEBUG_TYPE_ERROR_ARB ? myMsgQueue->pushError(aMsg) : myMsgQueue->pushInfo (aMsg);
115
+    //    theType == GL_DEBUG_TYPE_ERROR ? myMsgQueue->pushError(aMsg) : myMsgQueue->pushInfo (aMsg);
116
     //}
117
-#else
118
-    // need GL_KHR_debug
119
-    StString aMsg = StString("Source:")         + theSource
120
-                  + StString(" | Type:")        + theType
121
-                  + StString(" | ID:")          + theId
122
-                  + StString(" | Severity:")    + theSeverity
123
-                  + StString(" | Message:\n  ") + theMessage + "\n";
124
-    StLogger::GetDefault().write(aMsg, StLogger::ST_WARNING);
125
-#endif
126
 }
127
 
128
 void StGLContext::setMessagesQueue(const StHandle<StMsgQueue>& theQueue) {
129
@@ -314,9 +302,17 @@
130
 }
131
 
132
 void StGLContext::stglResetErrors() {
133
-    GLenum anErr = glGetError();
134
-    for(int aLimit = 1000; (anErr != GL_NO_ERROR) && (aLimit > 0); --aLimit, anErr = glGetError()) {
135
+    GLenum aPrevErr = GL_NO_ERROR;
136
+    for(GLenum anErr = glGetError(); anErr != GL_NO_ERROR; anErr = glGetError()) {
137
+        if(anErr == aPrevErr) {
138
+            if(aPrevErr != GL_NO_ERROR) {
139
+                ST_DEBUG_LOG("GL error cannot be released - broken GL context?");
140
+            }
141
+            return;
142
+        }
143
+
144
         ST_DEBUG_LOG("Unhandled GL error (" + stglErrorToString(anErr) + ")");
145
+        aPrevErr = anErr;
146
     }
147
 }
148
 
149
@@ -522,6 +518,20 @@
150
         theMap.add(StDictEntry("Free GPU memory",
151
                    StString() + (aDedicatedFree / 1024)  + " MiB (from " + (aDedicated / 1024) + " MiB)"));
152
     }
153
+#if defined(_WIN32)
154
+    else if(myFuncs->wglGetGPUInfoAMD != NULL
155
+         && myFuncs->wglGetContextGPUIDAMD != NULL) {
156
+        GLuint aVMemMiB = 0;
157
+        HGLRC aGlRc = wglGetCurrentContext();
158
+        if(aGlRc != NULL) {
159
+            UINT anAmdId = myFuncs->wglGetContextGPUIDAMD(aGlRc);
160
+            if(anAmdId != 0
161
+            && myFuncs->wglGetGPUInfoAMD(anAmdId, WGL_GPU_RAM_AMD, GL_UNSIGNED_INT, sizeof(aVMemMiB), &aVMemMiB) > 0) {
162
+                theMap.add(StDictEntry("GPU memory", StString() + aVMemMiB  + " MiB"));
163
+            }
164
+        }
165
+    }
166
+#endif
167
 #endif
168
 
169
 #if !defined(GL_ES_VERSION_2_0) && !defined(__APPLE__) && !defined(_WIN32)
170
@@ -710,6 +720,11 @@
171
             STGL_READ_FUNC(wglDXLockObjectsNV);
172
             STGL_READ_FUNC(wglDXUnlockObjectsNV);
173
         }
174
+        if(stglCheckExtension(aWglExts, "WGL_AMD_gpu_association")) {
175
+            STGL_READ_FUNC(wglGetGPUIDsAMD);
176
+            STGL_READ_FUNC(wglGetGPUInfoAMD);
177
+            STGL_READ_FUNC(wglGetContextGPUIDAMD);
178
+        }
179
     }
180
 #elif defined(__APPLE__)
181
     //
182
@@ -759,6 +774,29 @@
183
         hasHighp = true;
184
     }
185
 
186
+#if defined(ST_DEBUG_GL)
187
+    // this extension is buggy on OpenGL ES - enable it only for debug builds
188
+    if(stglCheckExtension("GL_KHR_debug")) {
189
+        // According to GL_KHR_debug spec, all functions should have KHR suffix.
190
+        // However, some implementations can export these functions without suffix.
191
+        stglFindProc("glDebugMessageControlKHR",  myFuncs->glDebugMessageControl);
192
+        stglFindProc("glDebugMessageInsertKHR",   myFuncs->glDebugMessageInsert);
193
+        stglFindProc("glDebugMessageCallbackKHR", myFuncs->glDebugMessageCallback);
194
+        stglFindProc("glGetDebugMessageLogKHR",   myFuncs->glGetDebugMessageLog);
195
+        if(myFuncs->glDebugMessageCallback != NULL) {
196
+            // setup default callback
197
+            myFuncs->glDebugMessageCallback(debugCallbackWrap, this);
198
+            core11fwd->glEnable(GL_DEBUG_OUTPUT);
199
+            // note that some broken implementations (e.g. simulators) might generate error message on this call
200
+            core11fwd->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
201
sview-16_06.tar.gz/StShared/StGLProjCamera.cpp -> sview-17_04.tar.gz/StShared/StGLProjCamera.cpp Changed
17
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2010-2013 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2010-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * Distributed under the Boost Software License, Version 1.0.
7
  * See accompanying file license-boost.txt or copy at
8
@@ -84,7 +84,7 @@
9
     updateFrustum();
10
 }
11
 
12
-void StGLProjCamera::resize(const GLfloat theAspect) {
13
+void StGLProjCamera::resize(const float theAspect) {
14
     myAspect = theAspect;
15
     updateFrustum();
16
 }
17
sview-16_06.tar.gz/StShared/StGLTextFormatter.cpp -> sview-17_04.tar.gz/StShared/StGLTextFormatter.cpp Changed
159
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2012-2014 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2012-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * Distributed under the Boost Software License, Version 1.0.
7
  * See accompanying file license-boost.txt or copy at
8
@@ -13,7 +13,7 @@
9
 /**
10
  * Auxiliary function to translate rectangles by the vector.
11
  */
12
-inline void move(StArray<StGLTile>& theRects,
13
+inline void move(std::vector<StGLTile>& theRects,
14
                  const StGLVec2&    theMoveVec,
15
                  size_t             theCharFrom,
16
                  const size_t       theCharTo) {
17
@@ -26,7 +26,7 @@
18
 /**
19
  * Auxiliary function to translate rectangles in horizontal direction.
20
  */
21
-inline void moveX(StArray<StGLTile>& theRects,
22
+inline void moveX(std::vector<StGLTile>& theRects,
23
                   const GLfloat      theMoveVec,
24
                   size_t             theCharFrom,
25
                   const size_t       theCharTo) {
26
@@ -39,7 +39,7 @@
27
 /**
28
  * Auxiliary function to translate rectangles in vertical direction.
29
  */
30
-inline void moveY(StArray<StGLTile>& theRects,
31
+inline void moveY(std::vector<StGLTile>& theRects,
32
                   const GLfloat      theMoveVec,
33
                   size_t             theCharFrom,
34
                   const size_t       theCharTo) {
35
@@ -97,13 +97,42 @@
36
     return theVec;
37
 }
38
 
39
-void StGLTextFormatter::getResult(StArrayList<GLuint>&                               theTextures,
40
-                                  StArrayList< StHandle <StArrayList <StGLVec2> > >& theVertsPerTexture,
41
-                                  StArrayList< StHandle <StArrayList <StGLVec2> > >& theTCrdsPerTexture) const {
42
+void StGLTextFormatter::getResult(std::vector<GLuint>&                               theTextures,
43
+                                  std::vector< StHandle <std::vector <StGLVec2> > >& theVertsPerTexture,
44
+                                  std::vector< StHandle <std::vector <StGLVec2> > >& theTCrdsPerTexture) const {
45
     StGLVec2 aVec(0.0f, 0.0f);
46
     theTextures.clear();
47
     theVertsPerTexture.clear();
48
     theTCrdsPerTexture.clear();
49
+
50
+    std::vector<size_t> aNbRectPerTexture;
51
+    for(size_t aRectIter = 0; aRectIter < myRectsNb; ++aRectIter) {
52
+        const GLuint aTexture = myRects[aRectIter].texture;
53
+
54
+        size_t aListId = 0;
55
+        for(aListId = 0; aListId < theTextures.size(); ++aListId) {
56
+            if(theTextures[aListId] == aTexture) {
57
+                break;
58
+            }
59
+        }
60
+        if(aListId >= theTextures.size()) {
61
+            theTextures.push_back(aTexture);
62
+            theVertsPerTexture.push_back(new std::vector<StGLVec2>());
63
+            theTCrdsPerTexture.push_back(new std::vector<StGLVec2>());
64
+            aNbRectPerTexture.push_back(0);
65
+        }
66
+
67
+        ++aNbRectPerTexture[aListId];
68
+    }
69
+
70
+    for(size_t aTexIter = 0; aTexIter < theTextures.size(); ++aTexIter) {
71
+        const size_t aNbTexTris = aNbRectPerTexture[aTexIter] * 6;
72
+        std::vector<StGLVec2>& aVerts = *theVertsPerTexture[aTexIter];
73
+        std::vector<StGLVec2>& aTCrds = *theTCrdsPerTexture[aTexIter];
74
+        aVerts.reserve(aNbTexTris);
75
+        aTCrds.reserve(aNbTexTris);
76
+    }
77
+
78
     for(size_t aRectIter = 0; aRectIter < myRectsNb; ++aRectIter) {
79
         const StGLRect& aRect    = myRects[aRectIter].px;
80
         const StGLRect& aRectUV  = myRects[aRectIter].uv;
81
@@ -115,39 +144,34 @@
82
                 break;
83
             }
84
         }
85
-        if(aListId >= theTextures.size()) {
86
-            theTextures.add(aTexture);
87
-            theVertsPerTexture.add(new StArrayList<StGLVec2>());
88
-            theTCrdsPerTexture.add(new StArrayList<StGLVec2>());
89
-        }
90
 
91
-        StArrayList<StGLVec2>& aVerts = *theVertsPerTexture.changeValue(aListId);
92
-        StArrayList<StGLVec2>& aTCrds = *theTCrdsPerTexture.changeValue(aListId);
93
+        std::vector<StGLVec2>& aVerts = *theVertsPerTexture[aListId];
94
+        std::vector<StGLVec2>& aTCrds = *theTCrdsPerTexture[aListId];
95
 
96
         // apply floor on position to avoid blurring issues
97
         // due to cross-pixel coordinates
98
-        aVerts.add(floor(aRect.getBottomLeft(aVec)));
99
-        aVerts.add(floor(aRect.getTopLeft(aVec)));
100
-        aVerts.add(floor(aRect.getTopRight(aVec)));
101
-        aTCrds.add(aRectUV.getBottomLeft(aVec));
102
-        aTCrds.add(aRectUV.getTopLeft(aVec));
103
-        aTCrds.add(aRectUV.getTopRight(aVec));
104
-
105
-        aVerts.add(floor(aRect.getBottomLeft(aVec)));
106
-        aVerts.add(floor(aRect.getTopRight(aVec)));
107
-        aVerts.add(floor(aRect.getBottomRight(aVec)));
108
-        aTCrds.add(aRectUV.getBottomLeft(aVec));
109
-        aTCrds.add(aRectUV.getTopRight(aVec));
110
-        aTCrds.add(aRectUV.getBottomRight(aVec));
111
+        aVerts.push_back(floor(aRect.getBottomLeft(aVec)));
112
+        aVerts.push_back(floor(aRect.getTopLeft(aVec)));
113
+        aVerts.push_back(floor(aRect.getTopRight(aVec)));
114
+        aTCrds.push_back(aRectUV.getBottomLeft(aVec));
115
+        aTCrds.push_back(aRectUV.getTopLeft(aVec));
116
+        aTCrds.push_back(aRectUV.getTopRight(aVec));
117
+
118
+        aVerts.push_back(floor(aRect.getBottomLeft(aVec)));
119
+        aVerts.push_back(floor(aRect.getTopRight(aVec)));
120
+        aVerts.push_back(floor(aRect.getBottomRight(aVec)));
121
+        aTCrds.push_back(aRectUV.getBottomLeft(aVec));
122
+        aTCrds.push_back(aRectUV.getTopRight(aVec));
123
+        aTCrds.push_back(aRectUV.getBottomRight(aVec));
124
     }
125
 }
126
 
127
 void StGLTextFormatter::getResult(StGLContext&                                theCtx,
128
-                                  StArrayList<GLuint>&                        theTextures,
129
+                                  std::vector<GLuint>&                        theTextures,
130
                                   StArrayList< StHandle <StGLVertexBuffer> >& theVertsPerTexture,
131
                                   StArrayList< StHandle <StGLVertexBuffer> >& theTCrdsPerTexture) const {
132
-    StArrayList< StHandle <StArrayList <StGLVec2> > > aVertsPerTexture;
133
-    StArrayList< StHandle <StArrayList <StGLVec2> > > aTCrdsPerTexture;
134
+    std::vector< StHandle < std::vector<StGLVec2> > > aVertsPerTexture;
135
+    std::vector< StHandle < std::vector<StGLVec2> > > aTCrdsPerTexture;
136
     getResult(theTextures, aVertsPerTexture, aTCrdsPerTexture);
137
 
138
     if(theVertsPerTexture.size() != theTextures.size()) {
139
@@ -169,8 +193,8 @@
140
     }
141
 
142
     for(size_t aTextureIter = 0; aTextureIter < theTextures.size(); ++aTextureIter) {
143
-        const StArrayList<StGLVec2>& aVerts = *aVertsPerTexture[aTextureIter];
144
-        const StArrayList<StGLVec2>& aTCrds = *aTCrdsPerTexture[aTextureIter];
145
+        const std::vector<StGLVec2>& aVerts = *aVertsPerTexture[aTextureIter];
146
+        const std::vector<StGLVec2>& aTCrds = *aTCrdsPerTexture[aTextureIter];
147
         theVertsPerTexture[aTextureIter]->init(theCtx, aVerts);
148
         theTCrdsPerTexture[aTextureIter]->init(theCtx, aTCrds);
149
     }
150
@@ -222,7 +246,7 @@
151
         theFont.renderGlyph(theCtx,
152
                             aCharThis, aCharNext,
153
                             aTile, myPen);
154
-        myRects.add(aTile);
155
+        myRects.push_back(aTile);
156
 
157
         ++myRectsNb;
158
     }
159
sview-16_06.tar.gz/StShared/StGLTexture.cpp -> sview-17_04.tar.gz/StShared/StGLTexture.cpp Changed
85
 
1
@@ -16,9 +16,10 @@
2
 #include <StStrings/StLogger.h>
3
 #include <stAssert.h>
4
 
5
-bool StGLTexture::getInternalFormat(const StGLContext&  /*theCtx*/,
6
+bool StGLTexture::getInternalFormat(const StGLContext&  theCtx,
7
                                     const StImagePlane& theData,
8
                                     GLint&              theInternalFormat) {
9
+    (void )theCtx;
10
     // sized formats are not supported by OpenGL ES
11
     switch(theData.getFormat()) {
12
         case StImagePlane::ImgRGBAF:
13
@@ -52,12 +53,36 @@
14
             theInternalFormat = GL_RGBA16;
15
         #endif
16
             return true;
17
-        case StImagePlane::ImgRGB:
18
-        case StImagePlane::ImgBGR:
19
-        case StImagePlane::ImgRGB32:
20
+        case StImagePlane::ImgRGB: {
21
+            theInternalFormat = GL_RGB8;
22
+            return true;
23
+        }
24
+        case StImagePlane::ImgRGB32: {
25
+        #if defined(GL_ES_VERSION_2_0)
26
+            theInternalFormat = GL_RGBA8;
27
+        #else
28
+            theInternalFormat = GL_RGB8;
29
+        #endif
30
+            return true;
31
+        }
32
+        case StImagePlane::ImgBGR: {
33
+            theInternalFormat = GL_RGB8;
34
+        #if defined(GL_ES_VERSION_2_0)
35
+            return false;
36
+        #else
37
+            return true;
38
+        #endif
39
+        }
40
         case StImagePlane::ImgBGR32:
41
         #if defined(GL_ES_VERSION_2_0)
42
-            theInternalFormat = GL_RGB;
43
+            theInternalFormat = GL_RGB8;
44
+            if(!theCtx.extTexBGRA8) {
45
+                return false;
46
+            }
47
+
48
+            // GL_EXT_texture_format_BGRA8888 has been introduced for OpenGL ES 1.0
49
+            // and does not defined sized format supported by OpenGL ES 3.0+
50
+            theInternalFormat = GL_BGRA_EXT;
51
         #else
52
             theInternalFormat = GL_RGB8;
53
         #endif
54
@@ -287,6 +312,8 @@
55
         case GL_RGBA16:   return "GL_RGBA16";
56
         case GL_RGBA16F:  return "GL_RGBA16F"; // half-float
57
         case GL_RGBA32F:  return "GL_RGBA32F"; // float
58
+        //
59
+        case GL_BGRA_EXT:  return "GL_BGRA";
60
         // ALPHA variations (deprecated)
61
         case GL_ALPHA:     return "GL_ALPHA";
62
         case GL_ALPHA8:    return "GL_ALPHA8";
63
@@ -327,6 +354,8 @@
64
         case GL_RGBA16F:
65
         case GL_RGBA32F:
66
             return GL_RGBA;
67
+        case GL_BGRA_EXT:
68
+            return GL_BGRA_EXT;
69
         // ALPHA variations (deprecated)
70
         case GL_ALPHA:
71
         case GL_ALPHA8:
72
@@ -479,10 +508,10 @@
73
 
74
     GLint anInternalFormat = myTextFormat;
75
 #if defined(GL_ES_VERSION_2_0)
76
-    //if(!theCtx.isGlGreaterEqual(3, 0)) {
77
+    if(!theCtx.isGlGreaterEqual(3, 0)) {
78
         // sized formats are not supported here
79
         anInternalFormat = theDataFormat;
80
-    //}
81
+    }
82
 #endif
83
 
84
     if(myTarget == GL_TEXTURE_CUBE_MAP) {
85
sview-16_06.tar.gz/StShared/StJpegParser.cpp -> sview-17_04.tar.gz/StShared/StJpegParser.cpp Changed
14
 
1
@@ -163,9 +163,10 @@
2
 }
3
 
4
 bool StJpegParser::readFile(const StCString& theFilePath,
5
-                            const int        theOpenedFd) {
6
+                            const int        theOpenedFd,
7
+                            const size_t     theReadMax) {
8
     reset();
9
-    if(!StRawFile::readFile(theFilePath, theOpenedFd)) {
10
+    if(!StRawFile::readFile(theFilePath, theOpenedFd, theReadMax)) {
11
         return false;
12
     }
13
 
14
sview-16_06.tar.gz/StShared/StRawFile.cpp -> sview-17_04.tar.gz/StShared/StRawFile.cpp Changed
100
 
1
@@ -16,6 +16,14 @@
2
 #include <fstream>
3
 #include <limits>
4
 
5
+#if defined(_WIN32)
6
+    #define ftell64(a)     _ftelli64(a)
7
+    #define fseek64(a,b,c) _fseeki64(a,b,c)
8
+#else
9
+    #define ftell64(a)     ftello(a)
10
+    #define fseek64(a,b,c) fseeko(a,b,c)
11
+#endif
12
+
13
 #ifdef max
14
     #undef max
15
 #endif
16
@@ -123,7 +131,8 @@
17
 }
18
 
19
 bool StRawFile::readFile(const StCString& theFilePath,
20
-                         const int        theOpenedFd) {
21
+                         const int        theOpenedFd,
22
+                         const size_t     theReadMax) {
23
     freeBuffer();
24
 
25
     if(!openFile(StRawFile::READ, theFilePath, theOpenedFd)) {
26
@@ -134,8 +143,17 @@
27
         int64_t aFileLen = avio_size(myContextIO);
28
         if(aFileLen > 0) {
29
             // stream of known size - create a buffer and read the data
30
-            initBuffer(aFileLen <= int64_t(std::numeric_limits<ptrdiff_t>::max()) ? size_t(aFileLen) : 0);
31
-            if(myBuffSize != size_t(aFileLen)) {
32
+            size_t aReadLen = 0;
33
+            if(aFileLen <= int64_t(std::numeric_limits<ptrdiff_t>::max())) {
34
+                aReadLen = theReadMax != 0 ? (size_t )stMin(int64_t(theReadMax), aFileLen) : size_t(aFileLen);
35
+            } else if(theReadMax != 0) {
36
+                aReadLen = theReadMax;
37
+            } else {
38
+                return false;
39
+            }
40
+
41
+            initBuffer(aReadLen);
42
+            if(myBuffSize != aReadLen) {
43
                 return false;
44
             }
45
 
46
@@ -180,13 +198,18 @@
47
                 break;
48
             }
49
 
50
-            if(uint64_t(aFileLen) + 4096 > uint64_t(std::numeric_limits<ptrdiff_t>::max())) {
51
+            const uint64_t aReadLen = uint64_t(aFileLen) + uint64_t(aReadBytes);
52
+            if(aReadLen > uint64_t(std::numeric_limits<ptrdiff_t>::max())) {
53
                 isOk = false;
54
                 break;
55
             }
56
 
57
             aFileLen += aReadBytes;
58
             aChunks.add(aChunk);
59
+            if(theReadMax != 0
60
+            && aReadLen >= uint64_t(theReadMax)) {
61
+                break;
62
+            }
63
         }
64
         closeFile();
65
 
66
@@ -214,18 +237,28 @@
67
     }
68
 
69
     // determine length of file
70
-    fseek(myFileHandle, 0, SEEK_END);
71
-    long aFileLen = ftell(myFileHandle);
72
+    fseek64(myFileHandle, 0, SEEK_END);
73
+    int64_t aFileLen = ftell64(myFileHandle);
74
     if(aFileLen <= 0L) {
75
         closeFile();
76
         return false;
77
     }
78
 
79
+    size_t aReadLen = 0;
80
+    if(aFileLen <= int64_t(std::numeric_limits<ptrdiff_t>::max())) {
81
+        aReadLen = theReadMax != 0 ? (size_t )stMin(int64_t(theReadMax), aFileLen) : size_t(aFileLen);
82
+    } else if(theReadMax != 0) {
83
+        aReadLen = theReadMax;
84
+    } else {
85
+        closeFile();
86
+        return false;
87
+    }
88
+
89
     // create a buffer and read the data
90
-    initBuffer(size_t(aFileLen));
91
+    initBuffer(aReadLen);
92
 
93
-    fseek(myFileHandle, 0, SEEK_SET);
94
-    if(myBuffSize == size_t(aFileLen)) {
95
+    fseek64(myFileHandle, 0, SEEK_SET);
96
+    if(myBuffSize == aReadLen) {
97
         size_t aCountRead = fread(myBuffer, 1, myBuffSize, myFileHandle);
98
         (void )aCountRead;
99
     }
100
sview-16_06.tar.gz/StShared/StResourceManager.cpp -> sview-17_04.tar.gz/StShared/StResourceManager.cpp Changed
107
 
1
@@ -85,72 +85,41 @@
2
   myLang("en") {
3
 
4
 #if defined(_WIN32)
5
-    typedef HRESULT (WINAPI *SHGetKnownFolderPath_t)(const GUID* , DWORD , HANDLE , PWSTR* );
6
-    HMODULE aShell32Module = GetModuleHandleW(L"Shell32"); // should be already loaded
7
-    SHGetKnownFolderPath_t aGetFolder = aShell32Module != NULL
8
-                                      ? (SHGetKnownFolderPath_t )GetProcAddress(aShell32Module, "SHGetKnownFolderPath")
9
-                                      : (SHGetKnownFolderPath_t )NULL;
10
     StString anAppDataLocal, anAppDataLocalLow, anAppDataRoam;
11
-    if(aGetFolder != NULL) {
12
-        // Vista+
13
-        wchar_t* aPath = NULL;
14
-
15
-        const GUID THE_FOLDER_APPLOC = { 0xF1B32785, 0x6FBA, 0x4FCF, {0x9D, 0x55, 0x7B, 0x8E, 0x7F, 0x15, 0x70, 0x91} }; // FOLDERID_LocalAppData
16
-        const GUID THE_FOLDER_APPLOW = { 0xA520A1A4, 0x1780, 0x4FF6, {0xBD, 0x18, 0x16, 0x73, 0x43, 0xC5, 0xAF, 0x16} }; // FOLDERID_LocalAppDataLow
17
-        const GUID THE_FOLDER_APPROA = { 0x3EB685DB, 0x65F9, 0x4CF6, {0xA0, 0x3A, 0xE3, 0xEF, 0x65, 0x72, 0x9F, 0x3D} }; // FOLDERID_RoamingAppData
18
-        const GUID THE_FOLDER_DOCS   = { 0xFDD39AD0, 0x238F, 0x46AF, {0xAD, 0xB4, 0x6C, 0x85, 0x48, 0x03, 0x69, 0xC7} }; // FOLDERID_Documents
19
-
20
-        const GUID THE_FOLDER_DOWN   = { 0x374DE290, 0x123F, 0x4565, {0x91, 0x64, 0x39, 0xC4, 0x92, 0x5E, 0x46, 0x7B} }; // FOLDERID_Downloads
21
-        const GUID THE_FOLDER_PICS   = { 0x33E28130, 0x4E1E, 0x4676, {0x83, 0x5A, 0x98, 0x39, 0x5C, 0x3B, 0xC3, 0xBB} }; // FOLDERID_Pictures
22
-        const GUID THE_FOLDER_MUSIC  = { 0x4BD8D571, 0x6D19, 0x48D3, {0xBE, 0x97, 0x42, 0x22, 0x20, 0x08, 0x0E, 0x43} }; // FOLDERID_Music
23
-        const GUID THE_FOLDER_VIDS   = { 0x18989B1D, 0x99B5, 0x455B, {0x84, 0x1C, 0xAB, 0x7C, 0x74, 0xE4, 0xDD, 0xFC} }; // FOLDERID_Videos
24
-
25
-        if(aGetFolder(&THE_FOLDER_APPLOC, 0, NULL, &aPath) == S_OK) {
26
-            anAppDataLocal.fromUnicode(aPath);
27
-            ::CoTaskMemFree(aPath);
28
-        }
29
-        if(aGetFolder(&THE_FOLDER_APPLOW, 0, NULL, &aPath) == S_OK) {
30
-            anAppDataLocalLow.fromUnicode(aPath);
31
-            ::CoTaskMemFree(aPath);
32
-        }
33
-        if(aGetFolder(&THE_FOLDER_APPROA, 0, NULL, &aPath) == S_OK) {
34
-            anAppDataRoam.fromUnicode(aPath);
35
-            ::CoTaskMemFree(aPath);
36
-        }
37
-        if(aGetFolder(&THE_FOLDER_DOCS, 0, NULL, &aPath) == S_OK) {
38
-            myUserHomeFolder.fromUnicode(aPath);
39
-            myUserHomeFolder += "\\";
40
-            ::CoTaskMemFree(aPath);
41
-        }
42
+    wchar_t* aPath = NULL;
43
+    if(::SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &aPath) == S_OK) {
44
+        anAppDataLocal.fromUnicode(aPath);
45
+        ::CoTaskMemFree(aPath);
46
+    }
47
+    if(::SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, NULL, &aPath) == S_OK) {
48
+        anAppDataLocalLow.fromUnicode(aPath);
49
+        ::CoTaskMemFree(aPath);
50
+    }
51
+    if(::SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &aPath) == S_OK) {
52
+        anAppDataRoam.fromUnicode(aPath);
53
+        ::CoTaskMemFree(aPath);
54
+    }
55
+    if(::SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &aPath) == S_OK) {
56
+        myUserHomeFolder.fromUnicode(aPath);
57
+        myUserHomeFolder += "\\";
58
+        ::CoTaskMemFree(aPath);
59
+    }
60
 
61
-        if(aGetFolder(&THE_FOLDER_DOWN, 0, NULL, &aPath) == S_OK) {
62
-            myFolders[FolderId_Downloads].fromUnicode(aPath);
63
-            ::CoTaskMemFree(aPath);
64
-        }
65
-        if(aGetFolder(&THE_FOLDER_PICS, 0, NULL, &aPath) == S_OK) {
66
-            myFolders[FolderId_Pictures].fromUnicode(aPath);
67
-            ::CoTaskMemFree(aPath);
68
-        }
69
-        if(aGetFolder(&THE_FOLDER_MUSIC, 0, NULL, &aPath) == S_OK) {
70
-            myFolders[FolderId_Music].fromUnicode(aPath);
71
-            ::CoTaskMemFree(aPath);
72
-        }
73
-        if(aGetFolder(&THE_FOLDER_VIDS, 0, NULL, &aPath) == S_OK) {
74
-            myFolders[FolderId_Videos].fromUnicode(aPath);
75
-            ::CoTaskMemFree(aPath);
76
-        }
77
-    } else {
78
-        wchar_t aPath[MAX_PATH];
79
-        if(::SHGetFolderPathW(NULL, CSIDL_FLAG_CREATE | CSIDL_LOCAL_APPDATA, NULL, 0, aPath) == S_OK) {
80
-            anAppDataLocal.fromUnicode(aPath);
81
-        }
82
-        if(::SHGetFolderPathW(NULL, CSIDL_FLAG_CREATE | CSIDL_APPDATA, NULL, 0, aPath) == S_OK) {
83
-            anAppDataRoam.fromUnicode(aPath);
84
-        }
85
-        if(::SHGetFolderPathW(NULL, CSIDL_FLAG_CREATE | CSIDL_PERSONAL, NULL, 0, aPath) == S_OK) {
86
-            myUserHomeFolder.fromUnicode(aPath);
87
-            myUserHomeFolder += "\\";
88
-        }
89
+    if(::SHGetKnownFolderPath(FOLDERID_Downloads, 0, NULL, &aPath) == S_OK) {
90
+        myFolders[FolderId_Downloads].fromUnicode(aPath);
91
+        ::CoTaskMemFree(aPath);
92
+    }
93
+    if(::SHGetKnownFolderPath(FOLDERID_Pictures, 0, NULL, &aPath) == S_OK) {
94
+        myFolders[FolderId_Pictures].fromUnicode(aPath);
95
+        ::CoTaskMemFree(aPath);
96
+    }
97
+    if(::SHGetKnownFolderPath(FOLDERID_Music, 0, NULL, &aPath) == S_OK) {
98
+        myFolders[FolderId_Music].fromUnicode(aPath);
99
+        ::CoTaskMemFree(aPath);
100
+    }
101
+    if(::SHGetKnownFolderPath(FOLDERID_Videos, 0, NULL, &aPath) == S_OK) {
102
+        myFolders[FolderId_Videos].fromUnicode(aPath);
103
+        ::CoTaskMemFree(aPath);
104
     }
105
 
106
     StString anAppData;
107
sview-16_06.tar.gz/StShared/StShared.cbp -> sview-17_04.tar.gz/StShared/StShared.cbp Changed
9
 
1
@@ -495,6 +495,7 @@
2
        <Unit filename="../include/StSys/StSys.h" />
3
        <Unit filename="../include/StTemplates/StArray.h" />
4
        <Unit filename="../include/StTemplates/StArrayList.h" />
5
+       <Unit filename="../include/StTemplates/StArrayStreamBuffer.h" />
6
        <Unit filename="../include/StTemplates/StAtomic.h" />
7
        <Unit filename="../include/StTemplates/StHandle.h" />
8
        <Unit filename="../include/StTemplates/StQuickPointersSort.h" />
9
sview-16_06.tar.gz/StShared/StShared.rc -> sview-17_04.tar.gz/StShared/StShared.rc Changed
10
 
1
@@ -15,7 +15,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "sView common algorithms library\000"
4
       VALUE "FileVersion",     SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright",  "\251 2007-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright",  "\251 2007-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName",     "StShared\000"
8
       VALUE "ProductVersion",  SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite",    "www.sview.ru\000"
10
sview-16_06.tar.gz/StShared/StShared.vcxproj -> sview-17_04.tar.gz/StShared/StShared.vcxproj Changed
15
 
1
@@ -1,4 +1,4 @@
2
-<?xml version="1.0" encoding="utf-8"?>
3
+<?xml version="1.0" encoding="utf-8"?>
4
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5
   <ItemGroup Label="ProjectConfigurations">
6
     <ProjectConfiguration Include="Debug|Win32">
7
@@ -401,6 +401,7 @@
8
     <ClInclude Include="..\include\StSys\StSys.h" />
9
     <ClInclude Include="..\include\StTemplates\StArray.h" />
10
     <ClInclude Include="..\include\StTemplates\StArrayList.h" />
11
+    <ClInclude Include="..\include\StTemplates\StArrayStreamBuffer.h" />
12
     <ClInclude Include="..\include\StTemplates\StAtomic.h" />
13
     <ClInclude Include="..\include\StTemplates\StHandle.h" />
14
     <ClInclude Include="..\include\StTemplates\StQuaternion.h" />
15
sview-16_06.tar.gz/StShared/StThread.cpp -> sview-17_04.tar.gz/StShared/StThread.cpp Changed
63
 
1
@@ -121,6 +121,15 @@
2
 #endif
3
 }
4
 
5
+bool StThread::wait(const int theTimeMilliseconds) {
6
+#ifdef _WIN32
7
+    return isValid() && (WaitForSingleObject((HANDLE )myThread, (DWORD )theTimeMilliseconds) != WAIT_TIMEOUT);
8
+#else
9
+    (void )theTimeMilliseconds;
10
+    return isValid() && (pthread_join(myThread, NULL) == 0);
11
+#endif
12
+}
13
+
14
 void StThread::kill() {
15
     if(isValid()) {
16
     #ifdef _WIN32
17
@@ -146,21 +155,7 @@
18
 }
19
 
20
 namespace {
21
-#ifdef _WIN32
22
-    // for a 64-bit app running under 64-bit Windows, this is FALSE
23
-    static bool isWow64() {
24
-        typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE , PBOOL );
25
-        BOOL bIsWow64 = FALSE;
26
-        HMODULE aKern32Module = GetModuleHandleW(L"kernel32");
27
-        LPFN_ISWOW64PROCESS aFunIsWow64 = aKern32Module == NULL
28
-                                        ? (LPFN_ISWOW64PROCESS )NULL
29
-                                        : (LPFN_ISWOW64PROCESS )GetProcAddress(aKern32Module, "IsWow64Process");
30
-        return aFunIsWow64 != NULL
31
-            && aFunIsWow64(GetCurrentProcess(), &bIsWow64)
32
-            && bIsWow64 != FALSE;
33
-    }
34
-
35
-#elif defined(__ANDROID__)
36
+#if defined(__ANDROID__)
37
 
38
     /**
39
      * Simple number parser.
40
@@ -257,21 +252,8 @@
41
         return aNumLogicalProcessors;
42
     }
43
 
44
-    // GetSystemInfo() will return the number of processors in a data field in a SYSTEM_INFO structure.
45
     SYSTEM_INFO aSysInfo;
46
-    if(isWow64()) {
47
-        typedef BOOL (WINAPI *LPFN_GSI)(LPSYSTEM_INFO );
48
-        HMODULE aKern32 = GetModuleHandleW(L"kernel32");
49
-        LPFN_GSI aFuncSysInfo = (LPFN_GSI )GetProcAddress(aKern32, "GetNativeSystemInfo");
50
-        // So, they suggest 32-bit apps should call this instead of the other in WOW64
51
-        if(aFuncSysInfo != NULL) {
52
-            aFuncSysInfo(&aSysInfo);
53
-        } else {
54
-            GetSystemInfo(&aSysInfo);
55
-        }
56
-    } else {
57
-        GetSystemInfo(&aSysInfo);
58
-    }
59
+    ::GetNativeSystemInfo(&aSysInfo);
60
     aNumLogicalProcessors = aSysInfo.dwNumberOfProcessors;
61
     return aNumLogicalProcessors;
62
 #else
63
sview-16_06.tar.gz/StShared/StWebPImage.cpp -> sview-17_04.tar.gz/StShared/StWebPImage.cpp Changed
26
 
1
@@ -161,10 +161,11 @@
2
 #endif
3
 }
4
 
5
-bool StWebPImage::load(const StString& theFilePath,
6
-                       ImageType       theImageType,
7
-                       uint8_t*        theDataPtr,
8
-                       int             theDataSize) {
9
+bool StWebPImage::loadExtra(const StString& theFilePath,
10
+                            ImageType       theImageType,
11
+                            uint8_t*        theDataPtr,
12
+                            int             theDataSize,
13
+                            bool            theIsOnlyRGB) {
14
 #ifndef ST_HAVE_WEBP
15
     setState("WebP library is not initialized");
16
     return false;
17
@@ -193,7 +194,7 @@
18
     switch(theImageType) {
19
         case ST_TYPE_NONE:
20
         case ST_TYPE_WEBP: {
21
-            return loadInternal(theFilePath, theDataPtr, theDataSize, false);
22
+            return loadInternal(theFilePath, theDataPtr, theDataSize, theIsOnlyRGB);
23
         }
24
         case ST_TYPE_WEBPLL: {
25
             return loadInternal(theFilePath, theDataPtr, theDataSize, true);
26
sview-16_06.tar.gz/clean - Full.bat -> sview-17_04.tar.gz/clean - Full.bat Changed
17
 
1
@@ -6,4 +6,13 @@
2
 del /S bin\*exe.manifest
3
 del /S bin\*.lib
4
 del /S *.pdb
5
-del /S *.ilk
6
\ No newline at end of file
7
+del /S *.ilk
8
+
9
+del /S *.VC.opendb
10
+del /S *.VC.db
11
+del /S *.sdf
12
+del /S *.suo
13
+del /S *.psess
14
+del /S *.vsp
15
+
16
+if exist "%~dp0.vs" rmdir /S /Q "%~dp0.vs"
17
sview-16_06.tar.gz/distribution/build.bat -> sview-17_04.tar.gz/distribution/build.bat Changed
9
 
1
@@ -99,6 +99,7 @@
2
 echo   #define SVIEW_SDK_VER_STATUS %releaseStatus%>> "%SVIEW_BUILD_CONF%"
3
 echo #endif>> "%SVIEW_BUILD_CONF%"
4
 
5
+echo #define ST_HAVE_OPENVR>> "%SVIEW_BUILD_CONF%"
6
 echo #define ST_HAVE_WEBP>> "%SVIEW_BUILD_CONF%"
7
 echo #define ST_HAVE_MONGOOSE>> "%SVIEW_BUILD_CONF%"
8
 
9
sview-16_06.tar.gz/distribution/build.iss -> sview-17_04.tar.gz/distribution/build.iss Changed
66
 
1
@@ -147,7 +147,7 @@
2
 
3
 [Tasks]
4
 Name: desktopicon;           Description: "{cm:CreateDesktopIcon}";     GroupDescription: "{cm:AdditionalIcons}";  Flags: unchecked
5
-Name: quicklaunchicon;       Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}";  Flags: unchecked
6
+Name: quicklaunchicon;       Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}";  Flags: unchecked; OnlyBelowVersion: 0,6.1
7
 Name: flagOpenAL51;          Description: "{cm:OpenALSoft51}";          GroupDescription: "{cm:AdditionalIcons}" ; Components: StDrawers\StMoviePlayer; Flags: unchecked
8
 Name: flagAssocStereoImages; Description: "{cm:AssocStereoImages}";     GroupDescription: "{cm:FileAssociations}"; Components: StDrawers\StImageViewer
9
 Name: flagAssocImages;       Description: "{cm:AssocImages}";           GroupDescription: "{cm:FileAssociations}"; Components: StDrawers\StImageViewer; Flags: unchecked
10
@@ -214,8 +214,10 @@
11
 Source: {#SVIEW_DISTR_PATH_AMD64}\StOutPageFlip.dll;              DestDir: {app}\amd64;                        Flags: 64bit ignoreversion;                Components: StRenderers\StOutPageFlip; Check: IsWin64
12
 ; StRenderers -> StOutDistorted
13
 Source: {#SVIEW_DISTR_PATH_x86}\StOutDistorted.dll;               DestDir: {app};                              Flags: 32bit ignoreversion;                Components: StRenderers\StOutDistorted
14
+Source: {#SVIEW_DISTR_PATH_x86}\openvr_api.dll;                   DestDir: {app};                              Flags: 32bit ignoreversion;                Components: StRenderers\StOutDistorted
15
 Source: {#SVIEW_DISTR_PATH_x86}\lang\*StOutDistorted.lng;         DestDir: {app}\lang;                         Flags: 32bit ignoreversion recursesubdirs; Components: StRenderers\StOutDistorted
16
 Source: {#SVIEW_DISTR_PATH_AMD64}\StOutDistorted.dll;             DestDir: {app}\amd64;                        Flags: 64bit ignoreversion;                Components: StRenderers\StOutDistorted; Check: IsWin64
17
+Source: {#SVIEW_DISTR_PATH_AMD64}\openvr_api.dll;                 DestDir: {app}\amd64;                        Flags: 64bit ignoreversion;                Components: StRenderers\StOutDistorted; Check: IsWin64
18
 
19
 ; StDrawers
20
 Source: {#SVIEW_DISTR_PATH_x86}\textures\*;                    DestDir: {app}\textures;        Flags: 32bit ignoreversion; Components: StDrawers\StImageViewer or StDrawers\StMoviePlayer or StBrowserPlugins or StActiveXPlugin
21
@@ -243,6 +245,7 @@
22
 Source: {#SVIEW_DISTR_PATH_x86}\web\*.htm;                     DestDir: {app}\web;             Flags: 32bit ignoreversion recursesubdirs; Components: StDrawers\StMoviePlayer
23
 Source: {#SVIEW_DISTR_PATH_x86}\OpenAL32.dll;                  DestDir: {app};                 Flags: 32bit ignoreversion; Components: StCore
24
 Source: alsoft51.ini;                                          DestDir: {userappdata};   DestName: "alsoft.ini";     Tasks: flagOpenAL51; Components: StCore
25
+Source: openal\hrtf\*;                                         DestDir: {commonappdata}\openal\hrtf; Components: StCore
26
 Source: {#SVIEW_DISTR_PATH_AMD64}\StMoviePlayer.dll;           DestDir: {app}\amd64;           Flags: 64bit ignoreversion; Components: StCore; Check: IsWin64
27
 Source: {#SVIEW_DISTR_PATH_AMD64}\OpenAL32.dll;                DestDir: {app}\amd64;           Flags: 64bit ignoreversion; Components: StCore; Check: IsWin64
28
 
29
@@ -251,8 +254,8 @@
30
 ;Source: {#SVIEW_DISTR_PATH_AMD64}\StCADViewer.exe;             DestDir: {app}\amd64;           Flags: 64bit ignoreversion; Components: StCore; Check: IsWin64
31
 
32
 [Icons]
33
-Name: {group}\sView - Image Viewer; Filename: {app}\{#SVIEW_EXE_NAME};       Components: StDrawers\StImageViewer; IconFilename: {app}\{#SVIEW_EXE_NAME};       Comment: "{cm:StImageViewer}";  IconIndex: 0; Parameters: "--in=image - ""{app}\demo.jps"""; Check: not IsWin64
34
-Name: {group}\sView - Image Viewer; Filename: {app}\amd64\{#SVIEW_EXE_NAME}; Components: StDrawers\StImageViewer; IconFilename: {app}\amd64\{#SVIEW_EXE_NAME}; Comment: "{cm:StImageViewer}";  IconIndex: 0; Parameters: "--in=image - ""{app}\demo.jps"""; Check: IsWin64
35
+Name: {group}\sView - Image Viewer; Filename: {app}\{#SVIEW_EXE_NAME};       Components: StDrawers\StImageViewer; IconFilename: {app}\{#SVIEW_EXE_NAME};       Comment: "{cm:StImageViewer}";  IconIndex: 0; Parameters: "--in=image --demo=""{app}\demo.jps"""; Check: not IsWin64
36
+Name: {group}\sView - Image Viewer; Filename: {app}\amd64\{#SVIEW_EXE_NAME}; Components: StDrawers\StImageViewer; IconFilename: {app}\amd64\{#SVIEW_EXE_NAME}; Comment: "{cm:StImageViewer}";  IconIndex: 0; Parameters: "--in=image --demo=""{app}\demo.jps"""; Check: IsWin64
37
 Name: {group}\sView - Movie Player; Filename: {app}\{#SVIEW_EXE_NAME};       Components: StDrawers\StMoviePlayer; IconFilename: {app}\{#SVIEW_EXE_NAME};       Comment: "{cm:StMoviePlayer}";  IconIndex: 0; Parameters: "--in=video"; Check: not IsWin64
38
 Name: {group}\sView - Movie Player; Filename: {app}\amd64\{#SVIEW_EXE_NAME}; Components: StDrawers\StMoviePlayer; IconFilename: {app}\amd64\{#SVIEW_EXE_NAME}; Comment: "{cm:StMoviePlayer}";  IconIndex: 0; Parameters: "--in=video"; Check: IsWin64
39
 Name: {group}\Extras\sView - Failsafe;                    Filename: {app}\{#SVIEW_EXE_NAME};       Components: StDrawers\StImageViewer and StRenderers\StOutAnaglyph; IconFilename: {app}\{#SVIEW_EXE_NAME};       Comment: Failsafe sView launch; IconIndex: 0; Parameters: --out=StOutAnaglyph --in=image
40
@@ -267,10 +270,10 @@
41
 
42
 ;Name: {group}\user manual;          Filename: {app}\info\manual.pdf;         Comment: User manual; Tasks: ; Languages:
43
 Name: {group}\{cm:UninstallProgram,{#SVIEW_NAME}}; Filename: {uninstallexe}
44
-Name: {commondesktop}\{#SVIEW_NAME};Filename: {app}\{#SVIEW_EXE_NAME};       Tasks: desktopicon; Components: StDrawers\StImageViewer; IconFilename: {app}\{#SVIEW_EXE_NAME};       Comment: "{cm:StImageViewer}"; IconIndex: 0; Parameters: "--in=image - ""{app}\demo.jps"""; Check: not IsWin64
45
-Name: {commondesktop}\{#SVIEW_NAME};Filename: {app}\amd64\{#SVIEW_EXE_NAME}; Tasks: desktopicon; Components: StDrawers\StImageViewer; IconFilename: {app}\amd64\{#SVIEW_EXE_NAME}; Comment: "{cm:StImageViewer}"; IconIndex: 0; Parameters: "--in=image - ""{app}\demo.jps"""; Check: IsWin64
46
-Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#SVIEW_NAME}; Filename: {app}\{#SVIEW_EXE_NAME};       Tasks: quicklaunchicon; Components: StDrawers\StImageViewer; IconFilename: {app}\{#SVIEW_EXE_NAME};       Comment: "{cm:StImageViewer}"; IconIndex: 0; Parameters: "--in=image - ""{app}\demo.jps"""; Check: not IsWin64
47
-Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#SVIEW_NAME}; Filename: {app}\amd64\{#SVIEW_EXE_NAME}; Tasks: quicklaunchicon; Components: StDrawers\StImageViewer; IconFilename: {app}\amd64\{#SVIEW_EXE_NAME}; Comment: "{cm:StImageViewer}"; IconIndex: 0; Parameters: "--in=image - ""{app}\demo.jps"""; Check: IsWin64
48
+Name: {commondesktop}\{#SVIEW_NAME};Filename: {app}\{#SVIEW_EXE_NAME};       Tasks: desktopicon; Components: StDrawers\StImageViewer; IconFilename: {app}\{#SVIEW_EXE_NAME};       Comment: "{cm:StImageViewer}"; IconIndex: 0; Parameters: "--in=image --demo=""{app}\demo.jps"""; Check: not IsWin64
49
+Name: {commondesktop}\{#SVIEW_NAME};Filename: {app}\amd64\{#SVIEW_EXE_NAME}; Tasks: desktopicon; Components: StDrawers\StImageViewer; IconFilename: {app}\amd64\{#SVIEW_EXE_NAME}; Comment: "{cm:StImageViewer}"; IconIndex: 0; Parameters: "--in=image --demo=""{app}\demo.jps"""; Check: IsWin64
50
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#SVIEW_NAME}; Filename: {app}\{#SVIEW_EXE_NAME};       Tasks: quicklaunchicon; Components: StDrawers\StImageViewer; IconFilename: {app}\{#SVIEW_EXE_NAME};       Comment: "{cm:StImageViewer}"; IconIndex: 0; Parameters: "--in=image --demo=""{app}\demo.jps"""; Check: not IsWin64
51
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#SVIEW_NAME}; Filename: {app}\amd64\{#SVIEW_EXE_NAME}; Tasks: quicklaunchicon; Components: StDrawers\StImageViewer; IconFilename: {app}\amd64\{#SVIEW_EXE_NAME}; Comment: "{cm:StImageViewer}"; IconIndex: 0; Parameters: "--in=image --demo=""{app}\demo.jps"""; Check: IsWin64
52
 
53
 [Run]
54
 ;Filename: {app}\{#SVIEW_EXE_NAME}; WorkingDir: {app}; Components: StDrawers\StImageViewer; Description: {cm:LaunchProgram,{#SVIEW_NAME}}; Parameters: --in=image - demo.jps; Flags: nowait postinstall skipifsilent
55
@@ -314,8 +317,8 @@
56
 
57
 Root: HKCR; SubKey: .bmp;                                      ValueType: string; ValueData: sView Image;                   Tasks: flagAssocImages;       Flags: uninsdeletekey
58
 Root: HKCR; SubKey: .jpg;                                      ValueType: string; ValueData: sView Image;                   Tasks: flagAssocImages;       Flags: uninsdeletekey
59
-Root: HKCR; SubKey: .jpeg                                      ValueType: string; ValueData: sView Image;                   Tasks: flagAssocImages;       Flags: uninsdeletekey
60
-Root: HKCR; SubKey: .jpe                                       ValueType: string; ValueData: sView Image;                   Tasks: flagAssocImages;       Flags: uninsdeletekey
61
+Root: HKCR; SubKey: .jpeg;                                     ValueType: string; ValueData: sView Image;                   Tasks: flagAssocImages;       Flags: uninsdeletekey
62
+Root: HKCR; SubKey: .jpe;                                      ValueType: string; ValueData: sView Image;                   Tasks: flagAssocImages;       Flags: uninsdeletekey
63
 Root: HKCR; SubKey: .j2k;                                      ValueType: string; ValueData: sView Image;                   Tasks: flagAssocImages;       Flags: uninsdeletekey
64
 Root: HKCR; SubKey: .jp2;                                      ValueType: string; ValueData: sView Image;                   Tasks: flagAssocImages;       Flags: uninsdeletekey
65
 Root: HKCR; SubKey: .tga;                                      ValueType: string; ValueData: sView Image;                   Tasks: flagAssocImages;       Flags: uninsdeletekey
66
sview-17_04.tar.gz/distribution/openal Added
2
 
1
+(directory)
2
sview-17_04.tar.gz/distribution/openal/hrtf Added
2
 
1
+(directory)
2
sview-17_04.tar.gz/distribution/openal/hrtf/default-44100.mhr Added
sview-17_04.tar.gz/distribution/openal/hrtf/default-48000.mhr Added
sview-16_06.tar.gz/docs/INSTALL.md -> sview-17_04.tar.gz/docs/INSTALL.md Changed
40
 
1
@@ -38,11 +38,11 @@
2
 yum install ffmpeg-devel
3
 ~~~~~
4
 
5
-On Windows and Mac OS X please refer to official documentation for each project.
6
-Notice that DevIL and FreeImage libraries are optional and need not for building sView
7
+On Windows and macOS please refer to official documentation for each project.
8
+Notice that DevIL and FreeImage libraries are optional and are not required for building sView
9
 (libraries are loaded dynamically if available).
10
 
11
-## II. Makefile on Linux
12
+## II. Makefile (Linux, macOS, Android)
13
 
14
 Current Makefile has been written only for DEB/RPM source packages
15
 and lacks configuration flexibility (means there NO any ./configure and so on).
16
@@ -53,6 +53,23 @@
17
   make && make install
18
 ~~~~~
19
 
20
+### Android
21
+
22
+sView for Android is build in two steps:
23
+
24
+* Building native libraries using UNIX Makefile.
25
+  Paths to NDK and 3rd-party libraries can be specified through command-line options to **make** or by editing Makefile itself.
26
+  sView does not provide .mk files - it uses UNIX Makefile for building native code.
27
+~~~~~
28
+  make android ANDROID_NDK=$SVIEW_NDK FFMPEG_ROOT=$SVIEW_FFMPEG FREETYPE_ROOT=$SVIEW_FREETYPE OPENAL_ROOT=$SVIEW_OPENAL LIBCONFIG_ROOT=$SVIEW_LIBCONFIG
29
+~~~~~
30
+* Compiling Java classes and putting everything into APK file using Eclipse.
31
+  Eclipse performs building automatically (by default), but APK file is not created by this action.
32
+  APK export can be started from context menu on project sView (in the tree) -> Export -> Android -> Export Android Application.
33
+  Android Studio is currently can not be used for this purpose (not tested).
34
+
35
+This instruction has been tested only on Linux host.
36
+
37
 ## III. Code::Blocks
38
 
39
 Code::Blocks is an official way for building and development of sView.
40
sview-16_06.tar.gz/include/StAV/StAVImage.h -> sview-17_04.tar.gz/include/StAV/StAVImage.h Changed
22
 
1
@@ -66,15 +66,11 @@
2
     /**
3
      * Decode image from specified file or memory pointer.
4
      */
5
-    ST_CPPEXPORT virtual bool load(const StString& theFilePath,
6
-                                   ImageType       theImageType = ST_TYPE_NONE,
7
-                                   uint8_t* theDataPtr = NULL, int theDataSize = 0);
8
-
9
-    ST_CPPEXPORT bool loadExtra(const StString& theFilePath,
10
-                                ImageType       theImageType,
11
-                                uint8_t*        theDataPtr,
12
-                                int             theDataSize,
13
-                                bool            theIsOnlyRGB);
14
+    ST_CPPEXPORT virtual bool loadExtra(const StString& theFilePath,
15
+                                        ImageType       theImageType,
16
+                                        uint8_t*        theDataPtr,
17
+                                        int             theDataSize,
18
+                                        bool            theIsOnlyRGB) ST_ATTR_OVERRIDE;
19
 
20
     /**
21
      * Save image to specified path.
22
sview-16_06.tar.gz/include/StAV/stAV.h -> sview-17_04.tar.gz/include/StAV/stAV.h Changed
17
 
1
@@ -32,6 +32,15 @@
2
     #include <libavutil/stereo3d.h>
3
 #endif
4
 
5
+#if(LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 0, 0))
6
+    #include <libavutil/display.h>
7
+#endif
8
+
9
+#if(LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 57, 100))
10
+    #define ST_AV_NEWSPHERICAL
11
+    #include <libavutil/spherical.h>
12
+#endif
13
+
14
 #ifdef _MSC_VER
15
     #pragma warning(default : 4244)
16
 #endif
17
sview-16_06.tar.gz/include/StCore/StAndroidGlue.h -> sview-17_04.tar.gz/include/StCore/StAndroidGlue.h Changed
57
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StCore, window system independent C++ toolkit for writing OpenGL applications.
4
- * Copyright © 2014-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2014-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -219,15 +219,23 @@
10
      * Turn orientation sensor on/off.
11
      * Has no effect in case if sensor is unavailable.
12
      */
13
-    ST_CPPEXPORT void setTrackOrientation(const bool theToTrack);
14
+    ST_CPPEXPORT void setTrackOrientation(bool theToTrack);
15
+
16
+    /**
17
+     * Setup visibility of system bars.
18
+     */
19
+    ST_CPPEXPORT void setHideSystemBars(bool theToHideStatusBar,
20
+                                        bool theToHideNavBar);
21
 
22
     /**
23
      * Fetch current state:
24
      * @param theNewFile pop onNewIntent() open file event
25
      * @param theQuaternion device orientation
26
+     * @param theToSwapEyes swap left/right views
27
      */
28
     ST_CPPEXPORT void fetchState(StString&             theNewFile,
29
-                                 StQuaternion<double>& theQuaternion);
30
+                                 StQuaternion<double>& theQuaternion,
31
+                                 bool&                 theToSwapEyes);
32
 
33
     /**
34
      * Return device memory class.
35
@@ -350,6 +358,11 @@
36
      */
37
     ST_LOCAL void setOrientation(float theAzimuthDeg, float thePitchDeg, float theRollDeg, float theScreenRotDeg);
38
 
39
+    /**
40
+     * Define device Left/Right eyes swap flag.
41
+     */
42
+    ST_LOCAL void setSwapEyes(bool theToSwapLR);
43
+
44
         private: //! @name ANativeActivity callbacks
45
 
46
     ST_LOCAL static void processInputWrapper(StAndroidGlue*       theApp,
47
@@ -470,6 +483,9 @@
48
     bool                    myHasOrientSensor;   //!< flag indicating that device has orientation sensors
49
     bool                    myIsPoorOrient;      //!< flag indicating that available orientation sensor provides imprecise values
50
     bool                    myToTrackOrient;     //!< track device orientation
51
+    bool                    myToHideStatusBar;   //!< hide system-provided status bar
52
+    bool                    myToHideNavBar;      //!< hide system-provided navigation bar
53
+    bool                    myToSwapEyesHW;      //!< flag to swap LR views on external event
54
 
55
     bool                    myIsRunning;
56
     bool                    myIsStateSaved;
57
sview-16_06.tar.gz/include/StCore/StEvent.h -> sview-17_04.tar.gz/include/StCore/StEvent.h Changed
31
 
1
@@ -118,8 +118,27 @@
2
 
3
     StEventType   Type;    //!< event type
4
     double        Time;    //!< time in seconds when event was registered
5
-    unsigned int  SizeX;   //!< new window rectangle in pixels
6
-    unsigned int  SizeY;
7
+    unsigned int  SizeX;   //!< new window width  in pixels
8
+    unsigned int  SizeY;   //!< new window height in pixels
9
+    double        Aspect;  //!< new window aspect ratio (width / height)
10
+
11
+    /**
12
+     * Initialize size event.
13
+     */
14
+    void init(double theTime,
15
+              unsigned int theSizeX,
16
+              unsigned int theSizeY,
17
+              double theForcedAspect) {
18
+        Type  = stEvent_Size;
19
+        Time  = theTime;
20
+        SizeX = theSizeX;
21
+        SizeY = theSizeY;
22
+        if(theForcedAspect > 0.0) {
23
+            Aspect = theForcedAspect;
24
+        } else {
25
+            Aspect = double(theSizeX != 0 ? theSizeX : 1) / double(theSizeY != 0 ? theSizeY : 1);
26
+        }
27
+    }
28
 
29
 };
30
 
31
sview-16_06.tar.gz/include/StCore/StWindow.h -> sview-17_04.tar.gz/include/StCore/StWindow.h Changed
110
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StCore, window system independent C++ toolkit for writing OpenGL applications.
4
- * Copyright © 2007-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2007-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -88,6 +88,7 @@
10
     StWinAttr_GlQuadStereo,        //!< boolean, request OpenGL context with Quad Buffer, turned OFF by default
11
     StWinAttr_GlDebug,             //!< boolean, request Debug OpenGL context, FALSE by default
12
     StWinAttr_GlDepthSize,         //!< integer, minimum size of Depth Buffer (in bits) or 0 if not needed, 16 bit by default
13
+    StWinAttr_GlStencilSize,       //!< integer, size of Stencil Buffer (in bits) or 0 if not needed, 0 bit by default
14
     StWinAttr_ToBlockSleepSystem,  //!< boolean, prevent system  going to sleep (display could be turned off), FALSE by default
15
     StWinAttr_ToBlockSleepDisplay, //!< boolean, prevent display going to sleep, FALSE by default
16
     StWinAttr_GlobalMediaKeys,     //!< boolean, register system hot-key to capture multimedia even without window focus, FALSE by default
17
@@ -257,15 +258,20 @@
18
     /**
19
      * @return GUI margins
20
      */
21
-    ST_CPPEXPORT const StMarginsI& getMargins() const;
22
+    ST_CPPEXPORT virtual StMarginsI getMargins() const;
23
 
24
     /**
25
      * @return point relative to window mouse position
26
-     * (0,0) - is top left of the window and (1,1) right buttom.
27
+     * (0,0) - is top left of the window and (1,1) right bottom.
28
      */
29
     ST_CPPEXPORT StPointD_t getMousePos() const;
30
 
31
     /**
32
+     * @return TRUE if last mouse cursor position was updated by precise input device (e.g. mouse)
33
+     */
34
+    ST_CPPEXPORT bool isPreciseCursor() const;
35
+
36
+    /**
37
      * Function creates a GL window.
38
      * @return true on success
39
      */
40
@@ -336,6 +342,11 @@
41
     ST_CPPEXPORT void stglSwap();
42
 
43
     /**
44
+     * Return window aspect ratio (width / height in normal case).
45
+     */
46
+    ST_CPPEXPORT double stglAspectRatio() const;
47
+
48
+    /**
49
      * Get viewport for specified subwindow (to handle tiled presentation).
50
      * @param theWinEnum subwindow ID
51
      * @return rectangle within window from bottom-left corner (ready for OpenGL calls)
52
@@ -394,6 +405,11 @@
53
     ST_CPPEXPORT virtual void getDevices(StOutDevicesList& theList) const;
54
 
55
     /**
56
+     * Return true if 3D output requires fullscreen mode.
57
+     */
58
+    ST_CPPEXPORT virtual bool isStereoFullscreenOnly() const;
59
+
60
+    /**
61
      * @return true if stereo output enabled
62
      */
63
     ST_CPPEXPORT bool isStereoOutput() const;
64
@@ -448,6 +464,12 @@
65
     ST_CPPEXPORT virtual void setTrackOrientation(const bool theToTrack);
66
 
67
     /**
68
+     * Setup visibility of system bars.
69
+     */
70
+    ST_CPPEXPORT void setHideSystemBars(bool theToHideStatusBar,
71
+                                        bool theToHideNavBar);
72
+
73
+    /**
74
      * Return device orientation (for head-tracking) within right-handed coordinate system:
75
      * - Y is positive in up direction (towards the sky, perpendicular to the ground).
76
      * - X is positive to the right (tangential to the ground).
77
@@ -456,6 +478,11 @@
78
     ST_CPPEXPORT virtual StQuaternion<double> getDeviceOrientation() const;
79
 
80
     /**
81
+     * Return TRUE if Left/Right eyes should be swapped by external event.
82
+     */
83
+    ST_CPPEXPORT virtual bool toSwapEyesHW() const;
84
+
85
+    /**
86
      * Retrieve options list.
87
      */
88
     ST_CPPEXPORT virtual void getOptions(StParamsList& theList) const;
89
@@ -573,6 +600,12 @@
90
      */
91
     ST_CPPEXPORT StRectI_t defaultRect(const StMonitor* theMon = NULL) const;
92
 
93
+    /**
94
+     * Setup forced window aspect ratio.
95
+     * When negative value is given (default is -1), aspect ratio will be automatically computed as window (width/height).
96
+     */
97
+    ST_CPPEXPORT void setForcedAspect(double theAspect);
98
+
99
         public:
100
 
101
     ST_CPPEXPORT void* getNativeOglWin() const;
102
@@ -587,7 +620,6 @@
103
         protected:
104
 
105
     StHandle<StMsgQueue>        myMsgQueue;       //!< messages queue
106
-    StMarginsI                  myMargins;        //!< GUI margins
107
     bool                        myWasUsed;        //!< flag indicates that window has been actually used (created)
108
     bool                        myIsForcedStereo; //!< flag to force stereo output for mono sources
109
 
110
sview-16_06.tar.gz/include/StFile/StRawFile.h -> sview-17_04.tar.gz/include/StFile/StRawFile.h Changed
15
 
1
@@ -118,10 +118,12 @@
2
      * Fill the buffer with file content.
3
      * @param theFilePath the file path
4
      * @param theOpenedFd when specified, already opened file descriptor will be used; passed descriptor will be automatically closed
5
+     * @param theReadMax  limit reading by specified number of bytes (0 means full file)
6
      * @return true if file was read
7
      */
8
     ST_CPPEXPORT virtual bool readFile(const StCString& theFilePath = stCString(""),
9
-                                       const int        theOpenedFd = -1);
10
+                                       const int        theOpenedFd = -1,
11
+                                       const size_t     theReadMax  = 0);
12
 
13
     /**
14
      * Write the buffer into the file.
15
sview-16_06.tar.gz/include/StGL/StGLContext.h -> sview-17_04.tar.gz/include/StGL/StGLContext.h Changed
21
 
1
@@ -103,7 +103,9 @@
2
         GlVendor_UNKNOWN,
3
         GlVendor_NVIDIA,
4
         GlVendor_AMD,
5
-        GlVendor_Intel
6
+        GlVendor_Intel,
7
+        GlVendor_Qualcomm,
8
+        GlVendor_ImaginationTechnologies,
9
     };
10
 
11
     enum GPU_Name {
12
@@ -112,6 +114,8 @@
13
         GPU_QUADRO,
14
         GPU_RADEON,
15
         GPU_FIREGL,
16
+        GPU_Adreno,
17
+        GPU_PowerVR,
18
     };
19
 
20
     enum VSync_Mode {
21
sview-16_06.tar.gz/include/StGL/StGLFunctions.h -> sview-17_04.tar.gz/include/StGL/StGLFunctions.h Changed
104
 
1
@@ -61,6 +61,31 @@
2
     #define GL_RGBA8 0x8058
3
     // GL_EXT_texture_format_BGRA8888
4
     #define GL_BGRA_EXT 0x80E1 // same as GL_BGRA on desktop
5
+
6
+    // debug ARB extension
7
+    #define GL_DEBUG_OUTPUT                   0x92E0
8
+    #define GL_DEBUG_OUTPUT_SYNCHRONOUS       0x8242
9
+    #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
10
+    #define GL_DEBUG_CALLBACK_FUNCTION        0x8244
11
+    #define GL_DEBUG_CALLBACK_USER_PARAM      0x8245
12
+    #define GL_DEBUG_SOURCE_API               0x8246
13
+    #define GL_DEBUG_SOURCE_WINDOW_SYSTEM     0x8247
14
+    #define GL_DEBUG_SOURCE_SHADER_COMPILER   0x8248
15
+    #define GL_DEBUG_SOURCE_THIRD_PARTY       0x8249
16
+    #define GL_DEBUG_SOURCE_APPLICATION       0x824A
17
+    #define GL_DEBUG_SOURCE_OTHER             0x824B
18
+    #define GL_DEBUG_TYPE_ERROR               0x824C
19
+    #define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
20
+    #define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR  0x824E
21
+    #define GL_DEBUG_TYPE_PORTABILITY         0x824F
22
+    #define GL_DEBUG_TYPE_PERFORMANCE         0x8250
23
+    #define GL_DEBUG_TYPE_OTHER               0x8251
24
+    #define GL_MAX_DEBUG_MESSAGE_LENGTH       0x9143
25
+    #define GL_MAX_DEBUG_LOGGED_MESSAGES      0x9144
26
+    #define GL_DEBUG_LOGGED_MESSAGES          0x9145
27
+    #define GL_DEBUG_SEVERITY_HIGH            0x9146
28
+    #define GL_DEBUG_SEVERITY_MEDIUM          0x9147
29
+    #define GL_DEBUG_SEVERITY_LOW             0x9148
30
 #else
31
     #include <GL/gl.h>
32
 #endif
33
@@ -614,6 +639,27 @@
34
         }
35
     }
36
 
37
+        public: //! @name GL_KHR_debug (optional)
38
+
39
+    typedef void   (APIENTRY  *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam);
40
+
41
+    typedef void   (APIENTRYP glDebugMessageControl_t ) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);
42
+    typedef void   (APIENTRYP glDebugMessageInsert_t  ) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf);
43
+    typedef void   (APIENTRYP glDebugMessageCallback_t) (GLDEBUGPROCARB callback, const void* userParam);
44
+    typedef GLuint (APIENTRYP glGetDebugMessageLog_t  ) (GLuint   count,
45
+                                                         GLsizei  bufSize,
46
+                                                         GLenum*  sources,
47
+                                                         GLenum*  types,
48
+                                                         GLuint*  ids,
49
+                                                         GLenum*  severities,
50
+                                                         GLsizei* lengths,
51
+                                                         GLchar*  messageLog);
52
+
53
+    glDebugMessageControl_t  glDebugMessageControl;
54
+    glDebugMessageInsert_t   glDebugMessageInsert;
55
+    glDebugMessageCallback_t glDebugMessageCallback;
56
+    glGetDebugMessageLog_t   glGetDebugMessageLog;
57
+
58
 #else
59
 
60
         public: //! @name OpenGL 1.2
61
@@ -1303,13 +1349,6 @@
62
     PFNGLBINDIMAGETEXTURESPROC glBindImageTextures;
63
     PFNGLBINDVERTEXBUFFERSPROC glBindVertexBuffers;
64
 
65
-        public: //! @name GL_ARB_debug_output (optional)
66
-
67
-    PFNGLDEBUGMESSAGECONTROLARBPROC  glDebugMessageControlARB;
68
-    PFNGLDEBUGMESSAGEINSERTARBPROC   glDebugMessageInsertARB;
69
-    PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
70
-    PFNGLGETDEBUGMESSAGELOGARBPROC   glGetDebugMessageLogARB;
71
-
72
 #if defined(_WIN32)
73
         public: //! @name wgl extensions
74
 
75
@@ -1459,6 +1498,28 @@
76
     #define WGL_ACCESS_WRITE_DISCARD_NV 0x0002
77
 #endif
78
 
79
+        // WGL_AMD_gpu_association
80
+
81
+#ifndef WGL_GPU_VENDOR_AMD
82
+    #define WGL_GPU_VENDOR_AMD                 0x1F00
83
+    #define WGL_GPU_RENDERER_STRING_AMD        0x1F01
84
+    #define WGL_GPU_OPENGL_VERSION_STRING_AMD  0x1F02
85
+    #define WGL_GPU_FASTEST_TARGET_GPUS_AMD    0x21A2
86
+    #define WGL_GPU_RAM_AMD                    0x21A3
87
+    #define WGL_GPU_CLOCK_AMD                  0x21A4
88
+    #define WGL_GPU_NUM_PIPES_AMD              0x21A5
89
+    #define WGL_GPU_NUM_SIMD_AMD               0x21A6
90
+    #define WGL_GPU_NUM_RB_AMD                 0x21A7
91
+    #define WGL_GPU_NUM_SPI_AMD                0x21A8
92
+#endif
93
+
94
+    typedef UINT (WINAPI *wglGetGPUIDsAMD_t       )(UINT theMaxCount, UINT* theIds);
95
+    typedef INT  (WINAPI *wglGetGPUInfoAMD_t      )(UINT theId, INT theProperty, GLenum theDataType, UINT theSize, void* theData);
96
+    typedef UINT (WINAPI *wglGetContextGPUIDAMD_t )(HGLRC theHglrc);
97
+    wglGetGPUIDsAMD_t       wglGetGPUIDsAMD;
98
+    wglGetGPUInfoAMD_t      wglGetGPUInfoAMD;
99
+    wglGetContextGPUIDAMD_t wglGetContextGPUIDAMD;
100
+
101
 #elif defined(__APPLE__)
102
         public: //! @name CGL extensions
103
 
104
sview-16_06.tar.gz/include/StGL/StGLTextFormatter.h -> sview-17_04.tar.gz/include/StGL/StGLTextFormatter.h Changed
46
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2012-2014 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2012-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * Distributed under the Boost Software License, Version 1.0.
7
  * See accompanying file license-boost.txt or copy at
8
@@ -11,6 +11,8 @@
9
 
10
 #include <StGL/StGLFont.h>
11
 
12
+#include <vector>
13
+
14
 class StGLVertexBuffer;
15
 
16
 template<> inline void StArray< StHandle <StArrayList <StGLVec2> > >::sort() {}
17
@@ -125,15 +127,15 @@
18
     /**
19
      * Retrieve formatting results.
20
      */
21
-    ST_CPPEXPORT void getResult(StArrayList<GLuint>&                               theTextures,
22
-                                StArrayList< StHandle <StArrayList <StGLVec2> > >& theVertsPerTexture,
23
-                                StArrayList< StHandle <StArrayList <StGLVec2> > >& theTCrdsPerTexture) const;
24
+    ST_CPPEXPORT void getResult(std::vector<GLuint>&                               theTextures,
25
+                                std::vector< StHandle < std::vector<StGLVec2> > >& theVertsPerTexture,
26
+                                std::vector< StHandle < std::vector<StGLVec2> > >& theTCrdsPerTexture) const;
27
 
28
     /**
29
      * Retrieve formatting results.
30
      */
31
     ST_CPPEXPORT void getResult(StGLContext&                                theCtx,
32
-                                StArrayList<GLuint>&                        theTextures,
33
+                                std::vector<GLuint>&                        theTextures,
34
                                 StArrayList< StHandle <StGLVertexBuffer> >& theVertsPerTexture,
35
                                 StArrayList< StHandle <StGLVertexBuffer> >& theTCrdsPerTexture) const;
36
 
37
@@ -186,7 +188,7 @@
38
 
39
     StString              myString;        //!< currently rendered text
40
     StGLVec2              myPen;           //!< current pen position
41
-    StArrayList<StGLTile> myRects;         //!< glyphs rectangles
42
+    std::vector<StGLTile> myRects;         //!< glyphs rectangles
43
     size_t                myRectsNb;       //!< rectangles number
44
     GLfloat               myLineSpacing;   //!< line spacing (computed as maximum of all fonts involved in text formatting)
45
     GLfloat               myAscender;      //!<
46
sview-16_06.tar.gz/include/StGL/StGLVertexBuffer.h -> sview-17_04.tar.gz/include/StGL/StGLVertexBuffer.h Changed
32
 
1
@@ -14,6 +14,8 @@
2
 #include <StGL/StGLVec.h>
3
 #include <StGL/StGLResource.h>
4
 
5
+#include <vector>
6
+
7
 /**
8
  * Enumeration indicates the data stored in VBO.
9
  */
10
@@ -105,6 +107,21 @@
11
         return init(theCtx, 4, GLsizeiptr(theArray.size()), theArray.getFirst().getData());
12
     }
13
 
14
+    ST_LOCAL bool init(StGLContext& theCtx,
15
+                       const std::vector<StGLVec2>& theArray) {
16
+        return init(theCtx, 2, GLsizeiptr(theArray.size()), theArray.front().getData());
17
+    }
18
+
19
+    ST_LOCAL bool init(StGLContext& theCtx,
20
+                       const std::vector<StGLVec3>& theArray) {
21
+        return init(theCtx, 3, GLsizeiptr(theArray.size()), theArray.front().getData());
22
+    }
23
+
24
+    ST_LOCAL bool init(StGLContext& theCtx,
25
+                       const std::vector<StGLVec4>& theArray) {
26
+        return init(theCtx, 4, GLsizeiptr(theArray.size()), theArray.front().getData());
27
+    }
28
+
29
     ST_CPPEXPORT bool init(StGLContext&   theCtx,
30
                            GLsizeiptr     theElemSize,
31
                            GLsizeiptr     theElemsCount,
32
sview-16_06.tar.gz/include/StGL/StParams.h -> sview-17_04.tar.gz/include/StGL/StParams.h Changed
201
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * Distributed under the Boost Software License, Version 1.0.
7
  * See accompanying file license-boost.txt or copy at
8
@@ -15,35 +15,38 @@
9
 #include <StTemplates/StHandle.h>
10
 
11
 /**
12
+ * Surface to map image onto.
13
+ */
14
+enum StViewSurface {
15
+    StViewSurface_Plain,   //!< normal 2D image
16
+    StViewSurface_Cubemap, //!< cubemap texture
17
+    StViewSurface_Sphere,  //!< spherical panorama
18
+    //StViewSurface_Cylinder, //!< cylindrical panorama
19
+};
20
+
21
+/**
22
  * Common parameters for stereo image representation.
23
  */
24
 class StStereoParams {
25
 
26
         public:
27
 
28
-    enum ViewMode {
29
-        FLAT_IMAGE,        //!< normal 2D image
30
-        PANORAMA_CUBEMAP,  //!< cubemap texture
31
-        PANORAMA_SPHERE,   //!< spherical panorama
32
-        //PANORAMA_CYLINDER, //!< cylindrical panorama
33
-    };
34
-
35
-    static StString GET_VIEW_MODE_NAME(ViewMode theViewMode) {
36
+    static StString GET_VIEW_MODE_NAME(StViewSurface theViewMode) {
37
         switch(theViewMode) {
38
-            case PANORAMA_CUBEMAP: return "cubemap";
39
-            case PANORAMA_SPHERE:  return "sphere";
40
-            case FLAT_IMAGE:
41
-            default:               return "flat";
42
+            case StViewSurface_Cubemap: return "cubemap";
43
+            case StViewSurface_Sphere:  return "sphere";
44
+            case StViewSurface_Plain:   return "flat";
45
         }
46
+        return "flat";
47
     }
48
 
49
-    static ViewMode GET_VIEW_MODE_FROM_STRING(const StString& theViewModeStr) {
50
+    static StViewSurface GET_VIEW_MODE_FROM_STRING(const StString& theViewModeStr) {
51
         if(theViewModeStr.isStartsWithIgnoreCase(stCString("cubemap"))) {
52
-            return PANORAMA_CUBEMAP;
53
+            return StViewSurface_Cubemap;
54
         } else if(theViewModeStr.isStartsWithIgnoreCase(stCString("sphere"))) {
55
-            return PANORAMA_SPHERE;
56
+            return StViewSurface_Sphere;
57
         } else {
58
-            return FLAT_IMAGE;
59
+            return StViewSurface_Plain;
60
         }
61
     }
62
 
63
@@ -57,13 +60,12 @@
64
       Src1SizeY(0),
65
       Src2SizeX(0),
66
       Src2SizeY(0),
67
-      ViewingMode(FLAT_IMAGE),
68
+      ViewingMode(StViewSurface_Plain),
69
       Timestamp(0.0f),
70
       StereoFormat(StFormat_Mono),
71
       ToSwapLR(false),
72
+      ToFlipCubeZ(false),
73
       PanCenter(0.0f, 0.0f),
74
-      PanTheta(0.0f),
75
-      PanPhi(0.0f),
76
       ScaleFactor(1.0f),
77
       mySepDxPx(0),
78
       mySepDxZeroPx(0),
79
@@ -72,6 +74,10 @@
80
       myXRotateDegrees(0.0f),
81
       myYRotateDegrees(0.0f),
82
       myZRotateDegrees(0.0f),
83
+      myPanYaw(0.0f),
84
+      myPanPitch(0.0f),
85
+      myPanYawZero(0.0f),
86
+      myPanPitchZero(0.0f),
87
       myZRotateZero(0.0f) {
88
         //
89
     }
90
@@ -84,36 +90,24 @@
91
     }
92
 
93
     /**
94
-     * Switch to the next viewing mode.
95
-     */
96
-    void nextViewMode() {
97
-        switch(ViewingMode) {
98
-            case FLAT_IMAGE:        ViewingMode = PANORAMA_SPHERE; break;
99
-            case PANORAMA_CUBEMAP:
100
-            case PANORAMA_SPHERE:
101
-            default:                ViewingMode = FLAT_IMAGE;
102
-        }
103
-    }
104
-
105
-    /**
106
      * @return horizontal separation in pixels.
107
      * This number means delta between views.
108
      */
109
-    GLint getSeparationDx() const {
110
+    int getSeparationDx() const {
111
         return mySepDxZeroPx + mySepDxPx;
112
     }
113
 
114
     /**
115
      * Set horizontal separation in pixels.
116
      */
117
-    void setSeparationDx(const GLint theValue) {
118
+    void setSeparationDx(int theValue) {
119
         mySepDxPx = theValue - mySepDxZeroPx;
120
     }
121
 
122
     /**
123
      * Setup neutral point.
124
      */
125
-    void setSeparationNeutral(const GLint theSepDx = 0) {
126
+    void setSeparationNeutral(int theSepDx = 0) {
127
         mySepDxZeroPx = theSepDx;
128
     }
129
 
130
@@ -128,67 +122,99 @@
131
     /**
132
      * Set vertical separation in pixels.
133
      */
134
-    void setSeparationDy(const GLint theValue) {
135
+    void setSeparationDy(int theValue) {
136
         mySepDyPx = theValue;
137
     }
138
 
139
     /**
140
      * @return angular separation between views in degrees.
141
      */
142
-    GLfloat getSepRotation() const {
143
+    float getSepRotation() const {
144
         return mySepRotDegrees;
145
     }
146
 
147
     /**
148
      * @return angular separation between views in degrees.
149
      */
150
-    void setSepRotation(GLfloat theValue) {
151
+    void setSepRotation(float theValue) {
152
         mySepRotDegrees = theValue;
153
     }
154
 
155
     /**
156
+     * @return angle for panorama view
157
+     */
158
+    float getPanYaw() const {
159
+        return myPanYawZero + myPanYaw;
160
+    }
161
+
162
+    /**
163
+     * @return angle for panorama view
164
+     */
165
+    float getPanPitch() const {
166
+        return myPanPitchZero + myPanPitch;
167
+    }
168
+
169
+    /**
170
      * @return rotation angle in degrees.
171
      */
172
-    GLfloat getXRotate() const {
173
+    float getXRotate() const {
174
         return myXRotateDegrees;
175
     }
176
 
177
     /**
178
      * Change rotation angle in degrees.
179
      */
180
-    void setXRotate(const GLfloat theValue) {
181
+    void setXRotate(float theValue) {
182
         myXRotateDegrees = theValue;
183
     }
184
 
185
     /**
186
      * @return rotation angle in degrees.
187
      */
188
-    GLfloat getYRotate() const {
189
+    float getYRotate() const {
190
         return myYRotateDegrees;
191
     }
192
 
193
     /**
194
      * Change rotation angle in degrees.
195
      */
196
-    void setYRotate(const GLfloat theValue) {
197
+    void setYRotate(float theValue) {
198
         myYRotateDegrees = theValue;
199
     }
200
 
201
sview-17_04.tar.gz/include/StGLMesh/StGLTextureQuad.h Added
82
 
1
@@ -0,0 +1,80 @@
2
+/**
3
+ * Copyright © 2017 Kirill Gavrilov <kirill@sview.ru>
4
+ *
5
+ * Distributed under the Boost Software License, Version 1.0.
6
+ * See accompanying file license-boost.txt or copy at
7
+ * http://www.boost.org/LICENSE_1_0.txt
8
+ */
9
+
10
+#ifndef __StGLTextureQuad_h_
11
+#define __StGLTextureQuad_h_
12
+
13
+#include <StGL/StGLTexture.h>
14
+
15
+#include "StGLMesh.h"
16
+
17
+#include <StGLCore/StGLCore20.h>
18
+
19
+class StGLTextureQuad : public StGLTexture {
20
+
21
+        public:
22
+
23
+    StGLTextureQuad() : StGLTexture(GL_RGBA8) {
24
+        //
25
+    }
26
+
27
+    void stglDraw(StGLContext& theCtx) {
28
+        if(!isValid()) {
29
+            return;
30
+        }
31
+
32
+    #if !defined(GL_ES_VERSION_2_0)
33
+        theCtx.core20fwd->glDisable(GL_DEPTH_TEST);
34
+        theCtx.core20fwd->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
35
+        theCtx.core20fwd->glEnable(GL_BLEND);
36
+        theCtx.core11->glEnable(GL_TEXTURE_2D);
37
+
38
+        StGLTexture::bind(theCtx);
39
+
40
+        const StGLBoxPx aVPort = theCtx.stglViewport();
41
+        const int aWinSizeX = aVPort.width();
42
+        const int aWinSizeY = aVPort.height();
43
+        const GLfloat aWidth  = (aWinSizeX > 0) ?        GLfloat(getSizeX()) / GLfloat(aWinSizeX) : 1.0f;
44
+        const GLfloat aBottom = (aWinSizeY > 0) ? 100.0f / GLfloat(aWinSizeY) : 0.0f;
45
+        const GLfloat aHeight = (aWinSizeY > 0) ? 2.0f * GLfloat(getSizeY()) / GLfloat(aWinSizeY) : 1.0f;
46
+
47
+        const GLfloat aVerts[] = {
48
+             aWidth, -1.0f + aBottom + aHeight,
49
+             aWidth, -1.0f + aBottom,
50
+            -aWidth, -1.0f + aBottom + aHeight,
51
+            -aWidth, -1.0f + aBottom,
52
+        };
53
+
54
+        const GLfloat aTCrds[] = {
55
+            1.0f, 0.0f, // top-right
56
+            1.0f, 1.0f, // bottom-right
57
+            0.0f, 0.0f, // top-left
58
+            0.0f, 1.0f  // bottom-left
59
+        };
60
+
61
+        theCtx.core11->glLoadIdentity();
62
+
63
+        theCtx.core11->glEnableClientState(GL_VERTEX_ARRAY);
64
+        theCtx.core11->glVertexPointer(2, GL_FLOAT, 0, aVerts);
65
+        theCtx.core11->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
66
+        theCtx.core11->glTexCoordPointer(2, GL_FLOAT, 0, aTCrds);
67
+
68
+        theCtx.core11fwd->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
69
+
70
+        theCtx.core11->glDisableClientState(GL_TEXTURE_COORD_ARRAY);
71
+        theCtx.core11->glDisableClientState(GL_VERTEX_ARRAY);
72
+
73
+        StGLTexture::unbind(theCtx);
74
+        theCtx.core11->glDisable(GL_TEXTURE_2D);
75
+        theCtx.core20fwd->glDisable(GL_BLEND);
76
+    #endif
77
+    }
78
+
79
+};
80
+
81
+#endif // __StGLTextureQuad_h_
82
sview-16_06.tar.gz/include/StGLStereo/StGLProjCamera.h -> sview-17_04.tar.gz/include/StGLStereo/StGLProjCamera.h Changed
28
 
1
@@ -1,5 +1,5 @@
2
 /**
3
- * Copyright © 2010-2013 Kirill Gavrilov <kirill@sview.ru>
4
+ * Copyright © 2010-2017 Kirill Gavrilov <kirill@sview.ru>
5
  *
6
  * Distributed under the Boost Software License, Version 1.0.
7
  * See accompanying file license-boost.txt or copy at
8
@@ -197,15 +197,14 @@
9
     /**
10
      * Recompute projection matrix.
11
      */
12
-    ST_CPPEXPORT void resize(const GLfloat theAspect);
13
+    ST_CPPEXPORT void resize(const float theAspect);
14
 
15
     /**
16
      * Recompute projection matrix.
17
      */
18
-    ST_LOCAL void resize(const GLsizei theSizeX,
19
-                         const GLsizei theSizeY) {
20
-        const GLsizei aSizeY = (theSizeY > 0) ? theSizeY : 1;
21
-        resize(GLfloat(theSizeX) / GLfloat(aSizeY));
22
+    ST_LOCAL void resize(int theSizeX,
23
+                         int theSizeY) {
24
+        resize(float(theSizeX) / float(theSizeY > 0 ? theSizeY : 1));
25
     }
26
 
27
     /**
28
sview-16_06.tar.gz/include/StGLStereo/StGLStereoTexture.h -> sview-17_04.tar.gz/include/StGLStereo/StGLStereoTexture.h Changed
22
 
1
@@ -143,6 +143,20 @@
2
         myTextures[RIGHT_TEXTURE].setMinMagFilter(theCtx, theMinMagFilter);
3
     }
4
 
5
+    /**
6
+     * Return the left texture object.
7
+     */
8
+    const StGLTexture& getTextureLeft() const {
9
+        return myTextures[LEFT_TEXTURE];
10
+    }
11
+
12
+    /**
13
+     * Return the right texture object.
14
+     */
15
+    const StGLTexture& getTextureRight() const {
16
+        return myTextures[RIGHT_TEXTURE];
17
+    }
18
+
19
         protected:
20
 
21
     StGLTexture myTextures[2];
22
sview-16_06.tar.gz/include/StGLWidgets/StGLCheckboxTextured.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLCheckboxTextured.h Changed
11
 
1
@@ -34,7 +34,8 @@
2
      * Destructor.
3
      */
4
     ST_CPPEXPORT virtual ~StGLCheckboxTextured();
5
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo) ST_ATTR_OVERRIDE;
6
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo,
7
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
8
 
9
     /**
10
      * Return tracked value.
11
sview-16_06.tar.gz/include/StGLWidgets/StGLDescription.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLDescription.h Changed
15
 
1
@@ -19,10 +19,10 @@
2
     /**
3
      * Creates description widget with default size 256x96.
4
      */
5
-    ST_CPPEXPORT StGLDescription(StGLWidget* theParent);
6
+    ST_CPPEXPORT StGLDescription(StGLRootWidget* theParent);
7
 
8
-    ST_CPPEXPORT StGLDescription(StGLWidget* theParent,
9
-                                 const int   theWidth);
10
+    ST_CPPEXPORT StGLDescription(StGLRootWidget* theParent,
11
+                                 const int theWidth);
12
 
13
     ST_CPPEXPORT virtual ~StGLDescription();
14
 
15
sview-16_06.tar.gz/include/StGLWidgets/StGLImageProgram.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLImageProgram.h Changed
27
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2010-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2010-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -114,6 +114,9 @@
10
     ST_CPPEXPORT void setTextureUVDataSize(StGLContext&    theCtx,
11
                                            const StGLVec4& theTexDataVec4);
12
 
13
+    ST_CPPEXPORT void setCubeTextureFlipZ(StGLContext&    theCtx,
14
+                                          bool theToFlip);
15
+
16
     ST_LOCAL void setColorScale(const StGLVec3& theScale) {
17
         myColorScale = theScale;
18
     }
19
@@ -160,6 +163,7 @@
20
     StGLVarLocation uniTexUVDataLoc;
21
     StGLVarLocation uniTexSizePxLoc;
22
     StGLVarLocation uniTexelSizePxLoc;
23
+    StGLVarLocation uniTexCubeFlipZLoc;
24
     StGLVarLocation uniColorProcessingLoc;
25
     StGLVarLocation uniGammaLoc;
26
 
27
sview-16_06.tar.gz/include/StGLWidgets/StGLImageRegion.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLImageRegion.h Changed
76
 
1
@@ -112,6 +112,27 @@
2
     ST_CPPEXPORT StHandle<StStereoParams> getSource();
3
 
4
     /**
5
+     * Compute the head orientation.
6
+     * @param theView view identifier (to apply stereo separation)
7
+     * @param theToApplyDefShift if TRUE the default transformation will be applied (stored in the file + 90 degrees Yaw shift)
8
+     */
9
+    ST_LOCAL StGLQuaternion getHeadOrientation(unsigned int theView,
10
+                                               const bool theToApplyDefShift) const {
11
+        StGLQuaternion anOri;
12
+        getHeadOrientation(anOri, theView, theToApplyDefShift);
13
+        return anOri;
14
+    }
15
+
16
+    /**
17
+     * Compute the head orientation.
18
+     * @param theView view identifier (to apply stereo separation)
19
+     * @param theToApplyDefShift if TRUE the default transformation will be applied (stored in the file + 90 degrees Yaw shift)
20
+     */
21
+    ST_CPPEXPORT bool getHeadOrientation(StGLQuaternion& theOrient,
22
+                                         unsigned int theView,
23
+                                         const bool theToApplyDefShift) const;
24
+
25
+    /**
26
      * Return true if there is any video stream.
27
      */
28
     ST_LOCAL bool hasVideoStream() { return myHasVideoStream; }
29
@@ -125,7 +146,8 @@
30
     }
31
 
32
     ST_CPPEXPORT virtual ~StGLImageRegion();
33
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& thePointZo) ST_ATTR_OVERRIDE;
34
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& thePointZo,
35
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
36
     ST_CPPEXPORT virtual bool stglInit() ST_ATTR_OVERRIDE;
37
     ST_CPPEXPORT virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
38
     ST_CPPEXPORT virtual bool tryClick  (const StClickEvent& theEvent, bool& theIsItemClicked)   ST_ATTR_OVERRIDE;
39
@@ -221,16 +243,16 @@
40
     ST_LOCAL void doParamsModeNext(const size_t ) {
41
         const int aMode = params.ViewMode->getValue();
42
         switch(aMode) {
43
-            case StStereoParams::FLAT_IMAGE: {
44
-                params.ViewMode->setValue(StStereoParams::PANORAMA_SPHERE);
45
+            case StViewSurface_Plain: {
46
+                params.ViewMode->setValue(StViewSurface_Sphere);
47
                 return;
48
             }
49
-            case StStereoParams::PANORAMA_CUBEMAP: {
50
-                params.ViewMode->setValue(StStereoParams::FLAT_IMAGE);
51
+            case StViewSurface_Cubemap: {
52
+                params.ViewMode->setValue(StViewSurface_Plain);
53
                 return;
54
             }
55
-            case StStereoParams::PANORAMA_SPHERE: {
56
-                params.ViewMode->setValue(StStereoParams::PANORAMA_CUBEMAP);
57
+            case StViewSurface_Sphere: {
58
+                params.ViewMode->setValue(StViewSurface_Cubemap);
59
                 return;
60
             }
61
         }
62
@@ -269,10 +291,10 @@
63
 
64
 
65
     ST_LOCAL StGLVec2 getMouseMoveFlat(const StPointD_t& theCursorZoFrom,
66
-                                       const StPointD_t& theCursorZoTo);
67
+                                       const StPointD_t& theCursorZoTo) const;
68
     ST_LOCAL StGLVec2 getMouseMoveSphere(const StPointD_t& theCursorZoFrom,
69
-                                         const StPointD_t& theCursorZoTo);
70
-    ST_LOCAL StGLVec2 getMouseMoveSphere();
71
+                                         const StPointD_t& theCursorZoTo) const;
72
+    ST_LOCAL StGLVec2 getMouseMoveSphere() const;
73
 
74
     ST_LOCAL void scaleAt(const StPointD_t& thePoint,
75
                           const float       theStep);
76
sview-16_06.tar.gz/include/StGLWidgets/StGLMenuItem.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLMenuItem.h Changed
33
 
1
@@ -46,7 +46,8 @@
2
 
3
     ST_CPPEXPORT virtual ~StGLMenuItem();
4
 
5
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo) ST_ATTR_OVERRIDE;
6
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo,
7
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
8
     ST_CPPEXPORT virtual void stglResize() ST_ATTR_OVERRIDE;
9
     ST_CPPEXPORT virtual bool stglInit() ST_ATTR_OVERRIDE;
10
     ST_CPPEXPORT virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
11
@@ -148,8 +149,9 @@
12
 
13
         protected:
14
 
15
-    ST_LOCAL void stglUpdateTextArea(const StPointD_t& theCursorZo) {
16
-        StGLTextArea::stglUpdate(theCursorZo);
17
+    ST_LOCAL void stglUpdateTextArea(const StPointD_t& theCursorZo,
18
+                                     bool theIsPreciseInput) {
19
+        StGLTextArea::stglUpdate(theCursorZo, theIsPreciseInput);
20
     }
21
 
22
         private: //! @name private methods
23
@@ -183,7 +185,8 @@
24
         public:
25
 
26
     ST_CPPEXPORT StGLPassiveMenuItem(StGLMenu* theParent);
27
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo) ST_ATTR_OVERRIDE;
28
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo,
29
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
30
 
31
 };
32
 
33
sview-16_06.tar.gz/include/StGLWidgets/StGLMsgStack.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLMsgStack.h Changed
11
 
1
@@ -24,7 +24,8 @@
2
                               const StHandle<StMsgQueue>& theMsgQueue);
3
     ST_CPPEXPORT virtual ~StGLMsgStack();
4
     ST_CPPEXPORT virtual void stglResize() ST_ATTR_OVERRIDE;
5
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& thePointZo) ST_ATTR_OVERRIDE;
6
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& thePointZo,
7
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
8
 
9
         private:
10
 
11
sview-16_06.tar.gz/include/StGLWidgets/StGLPlayList.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLPlayList.h Changed
11
 
1
@@ -30,7 +30,8 @@
2
     ST_CPPEXPORT virtual ~StGLPlayList();
3
     ST_CPPEXPORT virtual bool stglInit() ST_ATTR_OVERRIDE;
4
     ST_CPPEXPORT virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
5
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo) ST_ATTR_OVERRIDE;
6
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo,
7
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
8
     ST_CPPEXPORT virtual void stglResize() ST_ATTR_OVERRIDE;
9
     ST_CPPEXPORT virtual bool doScroll(const StScrollEvent& theEvent) ST_ATTR_OVERRIDE;
10
 
11
sview-16_06.tar.gz/include/StGLWidgets/StGLRangeFieldFloat32.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLRangeFieldFloat32.h Changed
70
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2013-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2013-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -11,17 +11,22 @@
10
 #define __StGLRangeFieldFloat32_h_
11
 
12
 #include <StSettings/StFloat32Param.h>
13
-#include <StGLWidgets/StGLWidget.h>
14
+#include <StGLWidgets/StGLSeekBar.h>
15
 
16
 class StGLTextArea;
17
 
18
 /**
19
  * This is radio button for float value.
20
  */
21
-class StGLRangeFieldFloat32 : public StGLWidget {
22
+class StGLRangeFieldFloat32 : public StGLSeekBar {
23
 
24
         public:
25
 
26
+    enum RangeStyle {
27
+        RangeStyle_PlusMinus,
28
+        RangeStyle_Seekbar,
29
+    };
30
+
31
     enum FieldColor {
32
         FieldColor_Default,
33
         FieldColor_Positive,
34
@@ -36,11 +41,15 @@
35
      */
36
     ST_CPPEXPORT StGLRangeFieldFloat32(StGLWidget* theParent,
37
                                        const StHandle<StFloat32Param>& theTrackedValue,
38
-                                       const int theLeft = 0, const int theTop = 0,
39
-                                       const StGLCorner theCorner = StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT));
40
+                                       int theLeft = 0, int theTop = 0,
41
+                                       StGLCorner theCorner = StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT),
42
+                                       RangeStyle theStyle = RangeStyle_PlusMinus,
43
+                                       int theMargin = 0);
44
 
45
     ST_CPPEXPORT virtual ~StGLRangeFieldFloat32();
46
     ST_CPPEXPORT virtual bool stglInit() ST_ATTR_OVERRIDE;
47
+    ST_CPPEXPORT virtual void stglResize() ST_ATTR_OVERRIDE;
48
+    ST_CPPEXPORT virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
49
     ST_CPPEXPORT virtual bool doScroll(const StScrollEvent& theEvent) ST_ATTR_OVERRIDE;
50
 
51
         public:
52
@@ -58,6 +67,9 @@
53
     ST_CPPEXPORT void doDecrement(const size_t );
54
     ST_CPPEXPORT void doIncrement(const size_t );
55
 
56
+    ST_CPPEXPORT void doSeekClick(const int    theMouseBtn,
57
+                                  const double theValue);
58
+
59
         private:
60
 
61
     ST_LOCAL void onValueChange(const float theValue);
62
@@ -68,6 +80,7 @@
63
     StGLVec3                 myColors[FieldColorNb];
64
     StGLTextArea*            myValueText;  //!< text area
65
     StString                 myFormat;     //!< value format
66
+    RangeStyle               myRangeStyle;
67
 
68
 };
69
 
70
sview-16_06.tar.gz/include/StGLWidgets/StGLRootWidget.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLRootWidget.h Changed
113
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2009-2016 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -268,16 +268,46 @@
10
         return myScaleGlY;
11
     }
12
 
13
-    inline StRectD_t getRootRectGl() const {
14
+    /**
15
+     * Return the full width of the window (including non-working area)
16
+     */
17
+    ST_LOCAL int getRootFullSizeX() const {
18
+        return myRectPxFull.width();
19
+    }
20
+
21
+    /**
22
+     * Return the full height of the window (including non-working area)
23
+     */
24
+    ST_LOCAL int getRootFullSizeY() const {
25
+        return myRectPxFull.height();
26
+    }
27
+
28
+    /**
29
+     * Return GL coordinates for entire root widget (including non-working area).
30
+     */
31
+    ST_LOCAL StRectD_t getRootRectGl() const {
32
         return myRectGl;
33
     }
34
 
35
+    /**
36
+     * Return GL coordinates for working area within root widget.
37
+     */
38
+    ST_LOCAL StRectD_t getRootWorkRectGl() const {
39
+        return myRectWorkGl;
40
+    }
41
+
42
     ST_LOCAL const StMarginsI& getRootMargins() const {
43
         return myMarginsPx;
44
     }
45
 
46
-    ST_LOCAL StMarginsI& changeRootMargins() {
47
-        return myMarginsPx;
48
+    /**
49
+     * Return scale factor to downscale the main image for VR (e.g. with HMD having great FOV),
50
+     * or 1.0 for normal displays.
51
+     */
52
+    ST_LOCAL double getVrZoomOut() const {
53
+        return myMarginsPx.top != 0
54
+             ? 0.74 //1.0 - double(myMarginsPx.top) / double(getRootFullSizeY())
55
+             : 1.0;
56
     }
57
 
58
     /**
59
@@ -303,7 +333,11 @@
60
      */
61
     ST_CPPEXPORT static size_t generateShareId();
62
 
63
-    ST_LOCAL StGLProjCamera* getCamera() {
64
+    ST_LOCAL const StGLProjCamera* getCamera() const {
65
+        return &myProjCamera;
66
+    }
67
+
68
+    ST_LOCAL StGLProjCamera* changeCamera() {
69
         return &myProjCamera;
70
     }
71
 
72
@@ -388,12 +422,22 @@
73
      * Returns mouse cursor position in GL coordinates.
74
      */
75
     ST_LOCAL const StPointD_t& getCursorZo() const {
76
-        return cursorZo;
77
+        return myCursorZo;
78
     }
79
 
80
     using StGLWidget::stglResize;
81
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo) ST_ATTR_OVERRIDE;
82
-    ST_CPPEXPORT virtual void stglResize(const StGLBoxPx&  theRectPx);
83
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo,
84
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
85
+
86
+    /**
87
+     * Resize root widget in sync with window.
88
+     * @param theViewPort new viewport (width and height)
89
+     * @param theMargins  new margins defining a working area
90
+     * @param theAspect   new aspect ratio (normally width / height)
91
+     */
92
+    ST_CPPEXPORT virtual void stglResize(const StGLBoxPx& theViewPort,
93
+                                         const StMarginsI& theMargins,
94
+                                         float theAspect);
95
 
96
     /**
97
      * @return viewport dimensions from bound GL context (4-indices array)
98
@@ -466,11 +510,13 @@
99
     bool                      myIsMobile;      //!< flag indicating mobile device
100
     StMarginsI                myMarginsPx;     //!< active area margins in pixels
101
     StRectD_t                 myRectGl;        //!< rectangle in GL coordinates
102
+    StRectD_t                 myRectWorkGl;    //!< rectangle of working area in GL coordinates
103
+    StRectI_t                 myRectPxFull;    //!< full rectangle (including non-working area)
104
     GLdouble                  myScaleGlX;      //!< scale factor to optimize convertion from Pixels -> GL coordinates
105
     GLdouble                  myScaleGlY;      //!< scale factor to optimize convertion from Pixels -> GL coordinates
106
     GLfloat                   myScaleGUI;      //!< scale factor for GUI elements (text, icons), 1.0 by default
107
     unsigned int              myResolution;    //!< resolution in DPI (for text rendering), 72 by default, stored with myScaleGUI applied
108
-    StPointD_t                cursorZo;        //!< mouse cursor position
109
+    StPointD_t                myCursorZo;      //!< mouse cursor position
110
     GLint                     myViewport[4];   //!< cached GL viewport
111
 
112
     StArrayList<StGLWidget*>  myDestroyList;   //!< list of widgets to be destroyed
113
sview-16_06.tar.gz/include/StGLWidgets/StGLScrollArea.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLScrollArea.h Changed
11
 
1
@@ -32,7 +32,8 @@
2
     ST_CPPEXPORT virtual bool stglInit() ST_ATTR_OVERRIDE;
3
     ST_CPPEXPORT virtual void stglResize() ST_ATTR_OVERRIDE;
4
     ST_CPPEXPORT virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
5
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo) ST_ATTR_OVERRIDE;
6
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo,
7
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
8
     ST_CPPEXPORT virtual bool tryClick  (const StClickEvent& theEvent, bool& isItemClicked)   ST_ATTR_OVERRIDE;
9
     ST_CPPEXPORT virtual bool tryUnClick(const StClickEvent& theEvent, bool& isItemUnclicked) ST_ATTR_OVERRIDE;
10
     ST_CPPEXPORT virtual bool doScroll(const StScrollEvent& theEvent) ST_ATTR_OVERRIDE;
11
sview-16_06.tar.gz/include/StGLWidgets/StGLSeekBar.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLSeekBar.h Changed
23
 
1
@@ -24,8 +24,9 @@
2
      * Default constructor.
3
      */
4
     ST_CPPEXPORT StGLSeekBar(StGLWidget* theParent,
5
-                             const int   theTop,
6
-                             const int   theMargin);
7
+                             int theTop,
8
+                             int theMargin,
9
+                             StGLCorner theCorner = StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT));
10
 
11
     /**
12
      * Destructor.
13
@@ -45,7 +46,8 @@
14
 
15
     ST_CPPEXPORT virtual void stglResize() ST_ATTR_OVERRIDE;
16
     ST_CPPEXPORT virtual bool stglInit() ST_ATTR_OVERRIDE;
17
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursor) ST_ATTR_OVERRIDE;
18
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursor,
19
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
20
     ST_CPPEXPORT virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
21
     ST_CPPEXPORT virtual bool doScroll(const StScrollEvent& theEvent) ST_ATTR_OVERRIDE;
22
 
23
sview-16_06.tar.gz/include/StGLWidgets/StGLSubtitles.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLSubtitles.h Changed
11
 
1
@@ -71,7 +71,8 @@
2
                                const StHandle<StEnumParam>&    theParser);
3
     ST_CPPEXPORT virtual ~StGLSubtitles();
4
     ST_CPPEXPORT virtual bool stglInit() ST_ATTR_OVERRIDE;
5
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& thePointZo) ST_ATTR_OVERRIDE;
6
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& thePointZo,
7
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
8
     ST_CPPEXPORT virtual void stglDraw(unsigned int theView) ST_ATTR_OVERRIDE;
9
     ST_CPPEXPORT virtual void stglResize() ST_ATTR_OVERRIDE;
10
 
11
sview-16_06.tar.gz/include/StGLWidgets/StGLTextArea.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLTextArea.h Changed
18
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -234,7 +234,7 @@
10
 
11
         private:
12
 
13
-    StArrayList<GLuint>                       myTexturesList;
14
+    std::vector<GLuint>                       myTexturesList;
15
     StArrayList< StHandle<StGLVertexBuffer> > myTextVertBuf;
16
     StArrayList< StHandle<StGLVertexBuffer> > myTextTCrdBuf;
17
 
18
sview-16_06.tar.gz/include/StGLWidgets/StGLTextureButton.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLTextureButton.h Changed
53
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -15,6 +15,8 @@
10
 #include <StGL/StGLVertexBuffer.h>
11
 #include <StGL/StGLTexture.h>
12
 
13
+class StAction;
14
+
15
 /**
16
  * Widget of the clickable button with image face.
17
  */
18
@@ -44,6 +46,16 @@
19
     ST_CPPEXPORT virtual ~StGLTextureButton();
20
 
21
     /**
22
+     * Return action to be triggered on button click.
23
+     */
24
+    ST_LOCAL const StHandle<StAction>& getAction() const { return myAction; }
25
+
26
+    /**
27
+     * Set action to be triggered on button click.
28
+     */
29
+    ST_CPPEXPORT void setAction(const StHandle<StAction>& theAction);
30
+
31
+    /**
32
      * Return scale factor to be applied to the widget opacity, 1.0 by default.
33
      */
34
     ST_LOCAL float getOpacityScale() const { return myOpacityScale; }
35
@@ -111,7 +123,8 @@
36
     ST_CPPEXPORT virtual void stglResize() ST_ATTR_OVERRIDE;
37
     ST_CPPEXPORT virtual bool stglInit() ST_ATTR_OVERRIDE;
38
     ST_CPPEXPORT virtual void stglDraw  (unsigned int theView) ST_ATTR_OVERRIDE;
39
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo) ST_ATTR_OVERRIDE;
40
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo,
41
+                                         bool theIsPreciseInput) ST_ATTR_OVERRIDE;
42
     ST_CPPEXPORT virtual bool tryClick  (const StClickEvent& theEvent, bool& theIsItemClicked)   ST_ATTR_OVERRIDE;
43
     ST_CPPEXPORT virtual bool tryUnClick(const StClickEvent& theEvent, bool& theIsItemUnclicked) ST_ATTR_OVERRIDE;
44
     ST_CPPEXPORT virtual bool doScroll(const StScrollEvent& theEvent) ST_ATTR_OVERRIDE;
45
@@ -150,6 +163,7 @@
46
 
47
         protected:
48
 
49
+    StHandle<StAction>         myAction;       //!< action on button click
50
     StGLVertexBuffer           myVertBuf;      //!< vertices VBO
51
     StGLVertexBuffer           myTCrdBuf;      //!< texture coordinates VBO
52
     StGLVec4                   myColor;        //!< button color for alpha-textures
53
sview-16_06.tar.gz/include/StGLWidgets/StGLWidget.h -> sview-17_04.tar.gz/include/StGLWidgets/StGLWidget.h Changed
190
 
1
@@ -1,6 +1,6 @@
2
 /**
3
  * StGLWidgets, small C++ toolkit for writing GUI using OpenGL.
4
- * Copyright © 2009-2015 Kirill Gavrilov <kirill@sview.ru>
5
+ * Copyright © 2009-2017 Kirill Gavrilov <kirill@sview.ru>
6
  *
7
  * Distributed under the Boost Software License, Version 1.0.
8
  * See accompanying file license-boost.txt or copy at
9
@@ -83,18 +83,18 @@
10
     /**
11
      * @return root (absolute parent) widget
12
      */
13
-    inline StGLRootWidget* getRoot() {
14
+    ST_LOCAL StGLRootWidget* getRoot() {
15
         return myRoot;
16
     }
17
 
18
     /**
19
      * @return parent widget (one level up)
20
      */
21
-    inline StGLWidget* getParent() {
22
+    ST_LOCAL StGLWidget* getParent() {
23
         return myParent;
24
     }
25
 
26
-    inline StGLWidgetList* getChildren() {
27
+    ST_LOCAL StGLWidgetList* getChildren() {
28
         return &myChildren;
29
     }
30
 
31
@@ -109,7 +109,7 @@
32
     /**
33
      * @return link to previous item in the list
34
      */
35
-    inline StGLWidget* getPrev() {
36
+    ST_LOCAL StGLWidget* getPrev() {
37
         return myPrev;
38
     }
39
 
40
@@ -121,7 +121,7 @@
41
     /**
42
      * @return link to next item in the list
43
      */
44
-    inline StGLWidget* getNext() {
45
+    ST_LOCAL StGLWidget* getNext() {
46
         return myNext;
47
     }
48
 
49
@@ -133,14 +133,14 @@
50
     /**
51
      * @return true if this item not first in the list
52
      */
53
-    inline bool hasPrev() const {
54
+    ST_LOCAL bool hasPrev() const {
55
         return myPrev != NULL;
56
     }
57
 
58
     /**
59
      * @return true if this item not last in the list
60
      */
61
-    inline bool hasNext() const {
62
+    ST_LOCAL bool hasNext() const {
63
         return myNext != NULL;
64
     }
65
 
66
@@ -180,7 +180,7 @@
67
      * @return rectangle
68
      */
69
     ST_LOCAL const StRectI_t& getRectPx() const {
70
-        return rectPx;
71
+        return myRectPx;
72
     }
73
 
74
     /**
75
@@ -188,7 +188,7 @@
76
      */
77
     ST_LOCAL void setRectPx(const StRectI_t& theRectPx) {
78
         myIsResized = true;
79
-        this->rectPx = theRectPx;
80
+        myRectPx = theRectPx;
81
     }
82
 
83
     /**
84
@@ -197,7 +197,7 @@
85
      */
86
     ST_LOCAL StRectI_t& changeRectPx() {
87
         myIsResized = true;
88
-        return rectPx;
89
+        return myRectPx;
90
     }
91
 
92
     /**
93
@@ -269,7 +269,7 @@
94
     /**
95
      * @return true if widget can process input events
96
      */
97
-    inline bool isTopWidget() const {
98
+    ST_LOCAL bool isTopWidget() const {
99
         return myIsTopWidget;
100
     }
101
 
102
@@ -278,14 +278,14 @@
103
      * @param theMouseBtn mouse button id
104
      * @return isClicked
105
      */
106
-    ST_CPPEXPORT bool isClicked(const int& theMouseBtn) const;
107
+    ST_CPPEXPORT bool isClicked(int theMouseBtn) const;
108
 
109
     /**
110
      * Change clicking state.
111
      * @param theMouseBtn mouse button id
112
      * @param isClicked.
113
      */
114
-    ST_CPPEXPORT void setClicked(const int& theMouseBtn, bool isClicked);
115
+    ST_CPPEXPORT void setClicked(int theMouseBtn, bool isClicked);
116
 
117
     /**
118
      * Function iterate children and self to change clicking state.
119
@@ -352,7 +352,8 @@
120
      * Update parameters.
121
      * @param theCursorZo mouse cursor
122
      */
123
-    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo);
124
+    ST_CPPEXPORT virtual void stglUpdate(const StPointD_t& theCursorZo,
125
+                                         bool theIsPreciseInput);
126
 
127
     /**
128
      * Update widget and sub-widgets according to new backing store dimensions.
129
@@ -373,15 +374,15 @@
130
     /**
131
      * @return user-defined data
132
      */
133
-    inline size_t getUserData() const {
134
-        return userData;
135
+    ST_LOCAL size_t getUserData() const {
136
+        return myUserData;
137
     }
138
 
139
     /**
140
      * @param userData user-defined data
141
      */
142
-    inline void setUserData(const size_t theUserData) {
143
-        this->userData = theUserData;
144
+    ST_LOCAL void setUserData(const size_t theUserData) {
145
+        myUserData = theUserData;
146
     }
147
 
148
     /**
149
@@ -434,7 +435,12 @@
150
     /**
151
      * Returns link to the projection camera from root widget.
152
      */
153
-    ST_CPPEXPORT StGLProjCamera* getCamera();
154
+    ST_CPPEXPORT const StGLProjCamera* getCamera() const;
155
+
156
+    /**
157
+     * Returns link to the projection camera from root widget.
158
+     */
159
+    ST_CPPEXPORT StGLProjCamera* changeCamera();
160
 
161
     /**
162
      * @return OpenGL context from root widget.
163
@@ -450,10 +456,10 @@
164
     StGLWidget*     myPrev;          //!< previous item in array
165
     StGLWidget*     myNext;          //!< next item in array
166
 
167
-    size_t          userData;        //!< user-defined data
168
-    StRectI_t       rectPx;          //!< area coordinates in pixels
169
+    size_t          myUserData;      //!< user-defined data
170
+    StRectI_t       myRectPx;        //!< area coordinates in pixels
171
     StMarginsI      myMargins;       //!< extra margins before main content of the widget (text, image, etc.)
172
-    bool mouseClicked[ST_MOUSE_MAX_ID + 1]; // mouse clicking state
173
+    bool myMouseClicked[ST_MOUSE_MAX_ID + 1]; //!< mouse clicking state
174
 
175
         protected: //! @name fields available to inheritors
176
 
177
@@ -473,9 +479,9 @@
178
         public: //! @name public methods
179
 
180
     ST_CPPEXPORT StGLContainer(StGLWidget* theParent,
181
-                               const int   theLeft = 32, const int    theTop = 32,
182
-                               const StGLCorner theCorner = StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT),
183
-                               const int  theWidth = 32, const int theHeight = 32);
184
+                               int theLeft = 32,  int theTop = 32,
185
+                               StGLCorner theCorner = StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT),
186
+                               int theWidth = 32, int theHeight = 32);
187
 
188
     ST_CPPEXPORT virtual ~StGLContainer();
189
 
190
sview-16_06.tar.gz/include/StImage/StDevILImage.h -> sview-17_04.tar.gz/include/StImage/StDevILImage.h Changed
16
 
1
@@ -47,9 +47,11 @@
2
     ST_CPPEXPORT virtual ~StDevILImage();
3
 
4
     ST_CPPEXPORT virtual void close() ST_ATTR_OVERRIDE;
5
-    ST_CPPEXPORT virtual bool load(const StString& theFilePath,
6
-                                   ImageType theImageType = ST_TYPE_NONE,
7
-                                   uint8_t* theDataPtr = NULL, int theDataSize = 0) ST_ATTR_OVERRIDE;
8
+    ST_CPPEXPORT virtual bool loadExtra(const StString& theFilePath,
9
+                                        ImageType       theImageType,
10
+                                        uint8_t*        theDataPtr,
11
+                                        int             theDataSize,
12
+                                        bool            theIsOnlyRGB) ST_ATTR_OVERRIDE;
13
     ST_CPPEXPORT virtual bool save(const StString& theFilePath,
14
                                    ImageType       theImageType,
15
                                    StFormat        theSrcFormat) ST_ATTR_OVERRIDE;
16
sview-16_06.tar.gz/include/StImage/StFreeImage.h -> sview-17_04.tar.gz/include/StImage/StFreeImage.h Changed
16
 
1
@@ -33,9 +33,11 @@
2
     ST_CPPEXPORT virtual ~StFreeImage();
3
 
4
     ST_CPPEXPORT virtual void close() ST_ATTR_OVERRIDE;
5
-    ST_CPPEXPORT virtual bool load(const StString& theFilePath,
6
-                                   ImageType theImageType = ST_TYPE_NONE,
7
-                                   uint8_t* theDataPtr = NULL, int theDataSize = 0) ST_ATTR_OVERRIDE;
8
+    ST_CPPEXPORT virtual bool loadExtra(const StString& theFilePath,
9
+                                        ImageType       theImageType,
10
+                                        uint8_t*        theDataPtr,
11
+                                        int             theDataSize,
12
+                                        bool            theIsOnlyRGB) ST_ATTR_OVERRIDE;
13
     ST_CPPEXPORT virtual bool save(const StString& theFilePath,
14
                                    ImageType       theImageType,
15
                                    StFormat        theSrcFormat) ST_ATTR_OVERRIDE;
16
sview-16_06.tar.gz/include/StImage/StImageFile.h -> sview-17_04.tar.gz/include/StImage/StImageFile.h Changed
41
 
1
@@ -117,16 +117,31 @@
2
     ///virtual size_t getFramesCount() const = 0;
3
 
4
     /**
5
+     * Load the image from specified source.
6
+     * @param theFilePath  path to the file
7
+     * @param theImageType image type, should be set for files with undefined extension (mpo/jps/pns...)
8
+     * @param theDataPtr   data in the memory, image will be read from file if this data empty
9
+     * @param theDataSize  size of data in memory
10
+     * @return true on success
11
+     */
12
+    bool load(const StString& theFilePath,
13
+              ImageType theImageType = ST_TYPE_NONE,
14
+              uint8_t* theDataPtr = NULL, int theDataSize = 0) { return loadExtra(theFilePath, theImageType, theDataPtr, theDataSize, false); }
15
+
16
+    /**
17
      * This virtual function should be implemented by inheritors.
18
-     * @param theFilePath (const StString& ) path to the file;
19
-     * @param theImageType (int ) image type, should be set for files with undefined extension (mpo/jps/pns...);
20
-     * @param theDataPtr (uint8_t* ) data in the memory, image will be read from file if this data empty;
21
-     * @param theDataSize (int ) size of data in memory;
22
-     * @return true on success.
23
+     * @param theFilePath  path to the file
24
+     * @param theImageType image type, should be set for files with undefined extension (mpo/jps/pns...)
25
+     * @param theDataPtr   data in the memory, image will be read from file if this data empty
26
+     * @param theDataSize  size of data in memory
27
+     * @param theIsOnlyRGB option to convert YUV image data into RGB format
28
+     * @return true on success
29
      */
30
-    virtual bool load(const StString& theFilePath,
31
-                      ImageType theImageType = ST_TYPE_NONE,
32
-                      uint8_t* theDataPtr = NULL, int theDataSize = 0) = 0;
33
+    virtual bool loadExtra(const StString& theFilePath,
34
+                           ImageType       theImageType,
35
+                           uint8_t*        theDataPtr,
36
+                           int             theDataSize,
37
+                           bool            theIsOnlyRGB) = 0;
38
 
39
     /**
40
      * Close the file after it was opened with read() method.
41
sview-16_06.tar.gz/include/StImage/StJpegParser.h -> sview-17_04.tar.gz/include/StImage/StJpegParser.h Changed
11
 
1
@@ -119,7 +119,8 @@
2
      * Read the file content.
3
      */
4
     ST_CPPEXPORT virtual bool readFile(const StCString& theFilePath,
5
-                                       const int        theOpenedFd = -1) ST_ATTR_OVERRIDE;
6
+                                       const int        theOpenedFd = -1,
7
+                                       const size_t     theReadMax  = 0) ST_ATTR_OVERRIDE;
8
 
9
     /**
10
      * Determines images count.
11
sview-16_06.tar.gz/include/StImage/StWebPImage.h -> sview-17_04.tar.gz/include/StImage/StWebPImage.h Changed
16
 
1
@@ -33,9 +33,11 @@
2
     ST_CPPEXPORT virtual ~StWebPImage();
3
 
4
     ST_CPPEXPORT virtual void close() ST_ATTR_OVERRIDE;
5
-    ST_CPPEXPORT virtual bool load(const StString& theFilePath,
6
-                                   ImageType theImageType = ST_TYPE_NONE,
7
-                                   uint8_t* theDataPtr = NULL, int theDataSize = 0) ST_ATTR_OVERRIDE;
8
+    ST_CPPEXPORT virtual bool loadExtra(const StString& theFilePath,
9
+                                        ImageType       theImageType,
10
+                                        uint8_t*        theDataPtr,
11
+                                        int             theDataSize,
12
+                                        bool            theIsOnlyRGB) ST_ATTR_OVERRIDE;
13
     ST_CPPEXPORT virtual bool save(const StString& theFilePath,
14
                                    ImageType       theImageType,
15
                                    StFormat        theSrcFormat) ST_ATTR_OVERRIDE;
16
sview-16_06.tar.gz/include/StSettings/StFloat32Param.h -> sview-17_04.tar.gz/include/StSettings/StFloat32Param.h Changed
122
 
1
@@ -26,6 +26,8 @@
2
     : StParam<float>(theValue),
3
       myMinValue(-1E+37f),
4
       myMaxValue( 1E+37f),
5
+      myEffMinValue(-1E+37f),
6
+      myEffMaxValue(-1E+37f),
7
       myDefValue(0.0f),
8
       myValueStep(1.0f),
9
       myTolerance(0.0001f),
10
@@ -41,6 +43,8 @@
11
     : StParam<float>(theValue),
12
       myMinValue(-1E+37f),
13
       myMaxValue( 1E+37f),
14
+      myEffMinValue(-1E+37f),
15
+      myEffMaxValue(-1E+37f),
16
       myDefValue(0.0f),
17
       myValueStep(1.0f),
18
       myTolerance(0.0001f) {
19
@@ -59,6 +63,8 @@
20
     : StParam<float>(theValue),
21
       myMinValue(theMinValue),
22
       myMaxValue(theMaxValue),
23
+      myEffMinValue(theMinValue),
24
+      myEffMaxValue(theMaxValue),
25
       myDefValue(theDefValue),
26
       myValueStep(theStep),
27
       myTolerance(theTolerance) {
28
@@ -105,6 +111,7 @@
29
      */
30
     ST_LOCAL void setMinValue(float theValue) {
31
         myMinValue = theValue;
32
+        myEffMinValue = theValue;
33
     }
34
 
35
     /**
36
@@ -126,6 +133,7 @@
37
      */
38
     ST_LOCAL void setMaxValue(float theValue) {
39
         myMaxValue = theValue;
40
+        myEffMaxValue = theValue;
41
     }
42
 
43
     /**
44
@@ -135,6 +143,31 @@
45
                                   float theMaxValue) {
46
         myMinValue = theMinValue;
47
         myMaxValue = theMaxValue;
48
+        myEffMinValue = theMinValue;
49
+        myEffMaxValue = theMaxValue;
50
+    }
51
+
52
+    /**
53
+     * Return minimum effective value (can be greater then minimum allowed value).
54
+     */
55
+    ST_LOCAL float getEffectiveMinValue() const {
56
+        return myEffMinValue;
57
+    }
58
+
59
+    /**
60
+     * Return maximum effective value (can be less then maximum allowed value).
61
+     */
62
+    ST_LOCAL float getEffectiveMaxValue() const {
63
+        return myEffMaxValue;
64
+    }
65
+
66
+    /**
67
+     * Set effective minimum and maximum allowed values.
68
+     */
69
+    ST_LOCAL void setEffectiveMinMaxValues(float theMinValue,
70
+                                           float theMaxValue) {
71
+        myEffMinValue = theMinValue;
72
+        myEffMaxValue = theMaxValue;
73
     }
74
 
75
     /**
76
@@ -268,26 +301,35 @@
77
      * Return value within 0..1 range (taking into account min/max values).
78
      */
79
     ST_LOCAL float getNormalizedValue() const {
80
-        return (getValue() - myMinValue) / (myMaxValue - myMinValue);
81
+        return (getValue() - myEffMinValue) / (myEffMaxValue - myEffMinValue);
82
     }
83
 
84
     /**
85
      * Setup value within 0..1 range (to be scaled according to min/max values).
86
      */
87
-    ST_LOCAL bool setNormalizedValue(const float theValue) {
88
-        return setValue(myMinValue + theValue * (myMaxValue - myMinValue));
89
+    ST_LOCAL bool setNormalizedValue(float theValue,
90
+                                     bool  theToRoundToStep = false) {
91
+        float aValue = myEffMinValue + theValue * (myEffMaxValue - myEffMinValue);
92
+        if(theToRoundToStep) {
93
+            aValue = aValue >= 0.0
94
+                   ? (std::floor(aValue / myValueStep + 0.5f) * myValueStep)
95
+                   : (std::ceil (aValue / myValueStep + 0.5f) * myValueStep);
96
+        }
97
+        return setValue(aValue);
98
     }
99
 
100
         protected:
101
 
102
-    float    myMinValue;  //!< minimal allowed value
103
-    float    myMaxValue;  //!< maximal allowed value
104
-    float    myDefValue;  //!< default value
105
-    float    myValueStep; //!< default increment step
106
-    float    myTolerance; //!< tolerance for equality check
107
+    float    myMinValue;    //!< minimal allowed value
108
+    float    myMaxValue;    //!< maximal allowed value
109
+    float    myEffMinValue; //!< effective minimal allowed value
110
+    float    myEffMaxValue; //!< effective maximal allowed value
111
+    float    myDefValue;    //!< default value
112
+    float    myValueStep;   //!< default increment step
113
+    float    myTolerance;   //!< tolerance for equality check
114
 
115
-    StString myParamKey;  //!< parameter key (id)
116
-    StString myParamName; //!< parameter name (label)
117
+    StString myParamKey;    //!< parameter key (id)
118
+    StString myParamName;   //!< parameter name (label)
119
 
120
 };
121
 
122
sview-16_06.tar.gz/include/StSys/StSys.h -> sview-17_04.tar.gz/include/StSys/StSys.h Changed
12
 
1
@@ -94,10 +94,6 @@
2
     }
3
 
4
 #if defined(_WIN32)
5
-    static bool isVistaPlus() {
6
-        return getSystemVersionWin() >= SystemVersion_Vista;
7
-    }
8
-
9
     static bool isWin8Plus() {
10
         return getSystemVersionWin() >= SystemVersion_Win8;
11
     }
12
sview-17_04.tar.gz/include/StTemplates/StArrayStreamBuffer.h Added
158
 
1
@@ -0,0 +1,156 @@
2
+/**
3
+ * Copyright © 2016 Kirill Gavrilov <kirill@sview.ru>
4
+ *
5
+ * Distributed under the Boost Software License, Version 1.0.
6
+ * See accompanying file license-boost.txt or copy at
7
+ * http://www.boost.org/LICENSE_1_0.txt
8
+ */
9
+
10
+#ifndef __StArrayStreamBuffer_h__
11
+#define __StArrayStreamBuffer_h__
12
+
13
+#include <stTypes.h>
14
+
15
+#include <fstream>
16
+
17
+/**
18
+ * Custom buffer for streaming from allocated memory.
19
+ */
20
+class StArrayStreamBuffer : public std::streambuf {
21
+
22
+        public:
23
+
24
+    //! Main constructor.
25
+    StArrayStreamBuffer(const char*  theBegin,
26
+                        const size_t theSize)
27
+    : myBegin  (theBegin),
28
+      myEnd    (theBegin + theSize),
29
+      myCurrent(theBegin) {}
30
+
31
+        private:
32
+
33
+    /**
34
+     * Get character on underflow.
35
+     * Virtual function called by other member functions to get the current character
36
+     * in the controlled input sequence without changing the current position.
37
+     */
38
+    virtual int_type underflow() ST_ATTR_OVERRIDE {
39
+        if(myCurrent == myEnd) {
40
+            return traits_type::eof();
41
+        }
42
+
43
+        return traits_type::to_int_type(*myCurrent);
44
+    }
45
+
46
+    /**
47
+     * Get character on underflow and advance position.
48
+     * Virtual function called by other member functions to get the current character
49
+     * in the controlled input sequence and then advance the position indicator to the next character.
50
+     */
51
+    virtual int_type uflow() ST_ATTR_OVERRIDE {
52
+        if(myCurrent == myEnd) {
53
+            return traits_type::eof();
54
+        }
55
+
56
+        return traits_type::to_int_type(*myCurrent++);
57
+    }
58
+
59
+    /**
60
+     * Put character back in the case of backup underflow.
61
+     * Virtual function called by other member functions to put a character back
62
+     * into the controlled input sequence and decrease the position indicator.
63
+     */
64
+    virtual int_type pbackfail(int_type ch) ST_ATTR_OVERRIDE {
65
+        if(myCurrent == myBegin
66
+        || (ch != traits_type::eof()
67
+         && ch != myCurrent[-1])) {
68
+            return traits_type::eof();
69
+        }
70
+
71
+        return traits_type::to_int_type(*--myCurrent);
72
+    }
73
+
74
+    /**
75
+     * Get number of characters available.
76
+     * Virtual function (to be read s-how-many-c) called by other member functions
77
+     * to get an estimate on the number of characters available in the associated input sequence.
78
+     */
79
+    virtual std::streamsize showmanyc() ST_ATTR_OVERRIDE {
80
+        if(myCurrent > myEnd) {
81
+            // assert
82
+        }
83
+        return myEnd - myCurrent;
84
+    }
85
+
86
+    /**
87
+     * Seek to specified position.
88
+     */
89
+    virtual std::streampos seekoff(std::streamoff theOff,
90
+                                   std::ios_base::seekdir theWay,
91
+                                   std::ios_base::openmode theWhich) ST_ATTR_OVERRIDE {
92
+        switch(theWay) {
93
+            case std::ios_base::beg: {
94
+                myCurrent = myBegin + theOff;
95
+                if(myCurrent >= myEnd) {
96
+                    myCurrent = myEnd;
97
+                }
98
+                break;
99
+            }
100
+            case std::ios_base::cur: {
101
+                myCurrent += theOff;
102
+                if(myCurrent >= myEnd) {
103
+                    myCurrent = myEnd;
104
+                }
105
+                break;
106
+            }
107
+            case std::ios_base::end: {
108
+                myCurrent = myEnd - theOff;
109
+                if(myCurrent < myBegin) {
110
+                    myCurrent = myBegin;
111
+                }
112
+                break;
113
+            }
114
+            default: {
115
+                break;
116
+            }
117
+        }
118
+        (void )theWhich;
119
+        return myCurrent - myBegin;
120
+    }
121
+
122
+        public:
123
+
124
+    /**
125
+     * Read a bunch of bytes at once.
126
+     */
127
+    virtual std::streamsize xsgetn(char* thePtr,
128
+                                   std::streamsize theCount) ST_ATTR_OVERRIDE {
129
+        const char* aCurrent = myCurrent + theCount;
130
+        if(aCurrent >= myEnd) {
131
+            aCurrent = myEnd;
132
+        }
133
+        size_t aCopied = aCurrent - myCurrent;
134
+        if(aCopied == 0) {
135
+            return 0;
136
+        }
137
+        memcpy(thePtr, myCurrent, aCopied);
138
+        myCurrent = aCurrent;
139
+        return aCopied;
140
+    }
141
+
142
+        private:
143
+
144
+    // copying is not allowed
145
+    StArrayStreamBuffer           (const StArrayStreamBuffer& );
146
+    StArrayStreamBuffer& operator=(const StArrayStreamBuffer& );
147
+
148
+        private:
149
+
150
+    const char* const myBegin;
151
+    const char* const myEnd;
152
+    const char* myCurrent;
153
+
154
+};
155
+
156
+
157
+#endif // __StArrayStreamBuffer_h__
158
sview-16_06.tar.gz/include/StTemplates/StQuaternion.h -> sview-17_04.tar.gz/include/StTemplates/StQuaternion.h Changed
149
 
1
@@ -75,6 +75,24 @@
2
     Element_t w() const { return myV.w(); }
3
 
4
     /**
5
+     * Rotate vector by quaternion as rotation operator.
6
+     */
7
+    StVec3<Element_t> multiply(const StVec3<Element_t>& theVec) const {
8
+        StQuaternion aRot(theVec.x() * w() + theVec.z() * y() - theVec.y() * z(),
9
+                          theVec.y() * w() + theVec.x() * z() - theVec.z() * x(),
10
+                          theVec.z() * w() + theVec.y() * x() - theVec.x() * y(),
11
+                          theVec.x() * x() + theVec.y() * y() + theVec.z() * z());
12
+        return StVec3<Element_t>(w() * aRot.x() + x() * aRot.w() + y() * aRot.z() - z() * aRot.y(),
13
+                                 w() * aRot.y() + y() * aRot.w() + z() * aRot.x() - x() * aRot.z(),
14
+                                 w() * aRot.z() + z() * aRot.w() + x() * aRot.y() - y() * aRot.x()) * (Element_t(1) / squareNorm());
15
+    }
16
+
17
+    /**
18
+     * Rotate vector by quaternion as rotation operator.
19
+     */
20
+    StVec3<Element_t> operator*(const StVec3<Element_t>& theVec) const { return multiply(theVec); }
21
+
22
+    /**
23
      * Multiply two quaternions (e.g. rotate object by theQ2 and then by theQ1 - order is important!).
24
      */
25
     static StQuaternion multiply(const StQuaternion& theQ1,
26
@@ -85,6 +103,122 @@
27
                             theQ1.w() * theQ2.w() - theQ1.x() * theQ2.x() - theQ1.y() * theQ2.y() - theQ1.z() * theQ2.z());
28
     }
29
 
30
+    /**
31
+     * Initialize the quaternion from 3x3 rotation matrix.
32
+     */
33
+    void setMatrix(const Element_t theMat[3][3]) {
34
+        Element_t aTrace = theMat[0][0] + theMat[1][1] + theMat[2][2];
35
+        if(aTrace > 0.0) {
36
+            // if trace positive than "w" is biggest component
37
+            myV.x() = theMat[1][2] - theMat[2][1];
38
+            myV.y() = theMat[2][0] - theMat[0][2];
39
+            myV.z() = theMat[0][1] - theMat[1][0];
40
+            myV.w() = aTrace + Element_t(1);
41
+            scale(Element_t(0.5) / std::sqrt(w())); // "w" contain the "norm * 4"
42
+        } else if((theMat[0][0] > theMat[1][1])
43
+               && (theMat[0][0] > theMat[2][2])) {
44
+            // some of vector components is bigger
45
+            myV.x() = Element_t(1) + theMat[0][0] - theMat[1][1] - theMat[2][2];
46
+            myV.y() = theMat[1][0] + theMat[0][1];
47
+            myV.z() = theMat[2][0] + theMat[0][2];
48
+            myV.w() = theMat[1][2] - theMat[2][1];
49
+            scale(Element_t(0.5) / std::sqrt(x()));
50
+        } else if(theMat[1][1] > theMat[2][2]) {
51
+            myV.x() = theMat[1][0] + theMat[0][1];
52
+            myV.y() = Element_t(1) + theMat[1][1] - theMat[0][0] - theMat[2][2];
53
+            myV.z() = theMat[2][1] + theMat[1][2];
54
+            myV.w() = theMat[2][0] - theMat[0][2];
55
+            scale(Element_t(0.5) / std::sqrt(y()));
56
+        } else {
57
+            myV.x() = theMat[2][0] + theMat[0][2];
58
+            myV.y() = theMat[2][1] + theMat[1][2];
59
+            myV.z() = Element_t(1) + theMat[2][2] - theMat[0][0] - theMat[1][1];
60
+            myV.w() = theMat[0][1] - theMat[1][0];
61
+            scale(Element_t(0.5) / std::sqrt(z()));
62
+        }
63
+    }
64
+
65
+    /**
66
+     * Return square norm of quaternion.
67
+     */
68
+    Element_t squareNorm() const {
69
+        return x() * x() + y() * y() + z() * z() + w() * w();
70
+    }
71
+
72
+    /**
73
+     * Return norm of quaternion.
74
+     */
75
+    Element_t norm() const {
76
+        return std::sqrt(squareNorm());
77
+    }
78
+
79
+    /**
80
+     * Scale quaternion that its norm goes to 1.
81
+     * The appearing of 0 magnitude or near is a error, so we can be sure that can divide by magnitude
82
+     */
83
+    void normalize() {
84
+        Element_t aMagn = norm();
85
+        if(aMagn == Element_t(0)) {
86
+            stabilizeLength();
87
+            aMagn = norm();
88
+        }
89
+        scale(Element_t(1) / aMagn);
90
+    }
91
+
92
+    /**
93
+     * Stabilize quaternion length within 1 - 1/4.
94
+     * This operation is a faster than normalization and preserve length goes to 0 or infinity.
95
+     */
96
+    void stabilizeLength() {
97
+        Element_t aCs = std::abs(x()) + std::abs(y()) + std::abs(z()) + std::abs(w());
98
+        if(aCs > Element_t(0)) {
99
+            myV.x() /= aCs;
100
+            myV.y() /= aCs;
101
+            myV.z() /= aCs;
102
+            myV.w() /= aCs;
103
+        } else {
104
+            setIdent();
105
+        }
106
+    }
107
+
108
+    /**
109
+     * Make identity quaternion (zero-rotation).
110
+     */
111
+    void setIdent() {
112
+        myV.x() = myV.y() = myV.z() = Element_t(0);
113
+        myV.w() = Element_t(1);
114
+    }
115
+
116
+    /**
117
+     * Reverse direction of rotation (conjugate quaternion)
118
+     */
119
+    void reverse() {
120
+        myV.x() = -myV.x();
121
+        myV.y() = -myV.y();
122
+        myV.z() = -myV.z();
123
+    }
124
+
125
+    /**
126
+     * Return rotation with reversed direction (conjugated quaternion)
127
+     */
128
+    StQuaternion reversed() const {
129
+        StQuaternion aCopy(*this);
130
+        aCopy.reverse();
131
+        return aCopy;
132
+    }
133
+
134
+        private:
135
+
136
+    /**
137
+     * Apply scale factor.
138
+     */
139
+    inline void scale(const Element_t theScale) {
140
+        myV.x() *= theScale;
141
+        myV.y() *= theScale;
142
+        myV.z() *= theScale;
143
+        myV.w() *= theScale;
144
+    }
145
+
146
         private:
147
 
148
     StVec4<Element_t> myV;
149
sview-16_06.tar.gz/include/StTemplates/StVec2.h -> sview-17_04.tar.gz/include/StTemplates/StVec2.h Changed
28
 
1
@@ -94,6 +94,26 @@
2
     operator Element_t*() { return v; }
3
 
4
     /**
5
+     * Check this vector with another vector for equality (without tolerance!).
6
+     */
7
+    bool isEqual(const StVec2& theOther) const {
8
+        return v[0] == theOther.v[0]
9
+            && v[1] == theOther.v[1];
10
+    }
11
+
12
+    /**
13
+     * Check this vector with another vector for equality (without tolerance!).
14
+     */
15
+    bool operator==(const StVec2& theOther)       { return isEqual(theOther); }
16
+    bool operator==(const StVec2& theOther) const { return isEqual(theOther); }
17
+
18
+    /**
19
+     * Check this vector with another vector for non-equality (without tolerance!).
20
+     */
21
+    bool operator!=(const StVec2& theOther)       { return !isEqual(theOther); }
22
+    bool operator!=(const StVec2& theOther) const { return !isEqual(theOther); }
23
+
24
+    /**
25
      * Compute per-component summary.
26
      */
27
     StVec2& operator+=(const StVec2& theAdd) {
28
sview-16_06.tar.gz/include/StTemplates/StVec3.h -> sview-17_04.tar.gz/include/StTemplates/StVec3.h Changed
29
 
1
@@ -119,6 +119,27 @@
2
     operator Element_t*() { return v; }
3
 
4
     /**
5
+     * Check this vector with another vector for equality (without tolerance!).
6
+     */
7
+    bool isEqual(const StVec3& theOther) const {
8
+        return v[0] == theOther.v[0]
9
+            && v[1] == theOther.v[1]
10
+            && v[2] == theOther.v[2];
11
+    }
12
+
13
+    /**
14
+     * Check this vector with another vector for equality (without tolerance!).
15
+     */
16
+    bool operator==(const StVec3& theOther)       { return isEqual(theOther); }
17
+    bool operator==(const StVec3& theOther) const { return isEqual(theOther); }
18
+
19
+    /**
20
+     * Check this vector with another vector for non-equality (without tolerance!).
21
+     */
22
+    bool operator!=(const StVec3& theOther)       { return !isEqual(theOther); }
23
+    bool operator!=(const StVec3& theOther) const { return !isEqual(theOther); }
24
+
25
+    /**
26
      * Compute per-component summary.
27
      */
28
     StVec3& operator+=(const StVec3& add) {
29
sview-16_06.tar.gz/include/StTemplates/StVec4.h -> sview-17_04.tar.gz/include/StTemplates/StVec4.h Changed
30
 
1
@@ -141,6 +141,28 @@
2
     operator Element_t*() { return v; }
3
 
4
     /**
5
+     * Check this vector with another vector for equality (without tolerance!).
6
+     */
7
+    bool isEqual(const StVec4& theOther) const {
8
+        return v[0] == theOther.v[0]
9
+            && v[1] == theOther.v[1]
10
+            && v[2] == theOther.v[2]
11
+            && v[3] == theOther.v[3];
12
+    }
13
+
14
+    /**
15
+     * Check this vector with another vector for equality (without tolerance!).
16
+     */
17
+    bool operator==(const StVec4& theOther)       { return isEqual(theOther); }
18
+    bool operator==(const StVec4& theOther) const { return isEqual(theOther); }
19
+
20
+    /**
21
+     * Check this vector with another vector for non-equality (without tolerance!).
22
+     */
23
+    bool operator!=(const StVec4& theOther)       { return !isEqual(theOther); }
24
+    bool operator!=(const StVec4& theOther) const { return !isEqual(theOther); }
25
+
26
+    /**
27
      * Compute per-component summary.
28
      */
29
     StVec4& operator+=(const StVec4& add) {
30
sview-16_06.tar.gz/include/StThreads/StThread.h -> sview-17_04.tar.gz/include/StThreads/StThread.h Changed
33
 
1
@@ -69,14 +69,10 @@
2
      * Returns the CPU architecture used to build the program (may not match the system).
3
      */
4
     ST_LOCAL static const char* getArchString() {
5
-    #if defined(__arm__) || defined(__arm64__)
6
-        #if defined(__ARM_ARCH_8A__)
7
-            #if defined(__LP64__)
8
-                return "ARMv8-A 64-bit";
9
-            #else
10
-                return "ARMv8-A 32-bit";
11
-            #endif
12
-        #elif defined(__ARM_ARCH_7A__)
13
+    #if defined(__aarch64__) && defined(__LP64__)
14
+        return "AArch64 64-bit";
15
+    #elif defined(__arm__) || defined(__arm64__)
16
+        #if defined(__ARM_ARCH_7A__)
17
             return "ARMv7-A 32-bit";
18
         #elif defined(__ARM_ARCH_7R__)
19
             return "ARMv7-R 32-bit";
20
@@ -158,6 +154,12 @@
21
     ST_CPPEXPORT bool wait();
22
 
23
     /**
24
+     * Wait for thread return with specified timeout.
25
+     * Warning - timeout is supported only on Windows!
26
+     */
27
+    ST_CPPEXPORT bool wait(const int theTimeMilliseconds);
28
+
29
+    /**
30
      *  This is a dangerous function that should only be used in the most extreme case!
31
      */
32
     ST_CPPEXPORT void kill();
33
sview-16_06.tar.gz/include/stTypes.h -> sview-17_04.tar.gz/include/stTypes.h Changed
74
 
1
@@ -27,7 +27,9 @@
2
  */
3
 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
4
     //#define _USE_ATTRIBUTES_FOR_SAL 1 // doesn't work without /analyze option!
5
-    #include <CodeAnalysis/SourceAnnotations.h>
6
+    #if (_MSC_VER < 1900)
7
+      #include <CodeAnalysis/SourceAnnotations.h>
8
+    #endif
9
     //#define ST_ATTR_CHECK_RETURN [returnvalue:vc_attributes::Post(MustCheck=vc_attributes::Yes)]
10
     //#include <sal.h>
11
     #define ST_ATTR_CHECK_RETURN _Check_return_
12
@@ -61,10 +63,11 @@
13
 #endif
14
 
15
 #include <cmath>       // fabs
16
+#include <cfloat>
17
 #include <cstddef>     // size_t, NULL
18
 #include <cstdlib>
19
 #include <cstring>     // for memcpy
20
-#if !defined(__arm__) && !defined(__arm__)
21
+#if defined(__i386) || defined(__x86_64) || defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)
22
     #include <xmmintrin.h> // for memory alignment
23
 #endif
24
 #include <stdio.h>     // for _snprintf on MinGW
25
@@ -131,7 +134,7 @@
26
 #endif
27
 
28
 /**
29
- * Mordern compilers provide fixed-size primitives like int32_t.
30
+ * Modern compilers provide fixed-size primitives like int32_t.
31
  * Some developers can use these types in function overloads
32
  * to logically cover all variations depending on primitive size.
33
  * However some language primitives can recall to the same
34
@@ -428,8 +431,8 @@
35
  *  - ST_CIMPORT   Import symbol, C-style
36
  *  - ST_CPPEXPORT Export symbol, C++-style (with name decorations)
37
  *  - ST_CPPIMPORT Import symbol, C++-style
38
- *  - ST_EXPORT    Depricated macro, alias to ST_CEXPORT
39
- *  - ST_IMPORT    Depricated macro, alias to ST_CIXPORT
40
+ *  - ST_EXPORT    Deprecated macro, alias to ST_CEXPORT
41
+ *  - ST_IMPORT    Deprecated macro, alias to ST_CIXPORT
42
  *
43
  * Notice that function/class definition without extra specifiers
44
  * leads to different behaviour on different platforms!
45
@@ -437,7 +440,7 @@
46
  *  - On Linux (and others), symbol considered for export
47
  *
48
  * On Windows exported and imported symbols should be marked with different specifiers
49
- * which leads to extra comlications in library headers
50
+ * which leads to extra complications in library headers
51
  * (library should be build with export specifier whilst
52
  * application based on it should see import specifier).
53
  * However C++ method could be marked as "exported" in both cases.
54
@@ -540,6 +543,19 @@
55
     return isOddNumber(number) ? (number + 1) : number;
56
 }
57
 
58
+namespace st {
59
+    /**
60
+     * Return true for NaN.
61
+     */
62
+    inline bool isNaN(double theValue) {
63
+    #if defined(_MSC_VER)
64
+        return ::_isnan(theValue) != 0;
65
+    #else
66
+        return std::isnan(theValue);
67
+    #endif
68
+    }
69
+}
70
+
71
 #include <StTemplates/StTemplates.h> // include commonly-used templates
72
 
73
 /**
74
sview-16_06.tar.gz/sview/AndroidManifest.xml -> sview-17_04.tar.gz/sview/AndroidManifest.xml Changed
21
 
1
@@ -1,8 +1,9 @@
2
 <?xml version="1.0" encoding="utf-8"?>
3
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
4
           package="com.sview"
5
-          android:versionCode="12"
6
-          android:versionName="16.03">
7
+          android:versionCode="16"
8
+          android:versionName="16.12"
9
+          android:installLocation="auto">
10
     <application android:label="@string/app_name"
11
                  android:hasCode="true"
12
                  android:icon="@drawable/ic_launcher">
13
@@ -223,6 +224,7 @@
14
             </intent-filter>
15
         </activity>
16
         <!-- <activity android:name="com.sview.MainActivity" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity> -->
17
+        <activity android:name="com.sview.CrashReportActivity" android:label="@string/app_crash_name" android:configChanges="orientation|keyboardHidden"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.DEFAULT" /></intent-filter></activity>
18
     </application>
19
 
20
     <uses-sdk android:minSdkVersion="15" />
21
sview-16_06.tar.gz/sview/Contents/Info.plist -> sview-17_04.tar.gz/sview/Contents/Info.plist Changed
10
 
1
@@ -633,7 +633,7 @@
2
    <key>CFBundleExecutable</key>
3
    <string>sView</string>
4
    <key>CFBundleGetInfoString</key>
5
-   <string>Copyright © Kirill Gavrilov, 2007-2016</string>
6
+   <string>Copyright © Kirill Gavrilov, 2007-2017</string>
7
    <key>CFBundleIdentifier</key>
8
    <string>com.sView</string>
9
    <key>CFBundleInfoDictionaryVersion</key>
10
sview-16_06.tar.gz/sview/Resources/English.lproj/MainMenu.xib -> sview-17_04.tar.gz/sview/Resources/English.lproj/MainMenu.xib Changed
10
 
1
@@ -228,7 +228,7 @@
2
                            <object class="NSTextFieldCell" key="NSCell" id="955175397">
3
                                <int key="NSCellFlags">70385217</int>
4
                                <int key="NSCellFlags2">138544128</int>
5
-                               <string key="NSContents">Copyright © Kirill Gavrilov, 2007-2016www.sview.ru</string>
6
+                               <string key="NSContents">Copyright © Kirill Gavrilov, 2007-2017www.sview.ru</string>
7
                                <object class="NSFont" key="NSSupport" id="26">
8
                                    <string key="NSName">LucidaGrande</string>
9
                                    <double key="NSSize">11</double>
10
sview-16_06.tar.gz/sview/res/values/strings.xml -> sview-17_04.tar.gz/sview/res/values/strings.xml Changed
7
 
1
@@ -3,4 +3,5 @@
2
     <string name="app_name">sView</string>
3
     <string name="app_image_name">sView - Image Viewer</string>
4
     <string name="app_movie_name">sView - Media Player</string>
5
+    <string name="app_crash_name">sView - Crash Report</string>
6
 </resources>
7
sview-17_04.tar.gz/sview/src/com/sview/CrashReportActivity.java Added
48
 
1
@@ -0,0 +1,46 @@
2
+/**
3
+ * This is source code for sView
4
+ *
5
+ * Copyright © Kirill Gavrilov, 2017
6
+ */
7
+package com.sview;
8
+
9
+import android.app.Activity;
10
+import android.content.ContextWrapper;
11
+import android.content.Intent;
12
+import android.text.method.ScrollingMovementMethod;
13
+import android.widget.TextView;
14
+import android.os.Bundle;
15
+
16
+/**
17
+ * sView Crash Report activity.
18
+ */
19
+public class CrashReportActivity extends Activity {
20
+
21
+   public static final String THE_ERROR_REPORT_ID = "ERROR_REPORT";
22
+
23
+    @Override
24
+    public void onCreate(Bundle theSavedInstanceState) {
25
+        super.onCreate(theSavedInstanceState);
26
+
27
+        // create folder for external storage
28
+        myContext = new ContextWrapper(this);
29
+        myContext.getExternalFilesDir(null);
30
+
31
+        Intent anIntent = getIntent();
32
+        Bundle anExtras = anIntent != null ? getIntent().getExtras() : null;
33
+        String anErrorText = "";
34
+        if(anExtras != null) {
35
+            anErrorText = anExtras.getString(THE_ERROR_REPORT_ID);
36
+        }
37
+
38
+        myTextView = new TextView(this);
39
+        myTextView.setMovementMethod(new ScrollingMovementMethod());
40
+        myTextView.setText("sView Crash Report: " + anErrorText);
41
+        setContentView(myTextView);
42
+    }
43
+
44
+    private TextView       myTextView;
45
+    private ContextWrapper myContext;
46
+
47
+}
48
sview-16_06.tar.gz/sview/src/com/sview/StActivity.java -> sview-17_04.tar.gz/sview/src/com/sview/StActivity.java Changed
189
 
1
@@ -1,7 +1,7 @@
2
 /**
3
  * This is source code for sView
4
  *
5
- * Copyright © Kirill Gavrilov, 2014-2016
6
+ * Copyright © Kirill Gavrilov, 2014-2017
7
  */
8
 package com.sview;
9
 
10
@@ -47,6 +47,11 @@
11
         });
12
         AlertDialog aDialog = aBuilder.create();
13
         aDialog.show();
14
+
15
+        Intent anIntent = new Intent(theActivity, CrashReportActivity.class);
16
+        anIntent.putExtra(CrashReportActivity.THE_ERROR_REPORT_ID, theError);
17
+        anIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
18
+        theActivity.startActivity(anIntent);
19
     }
20
 
21
     /**
22
@@ -89,11 +94,11 @@
23
         if(!loadLibVerbose("gnustl_shared",   theInfo)
24
         //|| !loadLibVerbose("config++",        theInfo)
25
         || !loadLibVerbose("freetype",        theInfo)
26
-        || !loadLibVerbose("avutil-55",       theInfo)
27
-        || !loadLibVerbose("swresample-2",    theInfo)
28
-        || !loadLibVerbose("avcodec-57",      theInfo)
29
-        || !loadLibVerbose("avformat-57",     theInfo)
30
-        || !loadLibVerbose("swscale-4",       theInfo)
31
+        || !loadLibVerbose("avutil",          theInfo)
32
+        || !loadLibVerbose("swresample",      theInfo)
33
+        || !loadLibVerbose("avcodec",         theInfo)
34
+        || !loadLibVerbose("avformat",        theInfo)
35
+        || !loadLibVerbose("swscale",         theInfo)
36
         || !loadLibVerbose("openal",          theInfo)
37
         || !loadLibVerbose("StShared",        theInfo)
38
         || !loadLibVerbose("StGLWidgets",     theInfo)
39
@@ -115,6 +120,16 @@
40
         return true;
41
     }
42
 
43
+    /**
44
+     * Define device Left/Right eyes swap flag.
45
+     * Considering this flag depends on device output implementation.
46
+     */
47
+    public void setSwapEyes(boolean theToSwap) {
48
+        if(myCppGlue != 0) {
49
+            cppSetSwapEyes(myCppGlue, theToSwap);
50
+        }
51
+    }
52
+
53
 //endregion
54
 
55
 //region Overridden methods of NativeActivity class
56
@@ -140,7 +155,21 @@
57
             myIsPoorOri = mySensorMgr.getDefaultSensor(Sensor.TYPE_GYROSCOPE) == null;
58
         }
59
         myS3dvSurf = new StS3dvSurface();
60
-        super.onCreate(theSavedInstanceState);
61
+
62
+        try {
63
+            super.onCreate(theSavedInstanceState);
64
+        } catch(java.lang.UnsatisfiedLinkError theError) {
65
+            anInfo.append("Error: native library is unavailable:\n  " + theError.getMessage());
66
+            StActivity.exitWithError(this, "Broken apk?\n" + anInfo);
67
+        } catch(SecurityException theError) {
68
+            anInfo.append("Error: native library can not be loaded for security reasons:\n  " + theError.getMessage());
69
+            StActivity.exitWithError(this, "Broken apk?\n" + anInfo);
70
+        } catch(Exception theError) {
71
+            anInfo.append("Error: unhandled exception:\n  " + theError.getMessage());
72
+            StActivity.exitWithError(this, "Broken apk?\n" + anInfo);
73
+        }
74
+
75
+        updateHideSystemBars(myToHideStatusBar, myToHideNavBar);
76
     }
77
 
78
     /**
79
@@ -161,6 +190,15 @@
80
         if(myToTrackOrient) {
81
             updateTrackOrientation(true);
82
         }
83
+        updateHideSystemBars(myToHideStatusBar, myToHideNavBar);
84
+
85
+        android.os.Handler aHandler = new android.os.Handler();
86
+        aHandler.postDelayed(new Runnable() {
87
+            @Override
88
+            public void run() {
89
+                updateHideSystemBars(myToHideStatusBar, myToHideNavBar);
90
+            }
91
+        }, 500);
92
     }
93
 
94
     /**
95
@@ -352,6 +390,37 @@
96
         }
97
     }
98
 
99
+    /**
100
+     * Wrapper to show/hide navigation bar.
101
+     */
102
+    protected void updateHideSystemBars(boolean theToHideStatusBar,
103
+                                        boolean theToHideNavBar) {
104
+        if(android.os.Build.VERSION.SDK_INT < 19) {
105
+            return;
106
+        }
107
+
108
+        int anOptions = 0;
109
+
110
+        // Status bar can not be restored by these flags if
111
+        // "@android:style/Theme.NoTitleBar.Fullscreen" is set in manifest!
112
+        if(theToHideStatusBar) {
113
+            anOptions = anOptions
114
+                      | 0x00000004  // SYSTEM_UI_FLAG_FULLSCREEN
115
+                      | 0x00001000  // SYSTEM_UI_FLAG_IMMERSIVE_STICKY
116
+                      | 0x00000100; // SYSTEM_UI_FLAG_LAYOUT_STABLE
117
+        }
118
+        if(theToHideNavBar) {
119
+            anOptions = anOptions
120
+                      | android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
121
+                      | 0x00001000  // SYSTEM_UI_FLAG_IMMERSIVE_STICKY
122
+                      | 0x00000200  // SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
123
+                      | 0x00000100; // SYSTEM_UI_FLAG_LAYOUT_STABLE
124
+        }
125
+
126
+        final android.view.View aDecorView = getWindow().getDecorView();
127
+        aDecorView.setSystemUiVisibility(anOptions);
128
+    }
129
+
130
 //endregion
131
 
132
 //region Methods to be called from C++ level
133
@@ -421,6 +490,29 @@
134
     }
135
 
136
     /**
137
+     * Method to show/hide navigation bar.
138
+     */
139
+    public void setHideSystemBars(boolean theToHideStatusBar,
140
+                                  boolean theToHideNavBar) {
141
+        if(android.os.Build.VERSION.SDK_INT < 19) {
142
+            return;
143
+        }
144
+
145
+        final boolean toHideStatusBar = theToHideStatusBar;
146
+        final boolean toHideNavBar    = theToHideNavBar;
147
+        this.runOnUiThread (new Runnable() { public void run() {
148
+            if(myToHideStatusBar == toHideStatusBar
149
+            && myToHideNavBar    == toHideNavBar) {
150
+                return;
151
+            }
152
+
153
+            myToHideStatusBar = toHideStatusBar;
154
+            myToHideNavBar    = toHideNavBar;
155
+            updateHideSystemBars(toHideStatusBar, toHideNavBar);
156
+        }});
157
+    }
158
+
159
+    /**
160
      * Auxiliary method to show temporary info message.
161
      */
162
     public void postToast(String theInfo) {
163
@@ -500,6 +592,12 @@
164
                                           float theAzimuthDeg, float thePitchDeg, float theRollDeg,
165
                                           float theScreenRotDeg);
166
 
167
+    /**
168
+     * Define device Left/Right eyes swap flag.
169
+     */
170
+    private native void cppSetSwapEyes(long theCppPtr,
171
+                                       boolean theToSwap);
172
+
173
 //endregion
174
 
175
     @SuppressWarnings("deprecation")
176
@@ -511,8 +609,10 @@
177
     protected SensorManager  mySensorMgr;
178
     protected Sensor         mySensorOri;
179
     protected float          myQuat[] = { 0.0f, 0.0f, 0.0f, 1.0f };
180
-    protected boolean        myIsPoorOri     = false;
181
-    protected boolean        myToTrackOrient = false;
182
+    protected boolean        myIsPoorOri       = false;
183
+    protected boolean        myToTrackOrient   = false;
184
+    protected boolean        myToHideStatusBar = true;
185
+    protected boolean        myToHideNavBar    = true;
186
     protected long           myCppGlue = 0; //!< pointer to c++ class StAndroidGlue instance
187
 
188
     protected StS3dvSurface  myS3dvSurf = null;
189
sview-16_06.tar.gz/sview/sview.rc -> sview-17_04.tar.gz/sview/sview.rc Changed
10
 
1
@@ -16,7 +16,7 @@
2
     BEGIN
3
       VALUE "FileDescription", "sView\000"
4
       VALUE "FileVersion", SVIEW_SDK_VER_STRING "\000"
5
-      VALUE "LegalCopyright", "\251 2007-2016 Kirill Gavrilov\000"
6
+      VALUE "LegalCopyright", "\251 2007-2017 Kirill Gavrilov\000"
7
       VALUE "ProductName", "sView\000"
8
       VALUE "ProductVersion", SVIEW_SDK_VER_STRING "\000"
9
       VALUE "OfficialSite", "www.sview.ru\000"
10
sview-17_04.tar.gz/textures/actionColorAdjustOff128.png Added
sview-17_04.tar.gz/textures/actionColorAdjustOff144.png Added
sview-17_04.tar.gz/textures/actionColorAdjustOff16.png Added
sview-17_04.tar.gz/textures/actionColorAdjustOff192.png Added
sview-17_04.tar.gz/textures/actionColorAdjustOff24.png Added
sview-17_04.tar.gz/textures/actionColorAdjustOff256.png Added
sview-17_04.tar.gz/textures/actionColorAdjustOff32.png Added
sview-17_04.tar.gz/textures/actionColorAdjustOff48.png Added
sview-17_04.tar.gz/textures/actionColorAdjustOff64.png Added
sview-17_04.tar.gz/textures/actionColorAdjustOff72.png Added
sview-17_04.tar.gz/textures/actionColorAdjustOff96.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff128.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff144.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff16.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff192.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff24.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff256.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff32.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff48.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff64.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff72.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOff96.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn128.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn144.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn16.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn192.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn24.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn256.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn32.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn48.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn64.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn72.png Added
sview-17_04.tar.gz/textures/actionVideoFullscreen3dOn96.png Added
sview-17_04.tar.gz/textures/hmd_exit_fullscreen.png Added
sview-17_04.tar.gz/texturesSrc/actionColorAdjustOff.svg Added
76
 
1
@@ -0,0 +1,74 @@
2
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
3
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
4
+
5
+<svg
6
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
7
+   xmlns:cc="http://creativecommons.org/ns#"
8
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
9
+   xmlns:svg="http://www.w3.org/2000/svg"
10
+   xmlns="http://www.w3.org/2000/svg"
11
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
+   width="32"
14
+   height="32"
15
+   id="svg2"
16
+   version="1.1"
17
+   inkscape:version="0.91 r13725"
18
+   sodipodi:docname="actionColorAdjustOff.svg"
19
+   inkscape:export-filename="actionColorAdjustOff.png"
20
+   inkscape:export-xdpi="90"
21
+   inkscape:export-ydpi="90">
22
+  <defs
23
+     id="defs4" />
24
+  <sodipodi:namedview
25
+     id="base"
26
+     pagecolor="#ffffff"
27
+     bordercolor="#666666"
28
+     borderopacity="1.0"
29
+     inkscape:pageopacity="1"
30
+     inkscape:pageshadow="2"
31
+     inkscape:zoom="16"
32
+     inkscape:cx="19.104177"
33
+     inkscape:cy="13.779313"
34
+     inkscape:document-units="px"
35
+     inkscape:current-layer="layer1"
36
+     showgrid="false"
37
+     inkscape:window-width="1920"
38
+     inkscape:window-height="976"
39
+     inkscape:window-x="2552"
40
+     inkscape:window-y="-8"
41
+     inkscape:window-maximized="1" />
42
+  <metadata
43
+     id="metadata7">
44
+    <rdf:RDF>
45
+      <cc:Work
46
+         rdf:about="">
47
+        <dc:format>image/svg+xml</dc:format>
48
+        <dc:type
49
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
50
+        <dc:title />
51
+      </cc:Work>
52
+    </rdf:RDF>
53
+  </metadata>
54
+  <g
55
+     inkscape:label="Layer 1"
56
+     inkscape:groupmode="layer"
57
+     id="layer1"
58
+     transform="translate(0,-1020.3622)">
59
+    <path
60
+       d="m 0,1020.3622 h 32 v 32 H 0 z"
61
+       id="path5998"
62
+       inkscape:connector-curvature="0"
63
+       style="fill:none" />
64
+    <path
65
+       style="fill:#000000;fill-opacity:1;stroke:none"
66
+       d="M 16 4 C 13.55359 4 11.280286 4.7348139 9.3828125 5.9921875 L 10.982422 7.5917969 C 11.337197 7.0357748 11.955872 6.6660156 12.666016 6.6660156 C 13.772682 6.6660156 14.666016 7.5593156 14.666016 8.6660156 C 14.666016 9.3757836 14.295821 9.9947363 13.740234 10.349609 L 24.111328 20.720703 C 26.403989 19.666067 28 17.353593 28 14.666016 C 28 8.7726156 22.626666 4 16 4 z M 19.333984 6.6660156 C 20.440651 6.6660156 21.333984 7.5593156 21.333984 8.6660156 C 21.333984 9.7726156 20.440651 10.666016 19.333984 10.666016 C 18.227318 10.666016 17.333984 9.7726156 17.333984 8.6660156 C 17.333984 7.5593156 18.227318 6.6660156 19.333984 6.6660156 z M 7.5078125 7.5234375 C 5.34073 9.69448 4 12.690619 4 16 C 4 22.6267 9.3733334 28 16 28 C 17.106667 28 18 27.1067 18 26 C 18 25.48 17.800469 25.012344 17.480469 24.652344 C 17.173802 24.305744 16.972656 23.840684 16.972656 23.333984 C 16.972656 22.227384 17.86599 21.333984 18.972656 21.333984 L 21.318359 21.333984 L 13.03125 13.046875 L 7.5078125 7.5234375 z M 8.6660156 12 C 9.7726824 12 10.666016 12.8933 10.666016 14 C 10.666016 15.1067 9.7726824 16 8.6660156 16 C 7.559349 16 6.6660156 15.1067 6.6660156 14 C 6.6660156 12.8933 7.559349 12 8.6660156 12 z M 23.333984 12 C 24.44065 12 25.333984 12.8933 25.333984 14 C 25.333984 15.1067 24.44065 16 23.333984 16 C 22.227316 16 21.333984 15.1067 21.333984 14 C 21.333984 12.8933 22.227316 12 23.333984 12 z "
67
+       transform="translate(0,1020.3622)"
68
+       id="path4" />
69
+    <path
70
+       id="path3122"
71
+       d="m 4.6875,1025.0341 -1.71875,1.6875 0.5,0.5 6.1875,6.1875 8.78125,8.7813 5.5,5.5 1.71875,-1.6875 -20.96875,-20.9688 z"
72
+       inkscape:connector-curvature="0"
73
+       style="fill:#000000;fill-opacity:1;stroke:none" />
74
+  </g>
75
+</svg>
76
sview-17_04.tar.gz/texturesSrc/actionVideoFullscreen3dOff.svg Added
90
 
1
@@ -0,0 +1,88 @@
2
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
3
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
4
+
5
+<svg
6
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
7
+   xmlns:cc="http://creativecommons.org/ns#"
8
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
9
+   xmlns:svg="http://www.w3.org/2000/svg"
10
+   xmlns="http://www.w3.org/2000/svg"
11
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
+   width="32"
14
+   height="32"
15
+   id="svg2"
16
+   version="1.1"
17
+   inkscape:version="0.91 r13725"
18
+   sodipodi:docname="actionVideoFullscreen3dOff.svg"
19
+   inkscape:export-filename="actionVideoFullscreen3dOff.png"
20
+   inkscape:export-xdpi="90"
21
+   inkscape:export-ydpi="90">
22
+  <defs
23
+     id="defs4" />
24
+  <sodipodi:namedview
25
+     id="base"
26
+     pagecolor="#ffffff"
27
+     bordercolor="#666666"
28
+     borderopacity="1.0"
29
+     inkscape:pageopacity="1"
30
+     inkscape:pageshadow="2"
31
+     inkscape:zoom="4"
32
+     inkscape:cx="-21.995577"
33
+     inkscape:cy="42.597019"
34
+     inkscape:document-units="px"
35
+     inkscape:current-layer="text4244"
36
+     showgrid="false"
37
+     inkscape:window-width="1920"
38
+     inkscape:window-height="976"
39
+     inkscape:window-x="2552"
40
+     inkscape:window-y="-8"
41
+     inkscape:window-maximized="1" />
42
+  <metadata
43
+     id="metadata7">
44
+    <rdf:RDF>
45
+      <cc:Work
46
+         rdf:about="">
47
+        <dc:format>image/svg+xml</dc:format>
48
+        <dc:type
49
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
50
+        <dc:title />
51
+      </cc:Work>
52
+    </rdf:RDF>
53
+  </metadata>
54
+  <g
55
+     inkscape:label="Layer 1"
56
+     inkscape:groupmode="layer"
57
+     id="layer1"
58
+     transform="translate(0,-1020.3622)">
59
+    <path
60
+       d="m 0,1020.3622 h 32 v 32 H 0 z"
61
+       id="path6"
62
+       inkscape:connector-curvature="0"
63
+       style="fill:none" />
64
+    <path
65
+       style="fill:#000000;fill-opacity:1;stroke:none"
66
+       d="M 10.056641 6.6660156 L 12.724609 9.3339844 L 13.333984 9.3339844 L 13.333984 6.6660156 L 10.056641 6.6660156 z M 18.666016 6.6660156 L 18.666016 9.3339844 L 22.666016 9.3339844 L 22.666016 13.333984 L 25.333984 13.333984 L 25.333984 6.6660156 L 18.666016 6.6660156 z M 6.6660156 6.6816406 L 6.6660156 13.333984 L 9.3339844 13.333984 L 9.3339844 9.3496094 L 6.84375 6.859375 L 6.6660156 6.6816406 z M 6.6660156 18.666016 L 6.6660156 25.333984 L 13.333984 25.333984 L 13.333984 22.666016 L 9.3339844 22.666016 L 9.3339844 18.666016 L 6.6660156 18.666016 z M 22.666016 18.666016 L 22.666016 19.275391 L 25.333984 21.943359 L 25.333984 18.666016 L 22.666016 18.666016 z M 18.666016 22.666016 L 18.666016 25.333984 L 25.318359 25.333984 L 22.650391 22.666016 L 18.666016 22.666016 z "
67
+       transform="translate(0,1020.3622)"
68
+       id="path6-1" />
69
+    <g
70
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.5px;line-height:125%;font-family:Candara;-inkscape-font-specification:'Candara, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
71
+       id="text4244">
72
+      <path
73
+         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:11.25px;line-height:125%;font-family:Candara;-inkscape-font-specification:'Candara Bold';text-align:start;letter-spacing:0px;writing-mode:lr-tb;text-anchor:start"
74
+         d="M 12.126953 12.363281 C 11.324454 12.363281 10.803045 12.395278 10.458984 12.517578 A 0.28932582 0.28932582 0 0 0 10.269531 12.763672 L 10.169922 13.779297 A 0.28932582 0.28932582 0 0 0 10.515625 14.089844 C 10.810352 14.028844 11.156425 13.994141 11.550781 13.994141 C 11.977694 13.994141 12.26878 14.069169 12.423828 14.167969 C 12.578876 14.266969 12.634766 14.366284 12.634766 14.583984 C 12.634766 14.791384 12.538386 14.948253 12.208984 15.126953 C 11.884315 15.301453 11.439493 15.400391 10.869141 15.400391 A 0.28932582 0.28932582 0 0 0 10.582031 15.652344 L 10.466797 16.535156 A 0.28932582 0.28932582 0 0 0 10.753906 16.861328 C 11.544756 16.861328 12.117621 16.973897 12.455078 17.154297 C 12.792535 17.334697 12.914063 17.535359 12.914062 17.880859 C 12.914062 18.306259 12.71093 18.627741 12.185547 18.931641 A 0.28932582 0.28932582 0 0 0 12.183594 18.931641 C 11.678905 19.228841 10.959278 19.420269 10.025391 19.480469 A 0.28932582 0.28932582 0 0 0 9.7597656 19.816406 L 9.9082031 20.734375 A 0.28932582 0.28932582 0 0 0 10.210938 20.976562 C 11.688814 20.890562 12.874197 20.522709 13.744141 19.849609 C 14.501183 19.265109 14.916016 18.5227 14.916016 17.6875 C 14.916016 17.1333 14.735152 16.634388 14.380859 16.242188 C 14.173437 16.010088 13.913647 15.84625 13.630859 15.71875 C 13.791276 15.61045 13.940171 15.484084 14.070312 15.333984 C 14.28542 15.085494 14.426447 14.80498 14.490234 14.505859 L 13.03125 13.046875 L 12.361328 12.376953 C 12.282758 12.373173 12.208868 12.363281 12.126953 12.363281 z "
75
+         transform="translate(0,1020.3622)"
76
+         id="path4279" />
77
+      <path
78
+         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:11.25px;line-height:125%;font-family:Candara;-inkscape-font-specification:'Candara Bold';text-align:start;letter-spacing:0px;writing-mode:lr-tb;text-anchor:start"
79
+         d="M 18.185547 11.0625 C 18.078253 11.0625 17.879678 11.072078 17.568359 11.080078 C 17.258768 11.091078 17.025331 11.095703 16.873047 11.095703 L 15.912109 11.095703 A 0.25005314 0.25005314 0 0 0 15.662109 11.357422 C 15.675109 11.614386 15.672071 12.004231 15.681641 12.291016 L 17.603516 14.212891 C 17.596486 13.696812 17.590086 13.18008 17.568359 12.689453 C 17.710493 12.676453 17.87197 12.662109 17.960938 12.662109 C 18.755488 12.662109 19.292993 12.879828 19.648438 13.298828 A 0.25005314 0.25005314 0 0 0 19.650391 13.298828 C 20.021445 13.732828 20.205078 14.255656 20.205078 14.910156 C 20.205078 15.495655 20.059181 15.980161 19.785156 16.394531 L 21.044922 17.654297 C 21.076365 17.620449 21.114189 17.595885 21.144531 17.560547 C 21.846503 16.742847 22.204624 15.768381 22.205078 14.675781 C 22.205078 13.698881 21.879926 12.836866 21.244141 12.134766 C 20.589218 11.407066 19.549315 11.0625 18.185547 11.0625 z M 15.714844 15.730469 C 15.70537 16.699847 15.697147 17.674335 15.662109 18.488281 A 0.25005314 0.25005314 0 0 0 15.900391 18.748047 C 16.854996 18.792047 17.604078 18.8125 18.152344 18.8125 C 18.36011 18.8125 18.551424 18.784672 18.746094 18.761719 L 15.714844 15.730469 z "
80
+         transform="translate(0,1020.3622)"
81
+         id="path4281" />
82
+    </g>
83
+    <path
84
+       id="path3122"
85
+       d="m 4.6875,1025.0341 -1.71875,1.6875 0.5,0.5 6.1875,6.1875 8.78125,8.7813 5.5,5.5 1.71875,-1.6875 -20.96875,-20.9688 z"
86
+       inkscape:connector-curvature="0"
87
+       style="fill:#000000;fill-opacity:1;stroke:none" />
88
+  </g>
89
+</svg>
90
sview-17_04.tar.gz/texturesSrc/actionVideoFullscreen3dOn.svg Added
89
 
1
@@ -0,0 +1,87 @@
2
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
3
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
4
+
5
+<svg
6
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
7
+   xmlns:cc="http://creativecommons.org/ns#"
8
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
9
+   xmlns:svg="http://www.w3.org/2000/svg"
10
+   xmlns="http://www.w3.org/2000/svg"
11
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
+   width="32"
14
+   height="32"
15
+   id="svg2"
16
+   version="1.1"
17
+   inkscape:version="0.91 r13725"
18
+   sodipodi:docname="actionVideoFullscreen3dOn.svg"
19
+   inkscape:export-filename="actionVideoFullscreen3dOn.png"
20
+   inkscape:export-xdpi="90"
21
+   inkscape:export-ydpi="90">
22
+  <defs
23
+     id="defs4" />
24
+  <sodipodi:namedview
25
+     id="base"
26
+     pagecolor="#ffffff"
27
+     bordercolor="#666666"
28
+     borderopacity="1.0"
29
+     inkscape:pageopacity="1"
30
+     inkscape:pageshadow="2"
31
+     inkscape:zoom="8"
32
+     inkscape:cx="29.269528"
33
+     inkscape:cy="17.709292"
34
+     inkscape:document-units="px"
35
+     inkscape:current-layer="layer1"
36
+     showgrid="false"
37
+     inkscape:window-width="1920"
38
+     inkscape:window-height="976"
39
+     inkscape:window-x="2552"
40
+     inkscape:window-y="-8"
41
+     inkscape:window-maximized="1" />
42
+  <metadata
43
+     id="metadata7">
44
+    <rdf:RDF>
45
+      <cc:Work
46
+         rdf:about="">
47
+        <dc:format>image/svg+xml</dc:format>
48
+        <dc:type
49
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
50
+        <dc:title />
51
+      </cc:Work>
52
+    </rdf:RDF>
53
+  </metadata>
54
+  <g
55
+     inkscape:label="Layer 1"
56
+     inkscape:groupmode="layer"
57
+     id="layer1"
58
+     transform="translate(0,-1020.3622)">
59
+    <path
60
+       d="m 0,1020.3622 h 32 v 32 H 0 z"
61
+       id="path6"
62
+       inkscape:connector-curvature="0"
63
+       style="fill:none" />
64
+    <path
65
+       d="m 9.3333335,1039.0289 h -2.666667 v 6.6667 h 6.6666665 v -2.6667 H 9.3333335 v -4 z m -2.666667,-5.3333 h 2.666667 v -4 h 3.9999995 v -2.6667 H 6.6666665 v 6.6667 z m 15.9999985,9.3333 h -3.999998 v 2.6667 h 6.666667 v -6.6667 h -2.666669 v 4 z m -3.999998,-16 v 2.6667 h 3.999998 v 4 h 2.666669 v -6.6667 h -6.666667 z"
66
+       id="path6-1"
67
+       style="fill:#000000;fill-opacity:1;stroke:none"
68
+       inkscape:connector-curvature="0" />
69
+    <g
70
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.5px;line-height:125%;font-family:Candara;-inkscape-font-specification:'Candara, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
71
+       id="text4244">
72
+      <path
73
+         sodipodi:type="inkscape:offset"
74
+         inkscape:radius="0.2892969"
75
+         inkscape:original="M 12.126953 1033.0137 C 11.335938 1033.0137 10.812989 1033.0608 10.556641 1033.1523 L 10.457031 1034.168 C 10.775635 1034.102 11.140625 1034.0684 11.550781 1034.0684 C 12.466309 1034.0684 12.923828 1034.3613 12.923828 1034.9473 C 12.923828 1035.2695 12.732178 1035.5354 12.347656 1035.7441 C 11.966797 1035.9492 11.473389 1036.0527 10.869141 1036.0527 L 10.753906 1036.9355 C 12.387207 1036.9355 13.203125 1037.3725 13.203125 1038.2441 C 13.203125 1038.7751 12.912353 1039.2081 12.330078 1039.5449 C 11.769775 1039.8748 11.008057 1040.0708 10.044922 1040.1328 L 10.193359 1041.0508 C 11.632568 1040.9665 12.75708 1040.6106 13.566406 1039.9844 C 14.273194 1039.4387 14.626953 1038.7942 14.626953 1038.0508 C 14.626953 1037.5564 14.473633 1037.1394 14.166016 1036.7988 C 13.862061 1036.4582 13.465576 1036.2466 12.978516 1036.166 L 12.978516 1036.084 C 13.322754 1035.9741 13.613525 1035.7824 13.851562 1035.5078 C 14.111573 1035.2075 14.242188 1034.8784 14.242188 1034.5195 C 14.242188 1034.0654 14.070801 1033.7048 13.726562 1033.4375 C 13.353027 1033.1556 12.819092 1033.0137 12.126953 1033.0137 z "
76
+         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:11.25px;line-height:125%;font-family:Candara;-inkscape-font-specification:'Candara Bold';text-align:start;letter-spacing:0px;writing-mode:lr-tb;text-anchor:start"
77
+         id="path4279"
78
+         d="m 12.126953,1032.7246 c -0.802499,0 -1.323908,0.032 -1.667969,0.1543 a 0.28932582,0.28932582 0 0 0 -0.189453,0.2461 l -0.09961,1.0156 a 0.28932582,0.28932582 0 0 0 0.345703,0.3106 c 0.294727,-0.061 0.6408,-0.094 1.035156,-0.094 0.426913,0 0.717999,0.075 0.873047,0.1738 0.155048,0.099 0.210938,0.1984 0.210938,0.4161 0,0.2074 -0.09638,0.3642 -0.425782,0.5429 -0.324669,0.1745 -0.769491,0.2735 -1.339843,0.2735 a 0.28932582,0.28932582 0 0 0 -0.28711,0.2519 l -0.115234,0.8828 a 0.28932582,0.28932582 0 0 0 0.287109,0.3262 c 0.79085,0 1.363715,0.1126 1.701172,0.293 0.337457,0.1804 0.458984,0.381 0.458984,0.7265 0,0.4254 -0.203132,0.7469 -0.728515,1.0508 a 0.28932582,0.28932582 0 0 0 -0.002,0 c -0.504689,0.2972 -1.224316,0.4887 -2.158203,0.5489 a 0.28932582,0.28932582 0 0 0 -0.2656254,0.3359 l 0.1484375,0.918 a 0.28932582,0.28932582 0 0 0 0.3027349,0.2421 c 1.477876,-0.086 2.663259,-0.4538 3.533203,-1.1269 0.757042,-0.5845 1.171875,-1.3269 1.171875,-2.1621 0,-0.5542 -0.180864,-1.0531 -0.535157,-1.4453 -0.207422,-0.2321 -0.467212,-0.396 -0.75,-0.5235 0.160417,-0.1083 0.309311,-0.2346 0.439453,-0.3847 0.297093,-0.3432 0.460938,-0.7487 0.460938,-1.1778 0,-0.5269 -0.219904,-0.9944 -0.626953,-1.3105 a 0.28932582,0.28932582 0 0 0 -0.0039,-0 c -0.442082,-0.3336 -1.041758,-0.4824 -1.773438,-0.4824 z" />
79
+      <path
80
+         sodipodi:type="inkscape:offset"
81
+         inkscape:radius="0.25002813"
82
+         inkscape:original="M 18.185547 1031.6738 C 18.090332 1031.6738 17.887451 1031.6807 17.576172 1031.6914 C 17.264893 1031.7021 17.030518 1031.707 16.873047 1031.707 L 15.912109 1031.707 C 15.959716 1032.6482 15.984375 1033.7842 15.984375 1035.1172 C 15.984375 1036.5052 15.959716 1037.7534 15.912109 1038.8594 C 16.864258 1038.9034 17.610352 1038.9238 18.152344 1038.9238 C 19.353516 1038.9238 20.288574 1038.5361 20.955078 1037.7598 C 21.621149 1036.9839 21.954646 1036.0763 21.955078 1035.0371 C 21.955078 1034.1143 21.655518 1033.3233 21.058594 1032.6641 C 20.465332 1032.0049 19.507569 1031.6738 18.185547 1031.6738 z M 17.960938 1032.7734 C 18.803222 1032.7734 19.429687 1033.0146 19.839844 1033.498 C 20.25 1033.9778 20.455078 1034.5684 20.455078 1035.2715 C 20.455078 1035.9746 20.263672 1036.5718 19.882812 1037.0625 C 19.505615 1037.5496 18.924072 1037.793 18.136719 1037.793 C 17.898681 1037.793 17.659912 1037.768 17.421875 1037.7207 C 17.385255 1036.8601 17.367188 1035.9925 17.367188 1035.1172 C 17.367188 1034.3189 17.34912 1033.5547 17.3125 1032.8223 C 17.587159 1032.7896 17.803467 1032.7734 17.960938 1032.7734 z "
83
+         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:11.25px;line-height:125%;font-family:Candara;-inkscape-font-specification:'Candara Bold';text-align:start;letter-spacing:0px;writing-mode:lr-tb;text-anchor:start"
84
+         id="path4281"
85
+         d="m 18.185547,1031.4238 c -0.107294,0 -0.305869,0.01 -0.617188,0.018 -0.309591,0.011 -0.543028,0.016 -0.695312,0.016 l -0.960938,0 a 0.25005314,0.25005314 0 0 0 -0.25,0.2618 c 0.04732,0.9354 0.07227,2.0685 0.07227,3.3984 0,1.385 -0.02485,2.6308 -0.07227,3.7324 a 0.25005314,0.25005314 0 0 0 0.238282,0.2598 c 0.954605,0.044 1.703687,0.064 2.251953,0.064 1.254972,0 2.277196,-0.4192 2.992187,-1.2519 0.701972,-0.8177 1.060093,-1.7922 1.060547,-2.8848 0,-0.9769 -0.325152,-1.8389 -0.960937,-2.541 -0.654923,-0.7277 -1.694826,-1.0723 -3.058594,-1.0723 z m -0.224609,1.5996 c 0.794551,0 1.332055,0.2178 1.6875,0.6368 a 0.25005314,0.25005314 0 0 0 0.002,0 c 0.371054,0.434 0.554687,0.9568 0.554687,1.6113 0,0.6577 -0.17404,1.1935 -0.519531,1.6387 -0.325716,0.4206 -0.813004,0.6328 -1.548828,0.6328 -0.155237,0 -0.312039,-0.027 -0.46875,-0.049 -0.03059,-0.7864 -0.05078,-1.5779 -0.05078,-2.3769 0,-0.7179 -0.01936,-1.399 -0.04883,-2.0645 0.142134,-0.013 0.303611,-0.029 0.392579,-0.029 z" />
86
+    </g>
87
+  </g>
88
+</svg>
89
sview-17_04.tar.gz/texturesSrc/hmd_exit_fullscreen.svg Added
90
 
1
@@ -0,0 +1,88 @@
2
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
3
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
4
+
5
+<svg
6
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
7
+   xmlns:cc="http://creativecommons.org/ns#"
8
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
9
+   xmlns:svg="http://www.w3.org/2000/svg"
10
+   xmlns="http://www.w3.org/2000/svg"
11
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
+   width="256"
14
+   height="64"
15
+   id="svg2"
16
+   sodipodi:version="0.32"
17
+   inkscape:version="0.91 r13725"
18
+   version="1.0"
19
+   sodipodi:docname="hmd_exit_fullscreen.svg"
20
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
21
+   inkscape:export-filename="hmd_exit_fullscreen.png"
22
+   inkscape:export-xdpi="90"
23
+   inkscape:export-ydpi="90">
24
+  <defs
25
+     id="defs4" />
26
+  <sodipodi:namedview
27
+     id="base"
28
+     pagecolor="#ffffff"
29
+     bordercolor="#666666"
30
+     borderopacity="1.0"
31
+     gridtolerance="10000"
32
+     guidetolerance="10"
33
+     objecttolerance="10"
34
+     inkscape:pageopacity="0.0"
35
+     inkscape:pageshadow="2"
36
+     inkscape:zoom="5.12"
37
+     inkscape:cx="97.307582"
38
+     inkscape:cy="38.673056"
39
+     inkscape:document-units="px"
40
+     inkscape:current-layer="layer1"
41
+     width="256px"
42
+     height="64px"
43
+     showborder="true"
44
+     inkscape:window-width="1193"
45
+     inkscape:window-height="741"
46
+     inkscape:window-x="2858"
47
+     inkscape:window-y="98"
48
+     showgrid="false"
49
+     inkscape:window-maximized="0" />
50
+  <metadata
51
+     id="metadata7">
52
+    <rdf:RDF>
53
+      <cc:Work
54
+         rdf:about="">
55
+        <dc:format>image/svg+xml</dc:format>
56
+        <dc:type
57
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
58
+      </cc:Work>
59
+    </rdf:RDF>
60
+  </metadata>
61
+  <g
62
+     inkscape:label="Layer 1"
63
+     inkscape:groupmode="layer"
64
+     id="layer1">
65
+    <rect
66
+       style="fill:#000000;fill-opacity:0.51322752;stroke:none"
67
+       id="rect2166"
68
+       width="256"
69
+       height="64"
70
+       x="0"
71
+       y="0" />
72
+    <text
73
+       xml:space="preserve"
74
+       style="font-style:normal;font-weight:normal;font-size:12px;font-family:'Bitstream Vera Sans';fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
75
+       x="129.66238"
76
+       y="26.578556"
77
+       id="text2160"><tspan
78
+         sodipodi:role="line"
79
+         x="129.66238"
80
+         y="26.578556"
81
+         id="tspan2164"
82
+         style="font-size:20px;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">Press Enter</tspan><tspan
83
+         sodipodi:role="line"
84
+         x="129.66238"
85
+         y="51.578556"
86
+         style="font-size:20px;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1"
87
+         id="tspan4139">to exit VR mode</tspan></text>
88
+  </g>
89
+</svg>
90