(command.CommandList children: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<Id.Lit_LBracket '['>} {<-n>} {(DQ ($ Id.VSub_DollarName '$BASH_VERSION'))} {<Id.Lit_RBracket ']'>} ) (C {<exec>} {<bash>} {($ Id.VSub_Number '$0')}) ] ) (C {<set>} {<-u>}) (command.ShFunction name: die body: (BraceGroup children: [ (command.Sentence child: (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_At '$@'))}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<2>}) terminator: <Id.Op_Semi _> ) ] ) ) (command.Sentence child: (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<source>} { (DQ (braced_var_sub token: <Id.VSub_Name BASH_SOURCE> suffix_op: (suffix_op.Unary tok: <Id.VOp1_Percent '%'> arg_word: {<Id.Lit_Slash '/'> <Id.Lit_Other '*'>} ) ) <'/../CmdlineGL.lib'> ) } ) (C {<die>} { (DQ <'Can\'t find CmdlineGL.lib ('> (braced_var_sub token: <Id.VSub_Name BASH_SOURCE> suffix_op: (suffix_op.Unary tok: <Id.VOp1_Percent '%'> arg_word: {<Id.Lit_Slash '/'> <Id.Lit_Other '*'>} ) ) <'/../CmdlineGL.lib)'> ) } ) ] ) terminator: <Id.Op_Semi _> ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<CmdlineGL_LoadLib>} {<RenderLoop>} {<ModelViewer>} {<Cube>}) (C {<die>} {(DQ <'Can\'t load required libraries'>)}) ] ) (command.ShFunction name: Init body: (BraceGroup children: [ (C {<glEnable>} {<GL_NORMALIZE>} {<GL_DEPTH_TEST>}) (C {<glEnable>} {<GL_LIGHTING>}) (C {<glEnable>} {<GL_TEXTURE_2D>}) (C {<glShadeModel>} {<GL_SMOOTH>}) (C {<glClearColor>} {(SQ <'#000033'>)}) (C {<glBlendFunc>} {<GL_SRC_ALPHA>} {<GL_ONE>}) (C {<CmdlineGL_LoadTex>} {<checker>}) (C {<glLoadIdentity>}) (C {<glEnable>} {<GL_LIGHT0>}) (C {<glLight>} {<GL_LIGHT0>} {<GL_AMBIENT>} {<0.8>} {<0.8>} {<0.8>} {<0>}) (C {<glLight>} {<GL_LIGHT0>} {<GL_DIFFUSE>} {<1>} {<0.8>} {<0.8>} {<0>}) (C {<glLight>} {<GL_LIGHT0>} {<GL_SPECULAR>} {<0.8>} {<0.8>} {<0.8>} {<0>}) (C {<glLight>} {<GL_LIGHT0>} {<GL_POSITION>} {<10>} {<10>} {<10>} {<1>}) (C {<glClear>} {<GL_COLOR_BUFFER_BIT>} {<GL_DEPTH_BUFFER_BIT>}) ] ) ) (command.ShFunction name: RenderLoop_Render body: (BraceGroup children: [ (C {<ModelViewer_Update>}) (C {<glLoadIdentity>}) (C {<ModelViewer_ApplyMatrix>}) (C {<glColor>} {<0.5>} {<0.5>} {<0.5>} {<1>}) (C {<glBindTexture>} {<GL_TEXTURE_2D>} {<checker>}) (C {<Cube>}) (C {<glFlush>}) (C {<cglSwapBuffers>}) (C {<glClear>} {<GL_COLOR_BUFFER_BIT>} {<GL_DEPTH_BUFFER_BIT>}) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:blend) op: assign_op.Equal rhs: {<0>} spids: [288] ) ] ) (command.ShFunction name: RenderLoop_DispatchEvent body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Pipeline children: [(C {<ModelViewer_DispatchEvent>} {(DQ ($ Id.VSub_At '$@'))})] negated: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.LogicalAnd left: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ ($ Id.VSub_Number '$1'))} right: {<K>} ) right: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ ($ Id.VSub_Number '$2'))} right: {<Id.Lit_Other '+'>} ) ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Case to_match: {(DQ ($ Id.VSub_Number '$3'))} arms: [ (case_arm pat_list: [{<q>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RenderLoop_Done) op: assign_op.Equal rhs: {<1>} spids: [352] ) ] ) ] spids: [349 350 354 -1] ) (case_arm pat_list: [{<b>}] action: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DPipe] children: [ (command.DParen child: (arith_expr.BinaryAssign op_id: Id.Arith_Equal left: <Id.Lit_ArithVarLike blend> right: (arith_expr.Unary op_id: Id.Arith_Bang child: <Id.Lit_ArithVarLike blend> ) ) ) (BraceGroup children: [ (command.Sentence child: (C {<glEnable>} {<GL_BLEND>}) terminator: <Id.Op_Semi _> ) (command.Sentence child: (C {<glDisable>} {<GL_DEPTH_TEST>}) terminator: <Id.Op_Semi _> ) ] ) (BraceGroup children: [ (command.Sentence child: (C {<glDisable>} {<GL_BLEND>}) terminator: <Id.Op_Semi _> ) (command.Sentence child: (C {<glEnable>} {<GL_DEPTH_TEST>}) terminator: <Id.Op_Semi _> ) ] ) ] ) ] spids: [357 358 405 -1] ) ] ) ] spids: [312 337] ) ] ) ] spids: [298 309] ) ] ) ] ) ) (command.ShFunction name: main body: (BraceGroup children:[(C {<Init>}) (C {<RenderLoop_Run>}) (C {<cglQuit>})]) ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DParen child: (arith_expr.Binary op_id: Id.Arith_Less left: {($ Id.VSub_Pound '$#')} right: {<Id.Lit_Digits 1>} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.AndOr ops: [Id.Op_DPipe] children: [(C {<CmdlineGL_Start>} {<rw>}) (C {<die>} {(DQ <'Can\'t init CmdlineGL'>)})] ) (C {<main>}) ] spids: [438 452] ) (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ ($ Id.VSub_Number '$1'))} right: {(DQ <--record>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShFunction name: CmdlineGL body: (BraceGroup children: [ (command.Sentence child: (command.Pipeline children: [(C {<tee>} {<replay>}) (C {<command>} {<CmdlineGL>})] negated: F ) terminator: <Id.Op_Semi _> ) ] ) ) (command.AndOr ops: [Id.Op_DPipe] children: [(C {<CmdlineGL_Start>} {<rw>}) (C {<die>} {(DQ <'Can\'t init CmdlineGL'>)})] ) (C {<main>}) ] spids: [470 487] ) (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.DBracket expr: (bool_expr.Binary op_id: Id.BoolBinary_GlobDEqual left: {(DQ ($ Id.VSub_Number '$1'))} right: {(DQ <--dump>)} ) ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<CmdlineGL_Start>} {<stdout>}) (C {<die>} {(DQ <'Can\'t init CmdlineGL state'>)}) ] ) (C {<main>}) ] spids: [525 542] ) ] else_action: [ (C {<echo>} {(SQ <'Usage: ImgCube.sh [ --record | --dump ]'>)}) (C {<echo>}) (C {<echo>} {(SQ <' --dump Dump all output to stdout at a virtual 40fps'>)}) (C {<echo>} {(SQ <' --record Run CmdlineGL, but duplicate all output to "./replay"'>)}) (C {<echo>}) (C {<echo>} {(SQ <' Recordings can be played by piping them into CmdlineGL.'>)}) (C {<echo>} {(SQ <' For instance:'>)}) (C {<echo>} {(SQ <' $ CmdlineGL <replay >/dev/null'>)}) ] ) ] )