- UID
 - 246
 
- UCC
 -  
 
- 声望
 -  
 
- 好评
 -  
 
- 贡献
 -  
 
- 最后登录
 - 1970-1-1
 
 
 
 
 
 
 | 
 
 本帖最后由 黑暗枪骑兵 于 2011-3-17 08:41 编辑  
 
看了半天终于看出来了。。。。。。 
- CUT_F_LINEAR         = 0x1
 
 - CUT_F_ROT            = 0x2
 
 - CUT_F_4              = 0x4
 
 - CUT_F_TARGETPOS      = 0x8
 
 - CUT_F_SAMEPOS        = 0x10
 
 - CUT_F_SAMEROT        = 0x20
 
 - CUT_F_SAMETARGET     = 0x40
 
 - CUT_F_BEZIER         = 0x80
 
 - CUT_F_SAMESCALE      = 0x100
 
 - CUT_F_COLOR          = 0x200
 
 - CUT_F_SAMECOLOR      = 0x400
 
 - CUT_F_FOV            = 0x800
 
 - CUT_F_SAMEFOV        = 0x1000
 
 - CUT_F_ABSROT         = 0x2000
 
 - CUT_F_POSTCBINFO     = 0x4000
 
 - CUT_F_ROTTCBINFO     = 0x8000
 
 - CUT_F_POSBEZINFO     = 0x10000
 
 - CUT_F_TPOSTCBINFO    = 0x20000
 
 - CUT_F_FAKEROTTCBINFO = 0x40000
 
  
- struct cut_frame_tcbinfo
 
 - (
 
 -         tension=0,
 
 -         continuity=0,
 
 -         bias=0,
 
 -         easeFrom=0,
 
 -         easeTo=0
 
 - )
 
  
- struct cut_frame
 
 - (
 
 -         flags=0,
 
 -         
 
 -         position,
 
 -         posTCBInfo,
 
 -         rotation,
 
 -         rotTCBInfo,
 
 -         targetPosition,
 
 -         targetRoll, -- roll for target cameras and lights
 
 -         fov,
 
 -         rgb,
 
 -         length,
 
 -         
 
 -         index=0,
 
 -         
 
 -         function getFlagsAsString =
 
 -         (
 
 -                 local str="";
 
 -                 
 
 -                 if bit.and flags CUT_F_4 > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="?FOUR?" )
 
 -                 if bit.and flags CUT_F_POSTCBINFO > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="POS_TCB_INFO" )
 
 -                 if bit.and flags CUT_F_POSBEZINFO > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="POS_BEZ_INFO" )
 
 -                 if bit.and flags CUT_F_ROT > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="ROT" )
 
 -                 if bit.and flags CUT_F_ROTTCBINFO > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="ROT_TCB_INFO" )
 
 -                 if bit.and flags CUT_F_TARGETPOS > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="TARGET_POS" )
 
 -                 if bit.and flags CUT_F_TPOSTCBINFO > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="T_POS_TCB_INFO" )
 
 -                 if bit.and flags CUT_F_FOV > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="FOV" )
 
 -                 if bit.and flags CUT_F_COLOR > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="COLOR" )
 
 -                         
 
 -                 if bit.and flags CUT_F_SAMECOLOR > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="F_SAME_COLOR" )
 
 -                 if bit.and flags CUT_F_LINEAR > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="F_LINEAR" )
 
 -                 if bit.and flags CUT_F_SAMEPOS > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="F_SAME_POS" )
 
 -                 if bit.and flags CUT_F_SAMEROT > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="F_SAME_ROT" )
 
 -                 if bit.and flags CUT_F_SAMETARGET > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="F_SAME_TARGET" )
 
 -                 if bit.and flags CUT_F_BEZIER > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="F_BEZIER" )
 
 -                 if bit.and flags CUT_F_SAMESCALE > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="F_SAME_SCALE" )
 
 -                 if bit.and flags CUT_F_SAMEFOV > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="F_SAME_FOV" )
 
 -                 if bit.and flags CUT_F_ABSROT > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="F_ABS_ROT" )
 
 -                         
 
 -                 if bit.and flags CUT_F_FAKEROTTCBINFO > 0 then
 
 -                         ( if str.count > 0 then str+="|"; str+="?FAKE_ROT_TCB_INFO" )
 
 -                         
 
 -                 return str;
 
 -         ),
 
 -         
 
 -         /*
 
 -                 load a frame from array of numbers
 
 -                 ret: true or string with error
 
 -         */
 
 -         function load values =
 
 -         (
 
 -                 local idx=2;
 
 -                 
 
 -                 flags=values[1] as integer
 
 -                 
 
 -                 if dbox_debug DBG_FRAME_LOAD then
 
 -                         format "loading frame 0x% - %\n" (bit.intAsHex flags) (getFlagsAsString())
 
 -                 
 
 -                 -- position --
 
 -                 if bit.and flags CUT_F_SAMEPOS  == 0 then (
 
 -                         if (values.count - idx) < 3 then 
 
 -                                 return "Not enough values to load position"
 
 -                         local x=values[idx], y=values[idx + 1], z=values[idx + 2]
 
 -                         position=[x / 100, z / 100, y / 100]
 
 -                         idx+=3
 
 -                         
 
 -                         if dbox_debug DBG_FRAME_LOAD then
 
 -                                 format "loaded pos, idx is %\n" idx
 
 -                                 
 
 -                         -- tcb pos info --
 
 -                         if bit.and flags CUT_F_POSTCBINFO > 0 then (
 
 -                                 if values.count - idx < 5 then return "Not enough values to load TCB position info"
 
 -                                 idx+=5
 
  
-                                 if dbox_debug DBG_FRAME_LOAD then
 
 -                                         format "loaded pos tcb info, idx is %\n" idx
 
 -                         )
 
 -                 )
 
 -                 
 
 -                 -- rotation --
 
 -                 if (bit.and flags CUT_F_ROT > 0) and (bit.and flags CUT_F_SAMEROT == 0) then (
 
 -                         if values.count - idx < 4 then return "Not enough values to load rotation"
 
 -                         local angle=360 * values[idx]
 
 -                         local a=values[idx+1], b=values[idx+2], c=values[idx+3]
 
 -                         rotation=angleaxis angle [-a, -c, -b]
 
 -                         idx+=4
 
  
-                         if dbox_debug DBG_FRAME_LOAD then
 
 -                                 format "loaded rot, idx is %\n" idx
 
 -                         
 
 -                         -- tcb rot info --
 
 -                         if bit.and flags CUT_F_ROTTCBINFO > 0 then (
 
 -                                 if values.count - idx < 5 then return "Not enough values to load TCB rotation info"
 
 -                                 idx+=5
 
  
-                                 if dbox_debug DBG_FRAME_LOAD then
 
 -                                         format "loaded rot tcb info, idx is %\n" idx
 
 -                         )
 
 -                 )
 
 -                 
 
 -                 -- target position --
 
 -                 if bit.and flags CUT_F_TARGETPOS > 0 then (
 
 -                         if bit.and flags CUT_F_SAMETARGET == 0 then (
 
 -                                 if values.count - idx < 3 then return "Not enough values to load target position"
 
 -                                 local x=values[idx], y=values[idx + 1], z=values[idx + 2]
 
 -                                 targetPosition=[x / 100, z / 100, y / 100]
 
 -                                 idx+=3
 
 -                                 
 
 -                                 if dbox_debug DBG_FRAME_LOAD then
 
 -                                         format "loaded target pos, idx is %\n" idx
 
 -                                         
 
 -                                 -- tcb target pos info --
 
 -                                 if bit.and flags CUT_F_TPOSTCBINFO > 0 then (
 
 -                                         if values.count - idx < 5 then return "Not enough values to load TCB target position info"
 
 -                                         idx+=5
 
  
-                                         if dbox_debug DBG_FRAME_LOAD then
 
 -                                                 format "loaded target pos tcb info, idx is %\n" idx
 
 -                                 )                
 
 -                         )
 
 -                         if bit.and flags CUT_F_SAMEROT == 0 then (
 
 -                                 targetRoll=radtodeg values[idx]
 
 -                                 idx+=1
 
 -                                 
 
 -                                 if dbox_debug DBG_FRAME_LOAD then
 
 -                                         format "loaded target roll, idx is %\n" idx
 
 -                         )
 
 -                 )
 
 -                 
 
 -                 -- fov --
 
 -                 if (bit.and flags CUT_F_FOV > 0) and (bit.and flags CUT_F_SAMEFOV == 0) then (
 
 -                         if values.count - idx < 1 then return "Not enough values to load FOV"
 
 -                         fov=radtodeg values[idx] 
 
 -                         idx+=1;
 
  
-                         if dbox_debug DBG_FRAME_LOAD then
 
 -                                 format "loaded fov, idx is %\n" idx
 
 -                 )
 
 -                 
 
 -                 -- color --
 
 -                 if (bit.and flags CUT_F_COLOR > 0) and (bit.and flags CUT_F_SAMECOLOR == 0) then (
 
 -                         if values.count - idx < 3 then return "Not enough values to load color"
 
 -                         rgb=color (255 * values[idx]) (255 * values[idx + 1]) (255 * values[idx + 2])
 
 -                         idx+=3;
 
  
-                         if dbox_debug DBG_FRAME_LOAD then
 
 -                                 format "loaded color, idx is %\n" idx
 
 -                 )
 
 -                 if values.count - idx < 1 then return "Not enough values to load frame length"
 
 -                 length=values[idx];
 
 -                 
 
 -                 return true;
 
 -         ),
 
 -         
 
 -         function writeTCB os tcb =
 
 -         (
 
 -                 if tcb==undefined then return false;
 
 -                 
 
 -                 format "%;%;%;%;%;  " (formatFloat (2 / 50 as float * tcb.tension - 1)) \ 
 
 -                 (formatFloat (2 / 50 as float * tcb.continuity - 1)) \
 
 -                 (formatFloat (2 / 50 as float * tcb.bias - 1)) \ 
 
 -                 (formatFloat (tcb.easeTo / 50) 6) (formatFloat (tcb.easeFrom / 50)) to:os.stream
 
 -                 return true;
 
 -         ),
 
 -         
 
 -         function save os idx:0 =
 
 -         (
 
 -                 if rotation!=undefined then flags=bit.or flags CUT_F_ROT
 
 -                 if targetPosition!=undefined then flags=bit.or flags CUT_F_TARGETPOS
 
 -                 if fov!=undefined then flags=bit.or flags CUT_F_FOV
 
 -                 if rgb!=undefined then flags=bit.or flags CUT_F_COLOR
 
 -                 if posTCBInfo!=undefined then flags=bit.or flags CUT_F_POSTCBINFO
 
 -                 if rotTCBInfo!=undefined then flags=bit.or flags CUT_F_ROTTCBINFO
 
 -                 
 
 -                 format "{ 0x%;  " (bit.intAsHex flags) to:os.stream
 
 -                 
 
 -                 if position!=undefined then (
 
 -                         format "%; %; %;  " ((position.x * 100) as integer) ((position.z * 100) as integer) ((position.y * 100) as integer) to:os.stream
 
 -                 )
 
 -                 
 
 -                 writeTCB os posTCBInfo
 
 -                 
 
 -                 if rotation!=undefined then (
 
 -                         format "%; %; %; %;  " (formatFloat (rotation.angle / 360)) \
 
 -                         (formatFloat -rotation.axis.x) (formatFloat -rotation.axis.z) (formatFloat -rotation.axis.y)  to:os.stream
 
 -                 )
 
 -                 
 
 -                 writeTCB os rotTCBInfo
 
 -                 
 
 -                 if targetPosition!=undefined then (
 
 -                         format "%; %; %; " ((targetPosition.x * 100) as integer) ((targetPosition.z * 100) as integer) ((targetPosition.y * 100) as integer) to:os.stream
 
 -                 )
 
 -                 if targetRoll!=undefined then
 
 -                         format "%;  " (formatFloat (degtorad targetRoll))  to:os.stream
 
 -                 else if targetPosition!=undefined then
 
 -                         format " " to:os.stream
 
 -                         
 
 -                 if fov!=undefined then (
 
 -                         format "%;  " (formatFloat (degtorad fov))  to:os.stream
 
 -                 )
 
 -                 
 
 -                 if rgb!=undefined then (
 
 -                         format "%; %; %;  "  (rgb.r / 255) (rgb.g / 255) (rgb.b / 255) to:os.stream
 
 -                 )
 
 -                 
 
 -                 format "%; %; } // %%" length index idx os.newline to:os.stream
 
 -                 
 
 -         )
 
 - )
 
  复制代码 |   
 
 
 
 |