From b2fe78cef14a2c1a4d5cc0844325e4bfbb92967c Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Sun, 7 Aug 2016 18:14:05 +0200 Subject: [PATCH] Added three.js --- config_webrx.py | 6 +++--- htdocs/index.wrx | 3 ++- htdocs/openwebrx.css | 6 ++++++ htdocs/openwebrx.js | 26 +++++++++++++++++++++++++- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/config_webrx.py b/config_webrx.py index ea693c1..e50e7b9 100644 --- a/config_webrx.py +++ b/config_webrx.py @@ -117,9 +117,9 @@ To use a HackRF, compile the HackRF host tools from its "stdout" branch: #format_conversion="csdr convert_s16_f | csdr gain_ff 30" # >> /dev/urandom test signal source -#samp_rate = 2400000 -#start_rtl_command="cat /dev/urandom | (pv -qL `python -c 'print int({samp_rate} * 2.2)'` 2>&1)".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate) -#format_conversion="csdr convert_u8_f" +samp_rate = 2400000 +start_rtl_command="cat /dev/urandom | (pv -qL `python -c 'print int({samp_rate} * 2.2)'` 2>&1)".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate) +format_conversion="csdr convert_u8_f" # >> Pre-recorded raw I/Q file as signal source # You will have to correctly specify: samp_rate, center_freq, format_conversion in order to correctly play an I/Q file. diff --git a/htdocs/index.wrx b/htdocs/index.wrx index 2debd54..b651cf1 100644 --- a/htdocs/index.wrx +++ b/htdocs/index.wrx @@ -35,6 +35,7 @@ var waterfall_max_level_default=%[WATERFALL_MAX_LEVEL]; + @@ -72,8 +73,8 @@
+
-
diff --git a/htdocs/openwebrx.css b/htdocs/openwebrx.css index a117143..954ba86 100644 --- a/htdocs/openwebrx.css +++ b/htdocs/openwebrx.css @@ -396,6 +396,12 @@ input[type=range]:focus::-ms-fill-upper image-rendering: -webkit-optimize-contrast; } +#openwebrx-three-container +{ + overflow: scroll; + display: none; +} + #openwebrx-phantom-canvas { position: absolute; diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index ce5be95..474fe17 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1085,7 +1085,29 @@ function zoom_calc() function resize_waterfall_container(check_init) { if(check_init&&!waterfall_setup_done) return; - canvas_container.style.height=(window.innerHeight-e("webrx-top-container").clientHeight-e("openwebrx-scale-container").clientHeight).toString()+"px"; + three_container.style.height=canvas_container.style.height=(window.innerHeight-e("webrx-top-container").clientHeight-e("openwebrx-scale-container").clientHeight).toString()+"px"; +} + +function three_start() +{ + var scene = new THREE.Scene(); + var camera = new THREE.PerspectiveCamera( 75, three_container.clientWidth/three_container.clientHeight, 0.1, 1000 ); + var renderer = new THREE.WebGLRenderer(); + renderer.setSize( three_container.clientWidth, three_container.clientHeight ); + three_container.appendChild(renderer.domElement); + var geometry = new THREE.BoxGeometry( 1, 1, 1 ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var cube = new THREE.Mesh( geometry, material ); + scene.add( cube ); + camera.position.z = 5; + var render = function () { + console.log(render); + window.requestAnimationFrame( render ); + cube.rotation.x += 0.1; + cube.rotation.y += 0.1; + renderer.render(scene, camera); + }; + render(); } @@ -1706,6 +1728,7 @@ function add_canvas() function init_canvas_container() { canvas_container=e("webrx-canvas-container"); + three_container=e("openwebrx-three-container"); canvas_container.addEventListener("mouseout",canvas_container_mouseout, false); //window.addEventListener("mouseout",window_mouseout,false); //document.body.addEventListener("mouseup",body_mouseup,false); @@ -1897,6 +1920,7 @@ function openwebrx_resize() resize_canvases(); resize_waterfall_container(true); resize_scale(); + resize_three(); check_top_bar_congestion(); }