summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE.md4
-rw-r--r--bin/tests/test_string.cpp137
-rw-r--r--core/global_constants.cpp1
-rw-r--r--core/io/file_access_pack.cpp4
-rw-r--r--core/io/file_access_pack.h1
-rw-r--r--core/math/geometry.h4
-rw-r--r--core/os/dir_access.h1
-rw-r--r--core/ustring.cpp79
-rw-r--r--core/ustring.h5
-rw-r--r--core/variant_call.cpp10
-rw-r--r--core/variant_op.cpp16
-rw-r--r--demos/2d/area_input/box_area.pngbin0 -> 1246 bytes
-rw-r--r--demos/2d/area_input/circle_area.pngbin0 -> 3030 bytes
-rw-r--r--demos/2d/area_input/engine.cfg4
-rw-r--r--demos/2d/area_input/input.gd16
-rw-r--r--demos/2d/area_input/input.scnbin0 -> 2886 bytes
-rw-r--r--demos/2d/fog_of_war/.fscache11
-rw-r--r--demos/2d/fog_of_war/engine.cfg12
-rw-r--r--demos/2d/fog_of_war/floor.pngbin0 -> 572 bytes
-rw-r--r--demos/2d/fog_of_war/fog.gd86
-rw-r--r--demos/2d/fog_of_war/fog.pngbin0 -> 31448 bytes
-rw-r--r--demos/2d/fog_of_war/fog.scnbin0 -> 3714 bytes
-rw-r--r--demos/2d/fog_of_war/fog.xml29
-rw-r--r--demos/2d/fog_of_war/icon.pngbin0 -> 8681 bytes
-rw-r--r--demos/2d/fog_of_war/icon.png.flags1
-rw-r--r--demos/2d/fog_of_war/tile_edit.scnbin0 -> 1443 bytes
-rw-r--r--demos/2d/fog_of_war/troll.gd43
-rw-r--r--demos/2d/fog_of_war/troll.pngbin0 -> 7246 bytes
-rw-r--r--demos/2d/fog_of_war/troll.scnbin0 -> 1839 bytes
-rw-r--r--demos/2d/hdr/beach_cave.gd26
-rw-r--r--demos/2d/hdr/beach_cave.scnbin0 -> 2972 bytes
-rw-r--r--demos/2d/hdr/engine.cfg13
-rw-r--r--demos/2d/hdr/ocean_beach.pngbin0 -> 443558 bytes
-rw-r--r--demos/2d/hdr/ocean_beach.png.flags1
-rw-r--r--demos/2d/hdr/ocean_cave.pngbin0 -> 745215 bytes
-rw-r--r--demos/2d/hdr/ocean_cave.png.flags1
-rw-r--r--demos/2d/isometric/dungeon.scnbin4582 -> 4721 bytes
-rw-r--r--demos/2d/isometric_light/character_shder.resbin0 -> 1150 bytes
-rw-r--r--demos/2d/isometric_light/column.scnbin0 -> 1909 bytes
-rw-r--r--demos/2d/isometric_light/cubio.gd96
-rw-r--r--demos/2d/isometric_light/cubio.scnbin0 -> 6927 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0001.pngbin0 -> 7163 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0002.pngbin0 -> 7182 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0003.pngbin0 -> 7173 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0004.pngbin0 -> 7174 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0005.pngbin0 -> 7207 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0006.pngbin0 -> 7302 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0007.pngbin0 -> 7296 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0008.pngbin0 -> 7332 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0009.pngbin0 -> 7320 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0010.pngbin0 -> 7311 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0011.pngbin0 -> 7359 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0012.pngbin0 -> 7392 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0013.pngbin0 -> 7398 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0014.pngbin0 -> 7399 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0015.pngbin0 -> 7340 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0016.pngbin0 -> 7278 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0017.pngbin0 -> 7342 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0018.pngbin0 -> 7370 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0019.pngbin0 -> 7379 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0020.pngbin0 -> 7432 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0021.pngbin0 -> 7391 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0022.pngbin0 -> 7381 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0023.pngbin0 -> 7330 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0024.pngbin0 -> 7363 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0025.pngbin0 -> 7368 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0026.pngbin0 -> 7356 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0027.pngbin0 -> 7358 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0028.pngbin0 -> 7294 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0029.pngbin0 -> 7342 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0030.pngbin0 -> 7402 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0031.pngbin0 -> 7442 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0032.pngbin0 -> 7409 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0033.pngbin0 -> 7407 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0034.pngbin0 -> 7389 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0035.pngbin0 -> 7351 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0036.pngbin0 -> 7348 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0037.pngbin0 -> 7356 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0038.pngbin0 -> 7318 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0039.pngbin0 -> 7366 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0040.pngbin0 -> 7385 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0041.pngbin0 -> 7400 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0042.pngbin0 -> 7397 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0043.pngbin0 -> 7363 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0044.pngbin0 -> 7377 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0045.pngbin0 -> 7368 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0046.pngbin0 -> 7346 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0047.pngbin0 -> 7333 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0048.pngbin0 -> 7305 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0049.pngbin0 -> 7328 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0050.pngbin0 -> 7319 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0051.pngbin0 -> 7256 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0052.pngbin0 -> 7287 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0053.pngbin0 -> 7236 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0054.pngbin0 -> 7182 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0055.pngbin0 -> 7169 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0056.pngbin0 -> 7166 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0057.pngbin0 -> 7146 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0058.pngbin0 -> 7174 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0059.pngbin0 -> 7163 bytes
-rw-r--r--demos/2d/isometric_light/cubio/idle0060.pngbin0 -> 7163 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0001.pngbin0 -> 7027 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0002.pngbin0 -> 7234 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0003.pngbin0 -> 7658 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0004.pngbin0 -> 7999 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0005.pngbin0 -> 8086 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0006.pngbin0 -> 8004 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0007.pngbin0 -> 7759 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0008.pngbin0 -> 7485 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0009.pngbin0 -> 7066 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0010.pngbin0 -> 6925 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0011.pngbin0 -> 7003 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0012.pngbin0 -> 7316 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0013.pngbin0 -> 7607 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0014.pngbin0 -> 7924 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0015.pngbin0 -> 8000 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0016.pngbin0 -> 8025 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0017.pngbin0 -> 7918 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0018.pngbin0 -> 7532 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0019.pngbin0 -> 7247 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-b-0020.pngbin0 -> 7035 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0001.pngbin0 -> 7097 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0002.pngbin0 -> 7074 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0003.pngbin0 -> 7273 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0004.pngbin0 -> 7778 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0005.pngbin0 -> 7717 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0006.pngbin0 -> 8142 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0007.pngbin0 -> 8300 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0008.pngbin0 -> 8653 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0009.pngbin0 -> 8846 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0010.pngbin0 -> 8824 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0011.pngbin0 -> 8848 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0012.pngbin0 -> 8649 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0013.pngbin0 -> 8695 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0014.pngbin0 -> 8435 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0015.pngbin0 -> 8226 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0016.pngbin0 -> 7895 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0017.pngbin0 -> 7712 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0018.pngbin0 -> 7103 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0019.pngbin0 -> 7094 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-bl-0020.pngbin0 -> 7051 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0001.pngbin0 -> 8257 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0002.pngbin0 -> 7883 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0003.pngbin0 -> 6680 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0004.pngbin0 -> 6278 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0005.pngbin0 -> 6348 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0006.pngbin0 -> 5629 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0007.pngbin0 -> 6754 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0008.pngbin0 -> 7612 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0009.pngbin0 -> 8044 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0010.pngbin0 -> 8013 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0011.pngbin0 -> 7917 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0012.pngbin0 -> 7692 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0013.pngbin0 -> 6778 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0014.pngbin0 -> 6176 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0015.pngbin0 -> 6263 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0016.pngbin0 -> 6004 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0017.pngbin0 -> 6483 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0018.pngbin0 -> 7276 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0019.pngbin0 -> 7899 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-l-0020.pngbin0 -> 8119 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0001.pngbin0 -> 7095 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0002.pngbin0 -> 7064 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0003.pngbin0 -> 6854 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0004.pngbin0 -> 6801 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0005.pngbin0 -> 6900 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0006.pngbin0 -> 7017 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0007.pngbin0 -> 7128 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0008.pngbin0 -> 7065 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0009.pngbin0 -> 7000 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0010.pngbin0 -> 6980 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0011.pngbin0 -> 6978 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0012.pngbin0 -> 7139 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0013.pngbin0 -> 7191 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0014.pngbin0 -> 7119 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0015.pngbin0 -> 7051 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0016.pngbin0 -> 6995 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0017.pngbin0 -> 6832 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0018.pngbin0 -> 6962 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0019.pngbin0 -> 7049 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-u-0020.pngbin0 -> 7067 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0001.pngbin0 -> 8202 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0002.pngbin0 -> 8074 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0003.pngbin0 -> 7716 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0004.pngbin0 -> 7587 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0005.pngbin0 -> 7383 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0006.pngbin0 -> 7107 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0007.pngbin0 -> 6671 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0008.pngbin0 -> 6847 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0009.pngbin0 -> 6892 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0010.pngbin0 -> 6858 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0011.pngbin0 -> 7067 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0012.pngbin0 -> 6985 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0013.pngbin0 -> 6600 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0014.pngbin0 -> 7104 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0015.pngbin0 -> 7320 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0016.pngbin0 -> 7478 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0017.pngbin0 -> 7736 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0018.pngbin0 -> 7960 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0019.pngbin0 -> 7982 bytes
-rw-r--r--demos/2d/isometric_light/cubio/norm-ul-0020.pngbin0 -> 8137 bytes
-rw-r--r--demos/2d/isometric_light/energy.pngbin0 -> 6968 bytes
-rw-r--r--demos/2d/isometric_light/engine.cfg18
-rw-r--r--demos/2d/isometric_light/export.cfg262
-rw-r--r--demos/2d/isometric_light/faceColor.pngbin0 -> 47941 bytes
-rw-r--r--demos/2d/isometric_light/faceMask.pngbin0 -> 3106 bytes
-rw-r--r--demos/2d/isometric_light/faceNormal.pngbin0 -> 54844 bytes
-rw-r--r--demos/2d/isometric_light/fire.pngbin0 -> 8116 bytes
-rw-r--r--demos/2d/isometric_light/floor_shader.resbin0 -> 1026 bytes
-rw-r--r--demos/2d/isometric_light/light2.pngbin0 -> 3500 bytes
-rw-r--r--demos/2d/isometric_light/map.gd18
-rw-r--r--demos/2d/isometric_light/map.scnbin0 -> 8535 bytes
-rw-r--r--demos/2d/isometric_light/shadow_blob.pngbin0 -> 884 bytes
-rw-r--r--demos/2d/isometric_light/shoot.gd27
-rw-r--r--demos/2d/isometric_light/shoot.scnbin0 -> 4561 bytes
-rw-r--r--demos/2d/isometric_light/shoot_halo.pngbin0 -> 91312 bytes
-rw-r--r--demos/2d/isometric_light/tileset.resbin0 -> 2775 bytes
-rw-r--r--demos/2d/isometric_light/tileset_scene.scnbin0 -> 4812 bytes
-rw-r--r--demos/2d/isometric_light/torch.scnbin0 -> 4262 bytes
-rw-r--r--demos/2d/isometric_light/torch_light.pngbin0 -> 1262 bytes
-rw-r--r--demos/2d/isometric_light/torch_shader.resbin0 -> 741 bytes
-rw-r--r--demos/2d/isometric_light/wall_shader.resbin0 -> 1684 bytes
-rw-r--r--demos/2d/platformer/stage.xml35
-rw-r--r--demos/2d/screen_space_shaders/art/burano.jpgbin0 -> 246589 bytes
-rw-r--r--demos/2d/screen_space_shaders/art/burano.pngbin0 -> 974437 bytes
-rw-r--r--demos/2d/screen_space_shaders/art/filmgrain.pngbin0 -> 290595 bytes
-rw-r--r--demos/2d/screen_space_shaders/art/filmgrain.png.flags1
-rw-r--r--demos/2d/screen_space_shaders/art/forest.pngbin0 -> 1199433 bytes
-rw-r--r--demos/2d/screen_space_shaders/art/mountains.pngbin0 -> 927435 bytes
-rw-r--r--demos/2d/screen_space_shaders/art/platformer.pngbin0 -> 44102 bytes
-rw-r--r--demos/2d/screen_space_shaders/art/vignette.pngbin0 -> 4075 bytes
-rw-r--r--demos/2d/screen_space_shaders/art/white.pngbin0 -> 174 bytes
-rw-r--r--demos/2d/screen_space_shaders/engine.cfg4
-rw-r--r--demos/2d/screen_space_shaders/screen_shaders.gd32
-rw-r--r--demos/2d/screen_space_shaders/screen_shaders.scnbin0 -> 5762 bytes
-rw-r--r--demos/2d/sdf_font/KaushanScript-Regular.otfbin0 -> 89168 bytes
-rw-r--r--demos/2d/sdf_font/engine.cfg4
-rw-r--r--demos/2d/sdf_font/font.fntbin0 -> 180332 bytes
-rw-r--r--demos/2d/sdf_font/sdf.scnbin0 -> 2415 bytes
-rw-r--r--demos/2d/sprite_shaders/cubio.pngbin0 -> 26579 bytes
-rw-r--r--demos/2d/sprite_shaders/engine.cfg4
-rw-r--r--demos/2d/sprite_shaders/sprite_shaders.scnbin0 -> 4079 bytes
-rw-r--r--demos/2d/texscreen/bubble.pngbin0 -> 18619 bytes
-rw-r--r--demos/2d/texscreen/bubbles.gd17
-rw-r--r--demos/2d/texscreen/bubbles.scnbin0 -> 1456 bytes
-rw-r--r--demos/2d/texscreen/burano.pngbin0 -> 974437 bytes
-rw-r--r--demos/2d/texscreen/engine.cfg4
-rw-r--r--demos/2d/texscreen/lens.gd37
-rw-r--r--demos/2d/texscreen/lens.scnbin0 -> 1805 bytes
-rw-r--r--demos/gui/drag_and_drop/drag_and_drop.scnbin0 -> 2594 bytes
-rw-r--r--demos/gui/drag_and_drop/drag_drop_script.gd24
-rw-r--r--demos/gui/drag_and_drop/engine.cfg4
-rw-r--r--demos/viewport/gui_in_3d/gui_3d.gd49
-rw-r--r--demos/viewport/gui_in_3d/gui_3d.scnbin3498 -> 4668 bytes
-rw-r--r--doc/base/classes.xml29
-rw-r--r--drivers/etc1/rg_etc1.cpp2
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp134
-rw-r--r--drivers/gles2/rasterizer_gles2.h4
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp25
-rw-r--r--drivers/gles2/shaders/canvas.glsl190
-rw-r--r--drivers/trex/trex.c2
-rw-r--r--drivers/unix/dir_access_unix.cpp6
-rw-r--r--drivers/unix/dir_access_unix.h2
-rw-r--r--drivers/unix/file_access_unix.cpp2
-rw-r--r--drivers/vorbis/codebook.c2
-rw-r--r--drivers/vorbis/floor1.c2
-rw-r--r--drivers/windows/dir_access_windows.cpp11
-rw-r--r--drivers/windows/dir_access_windows.h1
-rw-r--r--drivers/windows/file_access_windows.cpp8
-rw-r--r--modules/gdscript/gd_functions.cpp2
-rw-r--r--modules/gdscript/gd_script.cpp3
-rw-r--r--platform/android/dir_access_android.cpp3
-rw-r--r--platform/android/dir_access_android.h1
-rw-r--r--platform/android/dir_access_jandroid.cpp3
-rw-r--r--platform/windows/detect.py208
-rw-r--r--platform/windows/os_windows.cpp1
-rw-r--r--scene/2d/area_2d.cpp261
-rw-r--r--scene/2d/area_2d.h37
-rw-r--r--scene/2d/back_buffer_copy.cpp75
-rw-r--r--scene/2d/back_buffer_copy.h41
-rw-r--r--scene/2d/canvas_item.cpp64
-rw-r--r--scene/2d/canvas_item.h1
-rw-r--r--scene/2d/collision_object_2d.cpp71
-rw-r--r--scene/2d/collision_object_2d.h12
-rw-r--r--scene/2d/light_2d.cpp43
-rw-r--r--scene/2d/light_2d.h8
-rw-r--r--scene/2d/light_occluder_2d.cpp5
-rw-r--r--scene/2d/node_2d.cpp49
-rw-r--r--scene/2d/node_2d.h8
-rw-r--r--scene/2d/particles_2d.cpp5
-rw-r--r--scene/2d/physics_body_2d.cpp1
-rw-r--r--scene/2d/tile_map.cpp309
-rw-r--r--scene/2d/tile_map.h41
-rw-r--r--scene/2d/visibility_notifier_2d.cpp22
-rw-r--r--scene/2d/visibility_notifier_2d.h1
-rw-r--r--scene/3d/camera.cpp18
-rw-r--r--scene/3d/camera.h2
-rw-r--r--scene/3d/spatial.cpp113
-rw-r--r--scene/3d/spatial.h15
-rw-r--r--scene/gui/base_button.cpp5
-rw-r--r--scene/gui/check_box.cpp79
-rw-r--r--scene/gui/check_box.h55
-rw-r--r--scene/gui/color_picker.cpp1
-rw-r--r--scene/gui/control.cpp84
-rw-r--r--scene/gui/file_dialog.cpp19
-rw-r--r--scene/gui/label.cpp4
-rw-r--r--scene/gui/text_edit.cpp53
-rw-r--r--scene/main/viewport.cpp71
-rw-r--r--scene/main/viewport.h1
-rw-r--r--scene/register_scene_types.cpp6
-rw-r--r--scene/resources/default_theme/default_theme.cpp38
-rw-r--r--scene/resources/default_theme/radio_checked.pngbin0 -> 569 bytes
-rw-r--r--scene/resources/default_theme/radio_unchecked.pngbin0 -> 421 bytes
-rw-r--r--scene/resources/default_theme/theme_data.h10
-rw-r--r--scene/resources/environment.cpp7
-rw-r--r--scene/resources/environment.h6
-rw-r--r--scene/resources/font.cpp21
-rw-r--r--scene/resources/font.h4
-rw-r--r--scene/resources/texture.cpp9
-rw-r--r--scene/resources/texture.h2
-rw-r--r--scene/resources/tile_set.cpp106
-rw-r--r--scene/resources/tile_set.h22
-rw-r--r--scene/resources/world.cpp6
-rw-r--r--scene/resources/world.h2
-rw-r--r--scene/resources/world_2d.cpp9
-rw-r--r--scene/resources/world_2d.h4
-rw-r--r--scene/scene_string_names.cpp6
-rw-r--r--scene/scene_string_names.h7
-rw-r--r--servers/physics/shape_sw.h2
-rw-r--r--servers/physics/space_sw.cpp2
-rw-r--r--servers/physics_2d/area_2d_sw.cpp71
-rw-r--r--servers/physics_2d/area_2d_sw.h34
-rw-r--r--servers/physics_2d/area_pair_2d_sw.cpp69
-rw-r--r--servers/physics_2d/area_pair_2d_sw.h18
-rw-r--r--servers/physics_2d/collision_object_2d_sw.cpp1
-rw-r--r--servers/physics_2d/collision_object_2d_sw.h4
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp33
-rw-r--r--servers/physics_2d/physics_2d_server_sw.h6
-rw-r--r--servers/physics_2d/shape_2d_sw.cpp63
-rw-r--r--servers/physics_2d/shape_2d_sw.h10
-rw-r--r--servers/physics_2d/space_2d_sw.cpp66
-rw-r--r--servers/physics_2d/space_2d_sw.h1
-rw-r--r--servers/physics_2d_server.cpp31
-rw-r--r--servers/physics_2d_server.h9
-rw-r--r--servers/visual/rasterizer.cpp2
-rw-r--r--servers/visual/rasterizer.h16
-rw-r--r--servers/visual/shader_language.cpp51
-rw-r--r--servers/visual/shader_language.h2
-rw-r--r--servers/visual/visual_server_raster.cpp164
-rw-r--r--servers/visual/visual_server_raster.h12
-rw-r--r--servers/visual/visual_server_wrap_mt.h6
-rw-r--r--servers/visual_server.h9
-rw-r--r--tools/editor/connections_dialog.cpp11
-rw-r--r--tools/editor/editor_dir_dialog.cpp22
-rw-r--r--tools/editor/editor_node.cpp5
-rw-r--r--tools/editor/editor_settings.cpp1
-rw-r--r--tools/editor/icons/icon_back_buffer_copy.pngbin0 -> 204 bytes
-rw-r--r--tools/editor/icons/icon_check_box.pngbin0 -> 344 bytes
-rw-r--r--tools/editor/io_plugins/editor_font_import_plugin.cpp347
-rw-r--r--tools/editor/io_plugins/editor_import_collada.cpp54
-rw-r--r--tools/editor/plugins/baked_light_baker.cpp2
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp101
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.h11
-rw-r--r--tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp1
-rw-r--r--tools/editor/plugins/light_occluder_2d_editor_plugin.cpp6
-rw-r--r--tools/editor/plugins/navigation_polygon_editor_plugin.cpp6
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp12
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp71
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.h2
-rw-r--r--tools/editor/plugins/theme_editor_plugin.cpp20
-rw-r--r--tools/editor/plugins/theme_editor_plugin.h2
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.cpp40
-rw-r--r--tools/editor/plugins/tile_set_editor_plugin.cpp170
-rw-r--r--tools/editor/plugins/tile_set_editor_plugin.h2
-rw-r--r--tools/editor/property_editor.cpp32
-rw-r--r--tools/script_plugins/time/time.gd4
376 files changed, 4499 insertions, 726 deletions
diff --git a/LICENSE.md b/LICENSE.md
index 122736f5f1..ca0a9702f7 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -21,3 +21,7 @@
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+**********************************************************************
+
diff --git a/bin/tests/test_string.cpp b/bin/tests/test_string.cpp
index 4aaddd8ac1..2a048f2f67 100644
--- a/bin/tests/test_string.cpp
+++ b/bin/tests/test_string.cpp
@@ -519,12 +519,13 @@ bool test_28() {
char output_format[] = "\tTest:\t%ls => %ls (%s)\n";
String format, output;
Array args;
+ bool error;
// %%
format = "fish %% frog";
args.clear();
- output = format.sprintf(args);
- success = (output == String("fish % frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish % frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -534,8 +535,8 @@ bool test_28() {
format = "fish %d frog";
args.clear();
args.push_back(5);
- output = format.sprintf(args);
- success = (output == String("fish 5 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 5 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -543,8 +544,8 @@ bool test_28() {
format = "fish %05d frog";
args.clear();
args.push_back(5);
- output = format.sprintf(args);
- success = (output == String("fish 00005 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 00005 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -552,8 +553,8 @@ bool test_28() {
format = "fish %5d frog";
args.clear();
args.push_back(5);
- output = format.sprintf(args);
- success = (output == String("fish 5 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 5 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -561,8 +562,8 @@ bool test_28() {
format = "fish %-5d frog";
args.clear();
args.push_back(5);
- output = format.sprintf(args);
- success = (output == String("fish 5 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 5 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -570,8 +571,8 @@ bool test_28() {
format = "fish %+d frog";
args.clear();
args.push_back(5);
- output = format.sprintf(args);
- success = (output == String("fish +5 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish +5 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -579,8 +580,8 @@ bool test_28() {
format = "fish %d frog";
args.clear();
args.push_back(-5);
- output = format.sprintf(args);
- success = (output == String("fish -5 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish -5 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -588,8 +589,8 @@ bool test_28() {
format = "fish %x frog";
args.clear();
args.push_back(45);
- output = format.sprintf(args);
- success = (output == String("fish 2d frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 2d frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -597,8 +598,8 @@ bool test_28() {
format = "fish %X frog";
args.clear();
args.push_back(45);
- output = format.sprintf(args);
- success = (output == String("fish 2D frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 2D frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -606,8 +607,8 @@ bool test_28() {
format = "fish %o frog";
args.clear();
args.push_back(99);
- output = format.sprintf(args);
- success = (output == String("fish 143 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 143 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -617,8 +618,8 @@ bool test_28() {
format = "fish %f frog";
args.clear();
args.push_back(99.99);
- output = format.sprintf(args);
- success = (output == String("fish 99.990000 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 99.990000 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -626,8 +627,8 @@ bool test_28() {
format = "fish %11f frog";
args.clear();
args.push_back(99.99);
- output = format.sprintf(args);
- success = (output == String("fish 99.990000 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 99.990000 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -635,8 +636,8 @@ bool test_28() {
format = "fish %-11f frog";
args.clear();
args.push_back(99.99);
- output = format.sprintf(args);
- success = (output == String("fish 99.990000 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 99.990000 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -644,8 +645,8 @@ bool test_28() {
format = "fish %f frog";
args.clear();
args.push_back(99);
- output = format.sprintf(args);
- success = (output == String("fish 99.000000 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 99.000000 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -653,8 +654,8 @@ bool test_28() {
format = "fish %+f frog";
args.clear();
args.push_back(99.99);
- output = format.sprintf(args);
- success = (output == String("fish +99.990000 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish +99.990000 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -662,8 +663,8 @@ bool test_28() {
format = "fish %.1f frog";
args.clear();
args.push_back(99.99);
- output = format.sprintf(args);
- success = (output == String("fish 100.0 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 100.0 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -671,8 +672,8 @@ bool test_28() {
format = "fish %.12f frog";
args.clear();
args.push_back(99.99);
- output = format.sprintf(args);
- success = (output == String("fish 99.990000000000 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 99.990000000000 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -680,8 +681,8 @@ bool test_28() {
format = "fish %.f frog";
args.clear();
args.push_back(99.99);
- output = format.sprintf(args);
- success = (output == String("fish 100 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 100 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -691,8 +692,8 @@ bool test_28() {
format = "fish %s frog";
args.clear();
args.push_back("cheese");
- output = format.sprintf(args);
- success = (output == String("fish cheese frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish cheese frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -700,8 +701,8 @@ bool test_28() {
format = "fish %10s frog";
args.clear();
args.push_back("cheese");
- output = format.sprintf(args);
- success = (output == String("fish cheese frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish cheese frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -709,8 +710,8 @@ bool test_28() {
format = "fish %-10s frog";
args.clear();
args.push_back("cheese");
- output = format.sprintf(args);
- success = (output == String("fish cheese frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish cheese frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -720,8 +721,8 @@ bool test_28() {
format = "fish %c frog";
args.clear();
args.push_back("A");
- output = format.sprintf(args);
- success = (output == String("fish A frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish A frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -729,8 +730,8 @@ bool test_28() {
format = "fish %c frog";
args.clear();
args.push_back(65);
- output = format.sprintf(args);
- success = (output == String("fish A frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish A frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -741,8 +742,8 @@ bool test_28() {
args.clear();
args.push_back(10);
args.push_back("cheese");
- output = format.sprintf(args);
- success = (output == String("fish cheese frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish cheese frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -751,8 +752,8 @@ bool test_28() {
args.clear();
args.push_back(10);
args.push_back(99);
- output = format.sprintf(args);
- success = (output == String("fish 99 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 99 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -762,8 +763,8 @@ bool test_28() {
args.push_back(10);
args.push_back(3);
args.push_back(99.99);
- output = format.sprintf(args);
- success = (output == String("fish 99.990 frog"));
+ output = format.sprintf(args, &error);
+ success = (output == String("fish 99.990 frog") && !error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -773,8 +774,8 @@ bool test_28() {
format = "fish %s %s frog";
args.clear();
args.push_back("cheese");
- output = format.sprintf(args);
- success = (output == "");
+ output = format.sprintf(args, &error);
+ success = (output == "not enough arguments for format string" && error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -783,8 +784,8 @@ bool test_28() {
args.clear();
args.push_back("hello");
args.push_back("cheese");
- output = format.sprintf(args);
- success = (output == "");
+ output = format.sprintf(args, &error);
+ success = (output == "not all arguments converted during string formatting" && error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -792,8 +793,8 @@ bool test_28() {
format = "fish %10";
args.clear();
args.push_back("cheese");
- output = format.sprintf(args);
- success = (output == "");
+ output = format.sprintf(args, &error);
+ success = (output == "incomplete format" && error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -801,8 +802,8 @@ bool test_28() {
format = "fish %&f frog";
args.clear();
args.push_back("cheese");
- output = format.sprintf(args);
- success = (output == "");
+ output = format.sprintf(args, &error);
+ success = (output == "unsupported format character" && error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -810,8 +811,8 @@ bool test_28() {
format = "fish %2.2.2f frog";
args.clear();
args.push_back(99.99);
- output = format.sprintf(args);
- success = (output == "");
+ output = format.sprintf(args, &error);
+ success = (output == "too many decimal points in format" && error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -820,8 +821,8 @@ bool test_28() {
args.clear();
args.push_back("cheese");
args.push_back(99.99);
- output = format.sprintf(args);
- success = (output == "");
+ output = format.sprintf(args, &error);
+ success = (output == "* wants number" && error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -829,8 +830,8 @@ bool test_28() {
format = "fish %c frog";
args.clear();
args.push_back("sc");
- output = format.sprintf(args);
- success = (output == "");
+ output = format.sprintf(args, &error);
+ success = (output == "%c requires number or single-character string" && error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
@@ -838,8 +839,8 @@ bool test_28() {
format = "fish %c frog";
args.clear();
args.push_back(Array());
- output = format.sprintf(args);
- success = (output == "");
+ output = format.sprintf(args, &error);
+ success = (output == "%c requires number or single-character string" && error);
OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
diff --git a/core/global_constants.cpp b/core/global_constants.cpp
index ae4abc627d..fc48a105db 100644
--- a/core/global_constants.cpp
+++ b/core/global_constants.cpp
@@ -313,6 +313,7 @@ static _GlobalConstant _global_constants[]={
BIND_GLOBAL_CONSTANT( KEY_MASK_ALT ),
BIND_GLOBAL_CONSTANT( KEY_MASK_META ),
BIND_GLOBAL_CONSTANT( KEY_MASK_CTRL ),
+ BIND_GLOBAL_CONSTANT( KEY_MASK_CMD ),
BIND_GLOBAL_CONSTANT( KEY_MASK_KPAD ),
BIND_GLOBAL_CONSTANT( KEY_MASK_GROUP_SWITCH ),
diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp
index 6e03819aac..afbd7e3d46 100644
--- a/core/io/file_access_pack.cpp
+++ b/core/io/file_access_pack.cpp
@@ -362,6 +362,10 @@ bool DirAccessPack::current_is_dir() const{
return cdir;
}
+bool DirAccessPack::current_is_hidden() const{
+
+ return false;
+}
void DirAccessPack::list_dir_end() {
list_dirs.clear();
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 5fcc79aaf4..2d0cf5b32e 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -208,6 +208,7 @@ public:
virtual bool list_dir_begin();
virtual String get_next();
virtual bool current_is_dir() const;
+ virtual bool current_is_hidden() const;
virtual void list_dir_end();
virtual int get_drive_count();
diff --git a/core/math/geometry.h b/core/math/geometry.h
index 7e0cc01a22..4ad4db8523 100644
--- a/core/math/geometry.h
+++ b/core/math/geometry.h
@@ -519,9 +519,9 @@ public:
bool s_ab = (b.x-a.x)*as_y-(b.y-a.y)*as_x > 0;
- if((c.x-a.x)*as_y-(c.y-a.y)*as_x > 0 == s_ab) return false;
+ if(((c.x-a.x)*as_y-(c.y-a.y)*as_x > 0) == s_ab) return false;
- if((c.x-b.x)*(s.y-b.y)-(c.y-b.y)*(s.x-b.x) > 0 != s_ab) return false;
+ if(((c.x-b.x)*(s.y-b.y)-(c.y-b.y)*(s.x-b.x) > 0) != s_ab) return false;
return true;
}
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index d8672218bd..dc56f2308e 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -78,6 +78,7 @@ public:
virtual String get_next(bool* p_is_dir); // compatibility
virtual String get_next()=0;
virtual bool current_is_dir() const=0;
+ virtual bool current_is_hidden() const=0;
virtual void list_dir_end()=0; ///<
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 476ab3f936..497e8f29ed 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -482,7 +482,7 @@ void String::erase(int p_pos, int p_chars) {
String String::capitalize() const {
- String aux=this->replace("_"," ").to_lower();
+ String aux=this->camelcase_to_underscore().replace("_"," ").to_lower();
String cap;
for (int i=0;i<aux.get_slice_count(" ");i++) {
@@ -498,6 +498,29 @@ String String::capitalize() const {
return cap;
}
+
+
+String String::camelcase_to_underscore() const {
+ const CharType * cstr = c_str();
+ String newString;
+ const char A = 'A', Z = 'Z';
+ int startIndex = 0;
+
+ for ( int i = 1; i < this->size()-1; i++ ) {
+ bool isCapital = cstr[i] >= A && cstr[i] <= Z;
+
+ if ( isCapital ) {
+ newString += "_" + this->substr(startIndex, i-startIndex);
+ startIndex = i;
+ }
+ }
+
+ newString += "_" + this->substr(startIndex, this->size()-startIndex);
+
+ return newString;
+}
+
+
int String::get_slice_count(String p_splitter) const{
if (empty())
@@ -3550,8 +3573,8 @@ String String::lpad(int min_length, const String& character) const {
// sprintf is implemented in GDScript via:
// "fish %s pie" % "frog"
// "fish %s %d pie" % ["frog", 12]
-String String::sprintf(const Array& values) const {
-
+// In case of an error, the string returned is the error description and "error" is true.
+String String::sprintf(const Array& values, bool* error) const {
String formatted;
CharType* self = (CharType*)c_str();
int num_items = values.size();
@@ -3564,6 +3587,7 @@ String String::sprintf(const Array& values) const {
bool left_justified;
bool show_sign;
+ *error = true;
for (; *self; self++) {
const CharType c = *self;
@@ -3580,13 +3604,11 @@ String String::sprintf(const Array& values) const {
case 'x': // Hexadecimal (lowercase)
case 'X': { // Hexadecimal (uppercase)
if (value_index >= values.size()) {
- ERR_EXPLAIN("not enough arguments for format string");
- ERR_FAIL_V("");
+ return "not enough arguments for format string";
}
if (!values[value_index].is_num()) {
- ERR_EXPLAIN("a number is required");
- ERR_FAIL_V("");
+ return "a number is required";
}
int64_t value = values[value_index];
@@ -3622,13 +3644,11 @@ String String::sprintf(const Array& values) const {
}
case 'f': { // Float
if (value_index >= values.size()) {
- ERR_EXPLAIN("not enough arguments for format string");
- ERR_FAIL_V("");
+ return "not enough arguments for format string";
}
if (!values[value_index].is_num()) {
- ERR_EXPLAIN("a number is required");
- ERR_FAIL_V("");
+ return "a number is required";
}
double value = values[value_index];
@@ -3657,8 +3677,7 @@ String String::sprintf(const Array& values) const {
}
case 's': { // String
if (value_index >= values.size()) {
- ERR_EXPLAIN("not enough arguments for format string");
- ERR_FAIL_V("");
+ return "not enough arguments for format string";
}
String str = values[value_index];
@@ -3676,8 +3695,7 @@ String String::sprintf(const Array& values) const {
}
case 'c': {
if (value_index >= values.size()) {
- ERR_EXPLAIN("not enough arguments for format string");
- ERR_FAIL_V("");
+ return "not enough arguments for format string";
}
// Convert to character.
@@ -3685,22 +3703,18 @@ String String::sprintf(const Array& values) const {
if (values[value_index].is_num()) {
int value = values[value_index];
if (value < 0) {
- ERR_EXPLAIN("unsigned byte integer is lower than maximum")
- ERR_FAIL_V("");
+ return "unsigned byte integer is lower than maximum";
} else if (value > 255) {
- ERR_EXPLAIN("unsigned byte integer is greater than maximum")
- ERR_FAIL_V("");
+ return "unsigned byte integer is greater than maximum";
}
str = chr(values[value_index]);
} else if (values[value_index].get_type() == Variant::STRING) {
str = values[value_index];
if (str.length() != 1) {
- ERR_EXPLAIN("%c requires number or single-character string");
- ERR_FAIL_V("");
+ return "%c requires number or single-character string";
}
} else {
- ERR_EXPLAIN("%c requires number or single-character string");
- ERR_FAIL_V("");
+ return "%c requires number or single-character string";
}
// Padding.
@@ -3741,8 +3755,7 @@ String String::sprintf(const Array& values) const {
}
case '.': { // Float separtor.
if (in_decimals) {
- ERR_EXPLAIN("too many decimal points in format");
- ERR_FAIL_V("");
+ return "too many decimal points in format";
}
in_decimals = true;
min_decimals = 0; // We want to add the value manually.
@@ -3751,13 +3764,11 @@ String String::sprintf(const Array& values) const {
case '*': { // Dyanmic width, based on value.
if (value_index >= values.size()) {
- ERR_EXPLAIN("not enough arguments for format string");
- ERR_FAIL_V("");
+ return "not enough arguments for format string";
}
if (!values[value_index].is_num()) {
- ERR_EXPLAIN("* wants number");
- ERR_FAIL_V("");
+ return "* wants number";
}
int size = values[value_index];
@@ -3773,8 +3784,7 @@ String String::sprintf(const Array& values) const {
}
default: {
- ERR_EXPLAIN("unsupported format character");
- ERR_FAIL_V("");
+ return "unsupported format character";
}
}
} else { // Not in format string.
@@ -3796,14 +3806,13 @@ String String::sprintf(const Array& values) const {
}
if (in_format) {
- ERR_EXPLAIN("incomplete format");
- ERR_FAIL_V("");
+ return "incomplete format";
}
if (value_index != values.size()) {
- ERR_EXPLAIN("not all arguments converted during string formatting");
- ERR_FAIL_V("");
+ return "not all arguments converted during string formatting";
}
+ *error = false;
return formatted;
}
diff --git a/core/ustring.h b/core/ustring.h
index af5ffb7c35..f79e5ce306 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -130,7 +130,7 @@ public:
String pad_zeros(int p_digits) const;
String lpad(int min_length,const String& character=" ") const;
String rpad(int min_length,const String& character=" ") const;
- String sprintf(const Array& values) const;
+ String sprintf(const Array& values, bool* error) const;
static String num(double p_num,int p_decimals=-1);
static String num_scientific(double p_num);
static String num_real(double p_num);
@@ -149,6 +149,7 @@ public:
static double to_double(const CharType* p_str, const CharType **r_end=NULL);
static int64_t to_int(const CharType* p_str,int p_len=-1);
String capitalize() const;
+ String camelcase_to_underscore() const;
int get_slice_count(String p_splitter) const;
String get_slice(String p_splitter,int p_slice) const;
@@ -225,8 +226,6 @@ public:
String(const char *p_str);
String(const CharType *p_str,int p_clip_to_len=-1);
String(const StrRange& p_range);
-
-
};
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 50a60390e5..c6b498ff28 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -511,7 +511,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM1(ColorArray,append_array);
#define VCALL_PTR0(m_type,m_method)\
-static void _call_##m_type##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(); }
+static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(); }
#define VCALL_PTR0R(m_type,m_method)\
static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(); }
#define VCALL_PTR1(m_type,m_method)\
@@ -519,7 +519,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
#define VCALL_PTR1R(m_type,m_method)\
static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0]); }
#define VCALL_PTR2(m_type,m_method)\
-static void _call_##m_type##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1]); }
+static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1]); }
#define VCALL_PTR2R(m_type,m_method)\
static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1]); }
#define VCALL_PTR3(m_type,m_method)\
@@ -531,7 +531,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
#define VCALL_PTR4R(m_type,m_method)\
static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1],*p_args[2],*p_args[3]); }
#define VCALL_PTR5(m_type,m_method)\
-static void _call_##m_type##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1],*p_args[2],*p_args[3],*p_args[4]); }
+static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1],*p_args[2],*p_args[3],*p_args[4]); }
#define VCALL_PTR5R(m_type,m_method)\
static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1],*p_args[2],*p_args[3],*p_args[4]); }
@@ -685,7 +685,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_PTR0R( InputEvent, is_pressed );
VCALL_PTR1R( InputEvent, is_action );
VCALL_PTR0R( InputEvent, is_echo );
- //VCALL_PTR2( InputEvent, set_as_action );
+ VCALL_PTR2( InputEvent, set_as_action );
struct ConstructData {
@@ -1496,7 +1496,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_pressed,varray());
ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action,STRING,"action",varray());
ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_echo,varray());
- //ADDFUNC2(INPUT_EVENT,NIL,InputEvent,set_as_action,STRING,"action",BOOL,"pressed",varray());
+ ADDFUNC2(INPUT_EVENT,NIL,InputEvent,set_as_action,STRING,"action",BOOL,"pressed",varray());
/* REGISTER CONSTRUCTORS */
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index d6129e150c..87d9738b06 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -741,18 +741,22 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
_RETURN( p_a._data._int % p_b._data._int );
} else if (p_a.type==STRING) {
- const String *str=reinterpret_cast<const String*>(p_a._data._mem);
+ const String* format=reinterpret_cast<const String*>(p_a._data._mem);
+ String result;
+ bool error;
if (p_b.type==ARRAY) {
// e.g. "frog %s %d" % ["fish", 12]
- const Array *arr=reinterpret_cast<const Array*>(p_b._data._mem);
- _RETURN(str->sprintf(*arr));
+ const Array* args=reinterpret_cast<const Array*>(p_b._data._mem);
+ result=format->sprintf(*args, &error);
} else {
// e.g. "frog %d" % 12
- Array arr;
- arr.push_back(p_b);
- _RETURN(str->sprintf(arr));
+ Array args;
+ args.push_back(p_b);
+ result=format->sprintf(args, &error);
}
+ r_valid = !error;
+ _RETURN(result);
}
r_valid=false;
diff --git a/demos/2d/area_input/box_area.png b/demos/2d/area_input/box_area.png
new file mode 100644
index 0000000000..ba7c37f7de
--- /dev/null
+++ b/demos/2d/area_input/box_area.png
Binary files differ
diff --git a/demos/2d/area_input/circle_area.png b/demos/2d/area_input/circle_area.png
new file mode 100644
index 0000000000..3cc24c8a0c
--- /dev/null
+++ b/demos/2d/area_input/circle_area.png
Binary files differ
diff --git a/demos/2d/area_input/engine.cfg b/demos/2d/area_input/engine.cfg
new file mode 100644
index 0000000000..3227e9278f
--- /dev/null
+++ b/demos/2d/area_input/engine.cfg
@@ -0,0 +1,4 @@
+[application]
+
+name="Area 2D Input Events"
+main_scene="res://input.scn"
diff --git a/demos/2d/area_input/input.gd b/demos/2d/area_input/input.gd
new file mode 100644
index 0000000000..3f719fc853
--- /dev/null
+++ b/demos/2d/area_input/input.gd
@@ -0,0 +1,16 @@
+
+extends Area2D
+
+#virtual from CollisionObject2D (also available as signal)
+func _input_event(viewport, event, shape_idx):
+ #convert event to local coordinates
+ if (event.type==InputEvent.MOUSE_MOTION):
+ event = make_input_local( event )
+ get_node("label").set_text(str(event.pos))
+
+#virtual from CollisionObject2D (also available as signal)
+func _mouse_exit():
+ get_node("label").set_text("")
+
+
+
diff --git a/demos/2d/area_input/input.scn b/demos/2d/area_input/input.scn
new file mode 100644
index 0000000000..1a2dcbc5f4
--- /dev/null
+++ b/demos/2d/area_input/input.scn
Binary files differ
diff --git a/demos/2d/fog_of_war/.fscache b/demos/2d/fog_of_war/.fscache
new file mode 100644
index 0000000000..ba5e3995f3
--- /dev/null
+++ b/demos/2d/fog_of_war/.fscache
@@ -0,0 +1,11 @@
+::res://::1422910453
+floor.png::ImageTexture::1422910453::
+fog.gd::GDScript::1422910025::
+fog.png::ImageTexture::1422908128::
+fog.scn::PackedScene::1422909435::
+fog.xml::TileSet::1422909324::
+icon.png::ImageTexture::1422811193::
+tile_edit.scn::PackedScene::1422909313::
+troll.gd::GDScript::1422909940::
+troll.png::ImageTexture::1418669358::
+troll.scn::PackedScene::1418669358::
diff --git a/demos/2d/fog_of_war/engine.cfg b/demos/2d/fog_of_war/engine.cfg
new file mode 100644
index 0000000000..5c4307b5bc
--- /dev/null
+++ b/demos/2d/fog_of_war/engine.cfg
@@ -0,0 +1,12 @@
+[application]
+
+name="Fog of War"
+main_scene="res://fog.scn"
+icon="icon.png"
+
+[input]
+
+move_up=[key(Up)]
+move_bottom=[key(Down)]
+move_left=[key(Left)]
+move_right=[key(Right)]
diff --git a/demos/2d/fog_of_war/floor.png b/demos/2d/fog_of_war/floor.png
new file mode 100644
index 0000000000..07b4f8c98f
--- /dev/null
+++ b/demos/2d/fog_of_war/floor.png
Binary files differ
diff --git a/demos/2d/fog_of_war/fog.gd b/demos/2d/fog_of_war/fog.gd
new file mode 100644
index 0000000000..9da5680e4d
--- /dev/null
+++ b/demos/2d/fog_of_war/fog.gd
@@ -0,0 +1,86 @@
+
+extends TileMap
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+
+# boundarys for the fog rectangle
+var x_min = -20 # left start tile
+var x_max = 20 # right end tile
+var y_min = -20 # top start tile
+var y_max = 20 # bottom end tile
+
+var position # players position
+
+# iteration variables
+var x
+var y
+
+# variable to check if player moved
+var x_old
+var y_old
+
+# array to build up the visible area like a square
+# first value determines the width/height of the tip
+# here it would be 2*2 + 1 = 5 tiles wide/high
+# second value determines the total squares size
+# here it would be 5*2 + 1 = 10 tiles wide/high
+var l = range(2,5)
+
+# process that runs in realtime
+func _fixed_process(delta):
+ position = get_node("../troll").get_pos()
+
+ # calculate the corresponding tile
+ # from the players position
+ x = int(position.x/get_cell_size().x)
+ # switching from positive to negative tile positions
+ # causes problems because of rounding problems
+ if position.x < 0:
+ x -= 1 # correct negative values
+
+ y = int(position.y/get_cell_size().y)
+ if position.y < 0:
+ y -= 1
+
+ # check if the player moved one tile further
+ if (x_old != x) or (y_old != y):
+
+ # create the transparent part (visited area)
+ var end = l.size()-1
+ var start = 0
+ for steps in range(l.size()):
+ for m in range(x-l[end]-1,x+l[end]+2):
+ for n in range(y-l[start]-1,y+l[start]+2):
+ if get_cell(m,n) != 0:
+ set_cell(m,n,1,0,0)
+ end -= 1
+ start += 1
+
+ # create the actual and active visible part
+ var end = l.size()-1
+ var start = 0
+ for steps in range(l.size()):
+ for m in range(x-l[end],x+l[end]+1):
+ for n in range(y-l[start],y+l[start]+1):
+ set_cell(m,n,-1)
+ end -= 1
+ start += 1
+
+ x_old = x
+ y_old = y
+
+ pass
+
+func _ready():
+ # Initalization here
+
+ # create a square filled with the 100% opaque fog
+ for x in range(x_min,x_max):
+ for y in range(y_min,y_max):
+ set_cell(x,y,0,0,0)
+ set_fixed_process(true)
+ pass
+
+
diff --git a/demos/2d/fog_of_war/fog.png b/demos/2d/fog_of_war/fog.png
new file mode 100644
index 0000000000..56980c298d
--- /dev/null
+++ b/demos/2d/fog_of_war/fog.png
Binary files differ
diff --git a/demos/2d/fog_of_war/fog.scn b/demos/2d/fog_of_war/fog.scn
new file mode 100644
index 0000000000..4987f1ead5
--- /dev/null
+++ b/demos/2d/fog_of_war/fog.scn
Binary files differ
diff --git a/demos/2d/fog_of_war/fog.xml b/demos/2d/fog_of_war/fog.xml
new file mode 100644
index 0000000000..ed08d84a1f
--- /dev/null
+++ b/demos/2d/fog_of_war/fog.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<resource_file type="TileSet" subresource_count="3" version="1.0" version_name="Godot Engine v1.0.stable.custom_build">
+ <ext_resource path="res://floor.png" type="Texture"></ext_resource>
+ <ext_resource path="res://fog.png" type="Texture"></ext_resource>
+ <main_resource>
+ <string name="0/name"> "fog opaque" </string>
+ <resource name="0/texture" resource_type="Texture" path="res://fog.png"> </resource>
+ <vector2 name="0/tex_offset"> -48, -48 </vector2>
+ <vector2 name="0/shape_offset"> 0, 0 </vector2>
+ <rect2 name="0/region"> 0, 0, 144, 144 </rect2>
+ <array name="0/shapes" len="0" shared="false">
+ </array>
+ <string name="1/name"> "fog transparent" </string>
+ <resource name="1/texture" resource_type="Texture" path="res://fog.png"> </resource>
+ <vector2 name="1/tex_offset"> -48, -48 </vector2>
+ <vector2 name="1/shape_offset"> 0, 0 </vector2>
+ <rect2 name="1/region"> 144, 0, 144, 144 </rect2>
+ <array name="1/shapes" len="0" shared="false">
+ </array>
+ <string name="2/name"> "floor" </string>
+ <resource name="2/texture" resource_type="Texture" path="res://floor.png"> </resource>
+ <vector2 name="2/tex_offset"> 0, 0 </vector2>
+ <vector2 name="2/shape_offset"> 0, 0 </vector2>
+ <rect2 name="2/region"> 0, 0, 0, 0 </rect2>
+ <array name="2/shapes" len="0" shared="false">
+ </array>
+
+ </main_resource>
+</resource_file> \ No newline at end of file
diff --git a/demos/2d/fog_of_war/icon.png b/demos/2d/fog_of_war/icon.png
new file mode 100644
index 0000000000..a483390048
--- /dev/null
+++ b/demos/2d/fog_of_war/icon.png
Binary files differ
diff --git a/demos/2d/fog_of_war/icon.png.flags b/demos/2d/fog_of_war/icon.png.flags
new file mode 100644
index 0000000000..dbef2209e8
--- /dev/null
+++ b/demos/2d/fog_of_war/icon.png.flags
@@ -0,0 +1 @@
+gen_mipmaps=true
diff --git a/demos/2d/fog_of_war/tile_edit.scn b/demos/2d/fog_of_war/tile_edit.scn
new file mode 100644
index 0000000000..aaca19d370
--- /dev/null
+++ b/demos/2d/fog_of_war/tile_edit.scn
Binary files differ
diff --git a/demos/2d/fog_of_war/troll.gd b/demos/2d/fog_of_war/troll.gd
new file mode 100644
index 0000000000..d118d3a2ba
--- /dev/null
+++ b/demos/2d/fog_of_war/troll.gd
@@ -0,0 +1,43 @@
+
+extends KinematicBody2D
+
+# This is a simple collision demo showing how
+# the kinematic cotroller works.
+# move() will allow to move the node, and will
+# always move it to a non-colliding spot,
+# as long as it starts from a non-colliding spot too.
+
+
+#pixels / second
+const MOTION_SPEED=160
+
+func _fixed_process(delta):
+
+ var motion = Vector2()
+
+ if (Input.is_action_pressed("move_up")):
+ motion+=Vector2(0,-1)
+ if (Input.is_action_pressed("move_bottom")):
+ motion+=Vector2(0,1)
+ if (Input.is_action_pressed("move_left")):
+ motion+=Vector2(-1,0)
+ if (Input.is_action_pressed("move_right")):
+ motion+=Vector2(1,0)
+
+ motion = motion.normalized() * MOTION_SPEED * delta
+ motion = move(motion)
+
+ #make character slide nicely through the world
+ var slide_attempts = 4
+ while(is_colliding() and slide_attempts>0):
+ motion = get_collision_normal().slide(motion)
+ motion=move(motion)
+ slide_attempts-=1
+
+
+func _ready():
+ # Initalization here
+ set_fixed_process(true)
+ pass
+
+
diff --git a/demos/2d/fog_of_war/troll.png b/demos/2d/fog_of_war/troll.png
new file mode 100644
index 0000000000..69f195d034
--- /dev/null
+++ b/demos/2d/fog_of_war/troll.png
Binary files differ
diff --git a/demos/2d/fog_of_war/troll.scn b/demos/2d/fog_of_war/troll.scn
new file mode 100644
index 0000000000..f5d87c3631
--- /dev/null
+++ b/demos/2d/fog_of_war/troll.scn
Binary files differ
diff --git a/demos/2d/hdr/beach_cave.gd b/demos/2d/hdr/beach_cave.gd
new file mode 100644
index 0000000000..9dffbc4662
--- /dev/null
+++ b/demos/2d/hdr/beach_cave.gd
@@ -0,0 +1,26 @@
+
+extends Node2D
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+const CAVE_LIMIT=1000
+
+func _input(ev):
+ if (ev.type==InputEvent.MOUSE_MOTION and ev.button_mask&1):
+ var rel_x = ev.relative_x
+ var cavepos = get_node("cave").get_pos()
+ cavepos.x+=rel_x
+ if (cavepos.x<-CAVE_LIMIT):
+ cavepos.x=-CAVE_LIMIT
+ elif (cavepos.x>0):
+ cavepos.x=0
+ get_node("cave").set_pos(cavepos)
+
+
+func _ready():
+ set_process_input(true)
+ # Initialization here
+ pass
+
+
diff --git a/demos/2d/hdr/beach_cave.scn b/demos/2d/hdr/beach_cave.scn
new file mode 100644
index 0000000000..4147a130ad
--- /dev/null
+++ b/demos/2d/hdr/beach_cave.scn
Binary files differ
diff --git a/demos/2d/hdr/engine.cfg b/demos/2d/hdr/engine.cfg
new file mode 100644
index 0000000000..3d8b4222d5
--- /dev/null
+++ b/demos/2d/hdr/engine.cfg
@@ -0,0 +1,13 @@
+[application]
+
+name="HDR for 2D"
+main_scene="res://beach_cave.scn"
+
+[display]
+
+width=1080
+height=720
+
+[rasterizer]
+
+blur_buffer_size=128
diff --git a/demos/2d/hdr/ocean_beach.png b/demos/2d/hdr/ocean_beach.png
new file mode 100644
index 0000000000..a873d4f61d
--- /dev/null
+++ b/demos/2d/hdr/ocean_beach.png
Binary files differ
diff --git a/demos/2d/hdr/ocean_beach.png.flags b/demos/2d/hdr/ocean_beach.png.flags
new file mode 100644
index 0000000000..82127bd7d5
--- /dev/null
+++ b/demos/2d/hdr/ocean_beach.png.flags
@@ -0,0 +1 @@
+tolinear=true
diff --git a/demos/2d/hdr/ocean_cave.png b/demos/2d/hdr/ocean_cave.png
new file mode 100644
index 0000000000..8875499df3
--- /dev/null
+++ b/demos/2d/hdr/ocean_cave.png
Binary files differ
diff --git a/demos/2d/hdr/ocean_cave.png.flags b/demos/2d/hdr/ocean_cave.png.flags
new file mode 100644
index 0000000000..82127bd7d5
--- /dev/null
+++ b/demos/2d/hdr/ocean_cave.png.flags
@@ -0,0 +1 @@
+tolinear=true
diff --git a/demos/2d/isometric/dungeon.scn b/demos/2d/isometric/dungeon.scn
index 76532a44aa..58c530d5c5 100644
--- a/demos/2d/isometric/dungeon.scn
+++ b/demos/2d/isometric/dungeon.scn
Binary files differ
diff --git a/demos/2d/isometric_light/character_shder.res b/demos/2d/isometric_light/character_shder.res
new file mode 100644
index 0000000000..ca221f766c
--- /dev/null
+++ b/demos/2d/isometric_light/character_shder.res
Binary files differ
diff --git a/demos/2d/isometric_light/column.scn b/demos/2d/isometric_light/column.scn
new file mode 100644
index 0000000000..f0b7683885
--- /dev/null
+++ b/demos/2d/isometric_light/column.scn
Binary files differ
diff --git a/demos/2d/isometric_light/cubio.gd b/demos/2d/isometric_light/cubio.gd
new file mode 100644
index 0000000000..30c766936c
--- /dev/null
+++ b/demos/2d/isometric_light/cubio.gd
@@ -0,0 +1,96 @@
+
+extends KinematicBody2D
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+
+const MAX_SPEED = 300.0
+const IDLE_SPEED = 10.0
+const ACCEL=5.0
+const VSCALE=0.5
+const SHOOT_INTERVAL=0.3
+
+var speed=Vector2()
+var current_anim=""
+var current_mirror=false
+
+var shoot_countdown=0
+
+func _input(ev):
+ if (ev.type==InputEvent.MOUSE_BUTTON and ev.button_index==1 and ev.pressed and shoot_countdown<=0):
+ var pos = get_canvas_transform().affine_inverse() * ev.pos
+ var dir = (pos-get_global_pos()).normalized()
+ var bullet = preload("res://shoot.scn").instance()
+ bullet.advance_dir=dir
+ bullet.set_pos( get_global_pos() + dir * 60 )
+ get_parent().add_child(bullet)
+ shoot_countdown=SHOOT_INTERVAL
+
+
+
+
+func _fixed_process(delta):
+
+ shoot_countdown-=delta
+ var dir = Vector2()
+ if (Input.is_action_pressed("up")):
+ dir+=Vector2(0,-1)
+ if (Input.is_action_pressed("down")):
+ dir+=Vector2(0,1)
+ if (Input.is_action_pressed("left")):
+ dir+=Vector2(-1,0)
+ if (Input.is_action_pressed("right")):
+ dir+=Vector2(1,0)
+
+ if (dir!=Vector2()):
+ dir=dir.normalized()
+ speed = speed.linear_interpolate(dir*MAX_SPEED,delta*ACCEL)
+ var motion = speed * delta
+ motion.y*=VSCALE
+ motion=move(motion)
+
+ if (is_colliding()):
+ var n = get_collision_normal()
+ motion=n.slide(motion)
+ move(motion)
+
+ var next_anim=""
+ var next_mirror=false
+
+ if (dir==Vector2() and speed.length()<IDLE_SPEED):
+ next_anim="idle"
+ next_mirror=false
+ elif (speed.length()>IDLE_SPEED*0.1):
+ var angle = atan2(abs(speed.x),speed.y)
+
+ next_mirror = speed.x>0
+ if (angle<PI/8):
+ next_anim="bottom"
+ next_mirror=false
+ elif (angle<PI/4+PI/8):
+ next_anim="bottom_left"
+ elif (angle<PI*2/4+PI/8):
+ next_anim="left"
+ elif (angle<PI*3/4+PI/8):
+ next_anim="top_left"
+ else:
+ next_anim="top"
+ next_mirror=false
+
+
+ if (next_anim!=current_anim or next_mirror!=current_mirror):
+ get_node("frames").set_flip_h(next_mirror)
+ get_node("anim").play(next_anim)
+ current_anim=next_anim
+ current_mirror=next_mirror
+
+
+
+func _ready():
+ # Initialization here
+ set_fixed_process(true)
+ set_process_input(true)
+ pass
+
+
diff --git a/demos/2d/isometric_light/cubio.scn b/demos/2d/isometric_light/cubio.scn
new file mode 100644
index 0000000000..c8ab7ddd4e
--- /dev/null
+++ b/demos/2d/isometric_light/cubio.scn
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0001.png b/demos/2d/isometric_light/cubio/idle0001.png
new file mode 100644
index 0000000000..837dd38f9c
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0001.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0002.png b/demos/2d/isometric_light/cubio/idle0002.png
new file mode 100644
index 0000000000..6137a37a9d
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0002.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0003.png b/demos/2d/isometric_light/cubio/idle0003.png
new file mode 100644
index 0000000000..7f3e3e0e31
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0003.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0004.png b/demos/2d/isometric_light/cubio/idle0004.png
new file mode 100644
index 0000000000..0a697dadf9
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0004.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0005.png b/demos/2d/isometric_light/cubio/idle0005.png
new file mode 100644
index 0000000000..9c47197247
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0005.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0006.png b/demos/2d/isometric_light/cubio/idle0006.png
new file mode 100644
index 0000000000..717a7be5b1
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0006.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0007.png b/demos/2d/isometric_light/cubio/idle0007.png
new file mode 100644
index 0000000000..dde18399f3
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0007.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0008.png b/demos/2d/isometric_light/cubio/idle0008.png
new file mode 100644
index 0000000000..0f716a5d84
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0008.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0009.png b/demos/2d/isometric_light/cubio/idle0009.png
new file mode 100644
index 0000000000..d271373f9d
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0009.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0010.png b/demos/2d/isometric_light/cubio/idle0010.png
new file mode 100644
index 0000000000..61311be0eb
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0010.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0011.png b/demos/2d/isometric_light/cubio/idle0011.png
new file mode 100644
index 0000000000..0b7d32d138
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0011.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0012.png b/demos/2d/isometric_light/cubio/idle0012.png
new file mode 100644
index 0000000000..c176034cfa
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0012.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0013.png b/demos/2d/isometric_light/cubio/idle0013.png
new file mode 100644
index 0000000000..c37018154b
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0013.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0014.png b/demos/2d/isometric_light/cubio/idle0014.png
new file mode 100644
index 0000000000..a4613e4269
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0014.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0015.png b/demos/2d/isometric_light/cubio/idle0015.png
new file mode 100644
index 0000000000..8354588b72
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0015.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0016.png b/demos/2d/isometric_light/cubio/idle0016.png
new file mode 100644
index 0000000000..4e5796fb89
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0016.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0017.png b/demos/2d/isometric_light/cubio/idle0017.png
new file mode 100644
index 0000000000..a4ac7e8c43
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0017.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0018.png b/demos/2d/isometric_light/cubio/idle0018.png
new file mode 100644
index 0000000000..aa7cc8fe6c
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0018.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0019.png b/demos/2d/isometric_light/cubio/idle0019.png
new file mode 100644
index 0000000000..3ab603ceda
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0019.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0020.png b/demos/2d/isometric_light/cubio/idle0020.png
new file mode 100644
index 0000000000..9f02648f1a
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0020.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0021.png b/demos/2d/isometric_light/cubio/idle0021.png
new file mode 100644
index 0000000000..ec37fc331f
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0021.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0022.png b/demos/2d/isometric_light/cubio/idle0022.png
new file mode 100644
index 0000000000..34bf331af0
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0022.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0023.png b/demos/2d/isometric_light/cubio/idle0023.png
new file mode 100644
index 0000000000..80a458146e
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0023.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0024.png b/demos/2d/isometric_light/cubio/idle0024.png
new file mode 100644
index 0000000000..cd08c6d14a
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0024.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0025.png b/demos/2d/isometric_light/cubio/idle0025.png
new file mode 100644
index 0000000000..de500512d4
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0025.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0026.png b/demos/2d/isometric_light/cubio/idle0026.png
new file mode 100644
index 0000000000..4a8335a248
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0026.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0027.png b/demos/2d/isometric_light/cubio/idle0027.png
new file mode 100644
index 0000000000..c3d1609a03
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0027.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0028.png b/demos/2d/isometric_light/cubio/idle0028.png
new file mode 100644
index 0000000000..96c1f32223
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0028.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0029.png b/demos/2d/isometric_light/cubio/idle0029.png
new file mode 100644
index 0000000000..5b72d02300
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0029.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0030.png b/demos/2d/isometric_light/cubio/idle0030.png
new file mode 100644
index 0000000000..a84787bf0a
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0030.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0031.png b/demos/2d/isometric_light/cubio/idle0031.png
new file mode 100644
index 0000000000..dc9cd7ddc5
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0031.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0032.png b/demos/2d/isometric_light/cubio/idle0032.png
new file mode 100644
index 0000000000..c99f2e52bc
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0032.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0033.png b/demos/2d/isometric_light/cubio/idle0033.png
new file mode 100644
index 0000000000..cf5c648f9e
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0033.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0034.png b/demos/2d/isometric_light/cubio/idle0034.png
new file mode 100644
index 0000000000..8e18e12d8d
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0034.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0035.png b/demos/2d/isometric_light/cubio/idle0035.png
new file mode 100644
index 0000000000..ee2c25ee96
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0035.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0036.png b/demos/2d/isometric_light/cubio/idle0036.png
new file mode 100644
index 0000000000..f452b5db33
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0036.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0037.png b/demos/2d/isometric_light/cubio/idle0037.png
new file mode 100644
index 0000000000..7768c712e3
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0037.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0038.png b/demos/2d/isometric_light/cubio/idle0038.png
new file mode 100644
index 0000000000..1200127116
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0038.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0039.png b/demos/2d/isometric_light/cubio/idle0039.png
new file mode 100644
index 0000000000..25219f0582
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0039.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0040.png b/demos/2d/isometric_light/cubio/idle0040.png
new file mode 100644
index 0000000000..8da0a81050
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0040.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0041.png b/demos/2d/isometric_light/cubio/idle0041.png
new file mode 100644
index 0000000000..fa102aec8a
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0041.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0042.png b/demos/2d/isometric_light/cubio/idle0042.png
new file mode 100644
index 0000000000..0d19c32572
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0042.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0043.png b/demos/2d/isometric_light/cubio/idle0043.png
new file mode 100644
index 0000000000..bf284c62d0
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0043.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0044.png b/demos/2d/isometric_light/cubio/idle0044.png
new file mode 100644
index 0000000000..3daa1be0b8
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0044.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0045.png b/demos/2d/isometric_light/cubio/idle0045.png
new file mode 100644
index 0000000000..92abe74295
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0045.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0046.png b/demos/2d/isometric_light/cubio/idle0046.png
new file mode 100644
index 0000000000..2a1ab0f036
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0046.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0047.png b/demos/2d/isometric_light/cubio/idle0047.png
new file mode 100644
index 0000000000..da38b835ef
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0047.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0048.png b/demos/2d/isometric_light/cubio/idle0048.png
new file mode 100644
index 0000000000..35fac1b602
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0048.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0049.png b/demos/2d/isometric_light/cubio/idle0049.png
new file mode 100644
index 0000000000..7ebd79b8d7
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0049.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0050.png b/demos/2d/isometric_light/cubio/idle0050.png
new file mode 100644
index 0000000000..ba0678ba87
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0050.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0051.png b/demos/2d/isometric_light/cubio/idle0051.png
new file mode 100644
index 0000000000..03c54f1232
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0051.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0052.png b/demos/2d/isometric_light/cubio/idle0052.png
new file mode 100644
index 0000000000..0e2c8b5d9f
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0052.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0053.png b/demos/2d/isometric_light/cubio/idle0053.png
new file mode 100644
index 0000000000..d95095937f
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0053.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0054.png b/demos/2d/isometric_light/cubio/idle0054.png
new file mode 100644
index 0000000000..5a09fce69e
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0054.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0055.png b/demos/2d/isometric_light/cubio/idle0055.png
new file mode 100644
index 0000000000..6e2aad9d70
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0055.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0056.png b/demos/2d/isometric_light/cubio/idle0056.png
new file mode 100644
index 0000000000..45813e953f
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0056.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0057.png b/demos/2d/isometric_light/cubio/idle0057.png
new file mode 100644
index 0000000000..579b4e1647
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0057.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0058.png b/demos/2d/isometric_light/cubio/idle0058.png
new file mode 100644
index 0000000000..236f290651
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0058.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0059.png b/demos/2d/isometric_light/cubio/idle0059.png
new file mode 100644
index 0000000000..837dd38f9c
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0059.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/idle0060.png b/demos/2d/isometric_light/cubio/idle0060.png
new file mode 100644
index 0000000000..837dd38f9c
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/idle0060.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0001.png b/demos/2d/isometric_light/cubio/norm-b-0001.png
new file mode 100644
index 0000000000..cda17e21cc
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0001.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0002.png b/demos/2d/isometric_light/cubio/norm-b-0002.png
new file mode 100644
index 0000000000..fb36728cdf
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0002.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0003.png b/demos/2d/isometric_light/cubio/norm-b-0003.png
new file mode 100644
index 0000000000..c8bfecb100
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0003.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0004.png b/demos/2d/isometric_light/cubio/norm-b-0004.png
new file mode 100644
index 0000000000..e91213434f
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0004.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0005.png b/demos/2d/isometric_light/cubio/norm-b-0005.png
new file mode 100644
index 0000000000..a823fe9a92
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0005.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0006.png b/demos/2d/isometric_light/cubio/norm-b-0006.png
new file mode 100644
index 0000000000..d9de12baad
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0006.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0007.png b/demos/2d/isometric_light/cubio/norm-b-0007.png
new file mode 100644
index 0000000000..f042eed408
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0007.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0008.png b/demos/2d/isometric_light/cubio/norm-b-0008.png
new file mode 100644
index 0000000000..e18ca607dd
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0008.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0009.png b/demos/2d/isometric_light/cubio/norm-b-0009.png
new file mode 100644
index 0000000000..7e7ddd4c63
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0009.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0010.png b/demos/2d/isometric_light/cubio/norm-b-0010.png
new file mode 100644
index 0000000000..fddb956099
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0010.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0011.png b/demos/2d/isometric_light/cubio/norm-b-0011.png
new file mode 100644
index 0000000000..240a50a9ec
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0011.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0012.png b/demos/2d/isometric_light/cubio/norm-b-0012.png
new file mode 100644
index 0000000000..3e38628e98
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0012.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0013.png b/demos/2d/isometric_light/cubio/norm-b-0013.png
new file mode 100644
index 0000000000..2380e76909
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0013.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0014.png b/demos/2d/isometric_light/cubio/norm-b-0014.png
new file mode 100644
index 0000000000..db374927c6
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0014.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0015.png b/demos/2d/isometric_light/cubio/norm-b-0015.png
new file mode 100644
index 0000000000..1cd0e762c5
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0015.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0016.png b/demos/2d/isometric_light/cubio/norm-b-0016.png
new file mode 100644
index 0000000000..0d894db3f4
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0016.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0017.png b/demos/2d/isometric_light/cubio/norm-b-0017.png
new file mode 100644
index 0000000000..c184af8e85
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0017.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0018.png b/demos/2d/isometric_light/cubio/norm-b-0018.png
new file mode 100644
index 0000000000..1db06014b7
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0018.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0019.png b/demos/2d/isometric_light/cubio/norm-b-0019.png
new file mode 100644
index 0000000000..e74c9c7954
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0019.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-b-0020.png b/demos/2d/isometric_light/cubio/norm-b-0020.png
new file mode 100644
index 0000000000..326e60c64a
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-b-0020.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0001.png b/demos/2d/isometric_light/cubio/norm-bl-0001.png
new file mode 100644
index 0000000000..0b36e8caa3
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0001.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0002.png b/demos/2d/isometric_light/cubio/norm-bl-0002.png
new file mode 100644
index 0000000000..f00166d140
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0002.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0003.png b/demos/2d/isometric_light/cubio/norm-bl-0003.png
new file mode 100644
index 0000000000..d84993e097
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0003.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0004.png b/demos/2d/isometric_light/cubio/norm-bl-0004.png
new file mode 100644
index 0000000000..8e4c7f278b
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0004.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0005.png b/demos/2d/isometric_light/cubio/norm-bl-0005.png
new file mode 100644
index 0000000000..5009f2a514
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0005.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0006.png b/demos/2d/isometric_light/cubio/norm-bl-0006.png
new file mode 100644
index 0000000000..d0d654de6e
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0006.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0007.png b/demos/2d/isometric_light/cubio/norm-bl-0007.png
new file mode 100644
index 0000000000..2df2437a0d
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0007.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0008.png b/demos/2d/isometric_light/cubio/norm-bl-0008.png
new file mode 100644
index 0000000000..4bb8e91ecc
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0008.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0009.png b/demos/2d/isometric_light/cubio/norm-bl-0009.png
new file mode 100644
index 0000000000..e4ab80ab72
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0009.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0010.png b/demos/2d/isometric_light/cubio/norm-bl-0010.png
new file mode 100644
index 0000000000..7ead89343f
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0010.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0011.png b/demos/2d/isometric_light/cubio/norm-bl-0011.png
new file mode 100644
index 0000000000..9714999645
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0011.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0012.png b/demos/2d/isometric_light/cubio/norm-bl-0012.png
new file mode 100644
index 0000000000..95e0117df8
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0012.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0013.png b/demos/2d/isometric_light/cubio/norm-bl-0013.png
new file mode 100644
index 0000000000..85d4f25e7e
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0013.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0014.png b/demos/2d/isometric_light/cubio/norm-bl-0014.png
new file mode 100644
index 0000000000..3c9cc526d0
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0014.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0015.png b/demos/2d/isometric_light/cubio/norm-bl-0015.png
new file mode 100644
index 0000000000..3e30649ce1
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0015.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0016.png b/demos/2d/isometric_light/cubio/norm-bl-0016.png
new file mode 100644
index 0000000000..f39399c369
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0016.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0017.png b/demos/2d/isometric_light/cubio/norm-bl-0017.png
new file mode 100644
index 0000000000..47f79741a1
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0017.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0018.png b/demos/2d/isometric_light/cubio/norm-bl-0018.png
new file mode 100644
index 0000000000..8f4ccdcf33
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0018.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0019.png b/demos/2d/isometric_light/cubio/norm-bl-0019.png
new file mode 100644
index 0000000000..a278ec0f05
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0019.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-bl-0020.png b/demos/2d/isometric_light/cubio/norm-bl-0020.png
new file mode 100644
index 0000000000..db5fd0b73c
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-bl-0020.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0001.png b/demos/2d/isometric_light/cubio/norm-l-0001.png
new file mode 100644
index 0000000000..7a989e79dd
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0001.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0002.png b/demos/2d/isometric_light/cubio/norm-l-0002.png
new file mode 100644
index 0000000000..2257923ee6
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0002.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0003.png b/demos/2d/isometric_light/cubio/norm-l-0003.png
new file mode 100644
index 0000000000..2e264e49a4
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0003.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0004.png b/demos/2d/isometric_light/cubio/norm-l-0004.png
new file mode 100644
index 0000000000..e0061451d6
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0004.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0005.png b/demos/2d/isometric_light/cubio/norm-l-0005.png
new file mode 100644
index 0000000000..e16cca081c
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0005.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0006.png b/demos/2d/isometric_light/cubio/norm-l-0006.png
new file mode 100644
index 0000000000..694c2163eb
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0006.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0007.png b/demos/2d/isometric_light/cubio/norm-l-0007.png
new file mode 100644
index 0000000000..ed2ae64cad
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0007.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0008.png b/demos/2d/isometric_light/cubio/norm-l-0008.png
new file mode 100644
index 0000000000..4bbaeb8006
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0008.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0009.png b/demos/2d/isometric_light/cubio/norm-l-0009.png
new file mode 100644
index 0000000000..1f53a1067b
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0009.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0010.png b/demos/2d/isometric_light/cubio/norm-l-0010.png
new file mode 100644
index 0000000000..2007942a2a
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0010.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0011.png b/demos/2d/isometric_light/cubio/norm-l-0011.png
new file mode 100644
index 0000000000..0c27288646
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0011.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0012.png b/demos/2d/isometric_light/cubio/norm-l-0012.png
new file mode 100644
index 0000000000..8b885bcee8
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0012.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0013.png b/demos/2d/isometric_light/cubio/norm-l-0013.png
new file mode 100644
index 0000000000..ed08c9a470
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0013.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0014.png b/demos/2d/isometric_light/cubio/norm-l-0014.png
new file mode 100644
index 0000000000..3b6088c9a0
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0014.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0015.png b/demos/2d/isometric_light/cubio/norm-l-0015.png
new file mode 100644
index 0000000000..1ffa2b8cda
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0015.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0016.png b/demos/2d/isometric_light/cubio/norm-l-0016.png
new file mode 100644
index 0000000000..00279dc052
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0016.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0017.png b/demos/2d/isometric_light/cubio/norm-l-0017.png
new file mode 100644
index 0000000000..1805000a78
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0017.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0018.png b/demos/2d/isometric_light/cubio/norm-l-0018.png
new file mode 100644
index 0000000000..1ff123533f
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0018.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0019.png b/demos/2d/isometric_light/cubio/norm-l-0019.png
new file mode 100644
index 0000000000..2faf043a2b
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0019.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-l-0020.png b/demos/2d/isometric_light/cubio/norm-l-0020.png
new file mode 100644
index 0000000000..7948d2d79d
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-l-0020.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0001.png b/demos/2d/isometric_light/cubio/norm-u-0001.png
new file mode 100644
index 0000000000..6c702ba7c3
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0001.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0002.png b/demos/2d/isometric_light/cubio/norm-u-0002.png
new file mode 100644
index 0000000000..9a151e049b
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0002.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0003.png b/demos/2d/isometric_light/cubio/norm-u-0003.png
new file mode 100644
index 0000000000..0b7464260a
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0003.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0004.png b/demos/2d/isometric_light/cubio/norm-u-0004.png
new file mode 100644
index 0000000000..89061fdbcf
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0004.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0005.png b/demos/2d/isometric_light/cubio/norm-u-0005.png
new file mode 100644
index 0000000000..efc8ab0157
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0005.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0006.png b/demos/2d/isometric_light/cubio/norm-u-0006.png
new file mode 100644
index 0000000000..a89ef58f46
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0006.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0007.png b/demos/2d/isometric_light/cubio/norm-u-0007.png
new file mode 100644
index 0000000000..b069591200
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0007.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0008.png b/demos/2d/isometric_light/cubio/norm-u-0008.png
new file mode 100644
index 0000000000..8f0dbe8016
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0008.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0009.png b/demos/2d/isometric_light/cubio/norm-u-0009.png
new file mode 100644
index 0000000000..d4698f2584
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0009.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0010.png b/demos/2d/isometric_light/cubio/norm-u-0010.png
new file mode 100644
index 0000000000..cc3d442d4a
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0010.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0011.png b/demos/2d/isometric_light/cubio/norm-u-0011.png
new file mode 100644
index 0000000000..43c505d7e4
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0011.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0012.png b/demos/2d/isometric_light/cubio/norm-u-0012.png
new file mode 100644
index 0000000000..d4f955fd0c
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0012.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0013.png b/demos/2d/isometric_light/cubio/norm-u-0013.png
new file mode 100644
index 0000000000..08dd875a54
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0013.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0014.png b/demos/2d/isometric_light/cubio/norm-u-0014.png
new file mode 100644
index 0000000000..4bea108a46
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0014.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0015.png b/demos/2d/isometric_light/cubio/norm-u-0015.png
new file mode 100644
index 0000000000..943c556706
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0015.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0016.png b/demos/2d/isometric_light/cubio/norm-u-0016.png
new file mode 100644
index 0000000000..d71a69c5a6
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0016.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0017.png b/demos/2d/isometric_light/cubio/norm-u-0017.png
new file mode 100644
index 0000000000..2d74e4472c
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0017.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0018.png b/demos/2d/isometric_light/cubio/norm-u-0018.png
new file mode 100644
index 0000000000..17a5b10acb
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0018.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0019.png b/demos/2d/isometric_light/cubio/norm-u-0019.png
new file mode 100644
index 0000000000..e376c843e1
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0019.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-u-0020.png b/demos/2d/isometric_light/cubio/norm-u-0020.png
new file mode 100644
index 0000000000..fa1d3521ca
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-u-0020.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0001.png b/demos/2d/isometric_light/cubio/norm-ul-0001.png
new file mode 100644
index 0000000000..3e75621260
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0001.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0002.png b/demos/2d/isometric_light/cubio/norm-ul-0002.png
new file mode 100644
index 0000000000..d48d902936
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0002.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0003.png b/demos/2d/isometric_light/cubio/norm-ul-0003.png
new file mode 100644
index 0000000000..703cef6715
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0003.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0004.png b/demos/2d/isometric_light/cubio/norm-ul-0004.png
new file mode 100644
index 0000000000..7dd3e2884e
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0004.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0005.png b/demos/2d/isometric_light/cubio/norm-ul-0005.png
new file mode 100644
index 0000000000..1281b9ceb8
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0005.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0006.png b/demos/2d/isometric_light/cubio/norm-ul-0006.png
new file mode 100644
index 0000000000..e3c58752e9
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0006.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0007.png b/demos/2d/isometric_light/cubio/norm-ul-0007.png
new file mode 100644
index 0000000000..ccec10c83c
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0007.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0008.png b/demos/2d/isometric_light/cubio/norm-ul-0008.png
new file mode 100644
index 0000000000..1243c7dfe8
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0008.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0009.png b/demos/2d/isometric_light/cubio/norm-ul-0009.png
new file mode 100644
index 0000000000..77ea3ca8e9
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0009.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0010.png b/demos/2d/isometric_light/cubio/norm-ul-0010.png
new file mode 100644
index 0000000000..cf1cb7d0e3
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0010.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0011.png b/demos/2d/isometric_light/cubio/norm-ul-0011.png
new file mode 100644
index 0000000000..1063ee29a8
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0011.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0012.png b/demos/2d/isometric_light/cubio/norm-ul-0012.png
new file mode 100644
index 0000000000..a896237161
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0012.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0013.png b/demos/2d/isometric_light/cubio/norm-ul-0013.png
new file mode 100644
index 0000000000..cc289b18a0
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0013.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0014.png b/demos/2d/isometric_light/cubio/norm-ul-0014.png
new file mode 100644
index 0000000000..faf36e82b6
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0014.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0015.png b/demos/2d/isometric_light/cubio/norm-ul-0015.png
new file mode 100644
index 0000000000..925be82a2e
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0015.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0016.png b/demos/2d/isometric_light/cubio/norm-ul-0016.png
new file mode 100644
index 0000000000..1cb2300b9d
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0016.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0017.png b/demos/2d/isometric_light/cubio/norm-ul-0017.png
new file mode 100644
index 0000000000..5a841b57af
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0017.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0018.png b/demos/2d/isometric_light/cubio/norm-ul-0018.png
new file mode 100644
index 0000000000..2b30df8988
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0018.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0019.png b/demos/2d/isometric_light/cubio/norm-ul-0019.png
new file mode 100644
index 0000000000..12c0a72d6d
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0019.png
Binary files differ
diff --git a/demos/2d/isometric_light/cubio/norm-ul-0020.png b/demos/2d/isometric_light/cubio/norm-ul-0020.png
new file mode 100644
index 0000000000..3cffda17ca
--- /dev/null
+++ b/demos/2d/isometric_light/cubio/norm-ul-0020.png
Binary files differ
diff --git a/demos/2d/isometric_light/energy.png b/demos/2d/isometric_light/energy.png
new file mode 100644
index 0000000000..237e3ea4f0
--- /dev/null
+++ b/demos/2d/isometric_light/energy.png
Binary files differ
diff --git a/demos/2d/isometric_light/engine.cfg b/demos/2d/isometric_light/engine.cfg
new file mode 100644
index 0000000000..0d9e432d5d
--- /dev/null
+++ b/demos/2d/isometric_light/engine.cfg
@@ -0,0 +1,18 @@
+[application]
+
+main_scene="res://map.scn"
+
+[input]
+
+up=[key(Up), key(W)]
+down=[key(S), key(Down)]
+left=[key(Left), key(A)]
+right=[key(Right), key(D)]
+
+[rasterizer]
+
+shadow_filter=0
+
+[render]
+
+default_clear_color=#ff000000
diff --git a/demos/2d/isometric_light/export.cfg b/demos/2d/isometric_light/export.cfg
new file mode 100644
index 0000000000..578d4171b2
--- /dev/null
+++ b/demos/2d/isometric_light/export.cfg
@@ -0,0 +1,262 @@
+[convert_images]
+
+action="none"
+compress_quality=0.7
+formats="png"
+shrink=1
+
+[export_filter]
+
+filter=""
+type="resources"
+
+[image_group_files]
+
+files=["res://faceNormal.png", "normal", "res://faceColor.png", "normal", "res://faceMask.png", "normal"]
+
+[image_groups]
+
+normal={"atlas":false, "action":"compress_ram", "shrink":1, "lossy_quality":0.7}
+
+[platform:Android]
+
+apk_expansion/SALT=""
+apk_expansion/enable=false
+apk_expansion/public_key=""
+command_line/extra_args=""
+custom_package/debug=""
+custom_package/release=""
+keystore/release=""
+keystore/release_password=""
+keystore/release_user=""
+one_click_deploy/clear_previous_install=true
+package/icon=""
+package/name=""
+package/signed=true
+package/unique_name="com.android.noname"
+permissions/access_checkin_properties=false
+permissions/access_coarse_location=false
+permissions/access_fine_location=false
+permissions/access_location_extra_commands=false
+permissions/access_mock_location=false
+permissions/access_network_state=false
+permissions/access_surface_flinger=false
+permissions/access_wifi_state=false
+permissions/account_manager=false
+permissions/add_voicemail=false
+permissions/authenticate_accounts=false
+permissions/battery_stats=false
+permissions/bind_accessibility_service=false
+permissions/bind_appwidget=false
+permissions/bind_device_admin=false
+permissions/bind_input_method=false
+permissions/bind_nfc_service=false
+permissions/bind_notification_listener_service=false
+permissions/bind_print_service=false
+permissions/bind_remoteviews=false
+permissions/bind_text_service=false
+permissions/bind_vpn_service=false
+permissions/bind_wallpaper=false
+permissions/bluetooth=false
+permissions/bluetooth_admin=false
+permissions/bluetooth_privileged=false
+permissions/brick=false
+permissions/broadcast_package_removed=false
+permissions/broadcast_sms=false
+permissions/broadcast_sticky=false
+permissions/broadcast_wap_push=false
+permissions/call_phone=false
+permissions/call_privileged=false
+permissions/camera=false
+permissions/capture_audio_output=false
+permissions/capture_secure_video_output=false
+permissions/capture_video_output=false
+permissions/change_component_enabled_state=false
+permissions/change_configuration=false
+permissions/change_network_state=false
+permissions/change_wifi_multicast_state=false
+permissions/change_wifi_state=false
+permissions/clear_app_cache=false
+permissions/clear_app_user_data=false
+permissions/control_location_updates=false
+permissions/delete_cache_files=false
+permissions/delete_packages=false
+permissions/device_power=false
+permissions/diagnostic=false
+permissions/disable_keyguard=false
+permissions/dump=false
+permissions/expand_status_bar=false
+permissions/factory_test=false
+permissions/flashlight=false
+permissions/force_back=false
+permissions/get_accounts=false
+permissions/get_package_size=false
+permissions/get_tasks=false
+permissions/get_top_activity_info=false
+permissions/global_search=false
+permissions/hardware_test=false
+permissions/inject_events=false
+permissions/install_location_provider=false
+permissions/install_packages=false
+permissions/install_shortcut=false
+permissions/internal_system_window=false
+permissions/internet=false
+permissions/kill_background_processes=false
+permissions/location_hardware=false
+permissions/manage_accounts=false
+permissions/manage_app_tokens=false
+permissions/manage_documents=false
+permissions/master_clear=false
+permissions/media_content_control=false
+permissions/modify_audio_settings=false
+permissions/modify_phone_state=false
+permissions/mount_format_filesystems=false
+permissions/mount_unmount_filesystems=false
+permissions/nfc=false
+permissions/persistent_activity=false
+permissions/process_outgoing_calls=false
+permissions/read_calendar=false
+permissions/read_call_log=false
+permissions/read_contacts=false
+permissions/read_external_storage=false
+permissions/read_frame_buffer=false
+permissions/read_history_bookmarks=false
+permissions/read_input_state=false
+permissions/read_logs=false
+permissions/read_phone_state=false
+permissions/read_profile=false
+permissions/read_sms=false
+permissions/read_social_stream=false
+permissions/read_sync_settings=false
+permissions/read_sync_stats=false
+permissions/read_user_dictionary=false
+permissions/reboot=false
+permissions/receive_boot_completed=false
+permissions/receive_mms=false
+permissions/receive_sms=false
+permissions/receive_wap_push=false
+permissions/record_audio=false
+permissions/reorder_tasks=false
+permissions/restart_packages=false
+permissions/send_respond_via_message=false
+permissions/send_sms=false
+permissions/set_activity_watcher=false
+permissions/set_alarm=false
+permissions/set_always_finish=false
+permissions/set_animation_scale=false
+permissions/set_debug_app=false
+permissions/set_orientation=false
+permissions/set_pointer_speed=false
+permissions/set_preferred_applications=false
+permissions/set_process_limit=false
+permissions/set_time=false
+permissions/set_time_zone=false
+permissions/set_wallpaper=false
+permissions/set_wallpaper_hints=false
+permissions/signal_persistent_processes=false
+permissions/status_bar=false
+permissions/subscribed_feeds_read=false
+permissions/subscribed_feeds_write=false
+permissions/system_alert_window=false
+permissions/transmit_ir=false
+permissions/uninstall_shortcut=false
+permissions/update_device_stats=false
+permissions/use_credentials=false
+permissions/use_sip=false
+permissions/vibrate=false
+permissions/wake_lock=false
+permissions/write_apn_settings=false
+permissions/write_calendar=false
+permissions/write_call_log=false
+permissions/write_contacts=false
+permissions/write_external_storage=false
+permissions/write_gservices=false
+permissions/write_history_bookmarks=false
+permissions/write_profile=false
+permissions/write_secure_settings=false
+permissions/write_settings=false
+permissions/write_sms=false
+permissions/write_social_stream=false
+permissions/write_sync_settings=false
+permissions/write_user_dictionary=false
+screen/orientation=0
+screen/support_large=true
+screen/support_normal=true
+screen/support_small=true
+screen/support_xlarge=true
+user_permissions/0=""
+user_permissions/1=""
+user_permissions/10=""
+user_permissions/11=""
+user_permissions/12=""
+user_permissions/13=""
+user_permissions/14=""
+user_permissions/15=""
+user_permissions/16=""
+user_permissions/17=""
+user_permissions/18=""
+user_permissions/19=""
+user_permissions/2=""
+user_permissions/3=""
+user_permissions/4=""
+user_permissions/5=""
+user_permissions/6=""
+user_permissions/7=""
+user_permissions/8=""
+user_permissions/9=""
+version/code=1
+version/name="1.0"
+
+[platform:BlackBerry 10]
+
+package/category="core.games"
+package/custom_template=""
+package/description="Game made with Godot Engine"
+package/icon=""
+package/name=""
+package/unique_name="com.godot.noname"
+release/author="Cert. Name"
+release/author_id="Cert. ID"
+version/code=1
+version/name="1.0"
+
+[platform:HTML5]
+
+browser/enable_run=false
+custom_package/debug=""
+custom_package/release=""
+options/memory_size=3
+
+[platform:Linux X11]
+
+binary/64_bits=true
+custom_binary/debug=""
+custom_binary/release=""
+resources/pack_mode=1
+
+[platform:Mac OSX]
+
+application/64_bits=false
+application/copyright=""
+application/icon=""
+application/identifier="com.godot.macgame"
+application/info="This Game is Nice"
+application/name=""
+application/short_version="1.0"
+application/signature="godotmacgame"
+application/version="1.0"
+custom_package/debug=""
+custom_package/release=""
+display/high_res=false
+
+[platform:Windows Desktop]
+
+binary/64_bits=true
+custom_binary/debug=""
+custom_binary/release=""
+resources/pack_mode=1
+
+[script]
+
+action="compile"
+encrypt_key=""
diff --git a/demos/2d/isometric_light/faceColor.png b/demos/2d/isometric_light/faceColor.png
new file mode 100644
index 0000000000..c6daf73cb7
--- /dev/null
+++ b/demos/2d/isometric_light/faceColor.png
Binary files differ
diff --git a/demos/2d/isometric_light/faceMask.png b/demos/2d/isometric_light/faceMask.png
new file mode 100644
index 0000000000..d91e968c8e
--- /dev/null
+++ b/demos/2d/isometric_light/faceMask.png
Binary files differ
diff --git a/demos/2d/isometric_light/faceNormal.png b/demos/2d/isometric_light/faceNormal.png
new file mode 100644
index 0000000000..651f075fa1
--- /dev/null
+++ b/demos/2d/isometric_light/faceNormal.png
Binary files differ
diff --git a/demos/2d/isometric_light/fire.png b/demos/2d/isometric_light/fire.png
new file mode 100644
index 0000000000..746e4f9f4b
--- /dev/null
+++ b/demos/2d/isometric_light/fire.png
Binary files differ
diff --git a/demos/2d/isometric_light/floor_shader.res b/demos/2d/isometric_light/floor_shader.res
new file mode 100644
index 0000000000..446c71d227
--- /dev/null
+++ b/demos/2d/isometric_light/floor_shader.res
Binary files differ
diff --git a/demos/2d/isometric_light/light2.png b/demos/2d/isometric_light/light2.png
new file mode 100644
index 0000000000..cd473251aa
--- /dev/null
+++ b/demos/2d/isometric_light/light2.png
Binary files differ
diff --git a/demos/2d/isometric_light/map.gd b/demos/2d/isometric_light/map.gd
new file mode 100644
index 0000000000..f712aeeaec
--- /dev/null
+++ b/demos/2d/isometric_light/map.gd
@@ -0,0 +1,18 @@
+
+extends Node2D
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+
+func _ready():
+ # Initialization here
+ pass
+
+
+
+
+func _on_prince_area_body_enter( body ):
+ if (body.get_name()=="cubio"):
+ get_node("message").show()
+ pass # replace with function body
diff --git a/demos/2d/isometric_light/map.scn b/demos/2d/isometric_light/map.scn
new file mode 100644
index 0000000000..c939a4b392
--- /dev/null
+++ b/demos/2d/isometric_light/map.scn
Binary files differ
diff --git a/demos/2d/isometric_light/shadow_blob.png b/demos/2d/isometric_light/shadow_blob.png
new file mode 100644
index 0000000000..e97fd2a826
--- /dev/null
+++ b/demos/2d/isometric_light/shadow_blob.png
Binary files differ
diff --git a/demos/2d/isometric_light/shoot.gd b/demos/2d/isometric_light/shoot.gd
new file mode 100644
index 0000000000..0486bbb658
--- /dev/null
+++ b/demos/2d/isometric_light/shoot.gd
@@ -0,0 +1,27 @@
+
+extends KinematicBody2D
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+
+var advance_dir=Vector2(1,0)
+const ADVANCE_SPEED = 500.0
+
+var hit=false
+
+func _fixed_process(delta):
+
+ if (hit):
+ return
+ move(advance_dir*delta*ADVANCE_SPEED)
+ if (is_colliding()):
+ get_node("anim").play("explode")
+ hit=true
+
+func _ready():
+ # Initialization here
+ set_fixed_process(true)
+ pass
+
+
diff --git a/demos/2d/isometric_light/shoot.scn b/demos/2d/isometric_light/shoot.scn
new file mode 100644
index 0000000000..672608810f
--- /dev/null
+++ b/demos/2d/isometric_light/shoot.scn
Binary files differ
diff --git a/demos/2d/isometric_light/shoot_halo.png b/demos/2d/isometric_light/shoot_halo.png
new file mode 100644
index 0000000000..5ba954b32b
--- /dev/null
+++ b/demos/2d/isometric_light/shoot_halo.png
Binary files differ
diff --git a/demos/2d/isometric_light/tileset.res b/demos/2d/isometric_light/tileset.res
new file mode 100644
index 0000000000..633bdada38
--- /dev/null
+++ b/demos/2d/isometric_light/tileset.res
Binary files differ
diff --git a/demos/2d/isometric_light/tileset_scene.scn b/demos/2d/isometric_light/tileset_scene.scn
new file mode 100644
index 0000000000..3d0773c9c5
--- /dev/null
+++ b/demos/2d/isometric_light/tileset_scene.scn
Binary files differ
diff --git a/demos/2d/isometric_light/torch.scn b/demos/2d/isometric_light/torch.scn
new file mode 100644
index 0000000000..d1cb7fe7e6
--- /dev/null
+++ b/demos/2d/isometric_light/torch.scn
Binary files differ
diff --git a/demos/2d/isometric_light/torch_light.png b/demos/2d/isometric_light/torch_light.png
new file mode 100644
index 0000000000..a98113d36f
--- /dev/null
+++ b/demos/2d/isometric_light/torch_light.png
Binary files differ
diff --git a/demos/2d/isometric_light/torch_shader.res b/demos/2d/isometric_light/torch_shader.res
new file mode 100644
index 0000000000..ad70d5260d
--- /dev/null
+++ b/demos/2d/isometric_light/torch_shader.res
Binary files differ
diff --git a/demos/2d/isometric_light/wall_shader.res b/demos/2d/isometric_light/wall_shader.res
new file mode 100644
index 0000000000..78c8fe57e1
--- /dev/null
+++ b/demos/2d/isometric_light/wall_shader.res
Binary files differ
diff --git a/demos/2d/platformer/stage.xml b/demos/2d/platformer/stage.xml
index 35517f747d..610057183b 100644
--- a/demos/2d/platformer/stage.xml
+++ b/demos/2d/platformer/stage.xml
@@ -2,16 +2,16 @@
<resource_file type="PackedScene" subresource_count="9" version="1.0" version_name="Godot Engine v1.0.stable.custom_build">
<ext_resource path="res://music.ogg" type="AudioStream"></ext_resource>
<ext_resource path="res://tileset.xml" type="TileSet"></ext_resource>
- <ext_resource path="res://coin.xml" type="PackedScene"></ext_resource>
- <ext_resource path="res://seesaw.xml" type="PackedScene"></ext_resource>
+ <ext_resource path="res://parallax_bg.xml" type="PackedScene"></ext_resource>
<ext_resource path="res://player.xml" type="PackedScene"></ext_resource>
<ext_resource path="res://moving_platform.xml" type="PackedScene"></ext_resource>
+ <ext_resource path="res://seesaw.xml" type="PackedScene"></ext_resource>
+ <ext_resource path="res://coin.xml" type="PackedScene"></ext_resource>
<ext_resource path="res://enemy.xml" type="PackedScene"></ext_resource>
- <ext_resource path="res://parallax_bg.xml" type="PackedScene"></ext_resource>
<main_resource>
<dictionary name="_bundled" shared="false">
<string> "names" </string>
- <string_array len="127">
+ <string_array len="130">
<string> "stage" </string>
<string> "Node" </string>
<string> "_import_path" </string>
@@ -21,6 +21,7 @@
<string> "visibility/visible" </string>
<string> "visibility/opacity" </string>
<string> "visibility/self_opacity" </string>
+ <string> "visibility/light_mask" </string>
<string> "transform/pos" </string>
<string> "transform/rot" </string>
<string> "transform/scale" </string>
@@ -32,7 +33,9 @@
<string> "cell/quadrant_size" </string>
<string> "cell/custom_transform" </string>
<string> "cell/half_offset" </string>
- <string> "collision/body_mode" </string>
+ <string> "cell/tile_origin" </string>
+ <string> "cell/y_sort" </string>
+ <string> "collision/use_kinematic" </string>
<string> "collision/friction" </string>
<string> "collision/bounce" </string>
<string> "collision/layers" </string>
@@ -172,10 +175,10 @@
<real> 0.814506 </real>
<string> "use_snap" </string>
<bool> False </bool>
+ <string> "snap_vec" </string>
+ <vector2> 10, 10 </vector2>
<string> "ofs" </string>
- <vector2> -121.031, 464.121 </vector2>
- <string> "snap" </string>
- <int> 10 </int>
+ <vector2> 177.488, 709.633 </vector2>
</dictionary>
<string> "3D" </string>
<dictionary shared="false">
@@ -278,10 +281,11 @@
<int> 0 </int>
</dictionary>
<string> "__editor_plugin_screen__" </string>
- <string> "2D" </string>
+ <string> "3D" </string>
</dictionary>
<bool> True </bool>
<real> 1 </real>
+ <int> 1 </int>
<vector2> 0, 0 </vector2>
<real> 0 </real>
<vector2> 1, 1 </vector2>
@@ -291,7 +295,7 @@
<int> 8 </int>
<matrix32> 1, 0, 0, 1, 0, 0 </matrix32>
<int> 2 </int>
- <int> 1 </int>
+ <bool> False </bool>
<int_array len="1998"> 0, 2, 70, 536870914, 71, 10, 72, 10, 73, 10, 74, 10, 75, 10, 76, 10, 77, 10, 78, 10, 65536, 2, 65606, 536870914, 65607, 10, 65608, 10, 65609, 10, 65610, 10, 65611, 10, 65612, 10, 65613, 10, 65614, 10, 131072, 2, 131142, 536870914, 131143, 10, 131144, 10, 131145, 10, 131146, 10, 131147, 10, 131148, 10, 131149, 10, 131150, 10, 196608, 2, 196626, 9, 196678, 536870914, 196679, 10, 196680, 10, 196681, 10, 196682, 10, 196683, 10, 196684, 10, 196685, 10, 196686, 10, 262144, 2, 262162, 8, 262214, 536870914, 262215, 10, 262216, 10, 262217, 10, 262218, 10, 262219, 10, 262220, 10, 262221, 10, 262222, 10, 327680, 2, 327697, 536870921, 327698, 7, 327733, 9, 327750, 536870914, 327751, 10, 327752, 10, 327753, 10, 327754, 10, 327755, 10, 327756, 10, 327757, 10, 327758, 10, 393216, 2, 393233, 536870920, 393234, 7, 393257, 9, 393269, 7, 393286, 536870914, 393287, 10, 393288, 10, 393289, 10, 393290, 10, 393291, 10, 393292, 10, 393293, 10, 393294, 10, 458752, 2, 458769, 7, 458770, 8, 458790, 9, 458793, 8, 458805, 8, 458822, 536870914, 458823, 10, 458824, 10, 458825, 10, 458826, 10, 458827, 10, 458828, 10, 458829, 10, 458830, 10, 524288, 4, 524289, 1, 524304, 536870913, 524305, 536870918, 524306, 6, 524307, 5, 524308, 1, 524326, 8, 524329, 7, 524341, 7, 524358, 536870914, 524359, 10, 524360, 10, 524361, 10, 524362, 10, 524363, 10, 524364, 10, 524365, 10, 524366, 10, 589824, 10, 589825, 13, 589840, 536870914, 589841, 10, 589842, 10, 589843, 10, 589844, 2, 589862, 7, 589865, 7, 589876, 536870913, 589877, 6, 589878, 1, 589894, 536870914, 589895, 10, 589896, 10, 589897, 10, 589898, 10, 589899, 10, 589900, 10, 589901, 10, 589902, 10, 655360, 2, 655376, 536870914, 655377, 10, 655378, 10, 655379, 10, 655380, 2, 655398, 7, 655401, 8, 655412, 536870925, 655413, 11, 655414, 13, 655430, 536870914, 655431, 10, 655432, 10, 655433, 10, 655434, 10, 655435, 10, 655436, 10, 655437, 10, 655438, 10, 720896, 2, 720912, 536870914, 720913, 10, 720914, 10, 720915, 10, 720916, 2, 720934, 8, 720937, 7, 720958, 536870913, 720959, 5, 720960, 536870917, 720961, 5, 720962, 5, 720963, 536870917, 720964, 5, 720965, 0, 720966, 536870916, 720967, 10, 720968, 10, 720969, 10, 720970, 10, 720971, 10, 720972, 10, 720973, 10, 720974, 10, 786432, 2, 786437, 9, 786448, 536870914, 786449, 10, 786450, 10, 786451, 10, 786452, 2, 786464, 536870913, 786465, 1, 786470, 7, 786473, 7, 786474, 536870924, 786475, 1, 786494, 536870914, 786495, 10, 786496, 10, 786497, 10, 786498, 10, 786499, 10, 786500, 10, 786501, 10, 786502, 10, 786503, 10, 786504, 10, 786505, 10, 786506, 10, 786507, 10, 786508, 10, 786509, 10, 851968, 2, 851973, 7, 851984, 536870914, 851985, 10, 851986, 10, 851987, 10, 851988, 2, 851996, 536870913, 851997, 1, 852000, 536870914, 852001, 3, 852006, 7, 852009, 536870913, 852011, 2, 852030, 536870914, 852031, 10, 852032, 10, 852033, 10, 852034, 10, 852035, 10, 852036, 10, 852037, 10, 852038, 10, 852039, 10, 852040, 10, 852041, 10, 852042, 10, 852043, 10, 852044, 10, 852045, 10, 917504, 2, 917506, 9, 917509, 7, 917512, 536870921, 917520, 536870925, 917521, 11, 917522, 11, 917523, 11, 917524, 13, 917532, 536870925, 917533, 13, 917536, 536870914, 917537, 4, 917538, 1, 917540, 536870913, 917541, 0, 917542, 1, 917545, 536870914, 917546, 10, 917547, 4, 917548, 1, 917566, 536870914, 917567, 10, 917568, 10, 917569, 10, 917570, 10, 917571, 10, 917572, 10, 917573, 10, 917574, 10, 917575, 10, 917576, 10, 917577, 10, 917578, 10, 917579, 10, 917580, 10, 917581, 10, 983040, 2, 983042, 7, 983045, 7, 983048, 536870920, 983050, 536870913, 983051, 1, 983064, 536870913, 983065, 1, 983072, 536870914, 983073, 10, 983074, 4, 983075, 0, 983076, 536870916, 983077, 10, 983078, 4, 983079, 536870912, 983080, 536870912, 983081, 536870916, 983082, 10, 983083, 10, 983084, 2, 983095, 9, 983102, 536870914, 983103, 10, 983104, 10, 983105, 10, 983106, 10, 983107, 10, 983108, 10, 983109, 10, 983110, 10, 983111, 10, 983112, 10, 983113, 10, 983114, 10, 983115, 10, 983116, 10, 983117, 10, 1048576, 2, 1048578, 8, 1048581, 8, 1048584, 536870919, 1048586, 536870925, 1048587, 13, 1048600, 536870925, 1048601, 13, 1048604, 9, 1048608, 536870925, 1048609, 536870923, 1048610, 536870923, 1048611, 536870923, 1048612, 10, 1048613, 10, 1048614, 10, 1048615, 10, 1048616, 10, 1048617, 10, 1048618, 10, 1048619, 10, 1048620, 4, 1048621, 1, 1048630, 536870921, 1048631, 8, 1048638, 536870914, 1048639, 10, 1048640, 10, 1048641, 10, 1048642, 10, 1048643, 10, 1048644, 10, 1048645, 10, 1048646, 10, 1048647, 10, 1048648, 10, 1048649, 10, 1048650, 10, 1048651, 10, 1048652, 10, 1048653, 10, 1114112, 4, 1114113, 0, 1114114, 6, 1114115, 0, 1114116, 0, 1114117, 6, 1114118, 1, 1114120, 536870920, 1114128, 536870913, 1114129, 5, 1114130, 536870917, 1114131, 5, 1114132, 0, 1114133, 1, 1114140, 7, 1114141, 536870921, 1114148, 536870914, 1114149, 10, 1114150, 10, 1114151, 10, 1114152, 10, 1114153, 10, 1114154, 10, 1114155, 10, 1114156, 10, 1114157, 2, 1114166, 536870920, 1114167, 8, 1114174, 536870914, 1114175, 10, 1114176, 10, 1114177, 10, 1114178, 10, 1114179, 10, 1114180, 10, 1114181, 10, 1114182, 10, 1114183, 10, 1114184, 10, 1114185, 10, 1114186, 10, 1114187, 10, 1114188, 10, 1179648, 10, 1179649, 10, 1179650, 10, 1179651, 10, 1179652, 10, 1179653, 10, 1179654, 2, 1179656, 536870919, 1179663, 536870915, 1179665, 10, 1179666, 10, 1179667, 10, 1179668, 10, 1179669, 4, 1179670, 12, 1179675, 9, 1179676, 8, 1179677, 8, 1179684, 536870914, 1179685, 10, 1179686, 10, 1179687, 10, 1179688, 10, 1179689, 10, 1179690, 10, 1179691, 10, 1179692, 10, 1179693, 4, 1179694, 1, 1179701, 9, 1179702, 536870919, 1179703, 7, 1179710, 536870914, 1179711, 10, 1179712, 10, 1179713, 10, 1179714, 10, 1179715, 10, 1179716, 10, 1179717, 10, 1179718, 10, 1179719, 10, 1179720, 10, 1179721, 10, 1179722, 10, 1245184, 10, 1245185, 10, 1245186, 10, 1245187, 10, 1245188, 10, 1245189, 10, 1245190, 2, 1245192, 536870919, 1245199, 536870913, 1245200, 536870916, 1245201, 10, 1245202, 10, 1245203, 10, 1245204, 10, 1245205, 10, 1245207, 1, 1245211, 7, 1245212, 7, 1245213, 536870920, 1245220, 536870914, 1245221, 10, 1245222, 10, 1245223, 10, 1245224, 10, 1245225, 10, 1245226, 10, 1245227, 10, 1245228, 10, 1245229, 10, 1245230, 2, 1245237, 8, 1245238, 536870919, 1245239, 8, 1245240, 536870921, 1245246, 536870914, 1245247, 10, 1245248, 10, 1245249, 10, 1245250, 10, 1245251, 10, 1245252, 10, 1245253, 10, 1245254, 10, 1245255, 10, 1245256, 10, 1245257, 10, 1245258, 10, 1310720, 10, 1310721, 10, 1310722, 10, 1310723, 10, 1310724, 10, 1310725, 10, 1310726, 2, 1310728, 536870920, 1310730, 536870913, 1310731, 1, 1310734, 536870913, 1310735, 536870916, 1310736, 10, 1310737, 10, 1310738, 10, 1310739, 10, 1310740, 10, 1310741, 10, 1310742, 10, 1310743, 4, 1310744, 1, 1310747, 8, 1310748, 7, 1310749, 536870919, 1310756, 536870914, 1310757, 10, 1310758, 10, 1310759, 10, 1310760, 10, 1310761, 10, 1310762, 10, 1310763, 10, 1310764, 10, 1310765, 10, 1310766, 4, 1310767, 5, 1310768, 12, 1310773, 7, 1310774, 536870919, 1310775, 7, 1310776, 536870919, 1310782, 536870914, 1310783, 10, 1310784, 10, 1310785, 10, 1310786, 10, 1310787, 10, 1310788, 10, 1310789, 10, 1310790, 10, 1310791, 10, 1310792, 10, 1310793, 10, 1376256, 10, 1376257, 10, 1376258, 10, 1376259, 10, 1376260, 10, 1376261, 10, 1376262, 4, 1376263, 0, 1376264, 0, 1376265, 0, 1376266, 536870916, 1376267, 4, 1376268, 0, 1376269, 0, 1376270, 536870916, 1376271, 10, 1376272, 10, 1376273, 10, 1376274, 10, 1376275, 10, 1376276, 10, 1376277, 10, 1376278, 10, 1376279, 10, 1376280, 4, 1376281, 12, 1376283, 8, 1376284, 8, 1376285, 536870920, 1376287, 536870924, 1376288, 0, 1376289, 5, 1376290, 536870917, 1376291, 0, 1376292, 536870916, 1376293, 10, 1376294, 10, 1376295, 10, 1376296, 10, 1376297, 10, 1376298, 10, 1376299, 10, 1376300, 10, 1376301, 10, 1376302, 10, 1376303, 10, 1376305, 12, 1376309, 7, 1376310, 536870920, 1376311, 7, 1376312, 536870920, 1376318, 536870914, 1376319, 10, 1376320, 10, 1376321, 10, 1376322, 10, 1376323, 10, 1376324, 10, 1376325, 10, 1376326, 10, 1376327, 10, 1376328, 10, 1441792, 10, 1441793, 10, 1441794, 10, 1441795, 10, 1441796, 10, 1441797, 10, 1441798, 10, 1441799, 10, 1441800, 10, 1441801, 10, 1441802, 10, 1441803, 10, 1441804, 10, 1441805, 10, 1441806, 10, 1441807, 10, 1441808, 10, 1441809, 10, 1441810, 10, 1441811, 10, 1441812, 10, 1441813, 10, 1441814, 10, 1441815, 10, 1441816, 10, 1441818, 0, 1441819, 6, 1441820, 6, 1441821, 536870918, 1441822, 5, 1441824, 10, 1441825, 10, 1441826, 10, 1441827, 10, 1441828, 10, 1441829, 10, 1441830, 10, 1441831, 10, 1441832, 10, 1441833, 10, 1441834, 10, 1441835, 10, 1441836, 10, 1441837, 10, 1441838, 10, 1441839, 10, 1441840, 10, 1441842, 0, 1441843, 0, 1441844, 0, 1441845, 6, 1441846, 536870918, 1441847, 6, 1441848, 536870918, 1441849, 0, 1441850, 5, 1441851, 536870917, 1441852, 5, 1441853, 0, 1441854, 536870916, 1441855, 10, 1441856, 10, 1441857, 10, 1441858, 10, 1441859, 10, 1441860, 10, 1441861, 10, 1441862, 10, 1441863, 10, 1507328, 10, 1507329, 10, 1507330, 10, 1507331, 10, 1507332, 10, 1507333, 10, 1507334, 10, 1507335, 10, 1507336, 10, 1507337, 10, 1507338, 10, 1507339, 10, 1507340, 10, 1507341, 10, 1507342, 10, 1507343, 10, 1507344, 10, 1507345, 10, 1507346, 10, 1507347, 10, 1507348, 10, 1507349, 10, 1507350, 10, 1507351, 10, 1507352, 10, 1507353, 10, 1507354, 10, 1507355, 10, 1507356, 10, 1507357, 10, 1507358, 10, 1507359, 10, 1507360, 10, 1507361, 10, 1507362, 10, 1507363, 10, 1507364, 10, 1507365, 10, 1507366, 10, 1507367, 10, 1507368, 10, 1507369, 10, 1507370, 10, 1507371, 10, 1507372, 10, 1507373, 10, 1507374, 10, 1507375, 10, 1507376, 10, 1507377, 10, 1507378, 10, 1507379, 10, 1507380, 10, 1507381, 10, 1507382, 10, 1507383, 10, 1507384, 10, 1507385, 10, 1507386, 10, 1507387, 10, 1507388, 10, 1507389, 10, 1507390, 10, 1507391, 10, 1507392, 10, 1507393, 10, 1507394, 10, 1507395, 10, 1507396, 10, 1507397, 10, 1507398, 10, 1507399, 10, 1572864, 10, 1572865, 10, 1572866, 10, 1572867, 10, 1572868, 10, 1572869, 10, 1572870, 10, 1572871, 10, 1572872, 10, 1572873, 10, 1572874, 10, 1572875, 10, 1572876, 10, 1572877, 10, 1572878, 10, 1572879, 10, 1572880, 10, 1572881, 10, 1572882, 10, 1572883, 10, 1572884, 10, 1572885, 10, 1572886, 10, 1572887, 10, 1572888, 10, 1572889, 10, 1572890, 10, 1572891, 10, 1572892, 10, 1572893, 10, 1572894, 10, 1572895, 10, 1572896, 10, 1572897, 10, 1572898, 10, 1572899, 10, 1572900, 10, 1572901, 10, 1572902, 10, 1572903, 10, 1572904, 10, 1572905, 10, 1572906, 10, 1572907, 10, 1572908, 10, 1572909, 10, 1572910, 10, 1572911, 10, 1572912, 10, 1572913, 10, 1572914, 10, 1572915, 10, 1572916, 10, 1572917, 10, 1572918, 10, 1572919, 10, 1572920, 10, 1572921, 10, 1572922, 10, 1572923, 10, 1572924, 10, 1572925, 10, 1572926, 10, 1572927, 10, 1572928, 10, 1572929, 10, 1572930, 10, 1572931, 10, 1572932, 10, 1572933, 10, 1572934, 10, 1572935, 10, 1638400, 10, 1638401, 10, 1638402, 10, 1638403, 10, 1638404, 10, 1638405, 10, 1638406, 10, 1638407, 10, 1638408, 10, 1638409, 10, 1638410, 10, 1638411, 10, 1638412, 10, 1638413, 10, 1638414, 10, 1638415, 10, 1638416, 10, 1638417, 10, 1638418, 10, 1638419, 10, 1638420, 10, 1638421, 10, 1638422, 10, 1638423, 10, 1638424, 10, 1638425, 10, 1638426, 10, 1638427, 10, 1638428, 10, 1638429, 10, 1638430, 10, 1638431, 10, 1638432, 10, 1638433, 10, 1638434, 10, 1638435, 10, 1638436, 10, 1638437, 10, 1638438, 10, 1638439, 10, 1638440, 10, 1638441, 10, 1638442, 10, 1638443, 10, 1638444, 10, 1638445, 10, 1638446, 10, 1638447, 10, 1638448, 10, 1638449, 10, 1638450, 10, 1638451, 10, 1638452, 10, 1638453, 10, 1638454, 10, 1638455, 10, 1638456, 10, 1638457, 10, 1638458, 10, 1638459, 10, 1638460, 10, 1638461, 10, 1638462, 10, 1638463, 10, 1638464, 10, 1638465, 10, 1638466, 10, 1638467, 10, 1638468, 10, 1638469, 10, 1638470, 10, 1638471, 10, 1703952, 10, 1703953, 10, 1703954, 10, 1703955, 10, 1703956, 10, 1703957, 10, 1703958, 10, 1703959, 10, 1703960, 10, 1703961, 10, 1703962, 10, 1703963, 10, 1703964, 10, 1703965, 10, 1703966, 10, 1703967, 10, 1703968, 10, 1703969, 10, 1703970, 10, 1703971, 10, 1703972, 10, 1703973, 10, 1703974, 10, 1703975, 10, 1703976, 10, 1703977, 10, 1703978, 10, 1703979, 10, 1703980, 10, 1703981, 10, 1703982, 10, 1703983, 10, 1703984, 10, 1703985, 10, 1703986, 10, 1703987, 10, 1703988, 10, 1703989, 10, 1703990, 10, 1703991, 10, 1703992, 10, 1703993, 10, 1703994, 10, 1703995, 10, 1703996, 10, 1703997, 10, 1703998, 10, 1703999, 10, 1704000, 10, 1704001, 10, 1704002, 10, 1704003, 10, 1704004, 10, 1704005, 10, 1704006, 10, 1704007, 10, 1769488, 10, 1769489, 10, 1769490, 10, 1769491, 10, 1769492, 10, 1769493, 10, 1769494, 10, 1769495, 10, 1769496, 10, 1769497, 10, 1769498, 10, 1769499, 10, 1769500, 10, 1769501, 10, 1769502, 10, 1769503, 10, 1769504, 10, 1769505, 10, 1769506, 10, 1769507, 10, 1769508, 10, 1769509, 10, 1769510, 10, 1769511, 10, 1769512, 10, 1769513, 10, 1769514, 10, 1769515, 10, 1769516, 10, 1769517, 10, 1769518, 10, 1769519, 10, 1769520, 10, 1769521, 10, 1769522, 10, 1769523, 10, 1769524, 10, 1769525, 10, 1769526, 10, 1769527, 10, 1769528, 10, 1769529, 10, 1769530, 10, 1769531, 10, 1769532, 10, 1769533, 10, 1769534, 10, 1769535, 10, 1769536, 10, 1769537, 10, 1769538, 10, 1769539, 10, 1769540, 10, 1769541, 10 </int_array>
<dictionary shared="false">
<string> "_edit_lock_" </string>
@@ -483,12 +487,10 @@
</dictionary>
<string> "3D" </string>
<dictionary shared="false">
- <string> "deflight_rot_y" </string>
- <real> 0.628319 </real>
- <string> "zfar" </string>
- <real> 500 </real>
<string> "fov" </string>
<real> 45 </real>
+ <string> "zfar" </string>
+ <real> 500 </real>
<string> "viewports" </string>
<array len="4" shared="false">
<dictionary shared="false">
@@ -556,6 +558,8 @@
<vector3> 0, 0, 0 </vector3>
</dictionary>
</array>
+ <string> "deflight_rot_y" </string>
+ <real> 0.628319 </real>
<string> "default_light" </string>
<bool> True </bool>
<string> "viewport_mode" </string>
@@ -806,7 +810,6 @@
<string> "2D" </string>
</dictionary>
<resource resource_type="AudioStream" path="res://music.ogg"> </resource>
- <bool> False </bool>
<real> 2 </real>
<resource resource_type="PackedScene" path="res://enemy.xml"> </resource>
<vector2> 834.664, 1309.6 </vector2>
@@ -1000,7 +1003,7 @@
<real> -1 </real>
</array>
<string> "nodes" </string>
- <int_array len="952"> -1, -1, 1, 0, -1, 2, 2, 0, 3, 1, 0, 0, 0, 5, 4, -1, 21, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 10, 5, 11, 6, 12, 7, 13, 2, 14, 7, 15, 8, 16, 9, 17, 10, 18, 11, 19, 12, 20, 7, 21, 3, 22, 5, 23, 13, 24, 14, 3, 15, 0, 0, 0, 1, 25, -1, 2, 2, 0, 3, 16, 0, 2, 0, 27, 26, 17, 3, 2, 0, 9, 18, 3, 19, 0, 2, 0, 27, 28, 17, 3, 2, 0, 9, 20, 3, 19, 0, 2, 0, 27, 29, 17, 3, 2, 0, 9, 21, 3, 19, 0, 2, 0, 27, 30, 17, 3, 2, 0, 9, 22, 3, 19, 0, 2, 0, 27, 31, 17, 3, 2, 0, 9, 23, 3, 19, 0, 2, 0, 27, 32, 17, 3, 2, 0, 9, 24, 3, 19, 0, 2, 0, 27, 33, 17, 3, 2, 0, 9, 25, 3, 19, 0, 2, 0, 27, 34, 17, 3, 2, 0, 9, 26, 3, 19, 0, 2, 0, 27, 35, 17, 3, 2, 0, 9, 27, 3, 19, 0, 2, 0, 27, 36, 17, 3, 2, 0, 9, 28, 3, 19, 0, 2, 0, 27, 37, 17, 3, 2, 0, 9, 29, 3, 19, 0, 2, 0, 27, 38, 17, 3, 2, 0, 9, 30, 3, 19, 0, 2, 0, 27, 39, 17, 3, 2, 0, 9, 31, 3, 19, 0, 2, 0, 27, 40, 17, 3, 2, 0, 9, 32, 3, 19, 0, 2, 0, 27, 41, 17, 3, 2, 0, 9, 33, 3, 19, 0, 2, 0, 27, 42, 17, 3, 2, 0, 9, 34, 3, 19, 0, 2, 0, 27, 43, 17, 3, 2, 0, 9, 35, 3, 19, 0, 2, 0, 27, 44, 17, 3, 2, 0, 9, 36, 3, 19, 0, 2, 0, 27, 45, 17, 3, 2, 0, 9, 37, 3, 19, 0, 2, 0, 27, 46, 17, 3, 2, 0, 9, 38, 3, 19, 0, 2, 0, 27, 47, 17, 3, 2, 0, 9, 39, 3, 19, 0, 2, 0, 27, 48, 17, 3, 2, 0, 9, 40, 3, 19, 0, 2, 0, 27, 49, 17, 3, 2, 0, 9, 41, 3, 19, 0, 2, 0, 27, 50, 17, 3, 2, 0, 9, 42, 3, 19, 0, 2, 0, 27, 51, 17, 3, 2, 0, 9, 43, 3, 19, 0, 2, 0, 27, 52, 17, 3, 2, 0, 9, 44, 3, 19, 0, 2, 0, 27, 53, 17, 3, 2, 0, 9, 45, 3, 19, 0, 2, 0, 27, 54, 17, 3, 2, 0, 9, 46, 3, 19, 0, 2, 0, 27, 55, 17, 3, 2, 0, 9, 47, 3, 19, 0, 2, 0, 27, 56, 17, 3, 2, 0, 9, 48, 3, 19, 0, 2, 0, 27, 57, 17, 3, 2, 0, 9, 49, 3, 19, 0, 2, 0, 27, 58, 17, 3, 2, 0, 9, 50, 3, 19, 0, 2, 0, 27, 59, 17, 3, 2, 0, 9, 51, 3, 19, 0, 2, 0, 27, 60, 17, 3, 2, 0, 9, 52, 3, 19, 0, 2, 0, 27, 61, 17, 3, 2, 0, 9, 53, 3, 19, 0, 2, 0, 27, 62, 17, 3, 2, 0, 9, 54, 3, 19, 0, 2, 0, 27, 63, 17, 3, 2, 0, 9, 55, 3, 19, 0, 2, 0, 27, 64, 17, 3, 2, 0, 9, 56, 3, 19, 0, 2, 0, 27, 65, 17, 3, 2, 0, 9, 57, 3, 19, 0, 2, 0, 27, 66, 17, 3, 2, 0, 9, 58, 3, 19, 0, 2, 0, 27, 67, 17, 3, 2, 0, 9, 59, 3, 19, 0, 2, 0, 27, 68, 17, 3, 2, 0, 9, 60, 3, 19, 0, 0, 0, 70, 69, 61, 3, 2, 0, 9, 62, 3, 63, 0, 0, 0, 1, 71, -1, 1, 2, 0, 0, 46, 0, 73, 72, 64, 5, 2, 0, 9, 65, 3, 66, 74, 67, 75, 68, 0, 46, 0, 73, 76, 64, 5, 2, 0, 9, 69, 3, 66, 74, 70, 75, 71, 0, 46, 0, 73, 77, 64, 5, 2, 0, 9, 72, 3, 66, 74, 73, 75, 71, 0, 46, 0, 73, 78, 74, 3, 2, 0, 9, 75, 3, 76, 0, 0, 0, 80, 79, -1, 7, 2, 0, 81, 77, 82, 78, 83, 2, 84, 79, 85, 2, 86, 78, 0, 0, 0, 1, 87, -1, 1, 2, 0, 0, 52, 0, 70, 88, 80, 3, 2, 0, 9, 81, 3, 82, 0, 52, 0, 70, 89, 80, 3, 2, 0, 9, 83, 3, 82, 0, 52, 0, 70, 90, 80, 3, 2, 0, 9, 84, 3, 82, 0, 52, 0, 70, 91, 80, 3, 2, 0, 9, 85, 3, 82, 0, 52, 0, 70, 92, 80, 3, 2, 0, 9, 86, 3, 82, 0, 52, 0, 70, 93, 80, 3, 2, 0, 9, 87, 3, 82, 0, 52, 0, 70, 94, 80, 3, 2, 0, 9, 88, 3, 82, 0, 52, 0, 70, 95, 80, 3, 2, 0, 9, 89, 3, 82, 0, 52, 0, 70, 96, 80, 3, 2, 0, 9, 90, 3, 82, 0, 52, 0, 70, 97, 80, 3, 2, 0, 9, 91, 3, 82, 0, 52, 0, 70, 98, 80, 3, 2, 0, 9, 92, 3, 82, 0, 0, 0, 100, 99, 93, 2, 2, 0, 3, 94, 0, 0, 0, 101, 101, -1, 29, 2, 0, 6, 2, 7, 3, 8, 3, 102, 95, 103, 96, 104, 97, 105, 98, 106, 0, 107, 0, 108, 0, 109, 0, 110, 2, 111, 2, 112, 12, 113, 3, 114, 5, 115, 99, 116, 3, 117, 100, 118, 5, 119, 78, 120, 78, 121, 101, 122, 7, 123, 7, 124, 2, 125, 78, 126, 102, 0 </int_array>
+ <int_array len="960"> -1, -1, 1, 0, -1, 2, 2, 0, 3, 1, 0, 0, 0, 5, 4, -1, 24, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 10, 5, 11, 6, 12, 7, 13, 8, 14, 2, 15, 8, 16, 9, 17, 10, 18, 11, 19, 12, 20, 13, 21, 8, 22, 14, 23, 14, 24, 3, 25, 6, 26, 4, 27, 15, 3, 16, 0, 0, 0, 1, 28, -1, 2, 2, 0, 3, 17, 0, 2, 0, 30, 29, 18, 3, 2, 0, 10, 19, 3, 20, 0, 2, 0, 30, 31, 18, 3, 2, 0, 10, 21, 3, 20, 0, 2, 0, 30, 32, 18, 3, 2, 0, 10, 22, 3, 20, 0, 2, 0, 30, 33, 18, 3, 2, 0, 10, 23, 3, 20, 0, 2, 0, 30, 34, 18, 3, 2, 0, 10, 24, 3, 20, 0, 2, 0, 30, 35, 18, 3, 2, 0, 10, 25, 3, 20, 0, 2, 0, 30, 36, 18, 3, 2, 0, 10, 26, 3, 20, 0, 2, 0, 30, 37, 18, 3, 2, 0, 10, 27, 3, 20, 0, 2, 0, 30, 38, 18, 3, 2, 0, 10, 28, 3, 20, 0, 2, 0, 30, 39, 18, 3, 2, 0, 10, 29, 3, 20, 0, 2, 0, 30, 40, 18, 3, 2, 0, 10, 30, 3, 20, 0, 2, 0, 30, 41, 18, 3, 2, 0, 10, 31, 3, 20, 0, 2, 0, 30, 42, 18, 3, 2, 0, 10, 32, 3, 20, 0, 2, 0, 30, 43, 18, 3, 2, 0, 10, 33, 3, 20, 0, 2, 0, 30, 44, 18, 3, 2, 0, 10, 34, 3, 20, 0, 2, 0, 30, 45, 18, 3, 2, 0, 10, 35, 3, 20, 0, 2, 0, 30, 46, 18, 3, 2, 0, 10, 36, 3, 20, 0, 2, 0, 30, 47, 18, 3, 2, 0, 10, 37, 3, 20, 0, 2, 0, 30, 48, 18, 3, 2, 0, 10, 38, 3, 20, 0, 2, 0, 30, 49, 18, 3, 2, 0, 10, 39, 3, 20, 0, 2, 0, 30, 50, 18, 3, 2, 0, 10, 40, 3, 20, 0, 2, 0, 30, 51, 18, 3, 2, 0, 10, 41, 3, 20, 0, 2, 0, 30, 52, 18, 3, 2, 0, 10, 42, 3, 20, 0, 2, 0, 30, 53, 18, 3, 2, 0, 10, 43, 3, 20, 0, 2, 0, 30, 54, 18, 3, 2, 0, 10, 44, 3, 20, 0, 2, 0, 30, 55, 18, 3, 2, 0, 10, 45, 3, 20, 0, 2, 0, 30, 56, 18, 3, 2, 0, 10, 46, 3, 20, 0, 2, 0, 30, 57, 18, 3, 2, 0, 10, 47, 3, 20, 0, 2, 0, 30, 58, 18, 3, 2, 0, 10, 48, 3, 20, 0, 2, 0, 30, 59, 18, 3, 2, 0, 10, 49, 3, 20, 0, 2, 0, 30, 60, 18, 3, 2, 0, 10, 50, 3, 20, 0, 2, 0, 30, 61, 18, 3, 2, 0, 10, 51, 3, 20, 0, 2, 0, 30, 62, 18, 3, 2, 0, 10, 52, 3, 20, 0, 2, 0, 30, 63, 18, 3, 2, 0, 10, 53, 3, 20, 0, 2, 0, 30, 64, 18, 3, 2, 0, 10, 54, 3, 20, 0, 2, 0, 30, 65, 18, 3, 2, 0, 10, 55, 3, 20, 0, 2, 0, 30, 66, 18, 3, 2, 0, 10, 56, 3, 20, 0, 2, 0, 30, 67, 18, 3, 2, 0, 10, 57, 3, 20, 0, 2, 0, 30, 68, 18, 3, 2, 0, 10, 58, 3, 20, 0, 2, 0, 30, 69, 18, 3, 2, 0, 10, 59, 3, 20, 0, 2, 0, 30, 70, 18, 3, 2, 0, 10, 60, 3, 20, 0, 2, 0, 30, 71, 18, 3, 2, 0, 10, 61, 3, 20, 0, 0, 0, 73, 72, 62, 3, 2, 0, 10, 63, 3, 64, 0, 0, 0, 1, 74, -1, 1, 2, 0, 0, 46, 0, 76, 75, 65, 5, 2, 0, 10, 66, 3, 67, 77, 68, 78, 69, 0, 46, 0, 76, 79, 65, 5, 2, 0, 10, 70, 3, 67, 77, 71, 78, 72, 0, 46, 0, 76, 80, 65, 5, 2, 0, 10, 73, 3, 67, 77, 74, 78, 72, 0, 46, 0, 76, 81, 75, 3, 2, 0, 10, 76, 3, 77, 0, 0, 0, 83, 82, -1, 7, 2, 0, 84, 78, 85, 14, 86, 2, 87, 79, 88, 2, 89, 14, 0, 0, 0, 1, 90, -1, 1, 2, 0, 0, 52, 0, 73, 91, 80, 3, 2, 0, 10, 81, 3, 82, 0, 52, 0, 73, 92, 80, 3, 2, 0, 10, 83, 3, 82, 0, 52, 0, 73, 93, 80, 3, 2, 0, 10, 84, 3, 82, 0, 52, 0, 73, 94, 80, 3, 2, 0, 10, 85, 3, 82, 0, 52, 0, 73, 95, 80, 3, 2, 0, 10, 86, 3, 82, 0, 52, 0, 73, 96, 80, 3, 2, 0, 10, 87, 3, 82, 0, 52, 0, 73, 97, 80, 3, 2, 0, 10, 88, 3, 82, 0, 52, 0, 73, 98, 80, 3, 2, 0, 10, 89, 3, 82, 0, 52, 0, 73, 99, 80, 3, 2, 0, 10, 90, 3, 82, 0, 52, 0, 73, 100, 80, 3, 2, 0, 10, 91, 3, 82, 0, 52, 0, 73, 101, 80, 3, 2, 0, 10, 92, 3, 82, 0, 0, 0, 103, 102, 93, 2, 2, 0, 3, 94, 0, 0, 0, 104, 104, -1, 30, 2, 0, 6, 2, 7, 3, 8, 3, 9, 4, 105, 95, 106, 96, 107, 97, 108, 98, 109, 0, 110, 0, 111, 0, 112, 0, 113, 2, 114, 2, 115, 13, 116, 3, 117, 6, 118, 99, 119, 3, 120, 100, 121, 6, 122, 14, 123, 14, 124, 101, 125, 8, 126, 8, 127, 2, 128, 14, 129, 102, 0 </int_array>
<string> "conns" </string>
<int_array len="0"> </int_array>
</dictionary>
diff --git a/demos/2d/screen_space_shaders/art/burano.jpg b/demos/2d/screen_space_shaders/art/burano.jpg
new file mode 100644
index 0000000000..cdab993ec1
--- /dev/null
+++ b/demos/2d/screen_space_shaders/art/burano.jpg
Binary files differ
diff --git a/demos/2d/screen_space_shaders/art/burano.png b/demos/2d/screen_space_shaders/art/burano.png
new file mode 100644
index 0000000000..6eec09d585
--- /dev/null
+++ b/demos/2d/screen_space_shaders/art/burano.png
Binary files differ
diff --git a/demos/2d/screen_space_shaders/art/filmgrain.png b/demos/2d/screen_space_shaders/art/filmgrain.png
new file mode 100644
index 0000000000..b8ea89902c
--- /dev/null
+++ b/demos/2d/screen_space_shaders/art/filmgrain.png
Binary files differ
diff --git a/demos/2d/screen_space_shaders/art/filmgrain.png.flags b/demos/2d/screen_space_shaders/art/filmgrain.png.flags
new file mode 100644
index 0000000000..d5476d5499
--- /dev/null
+++ b/demos/2d/screen_space_shaders/art/filmgrain.png.flags
@@ -0,0 +1 @@
+repeat=true
diff --git a/demos/2d/screen_space_shaders/art/forest.png b/demos/2d/screen_space_shaders/art/forest.png
new file mode 100644
index 0000000000..f5a2fb9bfb
--- /dev/null
+++ b/demos/2d/screen_space_shaders/art/forest.png
Binary files differ
diff --git a/demos/2d/screen_space_shaders/art/mountains.png b/demos/2d/screen_space_shaders/art/mountains.png
new file mode 100644
index 0000000000..b8435bb1a8
--- /dev/null
+++ b/demos/2d/screen_space_shaders/art/mountains.png
Binary files differ
diff --git a/demos/2d/screen_space_shaders/art/platformer.png b/demos/2d/screen_space_shaders/art/platformer.png
new file mode 100644
index 0000000000..21c1cb4c4b
--- /dev/null
+++ b/demos/2d/screen_space_shaders/art/platformer.png
Binary files differ
diff --git a/demos/2d/screen_space_shaders/art/vignette.png b/demos/2d/screen_space_shaders/art/vignette.png
new file mode 100644
index 0000000000..8afeb7f9e1
--- /dev/null
+++ b/demos/2d/screen_space_shaders/art/vignette.png
Binary files differ
diff --git a/demos/2d/screen_space_shaders/art/white.png b/demos/2d/screen_space_shaders/art/white.png
new file mode 100644
index 0000000000..573faa33f2
--- /dev/null
+++ b/demos/2d/screen_space_shaders/art/white.png
Binary files differ
diff --git a/demos/2d/screen_space_shaders/engine.cfg b/demos/2d/screen_space_shaders/engine.cfg
new file mode 100644
index 0000000000..2a41110886
--- /dev/null
+++ b/demos/2d/screen_space_shaders/engine.cfg
@@ -0,0 +1,4 @@
+[application]
+
+name="Screen-Space Shaders"
+main_scene="res://screen_shaders.scn"
diff --git a/demos/2d/screen_space_shaders/screen_shaders.gd b/demos/2d/screen_space_shaders/screen_shaders.gd
new file mode 100644
index 0000000000..4e8a548539
--- /dev/null
+++ b/demos/2d/screen_space_shaders/screen_shaders.gd
@@ -0,0 +1,32 @@
+
+extends Control
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+
+func _ready():
+ # Initialization here
+ for c in get_node("pictures").get_children():
+ get_node("picture").add_item("PIC: "+c.get_name())
+ for c in get_node("effects").get_children():
+ get_node("effect").add_item("FX: "+c.get_name())
+ pass
+
+
+
+
+func _on_picture_item_selected( ID ):
+ for c in range(get_node("pictures").get_child_count()):
+ if (ID==c):
+ get_node("pictures").get_child(c).show()
+ else:
+ get_node("pictures").get_child(c).hide()
+
+
+func _on_effect_item_selected( ID ):
+ for c in range(get_node("effects").get_child_count()):
+ if (ID==c):
+ get_node("effects").get_child(c).show()
+ else:
+ get_node("effects").get_child(c).hide()
diff --git a/demos/2d/screen_space_shaders/screen_shaders.scn b/demos/2d/screen_space_shaders/screen_shaders.scn
new file mode 100644
index 0000000000..aa359616de
--- /dev/null
+++ b/demos/2d/screen_space_shaders/screen_shaders.scn
Binary files differ
diff --git a/demos/2d/sdf_font/KaushanScript-Regular.otf b/demos/2d/sdf_font/KaushanScript-Regular.otf
new file mode 100644
index 0000000000..bd29502100
--- /dev/null
+++ b/demos/2d/sdf_font/KaushanScript-Regular.otf
Binary files differ
diff --git a/demos/2d/sdf_font/engine.cfg b/demos/2d/sdf_font/engine.cfg
new file mode 100644
index 0000000000..bdf26ce741
--- /dev/null
+++ b/demos/2d/sdf_font/engine.cfg
@@ -0,0 +1,4 @@
+[application]
+
+name="Signed Distance Field Font"
+main_scene="res://sdf.scn"
diff --git a/demos/2d/sdf_font/font.fnt b/demos/2d/sdf_font/font.fnt
new file mode 100644
index 0000000000..c2b6b0177d
--- /dev/null
+++ b/demos/2d/sdf_font/font.fnt
Binary files differ
diff --git a/demos/2d/sdf_font/sdf.scn b/demos/2d/sdf_font/sdf.scn
new file mode 100644
index 0000000000..89d6245bf0
--- /dev/null
+++ b/demos/2d/sdf_font/sdf.scn
Binary files differ
diff --git a/demos/2d/sprite_shaders/cubio.png b/demos/2d/sprite_shaders/cubio.png
new file mode 100644
index 0000000000..6f76220225
--- /dev/null
+++ b/demos/2d/sprite_shaders/cubio.png
Binary files differ
diff --git a/demos/2d/sprite_shaders/engine.cfg b/demos/2d/sprite_shaders/engine.cfg
new file mode 100644
index 0000000000..09f9a59566
--- /dev/null
+++ b/demos/2d/sprite_shaders/engine.cfg
@@ -0,0 +1,4 @@
+[application]
+
+name="2D Shaders for Sprites"
+main_scene="res://sprite_shaders.scn"
diff --git a/demos/2d/sprite_shaders/sprite_shaders.scn b/demos/2d/sprite_shaders/sprite_shaders.scn
new file mode 100644
index 0000000000..7c36f2137c
--- /dev/null
+++ b/demos/2d/sprite_shaders/sprite_shaders.scn
Binary files differ
diff --git a/demos/2d/texscreen/bubble.png b/demos/2d/texscreen/bubble.png
new file mode 100644
index 0000000000..021abba601
--- /dev/null
+++ b/demos/2d/texscreen/bubble.png
Binary files differ
diff --git a/demos/2d/texscreen/bubbles.gd b/demos/2d/texscreen/bubbles.gd
new file mode 100644
index 0000000000..2ee227a928
--- /dev/null
+++ b/demos/2d/texscreen/bubbles.gd
@@ -0,0 +1,17 @@
+
+extends Control
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+
+const MAX_BUBBLES=10
+
+func _ready():
+ # Initialization here
+ for i in range(MAX_BUBBLES):
+ var bubble = preload("res://lens.scn").instance()
+ add_child(bubble)
+ pass
+
+
diff --git a/demos/2d/texscreen/bubbles.scn b/demos/2d/texscreen/bubbles.scn
new file mode 100644
index 0000000000..779cba6930
--- /dev/null
+++ b/demos/2d/texscreen/bubbles.scn
Binary files differ
diff --git a/demos/2d/texscreen/burano.png b/demos/2d/texscreen/burano.png
new file mode 100644
index 0000000000..6eec09d585
--- /dev/null
+++ b/demos/2d/texscreen/burano.png
Binary files differ
diff --git a/demos/2d/texscreen/engine.cfg b/demos/2d/texscreen/engine.cfg
new file mode 100644
index 0000000000..58193c8c4a
--- /dev/null
+++ b/demos/2d/texscreen/engine.cfg
@@ -0,0 +1,4 @@
+[application]
+
+name="Glass Bubbles (Texscreen)"
+main_scene="res://bubbles.scn"
diff --git a/demos/2d/texscreen/lens.gd b/demos/2d/texscreen/lens.gd
new file mode 100644
index 0000000000..2ccbfba497
--- /dev/null
+++ b/demos/2d/texscreen/lens.gd
@@ -0,0 +1,37 @@
+
+extends BackBufferCopy
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+const MOTION_SPEED=150
+
+var vsize;
+var dir;
+
+func _process(delta):
+ var pos = get_pos() + dir * delta * MOTION_SPEED
+
+ if (pos.x<0):
+ dir.x=abs(dir.x)
+ elif (pos.x>vsize.x):
+ dir.x=-abs(dir.x)
+
+ if (pos.y<0):
+ dir.y=abs(dir.y)
+ elif (pos.y>vsize.y):
+ dir.y=-abs(dir.y)
+
+ set_pos(pos)
+
+func _ready():
+ vsize = get_viewport_rect().size
+ var pos = vsize * Vector2(randf(),randf());
+ set_pos(pos);
+ dir = Vector2(randf()*2.0-1,randf()*2.0-1).normalized()
+ set_process(true)
+
+ # Initialization here
+ pass
+
+
diff --git a/demos/2d/texscreen/lens.scn b/demos/2d/texscreen/lens.scn
new file mode 100644
index 0000000000..5c6f8b7af8
--- /dev/null
+++ b/demos/2d/texscreen/lens.scn
Binary files differ
diff --git a/demos/gui/drag_and_drop/drag_and_drop.scn b/demos/gui/drag_and_drop/drag_and_drop.scn
new file mode 100644
index 0000000000..94a25cc53e
--- /dev/null
+++ b/demos/gui/drag_and_drop/drag_and_drop.scn
Binary files differ
diff --git a/demos/gui/drag_and_drop/drag_drop_script.gd b/demos/gui/drag_and_drop/drag_drop_script.gd
new file mode 100644
index 0000000000..21a737ce1a
--- /dev/null
+++ b/demos/gui/drag_and_drop/drag_drop_script.gd
@@ -0,0 +1,24 @@
+
+extends ColorPickerButton
+
+
+#virtual function
+func get_drag_data(pos):
+
+ #use another colorpicker as drag preview
+ var cpb = ColorPickerButton.new()
+ cpb.set_color( get_color() )
+ cpb.set_size(Vector2(50,50))
+ set_drag_preview(cpb)
+ #return color as drag data
+ return get_color()
+
+#virtual function
+func can_drop_data(pos, data):
+ return typeof(data)==TYPE_COLOR
+
+#virtual function
+func drop_data(pos, data):
+ set_color(data)
+
+
diff --git a/demos/gui/drag_and_drop/engine.cfg b/demos/gui/drag_and_drop/engine.cfg
new file mode 100644
index 0000000000..448939c61d
--- /dev/null
+++ b/demos/gui/drag_and_drop/engine.cfg
@@ -0,0 +1,4 @@
+[application]
+
+name="Drag &amp; Drop (GUI)"
+main_scene="res://drag_and_drop.scn"
diff --git a/demos/viewport/gui_in_3d/gui_3d.gd b/demos/viewport/gui_in_3d/gui_3d.gd
index 5309db9acb..c2a9df0069 100644
--- a/demos/viewport/gui_in_3d/gui_3d.gd
+++ b/demos/viewport/gui_in_3d/gui_3d.gd
@@ -7,38 +7,39 @@ extends Spatial
var prev_pos=null
-func _input(ev):
- if (ev.type in [InputEvent.MOUSE_BUTTON,InputEvent.MOUSE_MOTION]):
- var pos = ev.pos
- var rfrom = get_node("camera").project_ray_origin(pos)
- var rnorm = get_node("camera").project_ray_normal(pos)
+
+func _input( ev ):
+ #all other (non-mouse) events
+ if (not ev.type in [InputEvent.MOUSE_BUTTON,InputEvent.MOUSE_MOTION,InputEvent.SCREEN_DRAG,InputEvent.SCREEN_TOUCH]):
+ get_node("viewport").input(ev)
- #simple collision test against aligned plane
- #for game UIs of this kind consider more complex collision against plane
- var p = Plane(Vector3(0,0,1),0).intersects_ray(rfrom,rnorm)
- if (p==null):
- return
-
- pos.x=(p.x+1.5)*100
- pos.y=(-p.y+0.75)*100
- ev.pos=pos
- ev.global_pos=pos
- if (prev_pos==null):
- prev_pos=pos
- if (ev.type==InputEvent.MOUSE_MOTION):
- ev.relative_pos=pos-prev_pos
+
+#mouse events for area
+func _on_area_input_event( camera, ev, click_pos, click_normal, shape_idx ):
+
+ #use click pos (click in 3d space, convert to area space
+ var pos = get_node("area").get_global_transform().affine_inverse() * click_pos
+ #convert to 2D
+ pos = Vector2(pos.x,pos.y)
+ #convert to viewport coordinate system
+ pos.x=(pos.x+1.5)*100
+ pos.y=(-pos.y+0.75)*100
+ #set to event
+ ev.pos=pos
+ ev.global_pos=pos
+ if (prev_pos==null):
prev_pos=pos
+ if (ev.type==InputEvent.MOUSE_MOTION):
+ ev.relative_pos=pos-prev_pos
+ prev_pos=pos
get_node("viewport").input(ev)
-
-
+
func _ready():
# Initalization here
- get_node("quad").get_material_override().set_texture(FixedMaterial.PARAM_DIFFUSE, get_node("viewport").get_render_target_texture() )
+ get_node("area/quad").get_material_override().set_texture(FixedMaterial.PARAM_DIFFUSE, get_node("viewport").get_render_target_texture() )
set_process_input(true)
-
pass
-
diff --git a/demos/viewport/gui_in_3d/gui_3d.scn b/demos/viewport/gui_in_3d/gui_3d.scn
index df8f7d6dc5..c69d4dc73f 100644
--- a/demos/viewport/gui_in_3d/gui_3d.scn
+++ b/demos/viewport/gui_in_3d/gui_3d.scn
Binary files differ
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index e5bdcfbc6a..342941970f 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -257,13 +257,14 @@
<method name="lerp" >
<return type="float">
</return>
- <argument index="0" name="a" type="float">
+ <argument index="0" name="from" type="float">
</argument>
- <argument index="1" name="b" type="float">
+ <argument index="1" name="to" type="float">
</argument>
- <argument index="2" name="c" type="float">
+ <argument index="2" name="weight" type="float">
</argument>
<description>
+ Linear interpolates between two values by a normalized value.
</description>
</method>
<method name="dectime" >
@@ -276,6 +277,7 @@
<argument index="2" name="step" type="float">
</argument>
<description>
+ Decreases time by a specified amount.
</description>
</method>
<method name="randomize" >
@@ -421,6 +423,7 @@
<argument index="1" name="funcname" type="String">
</argument>
<description>
+ Returns a reference to the specified function
</description>
</method>
<method name="convert" >
@@ -475,6 +478,7 @@
<argument index="1" name="..." type="var">
</argument>
<description>
+ Print one or more arguments to the console with a tab between each argument.
</description>
</method>
<method name="printerr" >
@@ -499,6 +503,24 @@
Print one or more arguments to strings in the best way possible to console. No newline is added at the end.
</description>
</method>
+ <method name="var2str" >
+ <return type="String">
+ </return>
+ <argument index="0" name="var" type="var">
+ </argument>
+ <description>
+ Converts the value of a variable to a String.
+ </description>
+ </method>
+ <method name="str2var:var" >
+ <return type="String">
+ </return>
+ <argument index="0" name="str" type="String">
+ </argument>
+ <description>
+ Converts the value of a String to a variable.
+ </description>
+ </method>
<method name="range" >
<return type="Array">
</return>
@@ -544,6 +566,7 @@
<argument index="0" name="var:var" type="var">
</argument>
<description>
+ Hashes the variable passed and returns an integer.
</description>
</method>
<method name="print_stack" >
diff --git a/drivers/etc1/rg_etc1.cpp b/drivers/etc1/rg_etc1.cpp
index cad9af8830..63877e6d12 100644
--- a/drivers/etc1/rg_etc1.cpp
+++ b/drivers/etc1/rg_etc1.cpp
@@ -2367,7 +2367,7 @@ found_perfect_match:
int dr = best_results[1].m_block_color_unscaled.r - best_results[0].m_block_color_unscaled.r;
int dg = best_results[1].m_block_color_unscaled.g - best_results[0].m_block_color_unscaled.g;
int db = best_results[1].m_block_color_unscaled.b - best_results[0].m_block_color_unscaled.b;
- RG_ETC1_ASSERT(best_use_color4 || (rg_etc1::minimum(dr, dg, db) >= cETC1ColorDeltaMin) && (rg_etc1::maximum(dr, dg, db) <= cETC1ColorDeltaMax));
+ RG_ETC1_ASSERT(best_use_color4 || ((rg_etc1::minimum(dr, dg, db) >= cETC1ColorDeltaMin) && (rg_etc1::maximum(dr, dg, db) <= cETC1ColorDeltaMax)));
if (best_use_color4)
{
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index e167b647e7..05c977f344 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -989,8 +989,14 @@ void RasterizerGLES2::texture_set_data(RID p_texture,const Image& p_image,VS::Cu
if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps)
glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,use_fast_texture_filter?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR_MIPMAP_LINEAR);
- else
- glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ else {
+ if (texture->flags&VS::TEXTURE_FLAG_FILTER) {
+ glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ } else {
+ glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
+
+ }
+ }
if (texture->flags&VS::TEXTURE_FLAG_FILTER) {
@@ -1283,8 +1289,14 @@ void RasterizerGLES2::texture_set_flags(RID p_texture,uint32_t p_flags) {
if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && !texture->ignore_mipmaps)
glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,use_fast_texture_filter?GL_LINEAR_MIPMAP_NEAREST:GL_LINEAR_MIPMAP_LINEAR);
- else
- glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ else{
+ if (texture->flags&VS::TEXTURE_FLAG_FILTER) {
+ glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ } else {
+ glTexParameteri(texture->target,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
+
+ }
+ }
if (texture->flags&VS::TEXTURE_FLAG_FILTER) {
@@ -4276,7 +4288,7 @@ void RasterizerGLES2::capture_viewport(Image* r_capture) {
void RasterizerGLES2::clear_viewport(const Color& p_color) {
- if (current_rt) {
+ if (current_rt || using_canvas_bg) {
glScissor( 0, 0, viewport.width, viewport.height );
} else {
@@ -6932,7 +6944,7 @@ void RasterizerGLES2::_draw_tex_bg() {
RID texture;
- if (current_env->bg_mode==VS::ENV_BG_TEXTURE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
+ if (current_env->bg_mode==VS::ENV_BG_TEXTURE) {
texture=current_env->bg_param[VS::ENV_BG_PARAM_TEXTURE];
} else {
texture=current_env->bg_param[VS::ENV_BG_PARAM_CUBEMAP];
@@ -6949,25 +6961,20 @@ void RasterizerGLES2::_draw_tex_bg() {
copy_shader.set_conditional(CopyShaderGLES2::USE_ENERGY,true);
- if (current_env->bg_mode==VS::ENV_BG_TEXTURE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
+ if (current_env->bg_mode==VS::ENV_BG_TEXTURE) {
copy_shader.set_conditional(CopyShaderGLES2::USE_CUBEMAP,false);
} else {
copy_shader.set_conditional(CopyShaderGLES2::USE_CUBEMAP,true);
}
- if (current_env->bg_mode==VS::ENV_BG_CUBEMAP_RGBE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
- copy_shader.set_conditional(CopyShaderGLES2::USE_RGBE,true);
- } else {
- copy_shader.set_conditional(CopyShaderGLES2::USE_RGBE,false);
- }
copy_shader.set_conditional(CopyShaderGLES2::USE_CUSTOM_ALPHA,true);
copy_shader.bind();
- if (current_env->bg_mode==VS::ENV_BG_TEXTURE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
+ if (current_env->bg_mode==VS::ENV_BG_TEXTURE) {
glUniform1i( copy_shader.get_uniform_location(CopyShaderGLES2::SOURCE),0);
} else {
glUniform1i( copy_shader.get_uniform_location(CopyShaderGLES2::SOURCE_CUBE),0);
@@ -6994,7 +7001,7 @@ void RasterizerGLES2::_draw_tex_bg() {
Vector3( 0, 0, 0)
};
- if (current_env->bg_mode==VS::ENV_BG_TEXTURE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
+ if (current_env->bg_mode==VS::ENV_BG_TEXTURE) {
//regular texture
//adjust aspect
@@ -7064,7 +7071,7 @@ void RasterizerGLES2::end_scene() {
if (framebuffer.active) {
//detect when to use the framebuffer object
- if (texscreen_used || framebuffer.scale!=1) {
+ if (using_canvas_bg || texscreen_used || framebuffer.scale!=1) {
use_fb=true;
} else if (current_env) {
use_fb=false;
@@ -7116,6 +7123,7 @@ void RasterizerGLES2::end_scene() {
switch(current_env->bg_mode) {
+ case VS::ENV_BG_CANVAS:
case VS::ENV_BG_KEEP: {
//copy from framebuffer if framebuffer
glClear(GL_DEPTH_BUFFER_BIT);
@@ -7128,7 +7136,7 @@ void RasterizerGLES2::end_scene() {
bgcolor = current_env->bg_param[VS::ENV_BG_PARAM_COLOR];
else
bgcolor = Globals::get_singleton()->get("render/default_clear_color");
- bgcolor = _convert_color(bgcolor);
+ bgcolor = _convert_color(bgcolor);
float a = use_fb ? float(current_env->bg_param[VS::ENV_BG_PARAM_GLOW]) : 1.0;
glClearColor(bgcolor.r,bgcolor.g,bgcolor.b,a);
_glClearDepth(1.0);
@@ -7136,9 +7144,7 @@ void RasterizerGLES2::end_scene() {
} break;
case VS::ENV_BG_TEXTURE:
- case VS::ENV_BG_CUBEMAP:
- case VS::ENV_BG_TEXTURE_RGBE:
- case VS::ENV_BG_CUBEMAP_RGBE: {
+ case VS::ENV_BG_CUBEMAP: {
glClear(GL_DEPTH_BUFFER_BIT);
@@ -7357,8 +7363,12 @@ void RasterizerGLES2::end_scene() {
_debug_shadows();
}
// _debug_luminances();
- _debug_samplers();
+// _debug_samplers();
+ if (using_canvas_bg) {
+ using_canvas_bg=false;
+ glColorMask(1,1,1,1); //don't touch alpha
+ }
}
void RasterizerGLES2::end_shadow_map() {
@@ -7827,8 +7837,26 @@ void RasterizerGLES2::flush_frame() {
/* CANVAS API */
+void RasterizerGLES2::begin_canvas_bg() {
+
+ if (framebuffer.active) {
+ using_canvas_bg=true;
+ glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.fbo);
+ glViewport( 0,0,viewport.width , viewport.height );
+ } else {
+ using_canvas_bg=false;
+ }
+
+}
+
void RasterizerGLES2::canvas_begin() {
+
+ if (using_canvas_bg) {
+ glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.fbo);
+ glColorMask(1,1,1,0); //don't touch alpha
+ }
+
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
@@ -8554,7 +8582,7 @@ RID RasterizerGLES2::canvas_light_shadow_buffer_create(int p_width) {
//printf("errnum: %x\n",status);
#ifdef GLEW_ENABLED
if (read_depth_supported) {
- glDrawBuffer(GL_BACK);
+ //glDrawBuffer(GL_BACK);
}
#endif
glBindFramebuffer(GL_FRAMEBUFFER, base_framebuffer);
@@ -8563,7 +8591,7 @@ RID RasterizerGLES2::canvas_light_shadow_buffer_create(int p_width) {
#ifdef GLEW_ENABLED
if (read_depth_supported) {
- glDrawBuffer(GL_BACK);
+ //glDrawBuffer(GL_BACK);
}
#endif
@@ -9099,8 +9127,10 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
canvas_use_modulate=p_modulate!=Color(1,1,1,1);
canvas_modulate=p_modulate;
canvas_shader.set_conditional(CanvasShaderGLES2::USE_MODULATE,canvas_use_modulate);
+ canvas_shader.set_conditional(CanvasShaderGLES2::USE_DISTANCE_FIELD,false);
bool reset_modulate=false;
+ bool prev_distance_field=false;
while(p_item_list) {
@@ -9116,12 +9146,22 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
canvas_use_modulate=p_modulate!=Color(1,1,1,1);
canvas_modulate=p_modulate;
canvas_shader.set_conditional(CanvasShaderGLES2::USE_MODULATE,canvas_use_modulate);
+ canvas_shader.set_conditional(CanvasShaderGLES2::USE_DISTANCE_FIELD,false);
+ prev_distance_field=false;
rebind_shader=true;
reset_modulate=true;
}
+ if (prev_distance_field!=ci->distance_field) {
+
+ canvas_shader.set_conditional(CanvasShaderGLES2::USE_DISTANCE_FIELD,ci->distance_field);
+ prev_distance_field=ci->distance_field;
+ rebind_shader=true;
+ }
+
+
if (current_clip!=ci->final_clip_owner) {
current_clip=ci->final_clip_owner;
@@ -9138,6 +9178,40 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
}
}
+ if (ci->copy_back_buffer && framebuffer.active && framebuffer.scale==1) {
+
+ Rect2 rect;
+ int x,y,w,h;
+
+ if (ci->copy_back_buffer->full) {
+
+ x = viewport.x;
+ y = window_size.height-(viewport.height+viewport.y);
+ w = viewport.width;
+ h = viewport.height;
+ } else {
+ x = viewport.x+ci->copy_back_buffer->screen_rect.pos.x;
+ y = window_size.height-(viewport.y+ci->copy_back_buffer->screen_rect.pos.y+ci->copy_back_buffer->screen_rect.size.y);
+ w = ci->copy_back_buffer->screen_rect.size.x;
+ h = ci->copy_back_buffer->screen_rect.size.y;
+ }
+ glActiveTexture(GL_TEXTURE0+max_texture_units-1);
+ glBindTexture(GL_TEXTURE_2D,framebuffer.sample_color);
+
+#ifdef GLEW_ENABLED
+ glReadBuffer(GL_COLOR_ATTACHMENT0);
+#endif
+ glCopyTexSubImage2D(GL_TEXTURE_2D,0,x,y,x,y,w,h);
+// if (current_clip) {
+// // print_line(" a clip ");
+// }
+
+ canvas_texscreen_used=true;
+ glActiveTexture(GL_TEXTURE0);
+ }
+
+
+
//begin rect
CanvasItem *material_owner = ci->material_owner?ci->material_owner:ci;
@@ -9276,7 +9350,10 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
normal_flip=Vector2(1,1);
}
- canvas_shader.set_conditional(CanvasShaderGLES2::USE_SHADOWS,light->shadow_buffer.is_valid());
+
+ bool has_shadow = light->shadow_buffer.is_valid() && ci->light_mask&light->item_shadow_mask;
+
+ canvas_shader.set_conditional(CanvasShaderGLES2::USE_SHADOWS,has_shadow);
bool light_rebind = canvas_shader.bind();
@@ -9302,7 +9379,9 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_POS,light->light_shader_pos);
canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_COLOR,light->color);
canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_HEIGHT,light->height);
- if (light->shadow_buffer.is_valid()) {
+ canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_LOCAL_MATRIX,light->xform_cache.affine_inverse());
+
+ if (has_shadow) {
CanvasLightShadow *cls = canvas_light_shadow_owner.get(light->shadow_buffer);
glActiveTexture(GL_TEXTURE0+max_texture_units-3);
@@ -9313,7 +9392,6 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list,int p_z,const
canvas_shader.set_uniform(CanvasShaderGLES2::SHADOW_TEXTURE,max_texture_units-3);
canvas_shader.set_uniform(CanvasShaderGLES2::SHADOW_MATRIX,light->shadow_matrix_cache);
- canvas_shader.set_uniform(CanvasShaderGLES2::LIGHT_LOCAL_MATRIX,light->xform_cache.affine_inverse());
canvas_shader.set_uniform(CanvasShaderGLES2::SHADOW_ESM_MULTIPLIER,light->shadow_esm_mult);
}
@@ -9900,7 +9978,7 @@ bool RasterizerGLES2::ShadowBuffer::init(int p_size,bool p_use_depth) {
//printf("errnum: %x\n",status);
#ifdef GLEW_ENABLED
if (p_use_depth) {
- glDrawBuffer(GL_BACK);
+ //glDrawBuffer(GL_BACK);
}
#endif
glBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -9909,7 +9987,7 @@ bool RasterizerGLES2::ShadowBuffer::init(int p_size,bool p_use_depth) {
#ifdef GLEW_ENABLED
if (p_use_depth) {
- glDrawBuffer(GL_BACK);
+ //glDrawBuffer(GL_BACK);
}
#endif
@@ -10517,7 +10595,7 @@ void RasterizerGLES2::init() {
glBindBuffer(GL_ARRAY_BUFFER,0); //unbind
-
+ using_canvas_bg=false;
_update_framebuffer();
DEBUG_TEST_ERROR("Initializing");
}
diff --git a/drivers/gles2/rasterizer_gles2.h b/drivers/gles2/rasterizer_gles2.h
index f09714f50c..b7895ad82e 100644
--- a/drivers/gles2/rasterizer_gles2.h
+++ b/drivers/gles2/rasterizer_gles2.h
@@ -677,6 +677,7 @@ class RasterizerGLES2 : public Rasterizer {
bg_param[VS::ENV_BG_PARAM_ENERGY]=1.0;
bg_param[VS::ENV_BG_PARAM_SCALE]=1.0;
bg_param[VS::ENV_BG_PARAM_GLOW]=0.0;
+ bg_param[VS::ENV_BG_PARAM_CANVAS_MAX_LAYER]=0;
for(int i=0;i<VS::ENV_FX_MAX;i++)
fx_enabled[i]=false;
@@ -1258,6 +1259,7 @@ class RasterizerGLES2 : public Rasterizer {
void _process_hdr();
void _draw_tex_bg();
+ bool using_canvas_bg;
Size2 window_size;
VS::ViewportRect viewport;
double last_time;
@@ -1600,6 +1602,8 @@ public:
/* CANVAS API */
+ virtual void begin_canvas_bg();
+
virtual void canvas_begin();
virtual void canvas_disable_blending();
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index b2052c7cbb..8d378ceec1 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -61,6 +61,7 @@ static String _typestr(SL::DataType p_type) {
case SL::TYPE_VEC2: return "vec2";
case SL::TYPE_VEC3: return "vec3";
case SL::TYPE_VEC4: return "vec4";
+ case SL::TYPE_MAT2: return "mat2";
case SL::TYPE_MAT3: return "mat3";
case SL::TYPE_MAT4: return "mat4";
case SL::TYPE_TEXTURE: return "sampler2D";
@@ -284,6 +285,7 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a
case SL::TYPE_VEC2: { Vector2 v = cnode->value; code="vec2("+_mknum(v.x)+", "+_mknum(v.y)+")"; } break;
case SL::TYPE_VEC3: { Vector3 v = cnode->value; code="vec3("+_mknum(v.x)+", "+_mknum(v.y)+", "+_mknum(v.z)+")"; } break;
case SL::TYPE_VEC4: { Plane v = cnode->value; code="vec4("+_mknum(v.normal.x)+", "+_mknum(v.normal.y)+", "+_mknum(v.normal.z)+", "+_mknum(v.d)+")"; } break;
+ case SL::TYPE_MAT2: { Matrix32 x = cnode->value; code="mat2( vec2("+_mknum(x[0][0])+", "+_mknum(x[0][1])+"), vec2("+_mknum(x[1][0])+", "+_mknum(x[1][1])+"))"; } break;
case SL::TYPE_MAT3: { Matrix3 x = cnode->value; code="mat3( vec3("+_mknum(x.get_axis(0).x)+", "+_mknum(x.get_axis(0).y)+", "+_mknum(x.get_axis(0).z)+"), vec3("+_mknum(x.get_axis(1).x)+", "+_mknum(x.get_axis(1).y)+", "+_mknum(x.get_axis(1).z)+"), vec3("+_mknum(x.get_axis(2).x)+", "+_mknum(x.get_axis(2).y)+", "+_mknum(x.get_axis(2).z)+"))"; } break;
case SL::TYPE_MAT4: { Transform x = cnode->value; code="mat4( vec4("+_mknum(x.basis.get_axis(0).x)+", "+_mknum(x.basis.get_axis(0).y)+", "+_mknum(x.basis.get_axis(0).z)+",0.0), vec4("+_mknum(x.basis.get_axis(1).x)+", "+_mknum(x.basis.get_axis(1).y)+", "+_mknum(x.basis.get_axis(1).z)+",0.0), vec4("+_mknum(x.basis.get_axis(2).x)+", "+_mknum(x.basis.get_axis(2).y)+", "+_mknum(x.basis.get_axis(2).z)+",0.0), vec4("+_mknum(x.origin.x)+", "+_mknum(x.origin.y)+", "+_mknum(x.origin.z)+",1.0))"; } break;
default: code="<error: "+Variant::get_type_name(cnode->value.get_type())+" ("+itos(cnode->datatype)+">";
@@ -476,6 +478,11 @@ String ShaderCompilerGLES2::dump_node_code(SL::Node *p_node,int p_level,bool p_a
m="[2]";
else if (mnode->name=="w")
m="[3]";
+ } else if (mnode->basetype==SL::TYPE_MAT2) {
+ if (mnode->name=="x")
+ m="[0]";
+ else if (mnode->name=="y")
+ m="[1]";
} else if (mnode->basetype==SL::TYPE_MAT3) {
if (mnode->name=="x")
@@ -657,6 +664,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
replace_table["vec2" ]= "vec2";
replace_table["vec3" ]= "vec3";
replace_table["vec4" ]= "vec4";
+ replace_table["mat2" ]= "mat2";
replace_table["mat3" ]= "mat3";
replace_table["mat4" ]= "mat4";
replace_table["texture" ]= "sampler2D";
@@ -808,12 +816,19 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
mode_replace_table[4]["POINT_COORD"]="gl_PointCoord";
mode_replace_table[4]["TIME"]="time";
- mode_replace_table[5]["SRC_COLOR"]="color";
- mode_replace_table[5]["COLOR"]="color";
+ mode_replace_table[5]["POSITION"]="gl_Position";
mode_replace_table[5]["NORMAL"]="normal";
- mode_replace_table[5]["LIGHT_DIR"]="light_dir";
- mode_replace_table[5]["LIGHT_DISTANCE"]="light_distance";
- mode_replace_table[5]["LIGHT"]="light";
+ mode_replace_table[5]["UV"]="uv_interp";
+ mode_replace_table[5]["COLOR"]="color";
+ mode_replace_table[5]["TEXTURE"]="texture";
+ mode_replace_table[5]["TEXTURE_PIXEL_SIZE"]="texpixel_size";
+ mode_replace_table[5]["VAR1"]="var1_interp";
+ mode_replace_table[5]["VAR2"]="var2_interp";
+ mode_replace_table[5]["LIGHT_VEC"]="light_vec";
+ mode_replace_table[5]["LIGHT_HEIGHT"]="light_height";
+ mode_replace_table[5]["LIGHT_COLOR"]="light";
+ mode_replace_table[5]["LIGHT"]="light_out";
+ mode_replace_table[5]["SCREEN_UV"]="screen_uv";
mode_replace_table[5]["POINT_COORD"]="gl_PointCoord";
mode_replace_table[5]["TIME"]="time";
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index 9022f30d7f..e6d2569977 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -26,6 +26,7 @@ uniform float time;
#ifdef USE_LIGHTING
uniform highp mat4 light_matrix;
+uniform highp mat4 light_local_matrix;
uniform vec2 light_pos;
varying vec4 light_uv_interp;
@@ -80,7 +81,7 @@ VERTEX_SHADER_CODE
#ifdef USE_LIGHTING
light_uv_interp.xy = (light_matrix * outvec).xy;
- light_uv_interp.zw = outvec.xy-light_pos;
+ light_uv_interp.zw =(light_local_matrix * outvec).xy;
#ifdef USE_SHADOWS
pos=outvec.xy;
#endif
@@ -164,7 +165,6 @@ uniform sampler2D shadow_texture;
uniform float shadow_attenuation;
uniform highp mat4 shadow_matrix;
-uniform highp mat4 light_local_matrix;
highp varying vec2 pos;
uniform float shadowpixel_size;
@@ -188,15 +188,24 @@ void main() {
vec4 color = color_interp;
#if defined(NORMAL_USED)
- vec3 normal = vec3(0,0,1);
+ vec3 normal = vec3(0.0,0.0,1.0);
#endif
-
+#ifdef USE_DISTANCE_FIELD
+ const float smoothing = 1.0/32.0;
+ float distance = texture2D(texture, uv_interp).a;
+ color.a = smoothstep(0.5 - smoothing, 0.5 + smoothing, distance);
+#else
color *= texture2D( texture, uv_interp );
+
+#endif
+
+
#if defined(ENABLE_SCREEN_UV)
vec2 screen_uv = gl_FragCoord.xy*screen_uv_mult;
#endif
+
{
FRAGMENT_SHADER_CODE
}
@@ -213,79 +222,110 @@ FRAGMENT_SHADER_CODE
#ifdef USE_LIGHTING
+ vec2 light_vec = light_uv_interp.zw;; //for shadow and normal mapping
+
#if defined(NORMAL_USED)
normal.xy = mat2(local_rot.xy,local_rot.zw) * normal.xy;
#endif
float att=1.0;
- vec4 light = texture2D(light_texture,light_uv_interp.xy) * light_color;
-#ifdef USE_SHADOWS
+ vec4 light = texture2D(light_texture,light_uv_interp.xy) * light_color;
+#if defined(USE_LIGHT_SHADER_CODE)
+//light is written by the light shader
+{
+ vec4 light_out=vec4(0.0,0.0,0.0,0.0);
+LIGHT_SHADER_CODE
+ color=light_out;
+}
- vec2 lpos = (light_local_matrix * vec4(pos,0.0,1.0)).xy;
- float angle_to_light = -atan(lpos.x,lpos.y);
- float PI = 3.14159265358979323846264;
- /*int i = int(mod(floor((angle_to_light+7.0*PI/6.0)/(4.0*PI/6.0))+1.0, 3.0)); // +1 pq os indices estao em ordem 2,0,1 nos arrays
- float ang*/
+#else
- float su,sz;
+#if defined(NORMAL_USED)
+ vec3 light_normal = normalize(vec3(light_vec,-light_height));
+ light*=max(dot(-light_normal,normal),0.0);
+#endif
- float abs_angle = abs(angle_to_light);
- vec2 point;
- float sh;
- if (abs_angle<45.0*PI/180.0) {
- point = lpos;
- sh=0+(1.0/8.0);
- } else if (abs_angle>135.0*PI/180.0) {
- point = -lpos;
- sh = 0.5+(1.0/8.0);
- } else if (angle_to_light>0) {
+ color*=light;
+/*
+#ifdef USE_NORMAL
+ color.xy=local_rot.xy;//normal.xy;
+ color.zw=vec2(0.0,1.0);
+#endif
+*/
- point = vec2(lpos.y,-lpos.x);
- sh = 0.25+(1.0/8.0);
+//light shader code
+#endif
+
+ if (any(lessThan(light_uv_interp.xy,vec2(0.0,0.0))) || any(greaterThanEqual(light_uv_interp.xy,vec2(1.0,1.0)))) {
+ color.a=0.0; //invisible
} else {
- point = vec2(-lpos.y,lpos.x);
- sh = 0.75+(1.0/8.0);
+#ifdef USE_SHADOWS
- }
+ float angle_to_light = -atan(light_vec.x,light_vec.y);
+ float PI = 3.14159265358979323846264;
+ /*int i = int(mod(floor((angle_to_light+7.0*PI/6.0)/(4.0*PI/6.0))+1.0, 3.0)); // +1 pq os indices estao em ordem 2,0,1 nos arrays
+ float ang*/
+
+ float su,sz;
+
+ float abs_angle = abs(angle_to_light);
+ vec2 point;
+ float sh;
+ if (abs_angle<45.0*PI/180.0) {
+ point = light_vec;
+ sh=0.0+(1.0/8.0);
+ } else if (abs_angle>135.0*PI/180.0) {
+ point = -light_vec;
+ sh = 0.5+(1.0/8.0);
+ } else if (angle_to_light>0.0) {
+ point = vec2(light_vec.y,-light_vec.x);
+ sh = 0.25+(1.0/8.0);
+ } else {
- vec4 s = shadow_matrix * vec4(point,0.0,1.0);
- s.xyz/=s.w;
- su=s.x*0.5+0.5;
- sz=s.z*0.5+0.5;
+ point = vec2(-light_vec.y,light_vec.x);
+ sh = 0.75+(1.0/8.0);
- float shadow_attenuation;
+ }
+
+
+ vec4 s = shadow_matrix * vec4(point,0.0,1.0);
+ s.xyz/=s.w;
+ su=s.x*0.5+0.5;
+ sz=s.z*0.5+0.5;
+
+ float shadow_attenuation;
#ifdef SHADOW_PCF5
- shadow_attenuation=0.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*2.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*2.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation/=5.0;
+ shadow_attenuation=0.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*2.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*2.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation/=5.0;
#endif
#ifdef SHADOW_PCF13
- shadow_attenuation += texture2D(shadow_texture,vec2(su,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*2.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*3.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*4.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*5.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*6.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*2.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*3.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*4.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*5.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*6.0,sh)).z<sz?0.0:1.0;
- shadow_attenuation/=13.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*2.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*3.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*4.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*5.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su+shadowpixel_size*6.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*2.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*3.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*4.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*5.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation += texture2D(shadow_texture,vec2(su-shadowpixel_size*6.0,sh)).z<sz?0.0:1.0;
+ shadow_attenuation/=13.0;
#endif
@@ -293,56 +333,28 @@ FRAGMENT_SHADER_CODE
{
- float unnormalized = su/shadowpixel_size;
- float fractional = fract(unnormalized);
- unnormalized = floor(unnormalized);
- float zc = texture2D(shadow_texture,vec2((unnormalized-0.5)*shadowpixel_size,sh)).z;
- float zn = texture2D(shadow_texture,vec2((unnormalized+0.5)*shadowpixel_size,sh)).z;
- float z = mix(zc,zn,fractional);
- shadow_attenuation=clamp(exp(shadow_esm_multiplier* ( z - sz )),0.0,1.0);
+ float unnormalized = su/shadowpixel_size;
+ float fractional = fract(unnormalized);
+ unnormalized = floor(unnormalized);
+ float zc = texture2D(shadow_texture,vec2((unnormalized-0.5)*shadowpixel_size,sh)).z;
+ float zn = texture2D(shadow_texture,vec2((unnormalized+0.5)*shadowpixel_size,sh)).z;
+ float z = mix(zc,zn,fractional);
+ shadow_attenuation=clamp(exp(shadow_esm_multiplier* ( z - sz )),0.0,1.0);
}
#endif
#if !defined(SHADOW_PCF5) && !defined(SHADOW_PCF13) && !defined(SHADOW_ESM)
- shadow_attenuation = texture2D(shadow_texture,vec2(su+shadowpixel_size,sh)).z<sz?0.0:1.0;
+ shadow_attenuation = texture2D(shadow_texture,vec2(su+shadowpixel_size,sh)).z<sz?0.0:1.0;
#endif
- light*=shadow_attenuation;
+ color.rgb*=shadow_attenuation;
//use shadows
#endif
-
-#if defined(USE_LIGHT_SHADER_CODE)
-//light is written by the light shader
-{
- vec2 light_dir = normalize(light_uv_interp.zw);
- float light_distance = length(light_uv_interp.zw);
-LIGHT_SHADER_CODE
-}
-
-#else
-
-#if defined(NORMAL_USED)
- vec3 light_normal = normalize(vec3(light_uv_interp.zw,-light_height));
- light*=max(dot(-light_normal,normal),0);
-#endif
-
- color*=light;
-/*
-#ifdef USE_NORMAL
- color.xy=local_rot.xy;//normal.xy;
- color.zw=vec2(0.0,1.0);
-#endif
-*/
- if (any(lessThan(light_uv_interp.xy,vec2(0.0,0.0))) || any(greaterThanEqual(light_uv_interp.xy,vec2(1.0,1.0)))) {
- color.a=0.0; //invisible
}
-//light shader code
-#endif
-
//use lighting
#endif
// color.rgb*=color.a;
diff --git a/drivers/trex/trex.c b/drivers/trex/trex.c
index e63a248e9e..b3668c3a11 100644
--- a/drivers/trex/trex.c
+++ b/drivers/trex/trex.c
@@ -489,7 +489,7 @@ static const TRexChar *trex_matchnode(TRex* exp,TRexNode *node,const TRexChar *s
return cur;
}
case OP_WB:
- if(str == exp->_bol && !isspace(*str)
+ if((str == exp->_bol && !isspace(*str))
|| (str == exp->_eol && !isspace(*(str-1)))
|| (!isspace(*str) && isspace(*(str+1)))
|| (isspace(*str) && !isspace(*(str+1))) ) {
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 452d791d96..5f51865432 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -161,6 +161,7 @@ String DirAccessUnix::get_next() {
}
+ _cishidden=(fname!="." && fname!=".." && fname.begins_with("."));
@@ -173,6 +174,11 @@ bool DirAccessUnix::current_is_dir() const {
return _cisdir;
}
+bool DirAccessUnix::current_is_hidden() const {
+
+ return _cishidden;
+}
+
void DirAccessUnix::list_dir_end() {
diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h
index 119cb5c3f4..f6089ccfe1 100644
--- a/drivers/unix/dir_access_unix.h
+++ b/drivers/unix/dir_access_unix.h
@@ -50,12 +50,14 @@ class DirAccessUnix : public DirAccess {
String current_dir;
bool _cisdir;
+ bool _cishidden;
public:
virtual bool list_dir_begin(); ///< This starts dir listing
virtual String get_next();
virtual bool current_is_dir() const;
+ virtual bool current_is_hidden() const;
virtual void list_dir_end(); ///<
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp
index 7f85526852..2f91eee90e 100644
--- a/drivers/unix/file_access_unix.cpp
+++ b/drivers/unix/file_access_unix.cpp
@@ -74,7 +74,7 @@ Error FileAccessUnix::_open(const String& p_path, int p_mode_flags) {
else if (p_mode_flags==WRITE)
mode_string="wb";
else if (p_mode_flags==READ_WRITE)
- mode_string="wb+";
+ mode_string="rb+";
else
return ERR_INVALID_PARAMETER;
diff --git a/drivers/vorbis/codebook.c b/drivers/vorbis/codebook.c
index 759d7b4254..8a928cebb9 100644
--- a/drivers/vorbis/codebook.c
+++ b/drivers/vorbis/codebook.c
@@ -248,7 +248,7 @@ static_codebook *vorbis_staticbook_unpack(oggpack_buffer *opb){
}
/* quantized values */
- if((quantvals*s->q_quant+7>>3)>opb->storage-oggpack_bytes(opb))
+ if(((quantvals*s->q_quant+7)>>3)>opb->storage-oggpack_bytes(opb))
goto _eofout;
s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals);
for(i=0;i<quantvals;i++)
diff --git a/drivers/vorbis/floor1.c b/drivers/vorbis/floor1.c
index 9f3154a6a3..ae3dcedb1f 100644
--- a/drivers/vorbis/floor1.c
+++ b/drivers/vorbis/floor1.c
@@ -1035,7 +1035,7 @@ static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
}
}
- fit_value[i]=val+predicted&0x7fff;
+ fit_value[i]=(val+predicted)&0x7fff;
fit_value[look->loneighbor[i-2]]&=0x7fff;
fit_value[look->hineighbor[i-2]]&=0x7fff;
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index d1e9766105..4c265a1ab2 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -68,6 +68,7 @@ struct DirAccessWindowsPrivate {
bool DirAccessWindows::list_dir_begin() {
_cisdir=false;
+ _cishidden=false;
if (unicode) {
list_dir_end();
@@ -95,6 +96,8 @@ String DirAccessWindows::get_next() {
if (unicode) {
_cisdir=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+ _cishidden=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN);
+
String name=p->fu.cFileName;
if (FindNextFileW(p->h, &p->fu) == 0) {
@@ -108,6 +111,7 @@ String DirAccessWindows::get_next() {
#ifndef WINRT_ENABLED
_cisdir=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+ _cishidden=(p->fu.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN);
String name=p->f.cFileName;
@@ -128,6 +132,11 @@ bool DirAccessWindows::current_is_dir() const {
return _cisdir;
}
+bool DirAccessWindows::current_is_hidden() const {
+
+ return _cishidden;
+}
+
void DirAccessWindows::list_dir_end() {
if (p->h!=INVALID_HANDLE_VALUE) {
@@ -270,7 +279,7 @@ Error DirAccessWindows::make_dir(String p_dir) {
return OK;
};
- if (err == ERROR_ALREADY_EXISTS) {
+ if (err == ERROR_ALREADY_EXISTS || err == ERROR_ACCESS_DENIED) {
return ERR_ALREADY_EXISTS;
};
diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h
index 36530ba9b3..906ce0d064 100644
--- a/drivers/windows/dir_access_windows.h
+++ b/drivers/windows/dir_access_windows.h
@@ -58,6 +58,7 @@ class DirAccessWindows : public DirAccess {
bool unicode;
bool _cisdir;
+ bool _cishidden;
public:
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index e24685432c..19a62967ea 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -28,8 +28,10 @@
/*************************************************************************/
#ifdef WINDOWS_ENABLED
-#include <Windows.h>
-#include "Shlwapi.h"
+#define WINVER 0x0500
+
+#include <windows.h>
+#include "shlwapi.h"
#include "file_access_windows.h"
@@ -69,7 +71,7 @@ Error FileAccessWindows::_open(const String& p_filename, int p_mode_flags) {
else if (p_mode_flags==WRITE)
mode_string=L"wb";
else if (p_mode_flags==READ_WRITE)
- mode_string=L"wb+";
+ mode_string=L"rb+";
else
return ERR_INVALID_PARAMETER;
diff --git a/modules/gdscript/gd_functions.cpp b/modules/gdscript/gd_functions.cpp
index b616d8f228..f37b2f645a 100644
--- a/modules/gdscript/gd_functions.cpp
+++ b/modules/gdscript/gd_functions.cpp
@@ -1101,7 +1101,7 @@ MethodInfo GDFunctions::get_info(Function p_func) {
return mi;
} break;
case MATH_LERP: {
- MethodInfo mi("lerp",PropertyInfo(Variant::REAL,"a"),PropertyInfo(Variant::REAL,"b"), PropertyInfo(Variant::REAL,"c"));
+ MethodInfo mi("lerp",PropertyInfo(Variant::REAL,"from"),PropertyInfo(Variant::REAL,"to"), PropertyInfo(Variant::REAL,"weight"));
mi.return_val.type=Variant::REAL;
return mi;
} break;
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index d3a9abf4b7..06c746c4fb 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -337,9 +337,10 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a
Variant::evaluate(op,*a,*b,*dst,valid);
if (!valid) {
- if (false && dst->get_type()==Variant::STRING) {
+ if (dst->get_type()==Variant::STRING) {
//return a string when invalid with the error
err_text=*dst;
+ err_text += " in operator '"+Variant::get_operator_name(op)+"'.";
} else {
err_text="Invalid operands '"+Variant::get_type_name(a->get_type())+"' and '"+Variant::get_type_name(b->get_type())+"' in operator '"+Variant::get_operator_name(op)+"'.";
}
diff --git a/platform/android/dir_access_android.cpp b/platform/android/dir_access_android.cpp
index 60bde61fc4..80311e5a08 100644
--- a/platform/android/dir_access_android.cpp
+++ b/platform/android/dir_access_android.cpp
@@ -79,6 +79,9 @@ bool DirAccessAndroid::current_is_dir() const{
return false;
}
+bool DirAccessAndroid::current_is_hidden() const{
+ return current!="." && current!=".." && current.begins_with(".");
+}
void DirAccessAndroid::list_dir_end(){
if (aad==NULL)
diff --git a/platform/android/dir_access_android.h b/platform/android/dir_access_android.h
index a6aead6eb3..57683542fa 100644
--- a/platform/android/dir_access_android.h
+++ b/platform/android/dir_access_android.h
@@ -52,6 +52,7 @@ public:
virtual bool list_dir_begin(); ///< This starts dir listing
virtual String get_next();
virtual bool current_is_dir() const;
+ virtual bool current_is_hidden() const;
virtual void list_dir_end(); ///<
virtual int get_drive_count();
diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp
index f32e16e7d8..fda4ca7357 100644
--- a/platform/android/dir_access_jandroid.cpp
+++ b/platform/android/dir_access_jandroid.cpp
@@ -105,6 +105,9 @@ bool DirAccessJAndroid::current_is_dir() const{
return true;
}
+bool DirAccessAndroid::current_is_hidden() const{
+ return current!="." && current!=".." && current.begins_with(".");
+}
void DirAccessJAndroid::list_dir_end(){
if (id==0)
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 62bab00f7b..9cdf04797c 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -1,4 +1,90 @@
-
+#
+# tested on | Windows native | Linux cross-compilation
+# ------------------------+-------------------+---------------------------
+# MSVS C++ 2010 Express | WORKS | n/a
+# Mingw-w64 | WORKS | WORKS
+# Mingw-w32 | WORKS | WORKS
+# MinGW | WORKS | untested
+#
+#####
+# Notes about MSVS C++ :
+#
+# - MSVC2010-Express compiles to 32bits only.
+#
+#####
+# Notes about Mingw-w64 and Mingw-w32 under Windows :
+#
+# - both can be installed using the official installer :
+# http://mingw-w64.sourceforge.net/download.php#mingw-builds
+#
+# - if you want to compile both 32bits and 64bits, don't forget to
+# run the installer twice to install them both.
+#
+# - install them into a path that does not contain spaces
+# ( example : "C:/Mingw-w32", "C:/Mingw-w64" )
+#
+# - if you want to compile faster using the "-j" option, don't forget
+# to install the appropriate version of the Pywin32 python extension
+# available from : http://sourceforge.net/projects/pywin32/files/
+#
+# - before running scons, you must add into the environment path
+# the path to the "/bin" directory of the Mingw version you want
+# to use :
+#
+# set PATH=C:/Mingw-w32/bin;%PATH%
+#
+# - then, scons should be able to detect gcc.
+# - Mingw-w32 only compiles 32bits.
+# - Mingw-w64 only compiles 64bits.
+#
+# - it is possible to add them both at the same time into the PATH env,
+# if you also define the MINGW32_PREFIX and MINGW64_PREFIX environment
+# variables.
+# For instance, you could store that set of commands into a .bat script
+# that you would run just before scons :
+#
+# set PATH=C:\mingw-w32\bin;%PATH%
+# set PATH=C:\mingw-w64\bin;%PATH%
+# set MINGW32_PREFIX=C:\mingw-w32\bin\
+# set MINGW64_PREFIX=C:\mingw-w64\bin\
+#
+#####
+# Notes about Mingw, Mingw-w64 and Mingw-w32 under Linux :
+#
+# - default toolchain prefixes are :
+# "i586-mingw32msvc-" for MinGW
+# "i686-w64-mingw32-" for Mingw-w32
+# "x86_64-w64-mingw32-" for Mingw-w64
+#
+# - if both MinGW and Mingw-w32 are installed on your system
+# Mingw-w32 should take the priority over MinGW.
+#
+# - it is possible to manually override prefixes by defining
+# the MINGW32_PREFIX and MINGW64_PREFIX environment variables.
+#
+#####
+# Notes about Mingw under Windows :
+#
+# - this is the MinGW version from http://mingw.org/
+# - install it into a path that does not contain spaces
+# ( example : "C:/MinGW" )
+# - several DirectX headers might be missing. You can copy them into
+# the C:/MinGW/include" directory from this page :
+# https://code.google.com/p/mingw-lib/source/browse/trunk/working/avcodec_to_widget_5/directx_include/
+# - before running scons, add the path to the "/bin" directory :
+# set PATH=C:/MinGW/bin;%PATH%
+# - scons should be able to detect gcc.
+#
+
+#####
+# TODO :
+#
+# - finish to cleanup this script to remove all the remains of previous hacks and workarounds
+# - make it work with the Windows7 SDK that is supposed to enable 64bits compilation for MSVC2010-Express
+# - confirm it works well with other Visual Studio versions.
+# - update the wiki about the pywin32 extension required for the "-j" option under Windows.
+# - update the wiki to document MINGW32_PREFIX and MINGW64_PREFIX
+#
import os
@@ -13,50 +99,70 @@ def get_name():
def can_build():
-
if (os.name=="nt"):
#building natively on windows!
if (os.getenv("VSINSTALLDIR")):
return True
else:
- print("MSVC Not detected, attempting mingw.")
+ print("\nMSVC not detected, attempting Mingw.")
+ mingw32 = ""
+ mingw64 = ""
+ if ( os.getenv("MINGW32_PREFIX") ) :
+ mingw32 = os.getenv("MINGW32_PREFIX")
+ if ( os.getenv("MINGW64_PREFIX") ) :
+ mingw64 = os.getenv("MINGW64_PREFIX")
+
+ test = "gcc --version > NUL 2>&1"
+ if os.system(test)!= 0 and os.system(mingw32+test)!=0 and os.system(mingw64+test)!=0 :
+ print("- could not detect gcc.")
+ print("Please, make sure a path to a Mingw /bin directory is accessible into the environment PATH.\n")
+ return False
+ else:
+ print("- gcc detected.")
+
return True
-
-
if (os.name=="posix"):
mingw = "i586-mingw32msvc-"
- mingw64 = "i686-w64-mingw32-"
+ mingw64 = "x86_64-w64-mingw32-"
+ mingw32 = "i686-w64-mingw32-"
+
if (os.getenv("MINGW32_PREFIX")):
- mingw=os.getenv("MINGW32_PREFIX")
+ mingw32=os.getenv("MINGW32_PREFIX")
+ mingw = mingw32
if (os.getenv("MINGW64_PREFIX")):
mingw64=os.getenv("MINGW64_PREFIX")
-
- if os.system(mingw+"gcc --version >/dev/null") == 0 or os.system(mingw64+"gcc --version >/dev/null") ==0:
+
+ test = "gcc --version >/dev/null"
+ if os.system(mingw+test) == 0 or os.system(mingw64+test) ==0 or os.system(mingw32+test) ==0 :
return True
-
-
return False
def get_opts():
mingw=""
+ mingw32=""
mingw64=""
- if (os.name!="nt"):
+ if ( os.name == "posix" ):
mingw = "i586-mingw32msvc-"
- mingw64 = "i686-w64-mingw32-"
- if (os.getenv("MINGW32_PREFIX")):
- mingw=os.getenv("MINGW32_PREFIX")
- if (os.getenv("MINGW64_PREFIX")):
- mingw64=os.getenv("MINGW64_PREFIX")
+ mingw32 = "i686-w64-mingw32-"
+ mingw64 = "x86_64-w64-mingw32-"
+
+ if os.system(mingw32+"gcc --version >/dev/null") != 0 :
+ mingw32 = mingw
+
+ if (os.getenv("MINGW32_PREFIX")):
+ mingw32=os.getenv("MINGW32_PREFIX")
+ mingw = mingw32
+ if (os.getenv("MINGW64_PREFIX")):
+ mingw64=os.getenv("MINGW64_PREFIX")
return [
- ('mingw_prefix','Mingw Prefix',mingw),
+ ('mingw_prefix','Mingw Prefix',mingw32),
('mingw_prefix_64','Mingw Prefix 64 bits',mingw64),
- ('mingw64_for_32','Use Mingw 64 for 32 Bits Build',"no"),
]
def get_flags():
@@ -140,13 +246,13 @@ def configure(env):
# http://www.scons.org/wiki/LongCmdLinesOnWin32
if (os.name=="nt"):
import subprocess
- def mySpawn(sh, escape, cmd, args, env):
- newargs = ' '.join(args[1:])
- cmdline = cmd + " " + newargs
+
+ def mySubProcess(cmdline,env):
+ #print "SPAWNED : " + cmdline
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
+ stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
data, err = proc.communicate()
rv = proc.wait()
if rv:
@@ -154,35 +260,45 @@ def configure(env):
print err
print "====="
return rv
+
+ def mySpawn(sh, escape, cmd, args, env):
+
+ newargs = ' '.join(args[1:])
+ cmdline = cmd + " " + newargs
+
+ rv=0
+ if len(cmdline) > 32000 and cmd.endswith("ar") :
+ cmdline = cmd + " " + args[1] + " " + args[2] + " "
+ for i in range(3,len(args)) :
+ rv = mySubProcess( cmdline + args[i], env )
+ if rv :
+ break
+ else:
+ rv = mySubProcess( cmdline, env )
+
+ return rv
+
env['SPAWN'] = mySpawn
#build using mingw
if (os.name=="nt"):
env['ENV']['TMP'] = os.environ['TMP'] #way to go scons, you can be so stupid sometimes
else:
- env["PROGSUFFIX"]=env["PROGSUFFIX"]+".exe"
+ env["PROGSUFFIX"]=env["PROGSUFFIX"]+".exe" # for linux cross-compilation
mingw_prefix=""
if (env["bits"]=="default"):
env["bits"]="32"
- use64=False
if (env["bits"]=="32"):
-
- if (env["mingw64_for_32"]=="yes"):
- env.Append(CCFLAGS=['-m32'])
- env.Append(LINKFLAGS=['-m32'])
- env.Append(LINKFLAGS=['-static-libgcc'])
- env.Append(LINKFLAGS=['-static-libstdc++'])
- mingw_prefix=env["mingw_prefix_64"];
- else:
- mingw_prefix=env["mingw_prefix"];
-
-
+ env.Append(LINKFLAGS=['-static'])
+ env.Append(LINKFLAGS=['-static-libgcc'])
+ env.Append(LINKFLAGS=['-static-libstdc++'])
+ mingw_prefix=env["mingw_prefix"];
else:
- mingw_prefix=env["mingw_prefix_64"];
env.Append(LINKFLAGS=['-static'])
+ mingw_prefix=env["mingw_prefix_64"];
nulstr=""
@@ -193,10 +309,10 @@ def configure(env):
- if os.system(mingw_prefix+"gcc --version"+nulstr)!=0:
- #not really super consistent but..
- print("Can't find Windows compiler: "+mingw_prefix)
- sys.exit(255)
+ # if os.system(mingw_prefix+"gcc --version"+nulstr)!=0:
+ # #not really super consistent but..
+ # print("Can't find Windows compiler: "+mingw_prefix)
+ # sys.exit(255)
if (env["target"]=="release"):
@@ -231,11 +347,11 @@ def configure(env):
env.Append(CCFLAGS=['-DGLES2_ENABLED','-DGLEW_ENABLED'])
env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','kernel32'])
- if (env["bits"]=="32" and env["mingw64_for_32"]!="yes"):
-# env.Append(LIBS=['gcc_s'])
- #--with-arch=i686
- env.Append(CPPFLAGS=['-march=i686'])
- env.Append(LINKFLAGS=['-march=i686'])
+ # if (env["bits"]=="32"):
+# # env.Append(LIBS=['gcc_s'])
+ # #--with-arch=i686
+ # env.Append(CPPFLAGS=['-march=i686'])
+ # env.Append(LINKFLAGS=['-march=i686'])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index e392a56aa8..50c42448f4 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1862,6 +1862,7 @@ String OS_Windows::get_stdin_string(bool p_block) {
void OS_Windows::move_window_to_foreground() {
SetForegroundWindow(hWnd);
+ BringWindowToTop(hWnd);
}
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index fce21f6001..a5c455ce64 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -216,6 +216,119 @@ void Area2D::_body_inout(int p_status,const RID& p_body, int p_instance, int p_b
}
+
+void Area2D::_area_enter_tree(ObjectID p_id) {
+
+ Object *obj = ObjectDB::get_instance(p_id);
+ Node *node = obj ? obj->cast_to<Node>() : NULL;
+ ERR_FAIL_COND(!node);
+
+ Map<ObjectID,AreaState>::Element *E=area_map.find(p_id);
+ ERR_FAIL_COND(!E);
+ ERR_FAIL_COND(E->get().in_tree);
+
+ E->get().in_tree=true;
+ emit_signal(SceneStringNames::get_singleton()->area_enter,node);
+ for(int i=0;i<E->get().shapes.size();i++) {
+
+ emit_signal(SceneStringNames::get_singleton()->area_enter_shape,p_id,node,E->get().shapes[i].area_shape,E->get().shapes[i].self_shape);
+ }
+
+}
+
+void Area2D::_area_exit_tree(ObjectID p_id) {
+
+ Object *obj = ObjectDB::get_instance(p_id);
+ Node *node = obj ? obj->cast_to<Node>() : NULL;
+ ERR_FAIL_COND(!node);
+ Map<ObjectID,AreaState>::Element *E=area_map.find(p_id);
+ ERR_FAIL_COND(!E);
+ ERR_FAIL_COND(!E->get().in_tree);
+ E->get().in_tree=false;
+ emit_signal(SceneStringNames::get_singleton()->area_exit,node);
+ for(int i=0;i<E->get().shapes.size();i++) {
+
+ emit_signal(SceneStringNames::get_singleton()->area_exit_shape,p_id,node,E->get().shapes[i].area_shape,E->get().shapes[i].self_shape);
+ }
+
+}
+
+void Area2D::_area_inout(int p_status,const RID& p_area, int p_instance, int p_area_shape,int p_self_shape) {
+
+ bool area_in = p_status==Physics2DServer::AREA_BODY_ADDED;
+ ObjectID objid=p_instance;
+
+ Object *obj = ObjectDB::get_instance(objid);
+ Node *node = obj ? obj->cast_to<Node>() : NULL;
+
+ Map<ObjectID,AreaState>::Element *E=area_map.find(objid);
+
+ ERR_FAIL_COND(!area_in && !E);
+
+ locked=true;
+
+ if (area_in) {
+ if (!E) {
+
+ E = area_map.insert(objid,AreaState());
+ E->get().rc=0;
+ E->get().in_tree=node && node->is_inside_tree();
+ if (node) {
+ node->connect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_area_enter_tree,make_binds(objid));
+ node->connect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_area_exit_tree,make_binds(objid));
+ if (E->get().in_tree) {
+ emit_signal(SceneStringNames::get_singleton()->area_enter,node);
+ }
+ }
+
+ }
+ E->get().rc++;
+ if (node)
+ E->get().shapes.insert(AreaShapePair(p_area_shape,p_self_shape));
+
+
+ if (!node || E->get().in_tree) {
+ emit_signal(SceneStringNames::get_singleton()->area_enter_shape,objid,node,p_area_shape,p_self_shape);
+ }
+
+ } else {
+
+ E->get().rc--;
+
+ if (node)
+ E->get().shapes.erase(AreaShapePair(p_area_shape,p_self_shape));
+
+ bool eraseit=false;
+
+ if (E->get().rc==0) {
+
+ if (node) {
+ node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_area_enter_tree);
+ node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_area_exit_tree);
+ if (E->get().in_tree)
+ emit_signal(SceneStringNames::get_singleton()->area_exit,obj);
+
+ }
+
+ eraseit=true;
+
+ }
+ if (!node || E->get().in_tree) {
+ emit_signal(SceneStringNames::get_singleton()->area_exit_shape,objid,obj,p_area_shape,p_self_shape);
+ }
+
+ if (eraseit)
+ area_map.erase(E);
+
+ }
+
+ locked=false;
+
+
+}
+
+
+
void Area2D::_clear_monitoring() {
if (locked) {
@@ -223,27 +336,56 @@ void Area2D::_clear_monitoring() {
}
ERR_FAIL_COND(locked);
- Map<ObjectID,BodyState> bmcopy = body_map;
- body_map.clear();
- //disconnect all monitored stuff
+ {
+ Map<ObjectID,BodyState> bmcopy = body_map;
+ body_map.clear();
+ //disconnect all monitored stuff
- for (Map<ObjectID,BodyState>::Element *E=bmcopy.front();E;E=E->next()) {
+ for (Map<ObjectID,BodyState>::Element *E=bmcopy.front();E;E=E->next()) {
- Object *obj = ObjectDB::get_instance(E->key());
- Node *node = obj ? obj->cast_to<Node>() : NULL;
- ERR_CONTINUE(!node);
- if (!E->get().in_tree)
- continue;
+ Object *obj = ObjectDB::get_instance(E->key());
+ Node *node = obj ? obj->cast_to<Node>() : NULL;
+ ERR_CONTINUE(!node);
+ if (!E->get().in_tree)
+ continue;
- for(int i=0;i<E->get().shapes.size();i++) {
+ for(int i=0;i<E->get().shapes.size();i++) {
- emit_signal(SceneStringNames::get_singleton()->body_exit_shape,E->key(),node,E->get().shapes[i].body_shape,E->get().shapes[i].area_shape);
+ emit_signal(SceneStringNames::get_singleton()->body_exit_shape,E->key(),node,E->get().shapes[i].body_shape,E->get().shapes[i].area_shape);
+ }
+
+ emit_signal(SceneStringNames::get_singleton()->body_exit,obj);
+
+ node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree);
+ node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree);
}
- emit_signal(SceneStringNames::get_singleton()->body_exit,obj);
+ }
- node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_body_enter_tree);
- node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_body_exit_tree);
+ {
+
+ Map<ObjectID,AreaState> bmcopy = area_map;
+ area_map.clear();
+ //disconnect all monitored stuff
+
+ for (Map<ObjectID,AreaState>::Element *E=bmcopy.front();E;E=E->next()) {
+
+ Object *obj = ObjectDB::get_instance(E->key());
+ Node *node = obj ? obj->cast_to<Node>() : NULL;
+ ERR_CONTINUE(!node);
+ if (!E->get().in_tree)
+ continue;
+
+ for(int i=0;i<E->get().shapes.size();i++) {
+
+ emit_signal(SceneStringNames::get_singleton()->area_exit_shape,E->key(),node,E->get().shapes[i].area_shape,E->get().shapes[i].self_shape);
+ }
+
+ emit_signal(SceneStringNames::get_singleton()->area_exit,obj);
+
+ node->disconnect(SceneStringNames::get_singleton()->enter_tree,this,SceneStringNames::get_singleton()->_area_enter_tree);
+ node->disconnect(SceneStringNames::get_singleton()->exit_tree,this,SceneStringNames::get_singleton()->_area_exit_tree);
+ }
}
}
@@ -276,8 +418,10 @@ void Area2D::set_enable_monitoring(bool p_enable) {
if (monitoring) {
Physics2DServer::get_singleton()->area_set_monitor_callback(get_rid(),this,"_body_inout");
+ Physics2DServer::get_singleton()->area_set_area_monitor_callback(get_rid(),this,"_area_inout");
} else {
Physics2DServer::get_singleton()->area_set_monitor_callback(get_rid(),NULL,StringName());
+ Physics2DServer::get_singleton()->area_set_area_monitor_callback(get_rid(),NULL,StringName());
_clear_monitoring();
}
@@ -288,6 +432,26 @@ bool Area2D::is_monitoring_enabled() const {
return monitoring;
}
+void Area2D::set_monitorable(bool p_enable) {
+
+ if (locked) {
+ ERR_EXPLAIN("This function can't be used during the in/out signal.");
+ }
+ ERR_FAIL_COND(locked);
+
+ if (p_enable==monitorable)
+ return;
+
+ monitorable=p_enable;
+
+ Physics2DServer::get_singleton()->area_set_monitorable(get_rid(),monitorable);
+}
+
+bool Area2D::is_monitorable() const {
+
+ return monitorable;
+}
+
Array Area2D::get_overlapping_bodies() const {
ERR_FAIL_COND_V(!monitoring,Array());
@@ -307,12 +471,56 @@ Array Area2D::get_overlapping_bodies() const {
return ret;
}
+Array Area2D::get_overlapping_areas() const {
+
+ ERR_FAIL_COND_V(!monitoring,Array());
+ Array ret;
+ ret.resize(area_map.size());
+ int idx=0;
+ for (const Map<ObjectID,AreaState>::Element *E=area_map.front();E;E=E->next()) {
+ Object *obj = ObjectDB::get_instance(E->key());
+ if (!obj) {
+ ret.resize( ret.size() -1 ); //ops
+ } else {
+ ret[idx++]=obj;
+ }
+
+ }
+
+ return ret;
+}
+
+bool Area2D::overlaps_area(Node* p_area) const {
+
+ ERR_FAIL_NULL_V(p_area,false);
+ const Map<ObjectID,AreaState>::Element *E=area_map.find(p_area->get_instance_ID());
+ if (!E)
+ return false;
+ return E->get().in_tree;
+
+
+
+}
+
+bool Area2D::overlaps_body(Node* p_body) const{
+
+ ERR_FAIL_NULL_V(p_body,false);
+ const Map<ObjectID,BodyState>::Element *E=body_map.find(p_body->get_instance_ID());
+ if (!E)
+ return false;
+ return E->get().in_tree;
+
+}
+
void Area2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_body_enter_tree","id"),&Area2D::_body_enter_tree);
ObjectTypeDB::bind_method(_MD("_body_exit_tree","id"),&Area2D::_body_exit_tree);
+ ObjectTypeDB::bind_method(_MD("_area_enter_tree","id"),&Area2D::_area_enter_tree);
+ ObjectTypeDB::bind_method(_MD("_area_exit_tree","id"),&Area2D::_area_exit_tree);
+
ObjectTypeDB::bind_method(_MD("set_space_override_mode","enable"),&Area2D::set_space_override_mode);
ObjectTypeDB::bind_method(_MD("get_space_override_mode"),&Area2D::get_space_override_mode);
@@ -337,15 +545,29 @@ void Area2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_enable_monitoring","enable"),&Area2D::set_enable_monitoring);
ObjectTypeDB::bind_method(_MD("is_monitoring_enabled"),&Area2D::is_monitoring_enabled);
+ ObjectTypeDB::bind_method(_MD("set_monitorable","enable"),&Area2D::set_monitorable);
+ ObjectTypeDB::bind_method(_MD("is_monitorable"),&Area2D::is_monitorable);
+
ObjectTypeDB::bind_method(_MD("get_overlapping_bodies"),&Area2D::get_overlapping_bodies);
+ ObjectTypeDB::bind_method(_MD("get_overlapping_areas"),&Area2D::get_overlapping_areas);
+
+ ObjectTypeDB::bind_method(_MD("overlaps_body:PhysicsBody2D","body"),&Area2D::overlaps_body);
+ ObjectTypeDB::bind_method(_MD("overlaps_area:Area2D","area"),&Area2D::overlaps_area);
ObjectTypeDB::bind_method(_MD("_body_inout"),&Area2D::_body_inout);
+ ObjectTypeDB::bind_method(_MD("_area_inout"),&Area2D::_area_inout);
+
+
+ ADD_SIGNAL( MethodInfo("body_enter_shape",PropertyInfo(Variant::INT,"body_id"),PropertyInfo(Variant::OBJECT,"body",PROPERTY_HINT_RESOURCE_TYPE,"PhysicsBody2D"),PropertyInfo(Variant::INT,"body_shape"),PropertyInfo(Variant::INT,"area_shape")));
+ ADD_SIGNAL( MethodInfo("body_exit_shape",PropertyInfo(Variant::INT,"body_id"),PropertyInfo(Variant::OBJECT,"body",PROPERTY_HINT_RESOURCE_TYPE,"PhysicsBody2D"),PropertyInfo(Variant::INT,"body_shape"),PropertyInfo(Variant::INT,"area_shape")));
+ ADD_SIGNAL( MethodInfo("body_enter",PropertyInfo(Variant::OBJECT,"body",PROPERTY_HINT_RESOURCE_TYPE,"PhysicsBody2D")));
+ ADD_SIGNAL( MethodInfo("body_exit",PropertyInfo(Variant::OBJECT,"body",PROPERTY_HINT_RESOURCE_TYPE,"PhysicsBody2D")));
+ ADD_SIGNAL( MethodInfo("area_enter_shape",PropertyInfo(Variant::INT,"area_id"),PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D"),PropertyInfo(Variant::INT,"area_shape"),PropertyInfo(Variant::INT,"area_shape")));
+ ADD_SIGNAL( MethodInfo("area_exit_shape",PropertyInfo(Variant::INT,"area_id"),PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D"),PropertyInfo(Variant::INT,"area_shape"),PropertyInfo(Variant::INT,"area_shape")));
+ ADD_SIGNAL( MethodInfo("area_enter",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D")));
+ ADD_SIGNAL( MethodInfo("area_exit",PropertyInfo(Variant::OBJECT,"area",PROPERTY_HINT_RESOURCE_TYPE,"Area2D")));
- ADD_SIGNAL( MethodInfo("body_enter_shape",PropertyInfo(Variant::INT,"body_id"),PropertyInfo(Variant::OBJECT,"body"),PropertyInfo(Variant::INT,"body_shape"),PropertyInfo(Variant::INT,"area_shape")));
- ADD_SIGNAL( MethodInfo("body_exit_shape",PropertyInfo(Variant::INT,"body_id"),PropertyInfo(Variant::OBJECT,"body"),PropertyInfo(Variant::INT,"body_shape"),PropertyInfo(Variant::INT,"area_shape")));
- ADD_SIGNAL( MethodInfo("body_enter",PropertyInfo(Variant::OBJECT,"body")));
- ADD_SIGNAL( MethodInfo("body_exit",PropertyInfo(Variant::OBJECT,"body")));
ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Replace"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"gravity_point"),_SCS("set_gravity_is_point"),_SCS("is_gravity_a_point"));
@@ -355,6 +577,7 @@ void Area2D::_bind_methods() {
ADD_PROPERTY( PropertyInfo(Variant::REAL,"angular_damp",PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_angular_damp"),_SCS("get_angular_damp"));
ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"priority",PROPERTY_HINT_RANGE,"0,128,1"),_SCS("set_priority"),_SCS("get_priority"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitoring"),_SCS("set_enable_monitoring"),_SCS("is_monitoring_enabled"));
+ ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitorable"),_SCS("set_monitorable"),_SCS("is_monitorable"));
}
@@ -369,7 +592,9 @@ Area2D::Area2D() : CollisionObject2D(Physics2DServer::get_singleton()->area_crea
locked=false;
priority=0;
monitoring=false;
+ monitorable=false;
set_enable_monitoring(true);
+ set_monitorable(true);
}
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h
index f770e88a19..6a6c757e0c 100644
--- a/scene/2d/area_2d.h
+++ b/scene/2d/area_2d.h
@@ -53,6 +53,7 @@ private:
real_t angular_damp;
int priority;
bool monitoring;
+ bool monitorable;
bool locked;
void _body_inout(int p_status,const RID& p_body, int p_instance, int p_body_shape,int p_area_shape);
@@ -84,6 +85,36 @@ private:
Map<ObjectID,BodyState> body_map;
+
+
+ void _area_inout(int p_status,const RID& p_area, int p_instance, int p_area_shape,int p_self_shape);
+
+ void _area_enter_tree(ObjectID p_id);
+ void _area_exit_tree(ObjectID p_id);
+
+ struct AreaShapePair {
+
+ int area_shape;
+ int self_shape;
+ bool operator<(const AreaShapePair& p_sp) const {
+ if (area_shape==p_sp.area_shape)
+ return self_shape < p_sp.self_shape;
+ else
+ return area_shape < p_sp.area_shape;
+ }
+
+ AreaShapePair() {}
+ AreaShapePair(int p_bs, int p_as) { area_shape=p_bs; self_shape=p_as; }
+ };
+
+ struct AreaState {
+
+ int rc;
+ bool in_tree;
+ VSet<AreaShapePair> shapes;
+ };
+
+ Map<ObjectID,AreaState> area_map;
void _clear_monitoring();
@@ -117,8 +148,14 @@ public:
void set_enable_monitoring(bool p_enable);
bool is_monitoring_enabled() const;
+ void set_monitorable(bool p_enable);
+ bool is_monitorable() const;
+
Array get_overlapping_bodies() const; //function for script
+ Array get_overlapping_areas() const; //function for script
+ bool overlaps_area(Node* p_area) const;
+ bool overlaps_body(Node* p_body) const;
Area2D();
~Area2D();
diff --git a/scene/2d/back_buffer_copy.cpp b/scene/2d/back_buffer_copy.cpp
new file mode 100644
index 0000000000..245b3ba7eb
--- /dev/null
+++ b/scene/2d/back_buffer_copy.cpp
@@ -0,0 +1,75 @@
+#include "back_buffer_copy.h"
+
+void BackBufferCopy::_update_copy_mode() {
+
+ switch(copy_mode) {
+
+ case COPY_MODE_DISALED: {
+
+ VS::get_singleton()->canvas_item_set_copy_to_backbuffer(get_canvas_item(),false,Rect2());
+ } break;
+ case COPY_MODE_RECT: {
+
+ VS::get_singleton()->canvas_item_set_copy_to_backbuffer(get_canvas_item(),true,rect);
+ } break;
+ case COPY_MODE_VIEWPORT: {
+
+ VS::get_singleton()->canvas_item_set_copy_to_backbuffer(get_canvas_item(),true,Rect2());
+
+ } break;
+
+ }
+}
+
+Rect2 BackBufferCopy::get_item_rect() const {
+
+ return rect;
+}
+
+void BackBufferCopy::set_rect(const Rect2& p_rect) {
+
+ rect=p_rect;
+ _update_copy_mode();
+}
+
+Rect2 BackBufferCopy::get_rect() const{
+ return rect;
+}
+
+void BackBufferCopy::set_copy_mode(CopyMode p_mode){
+
+ copy_mode=p_mode;
+ _update_copy_mode();
+}
+BackBufferCopy::CopyMode BackBufferCopy::get_copy_mode() const{
+
+ return copy_mode;
+}
+
+
+void BackBufferCopy::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("set_rect","rect"),&BackBufferCopy::set_rect);
+ ObjectTypeDB::bind_method(_MD("get_rect"),&BackBufferCopy::get_rect);
+
+ ObjectTypeDB::bind_method(_MD("set_copy_mode","copy_mode"),&BackBufferCopy::set_copy_mode);
+ ObjectTypeDB::bind_method(_MD("get_copy_mode"),&BackBufferCopy::get_copy_mode);
+
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"copy_mode",PROPERTY_HINT_ENUM,"Disabled,Rect,Viewport"),_SCS("set_copy_mode"),_SCS("get_copy_mode"));
+ ADD_PROPERTY( PropertyInfo(Variant::RECT2,"rect"),_SCS("set_rect"),_SCS("get_rect"));
+
+ BIND_CONSTANT( COPY_MODE_DISALED );
+ BIND_CONSTANT( COPY_MODE_RECT );
+ BIND_CONSTANT( COPY_MODE_VIEWPORT );
+
+}
+
+BackBufferCopy::BackBufferCopy(){
+
+ rect=Rect2(-100,-100,200,200);
+ copy_mode=COPY_MODE_RECT;
+ _update_copy_mode();
+}
+BackBufferCopy::~BackBufferCopy(){
+
+}
diff --git a/scene/2d/back_buffer_copy.h b/scene/2d/back_buffer_copy.h
new file mode 100644
index 0000000000..3a86ffa309
--- /dev/null
+++ b/scene/2d/back_buffer_copy.h
@@ -0,0 +1,41 @@
+#ifndef BACKBUFFERCOPY_H
+#define BACKBUFFERCOPY_H
+
+#include "scene/2d/node_2d.h"
+
+class BackBufferCopy : public Node2D {
+ OBJ_TYPE( BackBufferCopy,Node2D);
+public:
+ enum CopyMode {
+ COPY_MODE_DISALED,
+ COPY_MODE_RECT,
+ COPY_MODE_VIEWPORT
+ };
+private:
+
+ Rect2 rect;
+ CopyMode copy_mode;
+
+ void _update_copy_mode();
+
+protected:
+
+ static void _bind_methods();
+
+public:
+
+ void set_rect(const Rect2& p_rect);
+ Rect2 get_rect() const;
+
+ void set_copy_mode(CopyMode p_mode);
+ CopyMode get_copy_mode() const;
+
+ Rect2 get_item_rect() const;
+
+ BackBufferCopy();
+ ~BackBufferCopy();
+};
+
+VARIANT_ENUM_CAST(BackBufferCopy::CopyMode);
+
+#endif // BACKBUFFERCOPY_H
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 4a1842100a..c3ff03d8f4 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -44,7 +44,6 @@ bool CanvasItemMaterial::_set(const StringName& p_name, const Variant& p_value)
return true;
} else if (p_name==SceneStringNames::get_singleton()->shader_unshaded) {
set_unshaded(p_value);
- print_line("set unshaded");
return true;
} else {
@@ -944,7 +943,67 @@ Ref<CanvasItemMaterial> CanvasItem::get_material() const{
}
+InputEvent CanvasItem::make_input_local(const InputEvent& p_event) const {
+ ERR_FAIL_COND_V(!is_inside_tree(),p_event);
+
+ InputEvent ev = p_event;
+
+ Matrix32 local_matrix = (get_canvas_transform() * get_global_transform()).affine_inverse();
+
+ switch(ev.type) {
+
+ case InputEvent::MOUSE_BUTTON: {
+
+ Vector2 g = local_matrix.xform(Vector2(ev.mouse_button.global_x,ev.mouse_button.global_y));
+ Vector2 l = local_matrix.xform(Vector2(ev.mouse_button.x,ev.mouse_button.y));
+ ev.mouse_button.x=l.x;
+ ev.mouse_button.y=l.y;
+ ev.mouse_button.global_x=g.x;
+ ev.mouse_button.global_y=g.y;
+
+ } break;
+ case InputEvent::MOUSE_MOTION: {
+
+ Vector2 g = local_matrix.xform(Vector2(ev.mouse_motion.global_x,ev.mouse_motion.global_y));
+ Vector2 l = local_matrix.xform(Vector2(ev.mouse_motion.x,ev.mouse_motion.y));
+ Vector2 r = local_matrix.basis_xform(Vector2(ev.mouse_motion.relative_x,ev.mouse_motion.relative_y));
+ Vector2 s = local_matrix.basis_xform(Vector2(ev.mouse_motion.speed_x,ev.mouse_motion.speed_y));
+ ev.mouse_motion.x=l.x;
+ ev.mouse_motion.y=l.y;
+ ev.mouse_motion.global_x=g.x;
+ ev.mouse_motion.global_y=g.y;
+ ev.mouse_motion.relative_x=r.x;
+ ev.mouse_motion.relative_y=r.y;
+ ev.mouse_motion.speed_x=s.x;
+ ev.mouse_motion.speed_y=s.y;
+
+ } break;
+ case InputEvent::SCREEN_TOUCH: {
+
+
+ Vector2 t = local_matrix.xform(Vector2(ev.screen_touch.x,ev.screen_touch.y));
+ ev.screen_touch.x=t.x;
+ ev.screen_touch.y=t.y;
+
+ } break;
+ case InputEvent::SCREEN_DRAG: {
+
+
+ Vector2 t = local_matrix.xform(Vector2(ev.screen_drag.x,ev.screen_drag.y));
+ Vector2 r = local_matrix.basis_xform(Vector2(ev.screen_drag.relative_x,ev.screen_drag.relative_y));
+ Vector2 s = local_matrix.basis_xform(Vector2(ev.screen_drag.speed_x,ev.screen_drag.speed_y));
+ ev.screen_drag.x=t.x;
+ ev.screen_drag.y=t.y;
+ ev.screen_drag.relative_x=r.x;
+ ev.screen_drag.relative_y=r.y;
+ ev.screen_drag.speed_x=s.x;
+ ev.screen_drag.speed_y=s.y;
+ } break;
+ }
+
+ return ev;
+}
void CanvasItem::_bind_methods() {
@@ -1011,6 +1070,7 @@ void CanvasItem::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_global_transform_with_canvas"),&CanvasItem::get_global_transform_with_canvas);
ObjectTypeDB::bind_method(_MD("get_viewport_transform"),&CanvasItem::get_viewport_transform);
ObjectTypeDB::bind_method(_MD("get_viewport_rect"),&CanvasItem::get_viewport_rect);
+ ObjectTypeDB::bind_method(_MD("get_canvas_transform"),&CanvasItem::get_canvas_transform);
ObjectTypeDB::bind_method(_MD("get_canvas"),&CanvasItem::get_canvas);
ObjectTypeDB::bind_method(_MD("get_world_2d"),&CanvasItem::get_world_2d);
//ObjectTypeDB::bind_method(_MD("get_viewport"),&CanvasItem::get_viewport);
@@ -1021,6 +1081,8 @@ void CanvasItem::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_use_parent_material","enable"),&CanvasItem::set_use_parent_material);
ObjectTypeDB::bind_method(_MD("get_use_parent_material"),&CanvasItem::get_use_parent_material);
+ ObjectTypeDB::bind_method(_MD("make_input_local","event"),&CanvasItem::make_input_local);
+
BIND_VMETHOD(MethodInfo("_draw"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"visibility/visible"), _SCS("_set_visible_"),_SCS("_is_visible_") );
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 0c7be261ab..c43642a8ec 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -249,6 +249,7 @@ public:
void set_use_parent_material(bool p_use_parent_material);
bool get_use_parent_material() const;
+ InputEvent make_input_local(const InputEvent& pevent) const;
CanvasItem();
~CanvasItem();
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 3b859d9366..a883fee103 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -28,6 +28,7 @@
/*************************************************************************/
#include "collision_object_2d.h"
#include "servers/physics_2d_server.h"
+#include "scene/scene_string_names.h"
void CollisionObject2D::_update_shapes_from_children() {
@@ -58,9 +59,15 @@ void CollisionObject2D::_notification(int p_what) {
} else
Physics2DServer::get_singleton()->body_set_space(rid,space);
+ _update_pickable();
+
//get space
}
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+
+ _update_pickable();
+ } break;
case NOTIFICATION_TRANSFORM_CHANGED: {
if (area)
@@ -166,6 +173,57 @@ void CollisionObject2D::_get_property_list( List<PropertyInfo> *p_list) const {
}
}
+
+void CollisionObject2D::set_pickable(bool p_enabled) {
+
+ if (pickable==p_enabled)
+ return;
+
+ pickable=p_enabled;
+ _update_pickable();
+}
+
+bool CollisionObject2D::is_pickable() const {
+
+ return pickable;
+}
+
+void CollisionObject2D::_input_event(Node *p_viewport, const InputEvent& p_input_event, int p_shape) {
+
+ if (get_script_instance()) {
+ get_script_instance()->call(SceneStringNames::get_singleton()->_input_event,p_viewport,p_input_event,p_shape);
+ }
+ emit_signal(SceneStringNames::get_singleton()->input_event,p_viewport,p_input_event,p_shape);
+}
+
+void CollisionObject2D::_mouse_enter() {
+
+ if (get_script_instance()) {
+ get_script_instance()->call(SceneStringNames::get_singleton()->_mouse_enter);
+ }
+ emit_signal(SceneStringNames::get_singleton()->mouse_enter);
+}
+
+
+void CollisionObject2D::_mouse_exit() {
+
+ if (get_script_instance()) {
+ get_script_instance()->call(SceneStringNames::get_singleton()->_mouse_exit);
+ }
+ emit_signal(SceneStringNames::get_singleton()->mouse_exit);
+
+}
+
+void CollisionObject2D::_update_pickable() {
+ if (!is_inside_tree())
+ return;
+ bool pickable = this->pickable && is_inside_tree() && is_visible();
+ if (area)
+ Physics2DServer::get_singleton()->area_set_pickable(rid,pickable);
+ else
+ Physics2DServer::get_singleton()->body_set_pickable(rid,pickable);
+}
+
void CollisionObject2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("add_shape","shape:Shape2D","transform"),&CollisionObject2D::add_shape,DEFVAL(Matrix32()));
@@ -180,6 +238,17 @@ void CollisionObject2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("clear_shapes"),&CollisionObject2D::clear_shapes);
ObjectTypeDB::bind_method(_MD("get_rid"),&CollisionObject2D::get_rid);
+ ObjectTypeDB::bind_method(_MD("set_pickable","enabled"),&CollisionObject2D::set_pickable);
+ ObjectTypeDB::bind_method(_MD("is_pickable"),&CollisionObject2D::is_pickable);
+
+ BIND_VMETHOD( MethodInfo("_input_event",PropertyInfo(Variant::OBJECT,"viewport"),PropertyInfo(Variant::INPUT_EVENT,"event"),PropertyInfo(Variant::INT,"shape_idx")));
+
+ ADD_SIGNAL( MethodInfo("input_event",PropertyInfo(Variant::OBJECT,"viewport"),PropertyInfo(Variant::INPUT_EVENT,"event"),PropertyInfo(Variant::INT,"shape_idx")));
+ ADD_SIGNAL( MethodInfo("mouse_enter"));
+ ADD_SIGNAL( MethodInfo("mouse_exit"));
+
+ ADD_PROPERTY( PropertyInfo(Variant::BOOL,"input/pickable"),_SCS("set_pickable"),_SCS("is_pickable"));
+
}
@@ -262,7 +331,9 @@ CollisionObject2D::CollisionObject2D(RID p_rid, bool p_area) {
rid=p_rid;
area=p_area;
+ pickable=true;
if (p_area) {
+
Physics2DServer::get_singleton()->area_attach_object_instance_ID(rid,get_instance_ID());
} else {
Physics2DServer::get_singleton()->body_attach_object_instance_ID(rid,get_instance_ID());
diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h
index 4a529ce062..393973ce90 100644
--- a/scene/2d/collision_object_2d.h
+++ b/scene/2d/collision_object_2d.h
@@ -38,6 +38,7 @@ class CollisionObject2D : public Node2D {
bool area;
RID rid;
+ bool pickable;
struct ShapeData {
Matrix32 xform;
@@ -66,9 +67,17 @@ protected:
bool _get(const StringName& p_name,Variant &r_ret) const;
void _get_property_list( List<PropertyInfo> *p_list) const;
static void _bind_methods();
+
+ void _update_pickable();
+friend class Viewport;
+ void _input_event(Node *p_viewport, const InputEvent& p_input_event, int p_shape);
+ void _mouse_enter();
+ void _mouse_exit();
+
public:
+
void add_shape(const Ref<Shape2D>& p_shape, const Matrix32& p_transform=Matrix32());
int get_shape_count() const;
void set_shape(int p_shape_idx, const Ref<Shape2D>& p_shape);
@@ -80,6 +89,9 @@ public:
void remove_shape(int p_shape_idx);
void clear_shapes();
+ void set_pickable(bool p_enabled);
+ bool is_pickable() const;
+
_FORCE_INLINE_ RID get_rid() const { return rid; }
CollisionObject2D();
diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp
index 93be0c397f..4abb7e5436 100644
--- a/scene/2d/light_2d.cpp
+++ b/scene/2d/light_2d.cpp
@@ -23,7 +23,7 @@ Rect2 Light2D::get_item_rect() const {
Size2i s;
- s = texture->get_size();
+ s = texture->get_size()*_scale;
Point2i ofs=texture_offset;
ofs-=s/2;
@@ -63,6 +63,8 @@ void Light2D::set_texture_offset( const Vector2& p_offset) {
texture_offset=p_offset;
VS::get_singleton()->canvas_light_set_texture_offset(canvas_light,texture_offset);
+ item_rect_changed();
+
}
Vector2 Light2D::get_texture_offset() const {
@@ -87,11 +89,27 @@ void Light2D::set_height( float p_height) {
VS::get_singleton()->canvas_light_set_height(canvas_light,height);
}
+
+
float Light2D::get_height() const {
return height;
}
+void Light2D::set_texture_scale( float p_scale) {
+
+ _scale=p_scale;
+ VS::get_singleton()->canvas_light_set_scale(canvas_light,_scale);
+ item_rect_changed();
+
+}
+
+
+float Light2D::get_texture_scale() const {
+
+ return _scale;
+}
+
void Light2D::set_z_range_min( int p_min_z) {
z_min=p_min_z;
@@ -148,6 +166,18 @@ int Light2D::get_item_mask() const {
return item_mask;
}
+void Light2D::set_item_shadow_mask( int p_mask) {
+
+ item_shadow_mask=p_mask;
+ VS::get_singleton()->canvas_light_set_item_shadow_mask(canvas_light,item_shadow_mask);
+
+}
+
+int Light2D::get_item_shadow_mask() const {
+
+ return item_shadow_mask;
+}
+
void Light2D::set_subtract_mode( bool p_enable ) {
subtract_mode=p_enable;
@@ -230,6 +260,10 @@ void Light2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_height","height"),&Light2D::set_height);
ObjectTypeDB::bind_method(_MD("get_height"),&Light2D::get_height);
+ ObjectTypeDB::bind_method(_MD("set_texture_scale","texture_scale"),&Light2D::set_texture_scale);
+ ObjectTypeDB::bind_method(_MD("get_texture_scale"),&Light2D::get_texture_scale);
+
+
ObjectTypeDB::bind_method(_MD("set_z_range_min","z"),&Light2D::set_z_range_min);
ObjectTypeDB::bind_method(_MD("get_z_range_min"),&Light2D::get_z_range_min);
@@ -246,6 +280,9 @@ void Light2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_item_mask","item_mask"),&Light2D::set_item_mask);
ObjectTypeDB::bind_method(_MD("get_item_mask"),&Light2D::get_item_mask);
+ ObjectTypeDB::bind_method(_MD("set_item_shadow_mask","item_shadow_mask"),&Light2D::set_item_shadow_mask);
+ ObjectTypeDB::bind_method(_MD("get_item_shadow_mask"),&Light2D::get_item_shadow_mask);
+
ObjectTypeDB::bind_method(_MD("set_subtract_mode","enable"),&Light2D::set_subtract_mode);
ObjectTypeDB::bind_method(_MD("get_subtract_mode"),&Light2D::get_subtract_mode);
@@ -261,6 +298,7 @@ void Light2D::_bind_methods() {
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"enabled"),_SCS("set_enabled"),_SCS("is_enabled"));
ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture"));
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"offset"),_SCS("set_texture_offset"),_SCS("get_texture_offset"));
+ ADD_PROPERTY( PropertyInfo(Variant::REAL,"scale",PROPERTY_HINT_RANGE,"0.01,4096,0.01"),_SCS("set_texture_scale"),_SCS("get_texture_scale"));
ADD_PROPERTY( PropertyInfo(Variant::COLOR,"color"),_SCS("set_color"),_SCS("get_color"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"subtract"),_SCS("set_subtract_mode"),_SCS("get_subtract_mode"));
ADD_PROPERTY( PropertyInfo(Variant::REAL,"range/height"),_SCS("set_height"),_SCS("get_height"));
@@ -272,6 +310,7 @@ void Light2D::_bind_methods() {
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"shadow/enabled"),_SCS("set_shadow_enabled"),_SCS("is_shadow_enabled"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/buffer_size",PROPERTY_HINT_RANGE,"32,16384,1"),_SCS("set_shadow_buffer_size"),_SCS("get_shadow_buffer_size"));
ADD_PROPERTY( PropertyInfo(Variant::REAL,"shadow/esm_multiplier",PROPERTY_HINT_RANGE,"1,4096,0.1"),_SCS("set_shadow_esm_multiplier"),_SCS("get_shadow_esm_multiplier"));
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"shadow/item_mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_item_shadow_mask"),_SCS("get_item_shadow_mask"));
}
@@ -283,11 +322,13 @@ Light2D::Light2D() {
shadow=false;
color=Color(1,1,1);
height=0;
+ _scale=1.0;
z_min=-1024;
z_max=1024;
layer_min=0;
layer_max=0;
item_mask=1;
+ item_shadow_mask=1;
subtract_mode=false;
shadow_buffer_size=2048;
shadow_esm_multiplier=80;
diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h
index 89f351c3cd..6cfb055fa9 100644
--- a/scene/2d/light_2d.h
+++ b/scene/2d/light_2d.h
@@ -12,11 +12,13 @@ private:
bool shadow;
Color color;
float height;
+ float _scale;
int z_min;
int z_max;
int layer_min;
int layer_max;
int item_mask;
+ int item_shadow_mask;
int shadow_buffer_size;
float shadow_esm_multiplier;
bool subtract_mode;
@@ -49,6 +51,9 @@ public:
void set_height( float p_height);
float get_height() const;
+ void set_texture_scale( float p_scale);
+ float get_texture_scale() const;
+
void set_z_range_min( int p_min_z);
int get_z_range_min() const;
@@ -64,6 +69,9 @@ public:
void set_item_mask( int p_mask);
int get_item_mask() const;
+ void set_item_shadow_mask( int p_mask);
+ int get_item_shadow_mask() const;
+
void set_subtract_mode( bool p_enable );
bool get_subtract_mode() const;
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index 186ea2e248..6ebd499f71 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -18,7 +18,8 @@ void OccluderPolygon2D::set_closed(bool p_closed) {
if (closed==p_closed)
return;
closed=p_closed;
- VS::get_singleton()->canvas_occluder_polygon_set_shape(occ_polygon,polygon,closed);
+ if (polygon.size())
+ VS::get_singleton()->canvas_occluder_polygon_set_shape(occ_polygon,polygon,closed);
emit_changed();
}
@@ -56,9 +57,9 @@ void OccluderPolygon2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_polygon","polygon"),&OccluderPolygon2D::set_polygon);
ObjectTypeDB::bind_method(_MD("get_polygon"),&OccluderPolygon2D::get_polygon);
- ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"closed"),_SCS("set_closed"),_SCS("is_closed"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"cull_mode",PROPERTY_HINT_ENUM,"Disabled,ClockWise,CounterClockWise"),_SCS("set_cull_mode"),_SCS("get_cull_mode"));
+ ADD_PROPERTY( PropertyInfo(Variant::VECTOR2_ARRAY,"polygon"),_SCS("set_polygon"),_SCS("get_polygon"));
BIND_CONSTANT(CULL_DISABLED);
BIND_CONSTANT(CULL_CLOCKWISE);
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 36b6b220b3..0b098f0cad 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -65,7 +65,7 @@ void Node2D::edit_set_state(const Variant& p_state) {
pos = state[0];
angle = state[1];
- scale = state[2];
+ _scale = state[2];
_update_transform();
_change_notify("transform/rot");
_change_notify("transform/scale");
@@ -93,11 +93,11 @@ void Node2D::edit_set_rect(const Rect2& p_edit_rect) {
Point2 new_pos = p_edit_rect.pos + p_edit_rect.size*zero_offset;//p_edit_rect.pos - r.pos;
Matrix32 postxf;
- postxf.set_rotation_and_scale(angle,scale);
+ postxf.set_rotation_and_scale(angle,_scale);
new_pos = postxf.xform(new_pos);
pos+=new_pos;
- scale*=new_scale;
+ _scale*=new_scale;
_update_transform();
_change_notify("transform/scale");
@@ -118,14 +118,14 @@ void Node2D::_update_xform_values() {
pos=_mat.elements[2];
angle=_mat.get_rotation();
- scale=_mat.get_scale();
+ _scale=_mat.get_scale();
_xform_dirty=false;
}
void Node2D::_update_transform() {
Matrix32 mat(angle,pos);
- _mat.set_rotation_and_scale(angle,scale);
+ _mat.set_rotation_and_scale(angle,_scale);
_mat.elements[2]=pos;
VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(),_mat);
@@ -161,11 +161,11 @@ void Node2D::set_scale(const Size2& p_scale) {
if (_xform_dirty)
((Node2D*)this)->_update_xform_values();
- scale=p_scale;
- if (scale.x==0)
- scale.x=CMP_EPSILON;
- if (scale.y==0)
- scale.y=CMP_EPSILON;
+ _scale=p_scale;
+ if (_scale.x==0)
+ _scale.x=CMP_EPSILON;
+ if (_scale.y==0)
+ _scale.y=CMP_EPSILON;
_update_transform();
_change_notify("transform/scale");
@@ -187,7 +187,7 @@ Size2 Node2D::get_scale() const {
if (_xform_dirty)
((Node2D*)this)->_update_xform_values();
- return scale;
+ return _scale;
}
void Node2D::_set_rotd(float p_angle) {
@@ -224,11 +224,27 @@ Rect2 Node2D::get_item_rect() const {
return Rect2(Point2(-32,-32),Size2(64,64));
}
-void Node2D::rotate(float p_degrees) {
+void Node2D::rotate(float p_radians) {
- set_rot( get_rot() + p_degrees);
+ set_rot( get_rot() + p_radians);
}
+void Node2D::translate(const Vector2& p_amount) {
+
+ set_pos( get_pos() + p_amount );
+}
+
+void Node2D::global_translate(const Vector2& p_amount) {
+
+ set_global_pos( get_global_pos() + p_amount );
+}
+
+void Node2D::scale(const Vector2& p_amount) {
+
+ set_scale( get_scale() * p_amount );
+}
+
+
void Node2D::move_x(float p_delta,bool p_scaled){
Matrix32 t = get_transform();
@@ -345,9 +361,12 @@ void Node2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_rot"),&Node2D::get_rot);
ObjectTypeDB::bind_method(_MD("get_scale"),&Node2D::get_scale);
- ObjectTypeDB::bind_method(_MD("rotate","degrees"),&Node2D::rotate);
+ ObjectTypeDB::bind_method(_MD("rotate","radians"),&Node2D::rotate);
ObjectTypeDB::bind_method(_MD("move_local_x","delta","scaled"),&Node2D::move_x,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("move_local_y","delta","scaled"),&Node2D::move_y,DEFVAL(false));
+ ObjectTypeDB::bind_method(_MD("translate","offset"),&Node2D::translate);
+ ObjectTypeDB::bind_method(_MD("global_translate","offset"),&Node2D::global_translate);
+ ObjectTypeDB::bind_method(_MD("scale","ratio"),&Node2D::scale);
ObjectTypeDB::bind_method(_MD("set_global_pos","pos"),&Node2D::set_global_pos);
ObjectTypeDB::bind_method(_MD("get_global_pos"),&Node2D::get_global_pos);
@@ -379,7 +398,7 @@ Node2D::Node2D() {
angle=0;
- scale=Vector2(1,1);
+ _scale=Vector2(1,1);
_xform_dirty=false;
z=0;
z_relative=true;
diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h
index 7b059008c2..39a1061195 100644
--- a/scene/2d/node_2d.h
+++ b/scene/2d/node_2d.h
@@ -37,7 +37,7 @@ class Node2D : public CanvasItem {
Point2 pos;
float angle;
- Size2 scale;
+ Size2 _scale;
int z;
bool z_relative;
@@ -72,9 +72,12 @@ public:
void set_rot(float p_angle);
void set_scale(const Size2& p_scale);
- void rotate(float p_degrees);
+ void rotate(float p_radians);
void move_x(float p_delta,bool p_scaled=false);
void move_y(float p_delta,bool p_scaled=false);
+ void translate(const Vector2& p_amount);
+ void global_translate(const Vector2& p_amount);
+ void scale(const Vector2& p_amount);
Point2 get_pos() const;
float get_rot() const;
@@ -96,6 +99,7 @@ public:
Matrix32 get_relative_transform(const Node *p_parent) const;
+
Matrix32 get_transform() const;
Node2D();
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 6e2cf5954b..c9dd92ff3d 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -1077,13 +1077,18 @@ void Particles2D::_bind_methods() {
BIND_CONSTANT( PARAM_SPREAD );
BIND_CONSTANT( PARAM_LINEAR_VELOCITY );
BIND_CONSTANT( PARAM_SPIN_VELOCITY );
+ BIND_CONSTANT( PARAM_ORBIT_VELOCITY );
BIND_CONSTANT( PARAM_GRAVITY_DIRECTION );
BIND_CONSTANT( PARAM_GRAVITY_STRENGTH );
BIND_CONSTANT( PARAM_RADIAL_ACCEL );
BIND_CONSTANT( PARAM_TANGENTIAL_ACCEL );
+ BIND_CONSTANT( PARAM_DAMPING );
+ BIND_CONSTANT( PARAM_INITIAL_ANGLE );
BIND_CONSTANT( PARAM_INITIAL_SIZE );
BIND_CONSTANT( PARAM_FINAL_SIZE );
BIND_CONSTANT( PARAM_HUE_VARIATION );
+ BIND_CONSTANT( PARAM_ANIM_SPEED_SCALE );
+ BIND_CONSTANT( PARAM_ANIM_INITIAL_POS );
BIND_CONSTANT( PARAM_MAX );
BIND_CONSTANT( MAX_COLOR_PHASES );
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 6f18325212..22dd0f01d0 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -98,6 +98,7 @@ PhysicsBody2D::PhysicsBody2D(Physics2DServer::BodyMode p_mode) : CollisionObject
mask=1;
set_one_way_collision_max_depth(0);
+ set_pickable(false);
}
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 75e7957cb8..2b88ee5dba 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -30,12 +30,32 @@
#include "io/marshalls.h"
#include "servers/physics_2d_server.h"
#include "method_bind_ext.inc"
+
+int TileMap::_get_quadrant_size() const {
+
+ if (y_sort_mode)
+ return 1;
+ else
+ return quadrant_size;
+}
+
void TileMap::_notification(int p_what) {
switch(p_what) {
case NOTIFICATION_ENTER_TREE: {
+ Node2D *c=this;
+ while(c) {
+
+ navigation=c->cast_to<Navigation2D>();
+ if (navigation) {
+ break;
+ }
+
+ c=c->get_parent()->cast_to<Node2D>();
+ }
+
pending_update=true;
_update_dirty_quadrants();
RID space = get_world_2d()->get_space();
@@ -47,6 +67,25 @@ void TileMap::_notification(int p_what) {
case NOTIFICATION_EXIT_TREE: {
_update_quadrant_space(RID());
+ for (Map<PosKey,Quadrant>::Element *E=quadrant_map.front();E;E=E->next()) {
+
+ Quadrant &q=E->get();
+ if (navigation) {
+ for(Map<PosKey,Quadrant::NavPoly>::Element *E=q.navpoly_ids.front();E;E=E->next()) {
+
+ navigation->navpoly_remove(E->get().id);
+ }
+ q.navpoly_ids.clear();
+ }
+
+ for(Map<PosKey,Quadrant::Occluder>::Element *E=q.occluder_instances.front();E;E=E->next()) {
+ VS::get_singleton()->free(E->get().id);
+ }
+ q.occluder_instances.clear();
+ }
+
+ navigation=NULL;
+
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
@@ -74,6 +113,10 @@ void TileMap::_update_quadrant_transform() {
Matrix32 global_transform = get_global_transform();
+ Matrix32 nav_rel;
+ if (navigation)
+ nav_rel = get_relative_transform(navigation);
+
for (Map<PosKey,Quadrant>::Element *E=quadrant_map.front();E;E=E->next()) {
Quadrant &q=E->get();
@@ -81,6 +124,17 @@ void TileMap::_update_quadrant_transform() {
xform.set_origin( q.pos );
xform = global_transform * xform;
Physics2DServer::get_singleton()->body_set_state(q.body,Physics2DServer::BODY_STATE_TRANSFORM,xform);
+
+ if (navigation) {
+ for(Map<PosKey,Quadrant::NavPoly>::Element *E=q.navpoly_ids.front();E;E=E->next()) {
+
+ navigation->navpoly_set_transform(E->get().id,nav_rel * E->get().xform);
+ }
+ }
+
+ for(Map<PosKey,Quadrant::Occluder>::Element *E=q.occluder_instances.front();E;E=E->next()) {
+ VS::get_singleton()->canvas_light_occluder_set_transform(E->get().id,global_transform * E->get().xform);
+ }
}
}
@@ -161,6 +215,34 @@ bool TileMap::get_center_y() const {
return center_y;
}
+void TileMap::_fix_cell_transform(Matrix32& xform,const Cell& p_cell, const Vector2& p_offset, const Size2 &p_sc) {
+
+ Size2 s=p_sc;
+ Vector2 offset = p_offset;
+
+ if (p_cell.transpose) {
+ SWAP(xform.elements[0].x, xform.elements[0].y);
+ SWAP(xform.elements[1].x, xform.elements[1].y);
+ SWAP(offset.x, offset.y);
+ SWAP(s.x, s.y);
+ }
+ if (p_cell.flip_h) {
+ xform.elements[0].x=-xform.elements[0].x;
+ xform.elements[1].x=-xform.elements[1].x;
+ if (tile_origin==TILE_ORIGIN_TOP_LEFT)
+ offset.x=s.x-offset.x;
+ }
+ if (p_cell.flip_v) {
+ xform.elements[0].y=-xform.elements[0].y;
+ xform.elements[1].y=-xform.elements[1].y;
+ if (tile_origin==TILE_ORIGIN_TOP_LEFT)
+ offset.y=s.y-offset.y;
+ }
+ xform.elements[2].x+=offset.x;
+ xform.elements[2].y+=offset.y;
+
+}
+
void TileMap::_update_dirty_quadrants() {
if (!pending_update)
@@ -173,15 +255,42 @@ void TileMap::_update_dirty_quadrants() {
VisualServer *vs = VisualServer::get_singleton();
Physics2DServer *ps = Physics2DServer::get_singleton();
Vector2 tofs = get_cell_draw_offset();
+ Vector2 tcenter = cell_size/2;
+ Matrix32 nav_rel;
+ if (navigation)
+ nav_rel = get_relative_transform(navigation);
+
+ Vector2 qofs;
while (dirty_quadrant_list.first()) {
Quadrant &q = *dirty_quadrant_list.first()->self();
- vs->canvas_item_clear(q.canvas_item);
+ for (List<RID>::Element *E=q.canvas_items.front();E;E=E->next()) {
+
+ vs->free(E->get());
+ }
+
+ q.canvas_items.clear();
+
ps->body_clear_shapes(q.body);
int shape_idx=0;
+ if (navigation) {
+ for(Map<PosKey,Quadrant::NavPoly>::Element *E=q.navpoly_ids.front();E;E=E->next()) {
+
+ navigation->navpoly_remove(E->get().id);
+ }
+ q.navpoly_ids.clear();
+ }
+
+ for(Map<PosKey,Quadrant::Occluder>::Element *E=q.occluder_instances.front();E;E=E->next()) {
+ VS::get_singleton()->free(E->get().id);
+ }
+ q.occluder_instances.clear();
+ Ref<CanvasItemMaterial> prev_material;
+ RID prev_canvas_item;
+
for(int i=0;i<q.cells.size();i++) {
Map<PosKey,Cell>::Element *E=tile_map.find( q.cells[i] );
@@ -192,11 +301,35 @@ void TileMap::_update_dirty_quadrants() {
Ref<Texture> tex = tile_set->tile_get_texture(c.id);
Vector2 tile_ofs = tile_set->tile_get_texture_offset(c.id);
- Vector2 offset = _map_to_world(E->key().x, E->key().y) - q.pos + tofs;
+ Vector2 wofs = _map_to_world(E->key().x, E->key().y);
+ Vector2 offset = wofs - q.pos + tofs;
if (!tex.is_valid())
continue;
+ Ref<CanvasItemMaterial> mat = tile_set->tile_get_material(c.id);
+
+ RID canvas_item;
+
+ if (prev_canvas_item==RID() || prev_material!=mat) {
+
+ canvas_item=vs->canvas_item_create();
+ if (mat.is_valid())
+ vs->canvas_item_set_material(canvas_item,mat->get_rid());
+ vs->canvas_item_set_parent( canvas_item, get_canvas_item() );
+ Matrix32 xform;
+ xform.set_origin( q.pos );
+ vs->canvas_item_set_transform( canvas_item, xform );
+ q.canvas_items.push_back(canvas_item);
+
+ prev_canvas_item=canvas_item;
+ prev_material=mat;
+
+ } else {
+ canvas_item=prev_canvas_item;
+ }
+
+
Rect2 r = tile_set->tile_get_region(c.id);
Size2 s = tex->get_size();
@@ -223,12 +356,32 @@ void TileMap::_update_dirty_quadrants() {
if (c.flip_v)
rect.size.y=-rect.size.y;
+ Vector2 center_ofs;
+
+ if (tile_origin==TILE_ORIGIN_TOP_LEFT) {
+ rect.pos+=tile_ofs;
+ } else if (tile_origin==TILE_ORIGIN_CENTER) {
+ rect.pos+=tcenter;
+
+ Vector2 center = (s/2) - tile_ofs;
+ center_ofs=tcenter-(s/2);
+
+ if (c.flip_h)
+ rect.pos.x-=s.x-center.x;
+ else
+ rect.pos.x-=center.x;
+
+ if (c.flip_v)
+ rect.pos.y-=s.y-center.y;
+ else
+ rect.pos.y-=center.y;
+ }
+
- rect.pos+=tile_ofs;
if (r==Rect2()) {
- tex->draw_rect(q.canvas_item,rect,false,Color(1,1,1),c.transpose);
+ tex->draw_rect(canvas_item,rect,false,Color(1,1,1),c.transpose);
} else {
- tex->draw_rect_region(q.canvas_item,rect,r,Color(1,1,1),c.transpose);
+ tex->draw_rect_region(canvas_item,rect,r,Color(1,1,1),c.transpose);
}
Vector< Ref<Shape2D> > shapes = tile_set->tile_get_shapes(c.id);
@@ -242,32 +395,48 @@ void TileMap::_update_dirty_quadrants() {
Vector2 shape_ofs = tile_set->tile_get_shape_offset(c.id);
Matrix32 xform;
xform.set_origin(offset.floor());
- if (c.transpose) {
- SWAP(xform.elements[0].x, xform.elements[0].y);
- SWAP(xform.elements[1].x, xform.elements[1].y);
- SWAP(shape_ofs.x, shape_ofs.y);
- SWAP(s.x, s.y);
- }
- if (c.flip_h) {
- xform.elements[0].x=-xform.elements[0].x;
- xform.elements[1].x=-xform.elements[1].x;
- shape_ofs.x=s.x-shape_ofs.x;
- }
- if (c.flip_v) {
- xform.elements[0].y=-xform.elements[0].y;
- xform.elements[1].y=-xform.elements[1].y;
- shape_ofs.y=s.y-shape_ofs.y;
- }
- xform.elements[2].x+=shape_ofs.x;
- xform.elements[2].y+=shape_ofs.y;
-
+ _fix_cell_transform(xform,c,shape_ofs+center_ofs,s);
ps->body_add_shape(q.body,shape->get_rid(),xform);
ps->body_set_shape_metadata(q.body,shape_idx++,Vector2(E->key().x,E->key().y));
}
}
+
+ if (navigation) {
+ Ref<NavigationPolygon> navpoly = tile_set->tile_get_navigation_polygon(c.id);
+ Vector2 npoly_ofs = tile_set->tile_get_navigation_polygon_offset(c.id);
+ Matrix32 xform;
+ xform.set_origin(offset.floor()+q.pos);
+ _fix_cell_transform(xform,c,npoly_ofs+center_ofs,s);
+
+ int pid = navigation->navpoly_create(navpoly,nav_rel * xform);
+
+ Quadrant::NavPoly np;
+ np.id=pid;
+ np.xform=xform;
+ q.navpoly_ids[E->key()]=np;
+ }
+
+
+ Ref<OccluderPolygon2D> occluder=tile_set->tile_get_light_occluder(c.id);
+ if (occluder.is_valid()) {
+
+ Vector2 occluder_ofs = tile_set->tile_get_occluder_offset(c.id);
+ Matrix32 xform;
+ xform.set_origin(offset.floor()+q.pos);
+ _fix_cell_transform(xform,c,occluder_ofs+center_ofs,s);
+
+ RID orid = VS::get_singleton()->canvas_light_occluder_create();
+ VS::get_singleton()->canvas_light_occluder_set_transform(orid,get_global_transform() * xform);
+ VS::get_singleton()->canvas_light_occluder_set_polygon(orid,occluder->get_rid());
+ VS::get_singleton()->canvas_light_occluder_attach_to_canvas(orid,get_canvas());
+ Quadrant::Occluder oc;
+ oc.xform=xform;
+ oc.id=orid;
+ q.occluder_instances[E->key()]=oc;
+ }
}
dirty_quadrant_list.remove( dirty_quadrant_list.first() );
@@ -282,10 +451,10 @@ void TileMap::_update_dirty_quadrants() {
for (Map<PosKey,Quadrant>::Element *E=quadrant_map.front();E;E=E->next()) {
Quadrant &q=E->get();
- if (q.canvas_item.is_valid()) {
- VS::get_singleton()->canvas_item_raise(q.canvas_item);
- }
+ for (List<RID>::Element *E=q.canvas_items.front();E;E=E->next()) {
+ VS::get_singleton()->canvas_item_raise(E->get());
+ }
}
quadrant_order_dirty=false;
@@ -308,10 +477,10 @@ void TileMap::_recompute_rect_cache() {
Rect2 r;
- r.pos=_map_to_world(E->key().x*quadrant_size, E->key().y*quadrant_size);
- r.expand_to( _map_to_world(E->key().x*quadrant_size+quadrant_size, E->key().y*quadrant_size) );
- r.expand_to( _map_to_world(E->key().x*quadrant_size+quadrant_size, E->key().y*quadrant_size+quadrant_size) );
- r.expand_to( _map_to_world(E->key().x*quadrant_size, E->key().y*quadrant_size+quadrant_size) );
+ r.pos=_map_to_world(E->key().x*_get_quadrant_size(), E->key().y*_get_quadrant_size());
+ r.expand_to( _map_to_world(E->key().x*_get_quadrant_size()+_get_quadrant_size(), E->key().y*_get_quadrant_size()) );
+ r.expand_to( _map_to_world(E->key().x*_get_quadrant_size()+_get_quadrant_size(), E->key().y*_get_quadrant_size()+_get_quadrant_size()) );
+ r.expand_to( _map_to_world(E->key().x*_get_quadrant_size(), E->key().y*_get_quadrant_size()+_get_quadrant_size()) );
if (E==quadrant_map.front())
r_total=r;
else
@@ -322,7 +491,7 @@ void TileMap::_recompute_rect_cache() {
if (r_total==Rect2()) {
rect_cache=Rect2(-10,-10,20,20);
} else {
- rect_cache=r_total.grow(MAX(cell_size.x,cell_size.y)*quadrant_size);
+ rect_cache=r_total.grow(MAX(cell_size.x,cell_size.y)*_get_quadrant_size());
}
item_rect_changed();
@@ -338,11 +507,13 @@ Map<TileMap::PosKey,TileMap::Quadrant>::Element *TileMap::_create_quadrant(const
Matrix32 xform;
//xform.set_origin(Point2(p_qk.x,p_qk.y)*cell_size*quadrant_size);
Quadrant q;
- q.pos = _map_to_world(p_qk.x*quadrant_size,p_qk.y*quadrant_size);
+ q.pos = _map_to_world(p_qk.x*_get_quadrant_size(),p_qk.y*_get_quadrant_size());
+ q.pos+=get_cell_draw_offset();
+ if (tile_origin==TILE_ORIGIN_CENTER)
+ q.pos+=cell_size/2;
+
xform.set_origin( q.pos );
- q.canvas_item = VisualServer::get_singleton()->canvas_item_create();
- VisualServer::get_singleton()->canvas_item_set_parent( q.canvas_item, get_canvas_item() );
- VisualServer::get_singleton()->canvas_item_set_transform( q.canvas_item, xform );
+// q.canvas_item = VisualServer::get_singleton()->canvas_item_create();
q.body=Physics2DServer::get_singleton()->body_create(use_kinematic?Physics2DServer::BODY_MODE_KINEMATIC:Physics2DServer::BODY_MODE_STATIC);
Physics2DServer::get_singleton()->body_attach_object_instance_ID(q.body,get_instance_ID());
Physics2DServer::get_singleton()->body_set_layer_mask(q.body,collision_layer);
@@ -366,10 +537,27 @@ void TileMap::_erase_quadrant(Map<PosKey,Quadrant>::Element *Q) {
Quadrant &q=Q->get();
Physics2DServer::get_singleton()->free(q.body);
- VisualServer::get_singleton()->free(q.canvas_item);
+ for (List<RID>::Element *E=q.canvas_items.front();E;E=E->next()) {
+
+ VisualServer::get_singleton()->free(E->get());
+ }
+ q.canvas_items.clear();
if (q.dirty_list.in_list())
dirty_quadrant_list.remove(&q.dirty_list);
+ if (navigation) {
+ for(Map<PosKey,Quadrant::NavPoly>::Element *E=q.navpoly_ids.front();E;E=E->next()) {
+
+ navigation->navpoly_remove(E->get().id);
+ }
+ q.navpoly_ids.clear();
+ }
+
+ for(Map<PosKey,Quadrant::Occluder>::Element *E=q.occluder_instances.front();E;E=E->next()) {
+ VS::get_singleton()->free(E->get().id);
+ }
+ q.occluder_instances.clear();
+
quadrant_map.erase(Q);
rect_cache_dirty=true;
}
@@ -397,7 +585,7 @@ void TileMap::set_cell(int p_x,int p_y,int p_tile,bool p_flip_x,bool p_flip_y,bo
if (!E && p_tile==INVALID_CELL)
return; //nothing to do
- PosKey qk(p_x/quadrant_size,p_y/quadrant_size);
+ PosKey qk(p_x/_get_quadrant_size(),p_y/_get_quadrant_size());
if (p_tile==INVALID_CELL) {
//erase existing
tile_map.erase(pk);
@@ -495,7 +683,7 @@ void TileMap::_recreate_quadrants() {
for (Map<PosKey,Cell>::Element *E=tile_map.front();E;E=E->next()) {
- PosKey qk(E->key().x/quadrant_size,E->key().y/quadrant_size);
+ PosKey qk(E->key().x/_get_quadrant_size(),E->key().y/_get_quadrant_size());
Map<PosKey,Quadrant>::Element *Q=quadrant_map.find(qk);
if (!Q) {
@@ -511,6 +699,7 @@ void TileMap::_recreate_quadrants() {
}
+
void TileMap::_clear_quadrants() {
while (quadrant_map.size()) {
@@ -678,6 +867,20 @@ void TileMap::set_half_offset(HalfOffset p_half_offset) {
emit_signal("settings_changed");
}
+void TileMap::set_tile_origin(TileOrigin p_tile_origin) {
+
+ _clear_quadrants();
+ tile_origin=p_tile_origin;
+ _recreate_quadrants();
+ emit_signal("settings_changed");
+}
+
+TileMap::TileOrigin TileMap::get_tile_origin() const{
+
+ return tile_origin;
+}
+
+
Vector2 TileMap::get_cell_draw_offset() const {
switch(mode) {
@@ -804,6 +1007,21 @@ Vector2 TileMap::world_to_map(const Vector2& p_pos) const{
return ret.floor();
}
+void TileMap::set_y_sort_mode(bool p_enable) {
+
+ _clear_quadrants();
+ y_sort_mode=p_enable;
+ VS::get_singleton()->canvas_item_set_sort_children_by_y(get_canvas_item(),y_sort_mode);
+ _recreate_quadrants();
+ emit_signal("settings_changed");
+
+}
+
+bool TileMap::is_y_sort_mode_enabled() const {
+
+ return y_sort_mode;
+}
+
void TileMap::_bind_methods() {
@@ -829,12 +1047,18 @@ void TileMap::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_quadrant_size","size"),&TileMap::set_quadrant_size);
ObjectTypeDB::bind_method(_MD("get_quadrant_size"),&TileMap::get_quadrant_size);
+ ObjectTypeDB::bind_method(_MD("set_tile_origin","origin"),&TileMap::set_tile_origin);
+ ObjectTypeDB::bind_method(_MD("get_tile_origin"),&TileMap::get_tile_origin);
+
ObjectTypeDB::bind_method(_MD("set_center_x","enable"),&TileMap::set_center_x);
ObjectTypeDB::bind_method(_MD("get_center_x"),&TileMap::get_center_x);
ObjectTypeDB::bind_method(_MD("set_center_y","enable"),&TileMap::set_center_y);
ObjectTypeDB::bind_method(_MD("get_center_y"),&TileMap::get_center_y);
+ ObjectTypeDB::bind_method(_MD("set_y_sort_mode","enable"),&TileMap::set_y_sort_mode);
+ ObjectTypeDB::bind_method(_MD("is_y_sort_mode_enabled"),&TileMap::is_y_sort_mode_enabled);
+
ObjectTypeDB::bind_method(_MD("set_collision_use_kinematic","use_kinematic"),&TileMap::set_collision_use_kinematic);
ObjectTypeDB::bind_method(_MD("get_collision_use_kinematic"),&TileMap::get_collision_use_kinematic);
@@ -871,6 +1095,8 @@ void TileMap::_bind_methods() {
ADD_PROPERTY( PropertyInfo(Variant::INT,"cell/quadrant_size",PROPERTY_HINT_RANGE,"1,128,1"),_SCS("set_quadrant_size"),_SCS("get_quadrant_size"));
ADD_PROPERTY( PropertyInfo(Variant::MATRIX32,"cell/custom_transform"),_SCS("set_custom_transform"),_SCS("get_custom_transform"));
ADD_PROPERTY( PropertyInfo(Variant::INT,"cell/half_offset",PROPERTY_HINT_ENUM,"Offset X,Offset Y,Disabled"),_SCS("set_half_offset"),_SCS("get_half_offset"));
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"cell/tile_origin",PROPERTY_HINT_ENUM,"Top Left,Center"),_SCS("set_tile_origin"),_SCS("get_tile_origin"));
+ ADD_PROPERTY( PropertyInfo(Variant::BOOL,"cell/y_sort"),_SCS("set_y_sort_mode"),_SCS("is_y_sort_mode_enabled"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"collision/use_kinematic",PROPERTY_HINT_NONE,""),_SCS("set_collision_use_kinematic"),_SCS("get_collision_use_kinematic"));
ADD_PROPERTY( PropertyInfo(Variant::REAL,"collision/friction",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_collision_friction"),_SCS("get_collision_friction"));
ADD_PROPERTY( PropertyInfo(Variant::REAL,"collision/bounce",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_collision_bounce"),_SCS("get_collision_bounce"));
@@ -886,6 +1112,8 @@ void TileMap::_bind_methods() {
BIND_CONSTANT( HALF_OFFSET_X );
BIND_CONSTANT( HALF_OFFSET_Y );
BIND_CONSTANT( HALF_OFFSET_DISABLED );
+ BIND_CONSTANT( TILE_ORIGIN_TOP_LEFT );
+ BIND_CONSTANT( TILE_ORIGIN_CENTER );
}
@@ -906,9 +1134,12 @@ TileMap::TileMap() {
mode=MODE_SQUARE;
half_offset=HALF_OFFSET_DISABLED;
use_kinematic=false;
+ navigation=NULL;
+ y_sort_mode=false;
fp_adjust=0.01;
fp_adjust=0.01;
+ tile_origin=TILE_ORIGIN_TOP_LEFT;
}
TileMap::~TileMap() {
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index fe1067fc1d..e02c4ee5bb 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -30,6 +30,7 @@
#define TILE_MAP_H
#include "scene/2d/node_2d.h"
+#include "scene/2d/navigation2d.h"
#include "scene/resources/tile_set.h"
#include "self_list.h"
#include "vset.h"
@@ -51,6 +52,12 @@ public:
HALF_OFFSET_DISABLED,
};
+ enum TileOrigin {
+ TILE_ORIGIN_TOP_LEFT,
+ TILE_ORIGIN_CENTER
+ };
+
+
private:
Ref<TileSet> tile_set;
@@ -61,6 +68,7 @@ private:
Matrix32 custom_transform;
HalfOffset half_offset;
bool use_kinematic;
+ Navigation2D *navigation;
union PosKey {
@@ -98,15 +106,29 @@ private:
struct Quadrant {
Vector2 pos;
- RID canvas_item;
+ List<RID> canvas_items;
RID body;
SelfList<Quadrant> dirty_list;
+ struct NavPoly {
+ int id;
+ Matrix32 xform;
+ };
+
+ struct Occluder {
+ RID id;
+ Matrix32 xform;
+ };
+
+
+ Map<PosKey,NavPoly> navpoly_ids;
+ Map<PosKey,Occluder> occluder_instances;
+
VSet<PosKey> cells;
- void operator=(const Quadrant& q) { pos=q.pos; canvas_item=q.canvas_item; body=q.body; cells=q.cells; }
- Quadrant(const Quadrant& q) : dirty_list(this) { pos=q.pos; canvas_item=q.canvas_item; body=q.body; cells=q.cells;}
+ void operator=(const Quadrant& q) { pos=q.pos; canvas_items=q.canvas_items; body=q.body; cells=q.cells; navpoly_ids=q.navpoly_ids; occluder_instances=q.occluder_instances; }
+ Quadrant(const Quadrant& q) : dirty_list(this) { pos=q.pos; canvas_items=q.canvas_items; body=q.body; cells=q.cells; occluder_instances=q.occluder_instances; navpoly_ids=q.navpoly_ids;}
Quadrant() : dirty_list(this) {}
};
@@ -119,11 +141,14 @@ private:
Rect2 rect_cache;
bool rect_cache_dirty;
bool quadrant_order_dirty;
+ bool y_sort_mode;
float fp_adjust;
float friction;
float bounce;
uint32_t collision_layer;
+ TileOrigin tile_origin;
+ void _fix_cell_transform(Matrix32& xform, const Cell& p_cell, const Vector2 &p_offset, const Size2 &p_sc);
Map<PosKey,Quadrant>::Element *_create_quadrant(const PosKey& p_qk);
void _erase_quadrant(Map<PosKey,Quadrant>::Element *Q);
@@ -135,6 +160,9 @@ private:
void _update_quadrant_transform();
void _recompute_rect_cache();
+ _FORCE_INLINE_ int _get_quadrant_size() const;
+
+
void _set_tile_data(const DVector<int>& p_data);
DVector<int> _get_tile_data() const;
@@ -195,6 +223,9 @@ public:
void set_half_offset(HalfOffset p_half_offset);
HalfOffset get_half_offset() const;
+ void set_tile_origin(TileOrigin p_tile_origin);
+ TileOrigin get_tile_origin() const;
+
void set_custom_transform(const Matrix32& p_xform);
Matrix32 get_custom_transform() const;
@@ -204,6 +235,9 @@ public:
Vector2 map_to_world(const Vector2& p_pos, bool p_ignore_ofs=false) const;
Vector2 world_to_map(const Vector2& p_pos) const;
+ void set_y_sort_mode(bool p_enable);
+ bool is_y_sort_mode_enabled() const;
+
void clear();
TileMap();
@@ -212,5 +246,6 @@ public:
VARIANT_ENUM_CAST(TileMap::Mode);
VARIANT_ENUM_CAST(TileMap::HalfOffset);
+VARIANT_ENUM_CAST(TileMap::TileOrigin);
#endif // TILE_MAP_H
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp
index 22534eeb0e..cd3c788b65 100644
--- a/scene/2d/visibility_notifier_2d.cpp
+++ b/scene/2d/visibility_notifier_2d.cpp
@@ -32,6 +32,7 @@
#include "scene/2d/physics_body_2d.h"
#include "scene/animation/animation_player.h"
#include "scene/scene_string_names.h"
+#include "particles_2d.h"
void VisibilityNotifier2D::_enter_viewport(Viewport* p_viewport) {
@@ -188,6 +189,15 @@ void VisibilityEnabler2D::_find_nodes(Node* p_node) {
}
+ if (enabler[ENABLER_PAUSE_PARTICLES]) {
+
+ Particles2D *ps = p_node->cast_to<Particles2D>();
+ if (ps) {
+ add=true;
+ }
+
+ }
+
if (add) {
p_node->connect(SceneStringNames::get_singleton()->exit_tree,this,"_node_removed",varray(p_node),CONNECT_ONESHOT);
@@ -271,6 +281,15 @@ void VisibilityEnabler2D::_change_node_state(Node* p_node,bool p_enabled) {
}
}
+ {
+ Particles2D *ps=p_node->cast_to<Particles2D>();
+
+ if (ps) {
+
+ ps->set_emitting(p_enabled);
+ }
+ }
+
}
@@ -292,9 +311,11 @@ void VisibilityEnabler2D::_bind_methods(){
ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/pause_animations"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PAUSE_ANIMATIONS );
ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/freeze_bodies"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_FREEZE_BODIES);
+ ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/pause_particles"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PAUSE_PARTICLES);
BIND_CONSTANT( ENABLER_FREEZE_BODIES );
BIND_CONSTANT( ENABLER_PAUSE_ANIMATIONS );
+ BIND_CONSTANT( ENABLER_PAUSE_PARTICLES );
BIND_CONSTANT( ENABLER_MAX);
}
@@ -320,3 +341,4 @@ VisibilityEnabler2D::VisibilityEnabler2D() {
}
+
diff --git a/scene/2d/visibility_notifier_2d.h b/scene/2d/visibility_notifier_2d.h
index cdf52ecb27..621c470d5d 100644
--- a/scene/2d/visibility_notifier_2d.h
+++ b/scene/2d/visibility_notifier_2d.h
@@ -73,6 +73,7 @@ public:
enum Enabler {
ENABLER_PAUSE_ANIMATIONS,
ENABLER_FREEZE_BODIES,
+ ENABLER_PAUSE_PARTICLES,
ENABLER_MAX
};
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 1109139180..db69182ca0 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -680,8 +680,6 @@ void Camera::_bind_methods() {
ObjectTypeDB::bind_method( _MD("get_projection"),&Camera::get_projection );
ObjectTypeDB::bind_method( _MD("set_visible_layers","mask"),&Camera::set_visible_layers );
ObjectTypeDB::bind_method( _MD("get_visible_layers"),&Camera::get_visible_layers );
- ObjectTypeDB::bind_method( _MD("look_at","target","up"),&Camera::look_at );
- ObjectTypeDB::bind_method( _MD("look_at_from_pos","pos","target","up"),&Camera::look_at_from_pos );
ObjectTypeDB::bind_method(_MD("set_environment","env:Environment"),&Camera::set_environment);
ObjectTypeDB::bind_method(_MD("get_environment:Environment"),&Camera::get_environment);
ObjectTypeDB::bind_method(_MD("set_keep_aspect_mode","mode"),&Camera::set_keep_aspect_mode);
@@ -752,22 +750,6 @@ Vector<Plane> Camera::get_frustum() const {
-void Camera::look_at(const Vector3& p_target, const Vector3& p_up_normal) {
-
- Transform lookat;
- lookat.origin=get_camera_transform().origin;
- lookat=lookat.looking_at(p_target,p_up_normal);
- set_global_transform(lookat);
-}
-
-void Camera::look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal) {
-
- Transform lookat;
- lookat.origin=p_pos;
- lookat=lookat.looking_at(p_target,p_up_normal);
- set_global_transform(lookat);
-
-}
void Camera::set_v_offset(float p_offset) {
diff --git a/scene/3d/camera.h b/scene/3d/camera.h
index 950688dfda..de03282021 100644
--- a/scene/3d/camera.h
+++ b/scene/3d/camera.h
@@ -139,8 +139,6 @@ public:
void set_keep_aspect_mode(KeepAspect p_aspect);
KeepAspect get_keep_aspect_mode() const;
- void look_at(const Vector3& p_target, const Vector3& p_up_normal);
- void look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal);
void set_v_offset(float p_offset);
float get_v_offset() const;
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index a5b009823c..6e11855543 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -593,6 +593,97 @@ bool Spatial::_is_visible_() const {
return !is_hidden();
}
+void Spatial::rotate(const Vector3& p_normal,float p_radians) {
+
+ Transform t =get_transform();
+ t.basis.rotate(p_normal,p_radians);
+ set_transform(t);
+}
+
+void Spatial::rotate_x(float p_radians) {
+
+ Transform t =get_transform();
+ t.basis.rotate(Vector3(1,0,0),p_radians);
+ set_transform(t);
+
+}
+
+void Spatial::rotate_y(float p_radians){
+
+ Transform t =get_transform();
+ t.basis.rotate(Vector3(0,1,0),p_radians);
+ set_transform(t);
+
+}
+void Spatial::rotate_z(float p_radians){
+
+ Transform t =get_transform();
+ t.basis.rotate(Vector3(0,0,1),p_radians);
+ set_transform(t);
+
+}
+
+void Spatial::translate(const Vector3& p_offset){
+
+ Transform t =get_transform();
+ t.origin+=p_offset;
+ set_transform(t);
+
+}
+void Spatial::scale(const Vector3& p_ratio){
+
+ Transform t =get_transform();
+ t.basis.scale(p_ratio);
+ set_transform(t);
+
+}
+void Spatial::global_rotate(const Vector3& p_normal,float p_radians){
+
+ Matrix3 rotation(p_normal,p_radians);
+ Transform t = get_global_transform();
+ t.basis= rotation * t.basis;
+ set_global_transform(t);
+
+}
+void Spatial::global_translate(const Vector3& p_offset){
+ Transform t = get_global_transform();
+ t.origin+=p_offset;
+ set_global_transform(t);
+
+}
+
+void Spatial::orthonormalize() {
+
+ Transform t = get_transform();
+ t.orthonormalize();
+ set_transform(t);
+
+}
+
+void Spatial::set_identity() {
+
+ set_transform(Transform());
+
+}
+
+
+void Spatial::look_at(const Vector3& p_target, const Vector3& p_up_normal) {
+
+ Transform lookat;
+ lookat.origin=get_global_transform().origin;
+ lookat=lookat.looking_at(p_target,p_up_normal);
+ set_global_transform(lookat);
+}
+
+void Spatial::look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal) {
+
+ Transform lookat;
+ lookat.origin=p_pos;
+ lookat=lookat.looking_at(p_target,p_up_normal);
+ set_global_transform(lookat);
+
+}
+
void Spatial::_bind_methods() {
@@ -633,6 +724,28 @@ void Spatial::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_set_visible_"), &Spatial::_set_visible_);
ObjectTypeDB::bind_method(_MD("_is_visible_"), &Spatial::_is_visible_);
+ void rotate(const Vector3& p_normal,float p_radians);
+ void rotate_x(float p_radians);
+ void rotate_y(float p_radians);
+ void rotate_z(float p_radians);
+ void translate(const Vector3& p_offset);
+ void scale(const Vector3& p_ratio);
+ void global_rotate(const Vector3& p_normal,float p_radians);
+ void global_translate(const Vector3& p_offset);
+
+ ObjectTypeDB::bind_method( _MD("rotate","normal","radians"),&Spatial::rotate );
+ ObjectTypeDB::bind_method( _MD("global_rotate","normal","radians"),&Spatial::global_rotate );
+ ObjectTypeDB::bind_method( _MD("rotate_x","radians"),&Spatial::rotate_x );
+ ObjectTypeDB::bind_method( _MD("rotate_y","radians"),&Spatial::rotate_y );
+ ObjectTypeDB::bind_method( _MD("rotate_z","radians"),&Spatial::rotate_z );
+ ObjectTypeDB::bind_method( _MD("translate","offset"),&Spatial::translate );
+ ObjectTypeDB::bind_method( _MD("global_translate","offset"),&Spatial::global_translate );
+ ObjectTypeDB::bind_method( _MD("orthonormalize"),&Spatial::orthonormalize );
+ ObjectTypeDB::bind_method( _MD("set_identity"),&Spatial::set_identity );
+
+ ObjectTypeDB::bind_method( _MD("look_at","target","up"),&Spatial::look_at );
+ ObjectTypeDB::bind_method( _MD("look_at_from_pos","pos","target","up"),&Spatial::look_at_from_pos );
+
BIND_CONSTANT( NOTIFICATION_TRANSFORM_CHANGED );
BIND_CONSTANT( NOTIFICATION_ENTER_WORLD );
BIND_CONSTANT( NOTIFICATION_EXIT_WORLD );
diff --git a/scene/3d/spatial.h b/scene/3d/spatial.h
index 49ecf5779b..f2cde8f1e6 100644
--- a/scene/3d/spatial.h
+++ b/scene/3d/spatial.h
@@ -167,6 +167,21 @@ public:
Transform get_relative_transform(const Node *p_parent) const;
+ void rotate(const Vector3& p_normal,float p_radians);
+ void rotate_x(float p_radians);
+ void rotate_y(float p_radians);
+ void rotate_z(float p_radians);
+ void translate(const Vector3& p_offset);
+ void scale(const Vector3& p_ratio);
+ void global_rotate(const Vector3& p_normal,float p_radians);
+ void global_translate(const Vector3& p_offset);
+
+ void look_at(const Vector3& p_target, const Vector3& p_up_normal);
+ void look_at_from_pos(const Vector3& p_pos,const Vector3& p_target, const Vector3& p_up_normal);
+
+ void orthonormalize();
+ void set_identity();
+
void show();
void hide();
bool is_visible() const;
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 0167687621..bbe15da1cc 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -279,12 +279,12 @@ void BaseButton::set_disabled(bool p_disabled) {
set_focus_mode(FOCUS_NONE);
else
set_focus_mode(FOCUS_ALL);
-};
+}
bool BaseButton::is_disabled() const {
return status.disabled;
-};
+}
void BaseButton::set_pressed(bool p_pressed) {
@@ -391,6 +391,7 @@ void BaseButton::_bind_methods() {
ADD_SIGNAL( MethodInfo("toggled", PropertyInfo( Variant::BOOL,"pressed") ) );
ADD_PROPERTY( PropertyInfo( Variant::BOOL, "disabled"), _SCS("set_disabled"), _SCS("is_disabled"));
ADD_PROPERTY( PropertyInfo( Variant::BOOL, "toggle_mode"), _SCS("set_toggle_mode"), _SCS("is_toggle_mode"));
+ ADD_PROPERTY( PropertyInfo( Variant::BOOL, "is_pressed"), _SCS("set_pressed"), _SCS("is_pressed"));
ADD_PROPERTY( PropertyInfo( Variant::BOOL, "click_on_press"), _SCS("set_click_on_press"), _SCS("get_click_on_press"));
diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp
new file mode 100644
index 0000000000..309152ba8f
--- /dev/null
+++ b/scene/gui/check_box.cpp
@@ -0,0 +1,79 @@
+/*************************************************************************/
+/* check_button.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "check_box.h"
+
+#include "servers/visual_server.h"
+#include "button_group.h"
+
+
+void CheckBox::_notification(int p_what) {
+
+ if (p_what==NOTIFICATION_DRAW) {
+
+ RID ci = get_canvas_item();
+
+ Ref<Texture> on=Control::get_icon(is_radio() ? "radio_checked" : "checked");
+ Ref<Texture> off=Control::get_icon(is_radio() ? "radio_unchecked" : "unchecked");
+
+ Vector2 ofs;
+ ofs.x = 0;
+ ofs.y = int((get_size().height - on->get_height())/2);
+
+ if (is_pressed())
+ on->draw(ci,ofs);
+ else
+ off->draw(ci,ofs);
+
+
+ }
+}
+
+bool CheckBox::is_radio()
+{
+ Node* parent = this;
+ do {
+ parent = parent->get_parent();
+ if (dynamic_cast< ButtonGroup* >(parent))
+ break;
+ } while (parent);
+
+ return (parent != 0);
+}
+
+CheckBox::CheckBox(const String &p_text):
+ Button(p_text)
+{
+ set_toggle_mode(true);
+ set_text_align(ALIGN_LEFT);
+
+}
+
+CheckBox::~CheckBox()
+{
+}
diff --git a/scene/gui/check_box.h b/scene/gui/check_box.h
new file mode 100644
index 0000000000..171fd55351
--- /dev/null
+++ b/scene/gui/check_box.h
@@ -0,0 +1,55 @@
+/*************************************************************************/
+/* check_box.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef CHECK_BOX_H
+#define CHECK_BOX_H
+
+
+#include "scene/gui/button.h"
+/**
+@author Mariano Suligoy <marianognu.esyrpg@gmail.com>
+*/
+class CheckBox : public Button {
+
+ OBJ_TYPE( CheckBox, Button );
+
+
+protected:
+ void _notification(int p_what);
+
+ bool is_radio();
+
+
+public:
+
+ CheckBox(const String& p_text=String());
+ ~CheckBox();
+
+};
+
+#endif
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 193649c815..d944b804a5 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -352,6 +352,7 @@ void ColorPickerButton::set_color(const Color& p_color){
picker->set_color(p_color);
+ update();
}
Color ColorPickerButton::get_color() const{
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index a8070be91d..86f442fd8c 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -940,67 +940,67 @@ void Control::_window_input_event(InputEvent p_event) {
case InputEvent::MOUSE_BUTTON: {
- window->key_event_accepted=false;
+ window->key_event_accepted=false;
- Point2 mpos =(get_canvas_transform()).affine_inverse().xform(Point2(p_event.mouse_button.x,p_event.mouse_button.y));
- if (p_event.mouse_button.pressed) {
+ Point2 mpos =(get_canvas_transform()).affine_inverse().xform(Point2(p_event.mouse_button.x,p_event.mouse_button.y));
+ if (p_event.mouse_button.pressed) {
- Size2 pos = mpos;
- if (window->mouse_focus && p_event.mouse_button.button_index!=window->mouse_focus_button) {
+ Size2 pos = mpos;
+ if (window->mouse_focus && p_event.mouse_button.button_index!=window->mouse_focus_button) {
- //do not steal mouse focus and stuff
+ //do not steal mouse focus and stuff
- } else {
+ } else {
- _window_sort_modal_stack();
- while (!window->modal_stack.empty()) {
+ _window_sort_modal_stack();
+ while (!window->modal_stack.empty()) {
- Control *top = window->modal_stack.back()->get();
- if (!top->has_point(top->get_global_transform().affine_inverse().xform(pos))) {
+ Control *top = window->modal_stack.back()->get();
+ if (!top->has_point(top->get_global_transform().affine_inverse().xform(pos))) {
- if (top->data.modal_exclusive) {
- //cancel event, sorry, modal exclusive EATS UP ALL
- get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID);
- get_tree()->set_input_as_handled();
- return; // no one gets the event if exclusive NO ONE
- }
+ if (top->data.modal_exclusive) {
+ //cancel event, sorry, modal exclusive EATS UP ALL
+ get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID);
+ get_tree()->set_input_as_handled();
+ return; // no one gets the event if exclusive NO ONE
+ }
- top->notification(NOTIFICATION_MODAL_CLOSE);
- top->_modal_stack_remove();
- top->hide();
- } else {
- break;
+ top->notification(NOTIFICATION_MODAL_CLOSE);
+ top->_modal_stack_remove();
+ top->hide();
+ } else {
+ break;
+ }
}
- }
- Matrix32 parent_xform;
+ Matrix32 parent_xform;
- if (data.parent_canvas_item)
- parent_xform=data.parent_canvas_item->get_global_transform();
+ if (data.parent_canvas_item)
+ parent_xform=data.parent_canvas_item->get_global_transform();
- window->mouse_focus = _find_control_at_pos(this,pos,parent_xform,window->focus_inv_xform);
- //print_line("has mf "+itos(window->mouse_focus!=NULL));
- window->mouse_focus_button=p_event.mouse_button.button_index;
+ window->mouse_focus = _find_control_at_pos(this,pos,parent_xform,window->focus_inv_xform);
+ //print_line("has mf "+itos(window->mouse_focus!=NULL));
+ window->mouse_focus_button=p_event.mouse_button.button_index;
- if (!window->mouse_focus) {
- break;
- }
+ if (!window->mouse_focus) {
+ break;
+ }
- if (p_event.mouse_button.button_index==BUTTON_LEFT) {
- window->drag_accum=Vector2();
- window->drag_attempted=false;
- window->drag_data=Variant();
- }
+ if (p_event.mouse_button.button_index==BUTTON_LEFT) {
+ window->drag_accum=Vector2();
+ window->drag_attempted=false;
+ window->drag_data=Variant();
+ }
- }
+ }
p_event.mouse_button.global_x = pos.x;
p_event.mouse_button.global_y = pos.y;
@@ -1020,8 +1020,8 @@ void Control::_window_input_event(InputEvent p_event) {
/*if (bool(GLOBAL_DEF("debug/print_clicked_control",false))) {
- print_line(String(window->mouse_focus->get_path())+" - "+pos);
- }*/
+ print_line(String(window->mouse_focus->get_path())+" - "+pos);
+ }*/
#endif
if (window->mouse_focus->get_focus_mode()!=FOCUS_NONE && window->mouse_focus!=window->key_focus && p_event.mouse_button.button_index==BUTTON_LEFT) {
@@ -1033,10 +1033,12 @@ void Control::_window_input_event(InputEvent p_event) {
if (window->mouse_focus->can_process()) {
_window_call_input(window->mouse_focus,p_event);
}
-
+
get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID);
get_tree()->set_input_as_handled();
+ window->tooltip_popup->hide();
+
} else {
if (window->drag_preview && p_event.mouse_button.button_index==BUTTON_LEFT) {
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index fbcfdb69bb..47f862a58d 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -29,6 +29,8 @@
#include "file_dialog.h"
#include "scene/gui/label.h"
#include "print_string.h"
+#include "os/keyboard.h"
+#include "tools/editor/editor_settings.h"
FileDialog::GetIconFunc FileDialog::get_icon_func=NULL;
@@ -278,13 +280,20 @@ void FileDialog::update_file_list() {
List<String> dirs;
bool isdir;
+ bool ishidden;
+ bool show_hidden = EditorSettings::get_singleton()->get("file_dialog/show_hidden_files");
String item;
+
while ((item=dir_access->get_next(&isdir))!="") {
-
- if (!isdir)
- files.push_back(item);
- else
- dirs.push_back(item);
+
+ ishidden = dir_access->current_is_hidden();
+
+ if (show_hidden || !ishidden) {
+ if (!isdir)
+ files.push_back(item);
+ else
+ dirs.push_back(item);
+ }
}
dirs.sort_custom<NoCaseComparator>();
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index d2e1e7f0b9..892e4c9bc7 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -72,6 +72,7 @@ void Label::_notification(int p_what) {
if (clip && !autowrap)
VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(),true);
+
if (word_cache_dirty)
regenerate_word_cache();
@@ -87,7 +88,8 @@ void Label::_notification(int p_what) {
bool use_outlinde = get_constant("shadow_as_outline");
Point2 shadow_ofs(get_constant("shadow_offset_x"),get_constant("shadow_offset_y"));
-
+ VisualServer::get_singleton()->canvas_item_set_distance_field_mode(get_canvas_item(),font.is_valid() && font->is_distance_field_hint());
+
int font_h = font->get_height();
int line_from=(int)get_val(); // + p_exposed.pos.y / font_h;
int lines_visible = size.y/font_h;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 8855627bb4..b26b55f076 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -498,7 +498,29 @@ void TextEdit::_notification(int p_what) {
for(int j=from;j<text[i].length();j++) {
CharType cc = text[i][j];
- if (cc==c)
+ //ignore any brackets inside a string
+ if (cc== '"' | cc == '\'') {
+ CharType quotation = cc;
+ do {
+ j++;
+ if (!(j<text[i].length())) {
+ break;
+ }
+ cc=text[i][j];
+ //skip over escaped quotation marks inside strings
+ if (cc=='\\') {
+ bool escaped = true;
+ while (j+1<text[i].length() && text[i][j+1]=='\\') {
+ escaped=!escaped;
+ j++;
+ }
+ if (escaped) {
+ j++;
+ continue;
+ }
+ }
+ } while (cc!= quotation);
+ } else if (cc==c)
stack++;
else if (cc==closec)
stack--;
@@ -547,7 +569,30 @@ void TextEdit::_notification(int p_what) {
for(int j=from;j>=0;j--) {
CharType cc = text[i][j];
- if (cc==c)
+ //ignore any brackets inside a string
+ if (cc== '"' | cc == '\'') {
+ CharType quotation = cc;
+ do {
+ j--;
+ if (!(j>=0)) {
+ break;
+ }
+ cc=text[i][j];
+ //skip over escaped quotation marks inside strings
+ if (cc==quotation) {
+ bool escaped = false;
+ while (j-1>=0 && text[i][j-1]=='\\') {
+ escaped=!escaped;
+ j--;
+ }
+ if (escaped) {
+ j--;
+ cc='\\';
+ continue;
+ }
+ }
+ } while (cc!= quotation);
+ } else if (cc==c)
stack++;
else if (cc==closec)
stack--;
@@ -1345,7 +1390,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
return;
}
- if (k.scancode==KEY_HOME) {
+ if (k.scancode==KEY_HOME && completion_index>0) {
completion_index=0;
completion_current=completion_options[completion_index];
@@ -1354,7 +1399,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
return;
}
- if (k.scancode==KEY_END) {
+ if (k.scancode==KEY_END && completion_index<completion_options.size()-1) {
completion_index=completion_options.size()-1;
completion_current=completion_options[completion_index];
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 02e009866f..ee400ae6d5 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -30,7 +30,7 @@
#include "os/os.h"
#include "scene/3d/spatial.h"
#include "os/input.h"
-
+#include "servers/physics_2d_server.h"
//#include "scene/3d/camera.h"
#include "servers/spatial_sound_server.h"
@@ -40,7 +40,7 @@
#include "scene/3d/spatial_indexer.h"
#include "scene/3d/collision_object.h"
-
+#include "scene/2d/collision_object_2d.h"
int RenderTargetTexture::get_width() const {
@@ -104,8 +104,10 @@ void Viewport::_update_stretch_transform() {
stretch_transform.scale(scale);
stretch_transform.elements[2]=size_override_margin*scale;
+
} else {
+
stretch_transform=Matrix32();
}
@@ -355,11 +357,12 @@ void Viewport::_notification(int p_what) {
case NOTIFICATION_FIXED_PROCESS: {
if (physics_object_picking) {
-#ifndef _3D_DISABLED
+
Vector2 last_pos(1e20,1e20);
CollisionObject *last_object;
ObjectID last_id=0;
PhysicsDirectSpaceState::RayResult result;
+ Physics2DDirectSpaceState *ss2d=Physics2DServer::get_singleton()->space_get_direct_state(find_world_2d()->get_space());
bool motion_tested=false;
@@ -392,6 +395,60 @@ void Viewport::_notification(int p_what) {
}
+ if (ss2d) {
+ //send to 2D
+
+
+ uint64_t frame = get_tree()->get_frame();
+
+ Vector2 point = get_canvas_transform().affine_inverse().xform(pos);
+ Physics2DDirectSpaceState::ShapeResult res[64];
+ int rc = ss2d->intersect_point(point,res,64,Set<RID>(),0xFFFFFFFF,0xFFFFFFFF);
+ for(int i=0;i<rc;i++) {
+
+ if (res[i].collider) {
+ CollisionObject2D *co=res[i].collider->cast_to<CollisionObject2D>();
+ if (co) {
+
+ Map<ObjectID,uint64_t>::Element *E=physics_2d_mouseover.find(res[i].collider_id);
+ if (!E) {
+ E=physics_2d_mouseover.insert(res[i].collider_id,frame);
+ co->_mouse_enter();
+ } else {
+ E->get()=frame;
+ }
+
+ co->_input_event(this,ev,res[i].shape);
+ }
+ }
+ }
+
+ List<Map<ObjectID,uint64_t>::Element*> to_erase;
+
+ for (Map<ObjectID,uint64_t>::Element*E=physics_2d_mouseover.front();E;E=E->next()) {
+ if (E->get()!=frame) {
+ Object *o=ObjectDB::get_instance(E->key());
+ if (o) {
+
+ CollisionObject2D *co=o->cast_to<CollisionObject2D>();
+ if (co) {
+ co->_mouse_exit();
+ }
+ }
+ to_erase.push_back(E);
+ }
+ }
+
+ while(to_erase.size()) {
+ physics_2d_mouseover.erase(to_erase.front()->get());
+ to_erase.pop_front();
+ }
+
+ }
+
+
+
+#ifndef _3D_DISABLED
bool captured=false;
if (physics_object_capture!=0) {
@@ -499,9 +556,9 @@ void Viewport::_notification(int p_what) {
_test_new_mouseover(new_collider);
}
-
- }
#endif
+ }
+
}
} break;
@@ -1021,8 +1078,9 @@ Matrix32 Viewport::_get_input_pre_xform() const {
ERR_FAIL_COND_V(to_screen_rect.size.x==0,pre_xf);
ERR_FAIL_COND_V(to_screen_rect.size.y==0,pre_xf);
- pre_xf.scale(rect.size/to_screen_rect.size);
+
pre_xf.elements[2]=-to_screen_rect.pos;
+ pre_xf.scale(rect.size/to_screen_rect.size);
} else {
pre_xf.elements[2]=-rect.pos;
@@ -1086,6 +1144,7 @@ void Viewport::_make_input_local(InputEvent& ev) {
} break;
}
+
}
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index d2a22401bd..14f4f68217 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -124,6 +124,7 @@ friend class RenderTargetTexture;
ObjectID physics_object_over;
Vector2 physics_last_mousepos;
void _test_new_mouseover(ObjectID new_collider);
+ Map<ObjectID,uint64_t> physics_2d_mouseover;
void _update_rect();
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index f90db42614..afadbf0170 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -53,6 +53,7 @@
#include "scene/gui/color_picker.h"
#include "scene/gui/texture_frame.h"
#include "scene/gui/menu_button.h"
+#include "scene/gui/check_box.h"
#include "scene/gui/check_button.h"
#include "scene/gui/tab_container.h"
#include "scene/gui/panel_container.h"
@@ -76,6 +77,7 @@
#include "scene/gui/reference_frame.h"
#include "scene/gui/graph_node.h"
#include "scene/gui/graph_edit.h"
+#include "scene/gui/tool_button.h"
#include "scene/resources/video_stream.h"
#include "scene/2d/particles_2d.h"
#include "scene/2d/path_2d.h"
@@ -86,6 +88,7 @@
#include "scene/2d/sprite.h"
#include "scene/2d/animated_sprite.h"
#include "scene/2d/polygon_2d.h"
+#include "scene/2d/back_buffer_copy.h"
#include "scene/2d/visibility_notifier_2d.h"
@@ -288,7 +291,9 @@ void register_scene_types() {
ObjectTypeDB::register_type<Popup>();
ObjectTypeDB::register_type<PopupPanel>();
ObjectTypeDB::register_type<MenuButton>();
+ ObjectTypeDB::register_type<CheckBox>();
ObjectTypeDB::register_type<CheckButton>();
+ ObjectTypeDB::register_type<ToolButton>();
ObjectTypeDB::register_type<Panel>();
ObjectTypeDB::register_type<Range>();
@@ -481,6 +486,7 @@ void register_scene_types() {
ObjectTypeDB::register_type<LightOccluder2D>();
ObjectTypeDB::register_type<OccluderPolygon2D>();
ObjectTypeDB::register_type<YSort>();
+ ObjectTypeDB::register_type<BackBufferCopy>();
ObjectTypeDB::set_type_enabled("CollisionShape2D",false);
ObjectTypeDB::set_type_enabled("CollisionPolygon2D",false);
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 4d1e9896db..7d5981522e 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -300,6 +300,40 @@ void make_default_theme() {
t->set_constant("hseparation","MenuButton", 0 );
+ // CheckBox
+
+ Ref<StyleBox> cbx_empty = memnew( StyleBoxEmpty );
+ cbx_empty->set_default_margin(MARGIN_LEFT,22);
+ cbx_empty->set_default_margin(MARGIN_RIGHT,4);
+ cbx_empty->set_default_margin(MARGIN_TOP,4);
+ cbx_empty->set_default_margin(MARGIN_BOTTOM,5);
+ Ref<StyleBox> cbx_focus = focus;
+ cbx_focus->set_default_margin(MARGIN_LEFT,4);
+ cbx_focus->set_default_margin(MARGIN_RIGHT,22);
+ cbx_focus->set_default_margin(MARGIN_TOP,4);
+ cbx_focus->set_default_margin(MARGIN_BOTTOM,5);
+
+ t->set_stylebox("normal","CheckBox", cbx_empty );
+ t->set_stylebox("pressed","CheckBox", cbx_empty );
+ t->set_stylebox("disabled","CheckBox", cbx_empty );
+ t->set_stylebox("hover","CheckBox", cbx_empty );
+ t->set_stylebox("focus","CheckBox", cbx_focus );
+
+ t->set_icon("checked", "CheckBox", make_icon(checked_png));
+ t->set_icon("unchecked", "CheckBox", make_icon(unchecked_png));
+ t->set_icon("radio_checked", "CheckBox", make_icon(radio_checked_png));
+ t->set_icon("radio_unchecked", "CheckBox", make_icon(radio_unchecked_png));
+
+ t->set_font("font","CheckBox", default_font );
+
+ t->set_color("font_color","CheckBox", control_font_color );
+ t->set_color("font_color_pressed","CheckBox", control_font_color_pressed );
+ t->set_color("font_color_hover","CheckBox", control_font_color_hover );
+ t->set_color("font_color_disabled","CheckBox", control_font_color_disabled );
+
+ t->set_constant("hseparation","CheckBox",4);
+ t->set_constant("check_vadjust","CheckBox",0);
+
// CheckButton
@@ -308,7 +342,7 @@ void make_default_theme() {
cb_empty->set_default_margin(MARGIN_LEFT,6);
cb_empty->set_default_margin(MARGIN_RIGHT,70);
cb_empty->set_default_margin(MARGIN_TOP,4);
- cb_empty->set_default_margin(MARGIN_BOTTOM,4);
+ cb_empty->set_default_margin(MARGIN_BOTTOM,4);
t->set_stylebox("normal","CheckButton", cb_empty );
t->set_stylebox("pressed","CheckButton", cb_empty );
@@ -540,7 +574,7 @@ void make_default_theme() {
// Tree
Ref<StyleBoxTexture> tree_selected = make_stylebox( selection_png,4,4,4,4,8,0,8,0);
- Ref<StyleBoxTexture> tree_selected_oof = make_stylebox( selection_oof_png,4,4,4,4,8,0,8,0);
+ Ref<StyleBoxTexture> tree_selected_oof = make_stylebox( selection_oof_png,4,4,4,4,8,0,8,0);
t->set_stylebox("bg","Tree", make_stylebox( tree_bg_png,4,4,4,5) );
t->set_stylebox("bg_focus","Tree", focus );
diff --git a/scene/resources/default_theme/radio_checked.png b/scene/resources/default_theme/radio_checked.png
new file mode 100644
index 0000000000..ada8dde3c1
--- /dev/null
+++ b/scene/resources/default_theme/radio_checked.png
Binary files differ
diff --git a/scene/resources/default_theme/radio_unchecked.png b/scene/resources/default_theme/radio_unchecked.png
new file mode 100644
index 0000000000..018af99afd
--- /dev/null
+++ b/scene/resources/default_theme/radio_unchecked.png
Binary files differ
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index e9a6d3dad6..78e210239d 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -264,6 +264,16 @@ static const unsigned char progress_fill_png[]={
};
+static const unsigned char radio_checked_png[]={
+0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xdf,0x3,0x1,0x4,0x19,0x36,0x83,0x13,0x8d,0xb2,0x0,0x0,0x0,0x1d,0x69,0x54,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x0,0x0,0x0,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x64,0x2e,0x65,0x7,0x0,0x0,0x1,0x9d,0x49,0x44,0x41,0x54,0x38,0xcb,0xad,0x93,0x31,0x6b,0xdb,0x50,0x14,0x85,0x3f,0x59,0x8a,0x21,0xbb,0x17,0xd1,0x37,0xa4,0xa4,0xb5,0x10,0xb5,0x3,0xfa,0x7,0x5d,0x3a,0x74,0xf2,0x56,0x39,0x64,0x4d,0x97,0x42,0x9b,0xce,0x6d,0x7e,0x44,0xe3,0x8e,0xf5,0x60,0x4,0xc5,0x22,0x9b,0x27,0x63,0xe8,0xea,0xc5,0x43,0x4d,0x48,0x40,0x7a,0xe9,0xd0,0xe0,0xd4,0x68,0x32,0x18,0x3c,0x8,0x64,0xc3,0xed,0x50,0x59,0x34,0x71,0xa7,0x3a,0x7,0xde,0x72,0xef,0x79,0x87,0x7b,0xde,0x3d,0xf,0xb6,0x84,0x71,0xbf,0xe0,0x38,0xce,0x23,0xe0,0x2d,0xf0,0x12,0xa8,0xe6,0xe5,0x6b,0xa0,0xf,0x7c,0xd6,0x5a,0x4f,0xff,0x29,0x60,0x99,0x16,0xfb,0x4f,0xf6,0x8f,0x81,0x56,0xb3,0x79,0xb4,0x7b,0x78,0xf8,0xa,0xc3,0xf8,0xd3,0x16,0x11,0xba,0xdd,0x73,0xc2,0xf0,0x6b,0xa,0xbc,0x9b,0x4c,0x26,0xed,0x34,0x4d,0xef,0xa,0x38,0x8e,0x73,0xbc,0xb7,0xf7,0xf8,0xcb,0xd9,0xd9,0xa7,0xe2,0xe2,0x7d,0x88,0x8,0x27,0x27,0xef,0xb9,0xb9,0xf9,0xf9,0x5a,0x6b,0xdd,0x2e,0x4,0xf2,0xb1,0x7f,0xf4,0x7a,0xbd,0x5d,0xc3,0x30,0xc8,0xb2,0x8c,0xf1,0x78,0x4c,0x14,0x45,0x0,0xb8,0xae,0x8b,0xe7,0x79,0x94,0xcb,0x65,0x44,0x84,0x46,0xa3,0x91,0x2,0x4f,0xb5,0xd6,0x53,0x13,0xa0,0x52,0xa9,0x7c,0x6c,0x36,0x8f,0x9e,0x1f,0x1c,0xd4,0xc8,0xb2,0x8c,0x4e,0xa7,0x43,0xab,0xd5,0x62,0x30,0x18,0x30,0x1c,0xe,0x19,0x8d,0x46,0xac,0x56,0x2b,0xea,0xf5,0x3a,0x96,0x65,0x21,0x52,0xda,0xb9,0xba,0xba,0x5c,0xce,0x66,0xb3,0x6f,0xeb,0xf1,0x2f,0xe2,0x38,0x16,0xad,0xb5,0x4,0x41,0x20,0x4a,0x29,0x1,0xee,0x1c,0xa5,0x94,0x4,0x41,0x20,0x5a,0x6b,0x89,0xe3,0x58,0x1c,0xc7,0xb9,0x0,0x28,0xe5,0xf6,0xaa,0x6b,0xdf,0x51,0x14,0x91,0x24,0xc9,0x86,0xff,0x24,0x49,0xa,0x4b,0x39,0xb7,0xfa,0xb7,0xc0,0x7f,0x63,0x2d,0x70,0x2d,0x22,0xc5,0x83,0xd9,0xb6,0xbd,0x41,0xb4,0x6d,0x1b,0xd7,0x75,0x8b,0x6d,0xe4,0xd9,0x28,0x4,0xfa,0xdd,0xee,0x39,0x0,0x9e,0xe7,0xe1,0xfb,0x3e,0x4a,0x29,0x4c,0xd3,0xc4,0x34,0x4d,0x94,0x52,0xf8,0xbe,0x8f,0xe7,0x79,0x0,0xe4,0xdc,0xfe,0x83,0xac,0x71,0xeb,0x20,0x99,0xeb,0xe6,0x62,0xb1,0xf8,0x6e,0x18,0x4c,0xc3,0x30,0x7c,0x21,0x52,0xda,0xa9,0xd5,0x9e,0x6d,0x44,0xf9,0xf4,0xf4,0x43,0x3a,0x9f,0xcf,0xdf,0xdc,0xde,0xfe,0x6a,0x2f,0x97,0xcb,0x87,0xf9,0x4c,0x5b,0xe3,0x37,0x57,0xdf,0xd7,0x8,0xe6,0x62,0x7d,0xab,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
+};
+
+
+static const unsigned char radio_unchecked_png[]={
+0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xdf,0x3,0x1,0x4,0x1b,0x6,0x97,0xfc,0xdf,0x9c,0x0,0x0,0x0,0x1d,0x69,0x54,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x0,0x0,0x0,0x0,0x0,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x47,0x49,0x4d,0x50,0x64,0x2e,0x65,0x7,0x0,0x0,0x1,0x9,0x49,0x44,0x41,0x54,0x38,0xcb,0xad,0x93,0xbd,0x72,0x82,0x40,0x14,0x85,0xf,0x68,0xa,0x9e,0x21,0x8d,0x8e,0x9,0xdb,0xc4,0xc7,0x48,0x41,0x43,0x2b,0xa3,0xad,0x69,0x32,0xc3,0xda,0xc7,0xa7,0x8,0x94,0xa1,0xd,0x68,0x4b,0xc3,0x5b,0xd8,0x5f,0x2d,0xe2,0x60,0xe8,0x99,0xa1,0xd8,0x82,0xc2,0x34,0x17,0x67,0x35,0x19,0x43,0x34,0xa7,0xbc,0x7b,0xee,0x37,0xf7,0x6f,0x81,0x2b,0x65,0x9c,0x6,0x84,0x10,0xb7,0x0,0x7c,0x0,0xe,0x0,0x9b,0xc3,0x6b,0x0,0x19,0x80,0x90,0x88,0x8a,0x1f,0x1,0xdd,0x4e,0x17,0x83,0xbb,0xc1,0x14,0x40,0xe0,0x79,0x13,0x6b,0x3c,0x1e,0x1d,0x81,0xe3,0x78,0x89,0xc5,0xe2,0x5d,0x1,0x90,0x79,0x9e,0x47,0x4a,0xa9,0x63,0x80,0x10,0x62,0xda,0xeb,0xf5,0xdf,0x82,0xe0,0xf5,0x6c,0xc9,0x52,0xce,0xb0,0xdd,0x7e,0x3c,0x11,0x51,0x74,0x0,0x70,0xd9,0x9b,0x34,0x4d,0xad,0x36,0x7d,0xbb,0xae,0xab,0x0,0xdc,0x13,0x51,0x61,0x72,0xcc,0xf7,0xbc,0x89,0xd5,0x76,0x70,0xec,0xf5,0x1,0xa0,0x1,0x38,0xa7,0x3d,0x9f,0x13,0x7b,0x1d,0x1d,0x60,0x5f,0xb0,0x41,0x5b,0x7,0x5c,0x2c,0x53,0xdb,0xf3,0x5f,0xb5,0xd6,0x1,0x59,0x1c,0x2f,0x5b,0x67,0xb2,0x37,0xd3,0x1,0x21,0x1f,0x49,0x2b,0xb1,0x37,0x3c,0x0,0xf8,0x3c,0xa5,0x94,0xb3,0x5f,0x93,0xd9,0x23,0x9b,0x93,0xee,0x34,0xf,0x55,0x55,0xad,0xc,0x3,0x45,0x92,0x24,0x8f,0xfb,0xbd,0x79,0x33,0x1c,0x3e,0x7c,0x2b,0x7b,0x3e,0x7f,0x51,0x65,0x59,0x3e,0xef,0x76,0x9f,0x51,0x5d,0xd7,0xff,0xf3,0x99,0xae,0xd6,0x17,0xf,0x97,0x66,0x8b,0x3d,0xf1,0x64,0x47,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
+};
+
+
static const unsigned char reference_border_png[]={
0x89,0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,0x0,0x0,0x0,0x1,0x73,0x52,0x47,0x42,0x0,0xae,0xce,0x1c,0xe9,0x0,0x0,0x0,0x6,0x62,0x4b,0x47,0x44,0x0,0xff,0x0,0xff,0x0,0xff,0xa0,0xbd,0xa7,0x93,0x0,0x0,0x0,0x9,0x70,0x48,0x59,0x73,0x0,0x0,0xb,0x13,0x0,0x0,0xb,0x13,0x1,0x0,0x9a,0x9c,0x18,0x0,0x0,0x0,0x7,0x74,0x49,0x4d,0x45,0x7,0xdb,0x7,0x9,0x11,0x2b,0x1a,0xed,0xf3,0x18,0x82,0x0,0x0,0x0,0x5b,0x49,0x44,0x41,0x54,0x38,0xcb,0x63,0xfc,0xbf,0x7d,0xfb,0x7f,0x6,0x6,0x6,0x6,0x86,0xae,0x2e,0x6,0x92,0x40,0x59,0x19,0x84,0x86,0x1b,0x40,0x6,0xf8,0xbf,0x7d,0xfb,0x7f,0xc6,0xff,0x8e,0x8e,0xff,0x19,0xf7,0xef,0x67,0xfc,0x7f,0xf1,0x22,0x49,0x9a,0x19,0xf5,0xf5,0x19,0xfe,0x3b,0x3a,0xfe,0x67,0x41,0x17,0x24,0xca,0x66,0x24,0xcb,0x98,0x18,0x28,0x4,0xa3,0x6,0x8c,0x1a,0xc0,0xc0,0xc0,0xc0,0xc0,0x82,0x2b,0x85,0x91,0x94,0x21,0x28,0xcb,0x4c,0x14,0x66,0x67,0x0,0x0,0x2b,0x27,0xc7,0x5e,0xa8,0x15,0xe4,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
};
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 3c4bc3ac75..1e3b9772ee 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -108,13 +108,14 @@ void Environment::_bind_methods() {
ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"fxaa/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_FXAA);
- ADD_PROPERTY( PropertyInfo(Variant::INT,"background/mode",PROPERTY_HINT_ENUM,"Keep,Default Color,Color,Texture,Cubemap,Texture RGBE,Cubemap RGBE"),_SCS("set_background"),_SCS("get_background"));
+ ADD_PROPERTY( PropertyInfo(Variant::INT,"background/mode",PROPERTY_HINT_ENUM,"Keep,Default Color,Color,Texture,Cubemap,Canvas"),_SCS("set_background"),_SCS("get_background"));
ADD_PROPERTYI( PropertyInfo(Variant::COLOR,"background/color"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_COLOR);
ADD_PROPERTYI( PropertyInfo(Variant::OBJECT,"background/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_TEXTURE);
ADD_PROPERTYI( PropertyInfo(Variant::OBJECT,"background/cubemap",PROPERTY_HINT_RESOURCE_TYPE,"CubeMap"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_CUBEMAP);
ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/energy",PROPERTY_HINT_RANGE,"0,128,0.01"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_ENERGY);
ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/scale",PROPERTY_HINT_RANGE,"0.001,16,0.001"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_SCALE);
ADD_PROPERTYI( PropertyInfo(Variant::REAL,"background/glow",PROPERTY_HINT_RANGE,"0.00,8,0.01"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_GLOW);
+ ADD_PROPERTYI( PropertyInfo(Variant::INT,"background/canvas_max_layer"),_SCS("set_background_param"),_SCS("get_background_param"), BG_PARAM_CANVAS_MAX_LAYER);
ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"glow/enabled"),_SCS("set_enable_fx"),_SCS("is_fx_enabled"), FX_GLOW);
ADD_PROPERTYI( PropertyInfo(Variant::INT,"glow/blur_passes",PROPERTY_HINT_RANGE,"1,4,1"),_SCS("fx_set_param"),_SCS("fx_get_param"), FX_PARAM_GLOW_BLUR_PASSES);
@@ -182,10 +183,10 @@ void Environment::_bind_methods() {
BIND_CONSTANT( BG_COLOR );
BIND_CONSTANT( BG_TEXTURE );
BIND_CONSTANT( BG_CUBEMAP );
- BIND_CONSTANT( BG_TEXTURE_RGBE );
- BIND_CONSTANT( BG_CUBEMAP_RGBE );
+ BIND_CONSTANT( BG_CANVAS );
BIND_CONSTANT( BG_MAX );
+ BIND_CONSTANT( BG_PARAM_CANVAS_MAX_LAYER );
BIND_CONSTANT( BG_PARAM_COLOR );
BIND_CONSTANT( BG_PARAM_TEXTURE );
BIND_CONSTANT( BG_PARAM_CUBEMAP );
diff --git a/scene/resources/environment.h b/scene/resources/environment.h
index a9e2f422b9..d672a898d5 100644
--- a/scene/resources/environment.h
+++ b/scene/resources/environment.h
@@ -44,14 +44,14 @@ public:
BG_COLOR=VS::ENV_BG_COLOR,
BG_TEXTURE=VS::ENV_BG_TEXTURE,
BG_CUBEMAP=VS::ENV_BG_CUBEMAP,
- BG_TEXTURE_RGBE=VS::ENV_BG_TEXTURE_RGBE,
- BG_CUBEMAP_RGBE=VS::ENV_BG_CUBEMAP_RGBE,
+ BG_CANVAS=VS::ENV_BG_CANVAS,
BG_MAX=VS::ENV_BG_MAX
};
enum BGParam {
- BG_PARAM_COLOR=VS::ENV_BG_PARAM_COLOR,
+ BG_PARAM_CANVAS_MAX_LAYER=VS::ENV_BG_PARAM_CANVAS_MAX_LAYER,
+ BG_PARAM_COLOR=VS::ENV_BG_PARAM_COLOR,
BG_PARAM_TEXTURE=VS::ENV_BG_PARAM_TEXTURE,
BG_PARAM_CUBEMAP=VS::ENV_BG_PARAM_CUBEMAP,
BG_PARAM_ENERGY=VS::ENV_BG_PARAM_ENERGY,
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 49ee3ee017..79316f0019 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -398,6 +398,17 @@ int Font::get_kerning_pair(CharType p_A,CharType p_B) const {
return 0;
}
+void Font::set_distance_field_hint(bool p_distance_field) {
+
+ distance_field_hint=p_distance_field;
+ emit_changed();
+}
+
+bool Font::is_distance_field_hint() const{
+
+ return distance_field_hint;
+}
+
void Font::clear() {
@@ -406,6 +417,7 @@ void Font::clear() {
char_map.clear();
textures.clear();
kerning_map.clear();
+ distance_field_hint=false;
}
Size2 Font::get_string_size(const String& p_string) const {
@@ -511,9 +523,16 @@ void Font::_bind_methods() {
ObjectTypeDB::bind_method(_MD("add_texture","texture:Texture"),&Font::add_texture);
ObjectTypeDB::bind_method(_MD("add_char","character","texture","rect","align","advance"),&Font::add_char,DEFVAL(Point2()),DEFVAL(-1));
+
+ ObjectTypeDB::bind_method(_MD("get_texture_count"),&Font::get_texture_count);
+ ObjectTypeDB::bind_method(_MD("get_texture:Texture","idx"),&Font::get_texture);
+
ObjectTypeDB::bind_method(_MD("get_char_size","char","next"),&Font::get_char_size,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("get_string_size","string"),&Font::get_string_size);
+ ObjectTypeDB::bind_method(_MD("set_distance_field_hint","enable"),&Font::set_distance_field_hint);
+ ObjectTypeDB::bind_method(_MD("is_distance_field_hint"),&Font::is_distance_field_hint);
+
ObjectTypeDB::bind_method(_MD("clear"),&Font::clear);
ObjectTypeDB::bind_method(_MD("draw","canvas_item","pos","string","modulate","clip_w"),&Font::draw,DEFVAL(Color(1,1,1)),DEFVAL(-1));
@@ -535,12 +554,14 @@ void Font::_bind_methods() {
ADD_PROPERTY( PropertyInfo( Variant::REAL, "height", PROPERTY_HINT_RANGE,"-1024,1024,1" ), _SCS("set_height"), _SCS("get_height") );
ADD_PROPERTY( PropertyInfo( Variant::REAL, "ascent", PROPERTY_HINT_RANGE,"-1024,1024,1" ), _SCS("set_ascent"), _SCS("get_ascent") );
+ ADD_PROPERTY( PropertyInfo( Variant::BOOL, "distance_field" ), _SCS("set_distance_field_hint"), _SCS("is_distance_field_hint") );
}
Font::Font() {
clear();
+
}
diff --git a/scene/resources/font.h b/scene/resources/font.h
index a64ec1ef7a..498bc6863a 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -75,6 +75,7 @@ private:
float height;
float ascent;
+ bool distance_field_hint;
void _set_chars(const DVector<int>& p_chars);
DVector<int> _get_chars() const;
@@ -116,6 +117,9 @@ public:
Size2 get_string_size(const String& p_string) const;
void clear();
+
+ void set_distance_field_hint(bool p_distance_field);
+ bool is_distance_field_hint() const;
void draw(RID p_canvas_item, const Point2& p_pos, const String& p_text,const Color& p_modulate=Color(1,1,1),int p_clip_w=-1) const;
void draw_halign(RID p_canvas_item, const Point2& p_pos, HAlign p_align,float p_width,const String& p_text,const Color& p_modulate=Color(1,1,1)) const;
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 2c1502288b..8d3cbadd06 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -321,6 +321,13 @@ void ImageTexture::premultiply_alpha() {
}
}
+void ImageTexture::normal_to_xy() {
+
+ Image img = get_data();
+ img.normalmap_to_xy();
+ create_from_image(img,flags);
+}
+
bool ImageTexture::has_alpha() const {
return ( format==Image::FORMAT_GRAYSCALE_ALPHA || format==Image::FORMAT_INDEXED_ALPHA || format==Image::FORMAT_RGBA );
@@ -405,9 +412,11 @@ void ImageTexture::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_lossy_storage_quality"),&ImageTexture::get_lossy_storage_quality);
ObjectTypeDB::bind_method(_MD("fix_alpha_edges"),&ImageTexture::fix_alpha_edges);
ObjectTypeDB::bind_method(_MD("premultiply_alpha"),&ImageTexture::premultiply_alpha);
+ ObjectTypeDB::bind_method(_MD("normal_to_xy"),&ImageTexture::normal_to_xy);
ObjectTypeDB::bind_method(_MD("set_size_override","size"),&ImageTexture::set_size_override);
ObjectTypeDB::set_method_flags(get_type_static(),_SCS("fix_alpha_edges"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
ObjectTypeDB::set_method_flags(get_type_static(),_SCS("premultiply_alpha"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
+ ObjectTypeDB::set_method_flags(get_type_static(),_SCS("normal_to_xy"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
ObjectTypeDB::bind_method(_MD("_reload_hook","rid"),&ImageTexture::_reload_hook);
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index c1122b005d..e853a4b05f 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -146,6 +146,8 @@ public:
void fix_alpha_edges();
void premultiply_alpha();
+ void normal_to_xy();
+
void set_size_override(const Size2& p_size);
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index 208ba5bb66..338804e0e1 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -46,6 +46,8 @@ bool TileSet::_set(const StringName& p_name, const Variant& p_value) {
tile_set_texture(id,p_value);
else if (what=="tex_offset")
tile_set_texture_offset(id,p_value);
+ else if (what=="material")
+ tile_set_material(id,p_value);
else if (what=="shape_offset")
tile_set_shape_offset(id,p_value);
else if (what=="region")
@@ -54,6 +56,14 @@ bool TileSet::_set(const StringName& p_name, const Variant& p_value) {
tile_set_shape(id,p_value);
else if (what=="shapes")
_tile_set_shapes(id,p_value);
+ else if (what=="occluder")
+ tile_set_light_occluder(id,p_value);
+ else if (what=="occluder_offset")
+ tile_set_occluder_offset(id,p_value);
+ else if (what=="navigation")
+ tile_set_navigation_polygon(id,p_value);
+ else if (what=="navigation_offset")
+ tile_set_navigation_polygon_offset(id,p_value);
else
return false;
@@ -79,6 +89,8 @@ bool TileSet::_get(const StringName& p_name,Variant &r_ret) const{
r_ret=tile_get_texture(id);
else if (what=="tex_offset")
r_ret=tile_get_texture_offset(id);
+ else if (what=="material")
+ r_ret=tile_get_material(id);
else if (what=="shape_offset")
r_ret=tile_get_shape_offset(id);
else if (what=="region")
@@ -87,6 +99,14 @@ bool TileSet::_get(const StringName& p_name,Variant &r_ret) const{
r_ret=tile_get_shape(id);
else if (what=="shapes")
r_ret=_tile_get_shapes(id);
+ else if (what=="occluder")
+ r_ret=tile_get_light_occluder(id);
+ else if (what=="occluder_offset")
+ r_ret=tile_get_occluder_offset(id);
+ else if (what=="navigation")
+ r_ret=tile_get_navigation_polygon(id);
+ else if (what=="navigation_offset")
+ r_ret=tile_get_navigation_polygon_offset(id);
else
return false;
@@ -103,8 +123,13 @@ void TileSet::_get_property_list( List<PropertyInfo> *p_list) const{
p_list->push_back(PropertyInfo(Variant::STRING,pre+"name"));
p_list->push_back(PropertyInfo(Variant::OBJECT,pre+"texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"));
p_list->push_back(PropertyInfo(Variant::VECTOR2,pre+"tex_offset"));
- p_list->push_back(PropertyInfo(Variant::VECTOR2,pre+"shape_offset"));
+ p_list->push_back(PropertyInfo(Variant::OBJECT,pre+"material",PROPERTY_HINT_RESOURCE_TYPE,"CanvasItemMaterial"));
p_list->push_back(PropertyInfo(Variant::RECT2,pre+"region"));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2,pre+"occluder_offset"));
+ p_list->push_back(PropertyInfo(Variant::OBJECT,pre+"occluder",PROPERTY_HINT_RESOURCE_TYPE,"OccluderPolygon2D"));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2,pre+"navigation_offset"));
+ p_list->push_back(PropertyInfo(Variant::OBJECT,pre+"navigation",PROPERTY_HINT_RESOURCE_TYPE,"NavigationPolygon"));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2,pre+"shape_offset"));
p_list->push_back(PropertyInfo(Variant::OBJECT,pre+"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape2D",PROPERTY_USAGE_EDITOR));
p_list->push_back(PropertyInfo(Variant::ARRAY,pre+"shapes",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR));
}
@@ -134,6 +159,22 @@ Ref<Texture> TileSet::tile_get_texture(int p_id) const {
}
+
+void TileSet::tile_set_material(int p_id,const Ref<CanvasItemMaterial> &p_material) {
+
+ ERR_FAIL_COND(!tile_map.has(p_id));
+ tile_map[p_id].material=p_material;
+ emit_changed();
+
+}
+
+Ref<CanvasItemMaterial> TileSet::tile_get_material(int p_id) const{
+
+ ERR_FAIL_COND_V(!tile_map.has(p_id),Ref<CanvasItemMaterial>());
+ return tile_map[p_id].material;
+}
+
+
void TileSet::tile_set_texture_offset(int p_id,const Vector2 &p_offset) {
ERR_FAIL_COND(!tile_map.has(p_id));
@@ -210,6 +251,58 @@ Ref<Shape2D> TileSet::tile_get_shape(int p_id) const {
}
+void TileSet::tile_set_light_occluder(int p_id,const Ref<OccluderPolygon2D> &p_light_occluder) {
+
+ ERR_FAIL_COND(!tile_map.has(p_id));
+ tile_map[p_id].occluder=p_light_occluder;
+
+}
+
+Ref<OccluderPolygon2D> TileSet::tile_get_light_occluder(int p_id) const{
+
+ ERR_FAIL_COND_V(!tile_map.has(p_id),Ref<OccluderPolygon2D>());
+ return tile_map[p_id].occluder;
+
+}
+
+void TileSet::tile_set_navigation_polygon_offset(int p_id,const Vector2& p_offset) {
+
+ ERR_FAIL_COND(!tile_map.has(p_id));
+ tile_map[p_id].navigation_polygon_offset=p_offset;
+
+}
+
+Vector2 TileSet::tile_get_navigation_polygon_offset(int p_id) const{
+ ERR_FAIL_COND_V(!tile_map.has(p_id),Vector2());
+ return tile_map[p_id].navigation_polygon_offset;
+}
+
+void TileSet::tile_set_navigation_polygon(int p_id,const Ref<NavigationPolygon> &p_navigation_polygon) {
+
+ ERR_FAIL_COND(!tile_map.has(p_id));
+ tile_map[p_id].navigation_polygon=p_navigation_polygon;
+
+}
+
+Ref<NavigationPolygon> TileSet::tile_get_navigation_polygon(int p_id) const {
+
+ ERR_FAIL_COND_V(!tile_map.has(p_id),Ref<NavigationPolygon>());
+ return tile_map[p_id].navigation_polygon;
+
+}
+
+void TileSet::tile_set_occluder_offset(int p_id,const Vector2& p_offset) {
+
+ ERR_FAIL_COND(!tile_map.has(p_id));
+ tile_map[p_id].occluder_offset=p_offset;
+
+}
+
+Vector2 TileSet::tile_get_occluder_offset(int p_id) const{
+ ERR_FAIL_COND_V(!tile_map.has(p_id),Vector2());
+ return tile_map[p_id].occluder_offset;
+}
+
void TileSet::tile_set_shapes(int p_id,const Vector<Ref<Shape2D> > &p_shapes) {
ERR_FAIL_COND(!tile_map.has(p_id));
@@ -319,6 +412,8 @@ void TileSet::_bind_methods() {
ObjectTypeDB::bind_method(_MD("tile_get_name","id"),&TileSet::tile_get_name);
ObjectTypeDB::bind_method(_MD("tile_set_texture","id","texture:Texture"),&TileSet::tile_set_texture);
ObjectTypeDB::bind_method(_MD("tile_get_texture:Texture","id"),&TileSet::tile_get_texture);
+ ObjectTypeDB::bind_method(_MD("tile_set_material","id","material:CanvasItemMaterial"),&TileSet::tile_set_material);
+ ObjectTypeDB::bind_method(_MD("tile_get_material:CanvasItemMaterial","id"),&TileSet::tile_get_material);
ObjectTypeDB::bind_method(_MD("tile_set_texture_offset","id","texture_offset"),&TileSet::tile_set_texture_offset);
ObjectTypeDB::bind_method(_MD("tile_get_texture_offset","id"),&TileSet::tile_get_texture_offset);
ObjectTypeDB::bind_method(_MD("tile_set_shape_offset","id","shape_offset"),&TileSet::tile_set_shape_offset);
@@ -329,6 +424,15 @@ void TileSet::_bind_methods() {
ObjectTypeDB::bind_method(_MD("tile_get_shape:Shape2D","id"),&TileSet::tile_get_shape);
ObjectTypeDB::bind_method(_MD("tile_set_shapes","id","shapes"),&TileSet::_tile_set_shapes);
ObjectTypeDB::bind_method(_MD("tile_get_shapes","id"),&TileSet::_tile_get_shapes);
+ ObjectTypeDB::bind_method(_MD("tile_set_navigation_polygon","id","navigation_polygon:NavigationPolygon"),&TileSet::tile_set_navigation_polygon);
+ ObjectTypeDB::bind_method(_MD("tile_get_navigation_polygon:NavigationPolygon","id"),&TileSet::tile_get_navigation_polygon);
+ ObjectTypeDB::bind_method(_MD("tile_set_navigation_polygon_offset","id","navigation_polygon_offset"),&TileSet::tile_set_navigation_polygon_offset);
+ ObjectTypeDB::bind_method(_MD("tile_get_navigation_polygon_offset","id"),&TileSet::tile_get_navigation_polygon_offset);
+ ObjectTypeDB::bind_method(_MD("tile_set_light_occluder","id","light_occluder:OccluderPolygon2D"),&TileSet::tile_set_light_occluder);
+ ObjectTypeDB::bind_method(_MD("tile_get_light_occluder:OccluderPolygon2D","id"),&TileSet::tile_get_light_occluder);
+ ObjectTypeDB::bind_method(_MD("tile_set_occluder_offset","id","occluder_offset"),&TileSet::tile_set_occluder_offset);
+ ObjectTypeDB::bind_method(_MD("tile_get_occluder_offset","id"),&TileSet::tile_get_occluder_offset);
+
ObjectTypeDB::bind_method(_MD("remove_tile","id"),&TileSet::remove_tile);
ObjectTypeDB::bind_method(_MD("clear"),&TileSet::clear);
ObjectTypeDB::bind_method(_MD("get_last_unused_tile_id"),&TileSet::get_last_unused_tile_id);
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h
index ddbb1b59a6..0234755a53 100644
--- a/scene/resources/tile_set.h
+++ b/scene/resources/tile_set.h
@@ -32,6 +32,8 @@
#include "resource.h"
#include "scene/resources/shape_2d.h"
#include "scene/resources/texture.h"
+#include "scene/2d/light_occluder_2d.h"
+#include "scene/2d/navigation_polygon.h"
class TileSet : public Resource {
@@ -45,6 +47,11 @@ class TileSet : public Resource {
Vector2 shape_offset;
Rect2i region;
Vector<Ref<Shape2D> > shapes;
+ Vector2 occluder_offset;
+ Ref<OccluderPolygon2D> occluder;
+ Vector2 navigation_polygon_offset;
+ Ref<NavigationPolygon> navigation_polygon;
+ Ref<CanvasItemMaterial> material;
};
Map<int,Data> tile_map;
@@ -84,6 +91,21 @@ public:
void tile_set_shape(int p_id,const Ref<Shape2D> &p_shape);
Ref<Shape2D> tile_get_shape(int p_id) const;
+ void tile_set_material(int p_id,const Ref<CanvasItemMaterial> &p_material);
+ Ref<CanvasItemMaterial> tile_get_material(int p_id) const;
+
+ void tile_set_occluder_offset(int p_id,const Vector2& p_offset);
+ Vector2 tile_get_occluder_offset(int p_id) const;
+
+ void tile_set_light_occluder(int p_id,const Ref<OccluderPolygon2D> &p_light_occluder);
+ Ref<OccluderPolygon2D> tile_get_light_occluder(int p_id) const;
+
+ void tile_set_navigation_polygon_offset(int p_id,const Vector2& p_offset);
+ Vector2 tile_get_navigation_polygon_offset(int p_id) const;
+
+ void tile_set_navigation_polygon(int p_id,const Ref<NavigationPolygon> &p_navigation_polygon);
+ Ref<NavigationPolygon> tile_get_navigation_polygon(int p_id) const;
+
void tile_set_shapes(int p_id,const Vector<Ref<Shape2D> > &p_shapes);
Vector<Ref<Shape2D> > tile_get_shapes(int p_id) const;
diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp
index 880a3a32e3..30cf58bdd8 100644
--- a/scene/resources/world.cpp
+++ b/scene/resources/world.cpp
@@ -307,6 +307,11 @@ Ref<Environment> World::get_environment() const {
}
+PhysicsDirectSpaceState *World::get_direct_space_state() {
+
+ return PhysicsServer::get_singleton()->space_get_direct_state(space);
+}
+
void World::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_space"),&World::get_space);
@@ -314,6 +319,7 @@ void World::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_sound_space"),&World::get_sound_space);
ObjectTypeDB::bind_method(_MD("set_environment","env:Environment"),&World::set_environment);
ObjectTypeDB::bind_method(_MD("get_environment:Environment"),&World::get_environment);
+ ObjectTypeDB::bind_method(_MD("get_direct_space_state:PhysicsDirectSpaceState"),&World::get_direct_space_state);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"environment",PROPERTY_HINT_RESOURCE_TYPE,"Environment"),_SCS("set_environment"),_SCS("get_environment"));
}
diff --git a/scene/resources/world.h b/scene/resources/world.h
index 60b3b99ab0..b10cadd6e0 100644
--- a/scene/resources/world.h
+++ b/scene/resources/world.h
@@ -75,6 +75,8 @@ public:
void set_environment(const Ref<Environment>& p_environment);
Ref<Environment> get_environment() const;
+ PhysicsDirectSpaceState *get_direct_space_state();
+
World();
~World();
diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp
index 0dd6a3d5e7..43a7af4bfd 100644
--- a/scene/resources/world_2d.cpp
+++ b/scene/resources/world_2d.cpp
@@ -352,8 +352,17 @@ void World2D::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_canvas"),&World2D::get_canvas);
ObjectTypeDB::bind_method(_MD("get_space"),&World2D::get_space);
ObjectTypeDB::bind_method(_MD("get_sound_space"),&World2D::get_sound_space);
+
+ ObjectTypeDB::bind_method(_MD("get_direct_space_state:Physics2DDirectSpaceState"),&World2D::get_direct_space_state);
+
+}
+
+Physics2DDirectSpaceState *World2D::get_direct_space_state() {
+
+ return Physics2DServer::get_singleton()->space_get_direct_state(space);
}
+
World2D::World2D() {
canvas = VisualServer::get_singleton()->canvas_create();
diff --git a/scene/resources/world_2d.h b/scene/resources/world_2d.h
index 3feb23495d..865ec28fe9 100644
--- a/scene/resources/world_2d.h
+++ b/scene/resources/world_2d.h
@@ -30,7 +30,7 @@
#define WORLD_2D_H
#include "resource.h"
-
+#include "servers/physics_2d_server.h"
class SpatialIndexer2D;
class VisibilityNotifier2D;
@@ -68,6 +68,8 @@ public:
RID get_space();
RID get_sound_space();
+ Physics2DDirectSpaceState *get_direct_space_state();
+
World2D();
~World2D();
};
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index c30ff0044e..d4159f0946 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -64,6 +64,9 @@ SceneStringNames::SceneStringNames() {
body_exit_shape = StaticCString::create("body_exit_shape");
body_exit = StaticCString::create("body_exit");
+ area_enter_shape = StaticCString::create("area_enter_shape");
+ area_exit_shape = StaticCString::create("area_exit_shape");
+
idle=StaticCString::create("idle");
iteration=StaticCString::create("iteration");
@@ -103,6 +106,9 @@ SceneStringNames::SceneStringNames() {
_body_enter_tree = StaticCString::create("_body_enter_tree");
_body_exit_tree = StaticCString::create("_body_exit_tree");
+ _area_enter_tree = StaticCString::create("_area_enter_tree");
+ _area_exit_tree = StaticCString::create("_area_exit_tree");
+
_input_event=StaticCString::create("_input_event");
changed=StaticCString::create("changed");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 184cbe347b..aa29ef57dc 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -83,6 +83,10 @@ public:
StringName body_exit_shape;
StringName body_exit;
+ StringName area_enter_shape;
+ StringName area_exit_shape;
+
+
StringName _get_gizmo_geometry;
StringName _can_gizmo_scale;
@@ -124,6 +128,9 @@ public:
StringName _body_enter_tree;
StringName _body_exit_tree;
+ StringName _area_enter_tree;
+ StringName _area_exit_tree;
+
StringName changed;
StringName _shader_changed;
diff --git a/servers/physics/shape_sw.h b/servers/physics/shape_sw.h
index cdb21556b8..bcf8fbdc8d 100644
--- a/servers/physics/shape_sw.h
+++ b/servers/physics/shape_sw.h
@@ -438,7 +438,7 @@ struct MotionShapeSW : public ShapeSW {
}
return support;
}
- virtual void get_supports(const Vector3& p_normal,int p_max,Vector3 *r_supports,int & r_amount) const {}
+ virtual void get_supports(const Vector3& p_normal,int p_max,Vector3 *r_supports,int & r_amount) const { r_amount=0; }
bool intersect_segment(const Vector3& p_begin,const Vector3& p_end,Vector3 &r_result, Vector3 &r_normal) const { return false; }
Vector3 get_moment_of_inertia(float p_mass) const { return Vector3(); }
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index 4e8b60b86b..3fc34889f2 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -77,7 +77,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3& p_from, const Vecto
if (!_match_object_type_query(space->intersection_query_results[i],p_layer_mask,p_object_type_mask))
continue;
- if (!(static_cast<AreaSW*>(space->intersection_query_results[i])->is_ray_pickable()))
+ if (!(static_cast<CollisionObjectSW*>(space->intersection_query_results[i])->is_ray_pickable()))
continue;
if (p_exclude.has( space->intersection_query_results[i]->get_self()))
diff --git a/servers/physics_2d/area_2d_sw.cpp b/servers/physics_2d/area_2d_sw.cpp
index 2e911288ae..65f3b80dd3 100644
--- a/servers/physics_2d/area_2d_sw.cpp
+++ b/servers/physics_2d/area_2d_sw.cpp
@@ -31,6 +31,7 @@
#include "body_2d_sw.h"
Area2DSW::BodyKey::BodyKey(Body2DSW *p_body, uint32_t p_body_shape,uint32_t p_area_shape) { rid=p_body->get_self(); instance_id=p_body->get_instance_id(); body_shape=p_body_shape; area_shape=p_area_shape; }
+Area2DSW::BodyKey::BodyKey(Area2DSW *p_body, uint32_t p_body_shape,uint32_t p_area_shape) { rid=p_body->get_self(); instance_id=p_body->get_instance_id(); body_shape=p_body_shape; area_shape=p_area_shape; }
void Area2DSW::_shapes_changed() {
@@ -57,6 +58,7 @@ void Area2DSW::set_space(Space2DSW *p_space) {
}
monitored_bodies.clear();
+ monitored_areas.clear();
_set_space(p_space);
}
@@ -76,11 +78,31 @@ void Area2DSW::set_monitor_callback(ObjectID p_id, const StringName& p_method) {
monitor_callback_method=p_method;
monitored_bodies.clear();
+ monitored_areas.clear();
_shape_changed();
}
+void Area2DSW::set_area_monitor_callback(ObjectID p_id, const StringName& p_method) {
+
+
+ if (p_id==area_monitor_callback_id) {
+ area_monitor_callback_method=p_method;
+ return;
+ }
+
+ _unregister_shapes();
+
+ area_monitor_callback_id=p_id;
+ area_monitor_callback_method=p_method;
+
+ monitored_bodies.clear();
+ monitored_areas.clear();
+
+ _shape_changed();
+
+}
void Area2DSW::set_space_override_mode(Physics2DServer::AreaSpaceOverrideMode p_mode) {
@@ -134,6 +156,15 @@ void Area2DSW::_queue_monitor_update() {
}
+void Area2DSW::set_monitorable(bool p_monitorable) {
+
+ if (monitorable==p_monitorable)
+ return;
+
+ monitorable=p_monitorable;
+ _set_static(!monitorable);
+}
+
void Area2DSW::call_queries() {
if (monitor_callback_id && !monitored_bodies.empty()) {
@@ -170,13 +201,49 @@ void Area2DSW::call_queries() {
monitored_bodies.clear();
+ if (area_monitor_callback_id && !monitored_areas.empty()) {
+
+
+ Variant res[5];
+ Variant *resptr[5];
+ for(int i=0;i<5;i++)
+ resptr[i]=&res[i];
+
+ Object *obj = ObjectDB::get_instance(area_monitor_callback_id);
+ if (!obj) {
+ monitored_areas.clear();
+ area_monitor_callback_id=0;
+ return;
+ }
+
+
+
+ for (Map<BodyKey,BodyState>::Element *E=monitored_areas.front();E;E=E->next()) {
+
+ if (E->get().state==0)
+ continue; //nothing happened
+
+ res[0]=E->get().state>0 ? Physics2DServer::AREA_BODY_ADDED : Physics2DServer::AREA_BODY_REMOVED;
+ res[1]=E->key().rid;
+ res[2]=E->key().instance_id;
+ res[3]=E->key().body_shape;
+ res[4]=E->key().area_shape;
+
+
+ Variant::CallError ce;
+ obj->call(area_monitor_callback_method,(const Variant**)resptr,5,ce);
+ }
+ }
+
+ monitored_areas.clear();
+
//get_space()->area_remove_from_monitor_query_list(&monitor_query_list);
}
Area2DSW::Area2DSW() : CollisionObject2DSW(TYPE_AREA), monitor_query_list(this), moved_list(this) {
- _set_static(true); //areas are never active
+ _set_static(true); //areas are not active by default
space_override_mode=Physics2DServer::AREA_SPACE_OVERRIDE_DISABLED;
gravity=9.80665;
gravity_vector=Vector2(0,-1);
@@ -187,6 +254,8 @@ Area2DSW::Area2DSW() : CollisionObject2DSW(TYPE_AREA), monitor_query_list(this),
linear_damp=0.1;
priority=0;
monitor_callback_id=0;
+ area_monitor_callback_id=0;
+ monitorable=false;
}
diff --git a/servers/physics_2d/area_2d_sw.h b/servers/physics_2d/area_2d_sw.h
index d94b2f9ccf..26b7b2516c 100644
--- a/servers/physics_2d/area_2d_sw.h
+++ b/servers/physics_2d/area_2d_sw.h
@@ -50,10 +50,14 @@ class Area2DSW : public CollisionObject2DSW{
float linear_damp;
float angular_damp;
int priority;
+ bool monitorable;
ObjectID monitor_callback_id;
StringName monitor_callback_method;
+ ObjectID area_monitor_callback_id;
+ StringName area_monitor_callback_method;
+
SelfList<Area2DSW> monitor_query_list;
SelfList<Area2DSW> moved_list;
@@ -80,6 +84,7 @@ class Area2DSW : public CollisionObject2DSW{
_FORCE_INLINE_ BodyKey() {}
BodyKey(Body2DSW *p_body, uint32_t p_body_shape,uint32_t p_area_shape);
+ BodyKey(Area2DSW *p_body, uint32_t p_body_shape,uint32_t p_area_shape);
};
struct BodyState {
@@ -91,6 +96,7 @@ class Area2DSW : public CollisionObject2DSW{
};
Map<BodyKey,BodyState> monitored_bodies;
+ Map<BodyKey,BodyState> monitored_areas;
//virtual void shape_changed_notify(Shape2DSW *p_shape);
//virtual void shape_deleted_notify(Shape2DSW *p_shape);
@@ -108,9 +114,16 @@ public:
void set_monitor_callback(ObjectID p_id, const StringName& p_method);
_FORCE_INLINE_ bool has_monitor_callback() const { return monitor_callback_id; }
+ void set_area_monitor_callback(ObjectID p_id, const StringName& p_method);
+ _FORCE_INLINE_ bool has_area_monitor_callback() const { return area_monitor_callback_id; }
+
+
_FORCE_INLINE_ void add_body_to_query(Body2DSW *p_body, uint32_t p_body_shape,uint32_t p_area_shape);
_FORCE_INLINE_ void remove_body_from_query(Body2DSW *p_body, uint32_t p_body_shape,uint32_t p_area_shape);
+ _FORCE_INLINE_ void add_area_to_query(Area2DSW *p_area, uint32_t p_area_shape,uint32_t p_self_shape);
+ _FORCE_INLINE_ void remove_area_from_query(Area2DSW *p_area, uint32_t p_area_shape,uint32_t p_self_shape);
+
void set_param(Physics2DServer::AreaParameter p_param, const Variant& p_value);
Variant get_param(Physics2DServer::AreaParameter p_param) const;
@@ -142,6 +155,9 @@ public:
_FORCE_INLINE_ void remove_constraint( Constraint2DSW* p_constraint) { constraints.erase(p_constraint); }
_FORCE_INLINE_ const Set<Constraint2DSW*>& get_constraints() const { return constraints; }
+ void set_monitorable(bool p_monitorable);
+ _FORCE_INLINE_ bool is_monitorable() const { return monitorable; }
+
void set_transform(const Matrix32& p_transform);
void set_space(Space2DSW *p_space);
@@ -168,6 +184,24 @@ void Area2DSW::remove_body_from_query(Body2DSW *p_body, uint32_t p_body_shape,ui
_queue_monitor_update();
}
+void Area2DSW::add_area_to_query(Area2DSW *p_area, uint32_t p_area_shape,uint32_t p_self_shape) {
+
+
+ BodyKey bk(p_area,p_area_shape,p_self_shape);
+ monitored_areas[bk].inc();
+ if (!monitor_query_list.in_list())
+ _queue_monitor_update();
+
+
+}
+void Area2DSW::remove_area_from_query(Area2DSW *p_area, uint32_t p_area_shape,uint32_t p_self_shape) {
+
+
+ BodyKey bk(p_area,p_area_shape,p_self_shape);
+ monitored_areas[bk].dec();
+ if (!monitor_query_list.in_list())
+ _queue_monitor_update();
+}
diff --git a/servers/physics_2d/area_pair_2d_sw.cpp b/servers/physics_2d/area_pair_2d_sw.cpp
index 1c7f73db5e..ed2e34c972 100644
--- a/servers/physics_2d/area_pair_2d_sw.cpp
+++ b/servers/physics_2d/area_pair_2d_sw.cpp
@@ -94,3 +94,72 @@ AreaPair2DSW::~AreaPair2DSW() {
body->remove_constraint(this);
area->remove_constraint(this);
}
+
+
+//////////////////////////////////
+
+
+
+bool Area2Pair2DSW::setup(float p_step) {
+
+ bool result = CollisionSolver2DSW::solve(area_a->get_shape(shape_a),area_a->get_transform() * area_a->get_shape_transform(shape_a),Vector2(),area_b->get_shape(shape_b),area_b->get_transform() * area_b->get_shape_transform(shape_b),Vector2(),NULL,this);
+
+ if (result!=colliding) {
+
+ if (result) {
+
+ if (area_b->has_area_monitor_callback() && area_a->is_monitorable())
+ area_b->add_area_to_query(area_a,shape_a,shape_b);
+
+ if (area_a->has_area_monitor_callback() && area_b->is_monitorable())
+ area_a->add_area_to_query(area_b,shape_b,shape_a);
+
+ } else {
+
+ if (area_b->has_area_monitor_callback() && area_a->is_monitorable())
+ area_b->remove_area_from_query(area_a,shape_a,shape_b);
+
+ if (area_a->has_area_monitor_callback() && area_b->is_monitorable())
+ area_a->remove_area_from_query(area_b,shape_b,shape_a);
+ }
+
+ colliding=result;
+
+ }
+
+ return false; //never do any post solving
+}
+
+void Area2Pair2DSW::solve(float p_step) {
+
+
+}
+
+
+Area2Pair2DSW::Area2Pair2DSW(Area2DSW *p_area_a,int p_shape_a, Area2DSW *p_area_b,int p_shape_b) {
+
+
+ area_a=p_area_a;
+ area_b=p_area_b;
+ shape_a=p_shape_a;
+ shape_b=p_shape_b;
+ colliding=false;
+ area_a->add_constraint(this);
+ area_b->add_constraint(this);
+
+}
+
+Area2Pair2DSW::~Area2Pair2DSW() {
+
+ if (colliding) {
+
+ if (area_b->has_area_monitor_callback() && area_a->is_monitorable())
+ area_b->remove_area_from_query(area_a,shape_a,shape_b);
+
+ if (area_a->has_area_monitor_callback() && area_b->is_monitorable())
+ area_a->remove_area_from_query(area_b,shape_b,shape_a);
+ }
+
+ area_a->remove_constraint(this);
+ area_b->remove_constraint(this);
+}
diff --git a/servers/physics_2d/area_pair_2d_sw.h b/servers/physics_2d/area_pair_2d_sw.h
index 5dad8c7a12..575490b109 100644
--- a/servers/physics_2d/area_pair_2d_sw.h
+++ b/servers/physics_2d/area_pair_2d_sw.h
@@ -49,5 +49,23 @@ public:
~AreaPair2DSW();
};
+
+class Area2Pair2DSW : public Constraint2DSW {
+
+ Area2DSW *area_a;
+ Area2DSW *area_b;
+ int shape_a;
+ int shape_b;
+ bool colliding;
+public:
+
+ bool setup(float p_step);
+ void solve(float p_step);
+
+ Area2Pair2DSW(Area2DSW *p_area_a,int p_shape_a, Area2DSW *p_area_b,int p_shape_b);
+ ~Area2Pair2DSW();
+};
+
+
#endif // AREA_PAIR_2D_SW_H
diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp
index d0443f8110..eefc598b39 100644
--- a/servers/physics_2d/collision_object_2d_sw.cpp
+++ b/servers/physics_2d/collision_object_2d_sw.cpp
@@ -228,4 +228,5 @@ CollisionObject2DSW::CollisionObject2DSW(Type p_type) {
instance_id=0;
user_mask=0;
layer_mask=1;
+ pickable=true;
}
diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h
index 00ad361245..0c91237876 100644
--- a/servers/physics_2d/collision_object_2d_sw.h
+++ b/servers/physics_2d/collision_object_2d_sw.h
@@ -47,6 +47,7 @@ private:
Type type;
RID self;
ObjectID instance_id;
+ bool pickable;
struct Shape {
@@ -129,6 +130,9 @@ public:
_FORCE_INLINE_ bool is_static() const { return _static; }
+ void set_pickable(bool p_pickable) { pickable=p_pickable; }
+ _FORCE_INLINE_ bool is_pickable() const { return pickable; }
+
virtual ~CollisionObject2DSW() {}
};
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index be49955055..883acd0200 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -463,6 +463,24 @@ Matrix32 Physics2DServerSW::area_get_transform(RID p_area) const {
return area->get_transform();
};
+void Physics2DServerSW::area_set_pickable(RID p_area,bool p_pickable) {
+
+ Area2DSW *area = area_owner.get(p_area);
+ ERR_FAIL_COND(!area);
+ area->set_pickable(p_pickable);
+
+}
+
+void Physics2DServerSW::area_set_monitorable(RID p_area,bool p_monitorable) {
+
+ Area2DSW *area = area_owner.get(p_area);
+ ERR_FAIL_COND(!area);
+
+ area->set_monitorable(p_monitorable);
+
+}
+
+
void Physics2DServerSW::area_set_monitor_callback(RID p_area,Object *p_receiver,const StringName& p_method) {
Area2DSW *area = area_owner.get(p_area);
@@ -473,6 +491,14 @@ void Physics2DServerSW::area_set_monitor_callback(RID p_area,Object *p_receiver,
}
+void Physics2DServerSW::area_set_area_monitor_callback(RID p_area,Object *p_receiver,const StringName& p_method) {
+
+
+ Area2DSW *area = area_owner.get(p_area);
+ ERR_FAIL_COND(!area);
+
+ area->set_area_monitor_callback(p_receiver?p_receiver->get_instance_ID():0,p_method);
+}
/* BODY API */
@@ -925,6 +951,13 @@ bool Physics2DServerSW::body_collide_shape(RID p_body, int p_body_shape, RID p_s
}
+void Physics2DServerSW::body_set_pickable(RID p_body,bool p_pickable) {
+
+ Body2DSW *body = body_owner.get(p_body);
+ ERR_FAIL_COND(!body);
+ body->set_pickable(p_pickable);
+
+}
/* JOINT API */
diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h
index e9c499aaff..58fc4eeb33 100644
--- a/servers/physics_2d/physics_2d_server_sw.h
+++ b/servers/physics_2d/physics_2d_server_sw.h
@@ -133,8 +133,12 @@ public:
virtual Variant area_get_param(RID p_parea,AreaParameter p_param) const;
virtual Matrix32 area_get_transform(RID p_area) const;
+ virtual void area_set_monitorable(RID p_area,bool p_monitorable);
virtual void area_set_monitor_callback(RID p_area,Object *p_receiver,const StringName& p_method);
+ virtual void area_set_area_monitor_callback(RID p_area,Object *p_receiver,const StringName& p_method);
+
+ virtual void area_set_pickable(RID p_area,bool p_pickable);
/* BODY API */
@@ -217,6 +221,8 @@ public:
virtual void body_set_force_integration_callback(RID p_body,Object *p_receiver,const StringName& p_method,const Variant& p_udata=Variant());
virtual bool body_collide_shape(RID p_body, int p_body_shape,RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count);
+ virtual void body_set_pickable(RID p_body,bool p_pickable);
+
/* JOINT API */
virtual void joint_set_param(RID p_joint, JointParam p_param, real_t p_value);
diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp
index ed63870a12..9a4b52d563 100644
--- a/servers/physics_2d/shape_2d_sw.cpp
+++ b/servers/physics_2d/shape_2d_sw.cpp
@@ -106,6 +106,11 @@ void LineShape2DSW::get_supports(const Vector2& p_normal,Vector2 *r_supports,int
r_amount=0;
}
+bool LineShape2DSW::contains_point(const Vector2& p_point) const {
+
+ return normal.dot(p_point) < d;
+}
+
bool LineShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const {
Vector2 segment= p_begin - p_end;
@@ -175,6 +180,11 @@ void RayShape2DSW::get_supports(const Vector2& p_normal,Vector2 *r_supports,int
}
+bool RayShape2DSW::contains_point(const Vector2& p_point) const {
+
+ return false;
+}
+
bool RayShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const {
return false; //rays can't be intersected
@@ -223,6 +233,11 @@ void SegmentShape2DSW::get_supports(const Vector2& p_normal,Vector2 *r_supports,
}
+bool SegmentShape2DSW::contains_point(const Vector2& p_point) const {
+
+ return false;
+}
+
bool SegmentShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const {
if (!Geometry::segment_intersects_segment_2d(p_begin,p_end,a,b,&r_point))
@@ -288,6 +303,13 @@ void CircleShape2DSW::get_supports(const Vector2& p_normal,Vector2 *r_supports,i
}
+
+bool CircleShape2DSW::contains_point(const Vector2& p_point) const {
+
+ return p_point.length_squared() < radius*radius;
+}
+
+
bool CircleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const {
@@ -375,6 +397,11 @@ void RectangleShape2DSW::get_supports(const Vector2& p_normal,Vector2 *r_support
}
+bool RectangleShape2DSW::contains_point(const Vector2& p_point) const {
+
+ return Math::abs(p_point.x)<half_extents.x && Math::abs(p_point.y)<half_extents.y;
+}
+
bool RectangleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const {
@@ -439,6 +466,17 @@ void CapsuleShape2DSW::get_supports(const Vector2& p_normal,Vector2 *r_supports,
}
}
+bool CapsuleShape2DSW::contains_point(const Vector2& p_point) const {
+
+ Vector2 p = p_point;
+ p.y=Math::abs(p.y);
+ p.y-=height*0.5;
+ if (p.y<0)
+ p.y=0;
+
+ return p.length_squared() < radius*radius;
+}
+
bool CapsuleShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const {
@@ -574,6 +612,25 @@ void ConvexPolygonShape2DSW::get_supports(const Vector2& p_normal,Vector2 *r_sup
}
+
+bool ConvexPolygonShape2DSW::contains_point(const Vector2& p_point) const {
+
+ bool out=false;
+ bool in=false;
+
+ for(int i=0;i<point_count;i++) {
+
+ float d = points[i].normal.dot(p_point) - points[i].normal.dot(points[i].pos);
+ if (d>0)
+ out=true;
+ else
+ in=true;
+ }
+
+ return (in && !out) || (!in && out);
+}
+
+
bool ConvexPolygonShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const {
Vector2 n = (p_end-p_begin).normalized();
@@ -734,6 +791,12 @@ void ConcavePolygonShape2DSW::get_supports(const Vector2& p_normal,Vector2 *r_su
}
+bool ConcavePolygonShape2DSW::contains_point(const Vector2& p_point) const {
+
+ return false; //sorry
+}
+
+
bool ConcavePolygonShape2DSW::intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const{
uint32_t* stack = (uint32_t*)alloca(sizeof(int)*bvh_depth);
diff --git a/servers/physics_2d/shape_2d_sw.h b/servers/physics_2d/shape_2d_sw.h
index 931491efd5..05ea5b21cd 100644
--- a/servers/physics_2d/shape_2d_sw.h
+++ b/servers/physics_2d/shape_2d_sw.h
@@ -78,6 +78,8 @@ public:
virtual bool is_concave() const { return false; }
+ virtual bool contains_point(const Vector2& p_point) const=0;
+
virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const=0;
virtual void project_range_castv(const Vector2& p_cast, const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const=0;
virtual Vector2 get_support(const Vector2& p_normal) const;
@@ -171,6 +173,7 @@ public:
virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); }
virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const;
+ virtual bool contains_point(const Vector2& p_point) const;
virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const;
virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const;
@@ -213,6 +216,7 @@ public:
virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); }
virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const;
+ virtual bool contains_point(const Vector2& p_point) const;
virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const;
virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const;
@@ -260,6 +264,7 @@ public:
virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); }
virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const;
+ virtual bool contains_point(const Vector2& p_point) const;
virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const;
virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const;
@@ -297,6 +302,7 @@ public:
virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); }
virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const;
+ virtual bool contains_point(const Vector2& p_point) const;
virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const;
virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const;
@@ -336,6 +342,7 @@ public:
virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); }
virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const;
+ virtual bool contains_point(const Vector2& p_point) const;
virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const;
virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const;
@@ -423,6 +430,7 @@ public:
virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); }
virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const;
+ virtual bool contains_point(const Vector2& p_point) const;
virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const;
virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const;
@@ -485,6 +493,7 @@ public:
virtual void project_rangev(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { project_range(p_normal,p_transform,r_min,r_max); }
virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const;
+ virtual bool contains_point(const Vector2& p_point) const;
virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const;
virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const;
@@ -572,6 +581,7 @@ public:
virtual void project_range(const Vector2& p_normal, const Matrix32& p_transform, real_t &r_min, real_t &r_max) const { /*project_range(p_normal,p_transform,r_min,r_max);*/ }
virtual void get_supports(const Vector2& p_normal,Vector2 *r_supports,int & r_amount) const;
+ virtual bool contains_point(const Vector2& p_point) const;
virtual bool intersect_segment(const Vector2& p_begin,const Vector2& p_end,Vector2 &r_point, Vector2 &r_normal) const;
virtual real_t get_moment_of_inertia(float p_mass,const Vector2& p_scale) const { return 0; }
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index f2ed74ffbf..5aaf9a7613 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -45,6 +45,57 @@ _FORCE_INLINE_ static bool _match_object_type_query(CollisionObject2DSW *p_objec
}
+
+int Physics2DDirectSpaceStateSW::intersect_point(const Vector2& p_point,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) {
+
+ if (p_result_max<=0)
+ return 0;
+
+ Rect2 aabb;
+ aabb.pos=p_point-Vector2(0.00001,0.00001);
+ aabb.size=Vector2(0.00002,0.00002);
+
+ int amount = space->broadphase->cull_aabb(aabb,space->intersection_query_results,Space2DSW::INTERSECTION_QUERY_MAX,space->intersection_query_subindex_results);
+
+ int cc=0;
+
+ for(int i=0;i<amount;i++) {
+
+ if (!_match_object_type_query(space->intersection_query_results[i],p_layer_mask,p_object_type_mask))
+ continue;
+
+ if (p_exclude.has( space->intersection_query_results[i]->get_self()))
+ continue;
+
+ const CollisionObject2DSW *col_obj=space->intersection_query_results[i];
+
+ if (!col_obj->is_pickable())
+ continue;
+
+ int shape_idx=space->intersection_query_subindex_results[i];
+
+ Shape2DSW * shape = col_obj->get_shape(shape_idx);
+
+ Vector2 local_point = (col_obj->get_transform() * col_obj->get_shape_transform(shape_idx)).affine_inverse().xform(p_point);
+
+ if (!shape->contains_point(local_point))
+ continue;
+
+ r_results[cc].collider_id=col_obj->get_instance_id();
+ if (r_results[cc].collider_id!=0)
+ r_results[cc].collider=ObjectDB::get_instance(r_results[cc].collider_id);
+ r_results[cc].rid=col_obj->get_self();
+ r_results[cc].shape=shape_idx;
+ r_results[cc].metadata=col_obj->get_shape_metadata(shape_idx);
+
+ cc++;
+ }
+
+ return cc;
+
+
+}
+
bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2& p_from, const Vector2& p_to,RayResult &r_result,const Set<RID>& p_exclude,uint32_t p_layer_mask,uint32_t p_object_type_mask) {
@@ -527,13 +578,20 @@ void* Space2DSW::_broadphase_pair(CollisionObject2DSW *A,int p_subindex_A,Collis
if (type_A==CollisionObject2DSW::TYPE_AREA) {
- ERR_FAIL_COND_V(type_B!=CollisionObject2DSW::TYPE_BODY,NULL);
Area2DSW *area=static_cast<Area2DSW*>(A);
- Body2DSW *body=static_cast<Body2DSW*>(B);
+ if (type_B==CollisionObject2DSW::TYPE_AREA) {
+
+ Area2DSW *area_b=static_cast<Area2DSW*>(B);
+ Area2Pair2DSW *area2_pair = memnew(Area2Pair2DSW(area_b,p_subindex_B,area,p_subindex_A) );
+ return area2_pair;
+ } else {
+
+ Body2DSW *body=static_cast<Body2DSW*>(B);
+ AreaPair2DSW *area_pair = memnew(AreaPair2DSW(body,p_subindex_B,area,p_subindex_A) );
+ return area_pair;
+ }
- AreaPair2DSW *area_pair = memnew(AreaPair2DSW(body,p_subindex_B,area,p_subindex_A) );
- return area_pair;
} else {
diff --git a/servers/physics_2d/space_2d_sw.h b/servers/physics_2d/space_2d_sw.h
index 7977b19063..05b55fe807 100644
--- a/servers/physics_2d/space_2d_sw.h
+++ b/servers/physics_2d/space_2d_sw.h
@@ -46,6 +46,7 @@ public:
Space2DSW *space;
+ virtual int intersect_point(const Vector2& p_point,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
virtual bool intersect_ray(const Vector2& p_from, const Vector2& p_to,RayResult &r_result,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
virtual int intersect_shape(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
virtual bool cast_motion(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,float &p_closest_safe,float &p_closest_unsafe, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp
index 07389bc912..098f890222 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_2d_server.cpp
@@ -289,6 +289,36 @@ Array Physics2DDirectSpaceState::_cast_motion(const Ref<Physics2DShapeQueryParam
return ret;
}
+
+Array Physics2DDirectSpaceState::_intersect_point(const Vector2& p_point,int p_max_results,const Vector<RID>& p_exclude,uint32_t p_layers,uint32_t p_object_type_mask) {
+
+ Set<RID> exclude;
+ for(int i=0;i<p_exclude.size();i++)
+ exclude.insert(p_exclude[i]);
+
+ Vector<ShapeResult> ret;
+ ret.resize(p_max_results);
+
+ int rc = intersect_point(p_point,ret.ptr(),ret.size(),exclude,p_layers,p_object_type_mask);
+ if (rc==0)
+ return Array();
+
+ Array r;
+ r.resize(rc);
+ for(int i=0;i<rc;i++) {
+
+ Dictionary d;
+ d["rid"]=ret[i].rid;
+ d["collider_id"]=ret[i].collider_id;
+ d["collider"]=ret[i].collider;
+ d["shape"]=ret[i].shape;
+ d["metadata"]=ret[i].metadata;
+ r[i]=d;
+ }
+ return r;
+
+}
+
Array Physics2DDirectSpaceState::_collide_shape(const Ref<Physics2DShapeQueryParameters> &psq, int p_max_results){
Vector<Vector2> ret;
@@ -336,6 +366,7 @@ Physics2DDirectSpaceState::Physics2DDirectSpaceState() {
void Physics2DDirectSpaceState::_bind_methods() {
+ ObjectTypeDB::bind_method(_MD("intersect_point","point","max_results","exclude","layer_mask","type_mask"),&Physics2DDirectSpaceState::_intersect_point,DEFVAL(32),DEFVAL(Array()),DEFVAL(0x7FFFFFFF),DEFVAL(TYPE_MASK_COLLISION));
ObjectTypeDB::bind_method(_MD("intersect_ray:Dictionary","from","to","exclude","layer_mask","type_mask"),&Physics2DDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0x7FFFFFFF),DEFVAL(TYPE_MASK_COLLISION));
ObjectTypeDB::bind_method(_MD("intersect_shape","shape:Physics2DShapeQueryParameters","max_results"),&Physics2DDirectSpaceState::_intersect_shape,DEFVAL(32));
ObjectTypeDB::bind_method(_MD("cast_motion","shape:Physics2DShapeQueryParameters"),&Physics2DDirectSpaceState::_cast_motion);
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h
index 765cebf45f..01670ace7e 100644
--- a/servers/physics_2d_server.h
+++ b/servers/physics_2d_server.h
@@ -137,6 +137,7 @@ class Physics2DDirectSpaceState : public Object {
Dictionary _intersect_ray(const Vector2& p_from, const Vector2& p_to,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_layers=0,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
+ Array _intersect_point(const Vector2& p_point,int p_max_results=32,const Vector<RID>& p_exclude=Vector<RID>(),uint32_t p_layers=0,uint32_t p_object_type_mask=TYPE_MASK_COLLISION);
Array _intersect_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query,int p_max_results=32);
Array _cast_motion(const Ref<Physics2DShapeQueryParameters> &p_shape_query);
Array _collide_shape(const Ref<Physics2DShapeQueryParameters> &p_shape_query,int p_max_results=32);
@@ -181,6 +182,8 @@ public:
};
+ virtual int intersect_point(const Vector2& p_point,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0;
+
virtual int intersect_shape(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,ShapeResult *r_results,int p_result_max,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0;
virtual bool cast_motion(const RID& p_shape, const Matrix32& p_xform,const Vector2& p_motion,float p_margin,float &p_closest_safe,float &p_closest_unsafe, const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0;
@@ -341,7 +344,11 @@ public:
virtual Variant area_get_param(RID p_parea,AreaParameter p_param) const=0;
virtual Matrix32 area_get_transform(RID p_area) const=0;
+ virtual void area_set_monitorable(RID p_area,bool p_monitorable)=0;
+ virtual void area_set_pickable(RID p_area,bool p_pickable)=0;
+
virtual void area_set_monitor_callback(RID p_area,Object *p_receiver,const StringName& p_method)=0;
+ virtual void area_set_area_monitor_callback(RID p_area,Object *p_receiver,const StringName& p_method)=0;
/* BODY API */
@@ -459,6 +466,8 @@ public:
virtual bool body_collide_shape(RID p_body, int p_body_shape,RID p_shape, const Matrix32& p_shape_xform,const Vector2& p_motion,Vector2 *r_results,int p_result_max,int &r_result_count)=0;
+ virtual void body_set_pickable(RID p_body,bool p_pickable)=0;
+
/* JOINT API */
enum JointType {
diff --git a/servers/visual/rasterizer.cpp b/servers/visual/rasterizer.cpp
index c3dcd83a31..5088000022 100644
--- a/servers/visual/rasterizer.cpp
+++ b/servers/visual/rasterizer.cpp
@@ -91,7 +91,7 @@ RID Rasterizer::_create_shader(const FixedMaterialShaderKey& p_key) {
scode+="uniform float fmp_normal;\n";
scode+="uniform texture fmp_normal_tex;\n";
String uv_str;
- if ((p_key.texcoord_mask>>(VS::FIXED_MATERIAL_PARAM_NORMAL*2))&0x3==VS::FIXED_MATERIAL_TEXCOORD_SPHERE) {
+ if (((p_key.texcoord_mask>>(VS::FIXED_MATERIAL_PARAM_NORMAL*2))&0x3)==VS::FIXED_MATERIAL_TEXCOORD_SPHERE) {
uv_str="uv"; //sorry not supported
} else {
uv_str=_TEXUVSTR(VS::FIXED_MATERIAL_PARAM_NORMAL);
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 62ab8b3c56..ebc210fe3d 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -577,11 +577,13 @@ public:
Color color;
Matrix32 xform;
float height;
+ float scale;
int z_min;
int z_max;
int layer_min;
int layer_max;
int item_mask;
+ int item_shadow_mask;
bool subtract;
RID texture;
Vector2 texture_offset;
@@ -613,6 +615,8 @@ public:
layer_min=0;
layer_max=0;
item_mask=1;
+ scale=1.0;
+ item_shadow_mask=-1;
subtract=false;
texture_cache=NULL;
next_ptr=NULL;
@@ -765,6 +769,12 @@ public:
mutable Rect2 rect;
CanvasItem*next;
CanvasItemMaterial* material;
+ struct CopyBackBuffer {
+ Rect2 rect;
+ Rect2 screen_rect;
+ bool full;
+ };
+ CopyBackBuffer *copy_back_buffer;
float final_opacity;
@@ -773,6 +783,7 @@ public:
CanvasItem* final_clip_owner;
CanvasItem* material_owner;
ViewportRender *vp_render;
+ bool distance_field;
Rect2 global_rect_cache;
@@ -900,14 +911,15 @@ public:
}
void clear() { for (int i=0;i<commands.size();i++) memdelete( commands[i] ); commands.clear(); clip=false; rect_dirty=true; final_clip_owner=NULL; material_owner=NULL;}
- CanvasItem() { light_mask=1; vp_render=NULL; next=NULL; final_clip_owner=NULL; clip=false; final_opacity=1; blend_mode=VS::MATERIAL_BLEND_MODE_MIX; visible=true; rect_dirty=true; custom_rect=false; ontop=true; material_owner=NULL; material=NULL; }
- virtual ~CanvasItem() { clear(); }
+ CanvasItem() { light_mask=1; vp_render=NULL; next=NULL; final_clip_owner=NULL; clip=false; final_opacity=1; blend_mode=VS::MATERIAL_BLEND_MODE_MIX; visible=true; rect_dirty=true; custom_rect=false; ontop=true; material_owner=NULL; material=NULL; copy_back_buffer=NULL; distance_field=false; }
+ virtual ~CanvasItem() { clear(); if (copy_back_buffer) memdelete(copy_back_buffer); }
};
CanvasItemDrawViewportFunc draw_viewport_func;
+ virtual void begin_canvas_bg()=0;
virtual void canvas_begin()=0;
virtual void canvas_disable_blending()=0;
virtual void canvas_set_opacity(float p_opacity)=0;
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index f178c27ed0..af65a7a639 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -56,6 +56,7 @@ const char * ShaderLanguage::token_names[TK_MAX]={
"TYPE_VEC2",
"TYPE_VEC3",
"TYPE_VEC4",
+ "TYPE_MAT2",
"TYPE_MAT3",
"TYPE_MAT4",
"TYPE_TEXTURE",
@@ -403,9 +404,9 @@ ShaderLanguage::Token ShaderLanguage::read_token(const CharType* p_text,int p_le
{TK_TYPE_TEXTURE,"texture"},
{TK_TYPE_CUBEMAP,"cubemap"},
{TK_TYPE_COLOR,"color"},
- /*
+
{TK_TYPE_MAT2,"mat2"},
- {TK_TYPE_MAT3,"mat3"},
+ /*{TK_TYPE_MAT3,"mat3"},
{TK_TYPE_MAT4,"mat3"},*/
{TK_TYPE_MAT3,"mat3"},
{TK_TYPE_MAT4,"mat4"},
@@ -511,6 +512,7 @@ bool ShaderLanguage::is_token_datatype(TokenType p_type) {
(p_type==TK_TYPE_VEC3) ||
(p_type==TK_TYPE_VEC4) ||
(p_type==TK_TYPE_COLOR) ||
+ (p_type==TK_TYPE_MAT2) ||
(p_type==TK_TYPE_MAT3) ||
(p_type==TK_TYPE_MAT4) ||
(p_type==TK_TYPE_CUBEMAP) ||
@@ -529,6 +531,7 @@ ShaderLanguage::DataType ShaderLanguage::get_token_datatype(TokenType p_type) {
case TK_TYPE_VEC3: return TYPE_VEC3;
case TK_TYPE_VEC4: return TYPE_VEC4;
case TK_TYPE_COLOR: return TYPE_VEC4;
+ case TK_TYPE_MAT2: return TYPE_MAT2;
case TK_TYPE_MAT3: return TYPE_MAT3;
case TK_TYPE_MAT4: return TYPE_MAT4;
case TK_TYPE_TEXTURE: return TYPE_TEXTURE;
@@ -550,6 +553,7 @@ String ShaderLanguage::get_datatype_name(DataType p_type) {
case TYPE_VEC2: return "vec2";
case TYPE_VEC3: return "vec3";
case TYPE_VEC4: return "vec4";
+ case TYPE_MAT2: return "mat2";
case TYPE_MAT3: return "mat3";
case TYPE_MAT4: return "mat4";
case TYPE_TEXTURE: return "texture";
@@ -570,6 +574,7 @@ bool ShaderLanguage::is_token_nonvoid_datatype(TokenType p_type) {
(p_type==TK_TYPE_VEC3) ||
(p_type==TK_TYPE_VEC4) ||
(p_type==TK_TYPE_COLOR) ||
+ (p_type==TK_TYPE_MAT2) ||
(p_type==TK_TYPE_MAT3) ||
(p_type==TK_TYPE_MAT4) ||
(p_type==TK_TYPE_TEXTURE) ||
@@ -782,6 +787,7 @@ const ShaderLanguage::IntrinsicFuncDef ShaderLanguage::intrinsic_func_defs[]={
{"vec4",TYPE_VEC4,{TYPE_FLOAT,TYPE_VEC3,TYPE_VOID}},
{"vec4",TYPE_VEC4,{TYPE_VEC3,TYPE_FLOAT,TYPE_VOID}},
{"vec4",TYPE_VEC4,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}},
+ {"mat2",TYPE_MAT2,{TYPE_VEC2,TYPE_VEC2,TYPE_VOID}},
{"mat3",TYPE_MAT3,{TYPE_VEC3,TYPE_VEC3,TYPE_VEC3,TYPE_VOID}},
{"mat4",TYPE_MAT4,{TYPE_VEC4,TYPE_VEC4,TYPE_VEC4,TYPE_VEC4,TYPE_VOID}},
//intrinsics - trigonometry
@@ -918,6 +924,7 @@ const ShaderLanguage::OperatorDef ShaderLanguage::operator_defs[]={
{OP_ASSIGN,TYPE_VOID,{TYPE_VEC2,TYPE_VEC2}},
{OP_ASSIGN,TYPE_VOID,{TYPE_VEC3,TYPE_VEC3}},
{OP_ASSIGN,TYPE_VOID,{TYPE_VEC4,TYPE_VEC4}},
+ {OP_ASSIGN,TYPE_VOID,{TYPE_MAT2,TYPE_MAT2}},
{OP_ASSIGN,TYPE_VOID,{TYPE_MAT3,TYPE_MAT3}},
{OP_ASSIGN,TYPE_VOID,{TYPE_MAT4,TYPE_MAT4}},
{OP_ADD,TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT}},
@@ -933,6 +940,8 @@ const ShaderLanguage::OperatorDef ShaderLanguage::operator_defs[]={
{OP_MUL,TYPE_VEC2,{TYPE_VEC2,TYPE_FLOAT}},
{OP_MUL,TYPE_VEC2,{TYPE_FLOAT,TYPE_VEC2}},
{OP_MUL,TYPE_VEC2,{TYPE_VEC2,TYPE_MAT3}},
+ {OP_MUL,TYPE_VEC2,{TYPE_MAT2,TYPE_VEC2}},
+ {OP_MUL,TYPE_VEC2,{TYPE_VEC2,TYPE_MAT2}},
{OP_MUL,TYPE_VEC2,{TYPE_MAT3,TYPE_VEC2}},
{OP_MUL,TYPE_VEC2,{TYPE_VEC2,TYPE_MAT4}},
{OP_MUL,TYPE_VEC2,{TYPE_MAT4,TYPE_VEC2}},
@@ -947,6 +956,7 @@ const ShaderLanguage::OperatorDef ShaderLanguage::operator_defs[]={
{OP_MUL,TYPE_VEC4,{TYPE_FLOAT,TYPE_VEC4}},
{OP_MUL,TYPE_VEC4,{TYPE_MAT4,TYPE_VEC4}},
{OP_MUL,TYPE_VEC4,{TYPE_VEC4,TYPE_MAT4}},
+ {OP_MUL,TYPE_MAT2,{TYPE_MAT2,TYPE_MAT2}},
{OP_MUL,TYPE_MAT3,{TYPE_MAT3,TYPE_MAT3}},
{OP_MUL,TYPE_MAT4,{TYPE_MAT4,TYPE_MAT4}},
{OP_DIV,TYPE_FLOAT,{TYPE_FLOAT,TYPE_FLOAT}},
@@ -976,15 +986,15 @@ const ShaderLanguage::OperatorDef ShaderLanguage::operator_defs[]={
{OP_ASSIGN_MUL,TYPE_VOID,{TYPE_FLOAT,TYPE_FLOAT}},
{OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC2,TYPE_VEC2}},
{OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC2,TYPE_FLOAT}},
- {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT3,TYPE_VEC2}},
- {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT4,TYPE_VEC2}},
+ {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC2,TYPE_MAT2}},
+ {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT2,TYPE_MAT2}},
+ {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC3,TYPE_MAT3}},
{OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC3,TYPE_VEC3}},
{OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC3,TYPE_FLOAT}},
- {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT3,TYPE_VEC3}},
- {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT4,TYPE_VEC3}},
+ {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC3,TYPE_MAT4}},
{OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC4,TYPE_VEC4}},
{OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC4,TYPE_FLOAT}},
- {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT4,TYPE_VEC4}},
+ {OP_ASSIGN_MUL,TYPE_VOID,{TYPE_VEC4,TYPE_MAT4}},
{OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT3,TYPE_MAT3}},
{OP_ASSIGN_MUL,TYPE_VOID,{TYPE_MAT4,TYPE_MAT4}},
{OP_ASSIGN_DIV,TYPE_VOID,{TYPE_FLOAT,TYPE_FLOAT}},
@@ -1149,11 +1159,19 @@ const ShaderLanguage::BuiltinsDef ShaderLanguage::ci_fragment_builtins_defs[]={
const ShaderLanguage::BuiltinsDef ShaderLanguage::ci_light_builtins_defs[]={
- { "COLOR", TYPE_VEC4},
+ { "POSITION", TYPE_VEC4},
{ "NORMAL", TYPE_VEC3},
- { "LIGHT_DIR", TYPE_VEC2},
- { "LIGHT_DISTANCE", TYPE_FLOAT},
- { "LIGHT", TYPE_VEC3},
+ { "UV", TYPE_VEC2},
+ { "COLOR", TYPE_VEC4},
+ { "TEXTURE", TYPE_TEXTURE},
+ { "TEXTURE_PIXEL_SIZE", TYPE_VEC2},
+ { "VAR1", TYPE_VEC4},
+ { "VAR2", TYPE_VEC4},
+ { "SCREEN_UV", TYPE_VEC2},
+ { "LIGHT_VEC", TYPE_VEC2},
+ { "LIGHT_HEIGHT", TYPE_FLOAT},
+ { "LIGHT_COLOR", TYPE_VEC4},
+ { "LIGHT", TYPE_VEC4},
{ "POINT_COORD", TYPE_VEC2},
// { "SCREEN_POS", TYPE_VEC2},
// { "SCREEN_TEXEL_SIZE", TYPE_VEC2},
@@ -1558,6 +1576,7 @@ Error ShaderLanguage::parse_expression(Parser& parser,Node *p_parent,Node **r_ex
case TYPE_VEC2: name="vec2"; break;
case TYPE_VEC3: name="vec3"; break;
case TYPE_VEC4: name="vec4"; break;
+ case TYPE_MAT2: name="mat2"; break;
case TYPE_MAT3: name="mat3"; break;
case TYPE_MAT4: name="mat4"; break;
default: ERR_FAIL_V(ERR_BUG);
@@ -1852,6 +1871,7 @@ Error ShaderLanguage::parse_expression(Parser& parser,Node *p_parent,Node **r_ex
}
} break;
+ case TYPE_MAT2: ok=(ident=="x" || ident=="y"); member_type=TYPE_VEC2; break;
case TYPE_MAT3: ok=(ident=="x" || ident=="y" || ident=="z" ); member_type=TYPE_VEC3; break;
case TYPE_MAT4: ok=(ident=="x" || ident=="y" || ident=="z" || ident=="w"); member_type=TYPE_VEC4; break;
default: {}
@@ -2238,6 +2258,7 @@ Error ShaderLanguage::parse_variable_declaration(Parser& parser,BlockNode *p_blo
case TYPE_VEC2: con->value=Vector2(); break;
case TYPE_VEC3: con->value=Vector3(); break;
case TYPE_VEC4: con->value=iscolor?Variant(Color()):Variant(Plane()); break;
+ case TYPE_MAT2: con->value=Matrix32(); break;
case TYPE_MAT3: con->value=Matrix3(); break;
case TYPE_MAT4: con->value=Transform(); break;
case TYPE_TEXTURE:
@@ -2620,12 +2641,20 @@ void ShaderLanguage::get_keyword_list(ShaderType p_type, List<String> *p_keyword
int idx=0;
+ p_keywords->push_back("uniform");
+ p_keywords->push_back("texture");
+ p_keywords->push_back("cubemap");
+ p_keywords->push_back("color");
+ p_keywords->push_back("if");
+ p_keywords->push_back("else");
+
while(intrinsic_func_defs[idx].name) {
p_keywords->push_back(intrinsic_func_defs[idx].name);
idx++;
}
+
switch(p_type) {
case SHADER_MATERIAL_VERTEX: {
idx=0;
diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h
index f79c219d85..7777c8bcf3 100644
--- a/servers/visual/shader_language.h
+++ b/servers/visual/shader_language.h
@@ -56,6 +56,7 @@ public:
TK_TYPE_VEC2,
TK_TYPE_VEC3,
TK_TYPE_VEC4,
+ TK_TYPE_MAT2,
TK_TYPE_MAT3,
TK_TYPE_MAT4,
TK_TYPE_TEXTURE,
@@ -118,6 +119,7 @@ public:
TYPE_VEC2,
TYPE_VEC3,
TYPE_VEC4,
+ TYPE_MAT2,
TYPE_MAT3,
TYPE_MAT4,
TYPE_TEXTURE,
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 3bcf0b8a3e..83bfbbc6c3 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -1693,6 +1693,17 @@ void VisualServerRaster::viewport_set_hide_canvas(RID p_viewport,bool p_hide) {
}
+void VisualServerRaster::viewport_set_disable_environment(RID p_viewport,bool p_disable) {
+
+ VS_CHANGED;
+
+ Viewport *viewport=NULL;
+ viewport = viewport_owner.get( p_viewport );
+ ERR_FAIL_COND(!viewport);
+ viewport->disable_environment=p_disable;
+
+}
+
void VisualServerRaster::viewport_attach_camera(RID p_viewport,RID p_camera) {
VS_CHANGED;
@@ -3400,6 +3411,14 @@ void VisualServerRaster::canvas_item_set_clip(RID p_item, bool p_clip) {
canvas_item->clip=p_clip;
}
+void VisualServerRaster::canvas_item_set_distance_field_mode(RID p_item, bool p_distance_field) {
+ VS_CHANGED;
+ CanvasItem *canvas_item = canvas_item_owner.get( p_item );
+ ERR_FAIL_COND(!canvas_item);
+
+ canvas_item->distance_field=p_distance_field;
+}
+
void VisualServerRaster::canvas_item_set_transform(RID p_item, const Matrix32& p_transform) {
@@ -3765,6 +3784,27 @@ void VisualServerRaster::canvas_item_set_z_as_relative_to_parent(RID p_item, boo
}
+void VisualServerRaster::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2& p_rect) {
+
+ VS_CHANGED;
+ CanvasItem *canvas_item = canvas_item_owner.get( p_item );
+ ERR_FAIL_COND(!canvas_item);
+ if (bool(canvas_item->copy_back_buffer!=NULL) !=p_enable) {
+ if (p_enable) {
+ canvas_item->copy_back_buffer = memnew( Rasterizer::CanvasItem::CopyBackBuffer );
+ } else {
+ memdelete(canvas_item->copy_back_buffer);
+ canvas_item->copy_back_buffer=NULL;
+ }
+ }
+
+ if (p_enable) {
+ canvas_item->copy_back_buffer->rect=p_rect;
+ canvas_item->copy_back_buffer->full=p_rect==Rect2();
+ }
+
+}
+
void VisualServerRaster::canvas_item_set_use_parent_material(RID p_item, bool p_enable) {
VS_CHANGED;
@@ -3899,6 +3939,15 @@ void VisualServerRaster::canvas_light_set_transform(RID p_light, const Matrix32&
clight->xform=p_transform;
}
+void VisualServerRaster::canvas_light_set_scale(RID p_light, float p_scale) {
+
+ Rasterizer::CanvasLight *clight = canvas_light_owner.get(p_light);
+ ERR_FAIL_COND(!clight);
+ clight->scale=p_scale;
+
+}
+
+
void VisualServerRaster::canvas_light_set_texture(RID p_light, RID p_texture){
Rasterizer::CanvasLight *clight = canvas_light_owner.get(p_light);
@@ -3954,6 +4003,15 @@ void VisualServerRaster::canvas_light_set_item_mask(RID p_light, int p_mask){
}
+void VisualServerRaster::canvas_light_set_item_shadow_mask(RID p_light, int p_mask){
+
+ Rasterizer::CanvasLight *clight = canvas_light_owner.get(p_light);
+ ERR_FAIL_COND(!clight);
+ clight->item_shadow_mask=p_mask;
+
+}
+
+
void VisualServerRaster::canvas_light_set_subtract_mode(RID p_light, bool p_enable) {
@@ -4559,6 +4617,13 @@ void VisualServerRaster::free( RID p_rid ) {
}
+ if (occluder->canvas.is_valid() && canvas_owner.owns(occluder->canvas)) {
+
+ Canvas *canvas = canvas_owner.get(occluder->canvas);
+ canvas->occluders.erase(occluder);
+
+ }
+
canvas_light_occluder_owner.free( p_rid );
memdelete(occluder);
@@ -6221,6 +6286,20 @@ void VisualServerRaster::_process_sampled_light(const Transform& p_camera,Instan
}
+void VisualServerRaster::_render_no_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario) {
+ RID environment;
+ if (p_scenario->environment.is_valid())
+ environment=p_scenario->environment;
+ else
+ environment=p_scenario->fallback_environment;
+
+ rasterizer->set_camera(Transform(),CameraMatrix());
+ rasterizer->begin_scene(p_viewport->viewport_data,environment,p_scenario->debug);
+ rasterizer->set_viewport(viewport_rect);
+ rasterizer->end_scene();
+}
+
+
void VisualServerRaster::_render_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario) {
@@ -6741,8 +6820,12 @@ void VisualServerRaster::_render_canvas_item(CanvasItem *p_canvas_item,const Mat
_render_canvas_item(child_items[i],xform,p_clip_rect,opacity,p_z,z_list,z_last_list,(CanvasItem*)ci->final_clip_owner,p_material_owner);
}
+ if (ci->copy_back_buffer) {
- if ((!ci->commands.empty() && p_clip_rect.intersects(global_rect)) || ci->vp_render) {
+ ci->copy_back_buffer->screen_rect = xform.xform(ci->copy_back_buffer->rect).clip(p_clip_rect);
+ }
+
+ if ((!ci->commands.empty() && p_clip_rect.intersects(global_rect)) || ci->vp_render || ci->copy_back_buffer) {
//something to draw?
ci->final_transform=xform;
ci->final_opacity=opacity * ci->self_opacity;
@@ -6839,6 +6922,23 @@ void VisualServerRaster::_render_canvas(Canvas *p_canvas,const Matrix32 &p_trans
}
+void VisualServerRaster::_draw_viewport_camera(Viewport *p_viewport,bool p_ignore_camera) {
+
+
+ Camera *camera=NULL;
+ if (camera_owner.owns( p_viewport->camera ))
+ camera=camera_owner.get( p_viewport->camera );
+ Scenario *scenario = scenario_owner.get( p_viewport->scenario );
+
+ _update_instances(); // check dirty instances before rendering
+
+ if (p_ignore_camera)
+ _render_no_camera(p_viewport, camera,scenario );
+ else
+ _render_camera(p_viewport, camera,scenario );
+
+}
+
void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ofs_y,int p_parent_w,int p_parent_h) {
ViewportRect desired_rect=p_viewport->rect;
@@ -6873,14 +6973,31 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
/* Camera should always be BEFORE any other 3D */
- if (!p_viewport->hide_scenario && camera_owner.owns(p_viewport->camera) && scenario_owner.owns(p_viewport->scenario)) {
+ bool scenario_draw_canvas_bg=false;
+ int scenario_canvas_max_layer=0;
- Camera *camera = camera_owner.get( p_viewport->camera );
- Scenario *scenario = scenario_owner.get( p_viewport->scenario );
+ if (!p_viewport->hide_canvas && !p_viewport->disable_environment && scenario_owner.owns(p_viewport->scenario)) {
- _update_instances(); // check dirty instances before rendering
+ Scenario *scenario=scenario_owner.get(p_viewport->scenario);
+ if (scenario->environment.is_valid()) {
+ if (rasterizer->is_environment(scenario->environment)) {
+ scenario_draw_canvas_bg=rasterizer->environment_get_background(scenario->environment)==VS::ENV_BG_CANVAS;
+ scenario_canvas_max_layer=rasterizer->environment_get_background_param(scenario->environment,VS::ENV_BG_PARAM_CANVAS_MAX_LAYER);
+ }
+ }
+ }
- _render_camera(p_viewport, camera,scenario );
+ bool can_draw_3d=!p_viewport->hide_scenario && camera_owner.owns(p_viewport->camera) && scenario_owner.owns(p_viewport->scenario);
+
+
+ if (scenario_draw_canvas_bg) {
+
+ rasterizer->begin_canvas_bg();
+ }
+
+ if (!scenario_draw_canvas_bg && can_draw_3d) {
+
+ _draw_viewport_camera(p_viewport,false);
} else if (true /*|| !p_viewport->canvas_list.empty()*/){
@@ -6890,7 +7007,10 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
rasterizer->clear_viewport(Color(0,0,0,0));
}
else {
- rasterizer->clear_viewport(clear_color);
+ Color cc=clear_color;
+ if (scenario_draw_canvas_bg)
+ cc.a=0;
+ rasterizer->clear_viewport(cc);
}
p_viewport->render_target_clear=false;
}
@@ -6906,6 +7026,8 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
Rasterizer::CanvasLight *lights_with_shadow=NULL;
Rect2 shadow_rect;
+ int light_count=0;
+
for (Map<RID,Viewport::CanvasData>::Element *E=p_viewport->canvas_map.front();E;E=E->next()) {
Matrix32 xf = p_viewport->global_transform * E->get().transform;
@@ -6919,6 +7041,7 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
if (cl->enabled && cl->texture.is_valid()) {
//not super efficient..
Size2 tsize(rasterizer->texture_get_width(cl->texture),rasterizer->texture_get_height(cl->texture));
+ tsize*=cl->scale;
Vector2 offset=tsize/2.0;
cl->rect_cache=Rect2(-offset+cl->texture_offset,tsize);
cl->xform_cache=xf * cl->xform;
@@ -6944,10 +7067,13 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
cl->radius_cache=cl->rect_cache.size.length();
}
+
+ light_count++;
}
}
}
+ //print_line("lights: "+itos(light_count));
canvas_map[ Viewport::CanvasKey( E->key(), E->get().layer) ]=&E->get();
}
@@ -6984,6 +7110,16 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
rasterizer->set_viewport(viewport_rect); //must reset viewport afterwards
}
+
+
+
+ if (scenario_draw_canvas_bg && canvas_map.front() && canvas_map.front()->key().layer>scenario_canvas_max_layer) {
+
+ _draw_viewport_camera(p_viewport,!can_draw_3d);
+ scenario_draw_canvas_bg=false;
+
+ }
+
for (Map<Viewport::CanvasKey,Viewport::CanvasData*>::Element *E=canvas_map.front();E;E=E->next()) {
@@ -7005,9 +7141,21 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_
_render_canvas( E->get()->canvas,xform,canvas_lights );
i++;
+ if (scenario_draw_canvas_bg && E->key().layer>=scenario_canvas_max_layer) {
+ _draw_viewport_camera(p_viewport,!can_draw_3d);
+ scenario_draw_canvas_bg=false;
+ }
+
+
}
- rasterizer->canvas_debug_viewport_shadows(lights_with_shadow);
+ if (scenario_draw_canvas_bg) {
+ _draw_viewport_camera(p_viewport,!can_draw_3d);
+ scenario_draw_canvas_bg=false;
+ }
+
+
+ //rasterizer->canvas_debug_viewport_shadows(lights_with_shadow);
}
//capture
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index b9a3f83364..72af793278 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -489,6 +489,8 @@ class VisualServerRaster : public VisualServer {
bool render_target_vflip;
bool render_target_clear_on_new_frame;
bool render_target_clear;
+ bool disable_environment;
+
Image capture;
bool rendered_in_prev_frame;
@@ -515,7 +517,7 @@ class VisualServerRaster : public VisualServer {
SelfList<Viewport> update_list;
- Viewport() : update_list(this) { transparent_bg=false; render_target_update_mode=RENDER_TARGET_UPDATE_WHEN_VISIBLE; queue_capture=false; rendered_in_prev_frame=false; render_target_vflip=false; render_target_clear_on_new_frame=true; render_target_clear=true;}
+ Viewport() : update_list(this) { transparent_bg=false; render_target_update_mode=RENDER_TARGET_UPDATE_WHEN_VISIBLE; queue_capture=false; rendered_in_prev_frame=false; render_target_vflip=false; render_target_clear_on_new_frame=true; render_target_clear=true; disable_environment=false; }
};
SelfList<Viewport>::List viewport_update_list;
@@ -626,6 +628,7 @@ class VisualServerRaster : public VisualServer {
void _cull_room(Camera *p_camera, Instance *p_room,Instance *p_from_portal=NULL);
void _process_sampled_light(const Transform &p_camera, Instance *p_sampled_light, bool p_linear_colorspace);
+ void _render_no_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario);
void _render_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario);
static void _render_canvas_item_viewport(VisualServer* p_self,void *p_vp,const Rect2& p_rect);
void _render_canvas_item_tree(CanvasItem *p_canvas_item, const Matrix32& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, Rasterizer::CanvasLight *p_lights);
@@ -643,6 +646,7 @@ class VisualServerRaster : public VisualServer {
int changes;
bool draw_extra_frame;
+ void _draw_viewport_camera(Viewport *p_viewport, bool p_ignore_camera);
void _draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ofs_y,int p_parent_w,int p_parent_h);
void _draw_viewports();
void _draw_cursors_and_margins();
@@ -983,6 +987,7 @@ public:
virtual void viewport_render_target_clear(RID p_viewport);
virtual void viewport_set_render_target_to_screen_rect(RID p_viewport,const Rect2& p_rect);
+
virtual void viewport_queue_screen_capture(RID p_viewport);
virtual Image viewport_get_screen_capture(RID p_viewport) const;
@@ -991,6 +996,7 @@ public:
virtual void viewport_set_hide_scenario(RID p_viewport,bool p_hide);
virtual void viewport_set_hide_canvas(RID p_viewport,bool p_hide);
+ virtual void viewport_set_disable_environment(RID p_viewport,bool p_disable);
virtual void viewport_attach_camera(RID p_viewport,RID p_camera);
virtual void viewport_set_scenario(RID p_viewport,RID p_scenario);
@@ -1122,6 +1128,7 @@ public:
//virtual void canvas_item_set_rect(RID p_item, const Rect2& p_rect);
virtual void canvas_item_set_transform(RID p_item, const Matrix32& p_transform);
virtual void canvas_item_set_clip(RID p_item, bool p_clip);
+ virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable);
virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect=Rect2());
virtual void canvas_item_set_opacity(RID p_item, float p_opacity);
virtual float canvas_item_get_opacity(RID p_item, float p_opacity) const;
@@ -1149,6 +1156,7 @@ public:
virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable);
virtual void canvas_item_set_z(RID p_item, int p_z);
virtual void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable);
+ virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect);
virtual void canvas_item_set_material(RID p_item, RID p_material);
virtual void canvas_item_set_use_parent_material(RID p_item, bool p_enable);
@@ -1157,6 +1165,7 @@ public:
virtual void canvas_light_attach_to_canvas(RID p_light,RID p_canvas);
virtual void canvas_light_set_enabled(RID p_light, bool p_enabled);
virtual void canvas_light_set_transform(RID p_light, const Matrix32& p_transform);
+ virtual void canvas_light_set_scale(RID p_light, float p_scale);
virtual void canvas_light_set_texture(RID p_light, RID p_texture);
virtual void canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset);
virtual void canvas_light_set_color(RID p_light, const Color& p_color);
@@ -1164,6 +1173,7 @@ public:
virtual void canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z);
virtual void canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer);
virtual void canvas_light_set_item_mask(RID p_light, int p_mask);
+ virtual void canvas_light_set_item_shadow_mask(RID p_light, int p_mask);
virtual void canvas_light_set_subtract_mode(RID p_light, bool p_enable);
virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled);
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 1890f7b760..ded4c6fc00 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -982,6 +982,7 @@ public:
FUNC2(viewport_set_hide_canvas,RID,bool );
FUNC2(viewport_attach_camera,RID,RID );
FUNC2(viewport_set_scenario,RID,RID );
+ FUNC2(viewport_set_disable_environment,RID,bool );
FUNC1RC(RID,viewport_get_attached_camera,RID);
FUNC1RC(RID,viewport_get_scenario,RID );
@@ -1108,6 +1109,7 @@ public:
//FUNC(canvas_item_set_rect,RID, const Rect2& p_rect);
FUNC2(canvas_item_set_transform,RID, const Matrix32& );
FUNC2(canvas_item_set_clip,RID, bool );
+ FUNC2(canvas_item_set_distance_field_mode,RID, bool );
FUNC3(canvas_item_set_custom_rect,RID, bool ,const Rect2&);
FUNC2(canvas_item_set_opacity,RID, float );
FUNC2RC(float,canvas_item_get_opacity,RID, float );
@@ -1138,6 +1140,8 @@ public:
FUNC2(canvas_item_set_sort_children_by_y,RID,bool);
FUNC2(canvas_item_set_z,RID,int);
FUNC2(canvas_item_set_z_as_relative_to_parent,RID,bool);
+ FUNC3(canvas_item_set_copy_to_backbuffer,RID,bool,const Rect2&);
+
FUNC2(canvas_item_set_material,RID, RID );
@@ -1151,6 +1155,7 @@ public:
FUNC2(canvas_light_attach_to_canvas,RID,RID);
FUNC2(canvas_light_set_enabled,RID,bool);
FUNC2(canvas_light_set_transform,RID,const Matrix32&);
+ FUNC2(canvas_light_set_scale,RID,float);
FUNC2(canvas_light_set_texture,RID,RID);
FUNC2(canvas_light_set_texture_offset,RID,const Vector2&);
FUNC2(canvas_light_set_color,RID,const Color&);
@@ -1158,6 +1163,7 @@ public:
FUNC3(canvas_light_set_layer_range,RID,int,int);
FUNC3(canvas_light_set_z_range,RID,int,int);
FUNC2(canvas_light_set_item_mask,RID,int);
+ FUNC2(canvas_light_set_item_shadow_mask,RID,int);
FUNC2(canvas_light_set_subtract_mode,RID,bool);
FUNC2(canvas_light_set_shadow_enabled,RID,bool);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index ccf6978ae3..b6d354454e 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -704,6 +704,7 @@ public:
virtual void viewport_set_hide_scenario(RID p_viewport,bool p_hide)=0;
virtual void viewport_set_hide_canvas(RID p_viewport,bool p_hide)=0;
+ virtual void viewport_set_disable_environment(RID p_viewport,bool p_disable)=0;
virtual void viewport_attach_camera(RID p_viewport,RID p_camera)=0;
virtual void viewport_set_scenario(RID p_viewport,RID p_scenario)=0;
@@ -734,8 +735,7 @@ public:
ENV_BG_COLOR,
ENV_BG_TEXTURE,
ENV_BG_CUBEMAP,
- ENV_BG_TEXTURE_RGBE,
- ENV_BG_CUBEMAP_RGBE,
+ ENV_BG_CANVAS,
ENV_BG_MAX
};
@@ -744,6 +744,7 @@ public:
enum EnvironmentBGParam {
+ ENV_BG_PARAM_CANVAS_MAX_LAYER,
ENV_BG_PARAM_COLOR,
ENV_BG_PARAM_TEXTURE,
ENV_BG_PARAM_CUBEMAP,
@@ -968,6 +969,7 @@ public:
virtual void canvas_item_set_transform(RID p_item, const Matrix32& p_transform)=0;
virtual void canvas_item_set_clip(RID p_item, bool p_clip)=0;
+ virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable)=0;
virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect,const Rect2& p_rect=Rect2())=0;
virtual void canvas_item_set_opacity(RID p_item, float p_opacity)=0;
virtual float canvas_item_get_opacity(RID p_item, float p_opacity) const=0;
@@ -994,6 +996,7 @@ public:
virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable)=0;
virtual void canvas_item_set_z(RID p_item, int p_z)=0;
virtual void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable)=0;
+ virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable,const Rect2& p_rect)=0;
virtual void canvas_item_clear(RID p_item)=0;
virtual void canvas_item_raise(RID p_item)=0;
@@ -1005,6 +1008,7 @@ public:
virtual RID canvas_light_create()=0;
virtual void canvas_light_attach_to_canvas(RID p_light,RID p_canvas)=0;
virtual void canvas_light_set_enabled(RID p_light, bool p_enabled)=0;
+ virtual void canvas_light_set_scale(RID p_light, float p_scale)=0;
virtual void canvas_light_set_transform(RID p_light, const Matrix32& p_transform)=0;
virtual void canvas_light_set_texture(RID p_light, RID p_texture)=0;
virtual void canvas_light_set_texture_offset(RID p_light, const Vector2& p_offset)=0;
@@ -1013,6 +1017,7 @@ public:
virtual void canvas_light_set_z_range(RID p_light, int p_min_z,int p_max_z)=0;
virtual void canvas_light_set_layer_range(RID p_light, int p_min_layer,int p_max_layer)=0;
virtual void canvas_light_set_item_mask(RID p_light, int p_mask)=0;
+ virtual void canvas_light_set_item_shadow_mask(RID p_light, int p_mask)=0;
virtual void canvas_light_set_subtract_mode(RID p_light, bool p_enable)=0;
virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled)=0;
diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp
index d7158eb7e9..cf4b21510a 100644
--- a/tools/editor/connections_dialog.cpp
+++ b/tools/editor/connections_dialog.cpp
@@ -607,6 +607,14 @@ void ConnectionsDialog::_remove_confirm() {
}
*/
+
+struct _ConnectionsDialogMethodInfoSort {
+
+ _FORCE_INLINE_ bool operator()(const MethodInfo& a, const MethodInfo& b) const {
+ return a.name < b.name;
+ }
+};
+
void ConnectionsDialog::update_tree() {
if (!is_visible())
@@ -623,7 +631,8 @@ void ConnectionsDialog::update_tree() {
node->get_signal_list(&node_signals);
-
+ //node_signals.sort_custom<_ConnectionsDialogMethodInfoSort>();
+
for(List<MethodInfo>::Element *E=node_signals.front();E;E=E->next()) {
diff --git a/tools/editor/editor_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp
index eee4125e93..eec452ab7f 100644
--- a/tools/editor/editor_dir_dialog.cpp
+++ b/tools/editor/editor_dir_dialog.cpp
@@ -28,6 +28,9 @@
/*************************************************************************/
#include "editor_dir_dialog.h"
#include "os/os.h"
+#include "os/keyboard.h"
+#include "tools/editor/editor_settings.h"
+
void EditorDirDialog::_update_dir(TreeItem* p_item) {
@@ -39,12 +42,21 @@ void EditorDirDialog::_update_dir(TreeItem* p_item) {
da->change_dir(cdir);
da->list_dir_begin();
String p=da->get_next();
+
+ bool ishidden;
+ bool show_hidden = EditorSettings::get_singleton()->get("file_dialog/show_hidden_files");
+
while(p!="") {
- if (da->current_is_dir() && !p.begins_with(".")) {
- TreeItem *ti = tree->create_item(p_item);
- ti->set_text(0,p);
- ti->set_icon(0,get_icon("Folder","EditorIcons"));
- ti->set_collapsed(true);
+
+ ishidden = da->current_is_hidden();
+
+ if (show_hidden || !ishidden) {
+ if (da->current_is_dir() && !p.begins_with(".")) {
+ TreeItem *ti = tree->create_item(p_item);
+ ti->set_text(0,p);
+ ti->set_icon(0,get_icon("Folder","EditorIcons"));
+ ti->set_collapsed(true);
+ }
}
p=da->get_next();
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 3d42867d9a..5e571373ea 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -218,6 +218,7 @@ void EditorNode::_notification(int p_what) {
}
if (p_what==NOTIFICATION_ENTER_TREE) {
+
//MessageQueue::get_singleton()->push_call(this,"_get_scene_metadata");
get_tree()->set_editor_hint(true);
get_tree()->get_root()->set_as_audio_listener(false);
@@ -231,6 +232,8 @@ void EditorNode::_notification(int p_what) {
VisualServer::get_singleton()->viewport_set_hide_scenario(get_scene_root()->get_viewport(),true);
VisualServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport(),true);
+ VisualServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(),true);
+
_editor_select(1);
if (defer_load_scene!="") {
@@ -3412,6 +3415,8 @@ EditorNode::EditorNode() {
scene_root = memnew( Viewport );
+
+
//scene_root_base->add_child(scene_root);
scene_root->set_meta("_editor_disable_input",true);
VisualServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport(),true);
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 24699ac87f..deb5d86a2e 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -446,6 +446,7 @@ void EditorSettings::_load_defaults() {
set("text_editor/create_signal_callbacks",true);
+ set("file_dialog/show_hidden_files", false);
set("animation/autorename_animation_tracks",true);
set("animation/confirm_insert_track",true);
diff --git a/tools/editor/icons/icon_back_buffer_copy.png b/tools/editor/icons/icon_back_buffer_copy.png
new file mode 100644
index 0000000000..b27eb39108
--- /dev/null
+++ b/tools/editor/icons/icon_back_buffer_copy.png
Binary files differ
diff --git a/tools/editor/icons/icon_check_box.png b/tools/editor/icons/icon_check_box.png
new file mode 100644
index 0000000000..8a2b56cc3e
--- /dev/null
+++ b/tools/editor/icons/icon_check_box.png
Binary files differ
diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp
index 1fd7d26f8b..0562153199 100644
--- a/tools/editor/io_plugins/editor_font_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp
@@ -47,6 +47,12 @@ class _EditorFontImportOptions : public Object {
OBJ_TYPE(_EditorFontImportOptions,Object);
public:
+ enum FontMode {
+
+ FONT_BITMAP,
+ FONT_DISTANCE_FIELD
+ };
+
enum ColorType {
COLOR_WHITE,
COLOR_CUSTOM,
@@ -69,6 +75,9 @@ public:
CHARSET_CUSTOM_LATIN
};
+
+ FontMode font_mode;
+
CharacterSet character_set;
String custom_file;
@@ -91,7 +100,6 @@ public:
bool color_use_monochrome;
String gradient_image;
-
bool disable_filter;
bool round_advance;
@@ -100,7 +108,10 @@ public:
bool _set(const StringName& p_name, const Variant& p_value) {
String n = p_name;
- if (n=="extra_space/char")
+ if (n=="mode/mode") {
+ font_mode=FontMode(int(p_value));
+ _change_notify();
+ } else if (n=="extra_space/char")
char_extra_spacing=p_value;
else if (n=="extra_space/space")
space_extra_spacing=p_value;
@@ -169,7 +180,9 @@ public:
bool _get(const StringName& p_name,Variant &r_ret) const{
String n = p_name;
- if (n=="extra_space/char")
+ if (n=="mode/mode")
+ r_ret=font_mode;
+ else if (n=="extra_space/char")
r_ret=char_extra_spacing;
else if (n=="extra_space/space")
r_ret=space_extra_spacing;
@@ -231,6 +244,9 @@ public:
void _get_property_list( List<PropertyInfo> *p_list) const{
+
+ p_list->push_back(PropertyInfo(Variant::INT,"mode/mode",PROPERTY_HINT_ENUM,"Bitmap,Distance Field"));
+
p_list->push_back(PropertyInfo(Variant::INT,"extra_space/char",PROPERTY_HINT_RANGE,"-64,64,1"));
p_list->push_back(PropertyInfo(Variant::INT,"extra_space/space",PROPERTY_HINT_RANGE,"-64,64,1"));
p_list->push_back(PropertyInfo(Variant::INT,"extra_space/top",PROPERTY_HINT_RANGE,"-64,64,1"));
@@ -240,35 +256,45 @@ public:
if (character_set>=CHARSET_CUSTOM)
p_list->push_back(PropertyInfo(Variant::STRING,"character_set/custom",PROPERTY_HINT_FILE));
- p_list->push_back(PropertyInfo(Variant::BOOL,"shadow/enabled"));
- if (shadow) {
- p_list->push_back(PropertyInfo(Variant::INT,"shadow/radius",PROPERTY_HINT_RANGE,"-64,64,1"));
- p_list->push_back(PropertyInfo(Variant::VECTOR2,"shadow/offset"));
- p_list->push_back(PropertyInfo(Variant::COLOR,"shadow/color"));
- p_list->push_back(PropertyInfo(Variant::REAL,"shadow/transition",PROPERTY_HINT_EXP_EASING));
- }
+ int usage = PROPERTY_USAGE_DEFAULT;
- p_list->push_back(PropertyInfo(Variant::BOOL,"shadow2/enabled"));
- if (shadow2) {
- p_list->push_back(PropertyInfo(Variant::INT,"shadow2/radius",PROPERTY_HINT_RANGE,"-64,64,1"));
- p_list->push_back(PropertyInfo(Variant::VECTOR2,"shadow2/offset"));
- p_list->push_back(PropertyInfo(Variant::COLOR,"shadow2/color"));
- p_list->push_back(PropertyInfo(Variant::REAL,"shadow2/transition",PROPERTY_HINT_EXP_EASING));
+ if (font_mode==FONT_DISTANCE_FIELD) {
+ usage = PROPERTY_USAGE_NOEDITOR;
}
- p_list->push_back(PropertyInfo(Variant::INT,"color/mode",PROPERTY_HINT_ENUM,"White,Color,Gradient,Gradient Image"));
- if (color_type==COLOR_CUSTOM) {
- p_list->push_back(PropertyInfo(Variant::COLOR,"color/color"));
+ {
+ p_list->push_back(PropertyInfo(Variant::BOOL,"shadow/enabled",PROPERTY_HINT_NONE,"",usage));
+ if (shadow) {
+ p_list->push_back(PropertyInfo(Variant::INT,"shadow/radius",PROPERTY_HINT_RANGE,"-64,64,1",usage));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2,"shadow/offset",PROPERTY_HINT_NONE,"",usage));
+ p_list->push_back(PropertyInfo(Variant::COLOR,"shadow/color",PROPERTY_HINT_NONE,"",usage));
+ p_list->push_back(PropertyInfo(Variant::REAL,"shadow/transition",PROPERTY_HINT_EXP_EASING,"",usage));
+ }
+
+ p_list->push_back(PropertyInfo(Variant::BOOL,"shadow2/enabled",PROPERTY_HINT_NONE,"",usage));
+ if (shadow2) {
+ p_list->push_back(PropertyInfo(Variant::INT,"shadow2/radius",PROPERTY_HINT_RANGE,"-64,64,1",usage));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2,"shadow2/offset",PROPERTY_HINT_NONE,"",usage));
+ p_list->push_back(PropertyInfo(Variant::COLOR,"shadow2/color",PROPERTY_HINT_NONE,"",usage));
+ p_list->push_back(PropertyInfo(Variant::REAL,"shadow2/transition",PROPERTY_HINT_EXP_EASING,"",usage));
+ }
+
+ p_list->push_back(PropertyInfo(Variant::INT,"color/mode",PROPERTY_HINT_ENUM,"White,Color,Gradient,Gradient Image",usage));
+ if (color_type==COLOR_CUSTOM) {
+ p_list->push_back(PropertyInfo(Variant::COLOR,"color/color",PROPERTY_HINT_NONE,"",usage));
+
+ }
+ if (color_type==COLOR_GRADIENT_RANGE) {
+ p_list->push_back(PropertyInfo(Variant::COLOR,"color/begin",PROPERTY_HINT_NONE,"",usage));
+ p_list->push_back(PropertyInfo(Variant::COLOR,"color/end",PROPERTY_HINT_NONE,"",usage));
+ }
+ if (color_type==COLOR_GRADIENT_IMAGE) {
+ p_list->push_back(PropertyInfo(Variant::STRING,"color/image",PROPERTY_HINT_FILE,"",usage));
+ }
+ p_list->push_back(PropertyInfo(Variant::BOOL,"color/monochrome",PROPERTY_HINT_NONE,"",usage));
}
- if (color_type==COLOR_GRADIENT_RANGE) {
- p_list->push_back(PropertyInfo(Variant::COLOR,"color/begin"));
- p_list->push_back(PropertyInfo(Variant::COLOR,"color/end"));
- }
- if (color_type==COLOR_GRADIENT_IMAGE) {
- p_list->push_back(PropertyInfo(Variant::STRING,"color/image",PROPERTY_HINT_FILE));
- }
- p_list->push_back(PropertyInfo(Variant::BOOL,"color/monochrome"));
+
p_list->push_back(PropertyInfo(Variant::BOOL,"advanced/round_advance"));
p_list->push_back(PropertyInfo(Variant::BOOL,"advanced/disable_filter"));
@@ -307,6 +333,7 @@ public:
gradient_end=Color(0.5,0.5,0.5,1);
color_use_monochrome=false;
+ font_mode=FONT_BITMAP;
round_advance=true;
disable_filter=false;
@@ -314,6 +341,8 @@ public:
_EditorFontImportOptions() {
+ font_mode=FONT_BITMAP;
+
char_extra_spacing=0;
top_extra_spacing=0;
bottom_extra_spacing=0;
@@ -706,6 +735,137 @@ struct _EditorKerningKey {
};
+
+static unsigned char get_SDF_radial(
+ unsigned char *fontmap,
+ int w, int h,
+ int x, int y,
+ int max_radius )
+{
+ // hideous brute force method
+ float d2 = max_radius*max_radius+1.0;
+ unsigned char v = fontmap[x+y*w];
+ for( int radius = 1; (radius <= max_radius) && (radius*radius < d2); ++radius )
+ {
+ int line, lo, hi;
+ // north
+ line = y - radius;
+ if( (line >= 0) && (line < h) )
+ {
+ lo = x - radius;
+ hi = x + radius;
+ if( lo < 0 ) { lo = 0; }
+ if( hi >= w ) { hi = w-1; }
+ int idx = line * w + lo;
+ for( int i = lo; i <= hi; ++i )
+ {
+ // check this pixel
+ if( fontmap[idx] != v )
+ {
+ float nx = i - x;
+ float ny = line - y;
+ float nd2 = nx*nx+ny*ny;
+ if( nd2 < d2 )
+ {
+ d2 = nd2;
+ }
+ }
+ // move on
+ ++idx;
+ }
+ }
+ // south
+ line = y + radius;
+ if( (line >= 0) && (line < h) )
+ {
+ lo = x - radius;
+ hi = x + radius;
+ if( lo < 0 ) { lo = 0; }
+ if( hi >= w ) { hi = w-1; }
+ int idx = line * w + lo;
+ for( int i = lo; i <= hi; ++i )
+ {
+ // check this pixel
+ if( fontmap[idx] != v )
+ {
+ float nx = i - x;
+ float ny = line - y;
+ float nd2 = nx*nx+ny*ny;
+ if( nd2 < d2 )
+ {
+ d2 = nd2;
+ }
+ }
+ // move on
+ ++idx;
+ }
+ }
+ // west
+ line = x - radius;
+ if( (line >= 0) && (line < w) )
+ {
+ lo = y - radius + 1;
+ hi = y + radius - 1;
+ if( lo < 0 ) { lo = 0; }
+ if( hi >= h ) { hi = h-1; }
+ int idx = lo * w + line;
+ for( int i = lo; i <= hi; ++i )
+ {
+ // check this pixel
+ if( fontmap[idx] != v )
+ {
+ float nx = line - x;
+ float ny = i - y;
+ float nd2 = nx*nx+ny*ny;
+ if( nd2 < d2 )
+ {
+ d2 = nd2;
+ }
+ }
+ // move on
+ idx += w;
+ }
+ }
+ // east
+ line = x + radius;
+ if( (line >= 0) && (line < w) )
+ {
+ lo = y - radius + 1;
+ hi = y + radius - 1;
+ if( lo < 0 ) { lo = 0; }
+ if( hi >= h ) { hi = h-1; }
+ int idx = lo * w + line;
+ for( int i = lo; i <= hi; ++i )
+ {
+ // check this pixel
+ if( fontmap[idx] != v )
+ {
+ float nx = line - x;
+ float ny = i - y;
+ float nd2 = nx*nx+ny*ny;
+ if( nd2 < d2 )
+ {
+ d2 = nd2;
+ }
+ }
+ // move on
+ idx += w;
+ }
+ }
+ }
+ d2 = sqrtf( d2 );
+ if( v==0 )
+ {
+ d2 = -d2;
+ }
+ d2 *= 127.5 / max_radius;
+ d2 += 127.5;
+ if( d2 < 0.0 ) d2 = 0.0;
+ if( d2 > 255.0 ) d2 = 255.0;
+ return (unsigned char)(d2 + 0.5);
+}
+
+
Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata>& p_from, const String &p_existing) {
Ref<ResourceImportMetadata> from = p_from;
@@ -754,7 +914,11 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
}
- error = FT_Set_Pixel_Sizes(face,0,size);
+ int font_mode = from->get_option("mode/mode");
+
+ int scaler=(font_mode==_EditorFontImportOptions::FONT_DISTANCE_FIELD)?16:1;
+
+ error = FT_Set_Pixel_Sizes(face,0,size*scaler);
FT_GlyphSlot slot = face->glyph;
@@ -820,9 +984,9 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
{
bool skip=false;
- error = FT_Load_Char( face, charcode, FT_LOAD_RENDER );
+ error = FT_Load_Char( face, charcode, font_mode==_EditorFontImportOptions::FONT_BITMAP?FT_LOAD_RENDER:FT_LOAD_MONOCHROME );
if (error) skip=true;
- else error = FT_Render_Glyph( face->glyph, ft_render_mode_normal );
+ else error = FT_Render_Glyph( face->glyph, font_mode==_EditorFontImportOptions::FONT_BITMAP?ft_render_mode_normal:ft_render_mode_mono );
if (error) {
skip=true;
} else if (!skip) {
@@ -847,28 +1011,36 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
}
_EditorFontData * fdata = memnew( _EditorFontData );
- fdata->bitmap.resize( slot->bitmap.width*slot->bitmap.rows );
- fdata->width=slot->bitmap.width;
- fdata->height=slot->bitmap.rows;
- fdata->character=charcode;
- fdata->glyph=FT_Get_Char_Index(face,charcode);
- if (charcode=='x')
- xsize=slot->bitmap.width;
- if (charcode<127) {
- if (slot->bitmap_top>max_up) {
+ int w = slot->bitmap.width;
+ int h = slot->bitmap.rows;
+ int p = slot->bitmap.pitch;
- max_up=slot->bitmap_top;
- }
+ print_line("W: "+itos(w)+" P: "+itos(slot->bitmap.pitch));
+ if (font_mode==_EditorFontImportOptions::FONT_DISTANCE_FIELD) {
- if ( (slot->bitmap_top - fdata->height)<max_down ) {
+ // oversize the holding buffer so I can smooth it!
+ int sw = w + scaler * 4;
+ int sh = h + scaler * 4;
+ // do the SDF
+ int sdfw = sw / scaler;
+ int sdfh = sh / scaler;
- max_down=slot->bitmap_top - fdata->height;
- }
+ fdata->width=sdfw;
+ fdata->height=sdfh;
+ } else {
+ fdata->width=w;
+ fdata->height=h;
}
+ fdata->character=charcode;
+ fdata->glyph=FT_Get_Char_Index(face,charcode);
+ if (charcode=='x')
+ xsize=w/scaler;
+
+
fdata->valign=slot->bitmap_top;
fdata->halign=slot->bitmap_left;
@@ -878,12 +1050,85 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
else
fdata->advance=slot->advance.x/float(1<<6);
+ if (font_mode==_EditorFontImportOptions::FONT_DISTANCE_FIELD) {
+
+ fdata->halign = fdata->halign / scaler - 1.5;
+ fdata->valign = fdata->valign / scaler + 1.5;
+ fdata->advance/=scaler;
+
+ }
+
fdata->advance+=font_spacing;
- for (int i=0;i<slot->bitmap.width;i++) {
- for (int j=0;j<slot->bitmap.rows;j++) {
- fdata->bitmap[j*slot->bitmap.width+i]=slot->bitmap.buffer[j*slot->bitmap.width+i];
+ if (charcode<127) {
+ int top = fdata->valign;
+ int hmax = h/scaler;
+
+ if (top>max_up) {
+
+ max_up=top;
+ }
+
+
+ if ( (top - hmax)<max_down ) {
+
+ max_down=top - hmax;
+ }
+ }
+
+ if (font_mode==_EditorFontImportOptions::FONT_DISTANCE_FIELD) {
+
+
+ // oversize the holding buffer so I can smooth it!
+ int sw = w + scaler * 4;
+ int sh = h + scaler * 4;
+
+ unsigned char *smooth_buf = new unsigned char[sw*sh];
+
+ for( int i = 0; i < sw*sh; ++i ) {
+ smooth_buf[i] = 0;
+ }
+
+ // copy the glyph into the buffer to be smoothed
+ unsigned char *buf = slot->bitmap.buffer;
+ for( int j = 0; j < h; ++j ) {
+ for( int i = 0; i < w; ++i ) {
+ smooth_buf[scaler*2+i+(j+scaler*2)*sw] = 255 * ((buf[j*p+(i>>3)] >> (7 - (i & 7))) & 1);
+ }
+ }
+
+ // do the SDF
+ int sdfw = fdata->width;
+ int sdfh = fdata->height;
+
+ fdata->bitmap.resize( sdfw*sdfh );
+
+ for( int j = 0; j < sdfh; ++j ) {
+ for( int i = 0; i < sdfw; ++i ) {
+ int pd_idx = j*sdfw+i;
+
+ //fdata->bitmap[j*slot->bitmap.width+i]=slot->bitmap.buffer[j*slot->bitmap.width+i];
+
+ fdata->bitmap[pd_idx] =
+ //get_SDF
+ get_SDF_radial
+ ( smooth_buf, sw, sh,
+ i*scaler + (scaler >>1), j*scaler + (scaler >>1),
+ 2*scaler );
+
+ }
+ }
+
+ delete [] smooth_buf;
+
+ } else {
+ fdata->bitmap.resize( slot->bitmap.width*slot->bitmap.rows );
+ for (int i=0;i<slot->bitmap.width;i++) {
+ for (int j=0;j<slot->bitmap.rows;j++) {
+
+ fdata->bitmap[j*slot->bitmap.width+i]=slot->bitmap.buffer[j*slot->bitmap.width+i];
+ }
}
}
@@ -904,9 +1149,10 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
spd->ofs_x=0;
spd->ofs_y=0;
- if (!FT_Load_Char( face, ' ', FT_LOAD_RENDER ) && !FT_Render_Glyph( face->glyph, ft_render_mode_normal )) {
+ if (!FT_Load_Char( face, ' ', FT_LOAD_RENDER ) && !FT_Render_Glyph( face->glyph, font_mode==_EditorFontImportOptions::FONT_BITMAP?ft_render_mode_normal:ft_render_mode_mono )) {
spd->advance = slot->advance.x>>6; //round to nearest or store as float
+ spd->advance/=scaler;
spd->advance+=font_spacing;
} else {
@@ -955,7 +1201,7 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
if (kern==0)
continue;
- kerning_map[kpk]=kern;
+ kerning_map[kpk]=kern/scaler;
}
}
}
@@ -1079,7 +1325,7 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
pixels.resize(s.x*s.y*4);
DVector<uint8_t>::Write w = pixels.write();
- print_line("val: "+itos(font_data_list[i]->valign));
+ //print_line("val: "+itos(font_data_list[i]->valign));
for(int y=0;y<s.height;y++) {
int yc=CLAMP(y-o.y+font_data_list[i]->valign,0,height-1);
@@ -1284,6 +1530,7 @@ Ref<Font> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMetadata
font->clear();
font->set_height(height+bottom_space+top_space);
font->set_ascent(ascent+top_space);
+ font->set_distance_field_hint(font_mode==_EditorFontImportOptions::FONT_DISTANCE_FIELD);
//register texures
{
diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp
index 6dd46843cc..d2c9f395d2 100644
--- a/tools/editor/io_plugins/editor_import_collada.cpp
+++ b/tools/editor/io_plugins/editor_import_collada.cpp
@@ -1357,8 +1357,60 @@ Error ColladaImport::_create_mesh_surfaces(Ref<Mesh>& p_mesh,const Map<String,Co
vertw = DVector<Vector3>::Write();
DVector<Vector3> normals;
DVector<float> tangents;
+ if(md.vertices[vertex_src_id].sources.has("NORMAL")){
+ //has normals
+ normals.resize(vlen);
+ std::cout << "has normals" << std::endl;
+ String normal_src_id = md.vertices[vertex_src_id].sources["NORMAL"];
+ std::cout << "normals source: "<< normal_src_id.utf8().get_data() <<std::endl;
+ ERR_FAIL_COND_V(!md.sources.has(normal_src_id),ERR_INVALID_DATA);
- _generate_normals(index_array,vertices,normals);
+ const Collada::MeshData::Source *m=&md.sources[normal_src_id];
+
+ ERR_FAIL_COND_V( m->array.size() != vertex_src->array.size(), ERR_INVALID_DATA);
+ int stride=m->stride;
+ if (stride==0)
+ stride=3;
+
+
+ //read normals from morph target
+ DVector<Vector3>::Write vertw = normals.write();
+
+ for(int m_i=0;m_i<m->array.size()/stride;m_i++) {
+
+ int pos = m_i*stride;
+ Vector3 vtx( m->array[pos+0], m->array[pos+1], m->array[pos+2] );
+
+ #ifndef NO_UP_AXIS_SWAP
+ if (collada.state.up_axis==Vector3::AXIS_Z) {
+
+ SWAP( vtx.z, vtx.y );
+ vtx.z = -vtx.z;
+
+ }
+ #endif
+
+ Collada::Vertex vertex;
+ vertex.vertex=vtx;
+ vertex.fix_unit_scale(collada);
+ vtx=vertex.vertex;
+
+ vtx = p_local_xform.xform(vtx);
+
+
+ if (vertex_map.has(m_i)) { //vertex may no longer be here, don't bother converting
+
+
+ for (Set<int> ::Element *E=vertex_map[m_i].front() ; E; E=E->next() ) {
+
+ vertw[E->get()]=vtx;
+ }
+ }
+ }
+
+ }else{
+ _generate_normals(index_array,vertices,normals);//no normals
+ }
if (final_tangent_array.size() && final_uv_array.size()) {
_generate_tangents_and_binormals(index_array,vertices,final_uv_array,normals,tangents);
diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp
index 42a185b7c2..184f80a1b7 100644
--- a/tools/editor/plugins/baked_light_baker.cpp
+++ b/tools/editor/plugins/baked_light_baker.cpp
@@ -1233,7 +1233,7 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c
if (dist<r) {
//avoid accumulaiton of light on corners
//plot_light=plot_light.linear_interpolate(Color(0,0,0,0),1.0-sd/plot_size*plot_size);
- skip-true;
+ skip=true;
} else {
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 514f4b6525..fdec72332e 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -87,7 +87,7 @@ Dictionary CanvasItemEditor::get_state() const {
state["ofs"]=Point2(h_scroll->get_val(),v_scroll->get_val());
// state["ofs"]=-transform.get_origin();
state["use_snap"]=is_snap_active();
- state["snap"]=snap;
+ state["snap_vec"]=Vector2(get_snap());
state["pixel_snap"]=pixel_snap;
return state;
}
@@ -111,7 +111,15 @@ void CanvasItemEditor::set_state(const Dictionary& p_state){
}
if (state.has("snap")) {
- snap=state["snap"];
+ snap_x->set_val(state["snap"]);
+ snap_y->set_val(state["snap"]);
+ }
+
+ if (state.has("snap_vec")) {
+ Vector2 sv = state["snap_vec"];
+ snap_x->set_val(sv.x);
+ snap_y->set_val(sv.y);
+ viewport->update();
}
if (state.has("pixel_snap")) {
@@ -300,7 +308,7 @@ void CanvasItemEditor::_key_move(const Vector2& p_dir, bool p_snap, KeyMoveMODE
Vector2 drag = p_dir;
if (p_snap)
- drag*=snap;
+ drag*=get_snap();
undo_redo->add_undo_method(canvas_item,"edit_set_state",canvas_item->edit_get_state());
@@ -554,6 +562,13 @@ void CanvasItemEditor::_append_canvas_item(CanvasItem *c) {
}
+void CanvasItemEditor::_snap_changed(double) {
+
+ viewport->update();
+}
+
+
+
void CanvasItemEditor::_dialog_value_changed(double) {
if (updating_value_dialog)
@@ -563,7 +578,7 @@ void CanvasItemEditor::_dialog_value_changed(double) {
case SNAP_CONFIGURE: {
- snap=dialog_val->get_val();
+ // snap=dialog_val->get_val();
viewport->update();
} break;
case ZOOM_SET: {
@@ -1165,7 +1180,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
continue;
}
- if (pixel_snap || (is_snap_active() && snap>0)) {
+ if (pixel_snap || (is_snap_active() && get_snap().x>0 && get_snap().y>0)) {
if (drag!=DRAG_ALL) {
dfrom=drag_point_from;
@@ -1174,14 +1189,14 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
Vector2 newpos = drag_point_from + (dto-dfrom);
Vector2 disp;
- if (!is_snap_active() || snap<1) {
+ if (!is_snap_active() || get_snap().x<1 || get_snap().y<1) {
disp.x = Math::fposmod(newpos.x,1);
disp.y = Math::fposmod(newpos.y,1);
} else {
- disp.x = Math::fposmod(newpos.x,snap);
- disp.y = Math::fposmod(newpos.y,snap);
+ disp.x = Math::fposmod(newpos.x,get_snap().x);
+ disp.y = Math::fposmod(newpos.y,get_snap().y);
}
dto-=disp;
}
@@ -1477,7 +1492,7 @@ void CanvasItemEditor::_viewport_draw() {
_update_scrollbars();
RID ci=viewport->get_canvas_item();
- if (snap>0 && is_snap_active() && true ) {
+ if (get_snap().x>0 && get_snap().y>0 && is_snap_active() && true ) {
Size2 s = viewport->get_size();
@@ -1485,7 +1500,7 @@ void CanvasItemEditor::_viewport_draw() {
Matrix32 xform = transform.affine_inverse();
for(int i=0;i<s.width;i++) {
- int cell = Math::fast_ftoi(Math::floor(xform.xform(Vector2(i,0)).x/snap));
+ int cell = Math::fast_ftoi(Math::floor(xform.xform(Vector2(i,0)).x/get_snap().x));
if (i==0)
last_cell=cell;
if (last_cell!=cell)
@@ -1495,7 +1510,7 @@ void CanvasItemEditor::_viewport_draw() {
for(int i=0;i<s.height;i++) {
- int cell = Math::fast_ftoi(Math::floor(xform.xform(Vector2(0,i)).y/snap));
+ int cell = Math::fast_ftoi(Math::floor(xform.xform(Vector2(0,i)).y/get_snap().y));
if (i==0)
last_cell=cell;
if (last_cell!=cell)
@@ -1809,6 +1824,8 @@ void CanvasItemEditor::_notification(int p_what) {
group_button->set_icon(get_icon("Group","EditorIcons"));
ungroup_button->set_icon(get_icon("Ungroup","EditorIcons"));
key_insert_button->set_icon(get_icon("Key","EditorIcons"));
+ snap_x->connect("value_changed",this,"_snap_changed");
+ snap_y->connect("value_changed",this,"_snap_changed");
}
@@ -2002,7 +2019,7 @@ Point2 CanvasItemEditor::snapify(const Point2& p_pos) const {
Vector2 pos = p_pos;
- if (!active || snap<1) {
+ if (!active || get_snap().x<1 || get_snap().y<1) {
if (pixel_snap) {
@@ -2014,8 +2031,8 @@ Point2 CanvasItemEditor::snapify(const Point2& p_pos) const {
}
- pos.x=Math::stepify(pos.x,snap);
- pos.y=Math::stepify(pos.y,snap);
+ pos.x=Math::stepify(pos.x,get_snap().x);
+ pos.y=Math::stepify(pos.y,get_snap().y);
return pos;
@@ -2038,15 +2055,46 @@ void CanvasItemEditor::_popup_callback(int p_op) {
int idx = edit_menu->get_popup()->get_item_index(SNAP_USE_PIXEL);
edit_menu->get_popup()->set_item_checked(idx,pixel_snap);
} break;
+ case SNAP_OBJECT_CENTERS: {
+
+ List<Node*> &selection = editor_selection->get_selected_node_list();
+
+ undo_redo->create_action("Snap Object Centers");
+ for(List<Node*>::Element *E=selection.front();E;E=E->next()) {
+
+ CanvasItem *canvas_item = E->get()->cast_to<CanvasItem>();
+ if (!canvas_item)
+ continue;
+ if (!canvas_item->is_visible())
+ continue;
+ Node2D* node = canvas_item->cast_to<Node2D>();
+ if (!node)
+ continue;
+
+ Matrix32 gtrans = node->get_global_transform();
+ gtrans.elements[2]=snapify(gtrans.elements[2]);
+
+ undo_redo->add_do_method(node,"set_global_transform",gtrans);
+ undo_redo->add_undo_method(node,"set_global_transform",node->get_global_transform());
+ }
+
+ undo_redo->add_do_method(viewport,"update");
+ undo_redo->add_undo_method(viewport,"update");
+ undo_redo->commit_action();
+
+ } break;
case SNAP_CONFIGURE: {
updating_value_dialog=true;
+ snap_dialog->popup_centered_minsize();
+/*
dialog_label->set_text("Snap (Pixels):");
dialog_val->set_min(1);
dialog_val->set_step(1);
dialog_val->set_max(4096);
dialog_val->set_val(snap);
value_dialog->popup_centered(Size2(200,85));
+ */
updating_value_dialog=false;
} break;
@@ -2604,6 +2652,7 @@ void CanvasItemEditor::_bind_methods() {
ObjectTypeDB::bind_method("_unhandled_key_input",&CanvasItemEditor::_unhandled_key_input);
ObjectTypeDB::bind_method("_viewport_draw",&CanvasItemEditor::_viewport_draw);
ObjectTypeDB::bind_method("_viewport_input_event",&CanvasItemEditor::_viewport_input_event);
+ ObjectTypeDB::bind_method("_snap_changed",&CanvasItemEditor::_snap_changed);
ADD_SIGNAL( MethodInfo("item_lock_status_changed") );
ADD_SIGNAL( MethodInfo("item_group_status_changed") );
@@ -2812,6 +2861,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p->add_item("Configure Snap..",SNAP_CONFIGURE);
p->add_separator();
p->add_check_item("Use Pixel Snap",SNAP_USE_PIXEL);
+ p->add_item("Snap Selected Object Centers",SNAP_OBJECT_CENTERS);
p->add_separator();
p->add_item("Expand to Parent",EXPAND_TO_PARENT,KEY_MASK_CMD|KEY_P);
p->add_separator();
@@ -2918,12 +2968,33 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
dialog_val->connect("value_changed",this,"_dialog_value_changed");
select_sb = Ref<StyleBoxTexture>( memnew( StyleBoxTexture) );
+ snap_dialog = memnew( AcceptDialog );
+ VBoxContainer *snap_vb = memnew( VBoxContainer );
+ snap_dialog->add_child(snap_vb);
+ snap_dialog->set_child_rect(snap_vb);
+ snap_dialog->set_title("Snap Configuration");
+ snap_x = memnew( SpinBox );
+ snap_x->set_custom_minimum_size(Size2(250,0));
+ snap_y = memnew( SpinBox );
+ snap_x->set_min(1);
+ snap_x->set_max(4096);
+ snap_x->set_step(1);
+ snap_x->set_val(10);
+ snap_y->set_min(1);
+ snap_y->set_max(4096);
+ snap_y->set_step(1);
+ snap_y->set_val(10);
+ snap_vb->add_margin_child("Snap X",snap_x);
+ snap_vb->add_margin_child("Snap Y",snap_y);
+ add_child(snap_dialog);
+
+
key_pos=true;
key_rot=true;
key_scale=false;
zoom=1;
- snap=10;
+ //snap=10;
updating_value_dialog=false;
box_selecting=false;
//zoom=0.5;
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h
index 6648d486e8..9160742826 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.h
+++ b/tools/editor/plugins/canvas_item_editor_plugin.h
@@ -77,6 +77,7 @@ class CanvasItemEditor : public VBoxContainer {
SNAP_USE,
SNAP_CONFIGURE,
SNAP_USE_PIXEL,
+ SNAP_OBJECT_CENTERS,
ZOOM_IN,
ZOOM_OUT,
ZOOM_RESET,
@@ -143,7 +144,6 @@ class CanvasItemEditor : public VBoxContainer {
Matrix32 transform;
float zoom;
- int snap;
bool pixel_snap;
bool box_selecting;
Point2 box_selecting_to;
@@ -250,7 +250,11 @@ class CanvasItemEditor : public VBoxContainer {
AcceptDialog *value_dialog;
Label *dialog_label;
SpinBox *dialog_val;
-
+
+ AcceptDialog *snap_dialog;
+ SpinBox *snap_x;
+ SpinBox *snap_y;
+
CanvasItem *ref_item;
void _add_canvas_item(CanvasItem *p_canvas_item);
@@ -289,6 +293,7 @@ class CanvasItemEditor : public VBoxContainer {
void _viewport_input_event(const InputEvent& p_event);
void _viewport_draw();
+ void _snap_changed(double);
HSplitContainer *palette_split;
VSplitContainer *bottom_split;
@@ -335,7 +340,7 @@ protected:
public:
bool is_snap_active() const;
- int get_snap() const { return snap; }
+ Size2i get_snap() const { return Size2i(snap_x->get_val(),snap_y->get_val()); }
Matrix32 get_canvas_transform() const { return transform; }
diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
index dab6df9a39..9a0d5b4066 100644
--- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
@@ -369,6 +369,7 @@ void CollisionPolygon2DEditor::edit(Node *p_collision_polygon) {
wip.clear();
wip_active=false;
edited_point=-1;
+ canvas_item_editor->get_viewport_control()->update();
} else {
node=NULL;
diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
index c1fb81b66a..5fa3d8ac8f 100644
--- a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -96,7 +96,7 @@ bool LightOccluder2DEditor::forward_input_event(const InputEvent& p_event) {
create_poly->set_text("No OccluderPolygon2D resource on this node.\nCreate and assign one?");
create_poly->popup_centered_minsize();
}
- return false;
+ return (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==1);
}
switch(p_event.type) {
@@ -389,7 +389,7 @@ void LightOccluder2DEditor::edit(Node *p_collision_polygon) {
wip.clear();
wip_active=false;
edited_point=-1;
-
+ canvas_item_editor->get_viewport_control()->update();
} else {
node=NULL;
@@ -402,6 +402,8 @@ void LightOccluder2DEditor::edit(Node *p_collision_polygon) {
void LightOccluder2DEditor::_create_poly() {
+ if (!node)
+ return;
undo_redo->create_action("Create Occluder Polygon");
undo_redo->add_do_method(node,"set_occluder_polygon",Ref<OccluderPolygon2D>(memnew( OccluderPolygon2D)));
undo_redo->add_undo_method(node,"set_occluder_polygon",Variant(REF()));
diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
index 599d18c8bb..163accfdd3 100644
--- a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -36,6 +36,9 @@ void NavigationPolygonEditor::_node_removed(Node *p_node) {
void NavigationPolygonEditor::_create_nav() {
+ if (!node)
+ return;
+
undo_redo->create_action("Create Navigation Polygon");
undo_redo->add_do_method(node,"set_navigation_polygon",Ref<NavigationPolygon>(memnew( NavigationPolygon)));
undo_redo->add_undo_method(node,"set_navigation_polygon",Variant(REF()));
@@ -107,7 +110,7 @@ bool NavigationPolygonEditor::forward_input_event(const InputEvent& p_event) {
create_nav->set_text("No NavigationPolygon resource on this node.\nCreate and assign one?");
create_nav->popup_centered_minsize();
}
- return false;
+ return (p_event.type==InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==1);;
}
@@ -445,6 +448,7 @@ void NavigationPolygonEditor::edit(Node *p_collision_polygon) {
wip.clear();
wip_active=false;
edited_point=-1;
+ canvas_item_editor->get_viewport_control()->update();
} else {
node=NULL;
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 1349d5ccab..72b3025f2f 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -630,11 +630,13 @@ bool ScriptEditor::_test_script_times_on_disk() {
- if (!all_ok)
- if (bool(EDITOR_DEF("text_editor/auto_reload_changed_scripts",false)))
+ if (!all_ok) {
+ if (bool(EDITOR_DEF("text_editor/auto_reload_changed_scripts",false))) {
script_editor->_reload_scripts();
- else
+ } else {
disk_changed->call_deferred("popup_centered_ratio",0.5);
+ }
+ }
return all_ok;
}
@@ -920,7 +922,7 @@ void ScriptEditor::_menu_option(int p_option) {
String line_text = tx->get_line(i);
if (line_text.begins_with("#"))
- line_text = line_text.strip_edges().substr(1, line_text.length());
+ line_text = line_text.substr(1, line_text.length());
else
line_text = "#" + line_text;
tx->set_line(i, line_text);
@@ -932,7 +934,7 @@ void ScriptEditor::_menu_option(int p_option) {
String line_text = tx->get_line(begin);
if (line_text.begins_with("#"))
- line_text = line_text.strip_edges().substr(1, line_text.length());
+ line_text = line_text.substr(1, line_text.length());
else
line_text = "#" + line_text;
tx->set_line(begin, line_text);
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 87bd8105af..30ac50057f 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -477,6 +477,16 @@ void SpatialEditorViewport::_select_region() {
}
+void SpatialEditorViewport::_update_name() {
+
+ String ortho = orthogonal?"Orthogonal":"Perspective";
+
+ if (name!="")
+ view_menu->set_text("[ "+name+" "+ortho+" ]");
+ else
+ view_menu->set_text("[ "+ortho+" ]");
+}
+
void SpatialEditorViewport::_compute_edit(const Point2& p_point) {
@@ -832,6 +842,8 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
_edit.plane=TRANSFORM_X_AXIS;
set_message("View Plane Transform.",2);
+ name="";
+ _update_name();
} break;
case TRANSFORM_X_AXIS: {
@@ -1460,6 +1472,8 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
cursor.x_rot=Math_PI/2.0;
if (cursor.x_rot<-Math_PI/2.0)
cursor.x_rot=-Math_PI/2.0;
+ name="";
+ _update_name();
} break;
default: {}
@@ -1484,9 +1498,14 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
if (k.mod.shift) {
cursor.x_rot=-Math_PI/2.0;
set_message("Bottom View.",2);
+ name="Bottom";
+ _update_name();
+
} else {
cursor.x_rot=Math_PI/2.0;
set_message("Top View.",2);
+ name="Top";
+ _update_name();
}
} break;
case KEY_KP_1: {
@@ -1495,10 +1514,14 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
if (k.mod.shift) {
cursor.y_rot=Math_PI;
set_message("Rear View.",2);
+ name="Rear";
+ _update_name();
} else {
cursor.y_rot=0;
set_message("Front View.",2);
+ name="Front";
+ _update_name();
}
} break;
@@ -1508,9 +1531,13 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
if (k.mod.shift) {
cursor.y_rot=Math_PI/2.0;
set_message("Left View.",2);
+ name="Left";
+ _update_name();
} else {
cursor.y_rot=-Math_PI/2.0;
set_message("Right View.",2);
+ name="Right";
+ _update_name();
}
} break;
@@ -1518,6 +1545,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
orthogonal = !orthogonal;
_menu_option(orthogonal?VIEW_PERSPECTIVE:VIEW_ORTHOGONAL);
+ _update_name();
} break;
@@ -1831,35 +1859,47 @@ void SpatialEditorViewport::_menu_option(int p_option) {
cursor.x_rot=Math_PI/2.0;
cursor.y_rot=0;
+ name="Top";
+ _update_name();
} break;
case VIEW_BOTTOM: {
cursor.x_rot=-Math_PI/2.0;
cursor.y_rot=0;
+ name="Bottom";
+ _update_name();
} break;
case VIEW_LEFT: {
cursor.y_rot=Math_PI/2.0;
cursor.x_rot=0;
+ name="Left";
+ _update_name();
} break;
case VIEW_RIGHT: {
cursor.y_rot=-Math_PI/2.0;
cursor.x_rot=0;
+ name="Right";
+ _update_name();
} break;
case VIEW_FRONT: {
cursor.y_rot=0;
cursor.x_rot=0;
+ name="Front";
+ _update_name();
} break;
case VIEW_REAR: {
cursor.y_rot=Math_PI;
cursor.x_rot=0;
+ name="Rear";
+ _update_name();
} break;
case VIEW_CENTER_TO_SELECTION: {
@@ -1941,6 +1981,7 @@ void SpatialEditorViewport::_menu_option(int p_option) {
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(VIEW_ORTHOGONAL), false );
orthogonal=false;
call_deferred("update_transform_gizmo_view");
+ _update_name();
} break;
case VIEW_ORTHOGONAL: {
@@ -1949,6 +1990,7 @@ void SpatialEditorViewport::_menu_option(int p_option) {
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(VIEW_ORTHOGONAL), true );
orthogonal=true;
call_deferred("update_transform_gizmo_view");
+ _update_name();
} break;
case VIEW_AUDIO_LISTENER: {
@@ -2147,15 +2189,13 @@ void SpatialEditorViewport::reset() {
message_time=0;
message="";
last_message="";
+ name="Top";
cursor.x_rot=0;
cursor.y_rot=0;
cursor.distance=4;
cursor.region_select=false;
-
-
-
-
+ _update_name();
}
SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, EditorNode *p_editor, int p_index) {
@@ -2189,18 +2229,17 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
view_menu = memnew( MenuButton );
surface->add_child(view_menu);
view_menu->set_pos( Point2(4,4));
- view_menu->set_text("[view]");
view_menu->set_self_opacity(0.5);
- view_menu->get_popup()->add_item("Top",VIEW_TOP);
- view_menu->get_popup()->add_item("Bottom",VIEW_BOTTOM);
- view_menu->get_popup()->add_item("Left",VIEW_LEFT);
- view_menu->get_popup()->add_item("Right",VIEW_RIGHT);
- view_menu->get_popup()->add_item("Front",VIEW_FRONT);
- view_menu->get_popup()->add_item("Rear",VIEW_REAR);
+ view_menu->get_popup()->add_item("Top (Num7)",VIEW_TOP);
+ view_menu->get_popup()->add_item("Bottom (Shift+Num7)",VIEW_BOTTOM);
+ view_menu->get_popup()->add_item("Left (Num3)",VIEW_LEFT);
+ view_menu->get_popup()->add_item("Right (Shift+Num3)",VIEW_RIGHT);
+ view_menu->get_popup()->add_item("Front (Num1)",VIEW_FRONT);
+ view_menu->get_popup()->add_item("Rear (Shift+Num1)",VIEW_REAR);
view_menu->get_popup()->add_separator();
- view_menu->get_popup()->add_check_item("Perspective",VIEW_PERSPECTIVE);
- view_menu->get_popup()->add_check_item("Orthogonal",VIEW_ORTHOGONAL);
+ view_menu->get_popup()->add_check_item("Perspective (Num5)",VIEW_PERSPECTIVE);
+ view_menu->get_popup()->add_check_item("Orthogonal (Num5)",VIEW_ORTHOGONAL);
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_PERSPECTIVE),true);
view_menu->get_popup()->add_separator();
view_menu->get_popup()->add_check_item("Environment",VIEW_ENVIRONMENT);
@@ -2233,6 +2272,10 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
viewport->set_as_audio_listener(true);
}
+
+ name="Top";
+ _update_name();
+
EditorSettings::get_singleton()->connect("settings_changed",this,"update_transform_gizmo_view");
}
@@ -3666,7 +3709,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
p->add_check_item("View Origin",MENU_VIEW_ORIGIN);
p->add_check_item("View Grid",MENU_VIEW_GRID);
p->add_separator();
- p->add_check_item("Settings",MENU_VIEW_CAMERA_SETTINGS );
+ p->add_item("Settings",MENU_VIEW_CAMERA_SETTINGS);
p->set_item_checked( p->get_item_index(MENU_VIEW_USE_DEFAULT_LIGHT), true );
diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h
index 646a4d2d86..4d594d1921 100644
--- a/tools/editor/plugins/spatial_editor_plugin.h
+++ b/tools/editor/plugins/spatial_editor_plugin.h
@@ -92,6 +92,7 @@ public:
};
private:
int index;
+ String name;
void _menu_option(int p_option);
Size2 prev_size;
@@ -110,6 +111,7 @@ private:
bool orthogonal;
float gizmo_scale;
+ void _update_name();
void _compute_edit(const Point2& p_point);
void _clear_selected();
void _select_clicked(bool p_append,bool p_single);
diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp
index ccbd923118..bd6fb37b29 100644
--- a/tools/editor/plugins/theme_editor_plugin.cpp
+++ b/tools/editor/plugins/theme_editor_plugin.cpp
@@ -568,6 +568,26 @@ ThemeEditor::ThemeEditor() {
CheckButton *cb = memnew( CheckButton );
cb->set_text("CheckButton");
first_vb->add_child(cb );
+ CheckBox *cbx = memnew( CheckBox );
+ cbx->set_text("CheckBox");
+ first_vb->add_child(cbx );
+
+ /* TODO: This is not working properly, controls are overlapping*/
+ /*
+ ButtonGroup *bg = memnew( ButtonGroup );
+ bg->set_v_size_flags(SIZE_EXPAND_FILL);
+ VBoxContainer *gbvb = memnew( VBoxContainer );
+ gbvb->set_v_size_flags(SIZE_EXPAND_FILL);
+ CheckBox *rbx1 = memnew( CheckBox );
+ rbx1->set_text("CheckBox Radio1");
+ rbx1->set_pressed(true);
+ gbvb->add_child(rbx1);
+ CheckBox *rbx2 = memnew( CheckBox );
+ rbx2->set_text("CheckBox Radio2");
+ gbvb->add_child(rbx2);
+ bg->add_child(gbvb);
+ first_vb->add_child(bg);
+ */
MenuButton* test_menu_button = memnew( MenuButton );
test_menu_button->set_text("MenuButton");
diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h
index 98156422ee..83432b9232 100644
--- a/tools/editor/plugins/theme_editor_plugin.h
+++ b/tools/editor/plugins/theme_editor_plugin.h
@@ -33,6 +33,8 @@
#include "scene/gui/texture_frame.h"
#include "scene/gui/option_button.h"
#include "scene/gui/file_dialog.h"
+#include "scene/gui/check_box.h"
+#include "scene/gui/button_group.h"
#include "tools/editor/editor_node.h"
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp
index 47727a00c2..79e43f9012 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_map_editor_plugin.cpp
@@ -640,19 +640,53 @@ void TileMapEditor::_canvas_draw() {
Ref<Texture> t = ts->tile_get_texture(st);
if (t.is_valid()) {
- Vector2 from = xform.xform(ts->tile_get_texture_offset(st)+node->map_to_world(over_tile)+node->get_cell_draw_offset());
+ Vector2 from = node->map_to_world(over_tile)+node->get_cell_draw_offset();
Rect2 r = ts->tile_get_region(st);
Size2 sc = xform.get_scale();
if (mirror_x->is_pressed())
sc.x*=-1.0;
if (mirror_y->is_pressed())
sc.y*=-1.0;
+
+ Rect2 rect;
+ if (r==Rect2()) {
+ rect=Rect2(from,t->get_size());
+ } else {
+
+ rect=Rect2(from,r.get_size());
+ }
+
+
+ if (node->get_tile_origin()==TileMap::TILE_ORIGIN_TOP_LEFT) {
+ rect.pos+=ts->tile_get_texture_offset(st);
+
+ } else if (node->get_tile_origin()==TileMap::TILE_ORIGIN_CENTER) {
+ rect.pos+=node->get_cell_size()/2;
+ Vector2 s = r.size;
+
+ Vector2 center = (s/2) - ts->tile_get_texture_offset(st);
+
+
+ if (mirror_x->is_pressed())
+ rect.pos.x-=s.x-center.x;
+ else
+ rect.pos.x-=center.x;
+
+ if (mirror_y->is_pressed())
+ rect.pos.y-=s.y-center.y;
+ else
+ rect.pos.y-=center.y;
+ }
+
+ rect.pos=xform.xform(rect.pos);
+ rect.size*=sc;
+
if (r==Rect2()) {
- canvas_item_editor->draw_texture_rect(t,Rect2(from,t->get_size()*sc),false,Color(1,1,1,0.5),transpose->is_pressed());
+ canvas_item_editor->draw_texture_rect(t,rect,false,Color(1,1,1,0.5),transpose->is_pressed());
} else {
- canvas_item_editor->draw_texture_rect_region(t,Rect2(from,r.get_size()*sc),r,Color(1,1,1,0.5),transpose->is_pressed());
+ canvas_item_editor->draw_texture_rect_region(t,rect,r,Color(1,1,1,0.5),transpose->is_pressed());
}
}
}
diff --git a/tools/editor/plugins/tile_set_editor_plugin.cpp b/tools/editor/plugins/tile_set_editor_plugin.cpp
index a51caf7d54..8ff7720934 100644
--- a/tools/editor/plugins/tile_set_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_set_editor_plugin.cpp
@@ -37,83 +37,103 @@ void TileSetEditor::edit(const Ref<TileSet>& p_tileset) {
void TileSetEditor::_import_scene(Node *scene, Ref<TileSet> p_library, bool p_merge) {
if (!p_merge)
- p_library->clear();
+ p_library->clear();
for(int i=0;i<scene->get_child_count();i++) {
- Node *child = scene->get_child(i);
+ Node *child = scene->get_child(i);
- if (!child->cast_to<Sprite>()) {
- if (child->get_child_count()>0) {
- child=child->get_child(0);
- if (!child->cast_to<Sprite>()) {
- continue;
- }
+ if (!child->cast_to<Sprite>()) {
+ if (child->get_child_count()>0) {
+ child=child->get_child(0);
+ if (!child->cast_to<Sprite>()) {
+ continue;
+ }
- } else
- continue;
+ } else
+ continue;
- }
+ }
- Sprite *mi = child->cast_to<Sprite>();
- Ref<Texture> texture=mi->get_texture();
- if (texture.is_null())
+ Sprite *mi = child->cast_to<Sprite>();
+ Ref<Texture> texture=mi->get_texture();
+ Ref<CanvasItemMaterial> material=mi->get_material();
+
+ if (texture.is_null())
continue;
- int id = p_library->find_tile_by_name(mi->get_name());
- if (id<0) {
-
- id=p_library->get_last_unused_tile_id();
- p_library->create_tile(id);
- p_library->tile_set_name(id,mi->get_name());
- }
-
-
- p_library->tile_set_texture(id,texture);
- Vector2 phys_offset;
-
- if (mi->is_centered()) {
- Size2 s;
- if (mi->is_region()) {
- s=mi->get_region_rect().size;
- } else {
- s=texture->get_size();
- }
- phys_offset+=-s/2;
- }
- if (mi->is_region()) {
- p_library->tile_set_region(id,mi->get_region_rect());
- }
-
- Vector<Ref<Shape2D> >collisions;
-
- for(int j=0;j<mi->get_child_count();j++) {
-
- Node *child2 = mi->get_child(j);
- if (!child2->cast_to<StaticBody2D>())
- continue;
- StaticBody2D *sb = child2->cast_to<StaticBody2D>();
- if (sb->get_shape_count()==0)
- continue;
- Ref<Shape2D> collision=sb->get_shape(0);
- if (collision.is_valid()) {
- collisions.push_back(collision);
+ int id = p_library->find_tile_by_name(mi->get_name());
+ if (id<0) {
+
+ id=p_library->get_last_unused_tile_id();
+ p_library->create_tile(id);
+ p_library->tile_set_name(id,mi->get_name());
+ }
+
+
+
+ p_library->tile_set_texture(id,texture);
+ p_library->tile_set_material(id,material);
+
+ Vector2 phys_offset;
+
+ if (mi->is_centered()) {
+ Size2 s;
+ if (mi->is_region()) {
+ s=mi->get_region_rect().size;
+ } else {
+ s=texture->get_size();
+ }
+ phys_offset+=-s/2;
+ }
+ if (mi->is_region()) {
+ p_library->tile_set_region(id,mi->get_region_rect());
+ }
+
+ Vector<Ref<Shape2D> >collisions;
+ Ref<NavigationPolygon> nav_poly;
+ Ref<OccluderPolygon2D> occluder;
+
+ for(int j=0;j<mi->get_child_count();j++) {
+
+ Node *child2 = mi->get_child(j);
+
+ if (child2->cast_to<NavigationPolygonInstance>())
+ nav_poly=child2->cast_to<NavigationPolygonInstance>()->get_navigation_polygon();
+
+ if (child2->cast_to<LightOccluder2D>())
+ occluder=child2->cast_to<LightOccluder2D>()->get_occluder_polygon();
+
+ if (!child2->cast_to<StaticBody2D>())
+ continue;
+ StaticBody2D *sb = child2->cast_to<StaticBody2D>();
+ if (sb->get_shape_count()==0)
+ continue;
+ Ref<Shape2D> collision=sb->get_shape(0);
+ if (collision.is_valid()) {
+ collisions.push_back(collision);
}
- }
+ }
- if (collisions.size()) {
+ if (collisions.size()) {
- p_library->tile_set_shapes(id,collisions);
- p_library->tile_set_shape_offset(id,-phys_offset);
- } else {
- p_library->tile_set_shape_offset(id,Vector2());
+ p_library->tile_set_shapes(id,collisions);
+ p_library->tile_set_shape_offset(id,-phys_offset);
+ } else {
+ p_library->tile_set_shape_offset(id,Vector2());
+
+ }
+
+ p_library->tile_set_texture_offset(id,mi->get_offset());
+ p_library->tile_set_navigation_polygon(id,nav_poly);
+ p_library->tile_set_light_occluder(id,occluder);
+ p_library->tile_set_occluder_offset(id,-phys_offset);
+ p_library->tile_set_navigation_polygon_offset(id,-phys_offset);
- }
- p_library->tile_set_texture_offset(id,mi->get_offset());
}
}
@@ -121,23 +141,23 @@ void TileSetEditor::_menu_confirm() {
switch(option) {
- case MENU_OPTION_REMOVE_ITEM: {
+ case MENU_OPTION_REMOVE_ITEM: {
- tileset->remove_tile(to_erase);
- } break;
- case MENU_OPTION_MERGE_FROM_SCENE:
- case MENU_OPTION_CREATE_FROM_SCENE: {
+ tileset->remove_tile(to_erase);
+ } break;
+ case MENU_OPTION_MERGE_FROM_SCENE:
+ case MENU_OPTION_CREATE_FROM_SCENE: {
- EditorNode *en = editor;
- Node * scene = en->get_edited_scene();
- if (!scene)
- break;
+ EditorNode *en = editor;
+ Node * scene = en->get_edited_scene();
+ if (!scene)
+ break;
- _import_scene(scene,tileset,option==MENU_OPTION_MERGE_FROM_SCENE);
+ _import_scene(scene,tileset,option==MENU_OPTION_MERGE_FROM_SCENE);
- } break;
+ } break;
}
}
@@ -165,11 +185,11 @@ void TileSetEditor::_menu_cbk(int p_option) {
cd->set_text("Create from scene?");
cd->popup_centered(Size2(300,60));
} break;
- case MENU_OPTION_MERGE_FROM_SCENE: {
+ case MENU_OPTION_MERGE_FROM_SCENE: {
- cd->set_text("Merge from scene?");
- cd->popup_centered(Size2(300,60));
- } break;
+ cd->set_text("Merge from scene?");
+ cd->popup_centered(Size2(300,60));
+ } break;
}
}
diff --git a/tools/editor/plugins/tile_set_editor_plugin.h b/tools/editor/plugins/tile_set_editor_plugin.h
index 2531ec55bf..1248b4e007 100644
--- a/tools/editor/plugins/tile_set_editor_plugin.h
+++ b/tools/editor/plugins/tile_set_editor_plugin.h
@@ -56,7 +56,7 @@ class TileSetEditor : public Control {
int option;
void _menu_cbk(int p_option);
- void _menu_confirm();
+ void _menu_confirm();
static void _import_scene(Node *p_scene, Ref<TileSet> p_library, bool p_merge);
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 25c39b3173..078a177ca1 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -651,6 +651,8 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
if (!RES(v).is_null()) {
+
+
menu->add_icon_item(get_icon("EditResource","EditorIcons"),"Edit",OBJ_MENU_EDIT);
menu->add_icon_item(get_icon("Del","EditorIcons"),"Clear",OBJ_MENU_CLEAR);
menu->add_icon_item(get_icon("Duplicate","EditorIcons"),"Make Unique",OBJ_MENU_MAKE_UNIQUE);
@@ -659,6 +661,13 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
menu->add_separator();
menu->add_icon_item(get_icon("Reload","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT);
}
+ /*if (r.is_valid() && r->get_path().is_resource_file()) {
+ menu->set_item_tooltip(1,r->get_path());
+ } else if (r.is_valid()) {
+ menu->set_item_tooltip(1,r->get_name()+" ("+r->get_type()+")");
+ }*/
+ } else {
+
}
@@ -1858,9 +1867,17 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
p_item->set_text(1,"<"+res->get_type()+">");
};
+
+ if (res.is_valid() && res->get_path().is_resource_file()) {
+ p_item->set_tooltip(1,res->get_path());
+ } else if (res.is_valid()) {
+ p_item->set_tooltip(1,res->get_name()+" ("+res->get_type()+")");
+ }
+
+
if (has_icon(res->get_type(),"EditorIcons")) {
- p_item->set_icon(1,get_icon(res->get_type(),"EditorIcons"));
+ p_item->set_icon(0,get_icon(res->get_type(),"EditorIcons"));
} else {
Dictionary d = p_item->get_metadata(0);
@@ -1870,10 +1887,10 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
if (has_icon(hint_text,"EditorIcons")) {
- p_item->set_icon(1,get_icon(hint_text,"EditorIcons"));
+ p_item->set_icon(0,get_icon(hint_text,"EditorIcons"));
} else {
- p_item->set_icon(1,get_icon("Object","EditorIcons"));
+ p_item->set_icon(0,get_icon("Object","EditorIcons"));
}
}
@@ -2362,7 +2379,7 @@ void PropertyEditor::update_tree() {
} else {
if (p.type == Variant::REAL) {
- item->set_range_config(1, -65536, 65535, 0.01);
+ item->set_range_config(1, -65536, 65535, 0.001);
} else {
item->set_range_config(1, -65536, 65535, 1);
@@ -2584,6 +2601,13 @@ void PropertyEditor::update_tree() {
if (has_icon(res->get_type(),"EditorIcons")) {
type=res->get_type();
}
+
+ if (res.is_valid() && res->get_path().is_resource_file()) {
+ item->set_tooltip(1,res->get_path());
+ } else if (res.is_valid()) {
+ item->set_tooltip(1,res->get_name()+" ("+res->get_type()+")");
+ }
+
}
diff --git a/tools/script_plugins/time/time.gd b/tools/script_plugins/time/time.gd
index 66b3e9ed04..2e56d89d4f 100644
--- a/tools/script_plugins/time/time.gd
+++ b/tools/script_plugins/time/time.gd
@@ -21,12 +21,12 @@ func _init():
timer.set_one_shot(false)
timer.connect("timeout",self,"_timeout")
-func _enter_scene():
+func _enter_tree():
label = Label.new()
add_custom_control(CONTAINER_TOOLBAR,label)
timer.start()
-func _exit_scene():
+func _exit_tree():
timer.stop()
label.free()
label=null