Commit Graph

86 Commits

Author SHA1 Message Date
Jaroslaw Palczynski
2c1bbfc11d [GitHub] 480 : FMath::GetReflectionVector(Dir,SurfaceNormal), For Reflecting Lasers off Mirrors and Projectile Bounces
TTP 348794

#codereview Robert.Manuszewski

[CL 2323910 by Jaroslaw Palczynski in Main branch]
2014-10-09 06:26:13 -04:00
Zak Middleton
edcb16966e #ue4 - Add FVector::Coincident(A, B, Tolerance) to see if two normal vectors are coincident within a tolerance (nearly parallel and pointing in the same direction).
- Add tolerance param to FVector::Parallel.

[CL 2323171 by Zak Middleton in Main branch]
2014-10-08 16:12:51 -04:00
Zak Middleton
34723d8ecc #ue4 - Add Vector functions: ProjectOnToNormal(), VectorPlaneProject()
[CL 2321936 by Zak Middleton in Main branch]
2014-10-07 18:14:53 -04:00
Zak Middleton
a836c6215b #docs - Documentation for quaternions, explaining order of composition during multiplication.
[CL 2316656 by Zak Middleton in Main branch]
2014-10-01 18:00:51 -04:00
Zak Middleton
9bcccbc819 #docs - Fix mistaken comments about composed transform order of transforms.
#codereview Wes.Hunt

[CL 2316354 by Zak Middleton in Main branch]
2014-10-01 14:50:01 -04:00
Michael Noland
cf61cf2c85 Core: Coding-standards fixes (TypeName [*|&] VariableName -> TypeName[*|&] VariableName)
[CL 2316335 by Michael Noland in Main branch]
2014-10-01 14:40:06 -04:00
Zak Middleton
8780c83f92 #docs - FTransform class comments expanded to include description of how transformations are applied and composed. Similar changes to KismetMathLibrary::ComposeTransforms() as well.
[CL 2316228 by Zak Middleton in Main branch]
2014-10-01 13:24:44 -04:00
Richard TalbotWatkin
e10d4ebf9c Corrected widget scale behaviour in the case that any scale component is negative.
Const-corrected FVector::GetSignVector.
#ttp 347989 - Editor: Uniform scaling is broken on mehes where one of scaling values is negative
#branch UE4
#proj Runtime.Engine, Runtime.Core
#reviewedby Matt.Kuhlenschmidt

[CL 2314204 by Richard TalbotWatkin in Main branch]
2014-09-30 11:36:23 -04:00
Zak Middleton
870523b466 #docs - Minor cleanup to FMatrix, FQuat.
[CL 2313540 by Zak Middleton in Main branch]
2014-09-29 18:07:17 -04:00
Nick Darnell
b7d652534c UMG - Fixing an issue with render transforms having the ability to generate infinity when numerical percision just happens to work out.
[CL 2309671 by Nick Darnell in Main branch]
2014-09-25 09:21:02 -04:00
Wes Hunt
d782e8722e Added IsIdentity() for FTransform2D and FMatrix2x2.
[CL 2307463 by Wes Hunt in Main branch]
2014-09-23 17:20:57 -04:00
Zak Middleton
af100ae49c #docs Improved docs for FVector, FVector2D.
[CL 2306248 by Zak Middleton in Main branch]
2014-09-22 19:21:04 -04:00
Zak Middleton
586d5466cf #docs - Fix some instances of "i.e." in comments terminating the short description in doxygen comments.
[CL 2303169 by Zak Middleton in Main branch]
2014-09-18 17:24:29 -04:00
Wes Hunt
69cbf8177d Implement GetTypeHash(FVector4) for use in hashing functiond (and GetTypeHash(FLineaerColor) to get around ambiguities that introduced).
* Doing so exposed an ambiguity in GetTypeHash(FLinearColor) because previously it was relying on an implicit conversion to FColor. Once an overload for FVector4 was provided, it became ambiguous because there is ALSO an implicit conversion to FVector4!
* Resolved this by implementing GetTypeHash(FLinearColor) directly instead of relying on implicit conversion to FColor.
* This exposed a situation where SDataGraph inlined a local definition of GetTypehash(FLinearColor), and was now in conflict with the real, global one.
  * This was a nono in the first place because depending on how UBT decided to combine cpp files, this could CHANGE THE MEANING of GetTypeHash(FLinearColor)!!!
  * Turns out that the function was completely unused in that file anyway, so never needed to be added in the first place.Thus, I removed it.
  * Arguably, the implementation in SDataGraph is better, but I left the old way so as not to change the meaning of any existing serialized hashes of colors that might be in data files.
#codereview:rob.manuszewski,Jaroslaw.Surowiec

[CL 2302959 by Wes Hunt in Main branch]
2014-09-18 16:43:05 -04:00
Wes Hunt
fd1ec3744a Remove stale comments on GetTypeHash for FVectors.
[CL 2302928 by Wes Hunt in Main branch]
2014-09-18 16:42:03 -04:00
Thomas Sarkanen
e0b9261c6a FMath::LineBoxIntersection() parameter simplification
GitHub pull request #430

https://github.com/EpicGames/UnrealEngine/pull/430/

Added overloaded verison of LineBoxIntersection that calculates Direction.Reciprocal() itself.

reviewed by James.Golding

[CL 2297951 by Thomas Sarkanen in Main branch]
2014-09-15 06:59:57 -04:00
Steve Robb
ee375abe53 LoadVector3* macros replaced with their componentwise equivalents from UnrealMathFPU.h to prevent GuardMalloc reports and/or page faults.
#codereview robert.manuszewski,gil.gribb,mike.troughton,michael.trepka

[CL 2280409 by Steve Robb in Main branch]
2014-09-01 08:48:53 -04:00
Dan Oconnor
f4e55cf9d9 Integration of 388 from user moritz-wundke - New interpolation methods in the math library, exposed to blueprints via custom node
[CL 2278367 by Dan Oconnor in Main branch]
2014-08-29 19:22:18 -04:00
Wes Hunt
71db3f3bad Change 2122846 on 2014/07/01 00:51:24 by Wes.Hunt@WHUNT-UE4-MAIN
#BUN UnrealMath updates
	* added RotationAboutPointMatrix
	* Added static Make() methods for the various derived FMatrix types. Allows single expressions that return an FMatrix so we don't have to rely on implicit conversion (which will break some generic programming).
	* Simplified the implementation of FQuat::MakeFromEuler.

Change 2122848 on 2014/07/01 01:04:31 by Wes.Hunt@WHUNT-UE4-MAIN

	Added SlateLayoutTransform to store a 2D translation and uniform scale (for FGeometry).
	#BUN Added SlateTransformCalculus for handling arbitrary transform manipulation. See documentation in header.

Change 2123889 on 2014/07/01 17:12:40 by Wes.Hunt@WHUNT-UE4-MAIN

	Remove unncessary use of FGeometry.

Change 2221407 on 2014/07/16 17:58:20 by Wes.Hunt@WHUNT-UE4-MAIN

	TransformCalculus changes
	* Move 2D versions of functions into SlateLayoutTransform header to separate it from the base 3D stuff.
	* FSlateLayoutTransform is scale then translate now instead of translate then scale.
	* TransformPosition -> TransformPoint
	* Added a version of Concatenate taking 4 transforms.
	* Update docs.

Change 2221408 on 2014/07/16 17:58:39 by Wes.Hunt@WHUNT-UE4-MAIN

	Adjustments to Slate headers and PCH

Change 2221409 on 2014/07/16 17:59:07 by Wes.Hunt@WHUNT-UE4-MAIN

	Transform calculus support for SlateRects

Change 2221459 on 2014/07/16 18:41:13 by Wes.Hunt@WHUNT-UE4-MAIN

	#BUN SWindow changes
	* Added GetLocalToScreenTransform. (Screen space == Desktop space)
	** Basically contains the ApplicationScale and Window offset from the desktop.
	* Added GetLocalToWindowTransform (Window space == Desktop space without the window offset)
	* Added GetClientRectInScreen
	** Allows code to know exactly WHERE the client rect is in the window.
	* Refactored GetWindowGeometryInScreen and GetWindowGeometryInWindow to use the new methods above.
	* SPopupLayer::OnArrangChildren refactored to clarify transformational spaces and use transformation calculus to do the work.
	** This fixes PopupLayer to correctly account for the scale of the widget it is presenting a popup for.
	** MenuAnchors that that create new SWindows still do no correctly account for scale.

Change 2221464 on 2014/07/16 18:45:25 by Wes.Hunt@WHUNT-UE4-MAIN

	Render Transforms initial checkin. Lots of cleanup to do, but this is functionally working for all basic widgets and draw elements in slate. Main feature todos:
	* restore pixel snapping.
	* handle clipping in the presence of rotation.

Change 2226298 on 2014/07/21 21:22:46 by Wes.Hunt@WHUNT-UE4-MAIN

	Use a better method to get the window's rectangle.

Change 2227809 on 2014/07/22 20:41:57 by Wes.Hunt@WHUNT-UE4-MAIN

	Add 2D version of TransformVector to SlateTransform.

Change 2232085 on 2014/07/25 16:32:15 by Wes.Hunt@WHUNT-UE4-MAIN

	Implement CPU pixel snapping even under render transform. This is pretty CPU intensive, but a reasonable POC.

Change 2232090 on 2014/07/25 16:33:10 by Wes.Hunt@WHUNT-UE4-MAIN

	Font cache fixes for padding.
	* Add 1 pixel of padding around all fonts.
	* Fix font cache to properly handle padding
	* Fix font cache to handle texture elements of zero size with non-zero padding.

Change 2232350 on 2014/07/25 19:50:11 by Wes.Hunt@WHUNT-UE4-MAIN

	#BUN Updated FSlateTextureAtlas padding logic.
	* Added ESlateTextureAtlasPaddingStyle which lets you choose from three atlasing padding styles:
	  * NoPadding - don't apply any padding (used to be Padding == 0).
	  * DilateBorder - copy border edges to apply 1-pixel padding (used to be Padding == 1).
	  * PadWithZero - expand 1-pixel border and fill it with zeros (new style).
	* removed notion of Padding > 1 pixel from atlasing. It wasn't useful as we don't support mips or aniso filtering.
	  * Also the existing code didn't actually handle Padding > 1.
	* FontCache now uses PadWithZero padding so upon zooming text, the edges get smoother.

Change 2237962 on 2014/07/31 02:17:28 by Wes.Hunt@WHUNT-UE4-MAIN

	TransformCalculus tweak.
	* Core Concatentate(T,T) no longer assumes the return type is T. Uses decltype(T.Concat(T)) instead.

Change 2237964 on 2014/07/31 02:21:31 by Wes.Hunt@WHUNT-UE4-MAIN

	#BUN Added a full suite of transform types for 2D transformations that are transform calculus aware:
	* FSlateScale2D
	* FSlateShear2D
	* FSlateQuat2D
	* FSlateMatrix2x2

	Added appropriate overloads and ConcatenateRules for all combinations, making them compatible with FSlateTransform and FSlateLayoutTransform.

	FSlateTransform is now implemented in terms of a decomposed Matrix3x2.

Change 2237972 on 2014/07/31 02:30:45 by Wes.Hunt@WHUNT-UE4-MAIN

	Remove 4x4 matrix from FSlateTransform

Change 2238004 on 2014/07/31 03:11:42 by Wes.Hunt@WHUNT-UE4-MAIN

	FSlateTransform -> FSlateRenderTransform.

Change 2238714 on 2014/07/31 15:16:18 by Wes.Hunt@WHUNT-UE4-MAIN

	#BUN Moved TransformCalculus into Core/Math.
	* Split into TransformCalculus, 2D, and 3D support.
	* FSlateRenderTransform is now just a typedef.
	* Renamed 2D transform types to remove "Slate" from their name.

Change 2240437 on 2014/08/01 19:08:59 by Wes.Hunt@WHUNT-UE4-MAIN

	Restore funky logic in deprecated FGeometry::MakeChild implementations.
	* legacy FGeometry::MakeChild functions took OffsetFromParent in the local space of the widget. This therefore CANNOT be the layout transform offset, because that needs to be in parent space for the transform of P * S + T to work correctly.
	* Therefore, the legacy functions now expect the ChildOffset to be in child space and re-apply the child scale to put them back into parent space.
	* This fixes the NodePanels to properly handle zooming around the mouse cursor point.

Change 2242769 on 2014/08/04 13:44:33 by Wes.Hunt@WHUNT-UE4-MAIN

	remove local layout transform storage from FGeometry.

Change 2242771 on 2014/08/04 13:45:59 by Wes.Hunt@WHUNT-UE4-MAIN

	Update Declarative syntax support to call it RenderTransform instead of Transform.

Change 2245872 on 2014/08/06 14:45:44 by Wes.Hunt@WHUNT-UE4-MAIN

	#BUN Add GetBottomRight function to FSlateRect.

Change 2246129 on 2014/08/06 17:32:04 by Wes.Hunt@WHUNT-UE4-MAIN

	SThrobber now supports render transforms.
	Key is to not use deprecated members of FPaintGeometry, which should be treated as immutable (at least public members shouldn't be modified withotu modifying the new members as well).

Change 2247782 on 2014/08/07 19:12:57 by Wes.Hunt@WHUNT-UE4-MAIN

	Clipping widgets now works under render transforms, FPaintGeometry legacy fixes.
	* Expanded FSlateVertex by 2 bytes to pass in local position.
	* Change clipcoords to be passed in local space.
	* Remove WorldPosition interpolator. Replaced by LocalPosition interpolator.

	FPaintGeometry fixes
	* FPaintGeometry now takes Size in LocalSpace unless using a legacy ctor. Avoid transform-and-back that was occurring when creating from an FGeometry, which already had it in local space, and rendering, which now wants it in local space.
	* FPaintGeometry again supports mutability when using legacy members (like DrawPosition). This allows legacy code to mutate an FPaintGeometry, which is committed to a render transform right before rendering.Hacky, but allows legacy code that treated FPaintGeometry as a plain-old-struct to work.
	* Removed a legacy ctor of FPaintGeoemtry that was not being used.

	Misc:
	* Turned off pixel snapping code in ElementBatcher because the FSlateVertex is doing it during construction.
	  * Still texture filtering artifacts to figure out, so the last word has not been spoken on this yet!
	* Tweaked FGeometry::MakeRoot to use the non-render transform ctor since it doesn't need to use it.
	* Removed /*WindowSpace*/ Size member from SlateDrawElement.
	* SlateDrawElement::GetRotationPoint vastly simplified by using Local space.
	* Moved slate cycle counters back to the top of the function in ElementBatcher.
	* Uninlined FSlateVertex ctors so I can tweak their rounding rules without a full recompile.

Change 2247790 on 2014/08/07 19:20:01 by Wes.Hunt@WHUNT-UE4-MAIN

	SSlider no longer uses MakeRotatedBox, correctly handles render transforms.
	* Now uses a render transform to draw a vertical slider handle instead of MakeRotatedBox.
	* Since we don't support layout transforms, we also have to adjust the clip rect to account for the render-only transform, and make it act like a layout transform.

Change 2249106 on 2014/08/08 19:13:21 by Wes.Hunt@WHUNT-UE4-MAIN

	Slate clipping now done in window space again.
	* This addresses subpixel jittering that occured on otherwise stable clip rects because local space was moving underneath, and transforming the clip rect to local space created occasional rounding errors.
	* Implemented a vectorized point-in-parallelogram check in the pixel shaders to do this. Now pass clip rect in slightly differently, and moved to a float16 to allow better clip precision under rotation. But the vertex data remains the same size.
	* Moved some more common transform work into FSlateVertex constructor to save duplication.
	* Removed construction of local clip rect as it's no longer needed except for text rendering.
	* Hoisted construction of local clip rect out of the text drawing character loop (whoops).
	* Precompute InverseLayoutTransform in draw code as we use that a lot now.
	* Fixed OGL renderer to work.

Change 2249123 on 2014/08/08 19:45:19 by Wes.Hunt@WHUNT-UE4-MAIN

	SProgressBar no longer uses a temporary PaintGeometry to create the inner clipping rect for drawing, it directly inflates the clipping rect now. Also tried to adjust the coords to reduce jitter in the one-pixel padding.

Change 2251914 on 2014/08/11 16:26:12 by Wes.Hunt@WHUNT-UE4-MAIN

	Fixing HitTest 2.0 to work with latest code.
	* Added AppendTransform to FGeometry to preserve immutability of the struct.

Change 2253023 on 2014/08/12 10:30:23 by Wes.Hunt@WHUNT-UE4-MAIN

	Fixing Slate RHI Renderer to use new screenspace clipping with render transforms.

Change 2253090 on 2014/08/12 11:36:16 by Wes.Hunt@WHUNT-UE4-MAIN

	Fix SClippingHorizontalBox to use immutable FGeometry position. Also fix to properly support scale in when it needs to clip children.

Change 2253701 on 2014/08/12 17:48:06 by Wes.Hunt@WHUNT-UE4-MAIN

	#BUN Round viewport rect instead of trunc to match how slate does it now (fixes 1:1 pixel error on SViewports). Need to abstract slate rounding internals so clients don't have to guess.

Change 2255403 on 2014/08/13 19:08:25 by Wes.Hunt@WHUNT-UE4-MAIN

	#BUN Added LayoutGeometry class.

Change 2255404 on 2014/08/13 19:10:40 by Wes.Hunt@WHUNT-UE4-MAIN

	#BUN Made FGeometry public members const to catch all mutating uses of them. Added some hacks in the implementation to make it backward compatible.

	Removed the AccumulatedLayoutTransform, since it was just a copy of AbsolutePosition and Scale. Now all code creates the layout transform on the fly from those members. Still functionally the same.

	Added support for MakeChild using FLayoutGeometry.

Change 2255405 on 2014/08/13 19:12:39 by Wes.Hunt@WHUNT-UE4-MAIN

	Changed SSplitter and Splitter2x2 to use FLayoutTransforms where possible. Now only calls ArrangeChildren() when rendering, avoiding accumulating the layout transforms and storing the render transforms altogether.

Change 2265162 on 2014/08/20 18:24:04 by Wes.Hunt@WHUNT-UE4-MAIN

	Implement MakeRotatedBox in terms of a render transform. Remove all shader code associated with rotating.

Change 2268034 on 2014/08/22 17:40:05 by Wes.Hunt@WHUNT-UE4-MAIN

	More 2D transform cleanup.
	* Removed a bunch of todo comments from the code, and converted them to more of a final form for main.
	* #BUN Removed FGeometry::CenteredPaintGeometryBelow as it was misleading, and users of the function were forced to mutate the resulting FPaintGeometry.
	* #BUN Removed FGeometry::GetRect() because it returned a rect in a weird space if the local scale != 1. Only one place in the code actually used it.

Change 2268096 on 2014/08/22 18:12:41 by Wes.Hunt@WHUNT-UE4-MAIN

	Clean up more stuff in FPaintGeometry.
	* #BUN Removed ToSlateRect and Identity().
	* Removed storage of accumulated layout transform, since DrawPosition and DrawScale implicitly stored it.
	* Removed a bunch of todo comments and converted them to a more final form.

Change 2270989 on 2014/08/25 15:48:46 by Wes.Hunt@WHUNT-UE4-MAIN

	Add support for Concatenate with 5 transforms.

Change 2271394 on 2014/08/25 19:12:53 by Wes.Hunt@WHUNT-UE4-MAIN

	#BUN Added an OffsetBy function to FSlateRect

Change 2271395 on 2014/08/25 19:13:56 by Wes.Hunt@WHUNT-UE4-MAIN

	Added a version of FSlateRotatedRect that uses regular floats, also added IsUnderLocation ToBoundingRect function for overlap testing.

Change 2271396 on 2014/08/25 19:14:38 by Wes.Hunt@WHUNT-UE4-MAIN

	HitTest 2.0 now works with render transforms.

#codereview:matt.kuhlenschmidt,nick.atamas

[CL 2276499 by Wes Hunt in Main branch]
2014-08-28 14:29:46 -04:00
James Golding
8ba7c91ea3 [GitHub] Add CInterpTo for linear colors, exposed in BP
https://github.com/EpicGames/UnrealEngine/pull/331 (EverNewJoy)

[CL 2272004 by James Golding in Main branch]
2014-08-26 07:15:54 -04:00
James Golding
5084c81d13 [GitHub] Add better comments for LinePlaneIntersection
https://github.com/EpicGames/UnrealEngine/pull/352 (error454)

[CL 2271987 by James Golding in Main branch]
2014-08-26 06:31:15 -04:00
Zak Middleton
a08febdb2d #ue4 - Clean up comments in FTransform and FQuat, and deprecate FTransform::GetTranslationV, GetScaleV, GetRotationV.
- FTransform empty constructor actually initializes to identity (comment was wrong and said otherwise).

[CL 2270907 by Zak Middleton in Main branch]
2014-08-25 15:07:01 -04:00
Martin Mittring
a4b7f318b4 * fixed TTP 343328 RENDERING: ScreenSpaceSubsurface Scattering: Unexpected behavior when altering Subsurface Color
* fixed TTP 343332 RENDERING: ScreenSpaceSubsurface Scattering: Adjusting Subsurface Color above 1 creates glow effect

[CL 2267946 by Martin Mittring in Main branch]
2014-08-22 17:11:01 -04:00
Ben Marsh
e9f8b8d3a1 Fixup multiline comments that are meant to be documentation. Need to start with /** for doxygen to parse them.
[CL 2265840 by Ben Marsh in Main branch]
2014-08-21 08:33:39 -04:00
Lina Halper
e513ea2300 Named FMatrix/FTransform unsafe Inverse to InverseFast, and InverseSafe,InverseSlow to Inverse as people often use Inverse as default function.
- Inverse was one of the main reasons of crashes via lots of functions. Seems making default Inverse to be safer version seems better.

[CL 2255081 by Lina Halper in Main branch]
2014-08-13 15:29:41 -04:00