-
-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flash.geom implementation interpolate, interpolateTo, pointAt, pointTowards #18495
base: master
Are you sure you want to change the base?
Conversation
implement interpolate interpolateTo pointAt extended version de- and recompose additional static function correct per default false... if set to true scale,skew and perspective are also interpolated.. removed stub for recompose quaternion, throws error when quaternion is erroneous added docblocks and some variable cleanup...
implement missing methods... additional method to set znear and zfar added...
added method pointTowards added docblock
i'm getting old... removed last arg correct
I didn't dig deeply into this yet, not sure if evilpie knows more about this area but here's some of my quick observations:
Some of the implementations changed a lot - can you clarify which ones are "this is a more accurate representation of what Flash does", and which ones are "this is my implementation, more accurate than Flash's"? |
Which missing methods? Without seeing example test cases where currently Ruffle shows incorrect results but the updated implementations are correct, it's hard to understand many of the changes. I also don't see |
Hey, welcome to the project and thanks for opening your first PR with us! We really appreciate it, and please don't feel discouraged by the review notes so far. It's all a process, and we just want things to be right :D I haven't gone over this fully so far but I have a few initial notes of feedback + questions:
|
correct AS:: => AS3::
i don't feel discouraged. this pull request is meant to be more a draft. my intension is not that you take the pull request 1:1 to ruffle... it needs someone to dive in and adapt the useful code parts, if needed...
but you need to understand it, to implement something in this area... i wanted to understand how matrix3d operations work in 3d space and playing arround with complex numbers makes no fun. so i decided to play arround in flash visually with it... i will provide more information for each section soon... |
added something i missed from last checkin
simple changes i made in the Matrix3D.as moved the import flash.geom.Orientation3D; to head of package... removed function checkOrientation(orientationStyle:String) and integrated it, in function decompose and recompose... renaming some variables e.g in public function appendRotation e.g public function transpose() main reason, better readability... |
lets start with per default flash does not take care for skew or perspective information which is embedded in the matrix this wont break any compatibilty... public function recompose the logic to apply scale direct on the rawData has been moved to the end of the method, so that skew and perspective can correctly be applied... from what i tested so far, this does not break any compatibilty additionally there is a possible check included when method is quaternion, if the given vector is really valid... both methods are now more generally useable and more correct... |
public static function get correct() per default the setting for ruffle is set to false (== do it the flash way, don't interpolate scale,skew perspective) when interpolating and the scale for both matrix is set to 1,1,1 when any matrix has a scale, flash does something that results in a litte different quaternion... public function interpolateTo logic is different to method interpolate, percent 0 means we start at the toMat public static function interpolate the method uses the method decompose to get all components for each matrix after interpolating each part, internal method recompose is used to build the new matrix a demo how this looks like in flash can be found here static method correct can be used to force a correct behaviour for interpolate... |
public function pointAt this is a prototype how it could work... the fun part here is that flash does not remove scale, skew or perspective Utils3D.as also a prototyp using Matrix3d.pointAt and Matrix3D.interpolate mainly a test when playing arround with interpolate... the different behaviour removing scale, leaving scale was the reason to implement the method function correct PerspectiveProjection.as a possible implementation how it could work... the next part if i find some time, i wanted to render this whole logic in ruffle... i'm pretty sure that for this we need a correct and complete decompose / recompose logic (the reason why i've extended these two methods) |
this is my first time opening a pull request...
i did some cleanup for different variable names and added the docblock information needed for debugging, rebuilding this methods mainly to understand how this could/should work...
here is an implementation for Matrix3D.as
static function interpolate
function interpolateTo
function pointAt (possible implementation)
extended version for re- and decompose including skew and perspective handling
there is an addition static method correct included to allow interpolation for scale,skew and perspective (per default false)
false == like flash does interpolation
the recompose method also includes a quaternion error message when the given vector is not correct...
and an additional switch
static function correct
if set to true interpolate will correctly include scale, skew and perspective
there is a helper function included function helperCustomRound, mainly for debugging reasons...
there is also an implementation for Utils3D.as
function pointTowards
i've played arround a little bit and the result is pretty nice... might be useful
also added PerspectiveProjection.as missing methods...
not really tested, but should be working...
some additional notes when playing with interpolate
the implementation in flash is wrong... and its a bad idea to mimic the behaviour for interpolation (mainly when using scale)
the quaternion calculation is not correct, which leads to slight differences in rendering...
for more information take a look here (testfiles also included there...)
airsdk/Adobe-Runtime-Support#3506