- Timestamp:
- Mar 19, 2006, 5:42:31 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/cacaball.c
r616 r647 50 50 float i = 10.0, j = 17.0, k = 11.0; 51 51 int p, frame = 0, pause = 0; 52 double frameOffset[360 +80];52 double frameOffset[360 + 80]; 53 53 double frameOffset40[360]; 54 54 double frameOffset80[360]; … … 84 84 } 85 85 86 for(frame = 0; frame<360; frame++) { 87 frameOffset[frame] = frame * M_PI / 60; 88 frameOffset40[frame] = (frame + 40) * M_PI / 60; 89 frameOffset80[frame] = (frame + 80) * M_PI / 60; 90 } 91 86 for(frame = 0; frame < 360; frame++) { 87 frameOffset[frame] = frame * M_PI / 60; 88 frameOffset40[frame] = (frame + 40) * M_PI / 60; 89 frameOffset80[frame] = (frame + 80) * M_PI / 60; 90 } 92 91 93 92 /* Go ! */ … … 104 103 105 104 frame++; 106 if(frame>=360)107 frame=0;105 if(frame >= 360) 106 frame = 0; 108 107 109 108 /* Crop the palette */ … … 112 111 int t1, t2, t3; 113 112 double c1 = 1.0 + sin((double)frameOffset[frame]); 114 double c2 = 1.0 + sin((double)frameOffset40[frame]); 115 double c3 = 1.0 + sin((double)frameOffset80[frame]); 116 117 118 t1 = p < 0x40 ? 0 : p < 0xc0 ? (p - 0x40) * 0x20 : 0xfff; 113 double c2 = 1.0 + sin((double)frameOffset40[frame]); 114 double c3 = 1.0 + sin((double)frameOffset80[frame]); 115 116 t1 = p < 0x40 ? 0 : p < 0xc0 ? (p - 0x40) * 0x20 : 0xfff; 119 117 t2 = p < 0xe0 ? 0 : (p - 0xe0) * 0x80; 120 118 t3 = p < 0x40 ? p * 0x40 : 0xfff; 121 t1/=4; t2/=4; t3/=4; 122 123 124 r[p] = c1 * t1 125 + c2 * t2 126 + c3 * t3; 127 g[p] = c1 * t2 128 + c2 * t3 129 + c3 * t1; 130 b[p] = c1 * t3 131 + c2 * t1 132 + c3 * t2; 133 } 134 119 120 r[p] = (c1 * t1 + c2 * t2 + c3 * t3) / 4; 121 g[p] = (c1 * t2 + c2 * t3 + c3 * t1) / 4; 122 b[p] = (c1 * t3 + c2 * t1 + c3 * t2) / 4; 123 } 135 124 136 125 /* Set the palette */
Note: See TracChangeset
for help on using the changeset viewer.