Commit Graph

447 Commits

Author SHA1 Message Date
Lasse Öörni 50fbdbd12e UIComponent AngelScript API fix, AS example and shutdown crash fix. 2017-08-23 22:02:51 +03:00
Lasse Öörni df669fbe1b Restore earlier HelloGUI sample, instead create separate Hello3DUI which demonstrates 3D UI render to texture. Move getting viewport related to scene from Scene to Renderer, so that Scene doesn't have to know about Renderer unnecessarily. Refactor the internal UI render calls related to rendertarget use. 2017-08-23 21:15:56 +03:00
Lasse Öörni d95aae9477 Merge remote-tracking branch 'rokups/feature/3D-UI' 2017-08-23 19:30:27 +03:00
Lasse Öörni fece9d6cc4 Fix uninitialized variables in InverseKinematics sample. Closes #2081. 2017-08-20 12:24:05 +03:00
Rokas Kupstys 6fc2c19baa More code cleanups.
* Moved `UIComponent::GetViewport()` to `Scene` class.
* Simplified resource initialization of `UIComponent` and removed need of overriding `IsEnabled()`.
* Renamed `UIComponent::GetElement()` to `GetRoot()` to be more consistent with UI subsystem.
* Removed ability to set root UI element to `UIComponent`, instead to add UI elements should be added as children to element renturned by `UIComponent::GetRoot()`.
* Cleaned up debug rendering in HelloGUI sample. Debug data is now rendered after pressing F2.
2017-08-20 10:55:58 +03:00
Rokas Kupstys 16ee7e1121 * Changed UIComponent::IsValid() to overriden UIComponent::IsEnabled()
* Separated batches and vertex buffers of normal UI and UI rendered to texture.
* Cleaned up `Render()` method adding additional `surface` parameter to render into. Passing null renders on to screen.
Support for rendering UI to texture.

This change adds support for rendering GUI into a texture. This is achieved by adding `UIComponent` component to `Node`. `UIComponent` overrides material of `Node`'s `StaticModel`. UI subsystem is changed so that batches belonging to UI elements owned by `UIComponent` are rendered into a texture that is also contained in `UIComponent`. Input is handled by UI subsystem, so anything that worked on normal UI will work on UI rendered on to 3D object. This required a minor change for input handling. Previously "screen" was considered surface of entire window. Now screen is considered area of root_element_position + root_element_size. This is fully backwards-compatible.

There is one issue i am unable to solve: since on OpenGL texture coordinates start from bottom-left corner a workaround is needed. Texture is flipped by projection matrix, however it breaks scissor test. I do not know how to properly fix it therefore scissor test is disabled when rendering into texture on OpenGL. Issue is clearly visible when scrolling a `ListView` in `HelloGUI` sample when UI is rendered on to a cube.

Other changes: lua and angelscript bindings, HelloGUI sample can toggle between rendering on screen or rendering on cube, added a ListView to HelloGUI sample window. `UI::DebugDraw()` support.
2017-08-19 20:33:00 +03:00
Eugene Kozlov ef3b6efd96 Add streaming mode to Lua samples 15_Navigation and 39_CrowdNavigation. Minor changes. 2017-08-08 01:34:57 +03:00
Eugene Kozlov 4403b99cbd Remove separate navigation streaming samples. 2017-08-08 01:34:57 +03:00
Eugene Kozlov f84e9d1392 Add streaming mode to C++ samples 15_Navigation and 39_CrowdNavigation . Fix using outdated navigation mesh data for streaming. 2017-08-08 01:34:57 +03:00
Eugene Kozlov db7d92e419 Fix stuck CrowdAgent-s after NavigationMesh::AddTile. 2017-08-08 01:34:56 +03:00
Eugene Kozlov 6f57b5b4e5 Add events for navigation mesh tile operations. Fix obstacles rendering into newly added tiles. 2017-08-08 01:34:56 +03:00
Eugene Kozlov 214dcc6638 Fix C++98 compilation. 2017-08-08 01:34:56 +03:00
Eugene Kozlov e85e9d897c Add support of sparse navigation meshes and dynamic tile management. Add two examples based on 15_Navigation and 39_CrowdNavigation. 2017-08-08 01:34:56 +03:00
Eugene Kozlov e963e89f47 Copy 15_Navigation and 39_CrowdNavigation samples. 2017-08-08 01:34:56 +03:00
TheComet 4f96c7c29f Refactoring the 'feature' setters and getters into a single method. Renaming a few things to be more consistent. Adding Documentation 2017-07-28 18:36:57 +02:00
TheComet 4a6d86804e Fixing bugs, updating script bindings and sample code 2017-07-28 03:42:16 +02:00
Iain Merrick 0450bcd11e Add configurable oversampling to improve subpixel font rendering (#1953)
Subpixel-positioned text looks blurry, due to bilinear filtering of the
underlying texture. The basic idea here is to stretch the font glyphs
horizontally to increase the sharpness at subpixel positions. The
stretched images need to be smoothed to avoid aliasing artifacts; this
is done in FontFaceFreeType::BoxFilter().

Glyphs are always pixel-aligned vertically, so no vertical oversampling
is needed.

To make this feature comprehensible (I hope!) I've removed the
'subpixelGlyphPositions' flag and replaced it with a couple of values:
'fontSubpixelThreshold' sets the point at which subpixel positioning
kicks on, and 'fontOversampling' controls the amount of stretching.

The default values are 12pt text and 2x oversampling. These are fairly
conservative settings, which should improve small text without wasting
a lot of memory.

Note that when the font hint level is NORMAL (the default), subpixel
positioning and oversampling are both disabled. So, this feature doesn't
change any default behavior, and applies some hopefully sensible values
if the hint level is set to LIGHT or NONE.
2017-07-03 11:21:47 -05:00
Iain Merrick e603eed814 Add a 'subpixel glyph positions' option to UI (#1953)
When this option is enabled, text will be formatted with subpixel
(fractional) positions on the x-axis. Positions on the y-axis are
still pixel-aligned.

Note that this option has no effect if the hinting level is set
to FONT_HINT_LEVEL_NORMAL, as each glyph is rounded to an integral
pixel size by the hinter. It only makes a different if the hinting
mode is LIGHT (vertical hinting only) or NONE.

With subpixel positioning, the output will look blurrier due to
texture filtering. TODO: Add horizontal oversampling to improve
sharpness. That needs extra memory so it should be configurable.
2017-06-20 17:04:56 -05:00
Iain Merrick 1e3a1edd45 Change font size to a float (closes #1952)
This commit changes the 'pointSize' parameter in Font, Text
and Text3D from an int to a float, allowing e.g. 14.5pt text.
Note that when hinting is enabled, font metrics are snapped
to pixel boundaries, so the effect may be hard to see unless
you also set UI.FontHintLevel to LIGHT or NONE.

This is a change to the public API, but existing code (including
scripts) should compile and run as before.
2017-06-18 22:27:59 -05:00
Lasse Öörni b9c3199a25 Merge remote-tracking branch 'iainmerrick/font_hinting' 2017-06-17 22:17:59 +03:00
Lasse Öörni 9ef8ac9ba9 Tabs to spaces. 2017-06-17 00:09:05 +03:00
Lasse Öörni e5dcfdafbb Merge remote-tracking branch 'dragonCASTjosh/master' 2017-06-17 00:08:03 +03:00
Iain Merrick 282f250e3a Add UI.FontHintLevel property
There are three levels: NORMAL (the default), LIGHT and NONE.
The LIGHT level makes FreeType align font outlines to pixel
boundaries vertically, but not horizontally.
2017-06-15 15:30:28 -05:00
Iain Merrick a476c43a24 Add a 'Typography' sample program
Displays text in various sizes, with checkboxes to play with settings
that affect the way text is rendered:
- Color (white-on-black versus black-on-white)
- Autohinter
- sRGB output conversion (not available on all platforms)
2017-06-13 13:40:22 -05:00
dragonCASTjosh eebc9f04c3 Fixed sphere light issue 2017-06-13 06:01:59 +01:00
Pengfei Li d9d98cd35b restore the commits in Sample.inl 2017-06-07 18:30:49 +03:00
Pengfei Li 353fc4d7b3 Consider the initial position for the borderless window 2017-06-07 18:30:47 +03:00
1vanK fa767d1dc1 40_Localization: Center mouse on start 2017-05-05 19:39:45 +03:00
Lasse Öörni d4df1937c8 Line breaks formatting for RaycastVehicle demo code. 2017-04-29 20:33:36 +03:00
Lasse Öörni 13cfad66ef RaycastVehicle code / comments formatting and AngelScript fix. RegisterRaycastVehicleLibrary function removed and class registration performed as part of Physics library initialization instead. 2017-04-29 20:21:55 +03:00
Sergey Lapin 2eb3a1183a RaycastVehicle C++ demo code 2017-04-25 13:45:09 +03:00
Yao Wei Tjong 姚伟忠 5b1fdb8852 Also exclude the IK sample when the URHO3D_IK option is disabled. 2017-04-13 17:13:41 +08:00
Yao Wei Tjong 姚伟忠 ec102aadfc Reorder initialization order to suppress Xcode warnings. 2017-04-08 23:52:44 +08:00
Yao Wei Tjong 姚伟忠 2efbcd570c Rename "define_resource_files" macro to "define_resource_dirs".
Enhance it to take extra arguments for specifiying target-specific resource directories and other extra for Web platform support.
Close #809.
2017-04-05 18:16:36 +08:00
Yao Wei Tjong 姚伟忠 8c9122ce25 Minor refactoring and cleaning on IK component's code. 2017-04-01 21:28:27 +08:00
Alex Murray 68f8d23411 Fixing issues raised by Mike3D (incorrect offset in sample, exposing auto solve) 2017-03-22 14:23:14 +01:00
TheComet 327965a40c Fixing build on windows, fixing segfault in release builds 2017-03-22 02:15:32 +01:00
TheComet 8fc0aa2866 Lua script bindings and CPP sample 2017-03-21 15:56:47 +01:00
TheComet 2be9286d38 Wrote AngelScript bindings, I'm still considering renaming a few things here and there 2017-03-21 15:56:47 +01:00
Enhex 516fcf18e5 Updated sound effects sample to use SetAutoRemoveMode() instead of nodes. 2017-03-14 23:58:59 +02:00
Lasse Öörni 2821837f2a Remove zero damping from Urho2DConstraints sample to eliminate jittering behavior. Closes #1816. 2017-02-11 15:33:09 +02:00
Mateus Vendramini 78b77ed48f Fixing small typos in comments 2017-02-05 17:33:01 -02:00
Lasse Öörni 11f099c655 Minor style edits. Use position instead of iterator in autocomplete to be safe against iterator invalidation. Add Lua binding to autocomplete. Add short description of the new feature being demonstrated in sample 26. 2017-01-01 22:35:16 +02:00
Enhex f0e05cb7e1 Console auto complete 2017-01-01 22:35:14 +02:00
urho3d-travis-ci ee054a1507 Travis CI: bump copyright to 2017.
[ccache clear]
2017-01-01 13:01:31 +00:00
1vanK 9d7dceb2f2 06_SkeletalAnimatin: fix running out bounds, lighting correction
Fix excessive specular on Kachujin texture
2016-12-30 13:58:41 +03:00
Lasse Öörni 299dbf803b Squashed commit of the following:
commit 8b67f0edcb9b588c70df1676bdbfa4853e50c3aa
Author: Lumak <lumak5309@gmail.com>
Date:   Thu Dec 29 10:18:40 2016 -0800

    corrected to stonetiled mat

commit c17d68b1e0ed5435c492a26ed8010c4f4aa708eb
Author: Lumak <lumak5309@gmail.com>
Date:   Thu Dec 29 10:14:20 2016 -0800

    removed proto mat/texture

commit 1c322d19556d7796c4958a920203e5b1c80af843
Author: Lumak <lumak5309@gmail.com>
Date:   Wed Dec 28 12:18:59 2016 -0800

    replaced the Jack with Jill in 06_SkeletalAnimation sample
2016-12-29 20:39:28 +02:00
Lasse Öörni fef73ba4c4 Squashed commit of the following:
commit 06f4d6afab933e32eaf3428dd080766b11a87f82
Author: Lasse Öörni <loorni@gmail.com>
Date:   Sun Dec 18 18:31:39 2016 +0200

    Black variant of logo.

commit 8fa11f888de023fcc76f26908e2ea77ebfd3146b
Author: Lasse Öörni <loorni@gmail.com>
Date:   Sun Dec 18 17:12:14 2016 +0200

    New logo in Lua samples.

commit 1283e38db1164a1c1e5db7d1042feabf996031fb
Merge: 4062553 4f5a2ea
Author: Lasse Öörni <loorni@gmail.com>
Date:   Sun Dec 18 16:51:04 2016 +0200

    Merge remote-tracking branch 'Modanung/new-logo'

commit 4f5a2ea104feeac12b87d3fb89d116e1866c2513
Author: Modanung <frode@lindeijer.nl>
Date:   Sun Dec 18 05:36:37 2016 +0100

    Also replaced logo in angelscript samples

commit 7c6e5e90c4dc82705883806e46b0957a44fbc787
Author: Modanung <frode@lindeijer.nl>
Date:   Sun Dec 18 03:34:31 2016 +0100

    Changed logo in samples to fishbone logo
2016-12-18 18:48:39 +02:00
Lasse Öörni f65ca809e2 Merge remote-tracking branch '1vanK/master' 2016-12-10 15:22:28 +02:00
1vanK 2a703a5ab1 Add engine parameters const 2016-12-10 08:18:18 +03:00