Skip to content

Commit

Permalink
add boombox
Browse files Browse the repository at this point in the history
  • Loading branch information
madjin committed Aug 1, 2020
1 parent d523e53 commit fdf9bb1
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 5 deletions.
File renamed without changes
Binary file added img/win7_mute.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 12 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,28 @@
<AssetImage id="black" src="img/black.png" tex_clamp="true"/>
<AssetImage id="polybius" src="img/poly.gif"/>
<AssetImage id="computers" src="img/computers.gif"/>
<AssetImage id="meetup-thumb" src="img/meetup.jpg" />
<AssetImage id="meetup-thumb" src="img/nsl-meetup.jpg" />
<AssetImage id="mute" src="img/win7_mute.png"/>
<AssetObject id="nsl" src="models/inside/nsl-matterport.gltf"/>
<AssetObject id="boombox" src="models/boombox.obj.gz"/>
<AssetObject id="monitor" src="models/BigFloor.dae.gz"/>
<AssetObject id="podium" mtl="models/podium/podium.mtl" src="models/podium/podium.obj"/>
<AssetScript src="videoscreen.js"/>
<AssetScript src="videoscreen.js"/>
<AssetScript src="radio_mute.js"/>
<AssetVideo auto_play="true" height="600" id="stream1" loop="false" src="presentation_noaudio.mp4" width="800"/>
<AssetVideo auto_play="true" height="500" id="stream2" src="david1.webm" width="600"/>
<AssetWebsurface height="600" id="meetup" src="https://www.meetup.com/NullSpaceLabs/events/" width="800"/>
<AssetWebsurface height="600" id="music" src="https://somafm.com/player/#/now-playing/defcon" width="900"/>
<AssetSound id="music" src="http://ice4.somafm.com/defcon-128-mp3" />
</Assets>
<Room ambient="0.1 0.1 0.1" pbr="true" defaultlights="false" shadows="true" skybox_back_id="black" skybox_down_id="black" skybox_front_id="black" skybox_left_id="black" skybox_right_id="black" skybox_up_id="black" use_local_asset="room_plane" visible="false">
<Object id="nsl" js_id="A-1-1515905543" pos="8 0 11" scale="1.5 1.5 1.5" xdir="0 0 1" zdir="-1 0 0"/>
<Object collision_id="cube" collision_pos="2 1 10" collision_scale="2.63144 1.84296 0.67236" id="boombox" js_id="radio_control" locked="true" onclick="radio_click()" pos="2 1 10" xdir="-0.193673 0 -0.981066" zdir="0.981066 0 -0.193673"/>
<Object col="1 1 1 0.2" cull_face="none" id="boombox" js_id="radio_control_highlight" locked="true" opacity="0.2" pos="2 1 10" xdir="-0.193673 0 -0.981066" zdir="0.981066 0 -0.193673"/>
<Sound gain="0.4" id="radio" js_id="radio_sound" pos="2 1 10" rect="-100 -100 100 100" scale="1.5 1.5 1.5"/>
<Object col="1 1 1 0.4" cull_face="none" id="plane" image_id="mute" js_id="radio_mute" lighting="false" locked="false" pos="2 1 10" visible="false" xdir="0.970248 0 -0.242112" zdir="0.242112 0 0.970248"/>
<Object collision_id="plane" id="plane" js_id="mainvideo" lighting="false" pos="12.5 2.2 3.46" scale="4 2.3 1" video_id="stream" xdir="1 -0.000305 0.000001" ydir="0.000305 0.999848 -0.01745" zdir="0.000004 0.01745 0.999848"/>
<Object collision_id="plane" id="plane" image_id="computers" js_id="A-12-1515907626" lighting="false" pos="0.2 1.3 8.679999" scale="1.4 0.9 1" xdir="-1 -0.000004 -0.000002" ydir="-0.000004 1 -0" zdir="0.000002 0 -1"/>
<Object collision_id="plane" id="plane" js_id="A-13-1515907694" lighting="false" pos="0.48 1.4 9.8" scale="1.4 0.9 1" websurface_id="music"/>
<Object collision_id="plane" id="plane" websurface_id="music" js_id="A-12-1515907626" lighting="false" pos="0.2 1.3 8.679999" scale="1.4 0.9 1" xdir="-1 -0.000004 -0.000002" ydir="-0.000004 1 -0" zdir="0.000002 0 -1"/>
<Object collision_id="plane" id="plane" js_id="A-13-1515907694" lighting="false" pos="0.48 1.4 9.8" scale="1.4 0.9 1" image_id="computers"/>
<Object collision_id="plane" id="plane" image_id="polybius" js_id="A-15-1515907744" lighting="false" pos="-0.71 2.01 15.719999" scale="0.95 0.7 1" xdir="0.034901 0.000001 -0.999391" ydir="-0.087103 0.996195 -0.003041" zdir="0.995588 0.087156 0.034768"/>
<Object collision_id="plane" id="plane" js_id="A-16-1515907821" lighting="false" pos="14.78 2.08 19.629999" scale="1.76 1.281 0.999" websurface_id="nsl" image_id="meetup-thumb" xdir="-0.999716 0.016836 -0.016841" ydir="0.01622 0.999217 0.03609" zdir="0.017435 0.035807 -0.999207"/>
<Object cull_face="none" id="monitor" js_id="ksdljf-5-1519876579" pos="14.299999 1.8 12.799999" xdir="0.942154 0 0.33518" zdir="-0.33518 0 0.942154"/>
Expand Down
Binary file added models/boombox.obj.gz
Binary file not shown.
92 changes: 92 additions & 0 deletions radio_mute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
var isJanusWeb = (typeof elation != 'undefined');
var highlight_timer = 0.0;
var highlight_timer_2 = 0.0;
var click_timer = 0;
var radio_gain_max = 1;

room.onLoad = function()
{
var radio = room.objects['radio_sound'];
if (radio)
{
if (radio.gain > 0)
{
radio_gain_max = radio.gain;
}
}
}

// note to James
// this function is the part that triggers multiple times
// it should only log 1 time on click, I'm getting one per each script in the room.
function radio_click()
{
//console.log('radio_click()');
// don't cange if clicked rapidly
if (click_timer > 0)
{
return;
}
var radio = room.objects['radio_sound'];
var mute = room.objects['radio_mute'];
if (radio)
{
click_timer = 0.2;
radio.gain = (radio_gain_max - radio.gain);
if (mute)
{
if (radio.gain == 0)
{
mute.visible = true;
}
else
{
mute.visible = false;
}
}
}
}

room.update = function(dt)
{
if (click_timer > 0)
{
click_timer -= dt * 0.001;
}
// hover/highlighting portion
var highlight = room.objects['radio_control_highlight'];
var radio_control = room.objects['radio_control'];
if (radio_control && highlight && player.cursor_object == 'radio_control')
{
highlight_timer -= dt * 0.001;
highlight_timer_2 += dt * 0.001;
if (highlight_timer <= 0)
{
highlight_timer += 1/30;
scale_base = radio_control.scale.x;
highlight_maxsize = radio_control.scale.x*0.025
highlight.scale = V(0.01+scale_base+highlight_maxsize+highlight_maxsize*Math.sin(highlight_timer_2*5));
//highlight.visible = !highlight.visible;
}
if (isJanusWeb && highlight.visible)
{
var mute = room.objects['radio_mute'];
if (highlight.visible)
{
highlight.setOpacity(0.4+Math.sin(highlight_timer_2)*0.0001);
}
if (mute.visible)
{
mute.setOpacity(0.4+Math.sin(highlight_timer_2)*0.0001);
}
}
highlight.visible = true;
}
else if (highlight)
{
if (highlight.visible)
{
highlight.visible = false;
}
}
}

0 comments on commit fdf9bb1

Please sign in to comment.