/* REV: Arkeon */ /* Last update: 07.04.02 */ typeof plugin = S;; typeof class = S;; typeof type_e = ObjBox;; typeof ambient_e = ObjButton;; typeof diffuse_e = ObjButton;; typeof specular_e = ObjButton;; typeof angle_e = ObjText;; typeof const_e = ObjText;; typeof quadr_e = ObjText;; typeof a_e = ObjText;; typeof b_e = ObjText;; typeof c_e = ObjText;; typeof SavedType = S;; typeof Init = ObjCheck;; typeof ambient_bmp = ObjBitmap;; typeof diffuse_bmp = ObjBitmap;; typeof specular_bmp = ObjBitmap;; var ambient = 0;; var diffuse = 0;; var specular = 0;; var angle = 0;; var const = 0;; var quadr = 0;; var a = 0;; var b = 0;; var c = 0;; var btn=0;; fun endcolor (new_color, btn)= if new_color == nil then nil else if btn == ambient_e then { _FILLbitmap ambient_bmp new_color; _PAINTbutton ambient_e; set ambient = new_color; } else if btn == diffuse_e then { _FILLbitmap diffuse_bmp new_color; _PAINTbutton diffuse_e; set diffuse = new_color; } else if btn == specular_e then { _FILLbitmap specular_bmp new_color; _PAINTbutton specular_e; set specular = new_color; } else nil;; fun chgColor(btn, win) = _CRcolorMap _channel win 0 0 "" mkfun2 @endcolor btn if btn == ambient_e then ambient else if btn == diffuse_e then diffuse else if btn == specular_e then specular else 0 ; 0;; fun swapRGB (color)= let color&0xff -> c1 in let (color>>8)&0xff -> c2 in let (color>>16)&0xff -> c3 in (c1<<16)+(c2<<8)+c3;; proto save=fun [ [Inst r1] ] [[S r1] [S r1] [[S r1]r1] [[S r1]r1]];; fun AddType(str, a) = _ADDcombo type_e (_GETcomboCount type_e) str;; fun AddTypes() = apply_on_list "Ambient"::"Para"::"Omni"::"Spot"::nil @AddType nil;; fun comboReflex(a, b, c, d) = let _GETcombo type_e -> [_ str] in set SavedType = if !strcmpi str "Ambient" then "LIGHT_AMBIENT" else if !strcmpi str "Para" then "LIGHT_PARA" else if !strcmpi str "Omni" then "LIGHT_OMNI" else "LIGHT_SPOT";; fun toType (str)= if !strcmp str "LIGHT_AMBIENT" then 0 else if !strcmp str "LIGHT_PARA" then 1 else if !strcmp str "LIGHT_OMNI" then 2 else 3 ;; fun closeedit() = strbuild ("type"::SavedType::nil):: ("ambient"::(itoh swapRGB ambient)::nil):: ("diffuse"::(itoh swapRGB diffuse)::nil):: ("specular"::(itoh swapRGB specular)::nil):: ("angle"::(_GETtext angle_e)::nil):: ("const"::(_GETtext const_e)::nil):: ("quadr"::(_GETtext quadr_e)::nil):: ("a"::(_GETtext a_e)::nil):: ("b"::(_GETtext b_e)::nil):: ("c"::(_GETtext c_e)::nil):: ("init"::(let _GETcheck Init -> x in if x then "on" else "off")::nil):: nil ;; fun dynamicedit(win, obj, mat, param) = let strextr param -> l in let _GETwindowSizePosition win -> [w h x y] in { /*let getInfo l "ambient" -> ambient in if ambient == nil then 0 else swapRGB htoi ambient;*/ set ambient = let getInfo l "ambient" -> tmp in if tmp == nil then 0 else swapRGB htoi tmp; set diffuse = let getInfo l "diffuse" -> tmp in if tmp == nil then 0 else swapRGB htoi tmp; set specular = let getInfo l "specular" -> tmp in if tmp == nil then 0 else swapRGB htoi tmp; set angle = let getInfo l "angle" -> tmp in if tmp == nil then 0 else atoi tmp; set const = let getInfo l "const" -> tmp in if tmp == nil then 0 else atoi tmp; set quadr = let getInfo l "quadr" -> tmp in if tmp == nil then 0 else atoi tmp; set a = let getInfo l "a" -> tmp in if tmp == nil then 0 else atoi tmp; set b = let getInfo l "b" -> tmp in if tmp == nil then 0 else atoi tmp; set c = let getInfo l "c" -> tmp in if tmp == nil then 0 else atoi tmp; _CRtext _channel win 5 5 45 20 ET_ALIGN_RIGHT "Type:"; set type_e = _CBcombo _CRcombo _channel win 15+45 5 100 100 CB_NOEDIT "LIGHT_AMBIENT" @comboReflex nil; AddTypes; set SavedType = let getInfo l "type" -> tmp in if tmp == nil then "LIGHT_AMBIENT" else tmp; _SELcombo type_e toType SavedType; set ambient_bmp = _FILLbitmap _CRbitmap _channel 40 20 ambient; _CRtext _channel win 10 35 45 20 ET_ALIGN_CENTER "ambient"; set ambient_e = _CBbutton _CRbuttonBitmap _channel win ambient_bmp 5 60 40 20 0 @chgColor win; set diffuse_bmp = _FILLbitmap _CRbitmap _channel 40 20 diffuse; _CRtext _channel win 30+40 35 40 20 ET_ALIGN_CENTER "diffuse"; set diffuse_e = _CBbutton _CRbuttonBitmap _channel win diffuse_bmp 30+40 60 40 20 0 @chgColor win; set specular_bmp = _FILLbitmap _CRbitmap _channel 40 20 specular; _CRtext _channel win 90+40 35 40 20 ET_ALIGN_CENTER "specular"; set specular_e = _CBbutton _CRbuttonBitmap _channel win specular_bmp 90+40 60 40 20 0 @chgColor win; _CRtext _channel win 5 125 40 20 ET_ALIGN_RIGHT "angle"; set angle_e = _CReditLine _channel win 50 125 30 20 ET_NUMBER|ET_DOWN itoa angle; _CRtext _channel win 5 155 40 20 ET_ALIGN_RIGHT "const"; set const_e = _CReditLine _channel win 50 155 30 20 ET_NUMBER|ET_DOWN itoa const; _CRtext _channel win 5 185 40 20 ET_ALIGN_RIGHT "quadr"; set quadr_e = _CReditLine _channel win 50 185 30 20 ET_NUMBER|ET_DOWN itoa quadr; _CRtext _channel win 90 125 40 20 ET_ALIGN_RIGHT "Soft A"; set a_e = _CReditLine _channel win 135 125 30 20 ET_NUMBER|ET_DOWN itoa a; _CRtext _channel win 90 155 40 20 ET_ALIGN_RIGHT "Soft B"; set b_e = _CReditLine _channel win 135 155 30 20 ET_NUMBER|ET_DOWN itoa b; _CRtext _channel win 90 185 40 20 ET_ALIGN_RIGHT "Soft C"; set c_e = _CReditLine _channel win 135 185 30 20 ET_NUMBER|ET_DOWN itoa c; set Init = _SETcheck _CRcheck _channel win 5 215 60 20 0 "Init on" if !strcmpi getInfo l "init" "on" then 1 else 0; }; @closeedit ;;