On 25-Mar-06, at 3:56 PM, Mike Woodworth wrote:
On Mar 25, 2006, at 3:42 PM, Frank Condello wrote:
On 25-Mar-06, at 4:07 AM, Mike Woodworth wrote:
...
perhaps, you can send me a sample of this math done as scalar
operations, and i'll port it to my class? then we can see if
there's any advantage.
Lo's example should do:
newvec = veca + (vecb - veca) * scalar
...
so all 3 floats have the same operation performed? so vecb
{xa1,ya1,za1,xa2,ya2,za3,...} + veca{xb1,yb1,zb1,xb2,yb2,zb2} = {xa1
+xb1,ya1+yb1,za1+zb1,xa2+xb2,ya2+yb2,za2+zb2} ?
Yup.
if so, option 2 will likely be *much* faster than scalar math in rb
loops.
I'm talking about plugin code exclusively - we've already given up on
vector array math in Rb ;)
sure, it might not be much faster than a plugin, but it will still
likely be on par. my time tests on similar vectorized code usually
shows a 10x speed increase.
This may be worth investigating further in that case...
What I envision are generic memoryblock extensions that can be mapped
to vDSP functions where appropriate e.g.:
blockResult.VecAdd( blockA, blockB, vecSize, [start], [end] )
This VecAdd extension would add each member of blockA and blockB and
store the result in blockResult. vecSize would be the number of
members in each vector, and start/end would be optional byte offsets
within the blocks (if end is omitted then sized blocks are expected,
and will be processed from start to block.Size-1).
These methods would assume each member is a 4 byte float. Given this,
the plugin can check if vecSize is 4 members and pass the data to
vDSP wholesale, or decide to work on a padded copy, or just do the
math itself.
VecAdd, VecSub, and VecMult (vec*scalar) methods would be enough to
be useful, but more exotic combinations (VecAddMult) and Matrix
methods (VecMultMat4x4) plus Double precision versions (VecAddD)
would help flesh it out ;)
I intended to do this myself at some point but my current game
project doesn't use mesh animation so it's not an immediate concern.
I'd certainly be happy to see someone else take this on in the meantime.
Frank.
–––––––––––––––––––––––––––––––––
Open Source RB Goodies and Shareware
<http://developer.chaoticbox.com/>
<http://www.chaoticbox.com/>
–––––––––––––––––––––––––––––––––
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|