> I don't see what good using another table would do, since the 
> vectors are changing with each iteration of the plasma.

i am not sure i uploaded the source code to my plasma, but, i know 
daniel morais did a decent one as well :) if your doing a sinus table, 
you pretty much should be doing:

  pix = (a + b + c + d) / 4;   
  write pix to screen

it has been a while since i looked at it (i wrote the plasma demo a 
*long* time ago). i know for sure, the sinus tables are not modified 
in the main loop :) to get the 'wave' effect, you can modify the 
*offset's* (hint)

i got bored :) - so, here is the source:

---
        t1=p1;
        t2=p2;
        for (y=40; y--; )
        {
          t3=p3; t4=p4;
          
          for (x=40; x--; )
          {
            color = 
              (cosinus[t1] + cosinus[t2] + 
               cosinus[t3] + cosinus[t4]) & 0xff;
            if (color == 0) color = 1;
            color |= color << 8;
            color |= color << 16;
            color |= color << 24;
            
            *ptr1++ = color; *ptr2++ = color;
            *ptr3++ = color; *ptr4++ = color;
            
            t3+=2; t4+=(t3&3)-1;
          }
          ptr1 += 120; ptr2 += 120;
          ptr3 += 120; ptr4 += 120;

          t1-=2; t2+=1; 
        }
        p1+=1; p2-=3; p3+=4; p4+=2;
---

so, nothing complex there really :) the [] references could probably 
be sped up a bit :) might compile better with this code:

            color = 
              (*(cosinus+t1) + *(cosinus+t2) + 
               *(cosinus+t3) + *(cosinus+t4)) & 0xff;

might make it a bit faster :)

---
Aaron Ardiri                           [EMAIL PROTECTED]
CEO - CTO                                              +46 70 656 1143
Mobile Wizardry                         http://www.mobilewizardry.com/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to