├── .gitignore ├── API.md ├── AUTHORS ├── CMakeLists.txt ├── LICENSE ├── NOTES ├── README.md ├── _inspiration ├── field-aol-1.jpg ├── field-aol-2.jpg └── lego-movie-ocean.jpg ├── c ├── Makefile ├── README.md ├── _export │ └── .gitkeep ├── add-all-markers.sh ├── add-markers.c ├── batch.c ├── demod-fm-streaming.c ├── demod-fm.c ├── easypng.h ├── fft-batch-broad.c ├── fft-batch.c ├── fft-stitch-broad.c ├── fft-stitch.c ├── fft.c ├── gradual-noise.c ├── gridvis.c ├── iq-lines.c ├── iqvis-rtl.c ├── iqvis.c ├── osc-server.c ├── piqvis.c ├── play.c ├── reader-all.sh ├── reader.c ├── render-text.c ├── rfcap.c ├── sender.c ├── single-sample.c ├── test.wav ├── tv-sender.c └── vis.c ├── data-wrangling ├── bipt_freqs.csv └── csv2lua.py ├── externals ├── lua │ ├── CMakeLists.txt │ └── src │ │ ├── Makefile │ │ ├── lapi.c │ │ ├── lapi.h │ │ ├── lauxlib.c │ │ ├── lauxlib.h │ │ ├── lbaselib.c │ │ ├── lbitlib.c │ │ ├── lcode.c │ │ ├── lcode.h │ │ ├── lcorolib.c │ │ ├── lctype.c │ │ ├── lctype.h │ │ ├── ldblib.c │ │ ├── ldebug.c │ │ ├── ldebug.h │ │ ├── ldo.c │ │ ├── ldo.h │ │ ├── ldump.c │ │ ├── lfunc.c │ │ ├── lfunc.h │ │ ├── lgc.c │ │ ├── lgc.h │ │ ├── linit.c │ │ ├── liolib.c │ │ ├── llex.c │ │ ├── llex.h │ │ ├── llimits.h │ │ ├── lmathlib.c │ │ ├── lmem.c │ │ ├── lmem.h │ │ ├── loadlib.c │ │ ├── lobject.c │ │ ├── lobject.h │ │ ├── lopcodes.c │ │ ├── lopcodes.h │ │ ├── loslib.c │ │ ├── lparser.c │ │ ├── lparser.h │ │ ├── lprefix.h │ │ ├── lstate.c │ │ ├── lstate.h │ │ ├── lstring.c │ │ ├── lstring.h │ │ ├── lstrlib.c │ │ ├── ltable.c │ │ ├── ltable.h │ │ ├── ltablib.c │ │ ├── ltm.c │ │ ├── ltm.h │ │ ├── lua.c │ │ ├── lua.h │ │ ├── lua.hpp │ │ ├── luac.c │ │ ├── luaconf.h │ │ ├── lualib.h │ │ ├── lundump.c │ │ ├── lundump.h │ │ ├── lutf8lib.c │ │ ├── lvm.c │ │ ├── lvm.h │ │ ├── lzio.c │ │ └── lzio.h ├── ovr-0.5.0.1 │ └── Src │ │ ├── CAPI │ │ ├── CAPI_DistortionRenderer.cpp │ │ ├── CAPI_DistortionRenderer.h │ │ ├── CAPI_DistortionTiming.cpp │ │ ├── CAPI_DistortionTiming.h │ │ ├── CAPI_FrameLatencyTracker.cpp │ │ ├── CAPI_FrameLatencyTracker.h │ │ ├── CAPI_FrameTimeManager3.cpp │ │ ├── CAPI_FrameTimeManager3.h │ │ ├── CAPI_HMDRenderState.cpp │ │ ├── CAPI_HMDRenderState.h │ │ ├── CAPI_HMDState.cpp │ │ ├── CAPI_HMDState.h │ │ ├── CAPI_HSWDisplay.cpp │ │ ├── CAPI_HSWDisplay.h │ │ ├── D3D1X │ │ │ ├── CAPI_D3D11_DistortionRenderer.cpp │ │ │ ├── CAPI_D3D11_DistortionRenderer.h │ │ │ ├── CAPI_D3D11_HSWDisplay.cpp │ │ │ ├── CAPI_D3D11_HSWDisplay.h │ │ │ ├── CAPI_D3D11_Util.cpp │ │ │ ├── CAPI_D3D11_Util.h │ │ │ └── Shaders │ │ │ │ ├── DistortionCS2x2.csh │ │ │ │ ├── DistortionChroma_ps.psh │ │ │ │ ├── DistortionChroma_vs.vsh │ │ │ │ ├── DistortionTimewarpChroma_vs.vsh │ │ │ │ ├── Distortion_ps.psh │ │ │ │ ├── SimpleQuad_ps.psh │ │ │ │ ├── SimpleQuad_vs.vsh │ │ │ │ ├── SimpleTexturedQuad_ps.psh │ │ │ │ ├── SimpleTexturedQuad_vs.vsh │ │ │ │ ├── bin2header.exe │ │ │ │ ├── genComputeShaderHeader.bat │ │ │ │ ├── genPixelShaderHeader.bat │ │ │ │ └── genVertexShaderHeader.bat │ │ ├── D3D9 │ │ │ ├── CAPI_D3D9_DistortionRenderer.cpp │ │ │ ├── CAPI_D3D9_DistortionRenderer.h │ │ │ ├── CAPI_D3D9_HSWDisplay.cpp │ │ │ ├── CAPI_D3D9_HSWDisplay.h │ │ │ └── CAPI_D3D9_Util.cpp │ │ ├── GL │ │ │ ├── CAPI_GL_DistortionRenderer.cpp │ │ │ ├── CAPI_GL_DistortionRenderer.h │ │ │ ├── CAPI_GL_DistortionShaders.h │ │ │ ├── CAPI_GL_HSWDisplay.cpp │ │ │ ├── CAPI_GL_HSWDisplay.h │ │ │ ├── CAPI_GL_Util.cpp │ │ │ └── CAPI_GL_Util.h │ │ └── Textures │ │ │ ├── healthAndSafety.tga │ │ │ ├── healthAndSafety.tga.h │ │ │ ├── overdriveLut_dk2.h │ │ │ └── overdriveLut_dk2_2.h │ │ ├── Displays │ │ ├── OVR_Display.cpp │ │ ├── OVR_Display.h │ │ ├── OVR_OSX_Display.cpp │ │ ├── OVR_OSX_Display.h │ │ ├── OVR_Win32_Display.cpp │ │ ├── OVR_Win32_Display.h │ │ ├── OVR_Win32_Dxgi_Display.h │ │ ├── OVR_Win32_FocusReader.cpp │ │ ├── OVR_Win32_FocusReader.h │ │ ├── OVR_Win32_RenderShim.cpp │ │ ├── OVR_Win32_ShimFunctions.cpp │ │ ├── OVR_Win32_ShimFunctions.h │ │ └── OVR_Win32_ShimVersion.h │ │ ├── Net │ │ ├── OVR_BitStream.cpp │ │ ├── OVR_BitStream.h │ │ ├── OVR_MessageIDTypes.h │ │ ├── OVR_NetworkPlugin.cpp │ │ ├── OVR_NetworkPlugin.h │ │ ├── OVR_NetworkTypes.h │ │ ├── OVR_PacketizedTCPSocket.cpp │ │ ├── OVR_PacketizedTCPSocket.h │ │ ├── OVR_RPC1.cpp │ │ ├── OVR_RPC1.h │ │ ├── OVR_Session.cpp │ │ ├── OVR_Session.h │ │ ├── OVR_Socket.cpp │ │ ├── OVR_Socket.h │ │ ├── OVR_Unix_Socket.cpp │ │ ├── OVR_Unix_Socket.h │ │ ├── OVR_Win32_Socket.cpp │ │ └── OVR_Win32_Socket.h │ │ ├── OVR_CAPI.cpp │ │ ├── OVR_Profile.cpp │ │ ├── OVR_Profile.h │ │ ├── OVR_SerialFormat.cpp │ │ ├── OVR_SerialFormat.h │ │ ├── OVR_Stereo.cpp │ │ ├── OVR_Stereo.h │ │ ├── Sensors │ │ └── OVR_DeviceConstants.h │ │ ├── Service │ │ ├── Service_NetClient.cpp │ │ ├── Service_NetClient.h │ │ ├── Service_NetSessionCommon.cpp │ │ ├── Service_NetSessionCommon.h │ │ ├── Service_Win32_FastIPC_Client.cpp │ │ └── Service_Win32_FastIPC_Client.h │ │ ├── Util │ │ ├── Util_Interface.cpp │ │ ├── Util_Interface.h │ │ ├── Util_LatencyTest2Reader.cpp │ │ ├── Util_LatencyTest2Reader.h │ │ ├── Util_LatencyTest2State.h │ │ ├── Util_MatFile.cpp │ │ ├── Util_MatFile.h │ │ ├── Util_Render_Stereo.cpp │ │ └── Util_Render_Stereo.h │ │ └── Vision │ │ ├── SensorFusion │ │ ├── Vision_SensorState.h │ │ ├── Vision_SensorStateReader.cpp │ │ └── Vision_SensorStateReader.h │ │ └── Vision_Common.h ├── ovr │ ├── Include │ │ ├── OVR.h │ │ ├── OVR_Kernel.h │ │ └── OVR_Version.h │ ├── Lib │ │ └── Mac │ │ │ ├── Debug │ │ │ └── libovr.a │ │ │ └── Release │ │ │ └── libovr.a │ └── Src │ │ ├── CAPI │ │ ├── CAPI_DistortionRenderer.cpp │ │ ├── CAPI_DistortionRenderer.h │ │ ├── CAPI_FrameTimeManager.cpp │ │ ├── CAPI_FrameTimeManager.h │ │ ├── CAPI_HMDRenderState.cpp │ │ ├── CAPI_HMDRenderState.h │ │ ├── CAPI_HMDState.cpp │ │ ├── CAPI_HMDState.h │ │ ├── CAPI_HSWDisplay.cpp │ │ ├── CAPI_HSWDisplay.h │ │ ├── CAPI_LatencyStatistics.cpp │ │ ├── CAPI_LatencyStatistics.h │ │ ├── GL │ │ │ ├── CAPI_GLE.cpp │ │ │ ├── CAPI_GLE.h │ │ │ ├── CAPI_GLE_GL.h │ │ │ ├── CAPI_GL_DistortionRenderer.cpp │ │ │ ├── CAPI_GL_DistortionRenderer.h │ │ │ ├── CAPI_GL_DistortionShaders.h │ │ │ ├── CAPI_GL_HSWDisplay.cpp │ │ │ ├── CAPI_GL_HSWDisplay.h │ │ │ ├── CAPI_GL_Util.cpp │ │ │ └── CAPI_GL_Util.h │ │ └── Textures │ │ │ └── healthAndSafety.tga.h │ │ ├── Displays │ │ ├── OVR_Display.cpp │ │ ├── OVR_Display.h │ │ ├── OVR_OSX_Display.cpp │ │ ├── OVR_OSX_Display.h │ │ ├── OVR_OSX_FocusObserver.h │ │ ├── OVR_OSX_FocusObserver.mm │ │ ├── OVR_OSX_FocusReader.h │ │ └── OVR_OSX_FocusReader.mm │ │ ├── Kernel │ │ ├── OVR_Alg.cpp │ │ ├── OVR_Alg.h │ │ ├── OVR_Allocator.cpp │ │ ├── OVR_Allocator.h │ │ ├── OVR_Array.h │ │ ├── OVR_Atomic.cpp │ │ ├── OVR_Atomic.h │ │ ├── OVR_CRC32.cpp │ │ ├── OVR_CRC32.h │ │ ├── OVR_Color.h │ │ ├── OVR_Compiler.h │ │ ├── OVR_ContainerAllocator.h │ │ ├── OVR_DebugHelp.cpp │ │ ├── OVR_DebugHelp.h │ │ ├── OVR_Delegates.h │ │ ├── OVR_Deque.h │ │ ├── OVR_File.cpp │ │ ├── OVR_File.h │ │ ├── OVR_FileFILE.cpp │ │ ├── OVR_Hash.h │ │ ├── OVR_KeyCodes.h │ │ ├── OVR_List.h │ │ ├── OVR_Lockless.cpp │ │ ├── OVR_Lockless.h │ │ ├── OVR_Log.cpp │ │ ├── OVR_Log.h │ │ ├── OVR_Math.cpp │ │ ├── OVR_Math.h │ │ ├── OVR_Nullptr.h │ │ ├── OVR_Observer.h │ │ ├── OVR_RefCount.cpp │ │ ├── OVR_RefCount.h │ │ ├── OVR_SharedMemory.cpp │ │ ├── OVR_SharedMemory.h │ │ ├── OVR_Std.cpp │ │ ├── OVR_Std.h │ │ ├── OVR_String.cpp │ │ ├── OVR_String.h │ │ ├── OVR_StringHash.h │ │ ├── OVR_String_FormatUtil.cpp │ │ ├── OVR_String_PathUtil.cpp │ │ ├── OVR_SysFile.cpp │ │ ├── OVR_SysFile.h │ │ ├── OVR_System.cpp │ │ ├── OVR_System.h │ │ ├── OVR_ThreadCommandQueue.cpp │ │ ├── OVR_ThreadCommandQueue.h │ │ ├── OVR_Threads.h │ │ ├── OVR_ThreadsPthread.cpp │ │ ├── OVR_Timer.cpp │ │ ├── OVR_Timer.h │ │ ├── OVR_Types.h │ │ ├── OVR_UTF8Util.cpp │ │ ├── OVR_UTF8Util.h │ │ ├── OVR_mach_exc_OSX.c │ │ └── OVR_mach_exc_OSX.h │ │ ├── Net │ │ ├── OVR_BitStream.cpp │ │ ├── OVR_BitStream.h │ │ ├── OVR_MessageIDTypes.h │ │ ├── OVR_NetworkPlugin.cpp │ │ ├── OVR_NetworkPlugin.h │ │ ├── OVR_NetworkTypes.h │ │ ├── OVR_PacketizedTCPSocket.cpp │ │ ├── OVR_PacketizedTCPSocket.h │ │ ├── OVR_RPC1.cpp │ │ ├── OVR_RPC1.h │ │ ├── OVR_Session.cpp │ │ ├── OVR_Session.h │ │ ├── OVR_Socket.cpp │ │ ├── OVR_Socket.h │ │ ├── OVR_Unix_Socket.cpp │ │ └── OVR_Unix_Socket.h │ │ ├── OVR_CAPI.cpp │ │ ├── OVR_CAPI.h │ │ ├── OVR_CAPI_GL.h │ │ ├── OVR_CAPI_Keys.h │ │ ├── OVR_JSON.cpp │ │ ├── OVR_JSON.h │ │ ├── OVR_Profile.cpp │ │ ├── OVR_Profile.h │ │ ├── OVR_SerialFormat.cpp │ │ ├── OVR_SerialFormat.h │ │ ├── OVR_Stereo.cpp │ │ ├── OVR_Stereo.h │ │ ├── Sensors │ │ └── OVR_DeviceConstants.h │ │ ├── Service │ │ ├── Service_NetClient.cpp │ │ ├── Service_NetClient.h │ │ ├── Service_NetSessionCommon.cpp │ │ └── Service_NetSessionCommon.h │ │ ├── Tracking │ │ ├── Tracking_PoseState.h │ │ ├── Tracking_SensorState.h │ │ ├── Tracking_SensorStateReader.cpp │ │ └── Tracking_SensorStateReader.h │ │ └── Util │ │ ├── Util_ImageWindow.cpp │ │ ├── Util_ImageWindow.h │ │ ├── Util_Interface.cpp │ │ ├── Util_Interface.h │ │ ├── Util_LatencyTest2Reader.cpp │ │ ├── Util_LatencyTest2Reader.h │ │ ├── Util_LatencyTest2State.h │ │ ├── Util_Render_Stereo.cpp │ │ ├── Util_Render_Stereo.h │ │ ├── Util_SystemGUI.cpp │ │ ├── Util_SystemGUI.h │ │ ├── Util_SystemGUI_OSX.mm │ │ ├── Util_SystemInfo.cpp │ │ ├── Util_SystemInfo.h │ │ └── Util_SystemInfo_OSX.mm └── stb │ ├── stb_image.h │ └── stb_truetype.h ├── fonts ├── Roboto-Bold.ttf ├── RobotoCondensed-Bold.ttf ├── RobotoCondensed-Light.ttf └── RobotoCondensed-Regular.ttf ├── frequensea-osculator-config.oscd ├── houdini └── surface.hipnc ├── img ├── grad-bry.jpg ├── grad-rainbow.jpg ├── lenna-tv.jpg ├── negx.jpg ├── negy.jpg ├── negz.jpg ├── posx.jpg ├── posy.jpg └── posz.jpg ├── lua ├── _frequencies.lua ├── _keys.lua ├── animate-camera.lua ├── capture-model.lua ├── diffuse.lua ├── draw-text.lua ├── dvbt-animate-one.lua ├── dvbt.lua ├── empty.lua ├── fft-sea-auto.lua ├── fft-sea-sick.lua ├── fft-sea.lua ├── fft-shifted.lua ├── fft.lua ├── fm-player.lua ├── grid-ripple.lua ├── grid.lua ├── iq-lines-animate-freq.lua ├── iq-lines-animate-one.lua ├── iq-lines-buffer.lua ├── iq-lines.lua ├── iq-tex-3d-filtered.lua ├── iq-tex-3d.lua ├── iq-tex-audio.lua ├── iq-tex-filtered.lua ├── iq-tex-steps.lua ├── iq-tex.lua ├── keys.lua ├── model-sea.lua ├── noise-grid-triangles.lua ├── noise-grid-wave.lua ├── noise-grid.lua ├── osc-rotate.lua ├── osc-server.lua ├── psychedelic-noise.lua ├── samples-and-model.lua ├── samples-tex-3d-filtered.lua ├── samples-tex-3d.lua ├── samples-tex-shaded.lua ├── samples-tex-slow.lua ├── samples-tex.lua ├── sea-grid.lua ├── signal-detector.lua ├── skybox.lua ├── slinky-points.lua ├── slinky-slow.lua ├── slinky-two-point-five.lua ├── slinky-vr.lua ├── slinky.lua ├── static-gradient.lua ├── static.lua └── texture-image.lua ├── obj ├── c004.obj ├── cubes.obj ├── grid.obj └── monkey.obj ├── rfdata ├── rf-100.900-1.raw ├── rf-100.900-2.raw ├── rf-100.900-3.raw ├── rf-1278.000-1.raw ├── rf-1574.182-1.raw ├── rf-1574.182-2.raw ├── rf-1574.182-3.raw ├── rf-2.500-1.raw ├── rf-2.500-2.raw ├── rf-2.500-3.raw ├── rf-200.500-big.raw ├── rf-2003.800-1.raw ├── rf-2003.800-2.raw ├── rf-2003.800-3.raw ├── rf-202.500-1.raw ├── rf-202.500-2.raw ├── rf-202.500-3.raw ├── rf-2040.200-1.raw ├── rf-2040.200-2.raw ├── rf-2040.200-3.raw ├── rf-2072.300-1.raw ├── rf-2072.300-2.raw ├── rf-2072.300-3.raw ├── rf-2104.800-1.raw ├── rf-2104.800-2.raw ├── rf-2104.800-3.raw ├── rf-394.855-1.raw ├── rf-4.000-1.raw ├── rf-4.000-2.raw ├── rf-4.000-3.raw ├── rf-433.000-short.raw ├── rf-433.000.raw ├── rf-612.004-1.raw ├── rf-612.004-2.raw ├── rf-612.004-3.raw ├── rf-862.000-1.raw └── rf-887.000-1.raw ├── rpi-fdb ├── Makefile ├── README ├── iqvis.c └── iqvis_lines.c ├── rust ├── Cargo.lock ├── Cargo.toml └── src │ └── main.rs ├── screenshots └── fft-sea.png ├── shaders ├── skybox.frag └── skybox.vert └── src ├── main.cpp ├── nfile.c ├── nfile.h ├── ngl.c ├── ngl.h ├── nim.c ├── nim.h ├── noise.c ├── noise.h ├── nosc.c ├── nosc.h ├── nrf.c ├── nrf.h ├── nut.c ├── nut.h ├── nvr.cpp ├── nvr.h ├── nwm.c ├── nwm.h ├── obj.c ├── obj.h ├── vec.c └── vec.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.dSYM 2 | /build/*.png 3 | /c/**/*.png 4 | /build 5 | /c/add-markers 6 | /c/batch 7 | /c/demod-fm 8 | /c/demod-fm-streaming 9 | /c/export 10 | /c/fft 11 | /c/fft-batch 12 | /c/fft-batch-broad 13 | /c/fft-stitch 14 | /c/fft-stitch-broad 15 | /c/gradual-noise 16 | /c/gridvis 17 | /c/iq-lines 18 | /c/iqvis 19 | /c/iqvis-rtl 20 | /c/osc-server 21 | /c/piqvis 22 | /c/play 23 | /c/reader 24 | /c/rfcap 25 | /c/sender 26 | /c/single-sample 27 | /c/tv-sender 28 | /c/vis 29 | /c/render-text 30 | /rpi-fdb/iqvis 31 | /rpi-fdb/iqvis_lines 32 | /rust/target 33 | /rftmp 34 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # Primary Author 2 | Frederik De Bleser 3 | 4 | # Contributors 5 | Lieven Menschaert 6 | Pieter Heremans 7 | 8 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.4) 2 | project(frequensea) 3 | 4 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99 -g -Wall -Werror -pedantic") 5 | 6 | add_subdirectory(externals/lua) 7 | 8 | include_directories(src) 9 | include_directories(externals/ovr/Include) 10 | include_directories(externals/ovr/Src) 11 | include_directories(externals/lua/src) 12 | include_directories(externals/stb) 13 | 14 | find_library(LIBRARY_MATH m) 15 | find_library(LIBRARY_PTHREAD pthread) 16 | find_library(LIBRARY_FFTW fftw3) 17 | find_library(LIBRARY_HACKRF hackrf) 18 | find_library(LIBRARY_PNG png) 19 | find_library(LIBRARY_RTLSDR rtlsdr) 20 | 21 | find_package(PkgConfig REQUIRED) 22 | pkg_search_module(GLFW REQUIRED glfw3) 23 | include_directories(${GLFW_INCLUDE_DIRS}) 24 | 25 | find_package(OpenGL REQUIRED) 26 | find_package(GLEW REQUIRED) 27 | 28 | include(FindOpenAL) 29 | set(CORE_LIBS ${LIBRARY_MATH} ${LIBRARY_PTHREAD} ${LIBRARY_FFTW} ${LIBRARY_HACKRF} ${LIBRARY_PNG} ${LIBRARY_RTLSDR} ${OPENGL_LIBRARY}) 30 | include_directories(${GLEW_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIR}) 31 | 32 | if (APPLE) 33 | include_directories(/System/Library/Frameworks /usr/local/include) 34 | #find_library(LIBRARY_OVR ovr PATHS externals/ovr/Lib/Mac/Debug) 35 | find_library(FRAMEWORK_COCOA Cocoa) 36 | find_library(FRAMEWORK_OPENGL OpenGL) 37 | find_library(FRAMEWORK_OPENAL OpenAL) 38 | find_library(FRAMEWORK_CORE_VIDEO CoreVideo) 39 | find_library(FRAMEWORK_IO_KIT IOKit) 40 | set(PLATFORM_LIBS ${LIBRARY_OVR} ${FRAMEWORK_COCOA} ${FRAMEWORK_OPENGL} ${FRAMEWORK_OPENAL} ${FRAMEWORK_CORE_VIDEO} ${FRAMEWORK_IO_KIT}) 41 | #add_definitions(-DWITH_NVR) 42 | #set(WITH_NVR 1) 43 | endif (APPLE) 44 | 45 | if (LINUX) 46 | find_package(X11 REQUIRED) 47 | set(PLATFORM_LIBS ${X11_X11_LIB} ${RT_LIBRARY} ${X11_Xrandr_LIB}) 48 | endif (LINUX) 49 | 50 | set(SOURCE_FILES 51 | src/main.cpp 52 | src/nfile.c 53 | src/ngl.c 54 | src/nim.c 55 | src/noise.c 56 | src/nosc.c 57 | src/nrf.c 58 | src/nut.c 59 | src/nwm.c 60 | src/obj.c 61 | src/vec.c) 62 | 63 | if (WITH_NVR) 64 | set(SOURCE_FILES ${SOURCE_FILES} src/nvr.cpp) 65 | endif (WITH_NVR) 66 | 67 | add_executable(frequensea ${SOURCE_FILES}) 68 | target_link_libraries(frequensea ${CORE_LIBS} ${PLATFORM_LIBS} stdc++ lua ${GLEW_LIBRARIES} ${OPENAL_LIBRARY} ${GLFW_LDFLAGS}) 69 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Frederik De Bleser 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /NOTES: -------------------------------------------------------------------------------- 1 | ## hackrf public header 2 | 3 | https://github.com/mossmann/hackrf/blob/master/host/libhackrf/src/hackrf.h -------------------------------------------------------------------------------- /_inspiration/field-aol-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/_inspiration/field-aol-1.jpg -------------------------------------------------------------------------------- /_inspiration/field-aol-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/_inspiration/field-aol-2.jpg -------------------------------------------------------------------------------- /_inspiration/lego-movie-ocean.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/_inspiration/lego-movie-ocean.jpg -------------------------------------------------------------------------------- /c/README.md: -------------------------------------------------------------------------------- 1 | Mac OS X 2 | ======== 3 | To install on OS X: 4 | 5 | sudo port install hackrf glfw libpng fftw 6 | make vis && ./vis 7 | -------------------------------------------------------------------------------- /c/_export/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/c/_export/.gitkeep -------------------------------------------------------------------------------- /c/add-all-markers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | make add-markers 3 | ./add-markers 10 465 4 | ./add-markers 470 925 5 | ./add-markers 930 1385 6 | ./add-markers 1390 1845 7 | ./add-markers 1850 2305 8 | ./add-markers 2310 2765 9 | ./add-markers 2770 3225 10 | ./add-markers 3230 3685 11 | ./add-markers 3690 4145 12 | ./add-markers 4150 4605 13 | -------------------------------------------------------------------------------- /c/easypng.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // Write a grayscale PNG image. 6 | static void write_gray_png(const char *fname, const int width, const int height, uint8_t *buffer) { 7 | png_structp png_ptr = NULL; 8 | png_infop info_ptr = NULL; 9 | png_bytepp row_pointers; 10 | 11 | FILE *fp = fopen(fname, "wb"); 12 | if (!fp) { 13 | printf("ERROR: Could not write open file %s for writing.\n", fname); 14 | return; 15 | } 16 | 17 | // Init PNG writer. 18 | png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 19 | if (png_ptr == NULL) { 20 | printf("ERROR: png_create_write_struct.\n"); 21 | return; 22 | } 23 | 24 | info_ptr = png_create_info_struct(png_ptr); 25 | if (info_ptr == NULL) { 26 | printf("ERROR: png_create_info_struct.\n"); 27 | png_destroy_write_struct(&png_ptr, NULL); 28 | return; 29 | } 30 | 31 | png_set_IHDR(png_ptr, info_ptr, 32 | width, height, 33 | 8, 34 | PNG_COLOR_TYPE_GRAY, 35 | PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); 36 | 37 | // PNG expects a list of pointers. We just calculate offsets into our buffer. 38 | row_pointers = (png_bytepp) png_malloc(png_ptr, height * sizeof(png_bytep)); 39 | for (int y = 0; y < height; y++) { 40 | row_pointers[y] = buffer + y * width; 41 | } 42 | 43 | // Write out the image data. 44 | png_init_io(png_ptr, fp); 45 | png_set_rows(png_ptr, info_ptr, row_pointers); 46 | png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); 47 | 48 | // Cleanup. 49 | png_free(png_ptr, row_pointers); 50 | png_destroy_write_struct(&png_ptr, &info_ptr); 51 | fclose(fp); 52 | printf("Written %s.\n", fname); 53 | } 54 | -------------------------------------------------------------------------------- /c/rfcap.c: -------------------------------------------------------------------------------- 1 | // Capture n samples of a frequency range. 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | const int SAMPLE_SIZE=512*512; 10 | 11 | double current_freq = 0; 12 | int n_samples = 0; 13 | 14 | hackrf_device *device; 15 | int receive_count = 0; 16 | uint8_t buffer[SAMPLE_SIZE]; 17 | 18 | #define HACKRF_CHECK_STATUS(status, message) \ 19 | if (status != 0) { \ 20 | printf("FAIL: %s\n", message); \ 21 | hackrf_close(device); \ 22 | hackrf_exit(); \ 23 | exit(EXIT_FAILURE); \ 24 | } \ 25 | 26 | void export_buffer(uint8_t *buffer) { 27 | char fname[100]; 28 | snprintf(fname, 100, "export/rf-%.3f-%d.raw", current_freq, receive_count + 1); 29 | printf("%s\n", fname); 30 | FILE *write_ptr = fopen(fname, "wb"); 31 | fwrite(buffer, SAMPLE_SIZE, 1, write_ptr); 32 | fclose(write_ptr); 33 | } 34 | 35 | 36 | int receive_sample_block(hackrf_transfer *transfer) { 37 | memcpy(buffer, transfer->buffer, SAMPLE_SIZE); 38 | export_buffer(buffer); 39 | receive_count += 1; 40 | return 0; 41 | } 42 | 43 | int main(int argc, char **argv) { 44 | int status; 45 | 46 | if (argc != 3) { 47 | printf("Usage: rfcap FREQ N_SAMPLES\n"); 48 | exit(EXIT_FAILURE); 49 | } 50 | 51 | current_freq = atof(argv[1]); 52 | n_samples = atoi(argv[2]); 53 | 54 | status = hackrf_init(); 55 | HACKRF_CHECK_STATUS(status, "hackrf_init"); 56 | 57 | status = hackrf_open(&device); 58 | HACKRF_CHECK_STATUS(status, "hackrf_open"); 59 | 60 | status = hackrf_set_freq(device, current_freq * 1e6); 61 | HACKRF_CHECK_STATUS(status, "hackrf_set_freq"); 62 | 63 | status = hackrf_set_sample_rate(device, 10e6); 64 | HACKRF_CHECK_STATUS(status, "hackrf_set_sample_rate"); 65 | 66 | status = hackrf_set_amp_enable(device, 0); 67 | HACKRF_CHECK_STATUS(status, "hackrf_set_amp_enable"); 68 | 69 | status = hackrf_set_lna_gain(device, 32); 70 | HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain"); 71 | 72 | status = hackrf_set_vga_gain(device, 30); 73 | HACKRF_CHECK_STATUS(status, "hackrf_set_lna_gain"); 74 | 75 | status = hackrf_start_rx(device, receive_sample_block, NULL); 76 | HACKRF_CHECK_STATUS(status, "hackrf_start_rx"); 77 | 78 | while (receive_count < n_samples) { 79 | usleep(100); 80 | } 81 | 82 | hackrf_stop_rx(device); 83 | hackrf_close(device); 84 | hackrf_exit(); 85 | return 0; 86 | } 87 | -------------------------------------------------------------------------------- /c/sender.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int send_sample_block(hackrf_transfer *transfer) { 7 | arc4random_buf(transfer->buffer, transfer->buffer_length); 8 | printf("block length: %d\n", transfer->valid_length); 9 | return 0; 10 | } 11 | 12 | int main(int argc, char **argv) { 13 | int status; 14 | status = hackrf_init(); 15 | if (status != 0) { 16 | printf("FAIL: hackrf_init\n"); 17 | hackrf_exit(); 18 | exit(EXIT_FAILURE); 19 | } 20 | 21 | hackrf_device *device; 22 | status = hackrf_open(&device); 23 | if (status != 0) { 24 | printf("FAIL: hackrf_open\n"); 25 | hackrf_exit(); 26 | exit(EXIT_FAILURE); 27 | } 28 | 29 | status = hackrf_set_freq(device, 100.9e6); 30 | if (status != 0) { 31 | printf("FAIL: hackrf_set_freq: %d\n", status); 32 | hackrf_close(device); 33 | hackrf_exit(); 34 | exit(EXIT_FAILURE); 35 | } 36 | 37 | status = hackrf_set_amp_enable(device, 1); 38 | if (status != 0) { 39 | printf("FAIL: hackrf_set_amp_enable: %d\n", status); 40 | hackrf_close(device); 41 | hackrf_exit(); 42 | exit(EXIT_FAILURE); 43 | } 44 | 45 | status = hackrf_set_lna_gain(device, 40); 46 | if (status != 0) { 47 | printf("FAIL: hackrf_set_lna_gain: %d\n", status); 48 | hackrf_close(device); 49 | hackrf_exit(); 50 | exit(EXIT_FAILURE); 51 | } 52 | 53 | status = hackrf_set_vga_gain(device, 62); 54 | if (status != 0) { 55 | printf("FAIL: hackrf_set_vga_gain: %d\n", status); 56 | hackrf_close(device); 57 | hackrf_exit(); 58 | exit(EXIT_FAILURE); 59 | } 60 | 61 | status = hackrf_set_txvga_gain(device, 47); 62 | if (status != 0) { 63 | printf("FAIL: hackrf_set_txvga_gain: %d\n", status); 64 | hackrf_close(device); 65 | hackrf_exit(); 66 | exit(EXIT_FAILURE); 67 | } 68 | 69 | status = hackrf_start_tx(device, send_sample_block, NULL); 70 | if (status != 0) { 71 | printf("FAIL: hackrf_start_rx: %d\n", status); 72 | hackrf_close(device); 73 | hackrf_exit(); 74 | exit(EXIT_FAILURE); 75 | } 76 | 77 | sleep(3); 78 | 79 | hackrf_stop_tx(device); 80 | hackrf_close(device); 81 | hackrf_exit(); 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /c/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/c/test.wav -------------------------------------------------------------------------------- /data-wrangling/csv2lua.py: -------------------------------------------------------------------------------- 1 | # Convert a CSV file to a Lua table script that can be imported using `dofile`. 2 | 3 | import csv 4 | 5 | def csv2lua(in_file, out_file, global_name): 6 | fp_in = open(in_file, 'r') 7 | rows = list(csv.reader(fp_in)) 8 | fp_in.close() 9 | 10 | headers = rows[0] 11 | lua_rows = [] 12 | for row in rows[1:]: 13 | cells = [] 14 | print row 15 | for i, cell in enumerate(row): 16 | key = headers[i] 17 | try: 18 | cell = int(cell) 19 | cells.append('%s=%s' % (key, cell)) 20 | except ValueError: 21 | cells.append('%s="%s"' % (key, cell)) 22 | lua_rows.append(' {' + ', '.join(cells) + '}') 23 | 24 | 25 | 26 | #start_freq, end_freq, allocation, applications = row 27 | #s = ' {start_freq=%s, end_freq=%s, allocation="%s", applications="%s"}' % (start_freq, end_freq, allocation, applications) 28 | #lua_rows.append(s) 29 | s = '%s = {\n%s\n}\n' % (global_name, ',\n'.join(lua_rows)) 30 | print s 31 | fp_out = open(out_file, 'w') 32 | fp_out.write(s) 33 | fp_out.close() 34 | 35 | def usage(): 36 | print "python csv2lua.py " 37 | 38 | if __name__ == '__main__': 39 | import sys 40 | if len(sys.argv) != 4: 41 | usage() 42 | else: 43 | csv2lua(sys.argv[1], sys.argv[2], sys.argv[3]) 44 | -------------------------------------------------------------------------------- /externals/lua/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.4) 2 | 3 | set(LUA_SOURCES 4 | src/lapi.c 5 | src/lauxlib.c 6 | src/lbaselib.c 7 | src/lbitlib.c 8 | src/lcode.c 9 | src/lcorolib.c 10 | src/lctype.c 11 | src/ldblib.c 12 | src/ldebug.c 13 | src/ldo.c 14 | src/ldump.c 15 | src/lfunc.c 16 | src/lgc.c 17 | src/linit.c 18 | src/liolib.c 19 | src/llex.c 20 | src/lmathlib.c 21 | src/lmem.c 22 | src/loadlib.c 23 | src/lobject.c 24 | src/lopcodes.c 25 | src/loslib.c 26 | src/lparser.c 27 | src/lstate.c 28 | src/lstring.c 29 | src/lstrlib.c 30 | src/ltable.c 31 | src/ltablib.c 32 | src/ltm.c 33 | src/lua.c 34 | src/luac.c 35 | src/lundump.c 36 | src/lutf8lib.c 37 | src/lvm.c 38 | src/lzio.c) 39 | 40 | add_library(lua ${LUA_SOURCES}) 41 | -------------------------------------------------------------------------------- /externals/lua/src/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.8 2014/07/15 21:26:50 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "llimits.h" 12 | #include "lstate.h" 13 | 14 | #define api_incr_top(L) {L->top++; api_check(L->top <= L->ci->top, \ 15 | "stack overflow");} 16 | 17 | #define adjustresults(L,nres) \ 18 | { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } 19 | 20 | #define api_checknelems(L,n) api_check((n) < (L->top - L->ci->func), \ 21 | "not enough elements in the stack") 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /externals/lua/src/lctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lctype.c,v 1.12 2014/11/02 19:19:04 roberto Exp $ 3 | ** 'ctype' functions for Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #define lctype_c 8 | #define LUA_CORE 9 | 10 | #include "lprefix.h" 11 | 12 | 13 | #include "lctype.h" 14 | 15 | #if !LUA_USE_CTYPE /* { */ 16 | 17 | #include 18 | 19 | LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = { 20 | 0x00, /* EOZ */ 21 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ 22 | 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 23 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ 24 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 25 | 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ 26 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 27 | 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ 28 | 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 29 | 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ 30 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 31 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ 32 | 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, 33 | 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ 34 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 35 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ 36 | 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8. */ 38 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9. */ 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a. */ 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b. */ 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c. */ 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d. */ 48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e. */ 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f. */ 52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 | }; 54 | 55 | #endif /* } */ 56 | -------------------------------------------------------------------------------- /externals/lua/src/lctype.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $ 3 | ** 'ctype' functions for Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lctype_h 8 | #define lctype_h 9 | 10 | #include "lua.h" 11 | 12 | 13 | /* 14 | ** WARNING: the functions defined here do not necessarily correspond 15 | ** to the similar functions in the standard C ctype.h. They are 16 | ** optimized for the specific needs of Lua 17 | */ 18 | 19 | #if !defined(LUA_USE_CTYPE) 20 | 21 | #if 'A' == 65 && '0' == 48 22 | /* ASCII case: can use its own tables; faster and fixed */ 23 | #define LUA_USE_CTYPE 0 24 | #else 25 | /* must use standard C ctype */ 26 | #define LUA_USE_CTYPE 1 27 | #endif 28 | 29 | #endif 30 | 31 | 32 | #if !LUA_USE_CTYPE /* { */ 33 | 34 | #include 35 | 36 | #include "llimits.h" 37 | 38 | 39 | #define ALPHABIT 0 40 | #define DIGITBIT 1 41 | #define PRINTBIT 2 42 | #define SPACEBIT 3 43 | #define XDIGITBIT 4 44 | 45 | 46 | #define MASK(B) (1 << (B)) 47 | 48 | 49 | /* 50 | ** add 1 to char to allow index -1 (EOZ) 51 | */ 52 | #define testprop(c,p) (luai_ctype_[(c)+1] & (p)) 53 | 54 | /* 55 | ** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' 56 | */ 57 | #define lislalpha(c) testprop(c, MASK(ALPHABIT)) 58 | #define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) 59 | #define lisdigit(c) testprop(c, MASK(DIGITBIT)) 60 | #define lisspace(c) testprop(c, MASK(SPACEBIT)) 61 | #define lisprint(c) testprop(c, MASK(PRINTBIT)) 62 | #define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) 63 | 64 | /* 65 | ** this 'ltolower' only works for alphabetic characters 66 | */ 67 | #define ltolower(c) ((c) | ('A' ^ 'a')) 68 | 69 | 70 | /* two more entries for 0 and -1 (EOZ) */ 71 | LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; 72 | 73 | 74 | #else /* }{ */ 75 | 76 | /* 77 | ** use standard C ctypes 78 | */ 79 | 80 | #include 81 | 82 | 83 | #define lislalpha(c) (isalpha(c) || (c) == '_') 84 | #define lislalnum(c) (isalnum(c) || (c) == '_') 85 | #define lisdigit(c) (isdigit(c)) 86 | #define lisspace(c) (isspace(c)) 87 | #define lisprint(c) (isprint(c)) 88 | #define lisxdigit(c) (isxdigit(c)) 89 | 90 | #define ltolower(c) (tolower(c)) 91 | 92 | #endif /* } */ 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /externals/lua/src/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h,v 2.12 2014/11/10 14:46:05 roberto Exp $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) 15 | 16 | #define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : -1) 17 | 18 | #define resethookcount(L) (L->hookcount = L->basehookcount) 19 | 20 | /* Active Lua function (given call info) */ 21 | #define ci_func(ci) (clLvalue((ci)->func)) 22 | 23 | 24 | LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, 25 | const char *opname); 26 | LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, 27 | const TValue *p2); 28 | LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, 29 | const TValue *p2, 30 | const char *msg); 31 | LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, 32 | const TValue *p2); 33 | LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, 34 | const TValue *p2); 35 | LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); 36 | LUAI_FUNC l_noret luaG_errormsg (lua_State *L); 37 | LUAI_FUNC void luaG_traceexec (lua_State *L); 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /externals/lua/src/ldo.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldo.h,v 2.21 2014/10/25 11:50:46 roberto Exp $ 3 | ** Stack and Call structure of Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldo_h 8 | #define ldo_h 9 | 10 | 11 | #include "lobject.h" 12 | #include "lstate.h" 13 | #include "lzio.h" 14 | 15 | 16 | #define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \ 17 | luaD_growstack(L, n); else condmovestack(L); 18 | 19 | 20 | #define incr_top(L) {L->top++; luaD_checkstack(L,0);} 21 | 22 | #define savestack(L,p) ((char *)(p) - (char *)L->stack) 23 | #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) 24 | 25 | 26 | /* type of protected functions, to be ran by 'runprotected' */ 27 | typedef void (*Pfunc) (lua_State *L, void *ud); 28 | 29 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, 30 | const char *mode); 31 | LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); 32 | LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); 33 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults, 34 | int allowyield); 35 | LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, 36 | ptrdiff_t oldtop, ptrdiff_t ef); 37 | LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); 38 | LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); 39 | LUAI_FUNC void luaD_growstack (lua_State *L, int n); 40 | LUAI_FUNC void luaD_shrinkstack (lua_State *L); 41 | 42 | LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); 43 | LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /externals/lua/src/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h,v 2.14 2014/06/19 18:27:20 roberto Exp $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ 15 | cast(int, sizeof(TValue)*((n)-1))) 16 | 17 | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ 18 | cast(int, sizeof(TValue *)*((n)-1))) 19 | 20 | 21 | /* test whether thread is in 'twups' list */ 22 | #define isintwups(L) (L->twups != L) 23 | 24 | 25 | /* 26 | ** Upvalues for Lua closures 27 | */ 28 | struct UpVal { 29 | TValue *v; /* points to stack or to its own value */ 30 | lu_mem refcount; /* reference counter */ 31 | union { 32 | struct { /* (when open) */ 33 | UpVal *next; /* linked list */ 34 | int touched; /* mark to avoid cycles with dead threads */ 35 | } open; 36 | TValue value; /* the value (when closed) */ 37 | } u; 38 | }; 39 | 40 | #define upisopen(up) ((up)->v != &(up)->u.value) 41 | 42 | 43 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 44 | LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); 45 | LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); 46 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); 47 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 48 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); 49 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 50 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 51 | int pc); 52 | 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /externals/lua/src/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c,v 1.38 2015/01/05 13:48:33 roberto Exp $ 3 | ** Initialization of libraries for lua.c and other clients 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | /* 12 | ** If you embed Lua in your program and need to open the standard 13 | ** libraries, call luaL_openlibs in your program. If you need a 14 | ** different set of libraries, copy this file to your project and edit 15 | ** it to suit your needs. 16 | ** 17 | ** You can also *preload* libraries, so that a later 'require' can 18 | ** open the library, which is already linked to the application. 19 | ** For that, do the following code: 20 | ** 21 | ** luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); 22 | ** lua_pushcfunction(L, luaopen_modname); 23 | ** lua_setfield(L, -2, modname); 24 | ** lua_pop(L, 1); // remove _PRELOAD table 25 | */ 26 | 27 | #include "lprefix.h" 28 | 29 | 30 | #include 31 | 32 | #include "lua.h" 33 | 34 | #include "lualib.h" 35 | #include "lauxlib.h" 36 | 37 | 38 | /* 39 | ** these libs are loaded by lua.c and are readily available to any Lua 40 | ** program 41 | */ 42 | static const luaL_Reg loadedlibs[] = { 43 | {"_G", luaopen_base}, 44 | {LUA_LOADLIBNAME, luaopen_package}, 45 | {LUA_COLIBNAME, luaopen_coroutine}, 46 | {LUA_TABLIBNAME, luaopen_table}, 47 | {LUA_IOLIBNAME, luaopen_io}, 48 | {LUA_OSLIBNAME, luaopen_os}, 49 | {LUA_STRLIBNAME, luaopen_string}, 50 | {LUA_MATHLIBNAME, luaopen_math}, 51 | {LUA_UTF8LIBNAME, luaopen_utf8}, 52 | {LUA_DBLIBNAME, luaopen_debug}, 53 | #if defined(LUA_COMPAT_BITLIB) 54 | {LUA_BITLIBNAME, luaopen_bit32}, 55 | #endif 56 | {NULL, NULL} 57 | }; 58 | 59 | 60 | LUALIB_API void luaL_openlibs (lua_State *L) { 61 | const luaL_Reg *lib; 62 | /* "require" functions from 'loadedlibs' and set results to global table */ 63 | for (lib = loadedlibs; lib->func; lib++) { 64 | luaL_requiref(L, lib->name, lib->func, 1); 65 | lua_pop(L, 1); /* remove lib */ 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /externals/lua/src/llex.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: llex.h,v 1.78 2014/10/29 15:38:24 roberto Exp $ 3 | ** Lexical Analyzer 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef llex_h 8 | #define llex_h 9 | 10 | #include "lobject.h" 11 | #include "lzio.h" 12 | 13 | 14 | #define FIRST_RESERVED 257 15 | 16 | 17 | #if !defined(LUA_ENV) 18 | #define LUA_ENV "_ENV" 19 | #endif 20 | 21 | 22 | /* 23 | * WARNING: if you change the order of this enumeration, 24 | * grep "ORDER RESERVED" 25 | */ 26 | enum RESERVED { 27 | /* terminal symbols denoted by reserved words */ 28 | TK_AND = FIRST_RESERVED, TK_BREAK, 29 | TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, 30 | TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, 31 | TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, 32 | /* other terminal symbols */ 33 | TK_IDIV, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, 34 | TK_SHL, TK_SHR, 35 | TK_DBCOLON, TK_EOS, 36 | TK_FLT, TK_INT, TK_NAME, TK_STRING 37 | }; 38 | 39 | /* number of reserved words */ 40 | #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) 41 | 42 | 43 | typedef union { 44 | lua_Number r; 45 | lua_Integer i; 46 | TString *ts; 47 | } SemInfo; /* semantics information */ 48 | 49 | 50 | typedef struct Token { 51 | int token; 52 | SemInfo seminfo; 53 | } Token; 54 | 55 | 56 | /* state of the lexer plus state of the parser when shared by all 57 | functions */ 58 | typedef struct LexState { 59 | int current; /* current character (charint) */ 60 | int linenumber; /* input line counter */ 61 | int lastline; /* line of last token 'consumed' */ 62 | Token t; /* current token */ 63 | Token lookahead; /* look ahead token */ 64 | struct FuncState *fs; /* current function (parser) */ 65 | struct lua_State *L; 66 | ZIO *z; /* input stream */ 67 | Mbuffer *buff; /* buffer for tokens */ 68 | Table *h; /* to avoid collection/reuse strings */ 69 | struct Dyndata *dyd; /* dynamic structures used by the parser */ 70 | TString *source; /* current source name */ 71 | TString *envn; /* environment variable name */ 72 | char decpoint; /* locale decimal point */ 73 | } LexState; 74 | 75 | 76 | LUAI_FUNC void luaX_init (lua_State *L); 77 | LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, 78 | TString *source, int firstchar); 79 | LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); 80 | LUAI_FUNC void luaX_next (LexState *ls); 81 | LUAI_FUNC int luaX_lookahead (LexState *ls); 82 | LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s); 83 | LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); 84 | 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /externals/lua/src/lmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lmem.h,v 1.43 2014/12/19 17:26:14 roberto Exp $ 3 | ** Interface to Memory Manager 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lmem_h 8 | #define lmem_h 9 | 10 | 11 | #include 12 | 13 | #include "llimits.h" 14 | #include "lua.h" 15 | 16 | 17 | /* 18 | ** This macro reallocs a vector 'b' from 'on' to 'n' elements, where 19 | ** each element has size 'e'. In case of arithmetic overflow of the 20 | ** product 'n'*'e', it raises an error (calling 'luaM_toobig'). Because 21 | ** 'e' is always constant, it avoids the runtime division MAX_SIZET/(e). 22 | ** 23 | ** (The macro is somewhat complex to avoid warnings: The 'sizeof' 24 | ** comparison avoids a runtime comparison when overflow cannot occur. 25 | ** The compiler should be able to optimize the real test by itself, but 26 | ** when it does it, it may give a warning about "comparison is always 27 | ** false due to limited range of data type"; the +1 tricks the compiler, 28 | ** avoiding this warning but also this optimization.) 29 | */ 30 | #define luaM_reallocv(L,b,on,n,e) \ 31 | (((sizeof(n) >= sizeof(size_t) && cast(size_t, (n)) + 1 > MAX_SIZET/(e)) \ 32 | ? luaM_toobig(L) : cast_void(0)) , \ 33 | luaM_realloc_(L, (b), (on)*(e), (n)*(e))) 34 | 35 | /* 36 | ** Arrays of chars do not need any test 37 | */ 38 | #define luaM_reallocvchar(L,b,on,n) \ 39 | cast(char *, luaM_realloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) 40 | 41 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) 42 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) 43 | #define luaM_freearray(L, b, n) luaM_realloc_(L, (b), (n)*sizeof(*(b)), 0) 44 | 45 | #define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s)) 46 | #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) 47 | #define luaM_newvector(L,n,t) \ 48 | cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) 49 | 50 | #define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s)) 51 | 52 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ 53 | if ((nelems)+1 > (size)) \ 54 | ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) 55 | 56 | #define luaM_reallocvector(L, v,oldn,n,t) \ 57 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) 58 | 59 | LUAI_FUNC l_noret luaM_toobig (lua_State *L); 60 | 61 | /* not to be called directly */ 62 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, 63 | size_t size); 64 | LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, 65 | size_t size_elem, int limit, 66 | const char *what); 67 | 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /externals/lua/src/lprefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $ 3 | ** Definitions for Lua code that must come before any other header file 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lprefix_h 8 | #define lprefix_h 9 | 10 | 11 | /* 12 | ** Allows POSIX/XSI stuff 13 | */ 14 | #if !defined(LUA_USE_C89) /* { */ 15 | 16 | #if !defined(_XOPEN_SOURCE) 17 | #define _XOPEN_SOURCE 600 18 | #elif _XOPEN_SOURCE == 0 19 | #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ 20 | #endif 21 | 22 | /* 23 | ** Allows manipulation of large files in gcc and some other compilers 24 | */ 25 | #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) 26 | #define _LARGEFILE_SOURCE 1 27 | #define _FILE_OFFSET_BITS 64 28 | #endif 29 | 30 | #endif /* } */ 31 | 32 | 33 | /* 34 | ** Windows stuff 35 | */ 36 | #if defined(_WIN32) /* { */ 37 | 38 | #if !defined(_CRT_SECURE_NO_WARNINGS) 39 | #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ 40 | #endif 41 | 42 | #endif /* } */ 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /externals/lua/src/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h,v 1.56 2014/07/18 14:46:47 roberto Exp $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | #include "lgc.h" 11 | #include "lobject.h" 12 | #include "lstate.h" 13 | 14 | 15 | #define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char)) 16 | #define sizestring(s) sizelstring((s)->len) 17 | 18 | #define sizeludata(l) (sizeof(union UUdata) + (l)) 19 | #define sizeudata(u) sizeludata((u)->len) 20 | 21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 22 | (sizeof(s)/sizeof(char))-1)) 23 | 24 | 25 | /* 26 | ** test whether a string is a reserved word 27 | */ 28 | #define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0) 29 | 30 | 31 | /* 32 | ** equality for short strings, which are always internalized 33 | */ 34 | #define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b)) 35 | 36 | 37 | LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); 38 | LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); 39 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 40 | LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); 41 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s); 42 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 43 | LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /externals/lua/src/ltable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltable.h,v 2.20 2014/09/04 18:15:29 roberto Exp $ 3 | ** Lua tables (hash) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltable_h 8 | #define ltable_h 9 | 10 | #include "lobject.h" 11 | 12 | 13 | #define gnode(t,i) (&(t)->node[i]) 14 | #define gval(n) (&(n)->i_val) 15 | #define gnext(n) ((n)->i_key.nk.next) 16 | 17 | 18 | /* 'const' to avoid wrong writings that can mess up field 'next' */ 19 | #define gkey(n) cast(const TValue*, (&(n)->i_key.tvk)) 20 | 21 | #define wgkey(n) (&(n)->i_key.nk) 22 | 23 | #define invalidateTMcache(t) ((t)->flags = 0) 24 | 25 | 26 | /* returns the key, given the value of a table entry */ 27 | #define keyfromval(v) \ 28 | (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val)))) 29 | 30 | 31 | LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); 32 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, 33 | TValue *value); 34 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); 35 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); 36 | LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key); 37 | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); 38 | LUAI_FUNC Table *luaH_new (lua_State *L); 39 | LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, 40 | unsigned int nhsize); 41 | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); 42 | LUAI_FUNC void luaH_free (lua_State *L, Table *t); 43 | LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 44 | LUAI_FUNC int luaH_getn (Table *t); 45 | 46 | 47 | #if defined(LUA_DEBUG) 48 | LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); 49 | LUAI_FUNC int luaH_isdummy (Node *n); 50 | #endif 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /externals/lua/src/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h,v 2.21 2014/10/25 11:50:46 roberto Exp $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | * WARNING: if you change the order of this enumeration, 16 | * grep "ORDER TM" and "ORDER OP" 17 | */ 18 | typedef enum { 19 | TM_INDEX, 20 | TM_NEWINDEX, 21 | TM_GC, 22 | TM_MODE, 23 | TM_LEN, 24 | TM_EQ, /* last tag method with fast access */ 25 | TM_ADD, 26 | TM_SUB, 27 | TM_MUL, 28 | TM_MOD, 29 | TM_POW, 30 | TM_DIV, 31 | TM_IDIV, 32 | TM_BAND, 33 | TM_BOR, 34 | TM_BXOR, 35 | TM_SHL, 36 | TM_SHR, 37 | TM_UNM, 38 | TM_BNOT, 39 | TM_LT, 40 | TM_LE, 41 | TM_CONCAT, 42 | TM_CALL, 43 | TM_N /* number of elements in the enum */ 44 | } TMS; 45 | 46 | 47 | 48 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 49 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 50 | 51 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 52 | 53 | #define ttypename(x) luaT_typenames_[(x) + 1] 54 | #define objtypename(x) ttypename(ttnov(x)) 55 | 56 | LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; 57 | 58 | 59 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 60 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 61 | TMS event); 62 | LUAI_FUNC void luaT_init (lua_State *L); 63 | 64 | LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, 65 | const TValue *p2, TValue *p3, int hasres); 66 | LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, 67 | StkId res, TMS event); 68 | LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, 69 | StkId res, TMS event); 70 | LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, 71 | const TValue *p2, TMS event); 72 | 73 | 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /externals/lua/src/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /externals/lua/src/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.44 2014/02/06 17:32:33 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | 15 | LUAMOD_API int (luaopen_base) (lua_State *L); 16 | 17 | #define LUA_COLIBNAME "coroutine" 18 | LUAMOD_API int (luaopen_coroutine) (lua_State *L); 19 | 20 | #define LUA_TABLIBNAME "table" 21 | LUAMOD_API int (luaopen_table) (lua_State *L); 22 | 23 | #define LUA_IOLIBNAME "io" 24 | LUAMOD_API int (luaopen_io) (lua_State *L); 25 | 26 | #define LUA_OSLIBNAME "os" 27 | LUAMOD_API int (luaopen_os) (lua_State *L); 28 | 29 | #define LUA_STRLIBNAME "string" 30 | LUAMOD_API int (luaopen_string) (lua_State *L); 31 | 32 | #define LUA_UTF8LIBNAME "utf8" 33 | LUAMOD_API int (luaopen_utf8) (lua_State *L); 34 | 35 | #define LUA_BITLIBNAME "bit32" 36 | LUAMOD_API int (luaopen_bit32) (lua_State *L); 37 | 38 | #define LUA_MATHLIBNAME "math" 39 | LUAMOD_API int (luaopen_math) (lua_State *L); 40 | 41 | #define LUA_DBLIBNAME "debug" 42 | LUAMOD_API int (luaopen_debug) (lua_State *L); 43 | 44 | #define LUA_LOADLIBNAME "package" 45 | LUAMOD_API int (luaopen_package) (lua_State *L); 46 | 47 | 48 | /* open all previous libraries */ 49 | LUALIB_API void (luaL_openlibs) (lua_State *L); 50 | 51 | 52 | 53 | #if !defined(lua_assert) 54 | #define lua_assert(x) ((void)0) 55 | #endif 56 | 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /externals/lua/src/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.44 2014/06/19 18:27:20 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* data to catch conversion errors */ 16 | #define LUAC_DATA "\x19\x93\r\n\x1a\n" 17 | 18 | #define LUAC_INT 0x5678 19 | #define LUAC_NUM cast_num(370.5) 20 | 21 | #define MYINT(s) (s[0]-'0') 22 | #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) 23 | #define LUAC_FORMAT 0 /* this is the official format */ 24 | 25 | /* load one chunk; from lundump.c */ 26 | LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, 27 | const char* name); 28 | 29 | /* dump one chunk; from ldump.c */ 30 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, 31 | void* data, int strip); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /externals/lua/src/lvm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lvm.h,v 2.34 2014/08/01 17:24:02 roberto Exp $ 3 | ** Lua virtual machine 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lvm_h 8 | #define lvm_h 9 | 10 | 11 | #include "ldo.h" 12 | #include "lobject.h" 13 | #include "ltm.h" 14 | 15 | 16 | #if !defined(LUA_NOCVTN2S) 17 | #define cvt2str(o) ttisnumber(o) 18 | #else 19 | #define cvt2str(o) 0 /* no conversion from numbers to strings */ 20 | #endif 21 | 22 | 23 | #if !defined(LUA_NOCVTS2N) 24 | #define cvt2num(o) ttisstring(o) 25 | #else 26 | #define cvt2num(o) 0 /* no conversion from strings to numbers */ 27 | #endif 28 | 29 | 30 | #define tonumber(o,n) \ 31 | (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) 32 | 33 | #define tointeger(o,i) \ 34 | (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger_(o,i)) 35 | 36 | #define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) 37 | 38 | #define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) 39 | 40 | 41 | LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); 42 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); 43 | LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); 44 | LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); 45 | LUAI_FUNC int luaV_tointeger_ (const TValue *obj, lua_Integer *p); 46 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, 47 | StkId val); 48 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, 49 | StkId val); 50 | LUAI_FUNC void luaV_finishOp (lua_State *L); 51 | LUAI_FUNC void luaV_execute (lua_State *L); 52 | LUAI_FUNC void luaV_concat (lua_State *L, int total); 53 | LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); 54 | LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); 55 | LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); 56 | LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /externals/lua/src/lzio.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.c,v 1.36 2014/11/02 19:19:04 roberto Exp $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #define lzio_c 8 | #define LUA_CORE 9 | 10 | #include "lprefix.h" 11 | 12 | 13 | #include 14 | 15 | #include "lua.h" 16 | 17 | #include "llimits.h" 18 | #include "lmem.h" 19 | #include "lstate.h" 20 | #include "lzio.h" 21 | 22 | 23 | int luaZ_fill (ZIO *z) { 24 | size_t size; 25 | lua_State *L = z->L; 26 | const char *buff; 27 | lua_unlock(L); 28 | buff = z->reader(L, z->data, &size); 29 | lua_lock(L); 30 | if (buff == NULL || size == 0) 31 | return EOZ; 32 | z->n = size - 1; /* discount char being returned */ 33 | z->p = buff; 34 | return cast_uchar(*(z->p++)); 35 | } 36 | 37 | 38 | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { 39 | z->L = L; 40 | z->reader = reader; 41 | z->data = data; 42 | z->n = 0; 43 | z->p = NULL; 44 | } 45 | 46 | 47 | /* --------------------------------------------------------------- read --- */ 48 | size_t luaZ_read (ZIO *z, void *b, size_t n) { 49 | while (n) { 50 | size_t m; 51 | if (z->n == 0) { /* no bytes in buffer? */ 52 | if (luaZ_fill(z) == EOZ) /* try to read more */ 53 | return n; /* no more input; return number of missing bytes */ 54 | else { 55 | z->n++; /* luaZ_fill consumed first byte; put it back */ 56 | z->p--; 57 | } 58 | } 59 | m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ 60 | memcpy(b, z->p, m); 61 | z->n -= m; 62 | z->p += m; 63 | b = (char *)b + m; 64 | n -= m; 65 | } 66 | return 0; 67 | } 68 | 69 | /* ------------------------------------------------------------------------ */ 70 | char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { 71 | if (n > buff->buffsize) { 72 | if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; 73 | luaZ_resizebuffer(L, buff, n); 74 | } 75 | return buff->buffer; 76 | } 77 | 78 | 79 | -------------------------------------------------------------------------------- /externals/lua/src/lzio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.h,v 1.30 2014/12/19 17:26:14 roberto Exp $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lzio_h 9 | #define lzio_h 10 | 11 | #include "lua.h" 12 | 13 | #include "lmem.h" 14 | 15 | 16 | #define EOZ (-1) /* end of stream */ 17 | 18 | typedef struct Zio ZIO; 19 | 20 | #define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) 21 | 22 | 23 | typedef struct Mbuffer { 24 | char *buffer; 25 | size_t n; 26 | size_t buffsize; 27 | } Mbuffer; 28 | 29 | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) 30 | 31 | #define luaZ_buffer(buff) ((buff)->buffer) 32 | #define luaZ_sizebuffer(buff) ((buff)->buffsize) 33 | #define luaZ_bufflen(buff) ((buff)->n) 34 | 35 | #define luaZ_buffremove(buff,i) ((buff)->n -= (i)) 36 | #define luaZ_resetbuffer(buff) ((buff)->n = 0) 37 | 38 | 39 | #define luaZ_resizebuffer(L, buff, size) \ 40 | ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \ 41 | (buff)->buffsize, size), \ 42 | (buff)->buffsize = size) 43 | 44 | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) 45 | 46 | 47 | LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); 48 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, 49 | void *data); 50 | LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */ 51 | 52 | 53 | 54 | /* --------- Private Part ------------------ */ 55 | 56 | struct Zio { 57 | size_t n; /* bytes still unread */ 58 | const char *p; /* current position in buffer */ 59 | lua_Reader reader; /* reader function */ 60 | void *data; /* additional data */ 61 | lua_State *L; /* Lua state (for reader) */ 62 | }; 63 | 64 | 65 | LUAI_FUNC int luaZ_fill (ZIO *z); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/DistortionChroma_vs.vsh: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : DistortionChroma_vs.vsh 4 | 5 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 6 | 7 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 8 | you may not use the Oculus VR Rift SDK except in compliance with the License, 9 | which is provided at the time of installation or download, or which 10 | otherwise accompanies this software in either electronic or hard copy form. 11 | 12 | You may obtain a copy of the License at 13 | 14 | http://www.oculusvr.com/licenses/LICENSE-3.2 15 | 16 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | 22 | ************************************************************************************/ 23 | 24 | float2 EyeToSourceUVScale; 25 | float2 EyeToSourceUVOffset; 26 | 27 | void main(in float2 Position : POSITION, 28 | in float4 Color : COLOR0, 29 | in float2 TexCoord0 : TEXCOORD0, 30 | in float2 TexCoord1 : TEXCOORD1, 31 | in float2 TexCoord2 : TEXCOORD2, 32 | out float4 oPosition : SV_Position, 33 | out float1 oColor : COLOR, 34 | out float2 oTexCoord0 : TEXCOORD0, 35 | out float2 oTexCoord1 : TEXCOORD1, 36 | out float2 oTexCoord2 : TEXCOORD2) 37 | { 38 | oPosition.x = Position.x; 39 | oPosition.y = Position.y; 40 | oPosition.z = 0.5; 41 | oPosition.w = 1.0; 42 | 43 | // Scale them into UV lookup space 44 | float2 tc0scaled = EyeToSourceUVScale * TexCoord0 + EyeToSourceUVOffset; 45 | float2 tc1scaled = EyeToSourceUVScale * TexCoord1 + EyeToSourceUVOffset; 46 | float2 tc2scaled = EyeToSourceUVScale * TexCoord2 + EyeToSourceUVOffset; 47 | 48 | oTexCoord0 = tc0scaled; // R sample. 49 | oTexCoord1 = tc1scaled; // G sample. 50 | oTexCoord2 = tc2scaled; // B sample. 51 | oColor = Color.r; // Used for vignette fade. 52 | } 53 | 54 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/Distortion_ps.psh: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : Distortion_ps.psh 4 | 5 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 6 | 7 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 8 | you may not use the Oculus VR Rift SDK except in compliance with the License, 9 | which is provided at the time of installation or download, or which 10 | otherwise accompanies this software in either electronic or hard copy form. 11 | 12 | You may obtain a copy of the License at 13 | 14 | http://www.oculusvr.com/licenses/LICENSE-3.2 15 | 16 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | 22 | ************************************************************************************/ 23 | 24 | 25 | Texture2D Texture : register(t0); 26 | SamplerState Linear : register(s0); 27 | 28 | float4 main(in float4 oPosition : SV_Position, 29 | in float1 oColor : COLOR, 30 | in float2 oTexCoord0 : TEXCOORD0) : SV_Target 31 | { 32 | float3 Result = Texture.Sample(Linear, oTexCoord0).rgb; 33 | return float4(Result * oColor, 1.0 ); 34 | } 35 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/SimpleQuad_ps.psh: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : SimpleQuad_ps.psh 4 | 5 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 6 | 7 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 8 | you may not use the Oculus VR Rift SDK except in compliance with the License, 9 | which is provided at the time of installation or download, or which 10 | otherwise accompanies this software in either electronic or hard copy form. 11 | 12 | You may obtain a copy of the License at 13 | 14 | http://www.oculusvr.com/licenses/LICENSE-3.2 15 | 16 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | 22 | ************************************************************************************/ 23 | 24 | float4 Color; 25 | 26 | float4 main() : SV_Target 27 | { 28 | return Color; 29 | } 30 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/SimpleQuad_vs.vsh: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : SimplaeQuad_vs.vsh 4 | 5 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 6 | 7 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 8 | you may not use the Oculus VR Rift SDK except in compliance with the License, 9 | which is provided at the time of installation or download, or which 10 | otherwise accompanies this software in either electronic or hard copy form. 11 | 12 | You may obtain a copy of the License at 13 | 14 | http://www.oculusvr.com/licenses/LICENSE-3.2 15 | 16 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | 22 | ************************************************************************************/ 23 | 24 | float2 PositionOffset = float2(0, 0); 25 | float2 Scale = float2(1, 1); 26 | 27 | void main( in float3 Position : POSITION, 28 | out float4 oPosition : SV_Position) 29 | { 30 | oPosition = float4(Position.xy * Scale + PositionOffset, 0.5, 1.0); 31 | } -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/SimpleTexturedQuad_ps.psh: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : SimpleTextureQuad_ps.psh 4 | 5 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 6 | 7 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 8 | you may not use the Oculus VR Rift SDK except in compliance with the License, 9 | which is provided at the time of installation or download, or which 10 | otherwise accompanies this software in either electronic or hard copy form. 11 | 12 | You may obtain a copy of the License at 13 | 14 | http://www.oculusvr.com/licenses/LICENSE-3.2 15 | 16 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | 22 | ************************************************************************************/ 23 | 24 | float4 Color; 25 | 26 | SamplerState LinearSampler : register(s0); 27 | Texture2D Texture : register(t0); 28 | 29 | struct Values 30 | { 31 | float4 Position : SV_Position; 32 | float4 Color : COLOR0; 33 | float2 TexCoord : TEXCOORD0; 34 | }; 35 | 36 | float4 main(in Values inputValues) : SV_Target 37 | { 38 | return Color * inputValues.Color * Texture.Sample(LinearSampler, inputValues.TexCoord); 39 | } 40 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/SimpleTexturedQuad_vs.vsh: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : SimpleTextureQuad_vs.vsh 4 | 5 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 6 | 7 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 8 | you may not use the Oculus VR Rift SDK except in compliance with the License, 9 | which is provided at the time of installation or download, or which 10 | otherwise accompanies this software in either electronic or hard copy form. 11 | 12 | You may obtain a copy of the License at 13 | 14 | http://www.oculusvr.com/licenses/LICENSE-3.2 15 | 16 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | 22 | ************************************************************************************/ 23 | 24 | struct Values 25 | { 26 | float4 Position : SV_Position; 27 | float4 Color : COLOR0; 28 | float2 TexCoord : TEXCOORD0; 29 | }; 30 | 31 | float2 PositionOffset = float2(0, 0); 32 | float2 Scale = float2(1, 1); 33 | 34 | void main(in float3 Position : POSITION, in float4 Color : COLOR0, in float2 TexCoord : TEXCOORD0, out Values outputValues) 35 | { 36 | outputValues.Position = float4(Position.xy * Scale + PositionOffset, 0.5, 1.0); 37 | outputValues.Color = Color; 38 | outputValues.TexCoord = TexCoord; 39 | } 40 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/bin2header.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/bin2header.exe -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/genComputeShaderHeader.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | pushd %~dp0 3 | echo Compiling shader and packing into header: %~2 4 | setlocal 5 | 6 | fxc.exe /nologo /E main /T cs_5_0 /Fo "%1" %2 7 | bin2header.exe "%1" 8 | 9 | echo Generating shader reflection data for %1 10 | ShaderReflector "%1" "%1_refl.h" 11 | 12 | echo /* Concatenating shader reflector output:*/ >> "%1.h" 13 | type "%1_refl.h" >> "%1.h" 14 | del "%1_refl.h" 15 | 16 | del "%1" 17 | endlocal 18 | popd 19 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/genPixelShaderHeader.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | pushd %~dp0 3 | echo Compiling shader and packing into header: %~2 4 | setlocal 5 | 6 | fxc.exe /nologo /E main /T ps_4_1 /Fo "%1" %2 7 | bin2header.exe "%1" 8 | 9 | echo Generating shader reflection data for %1 10 | ShaderReflector "%1" "%1_refl.h" 11 | 12 | echo /* Concatenating shader reflector output:*/ >> "%1.h" 13 | type "%1_refl.h" >> "%1.h" 14 | del "%1_refl.h" 15 | 16 | del "%1" 17 | endlocal 18 | popd 19 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/D3D1X/Shaders/genVertexShaderHeader.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | pushd %~dp0 3 | echo Compiling shader and packing into header: %~2 4 | setlocal 5 | 6 | fxc.exe /nologo /E main /T vs_4_1 /Fo "%1" %2 7 | bin2header.exe "%1" 8 | 9 | echo Generating shader reflection data for %1 10 | ShaderReflector "%1" "%1_refl.h" 11 | 12 | echo /* Concatenating shader reflector output:*/ >> "%1.h" 13 | type "%1_refl.h" >> "%1.h" 14 | del "%1_refl.h" 15 | 16 | del "%1" 17 | endlocal 18 | popd 19 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/CAPI/Textures/healthAndSafety.tga: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/externals/ovr-0.5.0.1/Src/CAPI/Textures/healthAndSafety.tga -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/Displays/OVR_Win32_FocusReader.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_Win32_FocusReader.cpp 4 | Content : Reader for current app with focus on Windows 5 | Created : July 2, 2014 6 | Authors : Chris Taylor 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | *************************************************************************************/ 26 | 27 | #include "OVR_Win32_FocusReader.h" 28 | #include "Kernel/OVR_Log.h" 29 | #include "../Service/Service_NetClient.h" 30 | 31 | OVR_DEFINE_SINGLETON(OVR::Win32::RenderFocusReader); 32 | 33 | namespace OVR { namespace Win32 { 34 | 35 | 36 | HWND RenderFocusReader::ReadActiveWindow() 37 | { 38 | const LocklessFocusState* focusState = Reader.Get(); 39 | 40 | if (!focusState || NoSharedMemory) 41 | { 42 | if (!Reader.Open(OVR_FOCUS_OBSERVER_SHARE_NAME)) 43 | { 44 | OVR_DEBUG_LOG(("[Win32ShimFunctions] Unable to open the shared memory space")); 45 | // Note: This should only warn and not assert because it is normal behavior when the server is not running. 46 | NoSharedMemory = true; 47 | return 0; 48 | } 49 | 50 | focusState = Reader.Get(); 51 | if (!focusState) 52 | { 53 | OVR_DEBUG_LOG(("[Win32ShimFunctions] Unable to get the shared memory space")); 54 | NoSharedMemory = true; 55 | return 0; 56 | } 57 | } 58 | 59 | return (HWND)Ptr64ToPtr(focusState->ActiveWindowHandle); 60 | } 61 | 62 | RenderFocusReader::RenderFocusReader() : 63 | NoSharedMemory(false) 64 | { 65 | // Must be at end of function 66 | PushDestroyCallbacks(); 67 | } 68 | 69 | RenderFocusReader::~RenderFocusReader() 70 | { 71 | } 72 | 73 | void RenderFocusReader::OnSystemDestroy() 74 | { 75 | delete this; 76 | } 77 | 78 | 79 | }} // namespace OVR::Win32 80 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/Displays/OVR_Win32_ShimFunctions.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_Win32_ShimFunctions.h 4 | Content : Client-side shim callbacks for usermode/rt hooks 5 | Created : May 6, 2014 6 | Authors : Dean Beeler 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | *************************************************************************************/ 26 | 27 | #ifndef OVR_Win32_ShimFunctions_h 28 | #define OVR_Win32_ShimFunctions_h 29 | 30 | #include "OVR_Win32_Display.h" 31 | 32 | namespace OVR { 33 | 34 | struct ExtraMonitorInfo; 35 | 36 | namespace Win32 { 37 | 38 | 39 | class DisplayShim 40 | { 41 | public: 42 | 43 | public: 44 | static DisplayShim& GetInstance() 45 | { 46 | static DisplayShim instance; 47 | return instance; 48 | } 49 | 50 | bool Initialize( bool inCompatibility ); 51 | bool Shutdown(); 52 | 53 | bool Update( ExtraMonitorInfo* shimInfo ); 54 | 55 | void* GetDX11SwapChain(); 56 | 57 | ULONG ChildUid; 58 | int ExpectedWidth; 59 | int ExpectedHeight; 60 | int Rotation; 61 | HWND hWindow; 62 | bool UseMirroring; 63 | bool Active; 64 | 65 | private: 66 | 67 | DisplayShim(); 68 | 69 | virtual ~DisplayShim(); 70 | 71 | DisplayShim(DisplayShim const&); // Don't Implement 72 | void operator=(DisplayShim const&); // Don't implement 73 | 74 | }; 75 | 76 | 77 | }} // namespace OVR::Win32 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/Net/OVR_MessageIDTypes.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_MessageIDTypes.h 4 | Content : Enumeration list indicating what type of message is being sent 5 | Created : July 3, 2014 6 | Authors : Kevin Jenkins 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | ************************************************************************************/ 26 | 27 | namespace OVR { namespace Net { 28 | 29 | /// First byte of a network message 30 | typedef unsigned char MessageID; 31 | 32 | enum DefaultMessageIDTypes 33 | { 34 | OVRID_RPC1, 35 | OVRID_END = 128, 36 | OVRID_LATENCY_TESTER_1, 37 | }; 38 | 39 | }} // namespace OVR::Net 40 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/Net/OVR_NetworkPlugin.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_NetworkPlugin.cpp 4 | Content : Base class for an extension to the network objects. 5 | Created : June 10, 2014 6 | Authors : Kevin Jenkins 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | ************************************************************************************/ 26 | 27 | #include "OVR_NetworkPlugin.h" 28 | 29 | namespace OVR { namespace Net { namespace Plugins { 30 | 31 | 32 | //----------------------------------------------------------------------------- 33 | // Plugin identifier to assign next 34 | 35 | //static uint8_t pluginIdNext = 0; 36 | 37 | 38 | //----------------------------------------------------------------------------- 39 | // NetworkPlugin 40 | 41 | NetworkPlugin::NetworkPlugin() 42 | { 43 | pSession = 0; 44 | //PluginId = pluginIdNext++; 45 | } 46 | 47 | NetworkPlugin::~NetworkPlugin() 48 | { 49 | } 50 | 51 | void NetworkPlugin::OnAddedToSession(Session* _pSession) 52 | { 53 | if (pSession != 0) 54 | { 55 | pSession->RemoveSessionListener(this); 56 | } 57 | 58 | pSession = _pSession; 59 | } 60 | 61 | void NetworkPlugin::OnRemovedFromSession(Session* _pSession) 62 | { 63 | OVR_UNUSED(_pSession); 64 | OVR_ASSERT(_pSession == pSession); 65 | 66 | pSession = 0; 67 | } 68 | 69 | 70 | }}} // OVR::Net::Plugins 71 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/Net/OVR_NetworkPlugin.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | PublicHeader: n/a 4 | Filename : OVR_NetworkPlugin.h 5 | Content : Base class for an extension to the network objects. 6 | Created : June 10, 2014 7 | Authors : Kevin Jenkins 8 | 9 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 10 | 11 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 12 | you may not use the Oculus VR Rift SDK except in compliance with the License, 13 | which is provided at the time of installation or download, or which 14 | otherwise accompanies this software in either electronic or hard copy form. 15 | 16 | You may obtain a copy of the License at 17 | 18 | http://www.oculusvr.com/licenses/LICENSE-3.2 19 | 20 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 21 | distributed under the License is distributed on an "AS IS" BASIS, 22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | See the License for the specific language governing permissions and 24 | limitations under the License. 25 | 26 | ************************************************************************************/ 27 | 28 | #ifndef OVR_NetworkPlugin_h 29 | #define OVR_NetworkPlugin_h 30 | 31 | #include "OVR_Session.h" 32 | 33 | namespace OVR { namespace Net { namespace Plugins { 34 | 35 | 36 | //----------------------------------------------------------------------------- 37 | // NetworkPlugin 38 | 39 | // NetworkPlugins use Session and SessionListener to provide network functionality 40 | // independent of the transport medium. 41 | // Uses the chain of command design pattern such that plugins can invoke or intercept 42 | // network events via the Session. 43 | class NetworkPlugin : public SessionListener 44 | { 45 | public: 46 | NetworkPlugin(); 47 | virtual ~NetworkPlugin(); 48 | 49 | protected: 50 | virtual void OnAddedToSession(Session* _pSession); 51 | virtual void OnRemovedFromSession(Session* _pSession); 52 | 53 | Session *pSession; 54 | //uint8_t PluginId; 55 | }; 56 | 57 | 58 | }}} // OVR::Net::Plugins 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/Net/OVR_NetworkTypes.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | PublicHeader: n/a 4 | Filename : OVR_NetworkTypes.h 5 | Content : Shared header for network types 6 | Created : June 12, 2014 7 | Authors : Kevin Jenkins 8 | 9 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 10 | 11 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 12 | you may not use the Oculus VR Rift SDK except in compliance with the License, 13 | which is provided at the time of installation or download, or which 14 | otherwise accompanies this software in either electronic or hard copy form. 15 | 16 | You may obtain a copy of the License at 17 | 18 | http://www.oculusvr.com/licenses/LICENSE-3.2 19 | 20 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 21 | distributed under the License is distributed on an "AS IS" BASIS, 22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | See the License for the specific language governing permissions and 24 | limitations under the License. 25 | 26 | ************************************************************************************/ 27 | 28 | #ifndef OVR_NetworkTypes_h 29 | #define OVR_NetworkTypes_h 30 | 31 | #include "Kernel/OVR_Types.h" 32 | 33 | namespace OVR { namespace Net { 34 | 35 | 36 | typedef uint64_t NetworkID; 37 | const NetworkID InvalidNetworkID = ~((NetworkID)0); 38 | 39 | 40 | } } // OVR::Net 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/Util/Util_Interface.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : Util_Interface.cpp 4 | Content : Simple interface, utilised by internal demos, 5 | with access to wider SDK as needed. 6 | Located in the body of the SDK to ensure updated 7 | when new SDK features are added. 8 | Created : February 20, 2014 9 | Authors : Tom Heath 10 | 11 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 12 | 13 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 14 | you may not use the Oculus VR Rift SDK except in compliance with the License, 15 | which is provided at the time of installation or download, or which 16 | otherwise accompanies this software in either electronic or hard copy form. 17 | 18 | You may obtain a copy of the License at 19 | 20 | http://www.oculusvr.com/licenses/LICENSE-3.2 21 | 22 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 23 | distributed under the License is distributed on an "AS IS" BASIS, 24 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | See the License for the specific language governing permissions and 26 | limitations under the License. 27 | 28 | *************************************************************************************/ 29 | 30 | #include "Util_Interface.h" 31 | 32 | 33 | 34 | //Files left in to ease its possible return...... 35 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/Util/Util_Interface.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : Util_Interface.h 4 | Content : Simple interface, utilised by internal demos, 5 | with access to wider SDK as needed. 6 | Located in the body of the SDK to ensure updated 7 | when new SDK features are added. 8 | Created : February 20, 2014 9 | Authors : Tom Heath 10 | 11 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 12 | 13 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 14 | you may not use the Oculus VR Rift SDK except in compliance with the License, 15 | which is provided at the time of installation or download, or which 16 | otherwise accompanies this software in either electronic or hard copy form. 17 | 18 | You may obtain a copy of the License at 19 | 20 | http://www.oculusvr.com/licenses/LICENSE-3.2 21 | 22 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 23 | distributed under the License is distributed on an "AS IS" BASIS, 24 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | See the License for the specific language governing permissions and 26 | limitations under the License. 27 | 28 | *************************************************************************************/ 29 | 30 | #ifndef OVR_Util_Interface_h 31 | #define OVR_Util_Interface_h 32 | #include "OVR_CAPI.h" 33 | 34 | //Files left in to ease its possible return...... 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /externals/ovr-0.5.0.1/Src/Util/Util_LatencyTest2Reader.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : Util_LatencyTest2Reader.h 4 | Content : Shared functionality for the DK2 latency tester 5 | Created : July 8, 2014 6 | Authors : Volga Aksoy, Chris Taylor 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | *************************************************************************************/ 26 | 27 | #ifndef OVR_Util_LatencyTest2Reader_h 28 | #define OVR_Util_LatencyTest2Reader_h 29 | 30 | #include "Vision/SensorFusion/Vision_SensorState.h" 31 | #include "Util_LatencyTest2State.h" 32 | 33 | namespace OVR { namespace Util { 34 | 35 | 36 | //----------------------------------------------------------------------------- 37 | // RecordStateReader 38 | 39 | // User interface to retrieve pose from the sensor fusion subsystem 40 | class RecordStateReader : public NewOverrideBase 41 | { 42 | protected: 43 | const Vision::CombinedHmdUpdater* Updater; 44 | 45 | public: 46 | RecordStateReader() 47 | : Updater(NULL) 48 | { 49 | } 50 | 51 | // Initialize the updater 52 | void SetUpdater(const Vision::CombinedHmdUpdater *updater) 53 | { 54 | Updater = updater; 55 | } 56 | 57 | void GetRecordSet(FrameTimeRecordSet& recordset); 58 | }; 59 | 60 | 61 | }} // namespace OVR::Util 62 | 63 | #endif // OVR_Util_LatencyTest2Reader_h 64 | -------------------------------------------------------------------------------- /externals/ovr/Include/OVR.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR.h 4 | Content : The main public interface to Oculus for C++ Developers. 5 | Includes C API and helper classes. 6 | 7 | Copyright : Copyright 2014 Oculus VR, LLC. All Rights reserved. 8 | 9 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 10 | you may not use the Oculus VR Rift SDK except in compliance with the License, 11 | which is provided at the time of installation or download, or which 12 | otherwise accompanies this software in either electronic or hard copy form. 13 | 14 | You may obtain a copy of the License at 15 | 16 | http://www.oculusvr.com/licenses/LICENSE-3.2 17 | 18 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 19 | distributed under the License is distributed on an "AS IS" BASIS, 20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | See the License for the specific language governing permissions and 22 | limitations under the License. 23 | 24 | *************************************************************************************/ 25 | 26 | #ifndef OVR_h 27 | #define OVR_h 28 | 29 | #include "OVR_Version.h" 30 | 31 | #include "../Src/Kernel/OVR_Math.h" 32 | 33 | #include "../Src/OVR_CAPI.h" 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /externals/ovr/Include/OVR_Kernel.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVRKernel.h 4 | Content : This contains references to all OVR Kernel headers in Src folder. 5 | Should be generated automatically based on PublicHeader tags. 6 | 7 | Copyright : Copyright 2014 Oculus VR, LLC. All Rights reserved. 8 | 9 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 10 | you may not use the Oculus VR Rift SDK except in compliance with the License, 11 | which is provided at the time of installation or download, or which 12 | otherwise accompanies this software in either electronic or hard copy form. 13 | 14 | You may obtain a copy of the License at 15 | 16 | http://www.oculusvr.com/licenses/LICENSE-3.2 17 | 18 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 19 | distributed under the License is distributed on an "AS IS" BASIS, 20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | See the License for the specific language governing permissions and 22 | limitations under the License. 23 | 24 | *************************************************************************************/ 25 | 26 | #ifndef OVR_h 27 | #define OVR_h 28 | 29 | #include "../Src/Kernel/OVR_Types.h" 30 | #include "../Src/Kernel/OVR_Allocator.h" 31 | #include "../Src/Kernel/OVR_RefCount.h" 32 | #include "../Src/Kernel/OVR_Log.h" 33 | #include "../Src/Kernel/OVR_Math.h" 34 | #include "../Src/Kernel/OVR_System.h" 35 | #include "../Src/Kernel/OVR_Nullptr.h" 36 | #include "../Src/Kernel/OVR_String.h" 37 | #include "../Src/Kernel/OVR_Array.h" 38 | #include "../Src/Kernel/OVR_Timer.h" 39 | #include "../Src/Kernel/OVR_SysFile.h" 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /externals/ovr/Include/OVR_Version.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVRVersion.h 4 | Content : 5 | 6 | Copyright : Copyright 2014 Oculus VR, LLC. All Rights reserved. 7 | 8 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 9 | you may not use the Oculus VR Rift SDK except in compliance with the License, 10 | which is provided at the time of installation or download, or which 11 | otherwise accompanies this software in either electronic or hard copy form. 12 | 13 | You may obtain a copy of the License at 14 | 15 | http://www.oculusvr.com/licenses/LICENSE-3.2 16 | 17 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | 23 | *************************************************************************************/ 24 | 25 | #ifndef _OVR_VERSION_H 26 | #define _OVR_VERSION_H 27 | 28 | #define OVR_MAJOR_VERSION 0 29 | #define OVR_MINOR_VERSION 4 30 | #define OVR_BUILD_VERSION 4 31 | #define OVR_VERSION_STRING "0.4.4" 32 | 33 | #define OVR_DK2_LATEST_FIRMWARE_MAJOR_VERSION 2 34 | #define OVR_DK2_LATEST_FIRMWARE_MINOR_VERSION 12 35 | #endif 36 | -------------------------------------------------------------------------------- /externals/ovr/Lib/Mac/Debug/libovr.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/externals/ovr/Lib/Mac/Debug/libovr.a -------------------------------------------------------------------------------- /externals/ovr/Lib/Mac/Release/libovr.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/externals/ovr/Lib/Mac/Release/libovr.a -------------------------------------------------------------------------------- /externals/ovr/Src/Displays/OVR_Display.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | PublicHeader: None 4 | Filename : OVR_Display.cpp 5 | Content : Common implementation for display device 6 | Created : May 6, 2014 7 | Notes : 8 | 9 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 10 | 11 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 12 | you may not use the Oculus VR Rift SDK except in compliance with the License, 13 | which is provided at the time of installation or download, or which 14 | otherwise accompanies this software in either electronic or hard copy form. 15 | 16 | You may obtain a copy of the License at 17 | 18 | http://www.oculusvr.com/licenses/LICENSE-3.2 19 | 20 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 21 | distributed under the License is distributed on an "AS IS" BASIS, 22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | See the License for the specific language governing permissions and 24 | limitations under the License. 25 | 26 | ************************************************************************************/ 27 | 28 | #include "OVR_Display.h" 29 | 30 | namespace OVR { 31 | 32 | 33 | // Place platform-independent code here 34 | 35 | 36 | } // namespace OVR 37 | -------------------------------------------------------------------------------- /externals/ovr/Src/Displays/OVR_OSX_FocusObserver.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_OSX_FocusObserver.h 4 | Content : Observer for app focus on OSX 5 | Created : August 5, 2014 6 | Authors : Jordan Tritell 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | *************************************************************************************/ 26 | 27 | OVR_PRIVATE_FILE 28 | 29 | #ifndef OVR_OSX_FocusObserver_h 30 | #define OVR_OSX_FocusObserver_h 31 | 32 | #include "../Kernel/OVR_Threads.h" 33 | #include "../Kernel/OVR_System.h" 34 | #include "../Kernel/OVR_Lockless.h" 35 | 36 | #include "../Service/Service_NetServer.h" 37 | 38 | namespace OVR { namespace OSX{ 39 | 40 | struct FocusNotifierImpl; 41 | 42 | class AppFocusObserver : public SystemSingletonBase 43 | { 44 | OVR_DECLARE_SINGLETON(AppFocusObserver); 45 | 46 | public: 47 | Lock ListLock; 48 | Array AppList; 49 | Service::NetServerListener *listener; 50 | FocusNotifierImpl* impl; 51 | 52 | void OnProcessFocus(pid_t pid); 53 | void SetListener(Service::NetServerListener *_listener); 54 | 55 | pid_t LastProcessId; 56 | pid_t ActiveProcessId; 57 | void AddProcess(pid_t pid); 58 | void nextProcess(); 59 | void RemoveProcess(pid_t pid); 60 | 61 | 62 | protected: 63 | void onAppFocus(pid_t pid); 64 | 65 | pid_t LastAppFocus; 66 | 67 | }; 68 | 69 | 70 | 71 | }} // namespace OVR, OSX 72 | 73 | 74 | #endif /* OVR_OSX_FocusObserver_h */ 75 | 76 | -------------------------------------------------------------------------------- /externals/ovr/Src/Displays/OVR_OSX_FocusReader.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_OSX_FocusReader.h 4 | Content : Reader for current app with focus on OSX 5 | Created : August 5, 2014 6 | Authors : Jordan Tritell 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | *************************************************************************************/ 26 | 27 | OVR_PRIVATE_FILE 28 | 29 | #ifndef OVR_OSX_FocusReader_h 30 | #define OVR_OSX_FocusReader_h 31 | 32 | #import 33 | 34 | @interface FocusReader : NSObject { 35 | NSWindow *window; 36 | } 37 | 38 | - (void)start; 39 | 40 | @property (assign) IBOutlet NSWindow *window; 41 | 42 | @end 43 | 44 | #endif /* OVR_OSX_FocusReader_h */ 45 | 46 | -------------------------------------------------------------------------------- /externals/ovr/Src/Kernel/OVR_Alg.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_Alg.cpp 4 | Content : Static lookup tables for Alg functions 5 | Created : September 19, 2012 6 | Notes : 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | ************************************************************************************/ 26 | 27 | #include "OVR_Types.h" 28 | 29 | namespace OVR { namespace Alg { 30 | 31 | //------------------------------------------------------------------------ 32 | extern const uint8_t UpperBitTable[256] = 33 | { 34 | 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 35 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 36 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 37 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 38 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 39 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 40 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 41 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 42 | }; 43 | 44 | extern const uint8_t LowerBitTable[256] = 45 | { 46 | 8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, 47 | 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, 48 | 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, 49 | 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, 50 | 7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, 51 | 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, 52 | 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0, 53 | 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0 54 | }; 55 | 56 | 57 | }} // OVE::Alg 58 | -------------------------------------------------------------------------------- /externals/ovr/Src/Kernel/OVR_CRC32.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | PublicHeader: OVR 4 | Filename : OVR_CRC32.h 5 | Content : CRC-32 with polynomial used for sensor devices 6 | Created : June 20, 2014 7 | Author : Chris Taylor 8 | 9 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 10 | 11 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 12 | you may not use the Oculus VR Rift SDK except in compliance with the License, 13 | which is provided at the time of installation or download, or which 14 | otherwise accompanies this software in either electronic or hard copy form. 15 | 16 | You may obtain a copy of the License at 17 | 18 | http://www.oculusvr.com/licenses/LICENSE-3.2 19 | 20 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 21 | distributed under the License is distributed on an "AS IS" BASIS, 22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | See the License for the specific language governing permissions and 24 | limitations under the License. 25 | 26 | ************************************************************************************/ 27 | 28 | #ifndef OVR_CRC32_h 29 | #define OVR_CRC32_h 30 | 31 | #include "OVR_Types.h" 32 | 33 | namespace OVR { 34 | 35 | 36 | //----------------------------------------------------------------------------------- 37 | // ***** CRC-32 38 | 39 | // Polynomial used and algorithm details are proprietary to our sensor board 40 | uint32_t CRC32_Calculate(const void* data, int bytes, uint32_t prevCRC = 0); 41 | 42 | 43 | } // namespace OVR 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /externals/ovr/Src/Kernel/OVR_Color.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | PublicHeader: OVR_Kernel.h 4 | Filename : OVR_Color.h 5 | Content : Contains color struct. 6 | Created : February 7, 2013 7 | Notes : 8 | 9 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 10 | 11 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 12 | you may not use the Oculus VR Rift SDK except in compliance with the License, 13 | which is provided at the time of installation or download, or which 14 | otherwise accompanies this software in either electronic or hard copy form. 15 | 16 | You may obtain a copy of the License at 17 | 18 | http://www.oculusvr.com/licenses/LICENSE-3.2 19 | 20 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 21 | distributed under the License is distributed on an "AS IS" BASIS, 22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | See the License for the specific language governing permissions and 24 | limitations under the License. 25 | 26 | ************************************************************************************/ 27 | #ifndef OVR_Color_h 28 | #define OVR_Color_h 29 | 30 | #include "OVR_Types.h" 31 | 32 | namespace OVR { 33 | 34 | 35 | struct Color 36 | { 37 | uint8_t R,G,B,A; 38 | 39 | Color() 40 | { 41 | #if defined(OVR_BUILD_DEBUG) 42 | R = G = B = A = 0; 43 | #endif 44 | } 45 | 46 | // Constructs color by channel. Alpha is set to 0xFF (fully visible) 47 | // if not specified. 48 | Color(unsigned char r,unsigned char g,unsigned char b, unsigned char a = 0xFF) 49 | : R(r), G(g), B(b), A(a) { } 50 | 51 | // 0xAARRGGBB - Common HTML color Hex layout 52 | Color(unsigned c) 53 | : R((unsigned char)(c>>16)), G((unsigned char)(c>>8)), 54 | B((unsigned char)c), A((unsigned char)(c>>24)) { } 55 | 56 | bool operator==(const Color& b) const 57 | { 58 | return R == b.R && G == b.G && B == b.B && A == b.A; 59 | } 60 | 61 | void GetRGBA(float *r, float *g, float *b, float* a) const 62 | { 63 | *r = R / 255.0f; 64 | *g = G / 255.0f; 65 | *b = B / 255.0f; 66 | *a = A / 255.0f; 67 | } 68 | }; 69 | 70 | 71 | } // namespace OVR 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /externals/ovr/Src/Kernel/OVR_Math.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_Math.h 4 | Content : Implementation of 3D primitives such as vectors, matrices. 5 | Created : September 4, 2012 6 | Authors : Andrew Reisse, Michael Antonov, Anna Yershova 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | *************************************************************************************/ 26 | 27 | #include "OVR_Math.h" 28 | #include "OVR_Log.h" 29 | 30 | #include 31 | 32 | 33 | namespace OVR { 34 | 35 | 36 | //------------------------------------------------------------------------------------- 37 | // ***** Constants 38 | 39 | template<> 40 | const Vector3 Vector3::ZERO = Vector3(); 41 | 42 | template<> 43 | const Vector3 Vector3::ZERO = Vector3(); 44 | 45 | template<> 46 | const Matrix4 Matrix4::IdentityValue = Matrix4(1.0f, 0.0f, 0.0f, 0.0f, 47 | 0.0f, 1.0f, 0.0f, 0.0f, 48 | 0.0f, 0.0f, 1.0f, 0.0f, 49 | 0.0f, 0.0f, 0.0f, 1.0f); 50 | 51 | template<> 52 | const Matrix4 Matrix4::IdentityValue = Matrix4(1.0, 0.0, 0.0, 0.0, 53 | 0.0, 1.0, 0.0, 0.0, 54 | 0.0, 0.0, 1.0, 0.0, 55 | 0.0, 0.0, 0.0, 1.0); 56 | 57 | 58 | } // Namespace OVR 59 | -------------------------------------------------------------------------------- /externals/ovr/Src/Net/OVR_MessageIDTypes.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_MessageIDTypes.h 4 | Content : Enumeration list indicating what type of message is being sent 5 | Created : July 3, 2014 6 | Authors : Kevin Jenkins 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | ************************************************************************************/ 26 | 27 | namespace OVR { namespace Net { 28 | 29 | /// First byte of a network message 30 | typedef unsigned char MessageID; 31 | 32 | enum DefaultMessageIDTypes 33 | { 34 | OVRID_RPC1, 35 | OVRID_END = 128, 36 | OVRID_LATENCY_TESTER_1, 37 | }; 38 | 39 | }} // namespace OVR::Net 40 | -------------------------------------------------------------------------------- /externals/ovr/Src/Net/OVR_NetworkPlugin.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_NetworkPlugin.cpp 4 | Content : Base class for an extension to the network objects. 5 | Created : June 10, 2014 6 | Authors : Kevin Jenkins 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | ************************************************************************************/ 26 | 27 | #include "OVR_NetworkPlugin.h" 28 | 29 | namespace OVR { namespace Net { namespace Plugins { 30 | 31 | 32 | //----------------------------------------------------------------------------- 33 | // Plugin identifier to assign next 34 | 35 | //static uint8_t pluginIdNext = 0; 36 | 37 | 38 | //----------------------------------------------------------------------------- 39 | // NetworkPlugin 40 | 41 | NetworkPlugin::NetworkPlugin() 42 | { 43 | pSession = 0; 44 | //PluginId = pluginIdNext++; 45 | } 46 | 47 | NetworkPlugin::~NetworkPlugin() 48 | { 49 | } 50 | 51 | void NetworkPlugin::OnAddedToSession(Session* _pSession) 52 | { 53 | if (pSession != 0) 54 | { 55 | pSession->RemoveSessionListener(this); 56 | } 57 | 58 | pSession = _pSession; 59 | } 60 | 61 | void NetworkPlugin::OnRemovedFromSession(Session* _pSession) 62 | { 63 | OVR_UNUSED(_pSession); 64 | OVR_ASSERT(_pSession == pSession); 65 | 66 | pSession = 0; 67 | } 68 | 69 | 70 | }}} // OVR::Net::Plugins 71 | -------------------------------------------------------------------------------- /externals/ovr/Src/Net/OVR_NetworkPlugin.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | PublicHeader: n/a 4 | Filename : OVR_NetworkPlugin.h 5 | Content : Base class for an extension to the network objects. 6 | Created : June 10, 2014 7 | Authors : Kevin Jenkins 8 | 9 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 10 | 11 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 12 | you may not use the Oculus VR Rift SDK except in compliance with the License, 13 | which is provided at the time of installation or download, or which 14 | otherwise accompanies this software in either electronic or hard copy form. 15 | 16 | You may obtain a copy of the License at 17 | 18 | http://www.oculusvr.com/licenses/LICENSE-3.2 19 | 20 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 21 | distributed under the License is distributed on an "AS IS" BASIS, 22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | See the License for the specific language governing permissions and 24 | limitations under the License. 25 | 26 | ************************************************************************************/ 27 | 28 | #ifndef OVR_NetworkPlugin_h 29 | #define OVR_NetworkPlugin_h 30 | 31 | #include "OVR_Session.h" 32 | 33 | namespace OVR { namespace Net { namespace Plugins { 34 | 35 | 36 | //----------------------------------------------------------------------------- 37 | // NetworkPlugin 38 | 39 | // NetworkPlugins use Session and SessionListener to provide network functionality 40 | // independent of the transport medium. 41 | // Uses the chain of command design pattern such that plugins can invoke or intercept 42 | // network events via the Session. 43 | class NetworkPlugin : public SessionListener 44 | { 45 | public: 46 | NetworkPlugin(); 47 | virtual ~NetworkPlugin(); 48 | 49 | protected: 50 | virtual void OnAddedToSession(Session* _pSession); 51 | virtual void OnRemovedFromSession(Session* _pSession); 52 | 53 | Session *pSession; 54 | //uint8_t PluginId; 55 | }; 56 | 57 | 58 | }}} // OVR::Net::Plugins 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /externals/ovr/Src/Net/OVR_NetworkTypes.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | PublicHeader: n/a 4 | Filename : OVR_NetworkTypes.h 5 | Content : Shared header for network types 6 | Created : June 12, 2014 7 | Authors : Kevin Jenkins 8 | 9 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 10 | 11 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 12 | you may not use the Oculus VR Rift SDK except in compliance with the License, 13 | which is provided at the time of installation or download, or which 14 | otherwise accompanies this software in either electronic or hard copy form. 15 | 16 | You may obtain a copy of the License at 17 | 18 | http://www.oculusvr.com/licenses/LICENSE-3.2 19 | 20 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 21 | distributed under the License is distributed on an "AS IS" BASIS, 22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | See the License for the specific language governing permissions and 24 | limitations under the License. 25 | 26 | ************************************************************************************/ 27 | 28 | #ifndef OVR_NetworkTypes_h 29 | #define OVR_NetworkTypes_h 30 | 31 | #include "../Kernel/OVR_Types.h" 32 | 33 | namespace OVR { namespace Net { 34 | 35 | 36 | typedef uint64_t NetworkID; 37 | const NetworkID InvalidNetworkID = ~((NetworkID)0); 38 | 39 | 40 | } } // OVR::Net 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /externals/ovr/Src/OVR_CAPI_GL.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : OVR_CAPI_GL.h 4 | Content : GL specific structures used by the CAPI interface. 5 | Created : November 7, 2013 6 | Authors : Lee Cooper 7 | 8 | Copyright : Copyright 2013 Oculus VR, LLC. All Rights reserved. 9 | 10 | Use of this software is subject to the terms of the Oculus Inc license 11 | agreement provided at the time of installation or download, or which 12 | otherwise accompanies this software in either electronic or hard copy form. 13 | 14 | ************************************************************************************/ 15 | #ifndef OVR_CAPI_GL_h 16 | #define OVR_CAPI_GL_h 17 | 18 | /// @file OVR_CAPI_GL.h 19 | /// OpenGL rendering support. 20 | 21 | #include "OVR_CAPI.h" 22 | #if defined(__APPLE__) 23 | #include 24 | #else 25 | #include 26 | #endif 27 | 28 | 29 | /// Used to configure slave GL rendering (i.e. for devices created externally). 30 | typedef struct OVR_ALIGNAS(8) ovrGLConfigData_s 31 | { 32 | /// General device settings. 33 | ovrRenderAPIConfigHeader Header; 34 | 35 | #if defined(OVR_OS_WIN32) 36 | /// The optional window handle. If unset, rendering will use the current window. 37 | HWND Window; 38 | /// The optional device context. If unset, rendering will use a new context. 39 | HDC DC; 40 | #elif defined (OVR_OS_LINUX) 41 | /// Optional display. If unset, will issue glXGetCurrentDisplay when context 42 | /// is current. 43 | struct _XDisplay* Disp; 44 | #endif 45 | } ovrGLConfigData; 46 | 47 | /// Contains OpenGL-specific rendering information. 48 | union ovrGLConfig 49 | { 50 | /// General device settings. 51 | ovrRenderAPIConfig Config; 52 | /// OpenGL-specific settings. 53 | ovrGLConfigData OGL; 54 | }; 55 | 56 | /// Used to pass GL eye texture data to ovrHmd_EndFrame. 57 | typedef struct OVR_ALIGNAS(8) ovrGLTextureData_s 58 | { 59 | /// General device settings. 60 | ovrTextureHeader Header; 61 | /// The OpenGL name for this texture. 62 | GLuint TexId; 63 | } ovrGLTextureData; 64 | 65 | static_assert(offsetof(ovrGLTextureData, TexId) == offsetof(ovrTexture, PlatformData), "Mismatch of structs that are presumed binary equivalents."); 66 | 67 | /// Contains OpenGL-specific texture information. 68 | typedef union ovrGLTexture_s 69 | { 70 | /// General device settings. 71 | ovrTexture Texture; 72 | /// OpenGL-specific settings. 73 | ovrGLTextureData OGL; 74 | } ovrGLTexture; 75 | 76 | #endif // OVR_CAPI_GL_h 77 | -------------------------------------------------------------------------------- /externals/ovr/Src/Util/Util_Interface.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : Util_Interface.cpp 4 | Content : Simple interface, utilised by internal demos, 5 | with access to wider SDK as needed. 6 | Located in the body of the SDK to ensure updated 7 | when new SDK features are added. 8 | Created : February 20, 2014 9 | Authors : Tom Heath 10 | 11 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 12 | 13 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 14 | you may not use the Oculus VR Rift SDK except in compliance with the License, 15 | which is provided at the time of installation or download, or which 16 | otherwise accompanies this software in either electronic or hard copy form. 17 | 18 | You may obtain a copy of the License at 19 | 20 | http://www.oculusvr.com/licenses/LICENSE-3.2 21 | 22 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 23 | distributed under the License is distributed on an "AS IS" BASIS, 24 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | See the License for the specific language governing permissions and 26 | limitations under the License. 27 | 28 | *************************************************************************************/ 29 | 30 | #include "Util_Interface.h" 31 | 32 | 33 | 34 | //Files left in to ease its possible return...... 35 | -------------------------------------------------------------------------------- /externals/ovr/Src/Util/Util_Interface.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : Util_Interface.h 4 | Content : Simple interface, utilised by internal demos, 5 | with access to wider SDK as needed. 6 | Located in the body of the SDK to ensure updated 7 | when new SDK features are added. 8 | Created : February 20, 2014 9 | Authors : Tom Heath 10 | 11 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 12 | 13 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 14 | you may not use the Oculus VR Rift SDK except in compliance with the License, 15 | which is provided at the time of installation or download, or which 16 | otherwise accompanies this software in either electronic or hard copy form. 17 | 18 | You may obtain a copy of the License at 19 | 20 | http://www.oculusvr.com/licenses/LICENSE-3.2 21 | 22 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 23 | distributed under the License is distributed on an "AS IS" BASIS, 24 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | See the License for the specific language governing permissions and 26 | limitations under the License. 27 | 28 | *************************************************************************************/ 29 | 30 | #ifndef OVR_Util_Interface_h 31 | #define OVR_Util_Interface_h 32 | #include "../OVR_CAPI.h" 33 | 34 | //Files left in to ease its possible return...... 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /externals/ovr/Src/Util/Util_LatencyTest2Reader.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : Util_LatencyTest2Reader.h 4 | Content : Shared functionality for the DK2 latency tester 5 | Created : July 8, 2014 6 | Authors : Volga Aksoy, Chris Taylor 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | *************************************************************************************/ 26 | 27 | #ifndef OVR_Util_LatencyTest2Reader_h 28 | #define OVR_Util_LatencyTest2Reader_h 29 | 30 | #include "../Tracking/Tracking_SensorState.h" 31 | #include "Util_LatencyTest2State.h" 32 | 33 | namespace OVR { namespace Util { 34 | 35 | 36 | //----------------------------------------------------------------------------- 37 | // RecordStateReader 38 | 39 | // User interface to retrieve pose from the sensor fusion subsystem 40 | class RecordStateReader : public NewOverrideBase 41 | { 42 | protected: 43 | const Tracking::CombinedSharedStateUpdater* Updater; 44 | 45 | public: 46 | RecordStateReader() 47 | : Updater(NULL) 48 | { 49 | } 50 | 51 | // Initialize the updater 52 | void SetUpdater(const Tracking::CombinedSharedStateUpdater *updater) 53 | { 54 | Updater = updater; 55 | } 56 | 57 | void GetRecordSet(FrameTimeRecordSet& recordset); 58 | }; 59 | 60 | 61 | }} // namespace OVR::Util 62 | 63 | #endif // OVR_Util_LatencyTest2Reader_h 64 | -------------------------------------------------------------------------------- /externals/ovr/Src/Util/Util_SystemGUI.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : Util_SystemGUI.h 4 | Content : OS GUI access, usually for diagnostics. 5 | Created : October 20, 2014 6 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 7 | 8 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 9 | you may not use the Oculus VR Rift SDK except in compliance with the License, 10 | which is provided at the time of installation or download, or which 11 | otherwise accompanies this software in either electronic or hard copy form. 12 | 13 | You may obtain a copy of the License at 14 | 15 | http://www.oculusvr.com/licenses/LICENSE-3.2 16 | 17 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | 23 | *************************************************************************************/ 24 | 25 | #ifndef OVR_Util_GUI_h 26 | #define OVR_Util_GUI_h 27 | 28 | 29 | namespace OVR { namespace Util { 30 | 31 | // Displays a modal message box on the default GUI display (not on a VR device). 32 | // The message box interface (e.g. OK button) is not localized. 33 | bool DisplayMessageBox(const char* pTitle, const char* pText); 34 | 35 | 36 | } } // namespace OVR::Util 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /externals/ovr/Src/Util/Util_SystemInfo.h: -------------------------------------------------------------------------------- 1 | /************************************************************************************ 2 | 3 | Filename : Util_SystemInfo.h 4 | Content : Various operations to get information about the system 5 | Created : September 26, 2014 6 | Author : Kevin Jenkins 7 | 8 | Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. 9 | 10 | Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 11 | you may not use the Oculus VR Rift SDK except in compliance with the License, 12 | which is provided at the time of installation or download, or which 13 | otherwise accompanies this software in either electronic or hard copy form. 14 | 15 | You may obtain a copy of the License at 16 | 17 | http://www.oculusvr.com/licenses/LICENSE-3.2 18 | 19 | Unless required by applicable law or agreed to in writing, the Oculus VR SDK 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | ************************************************************************************/ 26 | 27 | 28 | #ifndef OVR_Util_SystemInfo_h 29 | #define OVR_Util_SystemInfo_h 30 | 31 | #include "../Kernel/OVR_String.h" 32 | #include "../Kernel/OVR_Types.h" 33 | #include "../Kernel/OVR_Array.h" 34 | 35 | namespace OVR { namespace Util { 36 | 37 | const char * OSAsString(); 38 | String OSVersionAsString(); 39 | uint64_t GetGuidInt(); 40 | String GetGuidString(); 41 | const char * GetProcessInfo(); 42 | String GetFileVersionString(String filePath); 43 | String GetSystemFileVersionString(String filePath); 44 | String GetDisplayDriverVersion(); 45 | String GetCameraDriverVersion(); 46 | void GetGraphicsCardList(OVR::Array< OVR::String > &gpus); 47 | String GetProcessorInfo(int* numcores = NULL); 48 | 49 | } } // namespace OVR { namespace Util { 50 | 51 | #endif // OVR_Util_SystemInfo_h 52 | -------------------------------------------------------------------------------- /fonts/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/fonts/Roboto-Bold.ttf -------------------------------------------------------------------------------- /fonts/RobotoCondensed-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/fonts/RobotoCondensed-Bold.ttf -------------------------------------------------------------------------------- /fonts/RobotoCondensed-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/fonts/RobotoCondensed-Light.ttf -------------------------------------------------------------------------------- /fonts/RobotoCondensed-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/fonts/RobotoCondensed-Regular.ttf -------------------------------------------------------------------------------- /frequensea-osculator-config.oscd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/frequensea-osculator-config.oscd -------------------------------------------------------------------------------- /houdini/surface.hipnc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/houdini/surface.hipnc -------------------------------------------------------------------------------- /img/grad-bry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/img/grad-bry.jpg -------------------------------------------------------------------------------- /img/grad-rainbow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/img/grad-rainbow.jpg -------------------------------------------------------------------------------- /img/lenna-tv.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/img/lenna-tv.jpg -------------------------------------------------------------------------------- /img/negx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/img/negx.jpg -------------------------------------------------------------------------------- /img/negy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/img/negy.jpg -------------------------------------------------------------------------------- /img/negz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/img/negz.jpg -------------------------------------------------------------------------------- /img/posx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/img/posx.jpg -------------------------------------------------------------------------------- /img/posy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/img/posy.jpg -------------------------------------------------------------------------------- /img/posz.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/img/posz.jpg -------------------------------------------------------------------------------- /lua/animate-camera.lua: -------------------------------------------------------------------------------- 1 | -- Animate the camera around a static scene 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 1.0, 1.0) * dot(normalize(vp), normalize(vn)) * 0.3; 12 | color += vec3(0.1, 0.1, 0.5); 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(vp, 1.0); 14 | } 15 | ]] 16 | 17 | FRAGMENT_SHADER = [[ 18 | #version 400 19 | in vec3 color; 20 | layout (location = 0) out vec4 fragColor; 21 | void main() { 22 | fragColor = vec4(color, 0.95); 23 | } 24 | ]] 25 | 26 | function setup() 27 | model = ngl_model_load_obj("../obj/cubes.obj") 28 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 29 | end 30 | 31 | function draw() 32 | camera_x = math.sin(nwm_get_time() * 0.3) * 50 33 | camera_y = 10 34 | camera_z = math.cos(nwm_get_time() * 0.3) * 50 35 | 36 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 37 | ngl_clear(0.2, 0.2, 0.2, 1) 38 | ngl_draw_model(camera, model, shader) 39 | end 40 | -------------------------------------------------------------------------------- /lua/capture-model.lua: -------------------------------------------------------------------------------- 1 | -- Save transformed geometry data using OpenGL Transform Feedback 2 | -- https://www.opengl.org/wiki/Transform_Feedback 3 | -- Press "c" to capture/save the model in a file called "out.obj". 4 | 5 | VERTEX_SHADER = [[ 6 | #version 400 7 | layout (location = 0) in vec3 vp; 8 | layout (location = 1) in vec3 vn; 9 | out vec3 color; 10 | uniform mat4 uViewMatrix, uProjectionMatrix; 11 | uniform float uTime; 12 | void main() { 13 | color = vec3(1.0, 1.0, 1.0) * dot(normalize(vp), normalize(vn)) * 0.5; 14 | color += vec3(0.2, 0.5, 0.8); 15 | vec3 p = vp + noise1(uTime / 5.0 + vp.x / 100.0) * 20.0 + noise1(uTime / 10.0 + vp.z / 100.0) * 20.0; 16 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(p, 1.0); 17 | } 18 | ]] 19 | 20 | FRAGMENT_SHADER = [[ 21 | #version 400 22 | in vec3 color; 23 | layout (location = 0) out vec4 fragColor; 24 | void main() { 25 | fragColor = vec4(color, 0.95); 26 | } 27 | ]] 28 | 29 | camera_x = 0 30 | camera_y = 30 31 | camera_z = 50 32 | 33 | function setup() 34 | model = ngl_model_new_grid_triangles(100, 100, 5, 5) 35 | shader = ngl_shader_new(GL_LINES, VERTEX_SHADER, FRAGMENT_SHADER) 36 | end 37 | 38 | function draw() 39 | ngl_clear(0.2, 0.2, 0.2, 1) 40 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 41 | ngl_draw_model(camera, model, shader) 42 | end 43 | 44 | function on_key(key, mods) 45 | keys_camera_handler(key, mods) 46 | if key == KEY_C then 47 | ngl_capture_model(camera, model, shader, "out.obj") 48 | print("Saved to out.obj.") 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lua/diffuse.lua: -------------------------------------------------------------------------------- 1 | -- Display a static scene with a diffuse shader. 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color = vec3(.41,.3,.2); 8 | uniform mat4 uViewMatrix, uProjectionMatrix, NormalMatrix; 9 | uniform vec4 LightPosition; 10 | uniform vec3 Kd = vec3(2,5,10); 11 | uniform vec3 Ld = vec3(5,3,1); 12 | uniform float uTime; 13 | 14 | void main() { 15 | vec3 tnorm = normalize(vp * vn); 16 | //vec3 tnorm = vec3(1.0, 1.0, 1.0) * dot(normalize(vp), normalize(vn)) * 0.3; 17 | vec4 eyeCoords = uProjectionMatrix * uViewMatrix * vec4(vp, 1.0); 18 | vec3 s = normalize(vec3(LightPosition - eyeCoords)); 19 | vec3 nn = ((Ld * Kd) * max( dot( s, tnorm ), 0.0 )) / 10.0; 20 | color = ((Ld * Kd) * max( dot( s, tnorm ), 0.0 )) / 10.0; 21 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(vp, 1.0); 22 | } 23 | ]] 24 | 25 | FRAGMENT_SHADER = [[ 26 | #version 400 27 | in vec3 color; 28 | layout (location = 0) out vec4 fragColor; 29 | void main() { 30 | fragColor = vec4(color, 0.95); 31 | } 32 | ]] 33 | 34 | function setup() 35 | camera = ngl_camera_new_look_at(-20, 18, 50) 36 | model = ngl_model_load_obj("../obj/c004.obj") 37 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 38 | end 39 | 40 | function draw() 41 | ngl_clear(0.2, 0.2, 0.2, 1) 42 | ngl_draw_model(camera, model, shader) 43 | end 44 | -------------------------------------------------------------------------------- /lua/draw-text.lua: -------------------------------------------------------------------------------- 1 | -- Example showing how to draw text. 2 | 3 | function setup() 4 | font = ngl_font_new("../fonts/Roboto-Bold.ttf", 72) 5 | end 6 | 7 | function draw() 8 | ngl_clear(0.0, 0.0, 0.0, 1) 9 | ngl_font_draw(font, "Hello, world!", 1, 1, 1.0) 10 | end 11 | -------------------------------------------------------------------------------- /lua/dvbt.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as a texture from the HackRF 2 | -- You want seizures? 'Cause this is how you get seizures. 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | layout (location = 2) in vec2 vt; 9 | out vec3 color; 10 | out vec2 texCoord; 11 | uniform mat4 uViewMatrix, uProjectionMatrix; 12 | uniform float uTime; 13 | void main() { 14 | color = vec3(1.0, 1.0, 1.0); 15 | texCoord = vt; 16 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 17 | } 18 | ]] 19 | 20 | FRAGMENT_SHADER = [[ 21 | #version 400 22 | in vec3 color; 23 | in vec2 texCoord; 24 | uniform sampler2D uTexture; 25 | layout (location = 0) out vec4 fragColor; 26 | void main() { 27 | float r = texture(uTexture, texCoord).r * 10; 28 | fragColor = vec4(r, r, r, 1); 29 | } 30 | ]] 31 | 32 | function setup() 33 | freq = 502.19 34 | shift = 0.1e6 35 | device = nrf_device_new(freq, "../rfdata/rf-200.500-big.raw") 36 | shifter = nrf_freq_shifter_new(shift, device.sample_rate) 37 | filter = nrf_iq_filter_new(device.sample_rate, 60e3, 97) 38 | 39 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 40 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 41 | texture = ngl_texture_new(shader, "uTexture") 42 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 43 | end 44 | 45 | function draw() 46 | samples_buffer = nrf_device_get_samples_buffer(device) 47 | nrf_freq_shifter_process(shifter, samples_buffer) 48 | shifter_buffer = nrf_freq_shifter_get_buffer(shifter) 49 | nrf_iq_filter_process(filter, shifter_buffer) 50 | filter_buffer = nrf_iq_filter_get_buffer(filter) 51 | iq_buffer = nrf_buffer_to_iq_points(filter_buffer) 52 | 53 | ngl_clear(0.2, 0.2, 0.2, 1.0) 54 | ngl_texture_update(texture, iq_buffer, 256, 256) 55 | ngl_draw_model(camera, model, shader) 56 | end 57 | 58 | function on_key(key, mods) 59 | keys_frequency_handler(key, mods) 60 | if key == KEY_E then 61 | nut_buffer_save(nut_buffer_convert(filter_buffer, NUT_BUFFER_U8), "out.raw") 62 | end 63 | if key == KEY_LEFT_BRACKET then 64 | shift = shift - 0.01e3 65 | shifter = nrf_freq_shifter_new(shift, device.sample_rate) 66 | print("Shift: " .. shift) 67 | elseif key == KEY_RIGHT_BRACKET then 68 | shift = shift + 0.01e3 69 | shifter = nrf_freq_shifter_new(shift, device.sample_rate) 70 | print("Shift: " .. shift) 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /lua/empty.lua: -------------------------------------------------------------------------------- 1 | -- Empty template to get started 2 | 3 | function setup() 4 | -- Load the model, shaders, camera, ... 5 | end 6 | 7 | function draw() 8 | ngl_clear(0.2, 0.2, 0.2, 1) 9 | -- Draw your scene 10 | end 11 | -------------------------------------------------------------------------------- /lua/fft-shifted.lua: -------------------------------------------------------------------------------- 1 | -- Visualize FFT data as a texture 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | layout (location = 2) in vec2 vt; 8 | out vec3 color; 9 | out vec2 texCoord; 10 | uniform mat4 uViewMatrix, uProjectionMatrix; 11 | uniform float uTime; 12 | void main() { 13 | color = vec3(1.0, 1.0, 1.0); 14 | texCoord = vt; 15 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 16 | } 17 | ]] 18 | 19 | FRAGMENT_SHADER = [[ 20 | #version 400 21 | in vec3 color; 22 | in vec2 texCoord; 23 | uniform sampler2D uTexture; 24 | layout (location = 0) out vec4 fragColor; 25 | void main() { 26 | float r = texture(uTexture, texCoord).r; 27 | float g = texture(uTexture, texCoord).g; 28 | float pwr = r * r + g * g; 29 | float pwr_dbfs = 10.0 * log2(pwr + 1.0e-20) / log2(2.7182818284); 30 | 31 | //float v = sqrt(r * r + g * g) * 0.1; 32 | float v = pwr_dbfs * 0.02; 33 | fragColor = vec4(v, v, v, 0.95); 34 | } 35 | ]] 36 | 37 | function setup() 38 | freq = 97.5 39 | shift = 0 40 | device = nrf_device_new(freq, "../rfdata/rf-200.500-big.raw") 41 | shifter = nrf_freq_shifter_new(shift, device.sample_rate) 42 | fft = nrf_fft_new(1024, 1024) 43 | 44 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 45 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 46 | texture = ngl_texture_new(shader, "uTexture") 47 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 48 | end 49 | 50 | function draw() 51 | samples_buffer = nrf_device_get_samples_buffer(device) 52 | nrf_freq_shifter_process(shifter, samples_buffer) 53 | shifter_buffer = nrf_freq_shifter_get_buffer(shifter) 54 | nrf_fft_process(fft, shifter_buffer) 55 | fft_buffer = nrf_fft_get_buffer(fft) 56 | 57 | ngl_clear(0.2, 0.2, 0.2, 1.0) 58 | ngl_texture_update(texture, fft_buffer, 1024, 1024) 59 | ngl_draw_model(camera, model, shader) 60 | end 61 | 62 | function on_key(key, mods) 63 | keys_frequency_handler(key, mods) 64 | if key == KEY_LEFT_BRACKET then 65 | shift = shift - 10e3 66 | shifter = nrf_freq_shifter_new(shift, device.sample_rate) 67 | print("Shift: " .. shift) 68 | elseif key == KEY_RIGHT_BRACKET then 69 | shift = shift + 10e3 70 | shifter = nrf_freq_shifter_new(shift, device.sample_rate) 71 | print("Shift: " .. shift) 72 | end 73 | end 74 | -------------------------------------------------------------------------------- /lua/fft.lua: -------------------------------------------------------------------------------- 1 | -- Visualize FFT data as a texture 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | layout (location = 2) in vec2 vt; 8 | out vec3 color; 9 | out vec2 texCoord; 10 | uniform mat4 uViewMatrix, uProjectionMatrix; 11 | uniform float uTime; 12 | void main() { 13 | color = vec3(1.0, 1.0, 1.0); 14 | texCoord = vt; 15 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 16 | } 17 | ]] 18 | 19 | FRAGMENT_SHADER = [[ 20 | #version 400 21 | in vec3 color; 22 | in vec2 texCoord; 23 | uniform sampler2D uTexture; 24 | layout (location = 0) out vec4 fragColor; 25 | void main() { 26 | float r = texture(uTexture, texCoord).r * 0.1; 27 | fragColor = vec4(r, r, r, 0.95); 28 | } 29 | ]] 30 | 31 | function setup() 32 | freq = 97 33 | device = nrf_device_new(freq, "../rfdata/rf-200.500-big.raw") 34 | fft = nrf_fft_new(1024, 1024) 35 | 36 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 37 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 38 | texture = ngl_texture_new(shader, "uTexture") 39 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 40 | end 41 | 42 | function draw() 43 | samples_buffer = nrf_device_get_samples_buffer(device) 44 | nrf_fft_process(fft, samples_buffer) 45 | fft_buffer = nrf_fft_get_buffer(fft) 46 | 47 | ngl_clear(0.2, 0.2, 0.2, 1.0) 48 | ngl_texture_update(texture, fft_buffer, 1024, 1024) 49 | ngl_draw_model(camera, model, shader) 50 | end 51 | 52 | function on_key(key, mods) 53 | keys_frequency_handler(key, mods) 54 | end 55 | -------------------------------------------------------------------------------- /lua/fm-player.lua: -------------------------------------------------------------------------------- 1 | -- Play FM radio. Has no visible interface. 2 | 3 | function setup() 4 | freq_offset = 50000 5 | freq = (100.9e6 + freq_offset) / 1e6 6 | device = nrf_device_new(freq, "../rfdata/rf-100.900-1.raw") 7 | player = nrf_player_new(device, NRF_DEMODULATE_WBFM, freq_offset) 8 | freq_font = ngl_font_new("../fonts/Roboto-Bold.ttf", 72) 9 | end 10 | 11 | function draw() 12 | ngl_clear(0.2, 0.2, 0.2, 1.0) 13 | ngl_font_draw(freq_font, freq, 1, 0.7, 1.0) 14 | end 15 | 16 | function on_key(key, mods) 17 | keys_frequency_handler(key, mods) 18 | keys_frequency_offset_handler(key, mods) 19 | end 20 | -------------------------------------------------------------------------------- /lua/grid-ripple.lua: -------------------------------------------------------------------------------- 1 | -- Use noise on a grid 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 0.0, 0.0); 12 | float force = .6; 13 | float speed = 4.0; 14 | vec2 p = -1.0 + 2.0 * vp.xy / vec2(1.0,1.0); 15 | float len = length(p); 16 | vec2 uv = vp.xy + (p/len) * sin(len * 2.0 - uTime * speed) * force; 17 | uv.x = uv.x + 2.0* sin(uTime/2.0); 18 | vec3 pt = vec3(uv.x, noise1(noise1(uv.x * .287) + noise1(uv.y * 0.393) + uTime * .95), vp.y); 19 | gl_PointSize = 2; 20 | color = vec3(0.26, 0.8-noise1(pt.y*5.0), 1.0-(noise1(pt.y*5.0))); 21 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 22 | } 23 | ]] 24 | 25 | FRAGMENT_SHADER = [[ 26 | #version 400 27 | in vec3 color; 28 | layout (location = 0) out vec4 fragColor; 29 | void main() { 30 | fragColor = vec4(color, 0.95); 31 | } 32 | ]] 33 | 34 | function setup() 35 | shader = ngl_shader_new(GL_POINTS, VERTEX_SHADER, FRAGMENT_SHADER) 36 | model = ngl_model_new_grid_points(500, 500, 0.05, 0.05) 37 | --model = ngl_model_load_obj("../obj/c004.obj") 38 | end 39 | 40 | function draw() 41 | camera = ngl_camera_new_look_at(0, -5, -5) 42 | ngl_clear(0.2, 0.2, 0.2, 1.0) 43 | ngl_draw_model(camera, model, shader) 44 | end 45 | -------------------------------------------------------------------------------- /lua/grid.lua: -------------------------------------------------------------------------------- 1 | -- Draw a grid 2 | -- Animation happens in the shader 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | out vec3 color; 9 | uniform mat4 uViewMatrix, uProjectionMatrix; 10 | uniform float uTime; 11 | void main() { 12 | color = vec3(1.0, 1.0, 1.0); 13 | vec3 pt = vp * 2.0; 14 | gl_PointSize = abs(sin(pt.x * pt.y * uTime * 5.0) * 5.0); 15 | gl_Position = vec4(pt, 1.0); 16 | } 17 | ]] 18 | 19 | FRAGMENT_SHADER = [[ 20 | #version 400 21 | in vec3 color; 22 | layout (location = 0) out vec4 fragColor; 23 | void main() { 24 | fragColor = vec4(color, 0.95); 25 | } 26 | ]] 27 | 28 | function setup() 29 | camera = ngl_camera_new_look_at(0, 0, 0) -- Shader ignores camera position, but camera object is required for ngl_draw_model 30 | shader = ngl_shader_new(GL_POINTS, VERTEX_SHADER, FRAGMENT_SHADER) 31 | model = ngl_model_new_grid_points(100, 100, 0.01, 0.01) 32 | end 33 | 34 | function draw() 35 | ngl_clear(0.2, 0.2, 0.2, 1.0) 36 | ngl_draw_model(camera, model, shader) 37 | end 38 | -------------------------------------------------------------------------------- /lua/iq-lines-animate-freq.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as lines, animating through the spectrum 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | layout (location = 2) in vec2 vt; 8 | out vec3 color; 9 | out vec2 texCoord; 10 | uniform mat4 uViewMatrix, uProjectionMatrix; 11 | uniform float uTime; 12 | void main() { 13 | color = vec3(1.0, 1.0, 1.0); 14 | texCoord = vt; 15 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 16 | } 17 | ]] 18 | 19 | FRAGMENT_SHADER = [[ 20 | #version 400 21 | in vec3 color; 22 | in vec2 texCoord; 23 | uniform sampler2D uTexture; 24 | layout (location = 0) out vec4 fragColor; 25 | void main() { 26 | float r = texture(uTexture, texCoord).r * 20; 27 | fragColor = vec4(r, r, r, 1); 28 | } 29 | ]] 30 | 31 | function setup() 32 | freq = 100 33 | line_percentage = 0.01 34 | device = nrf_device_new(freq, "../rfdata/rf-202.500-2.raw") 35 | filter = nrf_iq_filter_new(device.sample_rate, 100e3, 51) 36 | 37 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 38 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 39 | texture = ngl_texture_new(shader, "uTexture") 40 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 41 | end 42 | 43 | function draw() 44 | samples_buffer = nrf_device_get_samples_buffer(device) 45 | nrf_iq_filter_process(filter, samples_buffer) 46 | filter_buffer = nrf_iq_filter_get_buffer(filter) 47 | iq_buffer = nrf_buffer_to_iq_lines(filter_buffer, 4, 0.3) 48 | 49 | ngl_clear(0.2, 0.2, 0.2, 1.0) 50 | ngl_texture_update(texture, iq_buffer, 1024, 1024) 51 | ngl_draw_model(camera, model, shader) 52 | 53 | freq = freq + 0.0001 54 | nrf_device_set_frequency(device, freq) 55 | end 56 | -------------------------------------------------------------------------------- /lua/iq-lines-buffer.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as lines. 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | layout (location = 2) in vec2 vt; 8 | out vec3 color; 9 | out vec2 texCoord; 10 | uniform mat4 uViewMatrix, uProjectionMatrix; 11 | uniform float uTime; 12 | void main() { 13 | color = vec3(1.0, 1.0, 1.0); 14 | texCoord = vt; 15 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 16 | } 17 | ]] 18 | 19 | FRAGMENT_SHADER = [[ 20 | #version 400 21 | in vec3 color; 22 | in vec2 texCoord; 23 | uniform sampler2D uTexture; 24 | layout (location = 0) out vec4 fragColor; 25 | void main() { 26 | float r = texture(uTexture, texCoord).r * 1; 27 | fragColor = vec4(r, r, r, 1); 28 | } 29 | ]] 30 | 31 | function setup() 32 | freq = 433 33 | device = nrf_device_new(freq, "../rfdata/rf-200.500-big.raw") 34 | --filter = nrf_iq_filter_new(device.sample_rate, 100e3, 43) 35 | 36 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 37 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 38 | texture = ngl_texture_new(shader, "uTexture") 39 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 40 | end 41 | 42 | function draw() 43 | samples_buffer = nrf_device_get_samples_buffer(device) 44 | --nrf_iq_filter_process(filter, samples_buffer) 45 | --filter_buffer = nrf_iq_filter_get_buffer(filter) 46 | iq_buffer = nrf_buffer_to_iq_lines(samples_buffer, 2, 1.0) 47 | 48 | ngl_clear(0.2, 0.2, 0.2, 1.0) 49 | ngl_texture_update(texture, iq_buffer, 512, 512) 50 | ngl_draw_model(camera, model, shader) 51 | end 52 | 53 | function on_key(key, mods) 54 | keys_frequency_handler(key, mods) 55 | if key == KEY_E then 56 | nut_buffer_save(nut_buffer_convert(filter_buffer, 1), "out.raw") 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /lua/iq-lines.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data from the HackRF 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 1.0, 1.0); 12 | vec2 pt = vec2((vp.x - 0.5) * 2, (vp.y - 0.5) * 2); 13 | gl_Position = vec4(pt.x, pt.y, 0.0, 1.0); 14 | } 15 | ]] 16 | 17 | FRAGMENT_SHADER = [[ 18 | #version 400 19 | in vec3 color; 20 | layout (location = 0) out vec4 fragColor; 21 | void main() { 22 | fragColor = vec4(color, 0.95); 23 | } 24 | ]] 25 | 26 | function setup() 27 | freq = 143.2 28 | line_percentage = 0.04 29 | device = nrf_device_new(freq, "../rfdata/rf-200.500-big.raw") 30 | 31 | camera = ngl_camera_new_look_at(0, 0, 0) -- Shader ignores camera position, but camera object is required for ngl_draw_model 32 | shader = ngl_shader_new(GL_LINE_STRIP, VERTEX_SHADER, FRAGMENT_SHADER) 33 | end 34 | 35 | function draw() 36 | samples_buffer = nrf_device_get_samples_buffer(device) 37 | reduced_buffer = nut_buffer_reduce(samples_buffer, line_percentage) 38 | 39 | ngl_clear(0.2, 0.2, 0.2, 1.0) 40 | model = ngl_model_new_with_buffer(reduced_buffer) 41 | ngl_draw_model(camera, model, shader) 42 | end 43 | 44 | function clamp(v, min, max) 45 | if v < min then 46 | return min 47 | elseif v > max then 48 | return max 49 | else 50 | return v 51 | end 52 | end 53 | 54 | function on_key(key, mods) 55 | keys_frequency_handler(key, mods) 56 | if (mods == 4) then -- Alt key 57 | d = 0.001 58 | else 59 | d = 0.01 60 | end 61 | if key == KEY_COMMA then 62 | line_percentage = clamp(line_percentage - d, 0, 1) 63 | print("Line percentage: " .. line_percentage * 100 .. "%") 64 | elseif key == KEY_PERIOD then 65 | line_percentage = clamp(line_percentage + d, 0, 1) 66 | print("Line percentage: " .. line_percentage * 100 .. "%") 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /lua/iq-tex-3d.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data from the HackRF in 3D. 2 | -- Calculate normals and lighting 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | layout (location = 2) in vec2 vt; 9 | flat out vec4 color; 10 | out vec2 texCoord; 11 | uniform mat4 uViewMatrix, uProjectionMatrix; 12 | uniform float uTime; 13 | uniform sampler2D uTexture; 14 | void main() { 15 | float offset = 0.0; 16 | float power = 1; 17 | float t1 = offset + texture(uTexture, vt).r * power; 18 | float t2 = offset + texture(uTexture, vt + vec2(0.01, 0)).r * power; 19 | float t3 = offset + texture(uTexture, vt + vec2(0, 0.01)).r * power; 20 | vec3 v1 = vec3(vp.x, t1, vp.z); 21 | vec3 v2 = vec3(vp.x + 0.01, t2, vp.z); 22 | vec3 v3 = vec3(vp.x, t3, vp.z + 0.01); 23 | 24 | vec3 u = v2 - v1; 25 | vec3 v = v3 - v1; 26 | float x = (u.y * v.z) - (u.z * v.y); 27 | float y = (u.z * v.x) - (u.x * v.z); 28 | float z = (u.x * v.y) - (u.y * v.x); 29 | vec3 n = vec3(x, y, z); 30 | 31 | color = vec4(1.0, 1.0, 1.0, 1.0) * dot(normalize(v1), normalize(n)) * 0.5; 32 | color += vec4(0.2, 0.2, 0.4, 0.5); 33 | color *= 2; 34 | 35 | float l = 1.0 - ((vp.x * vp.x + vp.z * vp.z) * 1.0); 36 | color *= vec4(l, l, l, l); 37 | texCoord = vt; 38 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(v1, 1.0); 39 | } 40 | ]] 41 | 42 | FRAGMENT_SHADER = [[ 43 | #version 400 44 | flat in vec4 color; 45 | in vec2 texCoord; 46 | layout (location = 0) out vec4 fragColor; 47 | void main() { 48 | fragColor = color; 49 | } 50 | ]] 51 | 52 | camera_x = 0.0 53 | camera_y = 1 54 | camera_z = 1 55 | 56 | function setup() 57 | freq = 201.2 58 | device = nrf_device_new(freq, "../rfdata/rf-202.500-2.raw") 59 | 60 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 61 | texture = ngl_texture_new(shader, "uTexture") 62 | model = ngl_model_new_grid_triangles(256, 256, 0.005, 0.005) 63 | ngl_model_translate(model, 0, -0.1, 0) 64 | end 65 | 66 | function draw() 67 | iq_buffer = nrf_device_get_iq_buffer(device) 68 | 69 | ngl_clear(0.2, 0.2, 0.2, 1.0) 70 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 71 | ngl_texture_update(texture, iq_buffer, 256, 256) 72 | ngl_draw_model(camera, model, shader) 73 | end 74 | 75 | function on_key(key, mods) 76 | keys_camera_handler(key, mods) 77 | keys_frequency_handler(key, mods) 78 | end 79 | -------------------------------------------------------------------------------- /lua/iq-tex-audio.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as a texture from the HackRF 2 | -- You want seizures? 'Cause this is how you get seizures. 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | layout (location = 2) in vec2 vt; 9 | out vec3 color; 10 | out vec2 texCoord; 11 | uniform mat4 uViewMatrix, uProjectionMatrix; 12 | uniform float uTime; 13 | void main() { 14 | color = vec3(1.0, 1.0, 1.0); 15 | texCoord = vt; // vec2(vp.x + 0.5, vp.z + 0.5); 16 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 17 | } 18 | ]] 19 | 20 | FRAGMENT_SHADER = [[ 21 | #version 400 22 | in vec3 color; 23 | in vec2 texCoord; 24 | uniform sampler2D uTexture; 25 | layout (location = 0) out vec4 fragColor; 26 | void main() { 27 | float r = texture(uTexture, texCoord).r * 10; 28 | fragColor = vec4(r, r, r, 0.95); 29 | } 30 | ]] 31 | 32 | function setup() 33 | freq = 97.6 34 | freq_offset = 100000 35 | device = nrf_device_new(freq, "../rfdata/rf-200.500-big.raw") 36 | shifter = nrf_freq_shifter_new(freq_offset, device.sample_rate) 37 | filter = nrf_iq_filter_new(device.sample_rate, 10e3, 51) 38 | player = nrf_player_new(device, NRF_DEMODULATE_WBFM, freq_offset) 39 | 40 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 41 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 42 | texture = ngl_texture_new(shader, "uTexture") 43 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 44 | end 45 | 46 | function draw() 47 | samples_buffer = nrf_device_get_samples_buffer(device) 48 | nrf_freq_shifter_process(shifter, samples_buffer) 49 | shifter_buffer = nrf_freq_shifter_get_buffer(shifter) 50 | nrf_iq_filter_process(filter, shifter_buffer) 51 | filter_buffer = nrf_iq_filter_get_buffer(filter) 52 | iq_buffer = nrf_buffer_to_iq_points(filter_buffer) 53 | 54 | 55 | ngl_clear(0.2, 0.2, 0.2, 1.0) 56 | ngl_texture_update(texture, iq_buffer, 256, 256) 57 | ngl_draw_model(camera, model, shader) 58 | end 59 | 60 | function on_key(key, mods) 61 | keys_frequency_handler(key, mods) 62 | keys_frequency_offset_handler(key, mods) 63 | end 64 | -------------------------------------------------------------------------------- /lua/iq-tex-filtered.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as a texture from the HackRF 2 | -- You want seizures? 'Cause this is how you get seizures. 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | layout (location = 2) in vec2 vt; 9 | out vec3 color; 10 | out vec2 texCoord; 11 | uniform mat4 uViewMatrix, uProjectionMatrix; 12 | uniform float uTime; 13 | void main() { 14 | color = vec3(1.0, 1.0, 1.0); 15 | texCoord = vt; 16 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 17 | } 18 | ]] 19 | 20 | FRAGMENT_SHADER = [[ 21 | #version 400 22 | in vec3 color; 23 | in vec2 texCoord; 24 | uniform sampler2D uTexture; 25 | layout (location = 0) out vec4 fragColor; 26 | void main() { 27 | float r = texture(uTexture, texCoord).r * 90; 28 | fragColor = vec4(r, r, r, 1); 29 | } 30 | ]] 31 | 32 | function setup() 33 | freq = 936.2 34 | device = nrf_device_new(freq, "../rfdata/rf-200.500-big.raw") 35 | filter = nrf_iq_filter_new(device.sample_rate, 200e3, 51) 36 | 37 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 38 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 39 | texture = ngl_texture_new(shader, "uTexture") 40 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 41 | end 42 | 43 | function draw() 44 | samples_buffer = nrf_device_get_samples_buffer(device) 45 | nrf_iq_filter_process(filter, samples_buffer) 46 | filter_buffer = nrf_iq_filter_get_buffer(filter) 47 | iq_buffer = nrf_buffer_to_iq_lines(filter_buffer, 4, 0.2) 48 | 49 | ngl_clear(0.2, 0.2, 0.2, 1.0) 50 | ngl_texture_update(texture, iq_buffer, 1024, 1024) 51 | ngl_draw_model(camera, model, shader) 52 | end 53 | 54 | function on_key(key, mods) 55 | keys_frequency_handler(key, mods) 56 | if key == KEY_E then 57 | nut_buffer_save(nut_buffer_convert(buffer, 1), "out.raw") 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /lua/iq-tex-steps.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as a texture from a file. 2 | -- Don't connect a device. 3 | -- Steps are deliberate. 4 | 5 | VERTEX_SHADER = [[ 6 | #version 400 7 | layout (location = 0) in vec3 vp; 8 | layout (location = 1) in vec3 vn; 9 | layout (location = 2) in vec2 vt; 10 | out vec3 color; 11 | out vec2 texCoord; 12 | uniform mat4 uViewMatrix, uProjectionMatrix; 13 | uniform float uTime; 14 | void main() { 15 | color = vec3(1.0, 1.0, 1.0); 16 | texCoord = vt; 17 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 18 | } 19 | ]] 20 | 21 | FRAGMENT_SHADER = [[ 22 | #version 400 23 | in vec3 color; 24 | in vec2 texCoord; 25 | uniform sampler2D uTexture; 26 | layout (location = 0) out vec4 fragColor; 27 | void main() { 28 | float r = texture(uTexture, texCoord).r * 5; 29 | fragColor = vec4(r, r, r, 0.95); 30 | } 31 | ]] 32 | 33 | function setup() 34 | freq = 612.004 35 | device = nrf_device_new(freq, "../rfdata/rf-612.004-big.raw") 36 | nrf_device_set_paused(device, true) 37 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 38 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 39 | texture = ngl_texture_new(shader, "uTexture") 40 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 41 | end 42 | 43 | function draw() 44 | ngl_clear(0.2, 0.2, 0.2, 1.0) 45 | buffer = nrf_device_get_iq_buffer(device); 46 | ngl_texture_update(texture, buffer, 256, 256); 47 | ngl_draw_model(camera, model, shader) 48 | end 49 | 50 | function on_key(key, mods) 51 | keys_frequency_handler(key, mods) 52 | if (key == KEY_SPACE) then 53 | nrf_device_step(device) 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /lua/iq-tex.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as a texture from the HackRF 2 | -- You want seizures? 'Cause this is how you get seizures. 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | layout (location = 2) in vec2 vt; 9 | out vec3 color; 10 | out vec2 texCoord; 11 | uniform mat4 uViewMatrix, uProjectionMatrix; 12 | uniform float uTime; 13 | void main() { 14 | color = vec3(1.0, 1.0, 1.0); 15 | texCoord = vt; 16 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 17 | } 18 | ]] 19 | 20 | FRAGMENT_SHADER = [[ 21 | #version 400 22 | in vec3 color; 23 | in vec2 texCoord; 24 | uniform sampler2D uTexture; 25 | layout (location = 0) out vec4 fragColor; 26 | void main() { 27 | float r = texture(uTexture, texCoord).r * 10; 28 | fragColor = vec4(r, r, r, 1); 29 | } 30 | ]] 31 | 32 | function setup() 33 | freq = 200.5 34 | device = nrf_device_new(freq, "../rfdata/rf-200.500-big.raw") 35 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 36 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 37 | texture = ngl_texture_new(shader, "uTexture") 38 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 39 | end 40 | 41 | function draw() 42 | iq_buffer = nrf_device_get_iq_buffer(device) 43 | 44 | ngl_clear(0.2, 0.2, 0.2, 1.0) 45 | ngl_texture_update(texture, iq_buffer, 256, 256) 46 | ngl_draw_model(camera, model, shader) 47 | end 48 | 49 | function on_key(key, mods) 50 | keys_frequency_handler(key, mods) 51 | end 52 | -------------------------------------------------------------------------------- /lua/keys.lua: -------------------------------------------------------------------------------- 1 | -- Show keys 2 | 3 | function setup() 4 | end 5 | 6 | function draw() 7 | ngl_clear(0.2, 0.2, 0.2, 1) 8 | end 9 | 10 | function on_key(key) 11 | print("Key " .. key) 12 | if key == KEY_SPACE then 13 | print("Space") 14 | elseif key == KEY_DOWN then 15 | print("Down") 16 | end 17 | end 18 | 19 | -------------------------------------------------------------------------------- /lua/model-sea.lua: -------------------------------------------------------------------------------- 1 | -- Display a static scene with a diffuse shader. 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color = vec3(.41,.3,.2); 8 | uniform mat4 uViewMatrix, uProjectionMatrix, NormalMatrix; 9 | uniform float uTime; 10 | 11 | void main() { 12 | float roughness = .0025; 13 | float innertexture = 50; 14 | float yflow = 4.50; 15 | vec3 pt = vec3(vp.x + noise1(uTime/10.0-vp.y),vp.y+noise1(vp.x * (roughness* 30.0) + noise1(vp.z * roughness) + uTime * 0.5) *yflow,vp.z); 16 | 17 | color = vec3(0.8-noise1(vp.z*innertexture), 1.0-noise1(vp.z*innertexture), 1.0-(noise1(vp.x*innertexture))); 18 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 19 | } 20 | ]] 21 | 22 | FRAGMENT_SHADER = [[ 23 | #version 400 24 | in vec3 color; 25 | layout (location = 0) out vec4 fragColor; 26 | void main() { 27 | fragColor = vec4(color, 0.95); 28 | } 29 | ]] 30 | 31 | function setup() 32 | model = ngl_model_load_obj("../obj/c004.obj") 33 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 34 | end 35 | 36 | function draw() 37 | ngl_clear(0.2, 0.2, 0.2, 1) 38 | time = nwm_get_time() 39 | camera_x = math.sin(time * 0.5) * 50.0 40 | camera_z = math.cos(time * 0.5) * 50.0 41 | --camera = ngl_camera_new_look_at(camera_x,10,camera_z) 42 | camera = ngl_camera_new_look_at(camera_x,30,80) 43 | ngl_draw_model(camera, model, shader) 44 | end 45 | -------------------------------------------------------------------------------- /lua/noise-grid-triangles.lua: -------------------------------------------------------------------------------- 1 | -- Use noise on a grid triangles 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | vec3 pt = vec3(vp.x * 10, 0, vp.z * 10); 12 | color = vec3(1.0, 1.0, 1.0); 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 14 | } 15 | ]] 16 | 17 | FRAGMENT_SHADER = [[ 18 | #version 400 19 | in vec3 color; 20 | layout (location = 0) out vec4 fragColor; 21 | void main() { 22 | fragColor = vec4(color, 0.95); 23 | } 24 | ]] 25 | 26 | function setup() 27 | shader = ngl_shader_new(GL_LINES, VERTEX_SHADER, FRAGMENT_SHADER) 28 | model = ngl_model_new_grid_triangles(100, 100, 0.01, 0.01) 29 | end 30 | 31 | function draw() 32 | camera = ngl_camera_new_look_at(0, 5, 10) 33 | ngl_clear(0.2, 0.2, 0.2, 1.0) 34 | ngl_draw_model(camera, model, shader) 35 | end 36 | -------------------------------------------------------------------------------- /lua/noise-grid-wave.lua: -------------------------------------------------------------------------------- 1 | -- Use noise on a grid triangles 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | float roughness = 2.0; 12 | float innertexture = 50; 13 | float yflow = 1.50; 14 | vec3 pt = vec3((vp.x + noise1(uTime/10.0-vp.z))* 40, noise1(noise1(vp.x * (roughness* 3.0)) + noise1(vp.z * roughness) + uTime * 0.5) * yflow, vp.z * 40); 15 | color = vec3(0.8-noise1(vp.x*innertexture), 1.0-noise1(vp.x*innertexture), 1.0-(noise1(vp.x*innertexture))); //vertical 16 | //color = vec3(0.8-noise1(vp.z*innertexture), 1.0-noise1(vp.z*innertexture), 1.0-(noise1(vp.z*innertexture))); // horizontal 17 | //color = vec3(0.8, 1.0-noise1(vp.x*innertexture*3), 1.0-(noise1(vp.z*innertexture)+noise1(vp.x*innertexture))); // mix + color accent 18 | 19 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 20 | } 21 | ]] 22 | 23 | FRAGMENT_SHADER = [[ 24 | #version 400 25 | in vec3 color; 26 | layout (location = 0) out vec4 fragColor; 27 | void main() { 28 | fragColor = vec4(color, 0.95); 29 | } 30 | ]] 31 | 32 | function setup() 33 | shader = ngl_shader_new(GL_LINES, VERTEX_SHADER, FRAGMENT_SHADER) 34 | model = ngl_model_new_grid_triangles(100, 100, 0.01, 0.01) 35 | end 36 | 37 | function draw() 38 | camera = ngl_camera_new_look_at(0, 5, 10) 39 | ngl_clear(0.2, 0.2, 0.2, 1.0) 40 | ngl_draw_model(camera, model, shader) 41 | end 42 | -------------------------------------------------------------------------------- /lua/noise-grid.lua: -------------------------------------------------------------------------------- 1 | -- Use noise on a grid 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | 11 | void main() { 12 | float increase = 6.0; 13 | vec3 pt = vec3(vp.x * 10, noise1(noise1((vp.x) * increase) + noise1(vp.y * increase) + uTime * 0.5), vp.y * 10); 14 | color.r = .25; 15 | color.g = (pt.z * (pt.y/3.0)); 16 | color.b = .5+(pt.y * 2.0); 17 | gl_PointSize = 5; 18 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 19 | } 20 | ]] 21 | 22 | FRAGMENT_SHADER = [[ 23 | #version 400 24 | in vec3 color; 25 | layout (location = 0) out vec4 fragColor; 26 | void main() { 27 | fragColor = vec4(color, 0.95); 28 | } 29 | ]] 30 | 31 | function setup() 32 | shader = ngl_shader_new(GL_POINTS, VERTEX_SHADER, FRAGMENT_SHADER) 33 | model = ngl_model_new_grid_points(500, 500, 0.005, 0.005) 34 | end 35 | 36 | function draw() 37 | camera = ngl_camera_new_look_at(0, -5, -5) 38 | ngl_clear(0.2, 0.2, 0.2, 1.0) 39 | ngl_draw_model(camera, model, shader) 40 | end 41 | -------------------------------------------------------------------------------- /lua/osc-rotate.lua: -------------------------------------------------------------------------------- 1 | -- Rotate the camera based on OSC messages from OSCulator 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 1.0, 1.0) * dot(normalize(vp), normalize(vn)) * 0.3; 12 | color += vec3(0.1, 0.1, 0.5); 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(vp, 1.0); 14 | } 15 | ]] 16 | 17 | FRAGMENT_SHADER = [[ 18 | #version 400 19 | in vec3 color; 20 | layout (location = 0) out vec4 fragColor; 21 | void main() { 22 | fragColor = vec4(color, 0.95); 23 | } 24 | ]] 25 | 26 | function handle_message(path, args) 27 | if path == "/wii/1/accel/pry" then 28 | pitch = args[1] - 0.5 29 | roll = args[2] - 0.5 30 | yaw = args[3] - 0.5 31 | accel = args[4] - 0.5 32 | camera_y = camera_y - yaw * 5 33 | end 34 | end 35 | 36 | 37 | function setup() 38 | camera_x = 0 39 | camera_y = 0 40 | camera_z = 0 41 | 42 | server = nosc_server_new(2222, handle_message) 43 | model = ngl_model_load_obj("../obj/cubes.obj") 44 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 45 | end 46 | 47 | function draw() 48 | nosc_server_update(server) 49 | 50 | camera = ngl_camera_new() 51 | ngl_camera_translate(camera, 10, -2, 10) 52 | ngl_camera_rotate_y(camera, camera_y) 53 | 54 | ngl_clear(0.2, 0.2, 0.2, 1) 55 | ngl_draw_model(camera, model, shader) 56 | end 57 | -------------------------------------------------------------------------------- /lua/osc-server.lua: -------------------------------------------------------------------------------- 1 | -- Receive OSC events 2 | 3 | function handle_message(path, args) 4 | print("OSC path: " .. path .. " len: " .. #args .. " 1: " .. args[1]) 5 | end 6 | 7 | function setup() 8 | server = nosc_server_new(2222, handle_message) 9 | end 10 | 11 | function draw() 12 | nosc_server_update(server) 13 | ngl_clear(0.2, 0.2, 0.2, 1) 14 | end 15 | -------------------------------------------------------------------------------- /lua/psychedelic-noise.lua: -------------------------------------------------------------------------------- 1 | -- Use noise on a grid triangles 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | vec3 pt = vec3(vp.x * 10, noise1(vp.x + 2 * vp.z + 1 * uTime) * 1.0, vp.z * 10); 12 | color = vec3(1.0, 1.0, 1.0); 13 | gl_PointSize = 2; 14 | vec3 ptn = pt; 15 | color = vec3(1.0, 1.0, 1.0) * dot(normalize(pt), normalize(ptn)) * 0.3; 16 | //color += vec3(0.1, 0.1, 0.5); 17 | color = noise3(pt.x * pt.y * pt.z * 0.4) * 2.0; 18 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 19 | } 20 | ]] 21 | 22 | FRAGMENT_SHADER = [[ 23 | #version 400 24 | in vec3 color; 25 | layout (location = 0) out vec4 fragColor; 26 | void main() { 27 | fragColor = vec4(color, 0.95); 28 | } 29 | ]] 30 | 31 | function setup() 32 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 33 | model = ngl_model_new_grid_triangles(100, 100, 0.01, 0.01) 34 | end 35 | 36 | function draw() 37 | camera = ngl_camera_new_look_at(0, -7, 0.1) 38 | ngl_clear(0.2, 0.2, 0.2, 1.0) 39 | ngl_draw_model(camera, model, shader) 40 | end 41 | -------------------------------------------------------------------------------- /lua/samples-tex-3d-filtered.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as a texture from the HackRF 2 | -- You want seizures? 'Cause this is how you get seizures. 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | layout (location = 2) in vec2 vt; 9 | out vec4 color; 10 | out vec2 texCoord; 11 | uniform mat4 uViewMatrix, uProjectionMatrix; 12 | uniform float uTime; 13 | uniform sampler2D uTexture; 14 | void main() { 15 | float l = 1.0 - ((vp.x * vp.x + vp.z * vp.z) * 0.04); 16 | color = vec4(l, l, l, l); 17 | texCoord = vt; 18 | float r = texture(uTexture, vt).r * 1.5; 19 | 20 | vec3 pt = vec3(vp.x, r, vp.z); 21 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 22 | } 23 | ]] 24 | 25 | FRAGMENT_SHADER = [[ 26 | #version 400 27 | in vec4 color; 28 | in vec2 texCoord; 29 | layout (location = 0) out vec4 fragColor; 30 | void main() { 31 | fragColor = color; 32 | } 33 | ]] 34 | 35 | function setup() 36 | freq = 97.5 37 | device = nrf_device_new(freq, "../rfdata/rf-202.500-2.raw") 38 | filter = nrf_iq_filter_new(device.sample_rate, 10e3, 23) 39 | 40 | camera = ngl_camera_new_look_at(0, 2, 4) 41 | shader = ngl_shader_new(GL_LINE_STRIP, VERTEX_SHADER, FRAGMENT_SHADER) 42 | texture = ngl_texture_new(shader, "uTexture") 43 | model = ngl_model_new_grid_triangles(100, 100, 0.1, 0.1) 44 | end 45 | 46 | function draw() 47 | samples_buffer = nrf_device_get_samples_buffer(device) 48 | nrf_iq_filter_process(filter, samples_buffer) 49 | filter_buffer = nrf_iq_filter_get_buffer(filter) 50 | 51 | ngl_clear(0.2, 0.2, 0.2, 1.0) 52 | ngl_texture_update(texture, filter_buffer, 512, 256) 53 | ngl_draw_model(camera, model, shader) 54 | end 55 | 56 | function on_key(key, mods) 57 | keys_frequency_handler(key, mods) 58 | end 59 | 60 | -------------------------------------------------------------------------------- /lua/samples-tex-3d.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as a texture from the HackRF 2 | -- You want seizures? 'Cause this is how you get seizures. 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | layout (location = 2) in vec2 vt; 9 | out vec4 color; 10 | out vec2 texCoord; 11 | uniform mat4 uViewMatrix, uProjectionMatrix; 12 | uniform float uTime; 13 | uniform sampler2D uTexture; 14 | void main() { 15 | float l = 1.0 - ((vp.x * vp.x + vp.z * vp.z) * 0.04); 16 | color = vec4(l, l, l, l); 17 | texCoord = vt; 18 | float r = texture(uTexture, vt).r * 1; 19 | 20 | vec3 pt = vec3(vp.x, r, vp.z); 21 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 22 | } 23 | ]] 24 | 25 | FRAGMENT_SHADER = [[ 26 | #version 400 27 | in vec4 color; 28 | in vec2 texCoord; 29 | layout (location = 0) out vec4 fragColor; 30 | void main() { 31 | fragColor = color; 32 | } 33 | ]] 34 | 35 | function setup() 36 | freq = 199.9 37 | device = nrf_device_new(freq, "../rfdata/rf-202.500-2.raw") 38 | camera = ngl_camera_new_look_at(0, 2, 4) 39 | shader = ngl_shader_new(GL_LINE_STRIP, VERTEX_SHADER, FRAGMENT_SHADER) 40 | texture = ngl_texture_new(shader, "uTexture") 41 | model = ngl_model_new_grid_triangles(100, 100, 0.1, 0.1) 42 | end 43 | 44 | function draw() 45 | ngl_clear(0.2, 0.2, 0.2, 1.0) 46 | buffer = nrf_device_get_samples_buffer(device) 47 | ngl_texture_update(texture, buffer, 512, 256) 48 | ngl_draw_model(camera, model, shader) 49 | end 50 | 51 | function on_key(key, mods) 52 | keys_frequency_handler(key, mods) 53 | end 54 | 55 | -------------------------------------------------------------------------------- /lua/samples-tex-shaded.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as a texture from the HackRF 2 | -- Calculate normals and lighting 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | layout (location = 2) in vec2 vt; 9 | flat out vec4 color; 10 | out vec2 texCoord; 11 | uniform mat4 uViewMatrix, uProjectionMatrix; 12 | uniform float uTime; 13 | uniform sampler2D uTexture; 14 | void main() { 15 | float offset = -0.2; 16 | float power = 0.1; 17 | float t1 = offset + texture(uTexture, vt).r * power; 18 | float t2 = offset + texture(uTexture, vt + vec2(0.01, 0)).r * power; 19 | float t3 = offset + texture(uTexture, vt + vec2(0, 0.01)).r * power; 20 | vec3 v1 = vec3(vp.x, t1, vp.z); 21 | vec3 v2 = vec3(vp.x + 0.01, t2, vp.z); 22 | vec3 v3 = vec3(vp.x, t3, vp.z + 0.01); 23 | 24 | vec3 u = v2 - v1; 25 | vec3 v = v3 - v1; 26 | float x = (u.y * v.z) - (u.z * v.y); 27 | float y = (u.z * v.x) - (u.x * v.z); 28 | float z = (u.x * v.y) - (u.y * v.x); 29 | vec3 n = vec3(x, y, z); 30 | 31 | color = vec4(1.0, 1.0, 1.0, 1.0) * dot(normalize(v1), normalize(n)) * 0.5; 32 | color += vec4(0.2, 0.2, 0.4, 0.5); 33 | color *= 2; 34 | 35 | float l = 1.0 - ((vp.x * vp.x + vp.z * vp.z) * 2.0); 36 | color *= vec4(l, l, l, l); 37 | texCoord = vt; 38 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(v1, 1.0); 39 | } 40 | ]] 41 | 42 | FRAGMENT_SHADER = [[ 43 | #version 400 44 | flat in vec4 color; 45 | in vec2 texCoord; 46 | layout (location = 0) out vec4 fragColor; 47 | void main() { 48 | fragColor = color; 49 | } 50 | ]] 51 | 52 | function setup() 53 | freq = 201.2 54 | device = nrf_device_new(freq, "../rfdata/rf-202.500-2.raw") 55 | camera = ngl_camera_new_look_at(0, 0.3, 0.5) 56 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 57 | texture = ngl_texture_new(shader, "uTexture") 58 | model = ngl_model_new_grid_triangles(100, 100, 0.01, 0.01) 59 | end 60 | 61 | function draw() 62 | ngl_clear(0.2, 0.2, 0.2, 1.0) 63 | buffer = nrf_device_get_samples_buffer(device) 64 | ngl_texture_update(texture, buffer, 512, 256) 65 | ngl_draw_model(camera, model, shader) 66 | end 67 | 68 | function on_key(key, mods) 69 | keys_frequency_handler(key, mods) 70 | end 71 | -------------------------------------------------------------------------------- /lua/samples-tex-slow.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as a texture from the HackRF 2 | -- You want seizures? 'Cause this is how you get seizures. 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | layout (location = 2) in vec2 vt; 9 | out vec3 color; 10 | out vec2 texCoord; 11 | uniform mat4 uViewMatrix, uProjectionMatrix; 12 | uniform float uTime; 13 | void main() { 14 | color = vec3(1.0, 1.0, 1.0); 15 | texCoord = vt; // vec2(vp.x + 0.5, vp.z + 0.5); 16 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 17 | } 18 | ]] 19 | 20 | FRAGMENT_SHADER = [[ 21 | #version 400 22 | in vec3 color; 23 | in vec2 texCoord; 24 | uniform sampler2D uTexture; 25 | layout (location = 0) out vec4 fragColor; 26 | void main() { 27 | float r = texture(uTexture, texCoord).r * 1; 28 | fragColor = vec4(r, r, r, 0.95); 29 | } 30 | ]] 31 | 32 | time_to_switch = 400 33 | 34 | function setup() 35 | freq = 1.0 36 | freq_time = 0 37 | device = nrf_device_new(freq, "../rfdata/rf-200.500-big.raw") 38 | interpolator = nrf_interpolator_new(0.01) 39 | 40 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 41 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 42 | texture = ngl_texture_new(shader, "uTexture") 43 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 44 | end 45 | 46 | function draw() 47 | samples_buffer = nrf_device_get_samples_buffer(device) 48 | nrf_interpolator_process(interpolator, samples_buffer) 49 | interpolator_buffer = nrf_interpolator_get_buffer(interpolator) 50 | 51 | ngl_clear(0.2, 0.2, 0.2, 1.0) 52 | ngl_texture_update(texture, interpolator_buffer, 512, 256) 53 | ngl_draw_model(camera, model, shader) 54 | freq_time = freq_time + 1 55 | if freq_time >= time_to_switch then 56 | freq = freq + 0.1 57 | nrf_device_set_frequency(device, freq) 58 | print("Frequency: " .. freq) 59 | freq_time = 0 60 | end 61 | end 62 | 63 | function on_key(key, mods) 64 | keys_frequency_handler(key, mods) 65 | end 66 | -------------------------------------------------------------------------------- /lua/samples-tex.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data as a texture from the HackRF 2 | -- You want seizures? 'Cause this is how you get seizures. 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | layout (location = 2) in vec2 vt; 9 | out vec3 color; 10 | out vec2 texCoord; 11 | uniform mat4 uViewMatrix, uProjectionMatrix; 12 | uniform float uTime; 13 | void main() { 14 | color = vec3(1.0, 1.0, 1.0); 15 | texCoord = vt; // vec2(vp.x + 0.5, vp.z + 0.5); 16 | gl_Position = vec4(vp.x*2, vp.z*2, 0, 1.0); 17 | } 18 | ]] 19 | 20 | FRAGMENT_SHADER = [[ 21 | #version 400 22 | in vec3 color; 23 | in vec2 texCoord; 24 | uniform sampler2D uTexture; 25 | layout (location = 0) out vec4 fragColor; 26 | void main() { 27 | float r = texture(uTexture, texCoord).r * 1; 28 | fragColor = vec4(r, r, r, 0.95); 29 | } 30 | ]] 31 | 32 | 33 | function setup() 34 | freq = 200.5 35 | device = nrf_device_new(freq, "../rfdata/rf-200.500-big.raw") 36 | camera = ngl_camera_new_look_at(0, 0, 0) -- Camera is unnecessary but ngl_draw_model requires it 37 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 38 | texture = ngl_texture_new(shader, "uTexture") 39 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 40 | end 41 | 42 | function draw() 43 | ngl_clear(0.2, 0.2, 0.2, 1.0) 44 | buffer = nrf_device_get_samples_buffer(device) 45 | ngl_texture_update(texture, buffer, 512, 256) 46 | ngl_draw_model(camera, model, shader) 47 | end 48 | 49 | function on_key(key, mods) 50 | keys_frequency_handler(key, mods) 51 | end 52 | -------------------------------------------------------------------------------- /lua/sea-grid.lua: -------------------------------------------------------------------------------- 1 | -- Use noise on a grid 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 1.0, 1.0); 12 | float force = 0.1; 13 | float waves = 3.0; 14 | float speed = 1.5; 15 | vec2 p = -1.0 + 2.0 * vp.xy / vec2(1,1); 16 | float len = length(p); 17 | vec2 uv = vp.xy + (p/len) * cos(len * 2.0 - uTime * 2.0) * force; 18 | //vec3 pt = vec3(vp.x * 20, noise1(noise1(vp.x * 8.287) + noise1(vp.y * 7.393) + uTime * 0.5) + force * cos(vp.x * waves - uTime * speed), vp.y * 20); 19 | vec3 pt = vec3(uv.x, 0, uv.y); 20 | 21 | gl_PointSize = 2; 22 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 23 | } 24 | ]] 25 | 26 | FRAGMENT_SHADER = [[ 27 | #version 400 28 | in vec3 color; 29 | layout (location = 0) out vec4 fragColor; 30 | void main() { 31 | fragColor = vec4(color, 0.95); 32 | } 33 | ]] 34 | 35 | function setup() 36 | shader = ngl_shader_new(GL_POINTS, VERTEX_SHADER, FRAGMENT_SHADER) 37 | model = ngl_model_new_grid_points(500, 500, 0.05, 0.05) 38 | end 39 | 40 | function draw() 41 | camera = ngl_camera_new_look_at(0, -5, -5) 42 | ngl_clear(0.2, 0.2, 0.2, 1.0) 43 | ngl_draw_model(camera, model, shader) 44 | end 45 | -------------------------------------------------------------------------------- /lua/skybox.lua: -------------------------------------------------------------------------------- 1 | -- Load a static scene 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 1.0, 1.0) * dot(normalize(vp), normalize(vn)) * 0.5; 12 | color += vec3(0.2, 0.5, 0.8); 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(vp, 1.0); 14 | } 15 | ]] 16 | 17 | FRAGMENT_SHADER = [[ 18 | #version 400 19 | in vec3 color; 20 | layout (location = 0) out vec4 fragColor; 21 | void main() { 22 | fragColor = vec4(color, 0.95); 23 | } 24 | ]] 25 | 26 | camera_x = -20 27 | camera_y = 18 28 | camera_z = 50 29 | 30 | function setup() 31 | model = ngl_model_load_obj("../obj/c004.obj") 32 | skybox = ngl_skybox_new("../img/negz.jpg", "../img/posz.jpg", "../img/posy.jpg", "../img/negy.jpg", "../img/negx.jpg", "../img/posx.jpg") 33 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 34 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 35 | end 36 | 37 | function draw() 38 | ngl_clear(0.2, 0.2, 0.2, 1) 39 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 40 | ngl_skybox_draw(skybox, camera) 41 | ngl_draw_model(camera, model, shader) 42 | end 43 | 44 | function on_key(key, mods) 45 | keys_camera_handler(key, mods) 46 | end 47 | -------------------------------------------------------------------------------- /lua/slinky-points.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data from the HackRF as a spiral (like a slinky toy) 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 1.0, 1.0); 12 | vec3 pt = vec3((vp.x - 0.5) * 10, (vp.y - 0.5) * 10, (vp.z - 0.5) * 50.0); 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 14 | gl_PointSize = 2; 15 | } 16 | ]] 17 | 18 | FRAGMENT_SHADER = [[ 19 | #version 400 20 | in vec3 color; 21 | layout (location = 0) out vec4 fragColor; 22 | void main() { 23 | fragColor = vec4(color, 1.0); 24 | } 25 | ]] 26 | 27 | 28 | function setup() 29 | camera_x = 0.1 30 | camera_y = 0.1 31 | camera_z = 0.5 32 | freq = 2.6 33 | device = nrf_device_new(freq, "../rfdata/rf-100.900-2.raw") 34 | shader = ngl_shader_new(GL_POINTS, VERTEX_SHADER, FRAGMENT_SHADER) 35 | end 36 | 37 | function draw() 38 | samples_buffer = nrf_device_get_samples_buffer(device) 39 | position_buffer = nrf_buffer_add_position_channel(samples_buffer) 40 | 41 | time = nwm_get_time() 42 | ngl_clear(0.2, 0.2, 0.2, 1.0) 43 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 44 | model = ngl_model_new_with_buffer(position_buffer) 45 | ngl_draw_model(camera, model, shader) 46 | end 47 | 48 | function on_key(key, mods) 49 | keys_camera_handler(key, mods) 50 | keys_frequency_handler(key, mods) 51 | end 52 | 53 | -------------------------------------------------------------------------------- /lua/slinky-slow.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data from the HackRF as a spiral (like a slinky toy) 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 1.0, 1.0); 12 | vec3 pt = vec3((vp.x - 0.5) * 5, (vp.y - 0.5) * 5, (vp.z - 0.5) * 100); 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 14 | } 15 | ]] 16 | 17 | FRAGMENT_SHADER = [[ 18 | #version 400 19 | in vec3 color; 20 | layout (location = 0) out vec4 fragColor; 21 | void main() { 22 | fragColor = vec4(color, 0.1); 23 | } 24 | ]] 25 | 26 | camera_x = 0 27 | camera_y = 0 28 | camera_z = 10 29 | function setup() 30 | freq = 200 31 | device = nrf_device_new(freq, "../rfdata/rf-100.900-2.raw", 0.01) 32 | shader = ngl_shader_new(GL_LINE_STRIP, VERTEX_SHADER, FRAGMENT_SHADER) 33 | end 34 | 35 | function draw() 36 | samples_buffer = nrf_device_get_samples_buffer(device) 37 | position_buffer = nrf_buffer_add_position_channel(samples_buffer) 38 | 39 | ngl_clear(0.2, 0.2, 0.2, 1.0) 40 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 41 | model = ngl_model_new_with_buffer(position_buffer) 42 | ngl_draw_model(camera, model, shader) 43 | end 44 | 45 | function on_key(key, mods) 46 | keys_camera_handler(key, mods) 47 | keys_frequency_handler(key, mods) 48 | end 49 | -------------------------------------------------------------------------------- /lua/slinky-two-point-five.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data from the HackRF as a spiral (like a slinky toy) 2 | -- This visualisation looks at the 2.5 (test?) tone 3 | 4 | VERTEX_SHADER = [[ 5 | #version 400 6 | layout (location = 0) in vec3 vp; 7 | layout (location = 1) in vec3 vn; 8 | out vec3 color; 9 | uniform mat4 uViewMatrix, uProjectionMatrix; 10 | uniform float uTime; 11 | void main() { 12 | color = vec3(1.0, 1.0, 1.0); 13 | vec3 pt = vec3(vp.x, vp.y, (vp.z - 0.5) * 1000.0); 14 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 15 | } 16 | 17 | ]] 18 | 19 | FRAGMENT_SHADER = [[ 20 | #version 400 21 | in vec3 color; 22 | layout (location = 0) out vec4 fragColor; 23 | void main() { 24 | fragColor = vec4(color, 0.95); 25 | } 26 | ]] 27 | 28 | function setup() 29 | device = nrf_device_new(2.5, "../rfdata/rf-2.500-1.raw") 30 | shader = ngl_shader_new(GL_LINE_STRIP, VERTEX_SHADER, FRAGMENT_SHADER) 31 | end 32 | 33 | function draw() 34 | samples_buffer = nrf_device_get_samples_buffer(device) 35 | position_buffer = nrf_buffer_add_position_channel(samples_buffer) 36 | 37 | time = nwm_get_time() 38 | camera_x = 0.5 39 | camera_y = 0.0 40 | camera_z = -1 41 | ngl_clear(0.2, 0.2, 0.2, 1.0) 42 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 43 | buffer = nrf_device_get_samples_buffer(device) 44 | model = ngl_model_new_with_buffer(position_buffer) 45 | ngl_draw_model(camera, model, shader) 46 | end 47 | -------------------------------------------------------------------------------- /lua/slinky-vr.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data from the HackRF as a spiral (like a slinky toy) 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 1.0, 1.0); 12 | vec3 pt = vec3((vp.x - 0.5) * 10, (vp.y - 0.5) * 10, (vp.z - 0.5) * 20); 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 14 | } 15 | ]] 16 | 17 | FRAGMENT_SHADER = [[ 18 | #version 400 19 | in vec3 color; 20 | layout (location = 0) out vec4 fragColor; 21 | void main() { 22 | fragColor = vec4(color, 0.95); 23 | } 24 | ]] 25 | 26 | function setup() 27 | freq = 0.8 28 | device = nrf_device_new(freq, "../rfdata/rf-100.900-2.raw") 29 | shader = ngl_shader_new(GL_POINTS, VERTEX_SHADER, FRAGMENT_SHADER) 30 | camera = ngl_camera_new_look_at(4, 0.5, 10) 31 | end 32 | 33 | function draw() 34 | samples_buffer = nrf_device_get_samples_buffer(device) 35 | position_buffer = nrf_buffer_add_position_channel(samples_buffer) 36 | 37 | time = nwm_get_time() 38 | ngl_clear(0.2, 0.2, 0.2, 1.0) 39 | model = ngl_model_new_with_buffer(position_buffer) 40 | ngl_draw_model(camera, model, shader) 41 | end 42 | 43 | function on_key(key, mods) 44 | keys_frequency_handler(key, mods) 45 | end 46 | -------------------------------------------------------------------------------- /lua/slinky.lua: -------------------------------------------------------------------------------- 1 | -- Visualize IQ data from the HackRF as a spiral (like a slinky toy) 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(0.95, 0.95, 0.95); 12 | vec3 pt = vec3((vp.x - 0.5) * 5, (vp.y - 0.5) * 5, (vp.z - 0.5) * 50); 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(pt, 1.0); 14 | gl_PointSize = 3; 15 | } 16 | ]] 17 | 18 | FRAGMENT_SHADER = [[ 19 | #version 400 20 | in vec3 color; 21 | layout (location = 0) out vec4 fragColor; 22 | void main() { 23 | fragColor = vec4(color, 0.1); 24 | } 25 | ]] 26 | 27 | camera_x = 0 28 | camera_y = 0 29 | camera_z = 5 30 | function setup() 31 | freq = 203.5 32 | device = nrf_device_new(freq, "../rfdata/rf-100.900-2.raw") 33 | shader = ngl_shader_new(GL_LINE_STRIP, VERTEX_SHADER, FRAGMENT_SHADER) 34 | end 35 | 36 | function draw() 37 | samples_buffer = nrf_device_get_samples_buffer(device) 38 | position_buffer = nrf_buffer_add_position_channel(samples_buffer) 39 | 40 | ngl_clear(0.05, 0.05, 0.05, 1.0) 41 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 42 | model = ngl_model_new_with_buffer(position_buffer) 43 | ngl_draw_model(camera, model, shader) 44 | end 45 | 46 | function on_key(key, mods) 47 | keys_camera_handler(key, mods) 48 | keys_frequency_handler(key, mods) 49 | end 50 | -------------------------------------------------------------------------------- /lua/static-gradient.lua: -------------------------------------------------------------------------------- 1 | -- Load a static scene 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 1.0, 1.0) * dot(normalize(vp), normalize(vn)) * 3; 12 | //color += vec3(0.2, 0.5, 0.8); 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(vp, 1.0); 14 | } 15 | ]] 16 | 17 | FRAGMENT_SHADER = [[ 18 | #version 400 19 | in vec3 color; 20 | layout (location = 0) out vec4 fragColor; 21 | uniform sampler2D uRamp; 22 | void main() { 23 | float r = texture(uRamp, vec2(color.r, 0)).r; 24 | float g = texture(uRamp, vec2(color.g, 0)).g; 25 | float b = texture(uRamp, vec2(color.b, 0)).b; 26 | fragColor = vec4(r, g, b, 1); 27 | } 28 | ]] 29 | 30 | camera_x = -20 31 | camera_y = 18 32 | camera_z = 50 33 | 34 | function setup() 35 | model = ngl_model_load_obj("../obj/c004.obj") 36 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 37 | texture = ngl_texture_new_from_file("../img/grad-bry.jpg", shader, "uRamp") 38 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 39 | end 40 | 41 | function draw() 42 | ngl_clear(0.2, 0.2, 0.2, 1) 43 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 44 | ngl_draw_model(camera, model, shader) 45 | end 46 | 47 | function on_key(key, mods) 48 | keys_camera_handler(key, mods) 49 | end 50 | -------------------------------------------------------------------------------- /lua/static.lua: -------------------------------------------------------------------------------- 1 | -- Load a static scene 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | out vec3 color; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | void main() { 11 | color = vec3(1.0, 1.0, 1.0) * dot(normalize(vp), normalize(vn)) * 0.5; 12 | color += vec3(0.2, 0.5, 0.8); 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(vp, 1.0); 14 | } 15 | ]] 16 | 17 | FRAGMENT_SHADER = [[ 18 | #version 400 19 | in vec3 color; 20 | layout (location = 0) out vec4 fragColor; 21 | void main() { 22 | fragColor = vec4(color, 0.95); 23 | } 24 | ]] 25 | 26 | camera_x = -20 27 | camera_y = 18 28 | camera_z = 50 29 | 30 | function setup() 31 | model = ngl_model_load_obj("../obj/c004.obj") 32 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 33 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 34 | end 35 | 36 | function draw() 37 | ngl_clear(0.2, 0.2, 0.2, 1) 38 | ngl_draw_model(camera, model, shader) 39 | end 40 | 41 | function on_key(key, mods) 42 | if (mods == 1) then -- Shift key 43 | d = 1 44 | else 45 | d = 0.1 46 | end 47 | 48 | if key == KEY_A or key == KEY_LEFT then 49 | ngl_model_translate(model, d, 0.0, 0.0) 50 | elseif key == KEY_D or key == KEY_RIGHT then 51 | ngl_model_translate(model, -d, 0.0, 0.0) 52 | elseif key == KEY_Q then 53 | ngl_model_translate(model, 0.0, d, 0.0) 54 | elseif key == KEY_E then 55 | ngl_model_translate(model, 0.0, -d, 0.0) 56 | elseif key == KEY_W or key == KEY_DOWN then 57 | ngl_model_translate(model, 0.0, 0.0, d) 58 | elseif key == KEY_S or key == KEY_DOWN then 59 | ngl_model_translate(model, 0.0, 0.0, -d) 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /lua/texture-image.lua: -------------------------------------------------------------------------------- 1 | -- Load a static scene 2 | 3 | VERTEX_SHADER = [[ 4 | #version 400 5 | layout (location = 0) in vec3 vp; 6 | layout (location = 1) in vec3 vn; 7 | layout (location = 2) in vec2 vt; 8 | uniform mat4 uViewMatrix, uProjectionMatrix; 9 | uniform float uTime; 10 | out vec2 texCoord; 11 | void main() { 12 | texCoord = vt; 13 | gl_Position = uProjectionMatrix * uViewMatrix * vec4(vp, 1.0); 14 | } 15 | ]] 16 | 17 | FRAGMENT_SHADER = [[ 18 | #version 400 19 | in vec3 color; 20 | in vec2 texCoord; 21 | layout (location = 0) out vec4 fragColor; 22 | uniform sampler2D uTexture; 23 | void main() { 24 | fragColor = texture(uTexture, texCoord); 25 | } 26 | ]] 27 | 28 | camera_x = 0 29 | camera_y = 1 30 | camera_z = 0.3 31 | 32 | function setup() 33 | model = ngl_model_new_grid_triangles(2, 2, 1, 1) 34 | shader = ngl_shader_new(GL_TRIANGLES, VERTEX_SHADER, FRAGMENT_SHADER) 35 | texture = ngl_texture_new_from_file("../img/negx.jpg", shader, "uTexture") 36 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 37 | end 38 | 39 | function draw() 40 | ngl_clear(0.2, 0.2, 0.2, 1) 41 | camera = ngl_camera_new_look_at(camera_x, camera_y, camera_z) 42 | ngl_draw_model(camera, model, shader) 43 | end 44 | 45 | function on_key(key, mods) 46 | keys_camera_handler(key, mods) 47 | end 48 | -------------------------------------------------------------------------------- /rfdata/rf-100.900-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-100.900-1.raw -------------------------------------------------------------------------------- /rfdata/rf-100.900-2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-100.900-2.raw -------------------------------------------------------------------------------- /rfdata/rf-100.900-3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-100.900-3.raw -------------------------------------------------------------------------------- /rfdata/rf-1278.000-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-1278.000-1.raw -------------------------------------------------------------------------------- /rfdata/rf-1574.182-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-1574.182-1.raw -------------------------------------------------------------------------------- /rfdata/rf-1574.182-2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-1574.182-2.raw -------------------------------------------------------------------------------- /rfdata/rf-1574.182-3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-1574.182-3.raw -------------------------------------------------------------------------------- /rfdata/rf-2.500-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2.500-1.raw -------------------------------------------------------------------------------- /rfdata/rf-2.500-2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2.500-2.raw -------------------------------------------------------------------------------- /rfdata/rf-2.500-3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2.500-3.raw -------------------------------------------------------------------------------- /rfdata/rf-200.500-big.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-200.500-big.raw -------------------------------------------------------------------------------- /rfdata/rf-2003.800-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2003.800-1.raw -------------------------------------------------------------------------------- /rfdata/rf-2003.800-2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2003.800-2.raw -------------------------------------------------------------------------------- /rfdata/rf-2003.800-3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2003.800-3.raw -------------------------------------------------------------------------------- /rfdata/rf-202.500-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-202.500-1.raw -------------------------------------------------------------------------------- /rfdata/rf-202.500-2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-202.500-2.raw -------------------------------------------------------------------------------- /rfdata/rf-202.500-3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-202.500-3.raw -------------------------------------------------------------------------------- /rfdata/rf-2040.200-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2040.200-1.raw -------------------------------------------------------------------------------- /rfdata/rf-2040.200-2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2040.200-2.raw -------------------------------------------------------------------------------- /rfdata/rf-2040.200-3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2040.200-3.raw -------------------------------------------------------------------------------- /rfdata/rf-2072.300-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2072.300-1.raw -------------------------------------------------------------------------------- /rfdata/rf-2072.300-2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2072.300-2.raw -------------------------------------------------------------------------------- /rfdata/rf-2072.300-3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2072.300-3.raw -------------------------------------------------------------------------------- /rfdata/rf-2104.800-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2104.800-1.raw -------------------------------------------------------------------------------- /rfdata/rf-2104.800-2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2104.800-2.raw -------------------------------------------------------------------------------- /rfdata/rf-2104.800-3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-2104.800-3.raw -------------------------------------------------------------------------------- /rfdata/rf-394.855-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-394.855-1.raw -------------------------------------------------------------------------------- /rfdata/rf-4.000-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-4.000-1.raw -------------------------------------------------------------------------------- /rfdata/rf-4.000-2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-4.000-2.raw -------------------------------------------------------------------------------- /rfdata/rf-4.000-3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-4.000-3.raw -------------------------------------------------------------------------------- /rfdata/rf-433.000-short.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-433.000-short.raw -------------------------------------------------------------------------------- /rfdata/rf-433.000.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-433.000.raw -------------------------------------------------------------------------------- /rfdata/rf-612.004-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-612.004-1.raw -------------------------------------------------------------------------------- /rfdata/rf-612.004-2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-612.004-2.raw -------------------------------------------------------------------------------- /rfdata/rf-612.004-3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-612.004-3.raw -------------------------------------------------------------------------------- /rfdata/rf-862.000-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-862.000-1.raw -------------------------------------------------------------------------------- /rfdata/rf-887.000-1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/rfdata/rf-887.000-1.raw -------------------------------------------------------------------------------- /rpi-fdb/Makefile: -------------------------------------------------------------------------------- 1 | #CFLAGS+=-std=c99 2 | CFLAGS+=-Wall 3 | #CFLAGS+=-Werror 4 | CFLAGS+=-g 5 | CFLAGS+=-O3 6 | 7 | INCLUDES+=-I/opt/vc/include 8 | INCLUDES+=-I/opt/vc/include/interface/vcos/pthreads 9 | INCLUDES+=-I/opt/vc/include/interface/vmcs_host/linux 10 | 11 | LIBS+=-L/opt/vc/lib 12 | LIBS+=-lGLESv2 13 | LIBS+=-lEGL 14 | LIBS+=-lm 15 | LIBS+=-lrt 16 | LIBS+=-lbcm_host 17 | LIBS+=-lvcos 18 | LIBS+=-lvchiq_arm 19 | LIBS+=-lpthread 20 | LIBS+=-lrtlsdr 21 | 22 | 23 | iqvis: iqvis.c 24 | gcc $(CFLAGS) $(INCLUDES) $(LIBS) -o iqvis iqvis.c 25 | iqvis_lines: iqvis_lines.c 26 | gcc $(CFLAGS) $(INCLUDES) $(LIBS) -o iqvis_lines iqvis_lines.c 27 | 28 | -------------------------------------------------------------------------------- /rpi-fdb/README: -------------------------------------------------------------------------------- 1 | 2 | IQ visualisation on RPi 3 | ======================= 4 | 5 | 6 | == Installation: 7 | (Debian/Raspbian) 8 | 9 | # rtl-sdr dependencies 10 | sudo apt-get install cmake 11 | sudo apt-get install libusb-1.0-0-dev 12 | 13 | # rtl-sdr library from source 14 | git clone git://git.osmocom.org/rtl-sdr.git 15 | cd rtl-sdr/ 16 | 17 | # set udev and modprobe rules 18 | sudo cp rtl-sdr.rules /etc/udev/rules.d/ 19 | sudo cat < /etc/modprobe.d/rtlsdr-blacklist.conf 20 | blacklist dvb_usb_rtl28xxu 21 | EOF 22 | # compile rtl-sdr 23 | mkdir build 24 | cd build/ 25 | cmake .. 26 | make 27 | sudo make install 28 | 29 | # make sure we got rid of default dvb kernel driver 30 | rmmod -f dvb_usb_rtl28xxu 31 | 32 | # frequensea 33 | 34 | git clone https://github.com/fdb/frequensea.git 35 | cd frequensea/rpi-fdb/ 36 | make 37 | 38 | ls -al ./iqvis 39 | 40 | 41 | == Usage 42 | 43 | startup without parameters, usefull keys : '<' and '>' to scroll through spectrum 44 | 45 | ./iqvis 46 | 47 | 48 | -------------------------------------------------------------------------------- /rust/Cargo.lock: -------------------------------------------------------------------------------- 1 | [root] 2 | name = "frequensea" 3 | version = "0.0.1" 4 | dependencies = [ 5 | "gl 0.0.1 (git+https://github.com/bjz/gl-rs#feed7be39546edb7e8781e3fbe5892caa41a5383)", 6 | "sdl2 0.0.1-alpha.1 (git+https://github.com/cristicbz/rust-sdl2?ref=static_to_const#c8c36cb64fe5d4f64bfa96a4ce0d49665753a291)", 7 | "toml 0.1.0 (git+https://github.com/alexcrichton/toml-rs#8a3ba4c65cfa22a3d924293a1fb3a70bfac5e66c)", 8 | ] 9 | 10 | [[package]] 11 | name = "gl" 12 | version = "0.0.1" 13 | source = "git+https://github.com/bjz/gl-rs#feed7be39546edb7e8781e3fbe5892caa41a5383" 14 | dependencies = [ 15 | "gl_generator 0.0.1 (git+https://github.com/bjz/gl-rs#feed7be39546edb7e8781e3fbe5892caa41a5383)", 16 | ] 17 | 18 | [[package]] 19 | name = "gl_generator" 20 | version = "0.0.1" 21 | source = "git+https://github.com/bjz/gl-rs#feed7be39546edb7e8781e3fbe5892caa41a5383" 22 | dependencies = [ 23 | "khronos_api 0.0.1 (git+https://github.com/bjz/gl-rs#feed7be39546edb7e8781e3fbe5892caa41a5383)", 24 | "rust-xml 0.1.0 (git+https://github.com/netvl/rust-xml#f86f02b3b1c355080136b0acc322b3318c195cda)", 25 | ] 26 | 27 | [[package]] 28 | name = "khronos_api" 29 | version = "0.0.1" 30 | source = "git+https://github.com/bjz/gl-rs#feed7be39546edb7e8781e3fbe5892caa41a5383" 31 | 32 | [[package]] 33 | name = "rust-xml" 34 | version = "0.1.0" 35 | source = "git+https://github.com/netvl/rust-xml#f86f02b3b1c355080136b0acc322b3318c195cda" 36 | 37 | [[package]] 38 | name = "sdl2" 39 | version = "0.0.1-alpha.1" 40 | source = "git+https://github.com/cristicbz/rust-sdl2?ref=static_to_const#c8c36cb64fe5d4f64bfa96a4ce0d49665753a291" 41 | 42 | [[package]] 43 | name = "toml" 44 | version = "0.1.0" 45 | source = "git+https://github.com/alexcrichton/toml-rs#8a3ba4c65cfa22a3d924293a1fb3a70bfac5e66c" 46 | 47 | -------------------------------------------------------------------------------- /rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "frequensea" 3 | version = "0.0.1" 4 | authors = ["Frederik De Bleser "] 5 | 6 | [dependencies.sdl2] 7 | git = "https://github.com/cristicbz/rust-sdl2" 8 | branch = "static_to_const" 9 | 10 | [dependencies.gl] 11 | git = "https://github.com/bjz/gl-rs" 12 | 13 | [dependencies.toml] 14 | git = "https://github.com/alexcrichton/toml-rs" 15 | -------------------------------------------------------------------------------- /rust/src/main.rs: -------------------------------------------------------------------------------- 1 | 2 | 3 | //use ovr::{SensorCapabilities, Ovr}; 4 | 5 | extern crate debug; 6 | extern crate libc; 7 | 8 | use libc::{c_uint, c_int, c_float, c_char, c_void, c_double, c_short}; 9 | 10 | #[cfg(target_os = "macos")] 11 | #[link(name="ovr")] 12 | #[link(name="stdc++")] 13 | #[link(name = "Cocoa", kind = "framework")] 14 | #[link(name = "IOKit", kind = "framework")] 15 | #[link(name = "CoreFoundation", kind = "framework")] 16 | #[link(name = "OpenGL", kind = "framework")] 17 | extern {} 18 | 19 | #[deriving(Clone, Default)] 20 | #[repr(C)] 21 | pub struct Sizei { 22 | pub x: c_int, 23 | pub y: c_int 24 | } 25 | 26 | #[deriving(Clone, Default)] 27 | #[repr(C)] 28 | pub struct Vector2i { 29 | pub x: c_int, 30 | pub y: c_int 31 | } 32 | 33 | 34 | #[deriving(Clone, Default)] 35 | #[repr(C)] 36 | pub struct FovPort { 37 | pub up_tan: c_float, 38 | pub down_tan: c_float, 39 | pub left_tan: c_float, 40 | pub right_tan: c_float 41 | } 42 | 43 | #[deriving(Clone, Default)] 44 | #[repr(C)] 45 | pub struct Vector3f { 46 | pub x: c_float, 47 | pub y: c_float, 48 | pub z: c_float 49 | } 50 | 51 | pub enum HmdStruct { } 52 | 53 | #[repr(C)] 54 | pub struct Hmd { 55 | pub handle: *const HmdStruct, 56 | pub hmd_type: c_int, 57 | pub product_name: *const c_char, 58 | pub manufacturer: *const c_char, 59 | pub hmd_capabilities: c_uint, 60 | pub sensor_capabilities: c_uint, 61 | pub distortion_capabilities: c_uint, 62 | pub resolution: Sizei, 63 | pub window_position: Vector2i, 64 | pub default_eye_fov: [FovPort, ..2], 65 | pub max_eye_fov: [FovPort, ..2], 66 | pub eye_render_order: [c_uint, ..2], 67 | pub display_device_name: *const c_char, 68 | pub display_id: c_int 69 | } 70 | 71 | 72 | extern "C" { 73 | pub fn ovr_Initialize() -> bool; 74 | pub fn ovrHmd_Create(index: c_int) -> *const Hmd; 75 | } 76 | 77 | 78 | 79 | fn main() { 80 | unsafe { 81 | if ovr_Initialize() { 82 | println!("Initialized."); 83 | } else { 84 | println!("Initialization failed."); 85 | } 86 | let hmd_ptr = ovrHmd_Create(0); 87 | let hmd = match hmd_ptr.as_ref() { 88 | Some(hmd) => hmd, 89 | None => { 90 | println!("Could not create HMD."); 91 | return; 92 | } 93 | }; 94 | println!("Resolution: {:?}", hmd.resolution); 95 | println!("Display Device Name: {:?}", hmd.display_device_name); 96 | 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /screenshots/fft-sea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fdb/frequensea/403e92a181a98f28ec57ffc39682b5d34c0cffb9/screenshots/fft-sea.png -------------------------------------------------------------------------------- /shaders/skybox.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | in vec3 texcoords; 4 | uniform samplerCube cube_texture; 5 | out vec4 frag_colour; 6 | 7 | void main () { 8 | frag_colour = texture (cube_texture, texcoords); 9 | } -------------------------------------------------------------------------------- /shaders/skybox.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | in vec3 vp; 4 | uniform mat4 uProjectionMatrix, uViewMatrix; 5 | out vec3 texcoords; 6 | 7 | void main () { 8 | texcoords = vp * 10; 9 | gl_Position = uProjectionMatrix * uViewMatrix * vec4 (vp * 10, 1.0); 10 | } -------------------------------------------------------------------------------- /src/nfile.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "nfile.h" 7 | 8 | char *nfile_read(const char* fname) { 9 | FILE *fp = fopen(fname, "rb"); 10 | if (!fp) { 11 | perror(fname); 12 | exit(EXIT_FAILURE); 13 | } 14 | 15 | fseek(fp, 0L, SEEK_END); 16 | long size = ftell(fp); 17 | rewind(fp); 18 | 19 | // Allocate memory for entire content 20 | char *buffer = calloc(1, size + 1); 21 | if (!buffer) { 22 | fclose(fp); 23 | fputs("ERR: nfile_read: failed to allocate memory.", stderr); 24 | exit(EXIT_FAILURE); 25 | } 26 | 27 | // Copy the file into the buffer 28 | if (fread(buffer, size, 1, fp) != 1) { 29 | fclose(fp); 30 | free(buffer); 31 | fputs("ERR: nfile_read: failed to read file.", stderr); 32 | exit(EXIT_FAILURE); 33 | } 34 | 35 | fclose(fp); 36 | return buffer; 37 | } 38 | 39 | long nfile_mtime(const char* fname) { 40 | struct stat buf; 41 | if (stat(fname, &buf) != -1) { 42 | return (long) buf.st_mtime; 43 | } else { 44 | return 0; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/nfile.h: -------------------------------------------------------------------------------- 1 | // NDBX File utility functions 2 | 3 | #ifndef NFILE_H 4 | #define NFILE_H 5 | 6 | char *nfile_read(const char* fname); 7 | long nfile_mtime(const char* fname); 8 | 9 | #endif // NFILE_H 10 | -------------------------------------------------------------------------------- /src/nim.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "nim.h" 6 | 7 | // Write a PNG image. 8 | void nim_png_write(const char *fname, int width, int height, nim_color_mode color_mode, uint8_t *buffer) { 9 | assert(color_mode == NIM_GRAY || color_mode == NIM_RGB); 10 | png_structp png_ptr = NULL; 11 | png_infop info_ptr = NULL; 12 | png_bytepp row_pointers; 13 | 14 | FILE *fp = fopen(fname, "wb"); 15 | if (!fp) { 16 | printf("ERROR: Could not write open file %s for writing.\n", fname); 17 | return; 18 | } 19 | 20 | // Init PNG writer. 21 | png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 22 | if (png_ptr == NULL) { 23 | printf("ERROR: png_create_write_struct.\n"); 24 | return; 25 | } 26 | 27 | info_ptr = png_create_info_struct(png_ptr); 28 | if (info_ptr == NULL) { 29 | printf("ERROR: png_create_info_struct.\n"); 30 | png_destroy_write_struct(&png_ptr, NULL); 31 | return; 32 | } 33 | 34 | png_set_IHDR(png_ptr, info_ptr, 35 | width, height, 36 | 8, 37 | color_mode, 38 | PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); 39 | 40 | int channels; 41 | if (color_mode == NIM_GRAY) { 42 | channels = 1; 43 | } else { // color_mode == NIM_RGB per assertion 44 | channels = 3; 45 | } 46 | 47 | // PNG expects a list of pointers. We just calculate offsets into our buffer. 48 | row_pointers = (png_bytepp) png_malloc(png_ptr, height * sizeof(png_bytep)); 49 | for (int y = 0; y < height; y++) { 50 | // The buffer coming from glReadPixels is upside down. Flip the rows. 51 | int flipped_y = height - y - 1; 52 | row_pointers[y] = buffer + (flipped_y * width * channels); 53 | } 54 | 55 | // Write out the image data. 56 | png_init_io(png_ptr, fp); 57 | png_set_rows(png_ptr, info_ptr, row_pointers); 58 | png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); 59 | 60 | // Cleanup. 61 | png_free(png_ptr, row_pointers); 62 | png_destroy_write_struct(&png_ptr, &info_ptr); 63 | fclose(fp); 64 | printf("Written %s.\n", fname); 65 | } 66 | -------------------------------------------------------------------------------- /src/nim.h: -------------------------------------------------------------------------------- 1 | // Image operations 2 | 3 | #ifndef NIM_H 4 | #define NIM_H 5 | 6 | #include 7 | #include 8 | 9 | typedef enum { 10 | NIM_GRAY = PNG_COLOR_TYPE_GRAY, 11 | NIM_RGB = PNG_COLOR_TYPE_RGB 12 | } nim_color_mode; 13 | 14 | void nim_png_write(const char *fname, int width, int height, nim_color_mode mode, uint8_t *buffer); 15 | 16 | #endif // NIM_H 17 | -------------------------------------------------------------------------------- /src/noise.h: -------------------------------------------------------------------------------- 1 | #ifndef NOISE_H 2 | #define NOISE_H 3 | 4 | void noise_init(); 5 | double noise_simplex(double x_in, double y_in); 6 | 7 | #endif // NOISE_H 8 | -------------------------------------------------------------------------------- /src/nosc.h: -------------------------------------------------------------------------------- 1 | // NDBX OSC Implementation 2 | // Can be used to receive messages from OSCulator. 3 | 4 | #ifndef NOSC_H 5 | #define NOSC_H 6 | 7 | #include 8 | 9 | #define NOSC_MAX_PATH_LENGTH 200 10 | #define NOSC_MAX_TYPES_LENGTH 10 11 | 12 | typedef union nosc_arg { 13 | char *s; 14 | int32_t i; 15 | float f; 16 | } nosc_arg; 17 | 18 | typedef struct { 19 | char path[NOSC_MAX_PATH_LENGTH]; 20 | char types[NOSC_MAX_TYPES_LENGTH]; 21 | int arg_count; 22 | nosc_arg *args; 23 | } nosc_message; 24 | 25 | const char *nosc_message_get_string(const nosc_message *msg, int index); 26 | int32_t nosc_message_get_int(const nosc_message *msg, int index); 27 | float nosc_message_get_float(const nosc_message *msg, int index); 28 | 29 | typedef struct nosc_message_item nosc_message_item; 30 | 31 | struct nosc_message_item { 32 | nosc_message *message; 33 | nosc_message_item *next; 34 | }; 35 | 36 | typedef struct nosc_server nosc_server; 37 | 38 | typedef void (*nosc_server_handle_message_fn)(nosc_server *server, nosc_message *message, void *ctx); 39 | 40 | struct nosc_server { 41 | int port; 42 | int running; 43 | 44 | nosc_server_handle_message_fn handle_message_fn; 45 | void *handle_message_ctx; 46 | 47 | pthread_t server_thread; 48 | 49 | nosc_message_item *front; 50 | nosc_message_item *rear; 51 | pthread_mutex_t message_mutex; 52 | }; 53 | 54 | nosc_server *nosc_server_new(int port, nosc_server_handle_message_fn fn, void *ctx); 55 | void nosc_server_update(nosc_server *server); 56 | void nosc_server_free(nosc_server *server); 57 | 58 | #endif // NOSC_H 59 | -------------------------------------------------------------------------------- /src/nut.h: -------------------------------------------------------------------------------- 1 | // Utility 2 | 3 | #ifndef NUT_H 4 | #define NUT_H 5 | 6 | #include 7 | 8 | // Sleep 9 | 10 | void nut_sleep_milliseconds(int millis); 11 | 12 | // Buffer 13 | 14 | typedef enum { 15 | NUT_BUFFER_U8 = 1, 16 | NUT_BUFFER_F64 17 | } nut_buffer_type; 18 | 19 | typedef union nut_buffer_data { 20 | uint8_t *u8; 21 | double *f64; 22 | } nut_buffer_data; 23 | 24 | typedef struct { 25 | nut_buffer_type type; 26 | int length; 27 | int channels; 28 | int size_bytes; 29 | nut_buffer_data data; 30 | } nut_buffer; 31 | 32 | nut_buffer *nut_buffer_new_u8(int length, int channels, const uint8_t *data); 33 | nut_buffer *nut_buffer_new_f64(int length, int channels, const double *data); 34 | nut_buffer *nut_buffer_copy(nut_buffer *buffer); 35 | nut_buffer *nut_buffer_reduce(nut_buffer *buffer, double percentage); 36 | nut_buffer *nut_buffer_clip(nut_buffer *buffer, int offset, int length); 37 | void nut_buffer_set_data(nut_buffer *dst, nut_buffer *src); 38 | void nut_buffer_append(nut_buffer *dst, nut_buffer *src); 39 | uint8_t nut_buffer_get_u8(nut_buffer *buffer, int offset); 40 | double nut_buffer_get_f64(nut_buffer *buffer, int offset); 41 | void nut_buffer_set_u8(nut_buffer *buffer, int offset, uint8_t value); 42 | void nut_buffer_set_f64(nut_buffer *buffer, int offset, double value); 43 | nut_buffer *nut_buffer_convert(nut_buffer *buffer, nut_buffer_type new_type); 44 | void nut_buffer_save(nut_buffer *buffer, const char *fname); 45 | void nut_buffer_free(nut_buffer *buffer); 46 | 47 | #endif // NUT_H 48 | -------------------------------------------------------------------------------- /src/nvr.h: -------------------------------------------------------------------------------- 1 | #ifndef NVR_H 2 | #define NVR_H 3 | 4 | #ifdef __APPLE__ 5 | #define OVR_OS_MAC 6 | #endif 7 | 8 | extern "C" { 9 | #include "vec.h" 10 | #include "nwm.h" 11 | #include "ngl.h" 12 | } 13 | 14 | #include "OVR.h" 15 | #include "OVR_CAPI_GL.h" 16 | 17 | typedef struct { 18 | int index; 19 | ovrEyeType type; 20 | ovrEyeRenderDesc render_desc; 21 | int width; 22 | int height; 23 | mat4 projection; 24 | ovrPosef render_pose; 25 | vec3 view_adjust; 26 | GLuint fbo; 27 | ovrTexture texture; 28 | GLuint texture_id; 29 | } nvr_eye; 30 | 31 | typedef struct { 32 | ovrHmd hmd; 33 | nvr_eye left_eye; 34 | nvr_eye right_eye; 35 | } nvr_device; 36 | 37 | typedef void (*nvr_render_cb_fn)(nvr_device *device, nvr_eye *eye, void *); 38 | 39 | nvr_device *nvr_device_init(); 40 | void nvr_device_destroy(nvr_device *device); 41 | nwm_window *nvr_device_window_init(nvr_device *device); 42 | void nvr_device_init_eyes(nvr_device *device); 43 | void nvr_device_draw(nvr_device *device, nvr_render_cb_fn callback, void* ctx); 44 | ngl_camera *nvr_device_eye_to_camera(nvr_device *device, nvr_eye *eye); 45 | 46 | #endif // NVR_H 47 | -------------------------------------------------------------------------------- /src/nwm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "nwm.h" 7 | 8 | static void _nwm_on_error(int error, const char* message) { 9 | fprintf(stderr, "GLFW ERROR %d: %s\n", error, message); 10 | exit(EXIT_FAILURE); 11 | } 12 | 13 | void nwm_init() { 14 | glfwSetErrorCallback(_nwm_on_error); 15 | 16 | if (!glfwInit()) { 17 | fprintf(stderr, "GLFW ERROR: Failed to initialize.\n"); 18 | exit(EXIT_FAILURE); 19 | } 20 | } 21 | 22 | nwm_window *nwm_window_init(int x, int y, int width, int height) { 23 | nwm_window* window; 24 | glfwWindowHint(GLFW_DEPTH_BITS, 16); 25 | 26 | #ifndef NWM_USE_OPENGL_ES 27 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 28 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); 29 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); 30 | glfwWindowHint(GLFW_SAMPLES, 4); 31 | #endif 32 | #if __APPLE__ 33 | glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); 34 | #endif 35 | window = glfwCreateWindow(width, height, "Frequensea", NULL, NULL); 36 | assert(window); 37 | if (x != 0 || y != 0) { 38 | glfwSetWindowPos(window, x, y); 39 | } 40 | glfwMakeContextCurrent(window); 41 | glEnable(GL_BLEND); 42 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 43 | glEnable(GL_DEPTH_TEST); 44 | glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); 45 | glEnable(GL_LINE_SMOOTH); 46 | glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); 47 | 48 | const GLubyte* renderer = glGetString(GL_RENDERER); 49 | const GLubyte* version = glGetString(GL_VERSION); 50 | printf("OpenGL Renderer: %s\n", renderer); 51 | printf("OpenGL Version: %s\n", version); 52 | 53 | return (nwm_window*) window; 54 | } 55 | 56 | void nwm_window_destroy(nwm_window* window) { 57 | glfwDestroyWindow(window); 58 | } 59 | 60 | int nwm_window_should_close(nwm_window* window) { 61 | return glfwWindowShouldClose(window); 62 | } 63 | 64 | void nwm_window_set_key_callback(nwm_window *window, nwm_key_cb_fn callback) { 65 | glfwSetKeyCallback(window, callback); 66 | } 67 | 68 | void nwm_window_set_user_data(nwm_window *window, void *data) { 69 | glfwSetWindowUserPointer(window, data); 70 | } 71 | 72 | void *nwm_window_get_user_data(nwm_window *window) { 73 | return glfwGetWindowUserPointer(window); 74 | } 75 | 76 | void nwm_window_swap_buffers(nwm_window* window) { 77 | glfwSwapBuffers(window); 78 | } 79 | 80 | void nwm_poll_events() { 81 | glfwPollEvents(); 82 | } 83 | 84 | void nwm_terminate() { 85 | glfwTerminate(); 86 | } 87 | 88 | double nwm_get_time() { 89 | return glfwGetTime(); 90 | } 91 | -------------------------------------------------------------------------------- /src/nwm.h: -------------------------------------------------------------------------------- 1 | #ifndef NWM_H 2 | #define NWM_H 3 | 4 | #ifdef __APPLE__ 5 | # define GL_SILENCE_DEPRECATION 6 | # define GLFW_INCLUDE_GLCOREARB 7 | #else 8 | #include 9 | #endif 10 | #include 11 | 12 | #ifdef __APPLE__ 13 | #define GLFW_EXPOSE_NATIVE_COCOA 14 | #define GLFW_EXPOSE_NATIVE_NSGL 15 | #endif 16 | #ifdef __linux__ 17 | #define GLFW_EXPOSE_NATIVE_X11 18 | #define GLFW_EXPOSE_NATIVE_GLX 19 | #endif 20 | 21 | #include 22 | 23 | #define NWM_WIN32 1 24 | #define NWM_OSX 2 25 | #define NWM_LINUX 3 26 | #define NWM_OPENGL 1 27 | #define NWM_OPENGL_ES 2 28 | 29 | #if defined( __WIN32__ ) || defined( _WIN32 ) 30 | #define NWM_USE_WIN32 31 | #define NWM_USE_OPENGL 32 | #define NWM_PLATFORM NWM_WIN32 33 | #define NWM_OPENGL_TYPE NWM_OPENGL 34 | #elif defined( __APPLE_CC__) 35 | #define NWM_USE_OSX 36 | #define NWM_USE_OPENGL 37 | #define NWM_PLATFORM NWM_OSX 38 | #define NWM_OPENGL_TYPE NWM_OPENGL 39 | #elif defined(__ARMEL__) 40 | #define NWM_USE_LINUX 41 | #define NWM_USE_OPENGL_ES 42 | #define NWM_PLATFORM NWM_LINUX 43 | #define NWM_OPENGL_TYPE NWM_OPENGL_ES 44 | #else 45 | #define NWM_USE_LINUX 46 | #define NWM_USE_OPENGL 47 | #define NWM_PLATFORM NWM_LINUX 48 | #define NWM_OPENGL_TYPE NWM_OPENGL 49 | #endif 50 | 51 | typedef GLFWwindow nwm_window; 52 | 53 | typedef void (*nwm_key_cb_fn)(nwm_window *window, int key, int scancode, int action, int mods); 54 | 55 | void nwm_init(); 56 | nwm_window *nwm_window_init(int x, int y, int width, int height); 57 | void nwm_window_destroy(nwm_window* window); 58 | int nwm_window_should_close(nwm_window* window); 59 | void nwm_window_set_key_callback(nwm_window *window, nwm_key_cb_fn callback); 60 | void *nwm_window_get_user_data(nwm_window *window); 61 | void nwm_window_set_user_data(nwm_window *window, void *data); 62 | void nwm_window_swap_buffers(nwm_window* window); 63 | void nwm_poll_events(); 64 | void nwm_terminate(); 65 | double nwm_get_time(); 66 | 67 | #endif // NWM_H 68 | -------------------------------------------------------------------------------- /src/obj.h: -------------------------------------------------------------------------------- 1 | #ifndef OBJ_H 2 | #define OBJ_H 3 | 4 | int obj_parse(const char *file_name, float** points_ptr, float** normals_ptr, int *face_count_ptr); 5 | void obj_write(const char *file_name, int component_count, int point_count, float* points); 6 | 7 | #endif // OBJ_H 8 | -------------------------------------------------------------------------------- /src/vec.h: -------------------------------------------------------------------------------- 1 | // Vector and matrix math 2 | 3 | #ifndef VEC_H 4 | #define VEC_H 5 | 6 | typedef struct { 7 | float x; 8 | float y; 9 | } vec2; 10 | 11 | typedef struct { 12 | float x; 13 | float y; 14 | float z; 15 | } vec3; 16 | 17 | typedef struct { 18 | float x; 19 | float y; 20 | float z; 21 | float w; 22 | } vec4; 23 | 24 | // Stored in column order: 25 | // 0 4 8 12 26 | // 1 5 9 13 27 | // 2 6 10 14 28 | // 3 7 11 15 29 | typedef struct { 30 | float m[16]; 31 | } mat4; 32 | 33 | typedef struct { 34 | float x; 35 | float y; 36 | float z; 37 | float w; 38 | } quat; 39 | 40 | vec2 vec2_init(float x, float y); 41 | 42 | vec3 vec3_zero(); 43 | vec3 vec3_init(float x, float y, float z); 44 | vec3 vec3_sub(const vec3* v1, const vec3* v2); 45 | float vec3_length(const vec3* v); 46 | vec3 vec3_normalize(const vec3* v); 47 | vec3 vec3_cross(const vec3* v1, const vec3* v2); 48 | float vec3_dot(const vec3* v1, const vec3* v2); 49 | vec3 vec3_normal(const vec3* v1, const vec3* v2, const vec3* v3); 50 | 51 | mat4 mat4_init_zero(); 52 | mat4 mat4_init_identity(); 53 | mat4 mat4_init_translate(float tx, float ty, float tz); 54 | mat4 mat4_init_scale(float sx, float sy, float sz); 55 | mat4 mat4_init_rotation_x(float deg); 56 | mat4 mat4_init_rotation_y(float deg); 57 | mat4 mat4_init_rotation_z(float deg); 58 | mat4 mat4_init_perspective(float fov_y, float aspect, float near, float far); 59 | mat4 mat4_init_look_at(const vec3* camera, const vec3* target, const vec3* up); 60 | 61 | mat4 mat4_mul(const mat4* m1, const mat4* m2); 62 | mat4 mat4_mul_scalar(const mat4* m, float s); 63 | float mat4_determinant(const mat4 *m); 64 | mat4 mat4_inverse(const mat4 *m); 65 | void mat4_set(mat4* m, const mat4* src); 66 | 67 | mat4 mat4_translate(const mat4* m, float tx, float ty, float tz); 68 | mat4 mat4_scale(const mat4* m, float sx, float sy, float sz); 69 | mat4 mat4_rotate_x(const mat4* m, float deg); 70 | mat4 mat4_rotate_y(const mat4* m, float deg); 71 | mat4 mat4_rotate_z(const mat4* m, float deg); 72 | 73 | mat4 quat_to_mat4(const quat* q); 74 | 75 | #endif // VEC_H 76 | --------------------------------------------------------------------------------