at_yasu's blog

ロード的なことを

PRIM_GROW

SLViewerの1.20が出たので、早速試してみた。SLViwer1.20 RCで以下のコードがコンパイルできます。動作自体はSLViwer1.19でも確認済み。

// written by Yasui Botha
//
// This program is Grow test.
// well, If you use the SLViewer version over the 1.20. You can edit to this.
// But your viewer version is under the 1.20, You don't must to edit this.
//
 
integer glow_vec = 0;  // 0 => up, !0 = down
float glow_num = 0.0;
float kaketi = 0.05;
default
{   
    state_entry()
    {
//        llSay(0, "Hello, Avatar!");
        glow_vec = 0;
        list values = llGetPrimitiveParams([PRIM_GLOW, 1]);
        glow_num = llList2Float(values, 0);
        llSetTimerEvent(0.05);
    }

    touch_start(integer total_number)
    {
        
    }
    
    timer() {
        float glow = 0.0;
                
        if (glow_vec == 0) {
            glow_num += kaketi;
        } else {
            glow_num -= kaketi;
        }
        
        glow = (glow_num * glow_num); // glow = t*t
        
        if (glow_num >= 1.0) {
            glow_vec = 1;
        } else if (glow_num <= 0.0) {
            glow_vec = 0;
        }
        
        if (glow >= 1.0) glow = 1.0;
        if (glow <= 0.0) glow = 0.0;
        
//        llOwnerSay("glow -> "+(string)glow);
        llSetPrimitiveParams([PRIM_GLOW, ALL_SIDES, glow]);
    }
}

Let's enjoy the glow :)