Commit graph

1108 commits

Author SHA1 Message Date
Juan Linietsky a7b2ac7bb1 Normalmapping and Specularmapping working in 2D engine
Added support for Sprite, AnimatedSprite and Polygon2D (should add for tileset eventually).
2020-02-11 11:53:28 +01:00
Juan Linietsky e1b3444415 Bugfixes and ability to better specify filter and repeat modes everywhere.
Removes antialiased flag for draw_* methods.
2020-02-11 11:53:28 +01:00
Juan Linietsky 9b0dd4f571 A lot of progress with canvas rendering, still far from working. 2020-02-11 11:53:27 +01:00
Juan Linietsky 3f335ce3d4 Texture refactor
-Texture renamed to Texture2D
-TextureLayered as base now inherits 2Darray, cubemap and cubemap array
-Removed all references to flags in textures (they will go in the shader)
-Texture3D gone for now (will come back later done properly)
-Create base rasterizer for RenderDevice, RasterizerRD
2020-02-11 11:53:26 +01:00
Andrea Catania e6be3f68da - Integrated NavigationServer and Navigation2DServer.
- Added Navigation Agents and Obstacles.
- Integrated Collision Avoidance.

This work has been kindly sponsored by IMVU.
2020-02-10 14:38:52 +01:00
Rémi Verschelde 3bd3462d61
Merge pull request #32496 from bitstopper/master
Fixes broken CPUParticles2D AtlasTextures usage
2020-02-07 21:12:19 +01:00
Rémi Verschelde 449656bcbb
Merge pull request #35867 from timothyqiu/path-update
Updates Path2D in debugging if navigation is visible
2020-02-06 10:23:31 +01:00
Marcel Admiraal 5af3b4ca27 Remove duplicate ERR_PRINT macro. 2020-02-05 11:13:24 +01:00
Haoyu Qiu 00d578ba3e Updates Path2D in debugging if navigation is visible 2020-02-03 13:59:13 +08:00
Tomasz Chabora 9ad7fc3405 Allow greater values in unit_offset 2020-01-24 14:40:33 +01:00
Rémi Verschelde ba177ccaec doc: Misc updates for AnimationNode* and others
- Add some missing descriptions.
- Add links to tutorials for ARVR and AnimationTree.
- Style fixes.
- Engine changes:
  * Make `AnimationNodeTransition.input_<number>` properties internal
    so that they don't appear in the docs. They still appear in the
    inspector based on the actual number of inputs requested.
  * Drop unimplemented `CPUParticles.flatness`. It's only used for 3D
    particles in `ParticlesMaterial`, and thus only relevant for
    `CPUParticles3D`.
2020-01-23 12:37:33 +01:00
Rémi Verschelde 4faaf6089a Remove unused #if 0'ed code 2020-01-21 21:41:54 +01:00
Rémi Verschelde 1de633205f Validate input in (CPU)Particles set_emission_shape()
Fixes #29777.

Co-authored-by: Cameron Reikes <cameronreikes@gmail.com>
2020-01-16 11:08:51 +01:00
Marcel Admiraal 907adb37ce Fixes get_floor_normal() returning the user defined floor_normal.
When there is no collision with a floor the get_floor_normal() function
should return the zero vector to be consistent with get_floor_velocity().

Renames floor_normal to up_direction in all bindings.

Updates the documentation of get_floor_normal() and get_floor_velocity()
to make it clear when the values are valid. Updates the documentation for
move_and_slide() and move_and_slide_with_snap() to use the new up_direction
parameter name.
2020-01-15 10:13:35 +01:00
Rémi Verschelde 100f50b7df Control/Light2D: Preventing setting 0 as scale as for Node2D
Triggers errors in `Transform2D::affine_invert()`.

Fixes #26510.
Fixes https://github.com/godotengine/godot/issues/24997#issuecomment-457951639.
2020-01-13 12:20:15 +01:00
Andrea Catania 9f1f4620e0 Added function to expose floor normal, useful to correctly calculate player velocity.
This work has been kindly sponsored by IMVU.
2020-01-10 14:58:19 +01:00
Gilles Roudière b5251eb00f Don't compile editor-only function when tools=no 2020-01-09 22:15:48 +01:00
Rémi Verschelde fa82664419
Merge pull request #34726 from nekomatata/polygon2d-antialiasing-fix
Fixed antialiasing option for Polygon2D with concave/hollow shapes
2020-01-03 14:17:05 +01:00
Александр Растриженков d8dbcbe066 Fix wrong disconnect in callback in VisibilityNotifier 3D 2020-01-02 15:09:26 +01:00
PouleyKetchoupp 1591677eb8 Fixed antialiasing option for Polygon2D
Some cases were not handled properly for Polygon2D after making changes in common code to fix Line2D antialiasing. Added an option for drawing polygons to differentiate the two use cases.

Fixes #34568
2020-01-01 11:40:14 +01:00
Rémi Verschelde a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Hugo Locurcio 0a5b30b14a
Add a range property hint for the number of contacts reported
This closes #34505.
2019-12-21 22:27:10 +01:00
Tyler Greenwood e4a0abdd93 Fixed a bug within sprite.cpp that caused nan values to appear when a texture had zero area 2019-12-16 13:53:35 +01:00
Rémi Verschelde 2845e6a21a
Merge pull request #34040 from qarmin/unused_variable_more_precise_numbers
Removed unused variables, add some constants numbers
2019-12-10 08:25:31 +01:00
Rafał Mikrut ed1c4bc77d Removed unused variables, add some constants numbers 2019-12-10 05:13:02 +01:00
Rémi Verschelde 10bae7c05b
Merge pull request #33857 from nekomatata/polygon-2d-antialiasing
Fixed antialiased option for Polygon2D
2019-12-03 07:51:16 +01:00
Marcel Admiraal 750f343e4a Ensure move_and_slide() is consistent between the 2D and 3D versions.
In the 3D version:
- Partially revert #20908 that was reverted in the 2D version as part
  of #21653. This ensures that the Vector returned is always perpendicular
  to the surface collided with; and not the floor_normal Vector passed to
  the function when on a floor.
- Include an update of the floor velocity before multiplying by the time
  delta, which was added to the 2D version as part of commit 13a8014.

In the 2D version:
- Use the Vector2.slide() function instead of Vector2.tangent() to adjust
  the amount of motion the stop_on_slope undoes to ensure that it is in the
  right direction. This is a implementation of the 3D approach from #30588.
- Combine the !found_collision and motion == Vector2() checks for break.
- Other minor formating changes to make the functions look identical.

Also renamed some variables to align with their use.
2019-12-02 08:35:50 +01:00
Tomasz Chabora 7e6fa6c7a8 Remove unnecessary bounded_offset from PathFollow2D 2019-11-30 03:16:33 +01:00
PouleyKetchoupp e6ebc43d72 Fixed antialiased option for Polygon2D / Line2D
Polygon2D:
The property wasn't used anymore after switching from canvas_item_add_polygon() to canvas_item_add_triangle_array() for drawing.

Line2D:
Added the same property as for Polygon2D & fixed smooth line drawing to use indices correctly.

Fixes #26823
2019-11-28 22:57:27 +01:00
Rémi Verschelde 5ef5e6a7e4
Merge pull request #32274 from raphael10241024/fix_sync_physics_jitter
fix kinematicBody2D jitters when sync_to_physics is turned on
2019-11-21 08:53:24 +01:00
Rafał Mikrut 99d8626f4a Fix some overflows and unitialized variables 2019-11-20 16:22:16 +01:00
Rémi Verschelde 3c0c8f26f9 Revert "Fixed TouchScreenButton::shape_centered having no effect"
This reverts commit 127c2d75ad.

This was a misunderstanding as #32725 is not a bug but expected
behavior.

Reverts #32927.
Supersedes and closes #33436.
2019-11-08 10:54:36 +01:00
Rémi Verschelde 77816fea8b
Merge pull request #32477 from aaronfranke/equal-approx-separate
Make is_equal_approx separate and make == exact again
2019-11-07 14:54:15 +01:00
Rémi Verschelde 9e1be8f8aa
Merge pull request #32934 from ajweeks/fix-scale-origin
Fix 2D scale gizmo placement
2019-10-30 12:04:10 +01:00
Mikolaj Kaczmarek a245bab78d Fixed disconnecting not connected signal 2019-10-29 00:53:48 +01:00
Rémi Verschelde 2416fbb4e2
Merge pull request #31943 from codecustard/Fixes_invalid_frames_on_reverse_anim
Fixes Reverse Animation Starting on First Frame
2019-10-27 09:55:44 +01:00
Rémi Verschelde 3eb8bd08ec
Merge pull request #32657 from ptrojahn/lines
Fix draw_rect
2019-10-26 23:09:24 +02:00
PouleyKetchoupp 1e0f37a70f Fixed emitting not initialized correctly in cpu particles 2d/3d
Fixes uninitialized variable caused by PR #32921
2019-10-24 21:38:01 +02:00
Rémi Verschelde 19fa163d9a
Merge pull request #32992 from KoBeWi/AUTOVECTORZ
Auto-increment frame_coords when keying
2019-10-23 07:42:52 +02:00
Rémi Verschelde 72dfa67dd3
Merge pull request #32924 from ajweeks/add-ruler-arcs
Draw arcs to indicate angles being measured by ruler
2019-10-22 22:44:50 +02:00
Tomasz Chabora 6c0ef9f729 Auto-increment frame_coords when keying 2019-10-22 20:12:55 +02:00
AJ Weeks fb7a4ce63e Fix canvas scale gizmo placement 2019-10-22 18:17:54 +01:00
Rémi Verschelde 4ecc30cc5e
Merge pull request #32927 from Muller-Castro/ShapeCenteredFix
Fixed TouchScreenButton::shape_centered having no effect
2019-10-22 15:53:29 +02:00
Rémi Verschelde 17a7da3b85
Merge pull request #32921 from nekomatata/fix-cpu-particle-delay
Fixed delay when CPUParticles & CPUParticles2D start being emitted
2019-10-22 14:28:04 +02:00
Rémi Verschelde bd23cce055
Merge pull request #32896 from nekomatata/joint-reset-collision
Properly reset collision exception when releasing Joint2D
2019-10-22 12:52:12 +02:00
PouleyKetchoupp 5bf516a062 Fixed delay when CPUParticles & CPUParticles2D start being emitted
Particles were processed only on the next frame after the emission started, causing a one frame delay in rendering. Now the first process cycle is started during the same frame, which makes them consistent with Particles & Particles2D.

Fixes #32890
2019-10-20 09:50:00 +02:00
Muller-Castro 127c2d75ad Fixed TouchScreenButton::shape_centered having no effect
The problem was that the shape_centered depended on TouchScreenButton::texture having a Texture
2019-10-19 18:16:47 -03:00
AJ Weeks 59d2c71227 Add arcs to indicate angle being measured by ruler 2019-10-19 19:45:56 +01:00
PouleyKetchoupp 0de76cc647 Properly reset collision exception when releasing Joint2D
Now using joint_disable_collisions_between_bodies() to reset the exception, because body_remove_collision_exception() was doing only a part of the work.

Fixes #32733
2019-10-17 19:22:59 +02:00
Emmanuel Barroga 94a00cd9c7 Fixes Reverse Animation Starting on First Frame
When playing an animation in reverse, the animation initially starts on frame 0. If it loops, it'll play normally by going to the last frame of the animation, but if it does not... it prematurely stops, since it is already on the last frame (for reversed animation) by starting on frame 0.
2019-10-16 04:26:26 -07:00
Marcel Admiraal f34deabd10 Correct change made to joints_2d.cpp by 072e403. 2019-10-15 17:55:35 +02:00
Aaron Franke aeb7075628
Replace vector == and is_zero_approx(distance) with is_equal_approx
Internal changes only
2019-10-14 16:47:42 -04:00
Gilles Roudiere b27ec4aea7 Fixes Sprite frame_coords 2019-10-13 08:44:44 +02:00
Paul Trojahn bdaedb601c Fix draw_rect
OpenGL uses the diamond exit rule to rasterize lines. If we don't shift
the points down and to the right by 0.5, the line can sometimes miss a
pixel when it shouldn't. The final fragment of a line isn't drawn. By
drawing the lines clockwise, we can avoid a missing pixel in the rectangle.
See section 3.4.1 in the OpenGL 1.5 specification.
Fixes #32279
2019-10-11 10:26:53 +02:00
qarmin bb685147f9 Fix crash in TileMap::update_cell_bitmask 2019-10-08 15:46:38 +02:00
bitstopper 36d9906d6a Fixes broken CPUParticles2D AtlasTextures usage 2019-10-07 10:54:36 +02:00
Rémi Verschelde f84bf7e8a8
Merge pull request #32351 from nekomatata/texture-rect-size-update
Update TextureRect when its Texture is modified directly
2019-10-07 08:57:17 +02:00
PouleyKetchoupp c7834ee566 Update TextureRect and Sprite when their Texture is modified directly.
Modified Sprite to use "changed" signal instead of _changed_callback to make it work when tool is disabled (change receptors are editor only).

Fixes #32349
2019-10-05 17:32:46 +02:00
qarmin f435a6f0b6 Fix crash in TileMap::fix_invalid_tiles 2019-10-05 11:37:38 +02:00
Rémi Verschelde 9327eb226a
Revert "Fixes CPUParticles2D not making use of AtlasTextures" 2019-10-02 09:44:06 +02:00
Rémi Verschelde 09bf1b35c0
Merge pull request #32459 from bitstopper/master
Fixes CPUParticles2D not making use of AtlasTextures
2019-10-02 08:48:19 +02:00
bitstopper 9f21fcf879 Fixes CPUParticles2D not making use of AtlasTextures
Fixes CPUParticles2D not making use of AtlasTextures #2
2019-10-01 14:04:37 +02:00
Soumya Lahiri a1b2364dba Altered rotation_degrees range 2019-09-30 20:43:57 +05:30
bob 943471dd02 Fix TileMap world_to_map rounding issue for negative integers
The previous code would fail for negative integer values like -3.0
(would return -4 instead of -3).

Fixes #31468.
2019-09-26 08:47:24 +02:00
Rémi Verschelde 076dc9803a
Merge pull request #32119 from Calinou/unify-axis-colors
Use the same axis colors consistently in the 2D and 3D editors
2019-09-25 13:03:47 +02:00
Rémi Verschelde dec10dd776
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
qarmin 17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
Rémi Verschelde 0c3335d1f3
Merge pull request #32309 from clayjohn/particles_tex_scale
Fix particles scale randomization
2019-09-24 18:05:44 +02:00
clayjohn bc94203add fix particles scale randomization 2019-09-24 08:03:53 -07:00
RaphaelHunter 101f1b802b fix kinematicBody2D jitters when sync_to_physics is turned on, closes #28181 2019-09-23 20:01:01 +08:00
qarmin 50be65bf43 Changed some code found by Clang Tidy and Coverity 2019-09-22 18:45:08 +02:00
luz.paz 91ecd7b6a6 Fix misc. source comment typos
Found using `codespell -q 3 -S ./thirdparty,*.po -L ang,ba,cas,dof,doubleclick,fave,hist,leapyear,lod,nd,numer,ois,paket,seeked,sinc,switchs,te,uint -D ~/Projects/codespell/codespell_lib/data/dictionary.txt `
2019-09-19 14:36:52 -04:00
Hugo Locurcio c2bcc3f700
Use the same axis colors consistently in the 2D and 3D editors 2019-09-13 14:08:41 +02:00
Rémi Verschelde 720065c721
Merge pull request #31476 from SoulForMachine/fix-move-and-slide-error
Prevent move_and_slide() to generate an error.
2019-09-03 12:51:42 +02:00
Rémi Verschelde 7e731bbce2
Merge pull request #31878 from aole/Initialize-TileMap-Custom-Transform
Initialize TileMap Custom Transform
2019-09-02 10:35:56 +02:00
Bhupendra Aole 0b5a600564 Initialize TileMap Custom Transform
Initialize TileMap Custom Transform to same as Cell Size (64).
Fixes #30948.
2019-09-01 19:33:45 -04:00
Hugo Locurcio 8c8dc6f026
Call some CanvasItem property setters only if needed
The CanvasItem property setters `set_modulate`, `set_self_modulate`
and `set_light_mask` have some side effects that don't need to be run
if the value hasn't changed.

This closes #31777.
2019-08-31 21:53:02 +02:00
Michael Alexsander Silva Dias c902066bb5 Remove some unneeded checks in CollisionObject(2D) 2019-08-30 14:22:46 -03:00
Milan Davidovic c12ce2b4dd Prevent move_and_slide() to generate an error.
When moving KinematicBody2D from one scene to another and not freeing
the old scene, the first call to move_and_slide() in the new scene will
generate an error because KinematicBody2D keeps internaly a
RID on_floor_body of a body resource in the old scene which no more has
a space assigned.

To fix this, on_floor_body is set to empty RID in response to
NOTIFICATION_ENTER_TREE notification of KinematicBody2D and
KinematicBody. Also all other data related to move_and_slide() is reset:
floor, ceiling, wall flags, colliders vector, floor_velocity.

This fixes #31416.
2019-08-26 15:10:15 +02:00
Rémi Verschelde bfed4b6a97
Merge pull request #31014 from DavidSichma/kinematic_angle
Fix floor_max_angle comparison for impossible angles
2019-08-23 09:10:38 +02:00
RaphaelHunter 74713fe970 Fix custom inertia in physics2d, closes#30838 2019-08-22 20:30:03 +08:00
Rémi Verschelde a8db4c848d
Merge pull request #31395 from ptrojahn/floatsarenasty
Replace is_zero_approx(A.distance_to(B)) with A==B
2019-08-20 12:54:40 +02:00
Paul Trojahn 7c9c6df7e4 Replace is_zero_approx(A.distance_to(B)) with A==B
Related to #22988 (Fixes the holes in the shape of
the first comment)
2019-08-19 18:16:58 +02:00
Hugo Locurcio 558e93f069
Improve the appearance of 2D path editors
- Add new handle icons for path/polygon editors
- Add smooth path point icons and curve tangent icons
- Use a gray color for tangent lines in the Path2D and Path editors
- Use antialiasing for Path2D lines
2019-08-18 22:27:01 +02:00
Rémi Verschelde 5f44ee30ec
Merge pull request #31360 from nekomatata/fix-error-parallax-mirroring
Fixed error in ParallaxLayer when set_mirroring is called before entering the tree
2019-08-14 13:48:22 +02:00
PouleyKetchoupp 927a7916f6 Fixed error in ParallaxLayer when set_mirroring is called before entering the tree
Fixes #31300
2019-08-14 13:21:22 +02:00
IAmActuallyCthulhu 82b9557803
Remove redundant author doc comments 2019-08-12 04:26:38 -05:00
Tomasz Chabora af5e0fff66 Remove ERR_EXPLAIN from scene/* code 2019-08-09 13:54:52 +02:00
Rémi Verschelde 5becb2e322
Merge pull request #31194 from bojidar-bg/29312-corrupt-initial-tilemap
Fix corrupted TileMap saves due to missing/wrong format
2019-08-08 11:20:06 +02:00
Bojidar Marinov 141ee27dad
Fix corrupted TileMap saves due to missing/wrong format
Fixes #29312
2019-08-08 09:30:55 +03:00
Rémi Verschelde ba541bceca
Merge pull request #31077 from qarmin/coverity_bugs
Change some code proposed by Coverity and Cppcheck
2019-08-07 13:49:33 +02:00
qarmin e0b5b21863 Add some code changes/fixes proposed by Coverity and Clang Tidy 2019-08-07 12:54:30 +02:00
Tomasz Chabora 459f5cb75e Tweaks related to Camera2D drag margins 2019-08-06 16:19:02 +02:00
Rémi Verschelde 77e8947687
Merge pull request #30905 from clayjohn/set-cpuparticles2d-visible
Toggle CPUParticles2D visibility when redrawing
2019-08-01 18:13:28 +02:00
David Sichma 2fae8832c5 Fix floor_max_angle comparison for impossible angles 2019-08-01 12:54:19 +02:00
Hugo Locurcio 0243dc53b8
Tweak Area and PhysicsBody damping setting hints for consistency
This partially addresses #19182.
2019-07-31 13:57:13 +02:00
clayjohn cb4d145c22 toggle CPUParticles2D visibility when redrawing 2019-07-28 18:31:52 -07:00
groud 11cb4eb363 Add frame_cords accessors to Sprite and Sprite3D 2019-07-27 13:05:02 +02:00
Rémi Verschelde 336846e547 Inspector: Fix PROPERTY_HINT_SPRITE_FRAME not behaving as RANGE
This was a regression in 3.1 and later from the new inspector, where
PROPERTY_HINT_SPRITE_FRAME was not fully re-implemented. It's meant to
be a normal PROPERTY_HINT_RANGE which also automatically increments its
value when keyed in the animation player.

To avoid code duplication, I made the frames properties use the actual
PROPERTY_HINT_RANGE and introduced a PROPERTY_USAGE_KEYING_INCREMENTS
usage flag instead.
2019-07-25 09:29:51 +02:00
Rémi Verschelde d15cf7b672
Merge pull request #30576 from qarmin/lgtm_coverage
Changed some code reported by LGTM and Coverity
2019-07-20 12:00:13 +02:00