galo 1 year ago
commit
de2eccca30

+ 1 - 0
.import/31plan2202 [QIPRotw1_6c].ogg-02156bef1665ea13d9f611331a10ebb9.md5

@@ -0,0 +1 @@
+source_md5="a7e6b41024747c01b816b9dac9f76652"

+ 3 - 0
.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5

@@ -0,0 +1,3 @@
+source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
+dest_md5="2ded9e7f9060e2b530aab678b135fc5b"
+

BIN
.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex


+ 13 - 0
31plan2202 [QIPRotw1_6c].ogg.import

@@ -0,0 +1,13 @@
+[remap]
+
+importer="ogg_vorbis"
+type="AudioStreamOGGVorbis"
+valid=false
+
+[deps]
+
+source_file="res://31plan2202 [QIPRotw1_6c].ogg"
+[params]
+
+loop=true
+loop_offset=0

BIN
31plan2202 [QIPRotw1_6c].ogv


+ 66 - 0
Camera.gd

@@ -0,0 +1,66 @@
+extends Camera
+
+onready var Player = get_parent()
+
+## Increase this value to give a slower turn speed
+const CAMERA_TURN_SPEED = 200
+
+func _ready():
+	## Tell Godot that we want to handle input
+	set_process_input(true)
+	Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
+	
+
+func look_updown_rotation(rotation = 0):
+	"""
+	Returns a new Vector3 which contains only the x direction
+	We'll use this vector to compute the final 3D rotation later
+	"""
+	var toReturn = self.get_rotation() + Vector3(rotation, 0, 0)
+
+	##
+	## We don't want the player to be able to bend over backwards
+	## neither to be able to look under their arse.
+	## Here we'll clamp the vertical look to 90° up and down
+	toReturn.x = clamp(toReturn.x, PI / -2, PI / 2)
+
+	return toReturn
+
+func look_leftright_rotation(rotation = 0):
+	"""
+	Returns a new Vector3 which contains only the y direction
+	We'll use this vector to compute the final 3D rotation later
+	"""
+	return Player.get_rotation() + Vector3(0, rotation, 0)
+
+func _input(event):
+	"""
+	First person camera controls
+	"""
+	##
+	## We'll only process mouse motion events
+	if not event is InputEventMouseMotion:
+		return
+
+	##
+	## We'll use the parent node "Player" to set our left-right rotation
+	## This prevents us from adding the x-rotation to the y-rotation
+	## which would result in a kind of flight-simulator camera
+	Player.set_rotation(look_leftright_rotation(event.relative.x / -CAMERA_TURN_SPEED))
+
+	##
+	## Now we can simply set our y-rotation for the camera, and let godot
+	## handle the transformation of both together
+	self.set_rotation(look_updown_rotation(event.relative.y / -CAMERA_TURN_SPEED))
+
+func _enter_tree():
+	"""
+	Hide the mouse when we start
+	"""
+	Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
+
+func _leave_tree():
+	"""
+	Show the mouse when we leave
+	"""
+	Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)

+ 127 - 0
Control.tscn

@@ -0,0 +1,127 @@
+[gd_scene load_steps=8 format=2]
+
+[ext_resource path="res://31plan2202 [QIPRotw1_6c].ogv" type="VideoStream" id=1]
+[ext_resource path="res://Camera.gd" type="Script" id=2]
+[ext_resource path="res://VideoPlayer.gd" type="Script" id=3]
+
+[sub_resource type="ViewportTexture" id=1]
+viewport_path = NodePath("Viewport")
+
+[sub_resource type="SpatialMaterial" id=2]
+resource_local_to_scene = true
+flags_unshaded = true
+params_cull_mode = 1
+albedo_texture = SubResource( 1 )
+
+[sub_resource type="SphereMesh" id=3]
+
+[sub_resource type="Animation" id=4]
+resource_name = "autostuff"
+length = 60.0
+loop = true
+step = 1.0
+tracks/0/type = "value"
+tracks/0/path = NodePath("Button2:visible")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/keys = {
+"times": PoolRealArray( 0, 40, 46 ),
+"transitions": PoolRealArray( 1, 1, 1 ),
+"update": 1,
+"values": [ false, true, false ]
+}
+tracks/1/type = "value"
+tracks/1/path = NodePath("Button:visible")
+tracks/1/interp = 1
+tracks/1/loop_wrap = true
+tracks/1/imported = false
+tracks/1/enabled = true
+tracks/1/keys = {
+"times": PoolRealArray( 0, 40, 46 ),
+"transitions": PoolRealArray( 1, 1, 1 ),
+"update": 1,
+"values": [ false, true, false ]
+}
+tracks/2/type = "method"
+tracks/2/path = NodePath("Viewport/VideoPlayer")
+tracks/2/interp = 1
+tracks/2/loop_wrap = true
+tracks/2/imported = false
+tracks/2/enabled = false
+tracks/2/keys = {
+"times": PoolRealArray( 46 ),
+"transitions": PoolRealArray( 1 ),
+"values": [ {
+"args": [  ],
+"method": "stop"
+} ]
+}
+
+[node name="Control" type="Control"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Viewport" type="Viewport" parent="."]
+size = Vector2( 3840, 1920 )
+own_world = true
+render_target_v_flip = true
+
+[node name="VideoPlayer" type="VideoPlayer" parent="Viewport"]
+anchor_right = 1.0
+anchor_bottom = 1.0
+stream = ExtResource( 1 )
+autoplay = true
+buffering_msec = 1000
+script = ExtResource( 3 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="MeshInstance" type="MeshInstance" parent="."]
+transform = Transform( -10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0 )
+material_override = SubResource( 2 )
+mesh = SubResource( 3 )
+material/0 = null
+
+[node name="Spatial" type="Spatial" parent="."]
+
+[node name="Camera" type="Camera" parent="Spatial"]
+fov = 80.0
+far = 75.0
+script = ExtResource( 2 )
+
+[node name="RayCast" type="RayCast" parent="Spatial/Camera"]
+visible = false
+cast_to = Vector3( 0, 0, -100 )
+
+[node name="Button" type="Button" parent="."]
+margin_left = 494.642
+margin_top = 258.069
+margin_right = 608.642
+margin_bottom = 311.069
+text = "b1"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="Button2" type="Button" parent="."]
+margin_left = 361.0
+margin_top = 260.0
+margin_right = 472.0
+margin_bottom = 313.0
+text = "b2"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
+autoplay = "autostuff"
+anims/autostuff = SubResource( 4 )
+[connection signal="button_down" from="Button" to="Viewport/VideoPlayer" method="_on_Button_button_down"]
+[connection signal="button_down" from="Button" to="Button2" method="hide"]
+[connection signal="button_down" from="Button" to="Button" method="hide"]

+ 22 - 0
VideoPlayer.gd

@@ -0,0 +1,22 @@
+extends VideoPlayer
+
+
+# Declare member variables here. Examples:
+# var a = 2
+# var b = "text"
+
+
+# Called when the node enters the scene tree for the first time.
+func _ready():
+	pass # Replace with function body.
+
+
+# Called every frame. 'delta' is the elapsed time since the previous frame.
+#func _process(delta):
+#	pass
+
+
+func _on_Button_button_down():
+	stream = load('res://test.ogv')
+	play()
+	pass # Replace with function body.

+ 7 - 0
default_env.tres

@@ -0,0 +1,7 @@
+[gd_resource type="Environment" load_steps=2 format=2]
+
+[sub_resource type="ProceduralSky" id=1]
+
+[resource]
+background_mode = 2
+background_sky = SubResource( 1 )

BIN
icon.png


+ 34 - 0
icon.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://icon.png"
+dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0

+ 27 - 0
project.godot

@@ -0,0 +1,27 @@
+; Engine configuration file.
+; It's best edited using the editor UI and not directly,
+; since the parameters that go here are not all obvious.
+;
+; Format:
+;   [section] ; section goes between []
+;   param=value ; assign values to parameters
+
+config_version=4
+
+_global_script_classes=[  ]
+_global_script_class_icons={
+
+}
+
+[application]
+
+config/name="360 video"
+run/main_scene="res://Control.tscn"
+config/icon="res://icon.png"
+
+[rendering]
+
+quality/driver/driver_name="GLES2"
+vram_compression/import_etc=true
+vram_compression/import_etc2=false
+environment/default_environment="res://default_env.tres"

BIN
test.ogv