From d20c3bfec2494785b4e41b988e87f8c554e65161 Mon Sep 17 00:00:00 2001 From: TempleOS-bot Date: Tue, 31 Jan 2017 04:27:26 -0500 Subject: [PATCH] Nightly update (ISO SHA-1 033e6b2) --- TempleOSCD/0000Boot/0000Kernel.BIN.C | Bin 192080 -> 192080 bytes TempleOSCD/Adam/ADefine.HC | 2 +- TempleOSCD/Compiler/Compiler.BIN | Bin 192919 -> 192920 bytes TempleOSCD/Compiler/CompilerB.HH | 1 - TempleOSCD/Demo/AcctExample/Registry.HC | 2 +- TempleOSCD/Demo/Graphics/LightTable.HC | 76 ++++++++++++++++++------ TempleOSCD/Doc/ChgLog.DD | 2 +- 7 files changed, 61 insertions(+), 22 deletions(-) diff --git a/TempleOSCD/0000Boot/0000Kernel.BIN.C b/TempleOSCD/0000Boot/0000Kernel.BIN.C index d8c97417a651dec05c81181da5e3ab52893b2ba5..d84e5cca2abcd1f1bb7e09baf82d5c52e2454df2 100644 GIT binary patch delta 258 zcmca`hx@`E?g=LBr}fn$uh?>LUdVEhc{2~op-4vU&F5p)SQ(2qe@j{|G5OCl;mupB zr*pB?^T{$!S14c<-<;N#%gB``I8yesRXo?RPU7p9wRr*?y#!ajy&`!}g|GjGab|Yqs;8Wi(`GWe7Hmcb)EZ zh0&Ac$tM}c$&Ilh+ZSJ9RP|!cFJRbyT8?Qx8)NbIY*nUzCX622v!a;99hp9T+TJ{y H>1+@HOlV%Q delta 258 zcmca`hx@`E?g=LBzQqlOS8TaAFJ!sMyqSmPP$Z+y=JT;?tc>lOza_1fV2g^6J9$W8 z^YZE?Tr5-hWErO`6flZ!PHW3$WU0`UWt<$}sW|yZyD_84WStIw7C9}53W>?*+XOeS z=tyRSNHFf%9Mfg*$Nc~Q|IPDma56Ja-n`=W6CNgofX#g`D9a<6ap?*6mHR7(0y^4{zr=%V@~X`X2 diff --git a/TempleOSCD/Adam/ADefine.HC b/TempleOSCD/Adam/ADefine.HC index 38b1214..97c0e0e 100644 --- a/TempleOSCD/Adam/ADefine.HC +++ b/TempleOSCD/Adam/ADefine.HC @@ -18,7 +18,7 @@ U0 LoadDocDefines() //$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/Adam/Opt/Boot/BootDVD.HC,DD_BOOT_HIGH_LOC_DVD"$ $TR-C,"LineRep"$ -$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,374"); +$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,414"); DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","82,012"); $ID,-4$ DefinePrint("DD_MP_VECT","%08X",MP_VECT_ADDR); diff --git a/TempleOSCD/Compiler/Compiler.BIN b/TempleOSCD/Compiler/Compiler.BIN index 4c01120c12d4faa8f4f1bbc9497cbf939443d8a1..a0908ac4b1d3bb3d50a31c02ed869e6ae4aef607 100644 GIT binary patch delta 108 zcmbRKn0v-!?hOTsObiU0ixdy0F{*Ah=}?Jb?AsjqC5jmtwx7Di_|SKHGcS|a^gX{BIk%tEU^;C&S;w4X QdQLMF_x2TWOz$TF0ART%?*IS* delta 93 zcmbR7n0xwT?hOTsOeG4Nixdy0F{*7g=}?JbT(UXx$u;xs1~QB#2CREEWf>VJ7tRsh zzQ>0#fswI#yR0AM6iLR<+c%{%N)$7uY(IUA@u4qc%J#JyOfO9tQ?^f!V`7{P0DIgb A(EtDd diff --git a/TempleOSCD/Compiler/CompilerB.HH b/TempleOSCD/Compiler/CompilerB.HH index 989e1f4..67409e3 100644 --- a/TempleOSCD/Compiler/CompilerB.HH +++ b/TempleOSCD/Compiler/CompilerB.HH @@ -21,7 +21,6 @@ extern U0 StreamDir(); public extern I64 StreamExePrint(U8 *fmt,...); public extern U0 StreamPrint(U8 *fmt,...); public extern Bool Trace(Bool val=ON); - #help_index "Compiler/Lex" #help_file "::/Doc/Lex" extern U0 ClassMemberLstDel(CHashClass *c); diff --git a/TempleOSCD/Demo/AcctExample/Registry.HC b/TempleOSCD/Demo/AcctExample/Registry.HC index 8747776..91fda92 100644 --- a/TempleOSCD/Demo/AcctExample/Registry.HC +++ b/TempleOSCD/Demo/AcctExample/Registry.HC @@ -62,7 +62,7 @@ $ID,-2$$TR,"Titanium"$ $ID,2$I64 best_score=16469; $ID,-2$$TR,"TOSRegen"$ $ID,2$progress1_tf=0.000;progress2_tf=0.000; -progress3_tf=0.000;progress4_tf=188.159; +progress3_tf=0.000;progress4_tf=195.910; $ID,-2$$ID,-2$$TR,"Once"$ $ID,2$$TR,"Adam"$ $ID,2$$ID,-2$$TR,"User"$ diff --git a/TempleOSCD/Demo/Graphics/LightTable.HC b/TempleOSCD/Demo/Graphics/LightTable.HC index e2455c1..d8d6c1b 100644 --- a/TempleOSCD/Demo/Graphics/LightTable.HC +++ b/TempleOSCD/Demo/Graphics/LightTable.HC @@ -1,14 +1,24 @@ +/* +There is a coarse and a fine-grained. +The coarse gets flood-filled but the +fine grained is only outlines. +*/ + class Photon { Photon *next,*last; CD3 p,v,p_snell_inhibit; } p_root[mp_cnt]; I64 p_root_locks; + +#define ANIMATE_JIFFIES (JIFFY_FREQ*0.01) +I64 master_sleep_jiffy; CTask *animate_tasks[mp_cnt]; + CDC *map; -F64 ts; I64 photon_cnt,snell_cnt; +Bool full_speed; U8 *bmp; F64 bmp_scale,bmp_scale_sqr; @@ -35,7 +45,7 @@ Photon *PhotonNew() { I64 num=photon_cnt++%mp_cnt; Photon *res=CAlloc(sizeof(Photon)); - while (!LBts(&p_root_locks,num)) + while (LBts(&p_root_locks,num)) Yield; QueIns(res,p_root[num].last); LBtr(&p_root_locks,num); @@ -54,7 +64,7 @@ U0 DrawIt(CTask *,CDC *dc) map->width,map->height,bmp_width,bmp_height); GrPrint(dc,0,FONT_HEIGHT,"PhotonCnt:%d SnellCnt:%d",photon_cnt,snell_cnt); for (i=0;iv.x,tmpp->v.y),è; D3Copy(&tmpp->p_snell_inhibit,&tmpp->p); + + //Coarse grains has black and white filled-in BSplines. + //Fine grained has only white outline without being filled-in. + + //Back-up a step and move fwd to get a fined-grained value + //for the point of contact. D3SubEqu(&tmpp->p,&tmpp->v); D3Mul(&p,bmp_scale,&tmpp->p); D3Copy(&p1,&p); @@ -121,6 +137,7 @@ U0 FindNormal(Photon *tmpp,CD3 *_normal) D3Copy(&p,&p1); D3Div(&tmpp->p,&p,bmp_scale); + //Draw an arc one direction, finding point of contact. for (è=0;è<ã/2;è+=ã/bmp_norm_radius) { D3Equ(&s,Cos(é+ã-ã/4-è),Sin(é+ã-ã/4-è)); D3Mul(&v,bmp_norm_radius,&s); @@ -131,6 +148,7 @@ U0 FindNormal(Photon *tmpp,CD3 *_normal) if (BmpPeek(p1.x,p1.y)!=WHITE) D3Copy(&p1,&tmpp->p); + //Draw an arc other direction, finding point of contact. for (è=0;è<ã/2;è+=ã/bmp_norm_radius) { D3Equ(&s,Cos(é+ã+ã/4+è),Sin(é+ã+ã/4+è)); D3Mul(&v,bmp_norm_radius,&s); @@ -182,10 +200,22 @@ U0 SnellsLaw(Photon *tmpp,I64 last,I64 next) U0 AnimateTask(I64) { - Photon *tmpp,*root=&p_root[Gs->num]; - I64 last,next; while (TRUE) { - while (!LBts(&p_root_locks,Gs->num)) + master_sleep_jiffy+=ANIMATE_JIFFIES; + if (cnts.jiffies>=master_sleep_jiffy) + master_sleep_jiffy=cnts.jiffies+ANIMATE_JIFFIES; + SleepUntil(master_sleep_jiffy); + } +} + +U0 MPAnimateTask(I64) +{ + I64 last_master_jiffy=0, + timeout_jiffy=master_sleep_jiffy+ANIMATE_JIFFIES, + last,next; + Photon *tmpp,*root=&p_root[Gs->num]; + while (TRUE) { + while (LBts(&p_root_locks,Gs->num)) Yield; tmpp=root->next; while (tmpp!=root) { @@ -210,16 +240,24 @@ U0 AnimateTask(I64) next=GrPeek(map,tmpp->p.x,tmpp->p.y); if (last!=next && (last==BLACK && next==WHITE) || (last==WHITE && next==BLACK) && +//Don't do a snell operation too close to the last. Just ignore it. D3DistSqr(&tmpp->p_snell_inhibit,&tmpp->p)>=4.0) SnellsLaw(tmpp,last,next); tmpp=tmpp->next; + if (cnts.jiffies>=timeout_jiffy) + break; } LBtr(&p_root_locks,Gs->num); - if (ts) - Sleep(1000*ts); - else { - Yield; - Yield; //Give a more time unlocked. + if (cnts.jiffies>=timeout_jiffy) { + Sleep(1); + timeout_jiffy=master_sleep_jiffy+ANIMATE_JIFFIES; + } + if (!full_speed) { + while (master_sleep_jiffy==last_master_jiffy) + Sleep(1); + last_master_jiffy=master_sleep_jiffy; + SleepUntil(master_sleep_jiffy); + timeout_jiffy=master_sleep_jiffy+ANIMATE_JIFFIES; } } } @@ -227,11 +265,12 @@ U0 AnimateTask(I64) U0 Init() { I64 i; - ts=0.01; + master_sleep_jiffy=cnts.jiffies; + full_speed=FALSE; photon_cnt=snell_cnt=0; map=DCNew(Fs->pix_width,Fs->pix_height); for (i=0;idraw_it=&DrawIt; + Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs); for (i=0;i