diff --git a/.gitignore b/.gitignore index 4d4de08..ea33be8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.import \ No newline at end of file +.import +*.import \ No newline at end of file diff --git a/MagicaVoxel-Importer b/MagicaVoxel-Importer index 8eab536..1ac6f1c 160000 --- a/MagicaVoxel-Importer +++ b/MagicaVoxel-Importer @@ -1 +1 @@ -Subproject commit 8eab5367c0b4e61a072779bbd11bc9f12ca19a97 +Subproject commit 1ac6f1cfa09a7d338a40af7d2b46dc624c0b2818 diff --git a/MeshInstance.gd b/MeshInstance.gd new file mode 100644 index 0000000..cd7b3b1 --- /dev/null +++ b/MeshInstance.gd @@ -0,0 +1,15 @@ +extends "res://addons/MagicaVoxelImporter/VoxelMesh.gd" + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" + +func _ready(): + # Called when the node is added to the scene for the first time. + # Initialization here + pass + +#func _process(delta): +# # Called every frame. Delta is time since last frame. +# # Update game logic here. +# pass diff --git a/default_env.tres b/default_env.tres index 98f26a7..ad86b72 100644 --- a/default_env.tres +++ b/default_env.tres @@ -1,5 +1,101 @@ [gd_resource type="Environment" load_steps=2 format=2] + [sub_resource type="ProceduralSky" id=1] + +radiance_size = 4 +sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 ) +sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 ) +sky_curve = 0.25 +sky_energy = 1.0 +ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 ) +ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 ) +ground_curve = 0.01 +ground_energy = 1.0 +sun_color = Color( 1, 1, 1, 1 ) +sun_latitude = 35.0 +sun_longitude = 0.0 +sun_angle_min = 1.0 +sun_angle_max = 100.0 +sun_curve = 0.05 +sun_energy = 16.0 +texture_size = 2 + [resource] + background_mode = 2 background_sky = SubResource( 1 ) +background_sky_custom_fov = 0.0 +background_color = Color( 0, 0, 0, 1 ) +background_energy = 1.0 +background_canvas_max_layer = 0 +ambient_light_color = Color( 0, 0, 0, 1 ) +ambient_light_energy = 1.0 +ambient_light_sky_contribution = 1.0 +fog_enabled = false +fog_color = Color( 0.5, 0.6, 0.7, 1 ) +fog_sun_color = Color( 1, 0.9, 0.7, 1 ) +fog_sun_amount = 0.0 +fog_depth_enabled = true +fog_depth_begin = 10.0 +fog_depth_curve = 1.0 +fog_transmit_enabled = false +fog_transmit_curve = 1.0 +fog_height_enabled = false +fog_height_min = 0.0 +fog_height_max = 100.0 +fog_height_curve = 1.0 +tonemap_mode = 0 +tonemap_exposure = 1.0 +tonemap_white = 1.0 +auto_exposure_enabled = false +auto_exposure_scale = 0.4 +auto_exposure_min_luma = 0.05 +auto_exposure_max_luma = 8.0 +auto_exposure_speed = 0.5 +ss_reflections_enabled = false +ss_reflections_max_steps = 64 +ss_reflections_fade_in = 0.15 +ss_reflections_fade_out = 2.0 +ss_reflections_depth_tolerance = 0.2 +ss_reflections_roughness = true +ssao_enabled = false +ssao_radius = 1.0 +ssao_intensity = 1.0 +ssao_radius2 = 0.0 +ssao_intensity2 = 1.0 +ssao_bias = 0.01 +ssao_light_affect = 0.0 +ssao_color = Color( 0, 0, 0, 1 ) +ssao_quality = 0 +ssao_blur = 3 +ssao_edge_sharpness = 4.0 +dof_blur_far_enabled = false +dof_blur_far_distance = 10.0 +dof_blur_far_transition = 5.0 +dof_blur_far_amount = 0.1 +dof_blur_far_quality = 1 +dof_blur_near_enabled = false +dof_blur_near_distance = 2.0 +dof_blur_near_transition = 1.0 +dof_blur_near_amount = 0.1 +dof_blur_near_quality = 1 +glow_enabled = false +glow_levels/1 = false +glow_levels/2 = false +glow_levels/3 = true +glow_levels/4 = false +glow_levels/5 = true +glow_levels/6 = false +glow_levels/7 = false +glow_intensity = 0.8 +glow_strength = 1.0 +glow_bloom = 0.0 +glow_blend_mode = 2 +glow_hdr_threshold = 1.0 +glow_hdr_scale = 2.0 +glow_bicubic_upscale = false +adjustment_enabled = false +adjustment_brightness = 1.0 +adjustment_contrast = 1.0 +adjustment_saturation = 1.0 + diff --git a/icon.png b/icon.png index a0b64ee..5f92a50 100644 Binary files a/icon.png and b/icon.png differ diff --git a/magicavoxel-samples/3x3x3.vox b/magicavoxel-samples/3x3x3.vox new file mode 100644 index 0000000..65778bb Binary files /dev/null and b/magicavoxel-samples/3x3x3.vox differ diff --git a/magicavoxel-samples/8x8x8.vox b/magicavoxel-samples/8x8x8.vox new file mode 100644 index 0000000..5619e69 Binary files /dev/null and b/magicavoxel-samples/8x8x8.vox differ diff --git a/magicavoxel-samples/castle.vox b/magicavoxel-samples/castle.vox new file mode 100644 index 0000000..0be7f39 Binary files /dev/null and b/magicavoxel-samples/castle.vox differ diff --git a/magicavoxel-samples/chr_knight.vox b/magicavoxel-samples/chr_knight.vox new file mode 100644 index 0000000..c921bf5 Binary files /dev/null and b/magicavoxel-samples/chr_knight.vox differ diff --git a/magicavoxel-samples/chr_old.vox b/magicavoxel-samples/chr_old.vox new file mode 100644 index 0000000..faf7508 Binary files /dev/null and b/magicavoxel-samples/chr_old.vox differ diff --git a/magicavoxel-samples/chr_rain.vox b/magicavoxel-samples/chr_rain.vox new file mode 100644 index 0000000..1a01080 Binary files /dev/null and b/magicavoxel-samples/chr_rain.vox differ diff --git a/magicavoxel-samples/chr_sword.vox b/magicavoxel-samples/chr_sword.vox new file mode 100644 index 0000000..05fc482 Binary files /dev/null and b/magicavoxel-samples/chr_sword.vox differ diff --git a/magicavoxel-samples/doom.vox b/magicavoxel-samples/doom.vox new file mode 100644 index 0000000..aea85f9 Binary files /dev/null and b/magicavoxel-samples/doom.vox differ diff --git a/magicavoxel-samples/ephtracy.vox b/magicavoxel-samples/ephtracy.vox new file mode 100644 index 0000000..27e1caa Binary files /dev/null and b/magicavoxel-samples/ephtracy.vox differ diff --git a/magicavoxel-samples/monu9.vox b/magicavoxel-samples/monu9.vox new file mode 100644 index 0000000..fd77111 Binary files /dev/null and b/magicavoxel-samples/monu9.vox differ diff --git a/magicavoxel-samples/nature.vox b/magicavoxel-samples/nature.vox new file mode 100644 index 0000000..2034818 Binary files /dev/null and b/magicavoxel-samples/nature.vox differ diff --git a/magicavoxel-samples/shelf.vox b/magicavoxel-samples/shelf.vox new file mode 100644 index 0000000..be75309 Binary files /dev/null and b/magicavoxel-samples/shelf.vox differ diff --git a/magicavoxel-samples/teapot.vox b/magicavoxel-samples/teapot.vox new file mode 100644 index 0000000..3d6360f Binary files /dev/null and b/magicavoxel-samples/teapot.vox differ diff --git a/main.gd b/main.gd new file mode 100644 index 0000000..0809b78 --- /dev/null +++ b/main.gd @@ -0,0 +1,15 @@ +extends Spatial + +# class member variables go here, for example: +# var a = 2 +# var b = "textvar" + +func _ready(): + # Called when the node is added to the scene for the first time. + # Initialization here + pass + +func _process(delta): + # Called every frame. Delta is time since last frame. + # Update game logic here. + $Label.text = '%s' % Engine.get_frames_per_second() diff --git a/main.tscn b/main.tscn new file mode 100644 index 0000000..c2aa6f1 --- /dev/null +++ b/main.tscn @@ -0,0 +1,373 @@ +[gd_scene load_steps=20 format=2] + +[ext_resource path="res://main.gd" type="Script" id=1] +[ext_resource path="res://magicavoxel-samples/nature.vox" type="ArrayMesh" id=2] +[ext_resource path="res://addons/MagicaVoxelImporter/VoxelMesh.gd" type="Script" id=3] +[ext_resource path="res://magicavoxel-samples/3x3x3.vox" type="ArrayMesh" id=4] +[ext_resource path="res://testsm.vox" type="ArrayMesh" id=5] +[ext_resource path="res://magicavoxel-samples/castle.vox" type="ArrayMesh" id=6] +[ext_resource path="res://magicavoxel-samples/monu9.vox" type="ArrayMesh" id=7] +[ext_resource path="res://testbig.vox" type="ArrayMesh" id=8] +[ext_resource path="res://magicavoxel-samples/8x8x8.vox" type="ArrayMesh" id=9] +[ext_resource path="res://magicavoxel-samples/chr_old.vox" type="ArrayMesh" id=10] +[ext_resource path="res://magicavoxel-samples/doom.vox" type="ArrayMesh" id=11] +[ext_resource path="res://magicavoxel-samples/shelf.vox" type="ArrayMesh" id=12] +[ext_resource path="res://testbox.vox" type="ArrayMesh" id=13] +[ext_resource path="res://magicavoxel-samples/chr_knight.vox" type="ArrayMesh" id=14] +[ext_resource path="res://magicavoxel-samples/teapot.vox" type="ArrayMesh" id=15] + +[sub_resource type="QuadMesh" id=1] + +custom_aabb = AABB( 0, 0, 0, 0, 0, 0 ) +size = Vector2( 5, 5 ) + +[sub_resource type="Environment" id=2] + +background_mode = 0 +background_sky_custom_fov = 0.0 +background_color = Color( 0, 0, 0, 1 ) +background_energy = 1.0 +background_canvas_max_layer = 0 +ambient_light_color = Color( 0, 0, 0, 1 ) +ambient_light_energy = 1.0 +ambient_light_sky_contribution = 1.0 +fog_enabled = false +fog_color = Color( 0.5, 0.6, 0.7, 1 ) +fog_sun_color = Color( 1, 0.9, 0.7, 1 ) +fog_sun_amount = 0.0 +fog_depth_enabled = true +fog_depth_begin = 10.0 +fog_depth_curve = 1.0 +fog_transmit_enabled = false +fog_transmit_curve = 1.0 +fog_height_enabled = false +fog_height_min = 0.0 +fog_height_max = 100.0 +fog_height_curve = 1.0 +tonemap_mode = 0 +tonemap_exposure = 1.0 +tonemap_white = 1.0 +auto_exposure_enabled = false +auto_exposure_scale = 0.4 +auto_exposure_min_luma = 0.05 +auto_exposure_max_luma = 8.0 +auto_exposure_speed = 0.5 +ss_reflections_enabled = false +ss_reflections_max_steps = 64 +ss_reflections_fade_in = 0.15 +ss_reflections_fade_out = 2.0 +ss_reflections_depth_tolerance = 0.2 +ss_reflections_roughness = true +ssao_enabled = false +ssao_radius = 1.0 +ssao_intensity = 1.0 +ssao_radius2 = 0.0 +ssao_intensity2 = 1.0 +ssao_bias = 0.01 +ssao_light_affect = 0.0 +ssao_color = Color( 0, 0, 0, 1 ) +ssao_quality = 0 +ssao_blur = 3 +ssao_edge_sharpness = 4.0 +dof_blur_far_enabled = false +dof_blur_far_distance = 10.0 +dof_blur_far_transition = 5.0 +dof_blur_far_amount = 0.1 +dof_blur_far_quality = 1 +dof_blur_near_enabled = false +dof_blur_near_distance = 2.0 +dof_blur_near_transition = 1.0 +dof_blur_near_amount = 0.1 +dof_blur_near_quality = 1 +glow_enabled = false +glow_levels/1 = false +glow_levels/2 = false +glow_levels/3 = true +glow_levels/4 = false +glow_levels/5 = true +glow_levels/6 = false +glow_levels/7 = false +glow_intensity = 0.8 +glow_strength = 1.0 +glow_bloom = 0.0 +glow_blend_mode = 2 +glow_hdr_threshold = 1.0 +glow_hdr_scale = 2.0 +glow_bicubic_upscale = false +adjustment_enabled = false +adjustment_brightness = 1.0 +adjustment_contrast = 1.0 +adjustment_saturation = 1.0 + +[sub_resource type="Animation" id=3] + +length = 10.0 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("Position3D:rotation_degrees") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 10 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ] +} + +[sub_resource type="Animation" id=4] + +resource_name = "Demo" +length = 28.0 +loop = true +step = 0.1 +tracks/0/type = "value" +tracks/0/path = NodePath("MeshInstance:mesh") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 6.2, 12.6, 18 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), +"update": 1, +"values": [ ExtResource( 5 ), ExtResource( 6 ), ExtResource( 7 ), ExtResource( 2 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("MeshInstance2:mesh") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 3.1, 7.3, 11.6, 16.8, 18 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ), ExtResource( 11 ), ExtResource( 12 ), ExtResource( 4 ) ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("MeshInstance3:mesh") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0, 5, 6.9, 15.6, 18 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1 ), +"update": 1, +"values": [ ExtResource( 13 ), ExtResource( 4 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 4 ) ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("Position3D/Camera:translation") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0, 9.4, 12.9, 28 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), +"update": 0, +"values": [ Vector3( 1.49012e-008, 0.360911, -0.652091 ), Vector3( 1.49012e-008, 0.360911, -0.652091 ), Vector3( -1.75089e-007, 0.959857, -2.59255 ), Vector3( -1.75089e-007, 0.959857, -2.59255 ) ] +} +tracks/4/type = "value" +tracks/4/path = NodePath("MeshInstance:point_size") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 0, 20, 21.4, 23.2, 28 ), +"transitions": PoolRealArray( 1, 1, 1, 1, 1 ), +"update": 0, +"values": [ 18.0, 18.0, 3.0, 3.0, 40.0 ] +} + +[node name="Spatial" type="Spatial" index="0"] + +script = ExtResource( 1 ) + +[node name="Floor" type="MeshInstance" parent="." index="0"] + +transform = Transform( 1, 0, 0, 0, -4.37114e-008, 1, 0, -1, -4.37114e-008, 0, 0, 0 ) +layers = 1 +material_override = null +cast_shadow = 1 +extra_cull_margin = 0.0 +use_in_baked_light = false +lod_min_distance = 0.0 +lod_min_hysteresis = 0.0 +lod_max_distance = 0.0 +lod_max_hysteresis = 0.0 +mesh = SubResource( 1 ) +skeleton = NodePath("..") +material/0 = null + +[node name="MeshInstance" type="MeshInstance" parent="." index="1"] + +transform = Transform( 0.025, 0, 0, 0, 0.025, 0, 0, 0, 0.025, 0, 0.0145142, 0 ) +layers = 1 +material_override = null +cast_shadow = 1 +extra_cull_margin = 0.0 +use_in_baked_light = false +lod_min_distance = 0.0 +lod_min_hysteresis = 0.0 +lod_max_distance = 0.0 +lod_max_hysteresis = 0.0 +mesh = ExtResource( 2 ) +skeleton = NodePath("..") +material/0 = null +script = ExtResource( 3 ) +_sections_unfolded = [ "Transform" ] +point_size = 18.0 + +[node name="MeshInstance2" type="MeshInstance" parent="." index="2"] + +transform = Transform( 0.025, 0, 0, 0, 0.025, 0, 0, 0, 0.025, 0.42993, 0.0145142, 0 ) +layers = 1 +material_override = null +cast_shadow = 1 +extra_cull_margin = 0.0 +use_in_baked_light = false +lod_min_distance = 0.0 +lod_min_hysteresis = 0.0 +lod_max_distance = 0.0 +lod_max_hysteresis = 0.0 +mesh = ExtResource( 4 ) +skeleton = NodePath("..") +material/0 = null +script = ExtResource( 3 ) +_sections_unfolded = [ "Transform" ] +point_size = 18.0 + +[node name="MeshInstance3" type="MeshInstance" parent="." index="3"] + +transform = Transform( 0.025, 0, 0, 0, 0.025, 0, 0, 0, 0.025, -0.451051, 0.014514, 0 ) +layers = 1 +material_override = null +cast_shadow = 1 +extra_cull_margin = 0.0 +use_in_baked_light = false +lod_min_distance = 0.0 +lod_min_hysteresis = 0.0 +lod_max_distance = 0.0 +lod_max_hysteresis = 0.0 +mesh = ExtResource( 4 ) +skeleton = NodePath("..") +material/0 = null +script = ExtResource( 3 ) +_sections_unfolded = [ "Transform" ] +point_size = 18.0 + +[node name="WorldEnvironment" type="WorldEnvironment" parent="." index="4"] + +environment = SubResource( 2 ) + +[node name="OmniLight" type="OmniLight" parent="WorldEnvironment" index="0"] + +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.154138, 0.762832, -1.23486 ) +layers = 1 +light_color = Color( 1, 1, 1, 1 ) +light_energy = 1.0 +light_indirect_energy = 1.0 +light_negative = false +light_specular = 0.5 +light_bake_mode = 1 +light_cull_mask = -1 +shadow_enabled = false +shadow_color = Color( 0, 0, 0, 1 ) +shadow_bias = 0.14 +shadow_contact = 0.0 +shadow_reverse_cull_face = false +editor_only = false +omni_range = 5.0 +omni_attenuation = 1.0 +omni_shadow_mode = 1 +omni_shadow_detail = 1 +_sections_unfolded = [ "Light", "Shadow", "Transform" ] + +[node name="Position3D" type="Position3D" parent="." index="5"] + +transform = Transform( 1, 0, 1.74846e-007, 0, 1, 0, -1.74846e-007, 0, 1, -0.0238543, 0, 0 ) +_sections_unfolded = [ "Transform" ] + +[node name="Camera" type="Camera" parent="Position3D" index="0"] + +transform = Transform( -1, -7.45058e-009, -8.9407e-008, -2.57837e-008, 0.955518, 0.294932, 8.9407e-008, 0.294932, -0.955518, -1.75089e-007, 0.959857, -2.59255 ) +keep_aspect = 1 +cull_mask = 1048575 +environment = null +h_offset = 0.0 +v_offset = 0.0 +doppler_tracking = 0 +projection = 0 +current = false +fov = 70.0 +size = 1.0 +near = 0.05 +far = 100.0 +_sections_unfolded = [ "Transform" ] + +[node name="OmniLight2" type="OmniLight" parent="Position3D/Camera" index="0"] + +transform = Transform( -1, -2.57837e-008, 8.35341e-008, 0, 0.955518, 0.294931, -8.74228e-008, 0.294931, -0.955518, -0.288927, -0.588953, 1.65443 ) +layers = 1 +light_color = Color( 1, 1, 1, 1 ) +light_energy = 1.0 +light_indirect_energy = 1.0 +light_negative = false +light_specular = 0.5 +light_bake_mode = 1 +light_cull_mask = -1 +shadow_enabled = false +shadow_color = Color( 0, 0, 0, 1 ) +shadow_bias = 0.15 +shadow_contact = 0.0 +shadow_reverse_cull_face = false +editor_only = false +omni_range = 5.0 +omni_attenuation = 1.0 +omni_shadow_mode = 1 +omni_shadow_detail = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="6"] + +root_node = NodePath("..") +autoplay = "demo" +playback_process_mode = 1 +playback_default_blend_time = 0.0 +playback_speed = 1.0 +anims/demo = SubResource( 3 ) +blend_times = [ ] + +[node name="AnimationPlayer2" type="AnimationPlayer" parent="." index="7"] + +root_node = NodePath("..") +autoplay = "Demo" +playback_process_mode = 1 +playback_default_blend_time = 0.0 +playback_speed = 1.0 +anims/Demo = SubResource( 4 ) +blend_times = [ ] + +[node name="Label" type="Label" parent="." index="8"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 40.0 +margin_bottom = 14.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 2 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 4 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + + diff --git a/project.godot b/project.godot index db6e402..63453de 100644 --- a/project.godot +++ b/project.godot @@ -11,8 +11,13 @@ config_version=3 [application] config/name="govox" +run/main_scene="res://main.tscn" config/icon="res://icon.png" +[editor_plugins] + +enabled=PoolStringArray( "MagicaVoxelImporter" ) + [rendering] environment/default_environment="res://default_env.tres" diff --git a/publish-to-addon.sh b/publish-to-addon.sh new file mode 100644 index 0000000..c65c7f1 --- /dev/null +++ b/publish-to-addon.sh @@ -0,0 +1 @@ +cp addons/MagicaVoxelImporter/* MagicaVoxel-Importer/addons/ diff --git a/testbox.vox b/testbox.vox new file mode 100644 index 0000000..e3f8bb8 Binary files /dev/null and b/testbox.vox differ