home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1908 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.sfu.ca!samy
  2. From: samy@news.sfu.ca (Sam Yee)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: TMapping again!
  5. Date: 24 Jan 1996 23:39:35 GMT
  6. Organization: Simon Fraser University
  7. Message-ID: <4e6fvn$ahf@morgoth.sfu.ca>
  8. References: <4dmnbq$pur@morgoth.sfu.ca> <DLL1MI.BqJ@si.hhs.nl>
  9. NNTP-Posting-Host: fraser.sfu.ca
  10. X-Newsreader: NN version 6.5.0 #5 (NOV)
  11.  
  12. (please e-mail to jeremym@wimsey.com)
  13.  
  14. Yep... a*b = exp(ln(a)+ln(b)) so use log lookups and exp lookups.
  15.  
  16. Say, per scanline, u=um*t+uc v=vm*t+vc du=dum*t dv=dvm*t
  17. since um, vm, dum, dvm are constant per polygon, you only need to
  18. calc ln(um), ln(vm), ln(dum), ln(dvm) once per polygon (using log2 lookup
  19. table on the highest most sig digits), and t is the distance from the
  20. user which is constant per scanline (for floors), so ln(t) only needs to
  21. be calculated once per scanline... 
  22.  
  23. per scanline:
  24. lnt=ln(t) ; use log2 lookup tables on most sig digits, and compensate
  25. u=uc+exp(lnt+lnum) ; use exp2 lookup table
  26. v=vc+exp(lnt+lnvm)
  27. du=exp(lnt+lndum)
  28. dv=exp(lnt+lndvm)
  29.  
  30. Poof.. No more multiplies...
  31.  
  32. jeremym@wimsey.com
  33. ------------------
  34. "Let he who has no sword sell his cloak and buy one." - Jesus, Luke 22:36
  35.  
  36.  
  37.  
  38.