Created
May 9, 2025 15:07
-
-
Save kg68k/b4b3dc93880db1a2c298121ee21614a9 to your computer and use it in GitHub Desktop.
ワイヤーフレームの星が回転
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dim int polyX(1000), polyY(1000) | |
dim float tblSin(359),tblCos(359) | |
for i=0 to 359:tblSin(i)=sin(pi(i/180#)):tblCos(i)=cos(pi(i/180#)):next | |
screen 1,1,1,1 | |
count=0:apg=0:vpg=0:sz=100:sizePls=1 | |
while 1 | |
apg=((count+1) mod 2) | |
vpg=(1+((count+1) mod 2)) | |
sz=sz+sizePls: if sz<10 or sz>200 then sizePls=sizePls*-1 | |
polyCalc(count mod 360,sz) | |
apage(apg) | |
wipe() | |
polyDraw(5) | |
vpage(vpg) | |
count=count+1 | |
endwhile | |
end | |
func polyDraw(lineNum;int) | |
for i=1 to lineNum | |
line(polyX(i-1),polyY(i-1),polyX(i),polyY(i),15,&HFFFF) | |
next | |
endfunc | |
func polyCalc(angle_offset;int, size;int) | |
for i=0 to 5 | |
polyX(i)=256+tblSin((angle_offset+i*144) mod 360)*size | |
polyY(i)=256+tblCos((angle_offset+i*144) mod 360)*size | |
next | |
endfunc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dim int polyX(1000), polyY(1000) | |
dim int saveX(1,5), saveY(1,5) | |
dim float tblSin(359),tblCos(359) | |
for i=0 to 359:tblSin(i)=sin(pi(i/180#)):tblCos(i)=cos(pi(i/180#)):next | |
screen 1,1,1,1 | |
count=0:apg=0:vpg=0:sz=100:sizePls=1 | |
while 1 | |
apg=(count+1) and 1 | |
vpg=1 shl apg | |
sz=sz+sizePls: if sz<10 or sz>200 then sizePls=-sizePls | |
polyCalc(count mod 360,sz) | |
apage(apg) | |
polyClear(5,apg) | |
polyDraw(5,apg) | |
vpage(vpg) | |
count=count+1 | |
endwhile | |
end | |
func polyDraw(lineNum;int,page;int) | |
int x0,y0,x1,y1:x1=polyX(0):y1=polyY(0) | |
saveX(page,0)=x1:saveY(page,0)=y1 | |
for i=1 to lineNum | |
x0=x1:y0=y1 | |
x1=polyX(i):y1=polyY(i) | |
saveX(page,i)=x1:saveY(page,i)=y1 | |
line(x0,y0,x1,y1,15,&HFFFF) | |
next | |
endfunc | |
func polyClear(lineNum;int,page;int) | |
int x0,y0,x1,y1:x1=saveX(page,0):y1=saveY(page,0) | |
for i=1 to lineNum | |
x0=x1:y0=y1 | |
x1=saveX(page,i):y1=saveY(page,i) | |
line(x0,y0,x1,y1,0,&HFFFF) | |
next | |
endfunc | |
func polyCalc(angle_offset;int, size;int) | |
for i=0 to 5 | |
polyX(i)=256+tblSin((angle_offset+i*144) mod 360)*size | |
polyY(i)=256+tblCos((angle_offset+i*144) mod 360)*size | |
next | |
endfunc |
ryusan_fast.bas はwipe()
で画面全体を消す代わりに、前回描画した線と同じ線を黒で描くことで消去する改造版。
星が小さいとFPSが高くなる。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://x.com/ryusan_mmd/status/1920823197240365483