批处理3D动画:球
转自: DosTips [url]http://www.dostips.com/forum/viewtopic.php?f=3&t=5594[/url]中文 WIN7 64位 测试通过[code]chcp 437
if "%1"=="" (
for %%a in ( FontSize:00080008
FontFamily:00000030
WindowSize:003d0050
ScreenColors:0000000f
CodePage:000001b5
ScreenBufferSize:003d0050
) do for /f "tokens=1,2 delims=:" %%b in ("%%a") do (
>nul reg add HKCU\Console\DosBatch_3D_Engine /v %%b /t reg_dword /d 0x%%c /f
)
start "DosBatch_3D_Engine" /max "%ComSpec%" /c "%~s0" 1&goto:eof
) else ( >nul reg delete HKCU\Console\DosBatch_3D_Engine /f )
@echo off & setlocal & title Sphere 3D & set /a cols=62, lines=62 & goto :Init_system
:: By einstein1969. Dedicated to jeb, dbenham, penpen, carlos, aGerman, Aacini, EdDyreen,
:: npocmaka_, Liviu, Sponge Belly, Magialisk, the users and the staff of Dostips forum.
:: Use raster font 8x8.
:Main
set /a ar=100, rt=0, ds=0, cx=cols/2, cz=4000, cY=lines/2
(
set SIN=
set _PLOT$_=
set _$PLOT_=
set _empty=
set lines=
set cols=
for /L %%\ in (1000,-1,0) do (
set /a "rt+=31416/60"
if !ds! lss 1000 set /a ds+=10
setlocal
set /a "a=(15708-rt) %% 62832, c=(a>>31|1)*a"
if !c! gtr 47124 (set /a "a=a-(a>>31|1)*62832, b=%SIN%, a=rt %% 62832, c=(a>>31|1)*a") else (if !c! gtr 15708 (set /a "a=(a>>31|1)*31416-a, b=%SIN%, a=rt %% 62832, c=(a>>31|1)*a") else set /a "b=%SIN%, a=rt %% 62832, c=(a>>31|1)*a")
if !c! gtr 47124 (set /a "a=a-(a>>31|1)*62832, a=%SIN%") else (if !c! gtr 15708 (set /a "a=(a>>31|1)*31416-a, a=%SIN%") else set /a "a=%SIN%")
for %%f in ("0 9999" "-5000 8661" "-8661 5000" "-9999 0" "-8661 -5000" "-5000 -8661" "0 -9999" "5000 -8661" "8661 -5000" "9999 0" "8661 5000" "5000 8661") do for /f "tokens=1,2" %%g in (%%f) do (
for %%t in ("3827 9239" "7071 7071" "9239 3827" "9999 0" "9239 -3827" "7071 -7071" "3827 -9239") do for /f "tokens=1,2" %%u in (%%t) do (
set /a "ax=ar*%%h/10000*%%u/10000, az=ar*%%g/10000*%%u/10000, ay=ar*%%v/10000, aax=(ax*b/10000-(ay*a/10000+az*b/10000)*a/10000)*b/10000-(ay*b/10000-az*a/10000)*a/10000, aay=(ax*b/10000-(ay*a/10000+az*b/10000)*a/10000)*a/10000+(ay*b/10000-az*a/10000)*b/10000, e=ax*a/10000+(ay*a/10000+az*b/10000)*b/10000, c=ds*aax/(e-cz)+cx, d=ds*aay/(e-cz)+cy"
if not defined L!d! set L!d!=%_empty%
if !e! lss 0 (%_$PLOT_% !c! !d! 1 %_PLOT$_%) else %_$PLOT_% !c! !d! 4 %_PLOT$_%
)
)
if not "!OT!"=="!time:~-1!" (
cls & (For /L %%l in (1,1,%lines%) do if not defined L%%l (echo() else echo( !L%%l!)>CON
if "!OT!"=="0" title Sphere 3D [%%\]
endlocal
set OT=!time:~-1!
) else endlocal
)
)
goto :eof
:Init_system
setlocal DisableDelayedExpansion
set /a cc=cols+2, ll=lines+2
(
mode %cc%,%ll% & cls
for /F "Tokens=1 delims==" %%v in ('set') do set "%%v="
set /a cols=%cols%, lines=%lines%
)
set "_$PLOT_=For /F usebackq^ tokens^=1-3 %%x in ('"
set "_PLOT$_=') do set /a f=%%x+1 & For %%w in (!f!) do set L%%y=!L%%y:~0,%%x!!g:~%%z,1!!L%%y:~%%w!"
set "SIN=(a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000)"
setlocal EnableDelayedExpansion
For /L %%l in (1,1,%cols%) do set "_empty=!_empty! "
set g= .±2@"
Goto :Main[/code] 卧槽,这是要逆天的节奏 .。。。高人,实在是高人啊。
和之前用汇编直接写了个3d动画,有的一拼。。 有个性,收藏了! 转向D3D或者OPENGL吧 牛叉的视觉效果,意想不到。 好厉害,无法直视 有意思,不错不错, [b]回复 [url=http://bbs.bathome.net/redirect.php?goto=findpost&pid=152224&ptid=31264]8#[/url] [i]ZJHJ[/i] [/b]
似乎很久没冒泡了 对其算法很好奇 [b]回复 [url=http://www.bathome.net/redirect.php?goto=findpost&pid=152228&ptid=31264]10#[/url] [i]terse[/i] [/b]
我也没有仔细研究其算法, 粗略可以看出用 无穷级数 实现了三角函数计算, 另外猜测用的是平行投影, 相对来说, 平行投影 加上 以球心作为 空间直角坐标系原点 可以使得计算上更简洁 看到一个很有趣的终端。
[url]http://www.cnblogs.com/crazylights/p/3932573.html[/url]
[img]http://images.cnitblog.com/blog/184642/201408/241635262531473.gif[/img] 楼主 V587 太牛逼了啊 能不能进行下详解 让我等屌丝有机会也写类似牛作啊 做的不错,真赞 [b]回复 [url=http://www.bathome.net/redirect.php?goto=findpost&pid=151845&ptid=31264]1#[/url] [i]neorobin[/i] [/b]
这个真的是大神制作啊,佩服了!! 对bat从此有了新的认识 打开看到效果的那一瞬间,无法想象。。。
批处理还能这么玩。。。 [b]回复 [url=http://www.bathome.net/redirect.php?goto=findpost&pid=151845&ptid=31264]1#[/url] [i]neorobin[/i] [/b]
哈哈 看起来就很好 [b]回复 [url=http://www.bathome.net/redirect.php?goto=findpost&pid=151845&ptid=31264]1#[/url] [i]neorobin[/i] [/b]
不得不说,确实很吊,能把bat做成这样,跪了 没有最吊,只有更吊~~~~~~~~~~~~~膜拜啊。 看来我低估BAT了 如果能把字体改成彩色之间的转换就完美了 大佬能详解吗,以便做出更好操作的“引擎” WIN10 64 测试通过.有生之年系列
页:
[1]