├── .gitignore ├── AnglesModule.cpp ├── AnglesModule.hpp ├── Animation.cpp ├── Animation.hpp ├── ArmModule.cpp ├── ArmModule.hpp ├── BL_csv.cpp ├── BL_csv.hpp ├── BL_lengths.cpp ├── BL_lengths.hpp ├── BallModule.cpp ├── BallModule.hpp ├── BinModule.cpp ├── BinModule.hpp ├── Cache.cpp ├── Cache.hpp ├── Character ├── Character.cpp ├── Character.hpp ├── Draw.cpp ├── Draw.hpp ├── Jamfile ├── SVGDraw.cpp ├── SVGDraw.hpp ├── Skin.cpp ├── Skin.hpp ├── control_utils.cpp ├── control_utils.hpp ├── pose_utils.cpp ├── pose_utils.hpp ├── sensor_utils.cpp ├── sensor_utils.hpp ├── skin_utils.cpp └── skin_utils.hpp ├── ClockModule.cpp ├── ClockModule.hpp ├── ColorModule.cpp ├── ColorModule.hpp ├── ConformalModule.cpp ├── ConformalModule.hpp ├── ControlQualityModule.cpp ├── ControlQualityModule.hpp ├── ControllerModule.cpp ├── ControllerModule.hpp ├── CoordsModule.cpp ├── CoordsModule.hpp ├── CurveModule.cpp ├── CurveModule.hpp ├── DiskModule.cpp ├── DiskModule.hpp ├── DisplayModule.cpp ├── DisplayModule.hpp ├── Equation.cpp ├── Equation.hpp ├── FFTPaintModule.cpp ├── FFTPaintModule.hpp ├── FragmentModule.cpp ├── FragmentModule.hpp ├── Frame.cpp ├── Frame.hpp ├── GI_Paint.cpp ├── GI_Paint.hpp ├── GI_StepModule.cpp ├── GI_StepModule.hpp ├── GP_AddModule.cpp ├── GP_AddModule.hpp ├── GP_GeneralPaintModule.cpp ├── GP_GeneralPaintModule.hpp ├── GP_Integrator.hpp ├── GP_IterModule.cpp ├── GP_IterModule.hpp ├── GP_ProjectModule.cpp ├── GP_ProjectModule.hpp ├── GP_RHSModule.cpp ├── GP_RHSModule.hpp ├── GP_ResidualModule.cpp ├── GP_ResidualModule.hpp ├── GP_RestrictModule.cpp ├── GP_RestrictModule.hpp ├── GP_SimplePaintModule.cpp ├── GP_SimplePaintModule.hpp ├── GP_Stroke.cpp ├── GP_Stroke.hpp ├── GP_TexViewerModule.cpp ├── GP_TexViewerModule.hpp ├── GP_VCycle.cpp ├── GP_VCycle.hpp ├── GameModule.cpp ├── GameModule.hpp ├── GameStuff.cpp ├── GameStuff.hpp ├── GradientStuff.cpp ├── GradientStuff.hpp ├── GraphModule.cpp ├── GraphModule.hpp ├── HQ.cpp ├── HQ.hpp ├── IKModule.cpp ├── IKModule.hpp ├── Image.cpp ├── Image.hpp ├── InputModule.cpp ├── InputModule.hpp ├── Item.cpp ├── Item.hpp ├── Jamfile ├── Jamrules ├── JoystickModule.cpp ├── JoystickModule.hpp ├── LL_Anim.cpp ├── LL_Anim.hpp ├── LL_Code.cpp ├── LL_Code.hpp ├── LL_Dialog.cpp ├── LL_Dialog.hpp ├── LL_LayeringModule.cpp ├── LL_LayeringModule.hpp ├── LL_ListGraph.cpp ├── LL_ListGraph.hpp ├── LL_Obj.cpp ├── LL_Obj.hpp ├── LL_Regions.cpp ├── LL_Regions.hpp ├── LevelModule.cpp ├── LevelModule.hpp ├── Library ├── Jamfile ├── Library.cpp ├── Library.hpp ├── ReadSkeleton.cpp ├── ReadSkeleton.hpp ├── ReadSkeletonV.cpp ├── Reader.cpp ├── Reader.hpp ├── Skeleton.cpp ├── Skeleton.hpp ├── Vfile.cpp ├── Vfile.hpp ├── WriteAsfAmc.cpp ├── WriteAsfAmc.hpp ├── WriteBvh.cpp ├── WriteBvh.hpp └── amc_to_bmc.pl ├── ManyDGraphModule.cpp ├── ManyDGraphModule.hpp ├── Mode.cpp ├── Mode.hpp ├── ModelModule.cpp ├── ModelModule.hpp ├── Module.cpp ├── Module.hpp ├── MotionModule.cpp ├── MotionModule.hpp ├── PathModule.cpp ├── PathModule.hpp ├── PhysicsAnimation.cpp ├── PhysicsAnimation.hpp ├── PhysicsModule.cpp ├── PhysicsModule.hpp ├── PlaneModule.cpp ├── PlaneModule.hpp ├── Poisson.cpp ├── Poisson.hpp ├── PoissonTiming.cpp ├── PoissonTiming.hpp ├── PolicyModule.cpp ├── PolicyModule.hpp ├── PresHack.cpp ├── PresHack.hpp ├── ProjectionModule.cpp ├── ProjectionModule.hpp ├── README ├── Ray2dModule.cpp ├── Ray2dModule.hpp ├── ReflectionDistance.cpp ├── ReflectionDistance.hpp ├── RewardModule.cpp ├── RewardModule.hpp ├── SP_Paint.cpp ├── SP_Paint.hpp ├── SS_Canvas.cpp ├── SS_Canvas.hpp ├── SS_Constraint.cpp ├── SS_Constraint.hpp ├── SS_OptCanvas.cpp ├── SS_OptCanvas.hpp ├── SS_Volume.cpp ├── SS_Volume.hpp ├── SS_coefs.cpp ├── SS_coefs.hpp ├── SS_nice_dump.hpp ├── SS_optimizer.cpp ├── SS_optimizer.hpp ├── SliderModule.cpp ├── SliderModule.hpp ├── String.cpp ├── String.hpp ├── TraceModule.cpp ├── TraceModule.hpp ├── TransitionDistance.hpp ├── TransitionModule.cpp ├── TransitionModule.hpp ├── VidStream.cpp ├── VidStream.hpp ├── VideoModule.cpp ├── VideoModule.hpp ├── XYGraphModule.cpp ├── XYGraphModule.hpp ├── dist ├── .gitignore ├── README.hack ├── bg.png ├── equations │ └── build_png.pl ├── gp_shaders │ ├── build_rhs.glsl │ ├── gp_blend_add.glsl │ ├── gp_blend_directional_add.glsl │ ├── gp_blend_max.glsl │ ├── gp_blend_min.glsl │ ├── gp_blend_over.glsl │ ├── gp_compare.glsl │ ├── gp_edge_gradient.glsl │ ├── gp_scale_bias.glsl │ ├── gp_scale_bias_subpixel.glsl │ ├── gp_sum.glsl │ ├── grad_view.glsl │ ├── guess.glsl │ ├── gx_residual.glsl │ ├── gy_residual.glsl │ ├── iter_shader.glsl │ ├── iter_shader_no_corners.glsl │ ├── mg_f_downsample.glsl │ ├── mg_f_residual.glsl │ ├── mg_f_upsample.glsl │ ├── mg_iter.glsl │ ├── mg_iter_no_corners.glsl │ ├── mg_rhs.glsl │ ├── mg_rhs_downsample.glsl │ ├── rhs_0_0.glsl │ ├── rhs_1_1.glsl │ ├── rhs_3_3.glsl │ ├── vc_interpolate.glsl │ ├── vc_interpolate_ATI_HACK.glsl │ ├── vc_interpolate_add.glsl │ ├── vc_interpolate_add_ATI_HACK.glsl │ ├── vc_iter.glsl │ ├── vc_recenter_scale.glsl │ ├── vc_recenter_scale_ATI_HACK.glsl │ ├── vc_recenter_sub.glsl │ ├── vc_residual.glsl │ ├── vc_restrict.glsl │ ├── vc_restrict_ATI_HACK.glsl │ └── ycbcr_view.glsl ├── gp_siggraph │ ├── background.png │ ├── background.svg │ ├── background_HDR.png │ ├── background_blending.png │ ├── background_capture.png │ ├── background_editing.png │ ├── background_enhancement.png │ ├── background_shadows.png │ ├── blend-add-example.ppm │ ├── blend-dir-before.png │ ├── blend-dir-example.ppm │ ├── blend-max-example.ppm │ ├── blend-min-example.ppm │ ├── blend-over-example.ppm │ ├── blend.png │ ├── brush-clone.png │ ├── brush-edge.png │ ├── brush-grad.png │ ├── clone_example_blank.ppm │ ├── edge_example_blank.ppm │ ├── edit_example.png │ ├── edit_example.svg │ ├── edit_sel.png │ ├── example129x129.png │ ├── example129x129.ppm │ ├── eye_clone.AFTER.png │ ├── eye_clone.BEFORE.png │ ├── gp_siggraph.hack │ ├── j2_4.png │ ├── jduesing_3.png │ ├── jhays_sunbeams.png │ ├── jim_bw.png │ ├── jim_color.png │ ├── montage.png │ ├── portia.png │ ├── ref_agarwala.png │ ├── ref_agarwala_et_al.png │ ├── ref_agarwala_et_al2.png │ ├── ref_agrawal.png │ ├── ref_bhat.png │ ├── ref_burt_adelson.png │ ├── ref_drori.png │ ├── ref_du1.png │ ├── ref_du2.png │ ├── ref_elder_goldberg1.png │ ├── ref_elder_goldberg2.png │ ├── ref_fattal.png │ ├── ref_feris.png │ ├── ref_finlayson.png │ ├── ref_georgiev.png │ ├── ref_gooch.png │ ├── ref_jia.png │ ├── ref_jia_tang.png │ ├── ref_kazhdan.png │ ├── ref_levin.png │ ├── ref_lischinski.png │ ├── ref_perez.png │ ├── ref_raskar.png │ ├── ref_sun.png │ ├── ref_tumblin.png │ ├── ref_wang.png │ ├── ref_wang2.png │ ├── refs │ ├── sketch.f_mazzarfferi.6.png │ ├── sketch.f_mazzarfferi.c.png │ ├── speeds.png │ ├── stucco_hall2.clayjar.ppm │ └── window.ppm ├── gp_speaking2 │ ├── cave_painting.png │ ├── cornsweet.png │ ├── cornsweet_bar.png │ ├── diffusion_curves.png │ ├── edit_example.png │ ├── edit_example.svg │ ├── gimp.png │ ├── gp_speaking2.hack │ ├── happening.png │ ├── pixel_absolute.png │ ├── pixel_relative.png │ ├── ref_perez2.png │ ├── superpaint.png │ ├── superpaint_menu.png │ ├── superpaint_out.png │ └── two_squares.png ├── infty │ ├── checker.png │ ├── conformal.glsl │ ├── droste.png │ ├── escher_droste.png │ ├── escher_grid.png │ ├── frac_bounding.png │ ├── frac_computer.png │ ├── frac_extrude.png │ ├── frac_filter.png │ ├── frac_solids.png │ ├── frac_title.png │ ├── frac_trees.png │ ├── grid.png │ ├── infty.hack │ ├── leiden.png │ ├── leiden_droste.png │ ├── print_gallery.png │ ├── print_orig.png │ ├── print_orig_sm.png │ └── ronit.png ├── job │ ├── arm.png │ ├── arm.svg │ ├── ball-fluid.png │ ├── ball-nofluid.png │ ├── ball.xcf │ ├── blender.png │ ├── copho.png │ ├── corner.uteart.ppm │ ├── f_mazzarfferi.0.png │ ├── f_mazzarfferi.1.png │ ├── f_mazzarfferi.2.png │ ├── f_mazzarfferi.3.png │ ├── f_mazzarfferi.4.png │ ├── f_mazzarfferi.5.png │ ├── f_mazzarfferi.6.png │ ├── f_mazzarfferi.c.png │ ├── gimp.png │ ├── gimp │ │ ├── gimp1.png │ │ └── gimp2.png │ ├── impjoin.png │ ├── job.hack │ ├── kidpix.png │ ├── kidpix2.png │ ├── lamp..frank..ppm │ ├── nomenoctopus2.png │ ├── penrose.png │ ├── real_world │ │ ├── rw1.png │ │ ├── rw2.png │ │ ├── rw3.png │ │ ├── rw4.png │ │ ├── rw5.png │ │ ├── rw6.png │ │ └── rw7.png │ ├── ref_adelson_and_anandan1990.png │ ├── ref_cole_et_al_2008.png │ ├── ref_koenderink1998.png │ ├── ref_orzan_et_al.png │ ├── restack-0.png │ ├── restack-1.png │ ├── restack-2.png │ ├── restack.svg │ ├── sheep_after.png │ ├── sheep_before.png │ ├── soft_motive.png │ ├── soft_motive.svg │ ├── stack_br.png │ ├── stack_rb.png │ ├── stacking.png │ ├── stacking.svg │ ├── star.png │ ├── stucco..frank..and.atelier79033.ppm │ ├── sun-1-small.png │ ├── sun-2-small.png │ ├── swap.svg │ ├── swap_graph.png │ ├── swap_graph.svg │ ├── swap_opaque.png │ ├── swap_opaque_transp.png │ ├── swap_transp.png │ └── wall.IndplsMichael.ppm ├── ll_shaders │ ├── ll_2dfade.glsl │ ├── ll_3dfade.glsl │ ├── ll_3dsel.glsl │ ├── ll_regions.glsl │ ├── ll_subpixel.glsl │ ├── peel_model_frag.glsl │ └── shade_model_vert.glsl ├── ll_siggraph │ ├── anim-ball.png │ ├── anim-pillars.png │ ├── anim.svg │ ├── cyl.mp4 │ ├── cyl_blocks.obj │ ├── flip-up.png │ ├── ix.mp4 │ ├── ll.hack │ ├── overlap.png │ ├── pants.mp4 │ ├── restack-1.png │ ├── restack-2.png │ ├── restack-3.png │ ├── restack.svg │ ├── soft_example.xcf │ ├── soft_example_1.png │ ├── soft_example_2.png │ ├── soft_example_cons.png │ ├── soft_example_stacked.png │ ├── voting.png │ ├── w1.png │ ├── w2.png │ ├── w3.png │ ├── w4.png │ └── weave.mp4 ├── p_shaders │ ├── jacobi.glsl │ ├── jfa_final.glsl │ ├── jfa_init.glsl │ └── jfa_iter.glsl ├── shaders │ └── static.glsl ├── sp_shaders │ └── combine.glsl ├── ss │ ├── accumulate_frag.glsl │ ├── bg.png │ ├── cons_frag.glsl │ ├── hard.png │ ├── soft.png │ └── stroke_frag.glsl ├── ss_eg │ ├── Makefile │ ├── alpha_analogy.png │ ├── alpha_analogy.svg │ ├── alpha_anim.s1.png │ ├── alpha_anim.s2.png │ ├── alpha_anim.s3.png │ ├── alpha_anim.s4.png │ ├── alpha_anim.s5.png │ ├── alpha_anim.svg │ ├── armies.png │ ├── armies.svg │ ├── core_b.scaled.png │ ├── core_b_b.thumb.png │ ├── core_b_c.thumb.png │ ├── core_b_h.thumb.png │ ├── core_b_o.thumb.png │ ├── core_b_oh.thumb.png │ ├── core_b_w.thumb.png │ ├── ss_eg.hack │ ├── svgsplit.py │ ├── swap.both.png │ ├── swap.one.png │ ├── swap.opaque.png │ ├── swap.opaque.svg │ ├── swap.svg │ └── swap.transp.png └── ss_examples │ ├── .gitignore │ ├── aubergene.png │ ├── aubergene_cons.png │ ├── aubergene_cons.txt │ ├── cheese.c.png │ ├── cheese.m.png │ ├── cheese.png │ ├── cheese.s.png │ ├── cheese_cons.png │ ├── cheese_cons.txt │ ├── four_b.png │ ├── four_g.png │ ├── four_m.png │ ├── four_y.png │ ├── lightning3.png │ ├── lightning3_cons.png │ ├── lightning3_cons.txt │ ├── magic-mail.c.png │ ├── magic-mail.m.png │ ├── magic-mail.png │ ├── magic-mail.r.png │ ├── magic-mail_cons.png │ ├── magic-mail_cons.txt │ ├── one_megapixel_two_layers_1.png │ ├── one_megapixel_two_layers_2.png │ └── ss_examples.hack ├── gp_gl_helpers.hpp ├── gp_hsv_helpers.hpp ├── gp_load_ppm.hpp ├── hack.cpp ├── shapes.hpp └── util ├── .gitignore ├── Basis ├── Error.cpp ├── Error.hpp ├── Jamfile ├── Jamfile.new ├── Jamrules ├── Jamrules.new ├── ListDir.cpp ├── ListDir.hpp ├── PackedIO.cpp ├── PackedIO.hpp ├── Screen.cpp ├── Screen.hpp ├── linux │ └── run_necklace.sh └── osx │ ├── SDLMain.h │ ├── SDLMain.m │ ├── build_app.pl │ ├── build_info.pl │ └── default.icns ├── Graphics ├── Cache.cpp ├── Cache.hpp ├── Font.cpp ├── Font.hpp ├── FrameDumper.cpp ├── FrameDumper.hpp ├── GLExtensions.cpp ├── GLExtensions.hpp ├── GLSLShader.cpp ├── GLSLShader.hpp ├── Graphics.cpp ├── Graphics.hpp ├── Jamfile ├── Jamfile.new ├── Material.hpp ├── ShadowStencil.cpp ├── ShadowStencil.hpp ├── Texture.cpp ├── Texture.hpp ├── fonts │ └── gentium.txf ├── gen_extension_loader.pl ├── glext.h ├── load_jpeg.cpp ├── load_jpeg.hpp ├── load_save_png.cpp ├── load_save_png.hpp ├── ppm2avi.pl ├── texfont.c └── texfont.h ├── Jamfile ├── Jamrules └── Vector ├── Box.hpp ├── Matrix-loose.hpp ├── Matrix.hpp ├── MatrixGL-loose.hpp ├── Misc.hpp ├── Quat.hpp ├── QuatGL.hpp ├── RootedVector.hpp ├── Vector.hpp └── VectorGL.hpp /.gitignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | *.o 3 | dist/gentium.txf 4 | dist/hack 5 | dist/equations/*eqn 6 | dist/equations/*png 7 | -------------------------------------------------------------------------------- /AnglesModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ANGLESMODULE_HPP 2 | #define ANGLESMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | //for Arm constants... 6 | #include "ArmModule.hpp" 7 | 8 | class AnglesModule : public Module { 9 | public: 10 | AnglesModule() { 11 | in_ports.push_back(&base_ang); 12 | in_ports.push_back(&seg_ang); 13 | in_ports.push_back(&hand_ang); 14 | base_ang() = seg_ang() = hand_ang() = 0.0f; 15 | base_ang.position = make_vector(-0.25f, 1.0f / 6.0f - 0.5f); 16 | seg_ang.position = make_vector(-0.25f, 3.0f / 6.0f - 0.5f); 17 | hand_ang.position = make_vector(-0.25f, 5.0f / 6.0f - 0.5f); 18 | 19 | 20 | out_ports.push_back(&base); 21 | out_ports.push_back(&seg); 22 | out_ports.push_back(&hand); 23 | base() = make_vector(BasePos.x, BasePos.y, 0.0f); 24 | seg() = make_vector(BaseLen+BasePos.x, BasePos.y, 0.0f); 25 | hand() = make_vector(BaseLen+SegLen+BasePos.x, BasePos.y, 0.0f); 26 | base.position = make_vector(0.25f, 1.0f / 6.0f - 0.5f); 27 | seg.position = make_vector(0.25f, 3.0f / 6.0f - 0.5f); 28 | hand.position = make_vector(0.25f, 5.0f / 6.0f - 0.5f); 29 | } 30 | virtual ~AnglesModule() { 31 | } 32 | //Item functions: 33 | virtual Vector2f size(); 34 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 35 | //Module functions: 36 | virtual void update(float elapsed_time); 37 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 38 | 39 | PortDataContainer< float > base_ang; 40 | PortDataContainer< float > seg_ang; 41 | PortDataContainer< float > hand_ang; 42 | 43 | PortDataContainer< Vector3f > base; 44 | PortDataContainer< Vector3f > seg; 45 | PortDataContainer< Vector3f > hand; 46 | }; 47 | 48 | #endif //ANGLESMODULE_HPP 49 | -------------------------------------------------------------------------------- /Animation.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ANIMATIONMODULE_HPP 2 | #define ANIMATIONMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include 6 | 7 | class AnimationModule : public Module { 8 | public: 9 | AnimationModule(std::string params); 10 | virtual ~AnimationModule() { 11 | } 12 | //Item functions: 13 | virtual Vector2f size(); 14 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 15 | virtual bool get_pixel_size(Vector2ui &into); 16 | //Module functions: 17 | virtual void update(float elapsed_time); 18 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 19 | 20 | vector< std::string > filenames; 21 | unsigned int frame; 22 | std::string bad_filename; 23 | bool no_frame; 24 | }; 25 | 26 | #endif //ANIMATIONMODULE_HPP 27 | -------------------------------------------------------------------------------- /ArmModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ARMMODULE_HPP 2 | #define ARMMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | const float BaseLen = 0.75f; 6 | const float SegLen = 0.5f; 7 | const float Rad = 0.05f; 8 | const Vector2f BasePos = {{{-1.0f + Rad * 1.5f, 0.0f}}}; 9 | 10 | class ArmModule : public Module { 11 | public: 12 | ArmModule() { 13 | in_ports.push_back(&base); 14 | in_ports.push_back(&seg); 15 | in_ports.push_back(&hand); 16 | base() = make_vector(BasePos.x, BasePos.y, 0.0f); 17 | seg() = make_vector(BaseLen+BasePos.x, BasePos.y, 0.0f); 18 | hand() = make_vector(BaseLen+SegLen+BasePos.x, BasePos.y, 0.0f); 19 | base.position = make_vector(-1.0f, 1.0f / 6.0f - 0.5f); 20 | seg.position = make_vector(-1.0f, 3.0f / 6.0f - 0.5f); 21 | hand.position = make_vector(-1.0f, 5.0f / 6.0f - 0.5f); 22 | } 23 | virtual ~ArmModule() { 24 | } 25 | //Item functions: 26 | virtual Vector2f size(); 27 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 28 | //Module functions: 29 | virtual void update(float elapsed_time); 30 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 31 | 32 | PortDataContainer< Vector3f > base; 33 | PortDataContainer< Vector3f > seg; 34 | PortDataContainer< Vector3f > hand; 35 | }; 36 | 37 | #endif //ARMMODULE_HPP 38 | -------------------------------------------------------------------------------- /BL_csv.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BL_CSV_HPP 2 | #define BL_CSV_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | using std::vector; 7 | using std::string; 8 | 9 | class CSVMotion : public Module { 10 | public: 11 | CSVMotion(string filename, double seconds_per_frame); 12 | virtual ~CSVMotion(); 13 | virtual Vector2f size(); 14 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 15 | virtual void update(float elapsed_time); 16 | virtual bool handle_event(SDL_Event const &event, Vector2f mouse); 17 | 18 | vector< string > names; 19 | vector< vector< Vector3d > > positions; 20 | vector< Vector3d > roots; //(x,y, z_rot) 21 | Box3d bounds; //bounds of local poses 22 | 23 | bool playing; 24 | double time_acc; 25 | double seconds_per_frame; 26 | 27 | PortDataContainer< vector< double > > lengths; 28 | PortDataContainer< unsigned int > frame; 29 | PortDataContainer< vector< unsigned int > > highlight; 30 | 31 | void update_lengths(); 32 | }; 33 | 34 | #endif //BL_CSV_HPP 35 | -------------------------------------------------------------------------------- /BL_lengths.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BL_CSV_HPP 2 | #define BL_CSV_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | using std::vector; 7 | using std::string; 8 | 9 | class Lengths : public Module { 10 | public: 11 | Lengths(); 12 | virtual ~Lengths(); 13 | virtual Vector2f size(); 14 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 15 | virtual float cursor_alpha(); 16 | virtual void update(float elapsed_time); 17 | virtual bool handle_event(SDL_Event const &event, Vector2f mouse); 18 | 19 | vector< double > mins; 20 | vector< double > maxes; 21 | vector< unsigned int > order; 22 | unsigned int prev_frame; 23 | 24 | bool have_cursor; 25 | float cursor_x; 26 | 27 | vector< double > splits; //for nonlinear scaling 28 | 29 | PortDataContainer< vector< double > > lengths; 30 | PortDataContainer< unsigned int > frame; 31 | PortDataContainer< vector< unsigned int > > highlight; 32 | }; 33 | 34 | #endif //BL_CSV_HPP 35 | -------------------------------------------------------------------------------- /BallModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BALLMODULE_HPP 2 | #define BALLMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | class BallModule : public Module { 6 | public: 7 | BallModule() { 8 | in_ports.push_back(&pos); 9 | pos() = make_vector(0.0f, 0.0f, 0.0f); 10 | pos.position = make_vector(-1.0f, 0.0f); 11 | } 12 | virtual ~BallModule() { 13 | } 14 | //Item functions: 15 | virtual Vector2f size(); 16 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 17 | //Module functions: 18 | virtual void update(float elapsed_time); 19 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 20 | 21 | PortDataContainer< Vector3f > pos; 22 | }; 23 | 24 | #endif //BALLMODULE_HPP 25 | -------------------------------------------------------------------------------- /BinModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BINMODULE_HPP 2 | #define BINMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include "GameStuff.hpp" 6 | 7 | class BinModule : public Module { 8 | public: 9 | BinModule() { 10 | in_ports.push_back(&control); 11 | out_ports.push_back(&index); 12 | 13 | control.position = make_vector(-0.5f * size().x, 0.0f); 14 | index.position = make_vector( 0.5f * size().x, 0.0f); 15 | 16 | control.name = "control"; 17 | index.name = "index"; 18 | 19 | index() = 0; 20 | } 21 | virtual ~BinModule() { 22 | } 23 | //Item functions: 24 | virtual Vector2f size(); 25 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 26 | //Module functions: 27 | virtual void update(float elapsed_time); 28 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 29 | 30 | PortDataContainer< Game2d::Control > control; 31 | PortDataContainer< unsigned int > index; 32 | }; 33 | 34 | #endif //BINMODULE_HPP 35 | -------------------------------------------------------------------------------- /Character/Draw.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CHARACTER_RENDER_HPP 2 | #define CHARACTER_RENDER_HPP 3 | #include 4 | using std::string; 5 | 6 | #include "Character.hpp" 7 | 8 | namespace Character { 9 | //draw a pose! 10 | void draw(Pose const &pose, State const &state, bool detail=true, bool color=true, bool select=false, float alpha = 1.0f, string bubble = ""); 11 | //draw a control! 12 | void draw(Control const &control, State const &state); 13 | //draw a state! 14 | void draw(State const &state); 15 | }; 16 | 17 | #endif //CHARACTER_RENDER_HPP 18 | -------------------------------------------------------------------------------- /Character/Jamfile: -------------------------------------------------------------------------------- 1 | TOP = .. ; 2 | 3 | SubDir TOP Character ; 4 | 5 | NAMES = Draw Character pose_utils control_utils Skin skin_utils SVGDraw sensor_utils ; 6 | 7 | ObjectC++Flags Draw SVGDraw : $(SDLC++FLAGS) ; 8 | ObjectC++Flags Skin : $(SDLC++FLAGS) ; 9 | ObjectC++Flags skin_utils : $(SDLC++FLAGS) ; 10 | ObjectC++Flags sensor_utils : $(SDLC++FLAGS) ; 11 | 12 | CHARACTER_OBJECTS = $(NAMES:D=$(SUBDIR):S=$(SUFOBJ)) ; 13 | 14 | MyObjects $(NAMES:S=.cpp) ; 15 | -------------------------------------------------------------------------------- /Character/SVGDraw.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CHARACTER_SVGDRAW_HPP 2 | #define CHARACTER_SVGDRAW_HPP 3 | 4 | #include "Character.hpp" 5 | 6 | #include 7 | using std::string; 8 | #include 9 | using std::ostream; 10 | 11 | namespace Character { 12 | 13 | void start_draw(ostream &svg_file); //writes svg header 14 | void draw(ostream &svg_file, Pose const &pose, State const &state, bool detail = true, bool color = true); 15 | void finish_draw(ostream &svg_file); //does final depth sort, output, writes footer 16 | 17 | }; 18 | 19 | #endif //CHARACTER_SVGDRAW_HPP 20 | -------------------------------------------------------------------------------- /Character/control_utils.cpp: -------------------------------------------------------------------------------- 1 | #include "control_utils.hpp" 2 | 3 | #include 4 | 5 | namespace Character { 6 | 7 | float control_distance(Control const &a, Control const &b) { 8 | float dis = 0.0f; 9 | { //handle relative velocity: 10 | float len_a = length(a.desired_velocity); 11 | float len_b = length(b.desired_velocity); 12 | dis += fabs(len_a - len_b); 13 | //handle relative angle: 14 | if (len_a > 0.0f && len_b > 0.0f) { 15 | dis += fabs(1.0f - (a.desired_velocity * b.desired_velocity) / (len_a * len_b)); 16 | } 17 | } 18 | //handle_relative turning: 19 | dis += fabs(a.desired_turning - b.desired_turning); 20 | //handle jumping: 21 | if (a.jump != b.jump) dis += 5.0f; 22 | return dis; 23 | } 24 | 25 | float total_control_distance(Library::Motion const &motion, unsigned int start, unsigned int end, Control const &control) { 26 | float dis = 0.0f; 27 | for (unsigned int frame = start; frame < end; ++frame) { 28 | Control motion_control; 29 | motion.get_control(frame, motion_control); 30 | dis += control_distance(motion_control, control); 31 | } 32 | return dis; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Character/control_utils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CONTROL_UTILS_HPP 2 | #define CONTROL_UTILS_HPP 3 | 4 | #include "Character.hpp" 5 | 6 | namespace Library { 7 | class Motion; 8 | }; 9 | 10 | namespace Character { 11 | float control_distance(Control const &a, Control const &b); 12 | float total_control_distance(Library::Motion const &motion, unsigned int start, unsigned int end, Control const &control); 13 | } 14 | #endif //CONTROL_UTILS_HPP 15 | -------------------------------------------------------------------------------- /Character/pose_utils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CHARACTER_POSE_UTILS_HPP 2 | #define CHARACTER_POSE_UTILS_HPP 3 | 4 | #include "Character.hpp" 5 | 6 | namespace Character { 7 | 8 | class WorldBones { 9 | public: 10 | vector< Vector3f > bases; 11 | vector< Vector3f > tips; 12 | vector< Quatf > orientations; 13 | }; 14 | 15 | void get_world_bones(Pose const &pose, WorldBones &out); 16 | 17 | float world_distance(WorldBones &a, WorldBones &b); 18 | 19 | void lower_to_ground(Pose const &pose); 20 | 21 | vector< Vector3f > get_pose_positions(int motion, int frame); 22 | void face_forward_and_zero_legs(Pose &pose); 23 | void zero_legs(Pose &pose); 24 | 25 | }; 26 | 27 | #endif //CHARACTER_POSE_UTILS_HPP 28 | -------------------------------------------------------------------------------- /Character/sensor_utils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CHARACTER_SENSOR_UTILS_HPP 2 | #define CHARACTER_SENSOR_UTILS_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | using std::vector; 11 | using std::string; 12 | using std::ofstream; 13 | 14 | namespace Character { 15 | 16 | class VirtualSensor { 17 | public: 18 | VirtualSensor() : relative_position(make_vector< float, 3 >(0)) { 19 | relative_orientation.clear(); 20 | } 21 | string bonename; 22 | Vector3f relative_position; 23 | Quatf relative_orientation; 24 | 25 | Quatf asf2v; 26 | }; 27 | 28 | // calls load_ and apply_, but the two functions may be used separately. 29 | void load_and_apply_virtual_sensors(); 30 | void load_virtual_sensors(); 31 | void apply_virtual_sensors(); 32 | void apply_virtual_sensors_only_one_motion(int motion); // used for calibrate motion 33 | 34 | void draw_virtual_sensors(Character::Pose current_pose); 35 | vector< float > compute_avg_sensor_diff(int motion); 36 | 37 | void save_virtual_sensors(string filename); 38 | 39 | // helpers 40 | void slurp_motion_data(int motion, vector< vector< Vector3f > > &wb_bases, vector< vector< Quatf > > &wb_orientations); 41 | void smooth_data(vector< vector< Vector3f > > &wb_bases, vector< vector< Quatf > > &wb_orientations); 42 | void set_accelerations(int motion, bool is_v, const vector< vector< Vector3f > > &wb_bases, const vector< vector< Quatf > > &wb_orientations); 43 | void smooth_accelerations(vector< vector< float > > &acc); 44 | 45 | 46 | extern vector< VirtualSensor > virtual_sensors; 47 | 48 | } 49 | #endif 50 | -------------------------------------------------------------------------------- /Character/skin_utils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CHARACTER_SKIN_UTILS_HPP 2 | #define CHARACTER_SKIN_UTILS_HPP 3 | 4 | #include "Skin.hpp" 5 | #include 6 | namespace Character { 7 | bool load(std::string const &filename, Library::Skeleton const *on, Skin &into, bool shadow = false); 8 | } //namespace Character 9 | 10 | #endif //CHARACTER_SKIN_UTILS_HPP 11 | -------------------------------------------------------------------------------- /ClockModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CLOCKMODULE_HPP 2 | #define CLOCKMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | //for Arm constants... 6 | #include "ArmModule.hpp" 7 | 8 | class ClockModule : public Module { 9 | public: 10 | ClockModule() { 11 | out_ports.push_back(&accum); 12 | accum.position = make_vector(0.25f, 0.0f); 13 | accum() = 0.0f; 14 | paused = true; 15 | } 16 | virtual ~ClockModule() { 17 | } 18 | //Item functions: 19 | virtual Vector2f size(); 20 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 21 | //Module functions: 22 | virtual void update(float elapsed_time); 23 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 24 | 25 | PortDataContainer< float > accum; 26 | bool paused; 27 | }; 28 | 29 | #endif //CLOCKMODULE_HPP 30 | -------------------------------------------------------------------------------- /ColorModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COLORMODULE_HPP 2 | #define COLORMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | class ColorModule : public Module { 6 | public: 7 | ColorModule() { 8 | set_color(make_vector(0.5f, 0.5f, 0.5f)); 9 | out_ports.push_back(&color); 10 | color.name = "color"; 11 | color.position = make_vector(1.0f, 0.0f); 12 | dragging_triangle = false; 13 | } 14 | virtual ~ColorModule() { 15 | } 16 | //Item functions: 17 | virtual Vector2f size(); 18 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 19 | //Module functions: 20 | virtual void update(float elapsed_time); 21 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 22 | 23 | void set_color(Vector3f rgb_color); 24 | bool dragging_triangle; 25 | void handle_position(Vector2f pos); //helper for handle_event. 26 | PortDataContainer< Vector3f > color; 27 | Vector3f hsv_color; 28 | }; 29 | 30 | #endif //COLORMODULE_HPP 31 | -------------------------------------------------------------------------------- /ControlQualityModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLQUALITYMODULE_HPP 2 | #define CONTROLQUALITYMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | class ControlQualityModule : public Module { 9 | public: 10 | ControlQualityModule() { 11 | in_ports.push_back(&frag); 12 | in_ports.push_back(&bin); 13 | 14 | frag.position = make_vector(-0.5f * size().x, 0.25f * size().y); 15 | bin.position = make_vector(-0.5f * size().x,-0.25f * size().y); 16 | 17 | frag() = (unsigned)-1; 18 | bin() = (unsigned)-1; 19 | 20 | frag.name = "frag"; 21 | bin.name = "bin"; 22 | 23 | out_ports.push_back(&value); 24 | 25 | value.position = make_vector(0.5f * size().x, 0.0f); 26 | 27 | value() = 0.0f; 28 | 29 | value.name = "value"; 30 | 31 | } 32 | virtual ~ControlQualityModule() { 33 | } 34 | 35 | //Item functions: 36 | virtual Vector2f size(); 37 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 38 | //Module functions: 39 | virtual void update(float elapsed_time); 40 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 41 | 42 | PortDataContainer< unsigned int > frag; 43 | PortDataContainer< unsigned int > bin; 44 | PortDataContainer< float > value; 45 | }; 46 | 47 | #endif //CONTROLQUALITYMODULE_HPP 48 | -------------------------------------------------------------------------------- /ControllerModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLLERMODULE_HPP 2 | #define CONTROLLERMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | class ControllerModule : public Module { 9 | public: 10 | ControllerModule() { 11 | in_ports.push_back(&control); 12 | out_ports.push_back(&frame); 13 | 14 | control.position = make_vector(-0.25f, 0.0f); 15 | frame.position = make_vector( 0.25f, 0.0f); 16 | 17 | fragment = 0; 18 | time_acc = 0; 19 | 20 | frame().motion = (unsigned)-1; 21 | } 22 | virtual ~ControllerModule() { 23 | } 24 | 25 | //Item functions: 26 | virtual Vector2f size(); 27 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 28 | //Module functions: 29 | virtual void update(float elapsed_time); 30 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 31 | 32 | private: 33 | 34 | PortDataContainer< Game2d::Control > control; 35 | 36 | unsigned int fragment; 37 | float time_acc; 38 | PortDataContainer< Game2d::Frame > frame; 39 | }; 40 | 41 | #endif //CONTROLLERMODULE_HPP 42 | -------------------------------------------------------------------------------- /CoordsModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COORDSMODULE_HPP 2 | #define COORDSMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | class CoordsModule : public Module { 6 | public: 7 | CoordsModule() { 8 | in_ports.push_back(&time); 9 | in_ports.push_back(&coords); 10 | time.position = make_vector(-1.0f, 0.25f); 11 | coords.position = make_vector(-1.0f,-0.25f); 12 | current() = make_vector(0.0f, 0.0f, 0.0f); 13 | time() = 0.0f; 14 | out_ports.push_back(¤t); 15 | current.position = make_vector(1.0f, 0.0f); 16 | } 17 | virtual ~CoordsModule() { 18 | } 19 | //Item functions: 20 | virtual Vector2f size(); 21 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 22 | //Module functions: 23 | virtual void update(float elapsed_time); 24 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 25 | 26 | //input: 27 | PortDataContainer< vector< Vector3f > > coords; 28 | PortDataContainer< float > time; 29 | //output: 30 | PortDataContainer< Vector3f > current; 31 | }; 32 | 33 | #endif //COORDSMODULE_HPP 34 | -------------------------------------------------------------------------------- /CurveModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CURVEMODULE_HPP 2 | #define CURVEMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | class CurveModule : public Module { 6 | public: 7 | CurveModule() { 8 | in_ports.push_back(&points); 9 | points.position = make_vector(-1.0f, 0.0f); 10 | out_ports.push_back(&coords); 11 | coords.position = make_vector(1.0f, 0.0f); 12 | current = 0; 13 | twist = false; 14 | } 15 | virtual ~CurveModule() { 16 | } 17 | //Item functions: 18 | virtual Vector2f size(); 19 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 20 | //Module functions: 21 | virtual void update(float elapsed_time); 22 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 23 | 24 | void recalc(); 25 | 26 | //input: 27 | PortDataContainer< vector< Vector4f > > points; 28 | //curve points -> x, y, rot, time. 29 | //output: 30 | PortDataContainer< vector< Vector3f > > coords; 31 | 32 | unsigned int current; 33 | bool twist; 34 | }; 35 | 36 | #endif //CURVEMODULE_HPP 37 | -------------------------------------------------------------------------------- /DiskModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DISKMODULE_HPP 2 | #define DISKMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | class DiskModule : public Module { 6 | public: 7 | DiskModule() { 8 | step = 0; 9 | animate = false; 10 | } 11 | virtual ~DiskModule() { 12 | } 13 | //Item functions: 14 | virtual Vector2f size(); 15 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 16 | //Module functions: 17 | virtual void update(float elapsed_time); 18 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 19 | unsigned int step; 20 | bool animate; 21 | }; 22 | 23 | #endif //DISKMODULE_HPP 24 | -------------------------------------------------------------------------------- /DisplayModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DISPLAYMODULE_HPP 2 | #define DISPLAYMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | template< class DATA > 6 | class DisplayModule : public Module { 7 | public: 8 | DisplayModule(std::string const &_prefix) : prefix(_prefix) { 9 | in_ports.push_back(&data); 10 | data.position = make_vector(-0.5f * size().x, 0.0f); 11 | data.name = "data"; 12 | } 13 | virtual ~DisplayModule() { 14 | } 15 | //Item functions: 16 | virtual Vector2f size(); 17 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 18 | //Module functions: 19 | virtual void update(float elapsed_time); 20 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 21 | 22 | PortDataContainer< DATA > data; 23 | std::string prefix; 24 | }; 25 | 26 | #endif //DISPLAYMODULE_HPP 27 | -------------------------------------------------------------------------------- /Equation.hpp: -------------------------------------------------------------------------------- 1 | #ifndef EQUATION_HPP 2 | #define EQUATION_HPP 3 | 4 | #include "Item.hpp" 5 | 6 | #include 7 | 8 | #include 9 | 10 | using std::string; 11 | 12 | class Equation : public Item { 13 | public: 14 | Equation(string const &_equation = "") : equation(_equation) { 15 | bad_equation = ""; 16 | } 17 | virtual ~Equation() {} 18 | string equation; 19 | private: 20 | string bad_equation; 21 | Graphics::TextureRef get_texture(); 22 | public: 23 | virtual Vector2f size(); 24 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 25 | virtual bool get_pixel_size(Vector2ui &into); 26 | 27 | }; 28 | 29 | #endif //EQUATION_HPP 30 | -------------------------------------------------------------------------------- /FragmentModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FRAGMENTMODULE_HPP 2 | #define FRAGMENTMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | //for communication with the MotionModule 9 | extern unsigned int CurrentFragment; 10 | 11 | class FragmentModule : public Module { 12 | public: 13 | FragmentModule(unsigned int _index) { 14 | index() = _index; 15 | assert(index() < Game2d::fragments.size()); 16 | paused = true; 17 | time_acc = 0.0f; 18 | out_ports.push_back(&index); 19 | index.position = make_vector(0.5f * this->size().x, 0.0f); 20 | index.name = "index"; 21 | in_ports.push_back(&in_index); 22 | in_index.position = make_vector(-0.5f * this->size().x, 0.0f); 23 | in_index.name = "in_index"; 24 | in_index() = (unsigned)-1; 25 | } 26 | virtual ~FragmentModule() { 27 | } 28 | 29 | //Item functions: 30 | virtual Vector2f size(); 31 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 32 | //Module functions: 33 | virtual void update(float elapsed_time); 34 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 35 | 36 | bool paused; 37 | float time_acc; 38 | PortDataContainer< unsigned int > index; 39 | PortDataContainer< unsigned int > in_index; 40 | }; 41 | 42 | #endif //FRAGMENTMODULE_HPP 43 | -------------------------------------------------------------------------------- /GI_Paint.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GI_PAINT_HPP 2 | #define GI_PAINT_HPP 3 | 4 | #include "GI_StepModule.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "Module.hpp" 12 | 13 | #include 14 | 15 | class StrokeBrush { 16 | public: 17 | StrokeBrush(float softness = 0.5f, float radius = 10.0f); 18 | float rate; //stamps / radius 19 | float flow; //paint / stamp 20 | float radius; //radius, in pixels 21 | 22 | //These require re-rendering tex: 23 | float softness; 24 | GLuint get_tex(); 25 | private: 26 | GLuint tex; //GL_TEXTURE_2D texture for brush; updated, if needed, when you call 'get_tex()'. NOTE: always use in same GL context! 27 | float tex_softness; 28 | }; 29 | 30 | class Paint : public Module { 31 | public: 32 | Paint(Vector2ui const &_size); 33 | virtual ~Paint(); 34 | virtual Vector2f size(); 35 | virtual bool handle_event(SDL_Event const &e, Vector2f mouse); 36 | virtual float cursor_alpha(); 37 | virtual void update(float elapsed); 38 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 39 | 40 | float cursor_fade; 41 | bool have_cursor; 42 | 43 | GLuint stroke_tex; 44 | GLuint stroke_fb; 45 | 46 | GLuint temp_tex; 47 | GLuint temp_fb; 48 | 49 | GLuint fb; 50 | 51 | 52 | Vector2f cur_mouse; 53 | 54 | //Painting stuff: 55 | void render_stroke(); 56 | std::vector< Vector4f > acc; 57 | float along; 58 | StrokeBrush brush; 59 | bool erase; 60 | 61 | float brush_spin_acc; 62 | 63 | PortDataContainer< Vector3f > color; 64 | PortDataContainer< TexInfo > tex; 65 | }; 66 | 67 | #endif //GI_PAINT_HPP 68 | -------------------------------------------------------------------------------- /GI_StepModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef STEPMODULE_HPP 2 | #define STEPMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include 6 | 7 | class TexInfo { 8 | public: 9 | TexInfo() : size(make_vector(0U, 0U)), tex(0), seq(0) { 10 | } 11 | void dealloc(); //deallocate textures. use with care! 12 | void alloc(Vector2ui _size); 13 | Vector2ui size; 14 | GLuint tex; 15 | unsigned int seq; //when updated, seq gets +1. 16 | }; 17 | 18 | class StepModule : public Module { 19 | public: 20 | StepModule(); 21 | virtual ~StepModule(); 22 | //Item functions: 23 | virtual Vector2f size(); 24 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 25 | //Module functions: 26 | virtual void update(float elapsed_time); 27 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 28 | 29 | GLuint fb; 30 | 31 | PortDataContainer< TexInfo > tex; 32 | PortDataContainer< TexInfo > high_tex; 33 | PortDataContainer< TexInfo > low_tex; 34 | PortDataContainer< TexInfo > over_tex; 35 | }; 36 | 37 | #endif //STEPMODULE_HPP 38 | -------------------------------------------------------------------------------- /GP_AddModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ADDMODULE_HPP 2 | #define ADDMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include "GP_TexViewerModule.hpp" 6 | 7 | class AddModule : public Module { 8 | public: 9 | AddModule(); 10 | virtual ~AddModule() { 11 | } 12 | //Item functions: 13 | virtual Vector2f size(); 14 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 15 | //Module functions: 16 | virtual void update(float elapsed_time); 17 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 18 | 19 | PortDataContainer< TexPacket > guess_in; 20 | PortDataContainer< TexPacket > correction_in; 21 | PortDataContainer< TexPacket > guess_out; 22 | 23 | bool do_add; 24 | }; 25 | 26 | #endif //ADDMODULE_HPP 27 | -------------------------------------------------------------------------------- /GP_Integrator.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRATOR_HPP 2 | #define INTEGRATOR_HPP 3 | 4 | /* 5 | * Basic integrator that plugs into 'GeneralPaint' to actually make it tick. 6 | */ 7 | 8 | #include 9 | 10 | using std::string; 11 | 12 | class GeneralPaintModule; 13 | 14 | class Integrator { 15 | public: 16 | virtual ~Integrator() { 17 | } 18 | //printed to let user know current integrator: 19 | virtual string name() = 0; 20 | //init from 'f' guess, store any viewable textures into 'viewable_textures': 21 | virtual void init(GeneralPaintModule *gp) = 0; 22 | //called every frame to actually do integrationings, possibly: 23 | virtual void update(GeneralPaintModule *gp) = 0; 24 | //after gradient changed: 25 | virtual void gradient_changed(GeneralPaintModule *gp) = 0; 26 | }; 27 | 28 | #endif //INTEGRATOR_HPP 29 | -------------------------------------------------------------------------------- /GP_IterModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ITERMODULE_HPP 2 | #define ITERMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include "GP_TexViewerModule.hpp" 6 | 7 | class IterModule : public Module { 8 | public: 9 | IterModule(unsigned int depth); 10 | virtual ~IterModule() { 11 | } 12 | //Item functions: 13 | virtual Vector2f size(); 14 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 15 | //Module functions: 16 | virtual void update(float elapsed_time); 17 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 18 | 19 | PortDataContainer< TexPacket > guess_in; 20 | PortDataContainer< TexPacket > rhs_in; 21 | PortDataContainer< TexPacket > guess_out; 22 | 23 | float corner, edge, middle, magic_x; 24 | 25 | bool do_iter; 26 | }; 27 | 28 | #endif //ITERMODULE_HPP 29 | -------------------------------------------------------------------------------- /GP_ProjectModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PROJECTMODULE_HPP 2 | #define PROJECTMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include "GP_TexViewerModule.hpp" 6 | 7 | class ProjectModule : public Module { 8 | public: 9 | ProjectModule(); 10 | virtual ~ProjectModule() { 11 | } 12 | //Item functions: 13 | virtual Vector2f size(); 14 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 15 | //Module functions: 16 | virtual void update(float elapsed_time); 17 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 18 | 19 | PortDataContainer< TexPacket > in; 20 | PortDataContainer< TexPacket > out; 21 | 22 | bool do_project; 23 | }; 24 | 25 | #endif //PROJECTMODULE_HPP 26 | -------------------------------------------------------------------------------- /GP_RHSModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef RHSMODULE_HPP 2 | #define RHSMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include "GP_TexViewerModule.hpp" 6 | 7 | class RHSModule : public Module { 8 | public: 9 | RHSModule(); 10 | virtual ~RHSModule() { 11 | } 12 | //Item functions: 13 | virtual Vector2f size(); 14 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 15 | //Module functions: 16 | virtual void update(float elapsed_time); 17 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 18 | 19 | PortDataContainer< TexPacket > gx_in; 20 | PortDataContainer< TexPacket > gy_in; 21 | PortDataContainer< TexPacket > rhs_out; 22 | }; 23 | 24 | #endif //RHSMODULE_HPP 25 | -------------------------------------------------------------------------------- /GP_ResidualModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef RESIDUALMODULE_HPP 2 | #define RESIDUALMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include "GP_TexViewerModule.hpp" 6 | 7 | class ResidualModule : public Module { 8 | public: 9 | ResidualModule(); 10 | virtual ~ResidualModule() { 11 | } 12 | //Item functions: 13 | virtual Vector2f size(); 14 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 15 | //Module functions: 16 | virtual void update(float elapsed_time); 17 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 18 | 19 | PortDataContainer< TexPacket > guess_in; 20 | PortDataContainer< TexPacket > rhs_in; 21 | PortDataContainer< TexPacket > rhs_out; 22 | 23 | float corner, edge, middle; 24 | 25 | bool do_residual; 26 | }; 27 | 28 | #endif //RESIDUALMODULE_HPP 29 | -------------------------------------------------------------------------------- /GP_RestrictModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef RESTRICTMODULE_HPP 2 | #define RESTRICTMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include "GP_TexViewerModule.hpp" 6 | 7 | class RestrictModule : public Module { 8 | public: 9 | RestrictModule(); 10 | virtual ~RestrictModule() { 11 | } 12 | //Item functions: 13 | virtual Vector2f size(); 14 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 15 | //Module functions: 16 | virtual void update(float elapsed_time); 17 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 18 | 19 | PortDataContainer< TexPacket > in; 20 | PortDataContainer< TexPacket > out; 21 | 22 | bool do_restrict; 23 | }; 24 | 25 | #endif //RESTRICTMODULE_HPP 26 | -------------------------------------------------------------------------------- /GP_Stroke.cpp: -------------------------------------------------------------------------------- 1 | #include "GP_Stroke.hpp" 2 | 3 | void Stroke::clear() { 4 | points.clear(); 5 | new_points = 0; 6 | dirty = false; 7 | } 8 | 9 | void Stroke::submit_point(Vector2f const &new_point) { 10 | points.push_back(new_point); 11 | ++new_points; 12 | //TODO: 'new point' hook? 13 | } 14 | 15 | void SmoothStroke::clear() { 16 | smoothing_queue.clear(); 17 | Stroke::clear(); 18 | } 19 | 20 | void SmoothStroke::submit_point(Vector2f const &new_point) { 21 | //chop stroke, add points: 22 | if (points.empty() && smoothing_queue.empty()) { 23 | //no stroke yet, so dump starting point in: 24 | smoothing_queue.push_back(new_point); 25 | last = new_point; 26 | along = 0.0f; 27 | } 28 | while (along + length(new_point - last) > Step) { 29 | last += normalize(new_point - last) * (Step - along); 30 | smoothing_queue.push_back(last); 31 | along = 0.0f; 32 | if (smoothing_queue.size() == smoothing_kernel.size()) { 33 | Vector2f p = make_vector( 0.0f, 0.0f ); 34 | for (unsigned int i = 0; i < smoothing_kernel.size(); ++i) { 35 | p += smoothing_kernel[i] * smoothing_queue[i]; 36 | } 37 | Stroke::submit_point(p); 38 | smoothing_queue.pop_front(); 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /GP_Stroke.hpp: -------------------------------------------------------------------------------- 1 | #ifndef STROKE_HPP 2 | #define STROKE_HPP 3 | 4 | //Convenient container for keeping track of a user stroke. 5 | //Idea: 6 | // points get submitted -> 7 | // stroke chopped up into short segments -> 8 | // short segments smoothed -> 9 | // final stroke geometry generated (incrementally based on smoothed segments). 10 | 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | using std::vector; 18 | using std::deque; 19 | 20 | class Stroke { 21 | public: 22 | Stroke() { 23 | clear(); 24 | } 25 | virtual ~Stroke() { } 26 | virtual void clear(); 27 | virtual void submit_point(Vector2f const &new_point); 28 | vector< Vector2f > points; 29 | unsigned int new_points; //basically a 'dirty' flag, for incremental computation. 30 | bool dirty; //really a dirty flag (i.e. "re-do the entire thing") 31 | }; 32 | 33 | class SmoothStroke : public Stroke { 34 | public: 35 | SmoothStroke() { 36 | Step = 1; 37 | smoothing_kernel.push_back( 0.25f ); 38 | smoothing_kernel.push_back( 0.50f ); 39 | smoothing_kernel.push_back( 0.25f ); 40 | clear(); 41 | } 42 | virtual ~SmoothStroke() { } 43 | virtual void clear(); 44 | virtual void submit_point(Vector2f const &new_point); 45 | //options: 46 | vector< float > smoothing_kernel; 47 | float Step; 48 | //dynamic stuff: 49 | Vector2f last; 50 | float along; 51 | deque< Vector2f > smoothing_queue; 52 | }; 53 | 54 | 55 | #endif //STROKE_HPP 56 | -------------------------------------------------------------------------------- /GP_TexViewerModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TEXVIEWERMODULE_HPP 2 | #define TEXVIEWERMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include 6 | 7 | class TexPacket { 8 | public: 9 | TexPacket() : width(0), height(0), tex(0), fb(0), new_flag(false) { 10 | } 11 | void dealloc(); //deallocate textures. use with care! 12 | void alloc(unsigned int width, unsigned int height); //allocate textures -- DOES NOT DEALLOC! (though will warn) 13 | unsigned int width, height; 14 | GLuint tex, fb; 15 | bool new_flag; //some sort of 'hey there, use this texture, eh?' flag. 16 | }; 17 | 18 | class TexViewerModule : public Module { 19 | public: 20 | TexViewerModule(bool _container, bool _rotate=false); 21 | virtual ~TexViewerModule() { 22 | } 23 | //Item functions: 24 | virtual Vector2f size(); 25 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 26 | //Module functions: 27 | virtual void update(float elapsed_time); 28 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 29 | 30 | PortDataContainer< TexPacket > tex; 31 | PortDataContainer< TexPacket > tex_out; 32 | bool container; 33 | bool rotate; 34 | }; 35 | 36 | #endif //TEXVIEWERMODULE_HPP 37 | -------------------------------------------------------------------------------- /GameModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GAMEMODULE_HPP 2 | #define GAMEMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | #include 9 | using std::pair; 10 | using std::make_pair; 11 | 12 | class GameModule : public Module { 13 | public: 14 | GameModule() { 15 | in_control.name = "cont"; 16 | out_control.name = "cont"; 17 | status.name = "status"; 18 | in_ports.push_back(&in_control); 19 | out_ports.push_back(&out_control); 20 | out_ports.push_back(&status); 21 | 22 | in_control.position = make_vector(-0.25f, 0.0f); 23 | 24 | out_control.position = make_vector( 0.25f, 3.0f / 4.0f -0.5f); 25 | status.position = make_vector( 0.25f, 1.0f / 4.0f -0.5f); 26 | 27 | flip_timer = 0.0f; 28 | 29 | spawn(); 30 | } 31 | virtual ~GameModule() { 32 | } 33 | 34 | //Item functions: 35 | virtual Vector2f size(); 36 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 37 | //Module functions: 38 | virtual void update(float elapsed_time); 39 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 40 | 41 | private: 42 | void spawn(); //spawn player 43 | 44 | PortDataContainer< Game2d::Control > in_control; 45 | PortDataContainer< Game2d::Control > out_control; 46 | 47 | float flip_timer; 48 | 49 | PortDataContainer< Game2d::LevelStatus > status; 50 | PortDataContainer< Vector2f > vel; //not connected, but consistency. 51 | }; 52 | 53 | #endif //GAMEMODULE_HPP 54 | -------------------------------------------------------------------------------- /GraphModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHMODULE_HPP 2 | #define GRAPHMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | class GraphModule : public Module { 6 | public: 7 | GraphModule() { 8 | in_ports.push_back(&time); 9 | in_ports.push_back(&graph); 10 | time.position = make_vector(-1.0f, 0.25f); 11 | time.name = "time"; 12 | graph.position = make_vector(-1.0f,-0.25f); 13 | graph.name = "graph"; 14 | current() = 0.0f; 15 | time() = 0.0f; 16 | out_ports.push_back(¤t); 17 | current.position = make_vector(1.0f, 0.0f); 18 | current.name = "val"; 19 | } 20 | virtual ~GraphModule() { 21 | } 22 | //Item functions: 23 | virtual Vector2f size(); 24 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 25 | //Module functions: 26 | virtual void update(float elapsed_time); 27 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 28 | 29 | //input: 30 | PortDataContainer< vector< float > > graph; 31 | PortDataContainer< float > time; 32 | //output: 33 | PortDataContainer< float > current; 34 | }; 35 | 36 | #endif //GRAPHMODULE_HPP 37 | -------------------------------------------------------------------------------- /HQ.hpp: -------------------------------------------------------------------------------- 1 | #ifndef HQ_HPP 2 | #define HQ_HPP 3 | 4 | extern unsigned int hq_bits; //bits of precision display is assumed to have. 5 | 6 | void init_hq(unsigned int samples); 7 | bool have_hq(); 8 | void start_hq_frame(); 9 | void finish_hq_frame(); 10 | void deinit_hq(); 11 | 12 | #endif //HQ_HPP 13 | -------------------------------------------------------------------------------- /IKModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef IKMODULE_HPP 2 | #define IKMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | //for Arm constants... 6 | #include "ArmModule.hpp" 7 | 8 | class IKModule : public Module { 9 | public: 10 | IKModule() { 11 | in_ports.push_back(&hand); 12 | hand() = make_vector(BaseLen+SegLen+BasePos.x, BasePos.y, 0.0f); 13 | hand.position = make_vector(-0.25f, 0.0f); 14 | 15 | out_ports.push_back(&base_ang); 16 | out_ports.push_back(&seg_ang); 17 | out_ports.push_back(&hand_ang); 18 | base_ang() = seg_ang() = hand_ang() = 0.0f; 19 | base_ang.position = make_vector(0.25f, 1.0f / 6.0f - 0.5f); 20 | seg_ang.position = make_vector(0.25f, 3.0f / 6.0f - 0.5f); 21 | hand_ang.position = make_vector(0.25f, 5.0f / 6.0f - 0.5f); 22 | } 23 | virtual ~IKModule() { 24 | } 25 | //Item functions: 26 | virtual Vector2f size(); 27 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 28 | //Module functions: 29 | virtual void update(float elapsed_time); 30 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 31 | 32 | PortDataContainer< Vector3f > hand; 33 | 34 | PortDataContainer< float > base_ang; 35 | PortDataContainer< float > seg_ang; 36 | PortDataContainer< float > hand_ang; 37 | 38 | }; 39 | 40 | #endif //IKMODULE_HPP 41 | -------------------------------------------------------------------------------- /Image.hpp: -------------------------------------------------------------------------------- 1 | #ifndef IMAGE_HPP 2 | #define IMAGE_HPP 3 | 4 | #include "Item.hpp" 5 | 6 | #include 7 | 8 | #include 9 | 10 | using std::string; 11 | 12 | class Image : public Item { 13 | public: 14 | Image() : path("") { 15 | bad_path = path; 16 | } 17 | virtual ~Image() {} 18 | string path; 19 | string bad_path; 20 | Graphics::TextureRef get_texture(); 21 | virtual Vector2f size(); 22 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 23 | virtual bool get_pixel_size(Vector2ui &into); 24 | }; 25 | 26 | #endif //IMAGE_HPP 27 | -------------------------------------------------------------------------------- /InputModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INPUTMODULE_HPP 2 | #define INPUTMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | template< class DATA > 6 | class InputModule : public Module { 7 | public: 8 | InputModule(std::string const &_prefix) : prefix(_prefix) { 9 | out_ports.push_back(&data); 10 | data.position = make_vector(0.5f * size().x, 0.0f); 11 | data.name = "data"; 12 | } 13 | virtual ~InputModule() { 14 | } 15 | //Item functions: 16 | virtual Vector2f size(); 17 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 18 | //Module functions: 19 | virtual void update(float elapsed_time); 20 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 21 | 22 | PortDataContainer< DATA > data; 23 | std::string prefix; 24 | }; 25 | 26 | #endif //INPUTMODULE_HPP 27 | -------------------------------------------------------------------------------- /Item.cpp: -------------------------------------------------------------------------------- 1 | #include "Item.hpp" 2 | #include 3 | 4 | void glBoxToBox(Box2f const &internal, Box2f const &external) { 5 | glTranslatef(external.min.x, external.min.y, 0.0f); 6 | glScalef( 7 | (external.max.x - external.min.x)/(internal.max.x - internal.min.x), 8 | (external.max.y - external.min.y)/(internal.max.y - internal.min.y), 9 | 1.0f); 10 | glTranslatef(-internal.min.x, -internal.min.y, 0.0f); 11 | } 12 | 13 | bool Item::get_pixel_size(Vector2ui &into) { 14 | into = make_vector(0U, 0U); 15 | return false; 16 | } 17 | -------------------------------------------------------------------------------- /Item.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ITEM_HPP 2 | #define ITEM_HPP 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | typedef unsigned int ItemId; 10 | 11 | class Item { 12 | public: 13 | Item() : id(rand()), position(make_vector(0.0f, 0.0f)), scale(1.0f) { 14 | } 15 | virtual ~Item() {} 16 | ItemId id; 17 | Vector2f position; //center position 18 | virtual Vector2f size() = 0; //size ['natural'] 19 | float scale; //scale of natural size. 20 | //viewport is the area of you that is seen. 21 | //screen_viewport is where this maps on the screen. 22 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0) = 0; 23 | //returns 'true' and sets 'into' if item has a preferred size in pixels: 24 | virtual bool get_pixel_size(Vector2ui &into); 25 | }; 26 | 27 | void glBoxToBox(Box2f const &internal, Box2f const &external); 28 | 29 | #endif //ITEM_HPP 30 | -------------------------------------------------------------------------------- /Jamrules: -------------------------------------------------------------------------------- 1 | include util/Basis/Jamrules.new ; 2 | -------------------------------------------------------------------------------- /JoystickModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef JOYSTICKMODULE_HPP 2 | #define JOYSTICKMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | class JoystickModule : public Module { 9 | public: 10 | JoystickModule() { 11 | out_ports.push_back(&control); 12 | control.position = make_vector(0.5f, 0.0f); 13 | control.name = "control"; 14 | set = false; 15 | } 16 | virtual ~JoystickModule() { 17 | } 18 | //Item functions: 19 | virtual Vector2f size(); 20 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 21 | //Module functions: 22 | virtual void update(float elapsed_time); 23 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 24 | 25 | PortDataContainer< Game2d::Control > control; 26 | bool set; 27 | }; 28 | 29 | #endif //JOYSTICKMODULE_HPP 30 | -------------------------------------------------------------------------------- /LL_Anim.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LL_ANIM_HPP 2 | #define LL_ANIM_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | enum { 7 | BARS, 8 | BALL, 9 | EDGES, 10 | STACKING 11 | }; 12 | class LayerAnim : public Module { 13 | public: 14 | LayerAnim(); 15 | virtual ~LayerAnim(); 16 | virtual Vector2f size(); 17 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 18 | virtual void update(float elapsed_time); 19 | virtual bool handle_event(SDL_Event const &event, Vector2f mouse); 20 | 21 | int mode; 22 | }; 23 | 24 | #endif //LL_ANIM_HPP 25 | -------------------------------------------------------------------------------- /LL_Code.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LL_CODE_HPP 2 | #define LL_CODE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include 7 | 8 | class FlipState; 9 | 10 | class Code : public Module { 11 | public: 12 | Code(); 13 | virtual ~Code(); 14 | virtual Vector2f size(); 15 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 16 | virtual void update(float elapsed_time); 17 | virtual bool handle_event(SDL_Event const &event, Vector2f mouse); 18 | 19 | Graphics::TextureRef code; 20 | 21 | PortDataContainer< FlipState * > state; 22 | }; 23 | 24 | #endif //LL_CODE_HPP 25 | -------------------------------------------------------------------------------- /LL_Dialog.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LL_DIALOG_HPP 2 | #define LL_DIALOG_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | class LayeringModule; 7 | 8 | class LayersDialog : public Module { 9 | public: 10 | LayersDialog(); 11 | virtual ~LayersDialog(); 12 | virtual Vector2f size(); 13 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 14 | virtual void update(float elapsed_time); 15 | virtual bool handle_event(SDL_Event const &event, Vector2f mouse); 16 | 17 | Vector2f mouse_pos; 18 | PortDataContainer< LayeringModule * > layering; 19 | }; 20 | 21 | #endif //LL_DIALOG_HPP 22 | -------------------------------------------------------------------------------- /LL_ListGraph.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LIST_GRAPH_HPP 2 | #define LIST_GRAPH_HPP 3 | 4 | #include 5 | 6 | using std::vector; 7 | 8 | class ListGraph { 9 | public: 10 | vector< vector< unsigned int > > lists; 11 | vector< vector< unsigned int > > edges; 12 | void flip_rel(unsigned int list, unsigned int item, unsigned int rel, bool is_up); 13 | bool is_consistent(); 14 | //test the fact 'a < b' at list. 15 | bool test_fact(unsigned int layers, vector< vector< bool > > &facts, unsigned int list, unsigned int a, unsigned int b); 16 | 17 | //assert() that facts are 'consistent'. 18 | void verify_facts(unsigned int layers, vector< vector< bool > > &facts); 19 | }; 20 | 21 | //NOTE: reward[ i * tiebreak.size() + j ] => goodness of 'i' before 'j' 22 | int set_order_greedy(vector< unsigned int > const &reward, vector< unsigned int > const &tiebreak, vector< unsigned int > &list); 23 | //Return is the total score := rewards gotten - rewards not gotten; ~= how sure we are of this ordering. 24 | 25 | #endif //LIST_GRAPH_HPP 26 | -------------------------------------------------------------------------------- /LL_Obj.hpp: -------------------------------------------------------------------------------- 1 | #ifndef OBJ_HPP 2 | #define OBJ_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | using std::string; 10 | using std::vector; 11 | 12 | class ObjModel; 13 | 14 | bool load_obj(string filename, ObjModel &into); 15 | 16 | class ObjModel { 17 | public: 18 | void clear() { 19 | verts.clear(); 20 | quads.clear(); 21 | tris.clear(); 22 | } 23 | vector< Vector3f > verts; 24 | vector< Vector< unsigned int, 4 > > quads; 25 | vector< Vector< unsigned int, 3 > > tris; 26 | Box3f bounds; 27 | void emit_as_quads(); //emit gl verts, making tris into quads. 28 | }; 29 | 30 | #endif //OBJ_HPP 31 | -------------------------------------------------------------------------------- /LevelModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LEVELMODULE_HPP 2 | #define LEVELMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | #include 9 | 10 | #include 11 | using std::pair; 12 | using std::make_pair; 13 | 14 | class LevelModule : public Module { 15 | public: 16 | LevelModule() { 17 | frame.name = "frame"; 18 | status.name = "status"; 19 | in_ports.push_back(&frame); 20 | in_ports.push_back(&status); 21 | 22 | frame.position = make_vector(-this->size().x * 0.5f, this->size().y * ( 0.25f)); 23 | status.position = make_vector(-this->size().x * 0.5f, this->size().y * (-0.25f)); 24 | status().pos = make_vector(0.5f, 0.0f); 25 | status().flip = false; 26 | frame().motion = (unsigned)-1; 27 | frame().frame = (unsigned)-1; 28 | current_pose.clear(); 29 | } 30 | virtual ~LevelModule() { 31 | } 32 | 33 | //Item functions: 34 | virtual Vector2f size(); 35 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 36 | //Module functions: 37 | virtual void update(float elapsed_time); 38 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 39 | 40 | private: 41 | PortDataContainer< Game2d::LevelStatus > status; 42 | PortDataContainer< Game2d::Frame > frame; 43 | Character::Pose current_pose; 44 | }; 45 | 46 | #endif //LEVELMODULE_HPP 47 | -------------------------------------------------------------------------------- /Library/Jamfile: -------------------------------------------------------------------------------- 1 | TOP = .. ; 2 | 3 | SubDir TOP Library ; 4 | 5 | NAMES = Library Reader ReadSkeleton Skeleton ; 6 | 7 | if $(LIBRARY_USE_VFILE) { 8 | NAMES += ReadSkeletonV Vfile WriteAsfAmc WriteBvh ; 9 | ObjectC++Flags ReadSkeleton : -DLIBRARY_USE_VFILE=1 ; 10 | ObjectC++Flags ReadSkeletonV : -I/usr/include/libxml2 ; 11 | LINKFLAGS += -L/usr/lib64 ; 12 | LIBRARYLINKLIBS += -lxml2 ; 13 | } 14 | 15 | LIBRARY_OBJECTS = $(NAMES:D=$(SUBDIR):S=$(SUFOBJ)) ; 16 | 17 | MyObjects $(NAMES:S=.cpp) ; 18 | -------------------------------------------------------------------------------- /Library/ReadSkeleton.hpp: -------------------------------------------------------------------------------- 1 | #ifndef READSKELETON_HPP 2 | #define READSKELETON_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include "Skeleton.hpp" 8 | 9 | using std::string; 10 | using std::vector; 11 | 12 | bool ReadSkeleton(string filename, Library::Skeleton &into); 13 | 14 | bool ReadSkeletonV(string filename, Library::Skeleton &into); 15 | 16 | // read 'amc' file format (automatically will call below on '.bmc' and '.v', though): 17 | bool ReadAnimation(string filename, Library::Skeleton const &on, vector< double > &positions ); 18 | // read the 'bmc' binary format (somewhat faster, probably): 19 | bool ReadAnimationBin(string filename, Library::Skeleton const &on, vector< double > &positions ); 20 | // read the '.v' file format: 21 | bool ReadAnimationV(string filename, Library::Skeleton const &on, vector< double > &positions ); 22 | 23 | 24 | // when using .v files, call this to get Euler angles back instead of axis-angles 25 | void to_euler_angles(Character::Pose &pose, Character::Angles &angles, Library::Skeleton &transformer); 26 | 27 | // copies skel into transformer, but making it into an euler-angle skeleton 28 | // pose.skeleton = &transformer; 29 | // pose.to_angles(angles); 30 | // angles.to_pose(pose); 31 | void get_euler_skeleton(Library::Skeleton &transformer, const Library::Skeleton &skel); 32 | #endif //READSKELETON_HPP 33 | -------------------------------------------------------------------------------- /Library/Vfile.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VFILE_HPP 2 | #define VFILE_HPP 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define VDEBUG 0 9 | 10 | using std::vector; 11 | using std::string; 12 | using std::cout; 13 | using std::endl; 14 | using std::ifstream; 15 | 16 | // reads any type from a filestream 17 | template< typename T > 18 | void readType(std::ifstream &v, T *foo) { 19 | v.read((char *)foo, sizeof(T)); 20 | if (v.fail()) { 21 | std::cout << "ERROR: read failed" << std::endl; 22 | } 23 | } 24 | 25 | // a helper class for the main Vfile class 26 | // - it contains bone names and DOFs in order 27 | class Datagroup { 28 | public: 29 | Datagroup() { GroupID = -1; } 30 | short GroupID; 31 | string Desc; 32 | char Type; 33 | float FR; 34 | vector DOFlabels; 35 | public: 36 | void print(); 37 | int read(ifstream &v); // returns # of bytes read 38 | }; 39 | 40 | // call on a v-file 41 | class Vfile { 42 | public: 43 | Datagroup bodies; 44 | vector< vector< double > > frames; // assume double. asssert if not. 45 | bool read_ok; 46 | bool found_datagroup; 47 | public: 48 | bool read(string filename); 49 | 50 | private: 51 | // reads the version number 52 | void read_header(ifstream &v); 53 | 54 | // loop through the sections 55 | // - find section "DATAGROUP" 56 | void read_sections(ifstream &v); 57 | 58 | // called by read_section when it sees a DATAGROUP. 59 | // reads all the records in the "DATAGROUP" section 60 | // - record "Global Bodies" contains all the skeleton dofs 61 | // - other records (e.g. "Local Bodies") 62 | void read_datagroups(ifstream &v, int len); 63 | 64 | // reads the dynamic data (i.e. the frame data) 65 | void read_dynamics(ifstream &v); 66 | }; 67 | 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /Library/WriteAsfAmc.hpp: -------------------------------------------------------------------------------- 1 | #include "Library.hpp" 2 | #include 3 | #include "ReadSkeleton.hpp" 4 | #include 5 | #include 6 | 7 | using std::cout; 8 | using std::endl; 9 | using std::ostream; 10 | using std::ofstream; 11 | using std::string; 12 | 13 | namespace Library { 14 | 15 | void writeHeaderAmc(ostream &os, string comment = ""); 16 | void writeFrameAmc(ostream &os, unsigned int frame, Character::Angles &angles); 17 | void writeVToAMC(unsigned int motion); 18 | void writeVSKToASF(unsigned int motion); 19 | 20 | void put_dof_rot(string const &dof, Quatd const &rot, double *info, int start_pos); 21 | } 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Library/WriteBvh.hpp: -------------------------------------------------------------------------------- 1 | #include "Library.hpp" 2 | #include 3 | #include "ReadSkeleton.hpp" 4 | #include 5 | #include 6 | 7 | using std::cout; 8 | using std::endl; 9 | using std::ostream; 10 | using std::ofstream; 11 | using std::string; 12 | 13 | namespace Library { 14 | 15 | // this should be passed an "euler skeleton" 16 | // order == the order the bones are written out in the hierarchy 17 | void writeHierarchyBvh(ostream &os, const Library::Skeleton &skel, unsigned int frames, vector< int > & order); 18 | void writeFrameBvh(ostream &os, unsigned int frame, Character::Pose &pose, vector< int > order); 19 | void writeVToBvh(unsigned int motion); 20 | 21 | void put_dof_rot(string const &dof, Quatd const &rot, double *info, int start_pos); 22 | Quatd get_dof_rot(string const &dof, double const *info, int start_pos); 23 | } 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ManyDGraphModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MANYDGRAPHMODULE_HPP 2 | #define MANYDGRAPHMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include 6 | 7 | class ManyDGraphModule : public Module { 8 | public: 9 | ManyDGraphModule(std::string params); 10 | virtual ~ManyDGraphModule() { 11 | } 12 | //Item functions: 13 | virtual Vector2f size(); 14 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 15 | //convenience: 16 | void update_current_axis(Vector2f mouse); 17 | //Module functions: 18 | virtual void update(float elapsed_time); 19 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 20 | 21 | unsigned int in_size; 22 | vector< float > in_data; 23 | vector< Vector3f > out_data; 24 | 25 | vector< Vector4f > axis; 26 | vector< Vector4f > goal_axis; 27 | float goal_time; 28 | unsigned int current_axis; 29 | }; 30 | 31 | #endif //MANYDGRAPHMODULE_HPP 32 | -------------------------------------------------------------------------------- /Mode.cpp: -------------------------------------------------------------------------------- 1 | #include "Mode.hpp" 2 | #include 3 | 4 | Mode::Mode() : 5 | min_ms_per_frame(1000/100), 6 | max_ms_per_frame(1000/15), 7 | quit_flag(false) { 8 | } 9 | 10 | Mode::~Mode() { 11 | } 12 | 13 | void Mode::main_loop() { 14 | Uint32 env_t = SDL_GetTicks(); 15 | Uint32 env_et = 0; 16 | SDL_Event event; 17 | while (!quit_flag) { 18 | //Find elapsed milliseconds, delaying and clamping as needed. 19 | env_et = SDL_GetTicks() - env_t; 20 | while (env_et < min_ms_per_frame) { 21 | SDL_Delay(min_ms_per_frame - env_et); 22 | env_et = SDL_GetTicks() - env_t; 23 | } 24 | env_t += env_et; 25 | if (env_et > max_ms_per_frame) env_et = max_ms_per_frame; 26 | 27 | //get and process any new events. 28 | while (SDL_PollEvent(&event)) { 29 | handle_event(event); 30 | //add alt-escape as a sort of force-quit: 31 | if (event.type == SDL_KEYDOWN 32 | && event.key.keysym.sym == SDLK_ESCAPE 33 | && (event.key.keysym.mod & KMOD_ALT) ) { 34 | quit_flag = true; 35 | } 36 | } 37 | 38 | //update the world 39 | update(env_et / 1000.0f); 40 | 41 | //draw the world 42 | draw(); 43 | 44 | //swap the drawn world to the front buffer 45 | SDL_GL_SwapWindow(Graphics::window); 46 | //SDL_GL_SwapBuffers(); 47 | } 48 | } 49 | 50 | void Mode::update(float elapsed_time) { 51 | //empty 52 | } 53 | 54 | void Mode::handle_event(SDL_Event const &event) { 55 | //empty 56 | } 57 | 58 | void Mode::draw() { 59 | //empty 60 | } 61 | -------------------------------------------------------------------------------- /Mode.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MODE_HPP 2 | #define MODE_HPP 3 | 4 | #include 5 | 6 | /* 7 | * This is the generic 'mode' class which encompases a current game state. 8 | * It contains a 'main_loop()' call which kicks it off. 9 | * the tick, handle_event, and draw calls are invoked by the main_loop. 10 | */ 11 | 12 | class Mode { 13 | public: 14 | Mode(); 15 | virtual ~Mode(); 16 | 17 | //calls handle_event, tick, and draw at appropriate times. 18 | virtual void main_loop(); 19 | 20 | //update the current world 21 | virtual void update(float elapsed_time); 22 | 23 | //handle the given sdl input event 24 | virtual void handle_event(SDL_Event const &event); 25 | 26 | //draw the current game world. 27 | virtual void draw(); 28 | 29 | //if a frame took less than this amount of time to render, wait. 30 | // (This prevents the cpu from being hogged.) 31 | Uint32 min_ms_per_frame; 32 | 33 | //if a frame took more than this amount of time to render, pretend it 34 | //didn't (results in a game slow-down) 35 | Uint32 max_ms_per_frame; 36 | 37 | //Indicates that the mode should be quit. 38 | bool quit_flag; 39 | }; 40 | 41 | #endif //MODE_HPP 42 | -------------------------------------------------------------------------------- /ModelModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MODELMODULE_HPP 2 | #define MODELMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | class ModelModule : public Module { 9 | public: 10 | ModelModule() { 11 | in_ports.push_back(&index1); 12 | in_ports.push_back(&index2); 13 | 14 | index1.position = make_vector(-0.5f, 0.25f); 15 | index2.position = make_vector(-0.5f,-0.25f); 16 | 17 | index1() = (unsigned)-1; 18 | index2() = (unsigned)-1; 19 | 20 | index1.name = "index1"; 21 | index2.name = "index2"; 22 | 23 | out_ports.push_back(&value); 24 | 25 | value.position = make_vector(0.5f, 0.0f); 26 | 27 | value() = 0.0f; 28 | 29 | value.name = "value"; 30 | 31 | } 32 | virtual ~ModelModule() { 33 | } 34 | 35 | //Item functions: 36 | virtual Vector2f size(); 37 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 38 | //Module functions: 39 | virtual void update(float elapsed_time); 40 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 41 | 42 | PortDataContainer< unsigned int > index1; 43 | PortDataContainer< unsigned int > index2; 44 | PortDataContainer< float > value; 45 | }; 46 | 47 | #endif //MODELMODULE_HPP 48 | -------------------------------------------------------------------------------- /Module.cpp: -------------------------------------------------------------------------------- 1 | #include "Module.hpp" 2 | 3 | #include 4 | #include 5 | 6 | using std::cout; 7 | 8 | map< string, ModuleCreator > &creators() { 9 | static map< string, ModuleCreator > ret; 10 | return ret; 11 | } 12 | 13 | map< string, string > &helps() { 14 | static map< string, string > ret; 15 | return ret; 16 | } 17 | 18 | map< string, ModuleCreator > const &get_module_map() { 19 | return creators(); 20 | } 21 | 22 | string get_module_help(string const &name) { 23 | if (!helps().count(name)) return ""; 24 | return helps()[name]; 25 | } 26 | 27 | void register_module(string const &name, ModuleCreator creator, string const &help) { 28 | if (creators().count(name)) { 29 | cerr << "Name '" << name << "' is double-registered." << endl; 30 | } else { 31 | cout << "Registered module '" << name << "'" << endl; 32 | creators().insert(make_pair(name, creator)); 33 | if (help != "") { 34 | assert(!helps().count(name)); 35 | helps().insert(make_pair(name, help)); 36 | } 37 | } 38 | } 39 | 40 | Module *create_module(std::string params) { 41 | string name = ""; 42 | while (!params.empty() && !isspace(params[0])) { 43 | name += params[0]; 44 | params.erase(0,1); 45 | } 46 | if (!params.empty()) { 47 | params.erase(0,1); 48 | } 49 | map< string, ModuleCreator >::iterator f = creators().find(name); 50 | if (f == creators().end()) { 51 | return NULL; 52 | } 53 | Module *ret = (f->second)(params); 54 | if (ret) { 55 | ret->params = name + " " + params; 56 | } 57 | return ret; 58 | } 59 | 60 | float Module::cursor_alpha() { 61 | return 1.0f; 62 | } 63 | -------------------------------------------------------------------------------- /MotionModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MOTIONMODULE_HPP 2 | #define MOTIONMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | class MotionModule : public Module { 9 | public: 10 | MotionModule(unsigned int _index) : index(_index) { 11 | time_acc = 0.0f; 12 | init(); 13 | } 14 | virtual ~MotionModule() { 15 | } 16 | 17 | //Item functions: 18 | virtual Vector2f size(); 19 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 20 | //Module functions: 21 | virtual void update(float elapsed_time); 22 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 23 | 24 | unsigned int index; 25 | float time_acc; 26 | 27 | private: 28 | void init(); //precalc some draw data for motions. 29 | float max_pos,min_pos; 30 | bool paused; 31 | vector< float > frame_positions; 32 | }; 33 | 34 | #endif //MOTIONMODULE_HPP 35 | -------------------------------------------------------------------------------- /PathModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PATHMODULE_HPP 2 | #define PATHMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include 6 | 7 | class PathModule : public Module { 8 | public: 9 | PathModule() { 10 | in_ports.push_back(&leave_a); 11 | in_ports.push_back(&intermed); 12 | in_ports.push_back(&join_b); 13 | 14 | out_ports.push_back(&score); 15 | 16 | leave_a.name = "leave"; 17 | intermed.name = "intermed"; 18 | join_b.name = "join"; 19 | score.name = "score"; 20 | 21 | leave_a.position = make_vector(-1.5f, 0.5f); 22 | intermed.position = make_vector(-1.5f,0.0f); 23 | join_b.position = make_vector(-1.5f,-0.5f); 24 | score.position = make_vector(1.5f, 0.0f); 25 | 26 | cur_leave_a = (unsigned)-1; 27 | cur_join_b = (unsigned)-1; 28 | cur_intermed = (unsigned)-1; 29 | 30 | show_c = false; 31 | animate = false; 32 | anim_time = 0.0f; 33 | } 34 | virtual ~PathModule() { 35 | } 36 | //Item functions: 37 | virtual Vector2f size(); 38 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 39 | //Module functions: 40 | virtual void update(float elapsed_time); 41 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 42 | //Helper functions: 43 | void calculate_path(); 44 | 45 | PortDataContainer< float > leave_a; 46 | PortDataContainer< float > intermed; 47 | PortDataContainer< float > join_b; 48 | 49 | PortDataContainer< float > score; 50 | 51 | vector< Vector2f > path_a; 52 | vector< Vector2f > path_b; 53 | vector< Vector2f > path_c; //the 'composite' path. 54 | 55 | unsigned int cur_leave_a; 56 | unsigned int cur_join_b; 57 | unsigned int cur_intermed; 58 | 59 | bool show_c; 60 | bool animate; 61 | float anim_time; 62 | }; 63 | 64 | #endif //PATHMODULE_HPP 65 | -------------------------------------------------------------------------------- /PhysicsAnimation.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PHYSICSANIMATION_HPP 2 | #define PHYSICSANIMATION_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include 7 | 8 | #include 9 | 10 | class PhysicsAnimationModule : public Module { 11 | public: 12 | PhysicsAnimationModule(std::string params); 13 | virtual ~PhysicsAnimationModule(); 14 | 15 | void add_frame(std::string filename); 16 | 17 | virtual Vector2f size(); 18 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 19 | //Module functions: 20 | virtual void update(float elapsed_time); 21 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 22 | 23 | std::vector< Graphics::TextureRef > textures; 24 | std::vector< Vector2f > coms; 25 | 26 | float t; 27 | float dt; 28 | 29 | Vector2f up; 30 | 31 | bool dragging; 32 | Vector2f dragging_ref; 33 | 34 | bool draw_coms; 35 | }; 36 | 37 | #endif //PHYSICSANIMATION_HPP 38 | -------------------------------------------------------------------------------- /PhysicsModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PHYSICSMODULE_HPP 2 | #define PHYSICSMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | class PhysicsModule : public Module { 6 | public: 7 | PhysicsModule() { 8 | in_ports.push_back(&pos); 9 | in_ports.push_back(&vel); 10 | 11 | pos.position = make_vector(-0.25f, 1.0f / 4.0f - 0.5f); 12 | vel.position = make_vector(-0.25f, 3.0f / 4.0f - 0.5f); 13 | 14 | out_ports.push_back(&coords); 15 | coords.position = make_vector(0.25f, 0.0f); 16 | } 17 | virtual ~PhysicsModule() { 18 | } 19 | //Item functions: 20 | virtual Vector2f size(); 21 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 22 | //Module functions: 23 | virtual void update(float elapsed_time); 24 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 25 | 26 | PortDataContainer< Vector3f > pos; 27 | PortDataContainer< Vector3f > vel; 28 | 29 | PortDataContainer< vector< Vector3f > > coords; 30 | }; 31 | 32 | #endif //PHYSICSMODULE_HPP 33 | -------------------------------------------------------------------------------- /PlaneModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PLANEMODULE_HPP 2 | #define PLANEMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | const float BaseLen = 0.75f; 6 | const float SegLen = 0.5f; 7 | const float Rad = 0.05f; 8 | const Vector2f BasePos = {{{-1.0f + Rad * 1.5f, 0.0f}}}; 9 | 10 | class PlaneModule : public Module { 11 | public: 12 | PlaneModule() { 13 | do_rot = false; 14 | rot = 0.0f; 15 | } 16 | virtual ~PlaneModule() { 17 | } 18 | //Item functions: 19 | virtual Vector2f size(); 20 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 21 | //Module functions: 22 | virtual void update(float elapsed_time); 23 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 24 | 25 | bool do_rot; 26 | float rot; 27 | }; 28 | 29 | #endif //PLANEMODULE_HPP 30 | -------------------------------------------------------------------------------- /Poisson.hpp: -------------------------------------------------------------------------------- 1 | #ifndef POISSONMODULE_HPP 2 | #define POISSONMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include 6 | 7 | class PoissonModule : public Module { 8 | private: 9 | void dealloc_tex(); 10 | void alloc_tex(); 11 | void clear_tex(); 12 | public: 13 | PoissonModule(); 14 | virtual ~PoissonModule() { 15 | } 16 | //Item functions: 17 | virtual Vector2f size(); 18 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 19 | private: 20 | void draw_stroke(); 21 | void draw_distance(); 22 | void update_graph(GLuint from_fb); 23 | public: 24 | //Module functions: 25 | virtual void update(float elapsed_time); 26 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 27 | 28 | GLuint cons_fb; //framebuffer bound to: 29 | GLuint cons_tex; //color texture 30 | GLuint cons_rb; //depth renderbuffer 31 | GLuint soln_fb; //solution fb bound to: 32 | GLuint soln_tex; 33 | GLuint temp_fb; //temp fb bound to: 34 | GLuint temp_tex; 35 | 36 | bool run; 37 | bool step; 38 | 39 | int step_type; 40 | enum { 41 | STEP_STANDARD, 42 | STEP_SCALED, 43 | }; 44 | 45 | float jacobi_scale; 46 | 47 | int show; 48 | enum { 49 | SHOW_CONS, 50 | SHOW_SOLN 51 | }; 52 | 53 | Vector3f color_a; 54 | Vector3f color_b; 55 | 56 | vector< Vector2f > stroke; 57 | 58 | PortDataContainer< unsigned int > iter_count; 59 | PortDataContainer< string > step_name; 60 | PortDataContainer< string > show_name; 61 | PortDataContainer< vector< float > > graph; 62 | }; 63 | 64 | #endif //POISSONMODULE_HPP 65 | -------------------------------------------------------------------------------- /PoissonTiming.hpp: -------------------------------------------------------------------------------- 1 | #ifndef POISSONTIMINGMODULE_HPP 2 | #define POISSONTIMINGMODULE_HPP 3 | #include "Module.hpp" 4 | #include "GI_StepModule.hpp" 5 | 6 | #include 7 | 8 | class PoissonTimingModule : public Module { 9 | private: 10 | void dealloc_tex(); 11 | void alloc_tex(); 12 | void clear_tex(); 13 | public: 14 | PoissonTimingModule(); 15 | virtual ~PoissonTimingModule() { 16 | } 17 | //Item functions: 18 | virtual Vector2f size(); 19 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 20 | private: 21 | void draw_stroke(); 22 | void draw_distance(); 23 | void do_gaussian(); //for timing comparison 24 | public: 25 | //Module functions: 26 | virtual void update(float elapsed_time); 27 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 28 | 29 | GLuint cons_fb; //framebuffer bound to: 30 | GLuint cons_tex; //color texture 31 | GLuint cons_rb; //depth renderbuffer 32 | GLuint soln_fb; //solution fb bound to: 33 | GLuint soln_tex; 34 | GLuint temp_fb; //temp fb bound to: 35 | GLuint temp_tex; 36 | 37 | bool run; 38 | bool step; 39 | 40 | float jacobi_scale; 41 | 42 | int show; 43 | enum { 44 | SHOW_CONS, 45 | SHOW_SOLN 46 | }; 47 | 48 | Vector3f color_a; 49 | Vector3f color_b; 50 | 51 | vector< Vector2f > stroke; 52 | 53 | PortDataContainer< unsigned int > iter_count; 54 | }; 55 | 56 | #endif //POISSONTIMINGMODULE_HPP 57 | -------------------------------------------------------------------------------- /PolicyModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef POLICYMODULE_HPP 2 | #define POLICYMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | void clear_policy_texture(); 9 | 10 | class PolicyModule : public Module { 11 | public: 12 | PolicyModule() { 13 | in_ports.push_back(&frag); 14 | in_ports.push_back(&bin); 15 | 16 | frag.position = make_vector(0.0f, -0.5f * size().y); 17 | bin.position = make_vector(-0.5f * size().x, 0.0f); 18 | 19 | frag() = (unsigned)-1; 20 | bin() = (unsigned)-1; 21 | 22 | frag.name = "frag"; 23 | bin.name = "bin"; 24 | 25 | out_ports.push_back(&value); 26 | 27 | value.position = make_vector(0.5f * size().x, 0.0f); 28 | 29 | value() = (unsigned)-1; 30 | 31 | value.name = "value"; 32 | 33 | } 34 | virtual ~PolicyModule() { 35 | } 36 | 37 | //Item functions: 38 | virtual Vector2f size(); 39 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 40 | //Module functions: 41 | virtual void update(float elapsed_time); 42 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 43 | 44 | PortDataContainer< unsigned int > frag; 45 | PortDataContainer< unsigned int > bin; 46 | PortDataContainer< unsigned int > value; 47 | }; 48 | 49 | #endif //POLICYMODULE_HPP 50 | -------------------------------------------------------------------------------- /ProjectionModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PROJECTIONMODULE_HPP 2 | #define PROJECTIONMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | const float BaseLen = 0.75f; 6 | const float SegLen = 0.5f; 7 | const float Rad = 0.05f; 8 | const Vector2f BasePos = {{{-1.0f + Rad * 1.5f, 0.0f}}}; 9 | 10 | class ProjectionModule : public Module { 11 | public: 12 | ProjectionModule() { 13 | in_ports.push_back(&near); 14 | in_ports.push_back(&far); 15 | in_ports.push_back(&fov); 16 | near() = 1.0f; 17 | near.name = "near"; 18 | near.position = make_vector(-2.0f, 0.5f); 19 | far() = 9.0f; 20 | far.name = "far"; 21 | far.position = make_vector(-2.0f, 0.0f); 22 | fov() = 60.0f; 23 | fov.name = "fov"; 24 | fov.position = make_vector(-2.0f, -0.5f); 25 | } 26 | virtual ~ProjectionModule() { 27 | } 28 | //Item functions: 29 | virtual Vector2f size(); 30 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 31 | //Module functions: 32 | virtual void update(float elapsed_time); 33 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 34 | 35 | PortDataContainer< float > near; 36 | PortDataContainer< float > far; 37 | PortDataContainer< float > fov; 38 | 39 | vector< Vector2f > points; 40 | }; 41 | 42 | #endif //PROJECTIONMODULE_HPP 43 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Preshack 2 | -------- 3 | A quick hack for making presentations in a new and different way. 4 | 5 | Well, the 'quick' part maybe isn't true any more, as I've been using it for several years. 6 | 7 | Building 8 | -------- 9 | Get ftjam. 10 | Run: jam -j4 11 | 12 | Running 13 | ------- 14 | cd dist 15 | ./hack README.hack 16 | 17 | 18 | I've bundled in various SIGGRAPH and Eurographics presentations to give you a flavor for what preshack can do. 19 | 20 | Who made this? 21 | -------------- 22 | This was made by Jim McCann. Source provided freely; please don't try to re-sell it. 23 | 24 | Feel free to e-mail me (ix@tchow.com or jmccann@cs.cmu.edu) if you have comments or questions... or just if you actually use this for your own presentations. You could be the first! 25 | -------------------------------------------------------------------------------- /ReflectionDistance.hpp: -------------------------------------------------------------------------------- 1 | #ifndef REFLECTION_DISTANCE_HPP 2 | #define REFLECTION_DISTANCE_HPP 3 | 4 | #include "GameStuff.hpp" 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | using std::vector; 12 | using std::string; 13 | 14 | class ReflectionDistance { 15 | public: 16 | static string const &name(); 17 | ReflectionDistance(Game2d::Fragment const &from); 18 | float distance(Game2d::Fragment const &to); 19 | vector< vector< Vector3f > > tips; 20 | }; 21 | 22 | 23 | #endif //REFLECTION_DISTANCE_HPP 24 | -------------------------------------------------------------------------------- /RewardModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef REWARDMODULE_HPP 2 | #define REWARDMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | class RewardModule : public Module { 9 | public: 10 | RewardModule() { 11 | in_ports.push_back(&frag); 12 | in_ports.push_back(&bin); 13 | 14 | frag.position = make_vector(0.0f, -0.5f * size().y); 15 | bin.position = make_vector(-0.5f * size().x, 0.0f); 16 | 17 | frag() = (unsigned)-1; 18 | bin() = (unsigned)-1; 19 | 20 | frag.name = "frag"; 21 | bin.name = "bin"; 22 | 23 | out_ports.push_back(&value); 24 | 25 | value.position = make_vector(0.5f * size().x, 0.0f); 26 | 27 | value() = 0.0f; 28 | 29 | value.name = "value"; 30 | 31 | } 32 | virtual ~RewardModule() { 33 | } 34 | 35 | //Item functions: 36 | virtual Vector2f size(); 37 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 38 | //Module functions: 39 | virtual void update(float elapsed_time); 40 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 41 | 42 | PortDataContainer< unsigned int > frag; 43 | PortDataContainer< unsigned int > bin; 44 | PortDataContainer< float > value; 45 | }; 46 | 47 | #endif //REWARDMODULE_HPP 48 | -------------------------------------------------------------------------------- /SP_Paint.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PAINT_HPP 2 | #define PAINT_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include 7 | 8 | #include 9 | 10 | using std::vector; 11 | using std::map; 12 | 13 | class SP_Paint : public Module { 14 | public: 15 | SP_Paint(Vector2ui size, uint32_t *a_data, uint32_t *b_data); 16 | ~SP_Paint(); 17 | virtual Vector2f size(); 18 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 19 | virtual void update(float time); 20 | virtual bool handle_event(SDL_Event const &, Vector2f mouse); 21 | virtual float cursor_alpha(); 22 | 23 | GLuint a_tex, b_tex, order_tex; 24 | GLuint order_fb; 25 | 26 | Vector2ui canvas_size; 27 | 28 | float draw_cursor; 29 | Vector2f old_mouse; 30 | 31 | float stroke_rad; 32 | Vector3f stroke_color; 33 | vector< Vector3f > stroke_queue; 34 | float stroke_acc; 35 | unsigned int stroke_brush; 36 | vector< GLuint > brushes; 37 | float stroke_rate; 38 | float stroke_pressure; 39 | 40 | //render stroke_queue into stroke, clear stroke queue. 41 | void render_stroke(); 42 | //merge current stroke into.. what you wanted to merge it into.. I guess. 43 | void finalize_stroke(); 44 | }; 45 | 46 | #endif //PAINT_HPP 47 | -------------------------------------------------------------------------------- /SS_Constraint.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SS_CONSTRAINT_HPP 2 | #define SS_CONSTRAINT_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "Module.hpp" 10 | 11 | #include 12 | 13 | 14 | const Vector2f LayerBoxSize = make_vector(0.2f, 0.18f); 15 | const Vector2f AlphaBoxSize = make_vector(1.0f, 0.06f); 16 | 17 | class LayerBox { 18 | public: 19 | LayerBox() : layer((unsigned)-1), pos(make_vector(0.0f, 0.0f)), target(make_vector(0.0f, 0.0f)), color(make_vector(1.0f, 0.0f, 1.0f)) { } 20 | unsigned int layer; 21 | Vector2f pos; 22 | Vector2f target; 23 | Vector3f color; 24 | }; 25 | 26 | class LayerBin { 27 | public: 28 | LayerBin() : col(0) { } 29 | std::vector< LayerBox * > cont; 30 | unsigned int col; 31 | Box2f get_box(); 32 | }; 33 | 34 | class StackingConstraint : public Module { 35 | public: 36 | StackingConstraint(); 37 | virtual ~StackingConstraint(); 38 | virtual Vector2f size(); 39 | virtual bool handle_event(SDL_Event const &e, Vector2f mouse); 40 | virtual void update(float elapsed); 41 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 42 | 43 | std::vector< LayerBox > boxes; 44 | std::vector< LayerBin > bins; 45 | LayerBox *current_box; 46 | unsigned int box_target_seam; 47 | unsigned int box_target_col; 48 | bool dragging_box; 49 | void layout_boxes(); 50 | 51 | void make_closest_wanted(); 52 | 53 | PortDataContainer< std::vector< Vector3f > > layer_colors; 54 | PortDataContainer< std::vector< uint32_t > > closest_wanted; 55 | 56 | Vector2f cur_mouse; 57 | }; 58 | 59 | 60 | #endif //SS_CONSTRAINT_HPP 61 | -------------------------------------------------------------------------------- /SS_OptCanvas.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SS_OPT_CANVAS_HPP 2 | #define SS_OPT_CANVAS_HPP 3 | 4 | #include "SS_optimizer.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "Module.hpp" 12 | 13 | #include 14 | 15 | 16 | class Const { 17 | public: 18 | vector< uint32_t > valid_orders; 19 | uint32_t col; 20 | }; 21 | 22 | class OptStacking : public Module { 23 | public: 24 | OptStacking(std::string base_name = ""); 25 | virtual ~OptStacking(); 26 | virtual Vector2f size(); 27 | virtual bool handle_event(SDL_Event const &e, Vector2f mouse); 28 | virtual float cursor_alpha(); 29 | virtual void update(float elapsed); 30 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 31 | 32 | float cursor_fade; 33 | bool have_cursor; 34 | 35 | std::string base_name; 36 | 37 | Vector2ui img_size; 38 | std::vector< Layer > layers; 39 | std::vector< Const > constraints; 40 | 41 | std::vector< uint32_t > free_colors; 42 | 43 | SolveStatus *solve; 44 | void start_solve(bool store_coefs); 45 | 46 | GLuint soln_tex; 47 | Vector2ui soln_size; 48 | uint32_t soln_serial; 49 | GLuint cons_tex; 50 | GLuint cons_fb; 51 | GLuint brush_tex; //just a circle 52 | 53 | PortDataContainer< std::vector< Vector3f > > layer_colors; 54 | PortDataContainer< std::vector< uint32_t > > closest_wanted; 55 | 56 | Vector2f cur_mouse; 57 | 58 | void render_stroke(); 59 | std::vector< Vector3f > stroke; 60 | float stroke_acc; 61 | float brush_diameter; 62 | float brush_rate; 63 | 64 | float brush_spin_acc; 65 | 66 | float stipple_ofs; 67 | }; 68 | 69 | #endif //SS_OPT_CANVAS_HPP 70 | -------------------------------------------------------------------------------- /SS_Volume.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SS_VOLUME_HPP 2 | #define SS_VOLUME_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | class SoftVolume : public Module { 7 | public: 8 | SoftVolume(); 9 | virtual ~SoftVolume(); 10 | virtual Vector2f size(); 11 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 12 | virtual void update(float elapsed_time); 13 | virtual bool handle_event(SDL_Event const &event, Vector2f mouse); 14 | }; 15 | 16 | #endif //SS_VOLUME_HPP 17 | -------------------------------------------------------------------------------- /SS_nice_dump.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //NOTE: matrix in COLUMN-MAJOR order!!! 4 | template< typename TYPE > 5 | void col_dump(const TYPE * col_mat, unsigned int rows, unsigned int cols) { 6 | for (unsigned int r = 0; r < rows; ++r) { 7 | if (r == 0) std::cout << '['; 8 | else std::cout << ' '; 9 | for (unsigned int c = 0; c < cols; ++c) { 10 | if (c) std::cout << ' '; 11 | std::cout << col_mat[r + c * rows]; 12 | } 13 | if (r + 1 == rows) std::cout << "]" << std::endl; 14 | else std::cout << ";...\n"; 15 | } 16 | } 17 | 18 | //and row-major version: 19 | template< typename TYPE > 20 | void row_dump(const TYPE * row_mat, unsigned int rows, unsigned int cols) { 21 | for (unsigned int r = 0; r < rows; ++r) { 22 | if (r == 0) std::cout << '['; 23 | else std::cout << ' '; 24 | for (unsigned int c = 0; c < cols; ++c) { 25 | if (c) std::cout << ' '; 26 | std::cout << row_mat[r * cols + c]; 27 | } 28 | if (r + 1 == rows) std::cout << "]" << std::endl; 29 | else std::cout << ";...\n"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SliderModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SLIDERMODULE_HPP 2 | #define SLIDERMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | class SliderModule : public Module { 6 | public: 7 | SliderModule() { 8 | out_ports.push_back(&val); 9 | val.position = make_vector(1.0f, 0.0f); 10 | min = -1.0f; 11 | max = 1.0f; 12 | snap = 0.0f; 13 | val() = (min + max) * 0.5f; 14 | width = 2.0f; 15 | rate = 0.0f; 16 | playing = false; 17 | } 18 | virtual ~SliderModule() { 19 | } 20 | //Item functions: 21 | virtual Vector2f size(); 22 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 23 | //Module functions: 24 | virtual void update(float elapsed_time); 25 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 26 | 27 | PortDataContainer< float > val; 28 | float min; 29 | float max; 30 | float snap; 31 | float width; 32 | float rate; 33 | bool playing; 34 | }; 35 | 36 | #endif //SLIDERMODULE_HPP 37 | -------------------------------------------------------------------------------- /String.cpp: -------------------------------------------------------------------------------- 1 | #include "String.hpp" 2 | #include 3 | #include 4 | #include 5 | 6 | Vector2f String::size() { 7 | Graphics::FontRef gentium = Graphics::get_font("gentium.txf"); 8 | Vector2f ret; 9 | ret.y = 1.0f; 10 | ret.x = gentium->get_length(text, ret.y); 11 | return ret; 12 | } 13 | 14 | void String::draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse) { 15 | glMatrixMode(GL_PROJECTION); 16 | glPushMatrix(); 17 | glBoxToBox(viewport, screen_viewport); 18 | 19 | glMatrixMode(GL_MODELVIEW); 20 | Graphics::FontRef gentium = Graphics::get_font("gentium.txf"); 21 | float len = gentium->get_length(text, 1.0f); 22 | glColor(color); 23 | gentium->draw(text, make_vector(-0.5f * len, -0.5f), 1.0f); 24 | glMatrixMode(GL_PROJECTION); 25 | glPopMatrix(); 26 | glMatrixMode(GL_MODELVIEW); 27 | } 28 | bool String::get_pixel_size(Vector2ui &into) { 29 | Vector2f s = size(); 30 | into.x = std::lround(30.0f * s.x); 31 | into.y = std::lround(30.0f * s.y); 32 | return true; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /String.hpp: -------------------------------------------------------------------------------- 1 | #ifndef STRING_HPP 2 | #define STRING_HPP 3 | 4 | #include "Item.hpp" 5 | 6 | #include 7 | 8 | using std::string; 9 | 10 | class String : public Item { 11 | public: 12 | String() : text("nothing"), color(make_vector(1.0f, 1.0f, 1.0f)) { 13 | } 14 | virtual ~String() {} 15 | string text; 16 | Vector3f color; 17 | virtual Vector2f size() override; 18 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0) override; 19 | virtual bool get_pixel_size(Vector2ui &into) override; 20 | 21 | }; 22 | 23 | #endif //STRING_HPP 24 | -------------------------------------------------------------------------------- /TraceModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRACEMODULE_HPP 2 | #define TRACEMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include "GameStuff.hpp" 6 | 7 | class TraceModule : public Module { 8 | public: 9 | TraceModule() { 10 | in_ports.push_back(&control); 11 | 12 | control.position = make_vector(-0.5f * size().x, 0.0f); 13 | 14 | control.name = "control"; 15 | 16 | time_acc = 0.0f; 17 | 18 | paused = true; 19 | } 20 | virtual ~TraceModule() { 21 | } 22 | //Item functions: 23 | virtual Vector2f size(); 24 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 25 | //Module functions: 26 | virtual void update(float elapsed_time); 27 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 28 | 29 | PortDataContainer< Game2d::Control > control; 30 | bool paused; 31 | float time_acc; 32 | }; 33 | 34 | #endif //TRACEMODULE_HPP 35 | -------------------------------------------------------------------------------- /TransitionDistance.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRANSITIONDISTANCE_HPP 2 | #define TRANSITIONDISTANCE_HPP 3 | 4 | #include "ReflectionDistance.hpp" 5 | 6 | typedef ReflectionDistance TransitionDistance; 7 | 8 | #endif //TRANSITIONDISTANCE_HPP 9 | -------------------------------------------------------------------------------- /TransitionModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRANSITIONMODULE_HPP 2 | #define TRANSITIONMODULE_HPP 3 | 4 | #include "Module.hpp" 5 | 6 | #include "GameStuff.hpp" 7 | 8 | class TransitionModule : public Module { 9 | public: 10 | TransitionModule() { 11 | in_ports.push_back(&index1); 12 | in_ports.push_back(&index2); 13 | 14 | index1.position = make_vector(-0.5f, 0.25f); 15 | index2.position = make_vector(-0.5f,-0.25f); 16 | 17 | index1() = (unsigned)-1; 18 | index2() = (unsigned)-1; 19 | 20 | index1.name = "index1"; 21 | index2.name = "index2"; 22 | 23 | out_ports.push_back(&value); 24 | 25 | value.position = make_vector(0.5f, 0.0f); 26 | 27 | value() = 0.0f; 28 | 29 | value.name = "value"; 30 | 31 | } 32 | virtual ~TransitionModule() { 33 | } 34 | 35 | //Item functions: 36 | virtual Vector2f size(); 37 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 38 | //Module functions: 39 | virtual void update(float elapsed_time); 40 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 41 | 42 | PortDataContainer< unsigned int > index1; 43 | PortDataContainer< unsigned int > index2; 44 | PortDataContainer< float > value; 45 | }; 46 | 47 | #endif //TRANSITIONMODULE_HPP 48 | -------------------------------------------------------------------------------- /VideoModule.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "VidStream.hpp" 4 | 5 | #include "Module.hpp" 6 | #include 7 | #include 8 | 9 | 10 | class VideoModule : public Module { 11 | public: 12 | VideoModule(std::string const &_path); 13 | virtual ~VideoModule(); 14 | 15 | //Item functions: 16 | virtual Vector2f size(); 17 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 18 | //Module functions: 19 | virtual void update(float elapsed_time); 20 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 21 | 22 | string path; 23 | std::unique_ptr< VidStream > stream; 24 | double target_time = 0.0; 25 | bool paused = true; 26 | bool dirty = true; 27 | GLuint tex = 0; 28 | }; 29 | -------------------------------------------------------------------------------- /XYGraphModule.hpp: -------------------------------------------------------------------------------- 1 | #ifndef XYGRAPHMODULE_HPP 2 | #define XYGRAPHMODULE_HPP 3 | #include "Module.hpp" 4 | 5 | #include 6 | 7 | class XYGraphModule : public Module { 8 | public: 9 | XYGraphModule() { 10 | in_ports.push_back(&x_val); 11 | in_ports.push_back(&y_val); 12 | in_ports.push_back(&z_val); 13 | x_val.name = "x"; 14 | y_val.name = "y"; 15 | z_val.name = "z"; 16 | x_val.position = make_vector( 0.0f,-1.0f); 17 | y_val.position = make_vector(-1.0f, 0.0f); 18 | z_val.position = make_vector( 0.0f, 1.0f); 19 | x_val() = 0.0f; 20 | y_val() = 0.0f; 21 | z_val() = 0.0f; 22 | old_val = make_vector(0.0f, 0.0f, 0.0f); 23 | min_val = make_vector(-1.0f,-1.0f,-1.0f); 24 | max_val = make_vector( 1.0f, 1.0f, 1.0f); 25 | recording = false; 26 | } 27 | virtual ~XYGraphModule() { 28 | } 29 | //Item functions: 30 | virtual Vector2f size(); 31 | virtual void draw(Box2f viewport, Box2f screen_viewport, float scale, unsigned int recurse = 0); 32 | //Module functions: 33 | virtual void update(float elapsed_time); 34 | virtual bool handle_event(SDL_Event const &event, Vector2f local_mouse); 35 | 36 | PortDataContainer< float > x_val; 37 | PortDataContainer< float > y_val; 38 | PortDataContainer< float > z_val; 39 | Vector3f old_val; 40 | Vector3f min_val; 41 | Vector3f max_val; 42 | bool recording; 43 | std::multimap< float, float > pts; 44 | }; 45 | 46 | #endif //XYGRAPHMODULE_HPP 47 | -------------------------------------------------------------------------------- /dist/.gitignore: -------------------------------------------------------------------------------- 1 | dump.hack 2 | paste_data 3 | -------------------------------------------------------------------------------- /dist/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/bg.png -------------------------------------------------------------------------------- /dist/gp_shaders/build_rhs.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect gx_tex; 5 | uniform sampler2DRect gy_tex; 6 | uniform float fac; 7 | 8 | void main() 9 | { 10 | vec4 gx = texture2DRect(gx_tex, gl_TexCoord[0].xy); 11 | vec4 gy = texture2DRect(gy_tex, gl_TexCoord[0].xy); 12 | vec4 gxm = texture2DRect(gx_tex, gl_TexCoord[0].xy - vec2(1,0)); 13 | vec4 gym = texture2DRect(gy_tex, gl_TexCoord[0].xy - vec2(0,1)); 14 | gl_FragColor = ((gx - gxm) + (gy - gym)) * fac; 15 | } 16 | -------------------------------------------------------------------------------- /dist/gp_shaders/gp_compare.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_texture_rectangle : enable 2 | 3 | uniform sampler2DRect img; 4 | uniform sampler2DRect orig; 5 | uniform float scale; 6 | uniform float bias; 7 | //expecting texture coordinates to be fragment posn. 8 | void main() 9 | { 10 | gl_FragColor = 11 | abs( 12 | texture2DRect(img, gl_TexCoord[0].xy) 13 | -texture2DRect(orig, gl_TexCoord[0].xy) 14 | ) * scale 15 | ; 16 | gl_FragColor.a = 1.0; 17 | } 18 | -------------------------------------------------------------------------------- /dist/gp_shaders/gp_edge_gradient.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_texture_rectangle : enable 2 | 3 | uniform sampler2DRect edge; 4 | //calculates whatever gradient you want, you just have to set up the texcoords. 5 | void main() 6 | { 7 | gl_FragColor = 8 | ( //gradient in edge: 9 | texture2DRect(edge, gl_TexCoord[0].xy) 10 | -texture2DRect(edge, gl_TexCoord[1].xy) 11 | ) 12 | ; 13 | gl_FragColor.a = 1.0; 14 | } 15 | -------------------------------------------------------------------------------- /dist/gp_shaders/gp_scale_bias.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect image; 5 | uniform float scale; 6 | uniform float bias; 7 | 8 | void main() 9 | { 10 | vec4 c = texture2DRect(image, gl_TexCoord[0].xy); 11 | gl_FragColor.rgb = c.rgb * scale + bias; 12 | gl_FragColor.a = 1.0; 13 | } 14 | -------------------------------------------------------------------------------- /dist/gp_shaders/gp_scale_bias_subpixel.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect image; 5 | uniform float scale; 6 | uniform float bias; 7 | 8 | #define S0 (0.5*0.125) 9 | #define S1 (1.5*0.125) 10 | #define S2 (2.5*0.125) 11 | #define S3 (3.5*0.125) 12 | #define S4 (4.5*0.125) 13 | #define S5 (5.5*0.125) 14 | #define S6 (6.5*0.125) 15 | #define S7 (7.5*0.125) 16 | 17 | void main() 18 | { 19 | vec2 min_px = gl_TexCoord[0].xy; 20 | vec2 max_px = gl_TexCoord[1].xy; 21 | vec4 c = 22 | 0.125 * ( 23 | texture2DRect(image, mix(min_px, max_px, vec2(S0,S6))) 24 | +texture2DRect(image, mix(min_px, max_px, vec2(S1,S1))) 25 | +texture2DRect(image, mix(min_px, max_px, vec2(S2,S4))) 26 | +texture2DRect(image, mix(min_px, max_px, vec2(S3,S7))) 27 | +texture2DRect(image, mix(min_px, max_px, vec2(S4,S2))) 28 | +texture2DRect(image, mix(min_px, max_px, vec2(S5,S5))) 29 | +texture2DRect(image, mix(min_px, max_px, vec2(S6,S0))) 30 | +texture2DRect(image, mix(min_px, max_px, vec2(S7,S3))) 31 | ) 32 | ; 33 | gl_FragColor.rgb = c.rgb * scale + bias; 34 | gl_FragColor.a = 1.0; 35 | } 36 | -------------------------------------------------------------------------------- /dist/gp_shaders/gp_sum.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //Expecting texture coordinates[0] to be for tex, 5 | //coord[1] for base image 6 | //produces (alpha-blended?) sum. 7 | uniform sampler2DRect tex; 8 | uniform sampler2DRect base; //base image 9 | void main() 10 | { 11 | vec4 tex_col = texture2DRect(tex, gl_TexCoord[0].xy); 12 | gl_FragColor = 13 | texture2DRect(base, gl_TexCoord[1].xy) 14 | + tex_col.a * gl_Color.a * gl_Color * tex_col 15 | ; 16 | } 17 | -------------------------------------------------------------------------------- /dist/gp_shaders/grad_view.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect grad; 5 | 6 | void main() 7 | { 8 | vec4 g = texture2DRect(grad, gl_TexCoord[0].xy); 9 | 10 | gl_FragColor = g + 0.5; 11 | } 12 | -------------------------------------------------------------------------------- /dist/gp_shaders/guess.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect guess; 5 | uniform sampler2DRect grad_x; 6 | uniform sampler2DRect grad_y; 7 | 8 | void main() 9 | { 10 | vec4 u = texture2DRect(guess, gl_FragCoord.xy + vec2(0, 1)); 11 | vec4 d = texture2DRect(guess, gl_FragCoord.xy + vec2(0,-1)); 12 | vec4 g_up = texture2DRect(grad_y, gl_FragCoord.xy + vec2(0,1)); 13 | vec4 g_pd = texture2DRect(grad_y, gl_FragCoord.xy); 14 | 15 | vec4 l = texture2DRect(guess, gl_FragCoord.xy + vec2( 1,0)); 16 | vec4 r = texture2DRect(guess, gl_FragCoord.xy + vec2(-1,0)); 17 | vec4 g_lp = texture2DRect(grad_x, gl_FragCoord.xy + vec2(1,0)); 18 | vec4 g_pr = texture2DRect(grad_x, gl_FragCoord.xy); 19 | 20 | vec4 p = texture2DRect(guess, gl_FragCoord.xy); 21 | 22 | //vec3 grad = 2 * ( p - l + g_lp + p - r - g_pr + p - u + g_up + p - d - g_pd ); 23 | //p = 0.25 * (l + r + u + d - g_lp + g_pr - g_up + g_pd); 24 | p = 0.25 * (l + r + u + d - g_lp + g_pr - g_up + g_pd); 25 | p.w = 1.0; 26 | 27 | gl_FragColor = p; 28 | } 29 | -------------------------------------------------------------------------------- /dist/gp_shaders/gx_residual.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_texture_rectangle : enable 2 | 3 | uniform sampler2DRect f; 4 | uniform sampler2DRect gx; 5 | 6 | void main() 7 | { 8 | gl_FragColor = 9 | texture2DRect(gx, gl_TexCoord[0].xy) 10 | - (texture2DRect(f, gl_TexCoord[0].xy+vec2(1,0)) 11 | - texture2DRect(f, gl_TexCoord[0].xy)); 12 | } 13 | -------------------------------------------------------------------------------- /dist/gp_shaders/gy_residual.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_texture_rectangle : enable 2 | 3 | uniform sampler2DRect f; 4 | uniform sampler2DRect gy; 5 | 6 | void main() 7 | { 8 | gl_FragColor = 9 | texture2DRect(gy, gl_TexCoord[0].xy) 10 | - (texture2DRect(f, gl_TexCoord[0].xy+vec2(0,1)) 11 | - texture2DRect(f, gl_TexCoord[0].xy)); 12 | } 13 | -------------------------------------------------------------------------------- /dist/gp_shaders/iter_shader.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect f; 5 | uniform sampler2DRect rhs; 6 | 7 | //Description (rather terse, eh?) of the filter we're trying to invert: 8 | uniform float w_corner; 9 | uniform float w_edge; 10 | uniform float w_center_inv; 11 | 12 | void main() 13 | { 14 | gl_FragColor = //vec4(mod(gl_TexCoord[0].x * 0.4,1.0), mod(gl_TexCoord[0].y*0.1,1.0)-0.5, 0.0, 1.0); 15 | //old value: 16 | 0.1 * texture2DRect(f, gl_TexCoord[0].xy) 17 | //guessed value: 18 | + 0.9 * w_center_inv * ( 19 | - ( texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,0.0)) 20 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,0.0)) 21 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,1.0)) 22 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,-1.0)) ) * w_edge 23 | 24 | - ( texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,1.0)) 25 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,-1.0)) 26 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,1.0)) 27 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,-1.0)) ) * w_corner 28 | + texture2DRect(rhs, gl_TexCoord[0].xy)); 29 | gl_FragColor.w = 1.0; 30 | } 31 | -------------------------------------------------------------------------------- /dist/gp_shaders/iter_shader_no_corners.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect f; 5 | uniform sampler2DRect rhs; 6 | 7 | //Description (rather terse, eh?) of the filter we're trying to invert: 8 | uniform float w_corner; 9 | uniform float w_edge; 10 | uniform float w_center_inv; 11 | 12 | void main() 13 | { 14 | gl_FragColor = //vec4(mod(gl_TexCoord[0].x * 0.4,1.0), mod(gl_TexCoord[0].y*0.1,1.0)-0.5, 0.0, 1.0); 15 | //old value: 16 | 0.1 * texture2DRect(f, gl_TexCoord[0].xy) 17 | //guessed value: 18 | + 0.9 * w_center_inv * ( 19 | - ( texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,0.0)) 20 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,0.0)) 21 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,1.0)) 22 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,-1.0)) ) * w_edge 23 | + texture2DRect(rhs, gl_TexCoord[0].xy)); 24 | gl_FragColor.w = 1.0; 25 | } 26 | -------------------------------------------------------------------------------- /dist/gp_shaders/mg_f_downsample.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //Note: we're expecting texture coordinates to be 2x fragment coordinates. 5 | uniform sampler2DRect f; 6 | void main() 7 | { 8 | gl_FragColor = 9 | 0.125 * ( 10 | 0.5*texture2DRect(f, gl_TexCoord[0].xy+vec2(-1,-1)) 11 | + texture2DRect(f, gl_TexCoord[0].xy+vec2( 0,-1)) 12 | +0.5*texture2DRect(f, gl_TexCoord[0].xy+vec2( 1,-1)) 13 | + texture2DRect(f, gl_TexCoord[0].xy+vec2(-1, 0)) 14 | +2.0*texture2DRect(f, gl_TexCoord[0].xy) 15 | + texture2DRect(f, gl_TexCoord[0].xy+vec2( 1, 0)) 16 | +0.5*texture2DRect(f, gl_TexCoord[0].xy+vec2(-1, 1)) 17 | + texture2DRect(f, gl_TexCoord[0].xy+vec2( 0, 1)) 18 | +0.5*texture2DRect(f, gl_TexCoord[0].xy+vec2( 1, 1)) 19 | ) 20 | ; 21 | } 22 | -------------------------------------------------------------------------------- /dist/gp_shaders/mg_f_residual.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //f_small is approx 2x smaller than this. 5 | // Assume: Texture coordinates aready set. 6 | // (basically, this is to get around possible clamping if I use fixed-function) 7 | uniform sampler2DRect f_small; 8 | uniform sampler2DRect f; 9 | void main() 10 | { 11 | gl_FragColor = texture2DRect(f, gl_TexCoord[1].xy) 12 | -texture2DRect(f_small, gl_TexCoord[0].xy); 13 | } 14 | -------------------------------------------------------------------------------- /dist/gp_shaders/mg_f_upsample.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //f_small is approx 2x smaller than this. 5 | // Assume: Texture coordinates aready set. 6 | // (basically, this is to get around possible clamping if I use fixed-function) 7 | uniform sampler2DRect f_small; 8 | uniform sampler2DRect f_resid; 9 | void main() 10 | { 11 | gl_FragColor = texture2DRect(f_small, gl_TexCoord[0].xy) 12 | +texture2DRect(f_resid, gl_TexCoord[1].xy); 13 | } 14 | -------------------------------------------------------------------------------- /dist/gp_shaders/mg_iter.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect f; 5 | uniform sampler2DRect rhs; 6 | 7 | //Description (rather terse, eh?) of the filter we're trying to invert: 8 | uniform float w_corner; 9 | uniform float w_edge; 10 | uniform float w_center_inv; 11 | 12 | void main() 13 | { 14 | gl_FragColor = 15 | //old value: 16 | 0.01 * texture2DRect(f, gl_TexCoord[0].xy) 17 | //guessed value: 18 | + 0.99 * w_center_inv * ( 19 | - ( texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,0.0)) 20 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,0.0)) 21 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,1.0)) 22 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,-1.0)) ) * w_edge 23 | 24 | - ( texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,1.0)) 25 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,-1.0)) 26 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,1.0)) 27 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,-1.0)) ) * w_corner 28 | + texture2DRect(rhs, gl_TexCoord[0].xy)); 29 | gl_FragColor.w = 1.0; 30 | } 31 | -------------------------------------------------------------------------------- /dist/gp_shaders/mg_iter_no_corners.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect f; 5 | uniform sampler2DRect rhs; 6 | 7 | //Description (rather terse, eh?) of the filter we're trying to invert: 8 | uniform float w_corner; 9 | uniform float w_edge; 10 | uniform float w_center_inv; 11 | 12 | void main() 13 | { 14 | gl_FragColor = //vec4(mod(gl_TexCoord[0].x * 0.4,1.0), mod(gl_TexCoord[0].y*0.1,1.0)-0.5, 0.0, 1.0); 15 | //old value: 16 | 0.1 * texture2DRect(f, gl_TexCoord[0].xy) 17 | //guessed value: 18 | + 0.9 * w_center_inv * ( 19 | - ( texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,0.0)) 20 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,0.0)) 21 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,1.0)) 22 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,-1.0)) ) * w_edge 23 | + texture2DRect(rhs, gl_TexCoord[0].xy)); 24 | gl_FragColor.w = 1.0; 25 | } 26 | -------------------------------------------------------------------------------- /dist/gp_shaders/mg_rhs.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect gx; 5 | uniform sampler2DRect gy; 6 | void main() 7 | { 8 | gl_FragColor = 9 | (texture2DRect(gx, gl_TexCoord[0].xy) 10 | -texture2DRect(gx, gl_TexCoord[0].xy+vec2(-1,0))) 11 | +(texture2DRect(gy, gl_TexCoord[0].xy) 12 | -texture2DRect(gy, gl_TexCoord[0].xy+vec2(0,-1))) 13 | ; 14 | } 15 | -------------------------------------------------------------------------------- /dist/gp_shaders/mg_rhs_downsample.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //Note: we're expecting texture coordinates to be 2x fragment coordinates. 5 | uniform sampler2DRect rhs; 6 | void main() 7 | { 8 | gl_FragColor = 9 | 0.25*texture2DRect(rhs, gl_TexCoord[0].xy+vec2(-1,-1)) 10 | +0.50*texture2DRect(rhs, gl_TexCoord[0].xy+vec2( 0,-1)) 11 | +0.25*texture2DRect(rhs, gl_TexCoord[0].xy+vec2( 1,-1)) 12 | +0.50*texture2DRect(rhs, gl_TexCoord[0].xy+vec2(-1, 0)) 13 | +1.00*texture2DRect(rhs, gl_TexCoord[0].xy) 14 | +0.50*texture2DRect(rhs, gl_TexCoord[0].xy+vec2( 1, 0)) 15 | +0.25*texture2DRect(rhs, gl_TexCoord[0].xy+vec2(-1, 1)) 16 | +0.50*texture2DRect(rhs, gl_TexCoord[0].xy+vec2( 0, 1)) 17 | +0.25*texture2DRect(rhs, gl_TexCoord[0].xy+vec2( 1, 1)) 18 | ; 19 | } 20 | -------------------------------------------------------------------------------- /dist/gp_shaders/rhs_0_0.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect gx; 5 | uniform sampler2DRect gy; 6 | uniform sampler2DRect f; 7 | void main() 8 | { 9 | gl_FragColor = 10 | (texture2DRect(gx, gl_TexCoord[0].xy) 11 | -texture2DRect(gx, gl_TexCoord[0].xy+vec2(-1,0))) 12 | +(texture2DRect(gy, gl_TexCoord[0].xy) 13 | -texture2DRect(gy, gl_TexCoord[0].xy+vec2(0,-1))) 14 | 15 | -( 16 | -4.0 * texture2DRect(f, gl_TexCoord[0].xy) 17 | +texture2DRect(f, gl_TexCoord[0].xy+vec2(1,0)) 18 | +texture2DRect(f, gl_TexCoord[0].xy+vec2(-1,0)) 19 | +texture2DRect(f, gl_TexCoord[0].xy+vec2(0,1)) 20 | +texture2DRect(f, gl_TexCoord[0].xy+vec2(0,-1)) 21 | ) 22 | ; 23 | } 24 | -------------------------------------------------------------------------------- /dist/gp_shaders/rhs_1_1.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_texture_rectangle : enable 2 | 3 | uniform sampler2DRect gx; 4 | uniform sampler2DRect gy; 5 | 6 | void main() 7 | { 8 | gl_FragColor = 9 | 0.25 * ( 10 | -texture2DRect(gx, gl_TexCoord[0].xy + vec2(-2,-1)) 11 | -texture2DRect(gx, gl_TexCoord[0].xy + vec2(-1,-1)) 12 | +texture2DRect(gx, gl_TexCoord[0].xy + vec2( 0,-1)) 13 | +texture2DRect(gx, gl_TexCoord[0].xy + vec2( 1,-1)) 14 | // 15 | -texture2DRect(gx, gl_TexCoord[0].xy + vec2(-2, 1)) 16 | -texture2DRect(gx, gl_TexCoord[0].xy + vec2(-1, 1)) 17 | +texture2DRect(gx, gl_TexCoord[0].xy + vec2( 0, 1)) 18 | +texture2DRect(gx, gl_TexCoord[0].xy + vec2( 1, 1)) 19 | 20 | -texture2DRect(gy, gl_TexCoord[0].xy + vec2(-1,-2)) 21 | -texture2DRect(gy, gl_TexCoord[0].xy + vec2(-1,-1)) 22 | +texture2DRect(gy, gl_TexCoord[0].xy + vec2(-1, 0)) 23 | +texture2DRect(gy, gl_TexCoord[0].xy + vec2(-1, 1)) 24 | // 25 | -texture2DRect(gy, gl_TexCoord[0].xy + vec2( 1,-2)) 26 | -texture2DRect(gy, gl_TexCoord[0].xy + vec2( 1,-1)) 27 | +texture2DRect(gy, gl_TexCoord[0].xy + vec2( 1, 0)) 28 | +texture2DRect(gy, gl_TexCoord[0].xy + vec2( 1, 1)) 29 | ) 30 | +0.5 * ( 31 | -texture2DRect(gx, gl_TexCoord[0].xy + vec2(-2, 0)) 32 | -texture2DRect(gx, gl_TexCoord[0].xy + vec2(-1, 0)) 33 | +texture2DRect(gx, gl_TexCoord[0].xy + vec2( 0, 0)) 34 | +texture2DRect(gx, gl_TexCoord[0].xy + vec2( 1, 0)) 35 | 36 | -texture2DRect(gy, gl_TexCoord[0].xy + vec2( 0,-2)) 37 | -texture2DRect(gy, gl_TexCoord[0].xy + vec2( 0,-1)) 38 | +texture2DRect(gy, gl_TexCoord[0].xy + vec2( 0, 0)) 39 | +texture2DRect(gy, gl_TexCoord[0].xy + vec2( 0, 1)) 40 | ) 41 | ; 42 | } 43 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_interpolate.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //small is approx 2x smaller than this. 5 | // Assume: Texture coordinates aready set. 6 | // (basically, this is to get around possible clamping if I use fixed-function) 7 | uniform sampler2DRect small; 8 | void main() 9 | { 10 | gl_FragColor = texture2DRect(small, gl_TexCoord[0].xy); 11 | } 12 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_interpolate_ATI_HACK.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //small is approx 2x smaller than this. 5 | // Assume: Texture coordinates aready set. 6 | // (basically, this is to get around possible clamping if I use fixed-function) 7 | uniform sampler2DRect small; 8 | 9 | vec4 fake_interp(sampler2DRect tex, vec2 pos) { 10 | pos = pos - vec2(0.5, 0.5); 11 | return mix( 12 | mix(texture2DRect(tex, vec2(floor(pos.x)+0.5, floor(pos.y)+0.5)), 13 | texture2DRect(tex, vec2(floor(pos.x)+0.5, ceil(pos.y)+0.5)), 14 | fract(pos.y)), 15 | mix(texture2DRect(tex, vec2(ceil(pos.x)+0.5, floor(pos.y)+0.5)), 16 | texture2DRect(tex, vec2(ceil(pos.x)+0.5, ceil(pos.y)+0.5)), 17 | fract(pos.y)), 18 | fract(pos.x)); 19 | } 20 | 21 | void main() 22 | { 23 | gl_FragColor = fake_interp(small, gl_TexCoord[0].xy); 24 | } 25 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_interpolate_add.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //small is approx 2x smaller than this. 5 | // Assume: Texture coordinates aready set. 6 | // (basically, this is to get around possible clamping if I use fixed-function) 7 | uniform sampler2DRect small; 8 | uniform sampler2DRect add; 9 | void main() 10 | { 11 | gl_FragColor = texture2DRect(small, gl_TexCoord[0].xy) 12 | +texture2DRect(add, gl_TexCoord[1].xy); 13 | } 14 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_interpolate_add_ATI_HACK.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | vec4 fake_interp(sampler2DRect tex, vec2 pos) { 5 | pos = pos - vec2(0.5, 0.5); 6 | return mix( 7 | mix(texture2DRect(tex, vec2(floor(pos.x)+0.5, floor(pos.y)+0.5)), 8 | texture2DRect(tex, vec2(floor(pos.x)+0.5, ceil(pos.y)+0.5)), 9 | fract(pos.y)), 10 | mix(texture2DRect(tex, vec2(ceil(pos.x)+0.5, floor(pos.y)+0.5)), 11 | texture2DRect(tex, vec2(ceil(pos.x)+0.5, ceil(pos.y)+0.5)), 12 | fract(pos.y)), 13 | fract(pos.x)); 14 | } 15 | 16 | //small is approx 2x smaller than this. 17 | // Assume: Texture coordinates aready set. 18 | // (basically, this is to get around possible clamping if I use fixed-function) 19 | uniform sampler2DRect small; 20 | uniform sampler2DRect add; 21 | void main() 22 | { 23 | gl_FragColor = fake_interp(small, gl_TexCoord[0].xy) 24 | +texture2DRect(add, gl_TexCoord[1].xy); 25 | } 26 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_iter.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect f; 5 | uniform sampler2DRect rhs; 6 | 7 | //Description (rather terse, eh?) of the filter we're trying to invert: 8 | // 'w_x' is a magic parameter... 9 | uniform float w_corner; 10 | uniform float w_edge; 11 | uniform float w_x; 12 | uniform float w_center_minus_x_inv; 13 | 14 | void main() 15 | { 16 | gl_FragColor = 17 | w_center_minus_x_inv * ( 18 | //RHS: 19 | texture2DRect(rhs, gl_TexCoord[0].xy) 20 | // - [... x ...] * A: 21 | - ( texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,0.0)) 22 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,0.0)) 23 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,1.0)) 24 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,-1.0)) ) * w_edge 25 | - ( texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,1.0)) 26 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,-1.0)) 27 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,1.0)) 28 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,-1.0)) ) * w_corner 29 | - texture2DRect(f, gl_TexCoord[0].xy) * w_x 30 | ); 31 | gl_FragColor.w = 1.0; 32 | } 33 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_recenter_scale.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //Note: Just here to avoid possible color clampping. Seriously. 5 | uniform sampler2DRect img; 6 | void main() 7 | { 8 | gl_FragColor = texture2DRect(img, gl_TexCoord[0].xy); 9 | } 10 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_recenter_scale_ATI_HACK.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | vec4 fake_interp(sampler2DRect tex, vec2 pos) { 5 | pos = pos - vec2(0.5, 0.5); 6 | return mix( 7 | mix(texture2DRect(tex, vec2(floor(pos.x)+0.5, floor(pos.y)+0.5)), 8 | texture2DRect(tex, vec2(floor(pos.x)+0.5, ceil(pos.y)+0.5)), 9 | fract(pos.y)), 10 | mix(texture2DRect(tex, vec2(ceil(pos.x)+0.5, floor(pos.y)+0.5)), 11 | texture2DRect(tex, vec2(ceil(pos.x)+0.5, ceil(pos.y)+0.5)), 12 | fract(pos.y)), 13 | fract(pos.x)); 14 | } 15 | 16 | //Note: Just here to avoid possible color clampping. Seriously. 17 | uniform sampler2DRect img; 18 | void main() 19 | { 20 | gl_FragColor = fake_interp(img, gl_TexCoord[0].xy); 21 | } 22 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_recenter_sub.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect img; 5 | uniform sampler2DRect sub; 6 | uniform vec3 grey; 7 | 8 | void main() 9 | { 10 | gl_FragColor = texture2DRect(img, gl_TexCoord[0].xy) 11 | -texture2DRect(sub, vec2(0.5,0.5)) 12 | +vec4(grey, 0.0); 13 | } 14 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_residual.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect f; 5 | uniform sampler2DRect rhs; 6 | 7 | //Description (rather terse, eh?) of the filter we're continuing: 8 | uniform float w_corner; 9 | uniform float w_edge; 10 | uniform float w_center; 11 | 12 | void main() 13 | { 14 | gl_FragColor = 15 | texture2DRect(rhs, gl_TexCoord[0].xy) 16 | //filtered value: 17 | - texture2DRect(f, gl_TexCoord[0].xy) * w_center 18 | - ( texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,0.0)) 19 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,0.0)) 20 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,1.0)) 21 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(0.0,-1.0)) ) * w_edge 22 | 23 | - ( texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,1.0)) 24 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(1.0,-1.0)) 25 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,1.0)) 26 | + texture2DRect(f, gl_TexCoord[0].xy + vec2(-1.0,-1.0)) ) * w_corner 27 | ; 28 | gl_FragColor.a = 1.0; 29 | } 30 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_restrict.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //Note: we're expecting texture coordinates to be 2x fragment coordinates. 5 | uniform sampler2DRect img; 6 | void main() 7 | { 8 | //use linear interp hardware: 9 | gl_FragColor = 10 | texture2DRect(img, gl_TexCoord[0].xy+vec2(-0.5,-0.5)) 11 | +texture2DRect(img, gl_TexCoord[0].xy+vec2(-0.5, 0.5)) 12 | +texture2DRect(img, gl_TexCoord[0].xy+vec2( 0.5, 0.5)) 13 | +texture2DRect(img, gl_TexCoord[0].xy+vec2( 0.5,-0.5)) 14 | /* //(nearest-neighbor hardware version): 15 | 0.25*texture2DRect(img, gl_TexCoord[0].xy+vec2(-1,-1)) 16 | +0.50*texture2DRect(img, gl_TexCoord[0].xy+vec2( 0,-1)) 17 | +0.25*texture2DRect(img, gl_TexCoord[0].xy+vec2( 1,-1)) 18 | +0.50*texture2DRect(img, gl_TexCoord[0].xy+vec2(-1, 0)) 19 | +1.00*texture2DRect(img, gl_TexCoord[0].xy) 20 | +0.50*texture2DRect(img, gl_TexCoord[0].xy+vec2( 1, 0)) 21 | +0.25*texture2DRect(img, gl_TexCoord[0].xy+vec2(-1, 1)) 22 | +0.50*texture2DRect(img, gl_TexCoord[0].xy+vec2( 0, 1)) 23 | +0.25*texture2DRect(img, gl_TexCoord[0].xy+vec2( 1, 1)) 24 | */ 25 | ; 26 | } 27 | -------------------------------------------------------------------------------- /dist/gp_shaders/vc_restrict_ATI_HACK.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | //Note: we're expecting texture coordinates to be 2x fragment coordinates. 5 | uniform sampler2DRect img; 6 | void main() 7 | { 8 | //use linear interp hardware: 9 | gl_FragColor = 10 | 0.25*texture2DRect(img, gl_TexCoord[0].xy+vec2(-1,-1)) 11 | +0.50*texture2DRect(img, gl_TexCoord[0].xy+vec2( 0,-1)) 12 | +0.25*texture2DRect(img, gl_TexCoord[0].xy+vec2( 1,-1)) 13 | +0.50*texture2DRect(img, gl_TexCoord[0].xy+vec2(-1, 0)) 14 | +1.00*texture2DRect(img, gl_TexCoord[0].xy) 15 | +0.50*texture2DRect(img, gl_TexCoord[0].xy+vec2( 1, 0)) 16 | +0.25*texture2DRect(img, gl_TexCoord[0].xy+vec2(-1, 1)) 17 | +0.50*texture2DRect(img, gl_TexCoord[0].xy+vec2( 0, 1)) 18 | +0.25*texture2DRect(img, gl_TexCoord[0].xy+vec2( 1, 1)) 19 | ; 20 | } 21 | -------------------------------------------------------------------------------- /dist/gp_shaders/ycbcr_view.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect image; 5 | //uniform float Kb; 6 | //uniform float Kr; 7 | uniform vec4 rfactor; 8 | uniform vec4 gfactor; 9 | uniform vec4 bfactor; 10 | 11 | void main() 12 | { 13 | vec4 c = texture2DRect(image, gl_TexCoord[0].xy); 14 | //c.x == Y, c.y == Cb, c.z == Cr 15 | 16 | //vec4 o; 17 | //o.a = 1.0; 18 | //o.b = c.y * 2.0 * (1.0 - Kb) + c.x; 19 | //o.r = c.z * 2.0 * (1.0 - Kr) + c.x; 20 | //o.g = (c.x - Kr * o.r + Kb * o.b) / (1.0 - Kr - Kb); 21 | gl_FragColor.r = dot(rfactor.xyz, c.xyz) + rfactor.w; 22 | gl_FragColor.g = dot(gfactor.xyz, c.xyz) + gfactor.w; 23 | gl_FragColor.b = dot(bfactor.xyz, c.xyz) + bfactor.w; 24 | gl_FragColor.a = 1.0; 25 | } 26 | -------------------------------------------------------------------------------- /dist/gp_siggraph/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/background.png -------------------------------------------------------------------------------- /dist/gp_siggraph/background_HDR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/background_HDR.png -------------------------------------------------------------------------------- /dist/gp_siggraph/background_blending.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/background_blending.png -------------------------------------------------------------------------------- /dist/gp_siggraph/background_capture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/background_capture.png -------------------------------------------------------------------------------- /dist/gp_siggraph/background_editing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/background_editing.png -------------------------------------------------------------------------------- /dist/gp_siggraph/background_enhancement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/background_enhancement.png -------------------------------------------------------------------------------- /dist/gp_siggraph/background_shadows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/background_shadows.png -------------------------------------------------------------------------------- /dist/gp_siggraph/blend-add-example.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/blend-add-example.ppm -------------------------------------------------------------------------------- /dist/gp_siggraph/blend-dir-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/blend-dir-before.png -------------------------------------------------------------------------------- /dist/gp_siggraph/blend-dir-example.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/blend-dir-example.ppm -------------------------------------------------------------------------------- /dist/gp_siggraph/blend-max-example.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/blend-max-example.ppm -------------------------------------------------------------------------------- /dist/gp_siggraph/blend-min-example.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/blend-min-example.ppm -------------------------------------------------------------------------------- /dist/gp_siggraph/blend-over-example.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/blend-over-example.ppm -------------------------------------------------------------------------------- /dist/gp_siggraph/blend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/blend.png -------------------------------------------------------------------------------- /dist/gp_siggraph/brush-clone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/brush-clone.png -------------------------------------------------------------------------------- /dist/gp_siggraph/brush-edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/brush-edge.png -------------------------------------------------------------------------------- /dist/gp_siggraph/brush-grad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/brush-grad.png -------------------------------------------------------------------------------- /dist/gp_siggraph/clone_example_blank.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/clone_example_blank.ppm -------------------------------------------------------------------------------- /dist/gp_siggraph/edge_example_blank.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/edge_example_blank.ppm -------------------------------------------------------------------------------- /dist/gp_siggraph/edit_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/edit_example.png -------------------------------------------------------------------------------- /dist/gp_siggraph/edit_sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/edit_sel.png -------------------------------------------------------------------------------- /dist/gp_siggraph/example129x129.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/example129x129.png -------------------------------------------------------------------------------- /dist/gp_siggraph/example129x129.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/example129x129.ppm -------------------------------------------------------------------------------- /dist/gp_siggraph/eye_clone.AFTER.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/eye_clone.AFTER.png -------------------------------------------------------------------------------- /dist/gp_siggraph/eye_clone.BEFORE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/eye_clone.BEFORE.png -------------------------------------------------------------------------------- /dist/gp_siggraph/j2_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/j2_4.png -------------------------------------------------------------------------------- /dist/gp_siggraph/jduesing_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/jduesing_3.png -------------------------------------------------------------------------------- /dist/gp_siggraph/jhays_sunbeams.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/jhays_sunbeams.png -------------------------------------------------------------------------------- /dist/gp_siggraph/jim_bw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/jim_bw.png -------------------------------------------------------------------------------- /dist/gp_siggraph/jim_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/jim_color.png -------------------------------------------------------------------------------- /dist/gp_siggraph/montage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/montage.png -------------------------------------------------------------------------------- /dist/gp_siggraph/portia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/portia.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_agarwala.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_agarwala.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_agarwala_et_al.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_agarwala_et_al.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_agarwala_et_al2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_agarwala_et_al2.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_agrawal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_agrawal.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_bhat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_bhat.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_burt_adelson.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_burt_adelson.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_drori.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_drori.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_du1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_du1.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_du2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_du2.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_elder_goldberg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_elder_goldberg1.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_elder_goldberg2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_elder_goldberg2.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_fattal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_fattal.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_feris.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_feris.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_finlayson.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_finlayson.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_georgiev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_georgiev.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_gooch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_gooch.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_jia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_jia.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_jia_tang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_jia_tang.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_kazhdan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_kazhdan.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_levin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_levin.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_lischinski.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_lischinski.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_perez.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_perez.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_raskar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_raskar.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_sun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_sun.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_tumblin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_tumblin.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_wang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_wang.png -------------------------------------------------------------------------------- /dist/gp_siggraph/ref_wang2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/ref_wang2.png -------------------------------------------------------------------------------- /dist/gp_siggraph/refs: -------------------------------------------------------------------------------- 1 | http://www.flickr.com/photos/virgomerry/114227402/ (air force one) [**Mary**] 2 | http://www.flickr.com/photos/bobcatnorth/1526916449/ (maximus the beagle) [Bobcatnorth] 3 | http://www.flickr.com/photos/deborahleventhal/264136530/ (man carrying watermelon) [Deborah Leventhal] 4 | http://www.flickr.com/photos/fortphoto/308860098/ (sunset) [Fort Photo] 5 | http://www.flickr.com/photos/kumakae/111331243/ (cow moon) [kumakae] 6 | http://www.flickr.com/photos/parmat/429691008/ (face) [simurg(parm..)] 7 | http://www.flickr.com/photos/orangeacid/185534998/ (becky's eye) [orangeacid] 8 | http://www.flickr.com/photos/curiouskiwi/118478920/ (green balloon) [Brenda Anderson] 9 | http://www.flickr.com/photos/damongreen/211376981/ (first tomato) [Damon Green] 10 | http://www.flickr.com/photos/knowprose/2102094384/ (condensation) [TaranRampersad] 11 | http://www.flickr.com/photos/kb-a/85522994/ (clementine) [TangoPango] 12 | -------------------------------------------------------------------------------- /dist/gp_siggraph/sketch.f_mazzarfferi.6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/sketch.f_mazzarfferi.6.png -------------------------------------------------------------------------------- /dist/gp_siggraph/sketch.f_mazzarfferi.c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/sketch.f_mazzarfferi.c.png -------------------------------------------------------------------------------- /dist/gp_siggraph/speeds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/speeds.png -------------------------------------------------------------------------------- /dist/gp_siggraph/stucco_hall2.clayjar.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/stucco_hall2.clayjar.ppm -------------------------------------------------------------------------------- /dist/gp_siggraph/window.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_siggraph/window.ppm -------------------------------------------------------------------------------- /dist/gp_speaking2/cave_painting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/cave_painting.png -------------------------------------------------------------------------------- /dist/gp_speaking2/cornsweet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/cornsweet.png -------------------------------------------------------------------------------- /dist/gp_speaking2/cornsweet_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/cornsweet_bar.png -------------------------------------------------------------------------------- /dist/gp_speaking2/diffusion_curves.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/diffusion_curves.png -------------------------------------------------------------------------------- /dist/gp_speaking2/edit_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/edit_example.png -------------------------------------------------------------------------------- /dist/gp_speaking2/gimp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/gimp.png -------------------------------------------------------------------------------- /dist/gp_speaking2/happening.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/happening.png -------------------------------------------------------------------------------- /dist/gp_speaking2/pixel_absolute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/pixel_absolute.png -------------------------------------------------------------------------------- /dist/gp_speaking2/pixel_relative.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/pixel_relative.png -------------------------------------------------------------------------------- /dist/gp_speaking2/ref_perez2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/ref_perez2.png -------------------------------------------------------------------------------- /dist/gp_speaking2/superpaint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/superpaint.png -------------------------------------------------------------------------------- /dist/gp_speaking2/superpaint_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/superpaint_menu.png -------------------------------------------------------------------------------- /dist/gp_speaking2/superpaint_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/superpaint_out.png -------------------------------------------------------------------------------- /dist/gp_speaking2/two_squares.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/gp_speaking2/two_squares.png -------------------------------------------------------------------------------- /dist/infty/checker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/checker.png -------------------------------------------------------------------------------- /dist/infty/conformal.glsl: -------------------------------------------------------------------------------- 1 | 2 | #version 110 3 | #extension GL_ARB_texture_rectangle : enable 4 | 5 | uniform sampler2D src; 6 | uniform sampler2DRect log_tex; 7 | uniform sampler2D exp_tex; 8 | uniform vec2 log_src; 9 | uniform vec2 fac; 10 | uniform float add_real; 11 | uniform float add_imag; 12 | uniform bool nomap; 13 | uniform vec2 exp_fac; 14 | 15 | void main() 16 | { 17 | vec2 coord = gl_TexCoord[0].xy; 18 | if (!nomap) { 19 | coord = texture2DRect(log_tex, gl_TexCoord[0].xy).xy; 20 | } 21 | coord += vec2(add_real, add_imag); 22 | // -- coord gets transformed from dst to src space: 23 | 24 | //coord = vec2(coord.x * fac.x - coord.y * fac.y, 25 | // coord.y * fac.x + coord.x * fac.y); 26 | 27 | // -- coord = exp(coord) 28 | // here we do some fading to match up over the scale breaks 29 | 30 | //translate back to the fundamental x range: 31 | coord = texture2D(exp_tex, vec2(coord.x * exp_fac.x, coord.y * exp_fac.y)).xy; 32 | //map into texture space: 33 | coord = coord * vec2(0.5,-0.5) + vec2(0.5, 0.5); 34 | 35 | gl_FragColor = texture2D(src, coord); 36 | gl_FragColor.a = gl_Color.a; 37 | } 38 | -------------------------------------------------------------------------------- /dist/infty/droste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/droste.png -------------------------------------------------------------------------------- /dist/infty/escher_droste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/escher_droste.png -------------------------------------------------------------------------------- /dist/infty/escher_grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/escher_grid.png -------------------------------------------------------------------------------- /dist/infty/frac_bounding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/frac_bounding.png -------------------------------------------------------------------------------- /dist/infty/frac_computer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/frac_computer.png -------------------------------------------------------------------------------- /dist/infty/frac_extrude.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/frac_extrude.png -------------------------------------------------------------------------------- /dist/infty/frac_filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/frac_filter.png -------------------------------------------------------------------------------- /dist/infty/frac_solids.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/frac_solids.png -------------------------------------------------------------------------------- /dist/infty/frac_title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/frac_title.png -------------------------------------------------------------------------------- /dist/infty/frac_trees.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/frac_trees.png -------------------------------------------------------------------------------- /dist/infty/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/grid.png -------------------------------------------------------------------------------- /dist/infty/leiden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/leiden.png -------------------------------------------------------------------------------- /dist/infty/leiden_droste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/leiden_droste.png -------------------------------------------------------------------------------- /dist/infty/print_gallery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/print_gallery.png -------------------------------------------------------------------------------- /dist/infty/print_orig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/print_orig.png -------------------------------------------------------------------------------- /dist/infty/print_orig_sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/print_orig_sm.png -------------------------------------------------------------------------------- /dist/infty/ronit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/infty/ronit.png -------------------------------------------------------------------------------- /dist/job/arm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/arm.png -------------------------------------------------------------------------------- /dist/job/ball-fluid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/ball-fluid.png -------------------------------------------------------------------------------- /dist/job/ball-nofluid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/ball-nofluid.png -------------------------------------------------------------------------------- /dist/job/ball.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/ball.xcf -------------------------------------------------------------------------------- /dist/job/blender.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/blender.png -------------------------------------------------------------------------------- /dist/job/copho.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/copho.png -------------------------------------------------------------------------------- /dist/job/corner.uteart.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/corner.uteart.ppm -------------------------------------------------------------------------------- /dist/job/f_mazzarfferi.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/f_mazzarfferi.0.png -------------------------------------------------------------------------------- /dist/job/f_mazzarfferi.1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/f_mazzarfferi.1.png -------------------------------------------------------------------------------- /dist/job/f_mazzarfferi.2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/f_mazzarfferi.2.png -------------------------------------------------------------------------------- /dist/job/f_mazzarfferi.3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/f_mazzarfferi.3.png -------------------------------------------------------------------------------- /dist/job/f_mazzarfferi.4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/f_mazzarfferi.4.png -------------------------------------------------------------------------------- /dist/job/f_mazzarfferi.5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/f_mazzarfferi.5.png -------------------------------------------------------------------------------- /dist/job/f_mazzarfferi.6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/f_mazzarfferi.6.png -------------------------------------------------------------------------------- /dist/job/f_mazzarfferi.c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/f_mazzarfferi.c.png -------------------------------------------------------------------------------- /dist/job/gimp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/gimp.png -------------------------------------------------------------------------------- /dist/job/gimp/gimp1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/gimp/gimp1.png -------------------------------------------------------------------------------- /dist/job/gimp/gimp2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/gimp/gimp2.png -------------------------------------------------------------------------------- /dist/job/impjoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/impjoin.png -------------------------------------------------------------------------------- /dist/job/kidpix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/kidpix.png -------------------------------------------------------------------------------- /dist/job/kidpix2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/kidpix2.png -------------------------------------------------------------------------------- /dist/job/lamp..frank..ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/lamp..frank..ppm -------------------------------------------------------------------------------- /dist/job/nomenoctopus2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/nomenoctopus2.png -------------------------------------------------------------------------------- /dist/job/penrose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/penrose.png -------------------------------------------------------------------------------- /dist/job/real_world/rw1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/real_world/rw1.png -------------------------------------------------------------------------------- /dist/job/real_world/rw2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/real_world/rw2.png -------------------------------------------------------------------------------- /dist/job/real_world/rw3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/real_world/rw3.png -------------------------------------------------------------------------------- /dist/job/real_world/rw4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/real_world/rw4.png -------------------------------------------------------------------------------- /dist/job/real_world/rw5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/real_world/rw5.png -------------------------------------------------------------------------------- /dist/job/real_world/rw6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/real_world/rw6.png -------------------------------------------------------------------------------- /dist/job/real_world/rw7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/real_world/rw7.png -------------------------------------------------------------------------------- /dist/job/ref_adelson_and_anandan1990.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/ref_adelson_and_anandan1990.png -------------------------------------------------------------------------------- /dist/job/ref_cole_et_al_2008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/ref_cole_et_al_2008.png -------------------------------------------------------------------------------- /dist/job/ref_koenderink1998.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/ref_koenderink1998.png -------------------------------------------------------------------------------- /dist/job/ref_orzan_et_al.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/ref_orzan_et_al.png -------------------------------------------------------------------------------- /dist/job/restack-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/restack-0.png -------------------------------------------------------------------------------- /dist/job/restack-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/restack-1.png -------------------------------------------------------------------------------- /dist/job/restack-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/restack-2.png -------------------------------------------------------------------------------- /dist/job/sheep_after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/sheep_after.png -------------------------------------------------------------------------------- /dist/job/sheep_before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/sheep_before.png -------------------------------------------------------------------------------- /dist/job/soft_motive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/soft_motive.png -------------------------------------------------------------------------------- /dist/job/stack_br.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/stack_br.png -------------------------------------------------------------------------------- /dist/job/stack_rb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/stack_rb.png -------------------------------------------------------------------------------- /dist/job/stacking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/stacking.png -------------------------------------------------------------------------------- /dist/job/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/star.png -------------------------------------------------------------------------------- /dist/job/stucco..frank..and.atelier79033.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/stucco..frank..and.atelier79033.ppm -------------------------------------------------------------------------------- /dist/job/sun-1-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/sun-1-small.png -------------------------------------------------------------------------------- /dist/job/sun-2-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/sun-2-small.png -------------------------------------------------------------------------------- /dist/job/swap_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/swap_graph.png -------------------------------------------------------------------------------- /dist/job/swap_opaque.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/swap_opaque.png -------------------------------------------------------------------------------- /dist/job/swap_opaque_transp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/swap_opaque_transp.png -------------------------------------------------------------------------------- /dist/job/swap_transp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/swap_transp.png -------------------------------------------------------------------------------- /dist/job/wall.IndplsMichael.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/job/wall.IndplsMichael.ppm -------------------------------------------------------------------------------- /dist/ll_shaders/ll_2dfade.glsl: -------------------------------------------------------------------------------- 1 | 2 | uniform sampler3D tags; 3 | uniform sampler3D ball; 4 | uniform sampler2D bars; 5 | uniform sampler1D sel; 6 | uniform sampler1D fade; 7 | 8 | void main() { 9 | 10 | vec3 at = gl_TexCoord[0].xyz; 11 | float f = texture1D(fade, at.z).a; 12 | 13 | if (f == 0.0) { 14 | discard; 15 | } 16 | 17 | gl_FragColor = texture2D(bars, at.xy); 18 | gl_FragColor.a *= f; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /dist/ll_shaders/ll_3dfade.glsl: -------------------------------------------------------------------------------- 1 | 2 | uniform sampler3D tags; 3 | uniform sampler3D ball; 4 | uniform sampler2D bars; 5 | uniform sampler1D sel; 6 | uniform sampler1D fade; 7 | 8 | void main() { 9 | 10 | vec3 at = gl_TexCoord[0].xyz; 11 | float f = texture1D(fade, at.z).a; 12 | 13 | if (f == 0.0) { 14 | discard; 15 | } 16 | 17 | gl_FragColor = texture3D(tags, at); 18 | gl_FragColor.a *= f; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /dist/ll_shaders/ll_3dsel.glsl: -------------------------------------------------------------------------------- 1 | 2 | uniform sampler3D tags; 3 | uniform sampler3D ball; 4 | uniform sampler2D bars; 5 | uniform sampler1D sel; 6 | uniform sampler1D fade; 7 | 8 | void main() { 9 | 10 | vec3 at = gl_TexCoord[0].xyz; 11 | float f = texture1D(fade, at.z).a; 12 | 13 | if (f == 0.0) { 14 | discard; 15 | } 16 | 17 | float r = texture3D(tags, at).x; 18 | vec4 bal = texture3D(ball, at); 19 | vec4 bar = texture2D(bars, at.xy); 20 | 21 | 22 | if (texture1D(sel,r).r > 0.5) { 23 | gl_FragColor = mix(bar,bal,bal.a); 24 | } else { 25 | gl_FragColor = mix(bal,bar,bar.a); 26 | } 27 | gl_FragColor.a *= f; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /dist/ll_shaders/ll_regions.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_texture_rectangle : enable 2 | 3 | uniform sampler2DRect tags; 4 | uniform vec4 highlight; 5 | uniform vec3 highlight_color; 6 | uniform float size; 7 | uniform float px_size; 8 | 9 | #define S0 vec2(-1.0/10.0,-3.0/10.0) * px_size 10 | #define S1 vec2(-3.0/10.0, 1.0/10.0) * px_size 11 | #define S2 vec2( 1.0/10.0, 3.0/10.0) * px_size 12 | #define S3 vec2( 3.0/10.0,-1.0/10.0) * px_size 13 | 14 | #define SAMP( L ) \ 15 | { \ 16 | vec2 at = gl_TexCoord[0].xy + L; \ 17 | vec4 tag1 = texture2DRect(tags, at + vec2(-size,-size)); \ 18 | vec4 tag2 = texture2DRect(tags, at + vec2( size, size)); \ 19 | vec4 tag3 = texture2DRect(tags, at + vec2(-size, size)); \ 20 | vec4 tag4 = texture2DRect(tags, at + vec2( size,-size)); \ 21 | \ 22 | if (tag1 != tag2 || tag3 != tag4) { \ 23 | acc += vec3(0.0, 0.0, 0.0); \ 24 | } else if (tag1 == highlight) { \ 25 | acc += highlight_color; \ 26 | } else { \ 27 | acc += vec3(1.0, 1.0, 1.0); \ 28 | } \ 29 | } 30 | 31 | void main() { 32 | vec3 acc = vec3(0.0, 0.0, 0.0); 33 | SAMP( S0 ); 34 | SAMP( S1 ); 35 | SAMP( S2 ); 36 | SAMP( S3 ); 37 | gl_FragColor.rgb = acc * 0.25; 38 | gl_FragColor.a = 1.0; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /dist/ll_shaders/ll_subpixel.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect image; 5 | uniform float px_size; 6 | 7 | // eight-queens / rotated grid: 8 | // . . . . . . x . 9 | // . x . . . . . . 10 | // . . . . x . . . 11 | // . . . . . . . x 12 | // . . x .'. . . . 13 | // . . . . . x . . 14 | // x . . . . . . . 15 | // . . . x . . . . 16 | 17 | #define S0 vec2(-7.0/16.0, 5.0/16.0) * px_size 18 | #define S1 vec2(-5.0/16.0,-5.0/16.0) * px_size 19 | #define S2 vec2(-3.0/16.0, 1.0/16.0) * px_size 20 | #define S3 vec2(-1.0/16.0, 7.0/16.0) * px_size 21 | #define S4 vec2( 1.0/16.0,-3.0/16.0) * px_size 22 | #define S5 vec2( 3.0/16.0, 3.0/16.0) * px_size 23 | #define S6 vec2( 5.0/16.0,-7.0/16.0) * px_size 24 | #define S7 vec2( 7.0/16.0,-1.0/16.0) * px_size 25 | 26 | void main() 27 | { 28 | vec2 at = gl_TexCoord[0].xy; 29 | vec4 c = 30 | 0.125 * ( 31 | texture2DRect(image, at + S0) 32 | +texture2DRect(image, at + S1) 33 | +texture2DRect(image, at + S2) 34 | +texture2DRect(image, at + S3) 35 | +texture2DRect(image, at + S4) 36 | +texture2DRect(image, at + S5) 37 | +texture2DRect(image, at + S6) 38 | +texture2DRect(image, at + S7) 39 | ) 40 | ; 41 | gl_FragColor = c; 42 | } 43 | -------------------------------------------------------------------------------- /dist/ll_shaders/peel_model_frag.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_texture_rectangle : enable 2 | 3 | uniform sampler2DRect max_depth; 4 | 5 | void main() { 6 | float depth = texture2DRect(max_depth, gl_FragCoord.xy).x; 7 | gl_FragColor = gl_Color; 8 | if (gl_FragCoord.z <= depth) { 9 | discard; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /dist/ll_shaders/shade_model_vert.glsl: -------------------------------------------------------------------------------- 1 | void main() { 2 | vec4 vert = gl_ModelViewProjectionMatrix * gl_Vertex; 3 | vec3 norm = normalize((gl_ModelViewMatrix * vec4(gl_Normal,0.0)).xyz); 4 | 5 | vec3 color = 6 | + abs(gl_Normal.x) * vec3(0.0, 1.0, 0.0) 7 | + abs(gl_Normal.y) * vec3(1.0, 0.5, 0.0) 8 | + abs(gl_Normal.z) * vec3(0.0, 0.5, 1.0); 9 | 10 | float lit = max(0.0, dot(norm, normalize(vec3(0.5,1.0,-1.5)))); 11 | float lit2 = max(0.0, dot(norm, normalize(vec3(-1.5,0.3,-0.5)))); 12 | 13 | gl_FrontColor = gl_BackColor = vec4(color,0.7) * 14 | mix( 15 | vec4(0.1, 0.1, 0.2, 1.0), 16 | vec4(1.0, 0.9, 0.9, 1.0), 17 | lit+lit2 18 | ); 19 | gl_Position = vert; 20 | } 21 | -------------------------------------------------------------------------------- /dist/ll_siggraph/anim-ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/anim-ball.png -------------------------------------------------------------------------------- /dist/ll_siggraph/anim-pillars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/anim-pillars.png -------------------------------------------------------------------------------- /dist/ll_siggraph/cyl.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/cyl.mp4 -------------------------------------------------------------------------------- /dist/ll_siggraph/flip-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/flip-up.png -------------------------------------------------------------------------------- /dist/ll_siggraph/ix.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/ix.mp4 -------------------------------------------------------------------------------- /dist/ll_siggraph/overlap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/overlap.png -------------------------------------------------------------------------------- /dist/ll_siggraph/pants.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/pants.mp4 -------------------------------------------------------------------------------- /dist/ll_siggraph/restack-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/restack-1.png -------------------------------------------------------------------------------- /dist/ll_siggraph/restack-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/restack-2.png -------------------------------------------------------------------------------- /dist/ll_siggraph/restack-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/restack-3.png -------------------------------------------------------------------------------- /dist/ll_siggraph/soft_example.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/soft_example.xcf -------------------------------------------------------------------------------- /dist/ll_siggraph/soft_example_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/soft_example_1.png -------------------------------------------------------------------------------- /dist/ll_siggraph/soft_example_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/soft_example_2.png -------------------------------------------------------------------------------- /dist/ll_siggraph/soft_example_cons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/soft_example_cons.png -------------------------------------------------------------------------------- /dist/ll_siggraph/soft_example_stacked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/soft_example_stacked.png -------------------------------------------------------------------------------- /dist/ll_siggraph/voting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/voting.png -------------------------------------------------------------------------------- /dist/ll_siggraph/w1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/w1.png -------------------------------------------------------------------------------- /dist/ll_siggraph/w2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/w2.png -------------------------------------------------------------------------------- /dist/ll_siggraph/w3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/w3.png -------------------------------------------------------------------------------- /dist/ll_siggraph/w4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/w4.png -------------------------------------------------------------------------------- /dist/ll_siggraph/weave.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ll_siggraph/weave.mp4 -------------------------------------------------------------------------------- /dist/p_shaders/jacobi.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_texture_rectangle : enable 2 | 3 | uniform sampler2DRect value; //w == distance to nearest constraint px 4 | uniform sampler2DRect cons; //white where we should interpolate, black where we should ignore, color where we are constrained. 5 | 6 | uniform float scale; 7 | 8 | // Neighborhood: 9 | // s0 10 | // s1 s2 11 | // s3 12 | 13 | vec4 sample(vec2 at) { 14 | vec4 s = texture2DRect(cons, at); 15 | if (s.w == 0.0) { 16 | return texture2DRect(value, at); 17 | } else { 18 | return s; 19 | } 20 | } 21 | 22 | void main() { 23 | vec2 at = gl_TexCoord[0].xy; 24 | { //check if we need to interpolate here: 25 | vec4 cur = texture2DRect(cons, at); 26 | if (cur.w != 0.0) { 27 | gl_FragColor = vec4(cur.xyz, 0.0); 28 | return; 29 | } 30 | } 31 | float dis = texture2DRect(value, at).w; 32 | float step = max(scale * dis, 1.0); 33 | 34 | vec4 sum = 35 | sample(at + vec2( step,0)) 36 | + sample(at + vec2(-step,0)) 37 | + sample(at + vec2(0, step)) 38 | + sample(at + vec2(0,-step)) 39 | ; 40 | gl_FragColor = vec4(sum.xyz / 4.0, dis); 41 | } 42 | -------------------------------------------------------------------------------- /dist/p_shaders/jfa_final.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect close; 5 | uniform sampler2DRect cons; 6 | 7 | void main() 8 | { 9 | vec2 pos = gl_TexCoord[0].xy; 10 | vec3 close = texture2DRect(close, pos).xyz; 11 | if (close.x == 0.0) { 12 | gl_FragColor = vec4(0.0, 0.0, 1.0, 0.0); 13 | } else { 14 | vec4 c = texture2DRect(cons, close.xy); 15 | gl_FragColor = vec4(c.xyz, 16 | sqrt(dot(close.xy - pos, close.xy - pos))); 17 | } 18 | /* //DEBUG: visualize distances: 19 | gl_FragColor.x = 0.0; //sqrt(dot(close.xy - pos, close.xy - pos)) / 600.0; 20 | gl_FragColor.yz = close.xy / 600.0; 21 | gl_FragColor.w = 1.0; 22 | */ 23 | 24 | } 25 | -------------------------------------------------------------------------------- /dist/p_shaders/jfa_init.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect cons; 5 | uniform float size; 6 | 7 | void main() 8 | { 9 | vec4 c = texture2DRect(cons, gl_TexCoord[0].xy); 10 | if (c.w == 0.0) { 11 | gl_FragColor = vec4(0.0, 0.0, size*size, 1.0); //"closest seed is here with distance 'huge'" 12 | } else { 13 | gl_FragColor = vec4(gl_TexCoord[0].xy, 0.0, 1.0); //"closest seed is here with distance 'small'" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /dist/p_shaders/jfa_iter.glsl: -------------------------------------------------------------------------------- 1 | 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect close; 5 | uniform float step; 6 | 7 | #define TEST( X ) \ 8 | { \ 9 | vec3 test = texture2DRect(close, gl_TexCoord[0].xy + (X)).xyz; \ 10 | if (test.x != 0.0) { \ 11 | test.z = dot(test.xy - pos, test.xy - pos); \ 12 | if (test.z < best.z) { \ 13 | best = test; \ 14 | } \ 15 | } \ 16 | } \ 17 | 18 | 19 | void main() { 20 | 21 | vec2 pos = gl_TexCoord[0].xy; 22 | vec3 best = texture2DRect(close, gl_TexCoord[0].xy).xyz; 23 | TEST(vec2(0,step)) 24 | TEST(vec2(0,-step)) 25 | TEST(vec2(step,0)) 26 | TEST(vec2(-step,0)) 27 | TEST(vec2(step,step)) 28 | TEST(vec2(-step,-step)) 29 | TEST(vec2(step,-step)) 30 | TEST(vec2(-step,step)) 31 | 32 | gl_FragColor.xyz = best; 33 | gl_FragColor.w = 1.0; 34 | } 35 | -------------------------------------------------------------------------------- /dist/shaders/static.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_ARB_texture_rectangle : enable 2 | 3 | uniform sampler2DRect img; 4 | uniform sampler2D static_tex; 5 | uniform vec2 static_mul; 6 | uniform vec2 static_add; 7 | uniform float scale; 8 | 9 | void main() 10 | { 11 | gl_FragColor = 12 | texture2DRect(img, gl_TexCoord[0].xy) 13 | + (texture2D(static_tex, gl_TexCoord[0].xy * static_mul + static_add) - 0.5) * scale; 14 | gl_FragColor.w = 1.0; 15 | } 16 | -------------------------------------------------------------------------------- /dist/sp_shaders/combine.glsl: -------------------------------------------------------------------------------- 1 | uniform sampler2D layerA; 2 | uniform sampler2D layerB; 3 | uniform sampler2D order; 4 | 5 | void main() 6 | { 7 | float amt = texture2D(order, gl_TexCoord[0].xy).x; 8 | vec4 ca = texture2D(layerA, gl_TexCoord[0].xy); 9 | vec4 cb = texture2D(layerB, gl_TexCoord[0].xy); 10 | 11 | if (ca.w + cb.w == 0.0) { 12 | gl_FragColor = vec4(0.0,0.0,0.0,0.0); 13 | return; 14 | } 15 | vec4 stack1; 16 | stack1.xyz = (ca.xyz * ca.w + cb.xyz * (1.0 - ca.w) * cb.w) / (ca.w + (1.0 - ca.w) * cb.w); 17 | stack1.w = ca.w + (1.0 - ca.w) * cb.w; 18 | vec4 stack2; 19 | stack2.xyz = (cb.xyz * cb.w + ca.xyz * (1.0 - cb.w) * ca.w) / (cb.w + (1.0 - cb.w) * ca.w); 20 | stack2.w = cb.w + (1.0 - cb.w) * ca.w; 21 | 22 | gl_FragColor = mix(stack1, stack2, amt); 23 | } 24 | -------------------------------------------------------------------------------- /dist/ss/accumulate_frag.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_texture_array : enable 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect image; 5 | uniform sampler2DRect coef; 6 | 7 | #ifndef CHAN 8 | #define CHAN a 9 | #endif 10 | 11 | void main() { 12 | vec4 i = texture2DRect(image, gl_TexCoord[0].xy); 13 | float a = texture2DRect(coef, gl_TexCoord[0].xy).CHAN; 14 | gl_FragColor = i * a; 15 | } 16 | -------------------------------------------------------------------------------- /dist/ss/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss/bg.png -------------------------------------------------------------------------------- /dist/ss/cons_frag.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_texture_array : enable 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2D brush; 5 | 6 | void main() { 7 | float b = texture2D(brush, gl_TexCoord[0].xy).a; 8 | if (b < 0.5) { 9 | discard; 10 | } else { 11 | gl_FragColor = gl_Color; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /dist/ss/hard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss/hard.png -------------------------------------------------------------------------------- /dist/ss/soft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss/soft.png -------------------------------------------------------------------------------- /dist/ss/stroke_frag.glsl: -------------------------------------------------------------------------------- 1 | #extension GL_EXT_texture_array : enable 2 | #extension GL_ARB_texture_rectangle : enable 3 | 4 | uniform sampler2DRect stroke; 5 | uniform sampler2DRect from; 6 | 7 | void main() { 8 | float s = texture2DRect(stroke, gl_TexCoord[0].xy).CHAN; 9 | float f = texture2DRect(from, gl_TexCoord[0].xy).CHAN; 10 | gl_FragColor = vec4(s * f, s * f, s * f, s * f); 11 | } 12 | -------------------------------------------------------------------------------- /dist/ss_eg/Makefile: -------------------------------------------------------------------------------- 1 | all : \ 2 | alpha_analogy.png \ 3 | alpha_anim.s1.png \ 4 | alpha_anim.s2.png \ 5 | alpha_anim.s3.png \ 6 | alpha_anim.s4.png \ 7 | alpha_anim.s5.png \ 8 | swap.opaque.png \ 9 | swap.transp.png \ 10 | swap.one.png \ 11 | swap.both.png \ 12 | armies.png \ 13 | 14 | alpha_anim.%.svg : alpha_anim.svg 15 | ./svgsplit.py $< $* > $@ 16 | 17 | swap.%.svg : swap.svg 18 | ./svgsplit.py $< $* > $@ 19 | 20 | %.png : %.svg 21 | inkscape --export-png=$@ --export-dpi=200 --export-area-drawing --export-background='#000000' --export-background-opacity=0.0 $< 22 | -------------------------------------------------------------------------------- /dist/ss_eg/alpha_analogy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/alpha_analogy.png -------------------------------------------------------------------------------- /dist/ss_eg/alpha_anim.s1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/alpha_anim.s1.png -------------------------------------------------------------------------------- /dist/ss_eg/alpha_anim.s2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/alpha_anim.s2.png -------------------------------------------------------------------------------- /dist/ss_eg/alpha_anim.s3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/alpha_anim.s3.png -------------------------------------------------------------------------------- /dist/ss_eg/alpha_anim.s4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/alpha_anim.s4.png -------------------------------------------------------------------------------- /dist/ss_eg/alpha_anim.s5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/alpha_anim.s5.png -------------------------------------------------------------------------------- /dist/ss_eg/armies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/armies.png -------------------------------------------------------------------------------- /dist/ss_eg/core_b.scaled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/core_b.scaled.png -------------------------------------------------------------------------------- /dist/ss_eg/core_b_b.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/core_b_b.thumb.png -------------------------------------------------------------------------------- /dist/ss_eg/core_b_c.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/core_b_c.thumb.png -------------------------------------------------------------------------------- /dist/ss_eg/core_b_h.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/core_b_h.thumb.png -------------------------------------------------------------------------------- /dist/ss_eg/core_b_o.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/core_b_o.thumb.png -------------------------------------------------------------------------------- /dist/ss_eg/core_b_oh.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/core_b_oh.thumb.png -------------------------------------------------------------------------------- /dist/ss_eg/core_b_w.thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/core_b_w.thumb.png -------------------------------------------------------------------------------- /dist/ss_eg/svgsplit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys 4 | from xml.dom.minidom import parse 5 | 6 | if len(sys.argv) != 3: 7 | print "Please pass the name of an svg and the name of a group to not hide." 8 | 9 | dom = parse(sys.argv[1]) 10 | 11 | found = False 12 | 13 | def supress(elt): 14 | global found 15 | for child in elt.childNodes: 16 | if elt.localName == 'g' and child.localName == 'title': 17 | name = child.firstChild.data 18 | if name != sys.argv[2]: 19 | elt.setAttribute('style', 'visibility:hidden;display:none') 20 | sys.stderr.write("Hiding %s.\n" % name) 21 | else: 22 | sys.stderr.write("Leaving %s as is.\n" % name) 23 | found = True 24 | else: 25 | supress(child) 26 | 27 | supress(dom) 28 | 29 | if not found: 30 | sys.stderr.write("Title %s not found.\n" % sys.argv[2]) 31 | exit(-1) 32 | 33 | sys.stdout.write(dom.toxml(encoding="utf-8")); 34 | -------------------------------------------------------------------------------- /dist/ss_eg/swap.both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/swap.both.png -------------------------------------------------------------------------------- /dist/ss_eg/swap.one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/swap.one.png -------------------------------------------------------------------------------- /dist/ss_eg/swap.opaque.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/swap.opaque.png -------------------------------------------------------------------------------- /dist/ss_eg/swap.transp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_eg/swap.transp.png -------------------------------------------------------------------------------- /dist/ss_examples/.gitignore: -------------------------------------------------------------------------------- 1 | *.coef*.png 2 | -------------------------------------------------------------------------------- /dist/ss_examples/aubergene.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/aubergene.png -------------------------------------------------------------------------------- /dist/ss_examples/aubergene_cons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/aubergene_cons.png -------------------------------------------------------------------------------- /dist/ss_examples/aubergene_cons.txt: -------------------------------------------------------------------------------- 1 | 4281933791 0 2 | 4293997325 1 3 | -------------------------------------------------------------------------------- /dist/ss_examples/cheese.c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/cheese.c.png -------------------------------------------------------------------------------- /dist/ss_examples/cheese.m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/cheese.m.png -------------------------------------------------------------------------------- /dist/ss_examples/cheese.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/cheese.png -------------------------------------------------------------------------------- /dist/ss_examples/cheese.s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/cheese.s.png -------------------------------------------------------------------------------- /dist/ss_examples/cheese_cons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/cheese_cons.png -------------------------------------------------------------------------------- /dist/ss_examples/cheese_cons.txt: -------------------------------------------------------------------------------- 1 | 4281933791 3 5 2 | 4293997325 0 1 4 3 | 4286697518 2 3 5 4 | 4293369899 0 1 3 5 | 4284486787 2 4 5 6 | -------------------------------------------------------------------------------- /dist/ss_examples/four_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/four_b.png -------------------------------------------------------------------------------- /dist/ss_examples/four_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/four_g.png -------------------------------------------------------------------------------- /dist/ss_examples/four_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/four_m.png -------------------------------------------------------------------------------- /dist/ss_examples/four_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/four_y.png -------------------------------------------------------------------------------- /dist/ss_examples/lightning3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/lightning3.png -------------------------------------------------------------------------------- /dist/ss_examples/lightning3_cons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/lightning3_cons.png -------------------------------------------------------------------------------- /dist/ss_examples/lightning3_cons.txt: -------------------------------------------------------------------------------- 1 | 4281933791 0 3 5 2 | 4293997325 2 4 5 3 | 4286697518 0 1 4 4 | 4293369899 2 3 5 5 | -------------------------------------------------------------------------------- /dist/ss_examples/magic-mail.c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/magic-mail.c.png -------------------------------------------------------------------------------- /dist/ss_examples/magic-mail.m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/magic-mail.m.png -------------------------------------------------------------------------------- /dist/ss_examples/magic-mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/magic-mail.png -------------------------------------------------------------------------------- /dist/ss_examples/magic-mail.r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/magic-mail.r.png -------------------------------------------------------------------------------- /dist/ss_examples/magic-mail_cons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/magic-mail_cons.png -------------------------------------------------------------------------------- /dist/ss_examples/magic-mail_cons.txt: -------------------------------------------------------------------------------- 1 | 4281933791 2 4 2 | 4293997325 0 1 3 | 4286697518 2 3 5 4 | 4293369899 0 1 4 5 | 4284486787 0 3 5 6 | -------------------------------------------------------------------------------- /dist/ss_examples/one_megapixel_two_layers_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/one_megapixel_two_layers_1.png -------------------------------------------------------------------------------- /dist/ss_examples/one_megapixel_two_layers_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/dist/ss_examples/one_megapixel_two_layers_2.png -------------------------------------------------------------------------------- /shapes.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SHAPES_HPP 2 | #define SHAPES_HPP 3 | 4 | #include 5 | 6 | template< int angles > 7 | Vector2f const *angles_table() { 8 | static Vector2f table[angles + 1]; //angles table is circular for ease-of-use reasons. 9 | static bool init = false; 10 | if (!init) { 11 | init = true; 12 | for (unsigned int a = 0; a <= angles; ++a) { 13 | float ang = a / float(angles) * float(M_PI) * 2.0f; 14 | table[a] = make_vector(cosf(ang), sinf(ang)); 15 | } 16 | } 17 | return table; 18 | } 19 | 20 | template< int angles > 21 | void circle( float radius = 1.0f, Vector2f center = make_vector(0.0f, 0.0f)) { 22 | glPushAttrib(GL_TRANSFORM_BIT); 23 | glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); 24 | glMatrixMode(GL_MODELVIEW); 25 | glPushMatrix(); 26 | glTranslatef(center.x, center.y, 0.0f); 27 | glScalef(radius, radius, 1.0f); 28 | 29 | Vector2f const *tab = angles_table< angles >(); 30 | glEnableClientState(GL_VERTEX_ARRAY); 31 | glVertexPointer(2, GL_FLOAT, sizeof(Vector2f), &(tab[0])); 32 | glDrawArrays(GL_TRIANGLE_FAN, 0, angles); 33 | 34 | glPopMatrix(); 35 | glPopClientAttrib(); 36 | glPopAttrib(); 37 | } 38 | 39 | /*template< int angles > 40 | void capsule( float length = 1.0f, float Vector2f center = make_vector(0.0f, 0.0f), float length = 1.0f, float r1*/ 41 | 42 | 43 | #endif //SHAPES_HPP 44 | -------------------------------------------------------------------------------- /util/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *~ 3 | .*.swp 4 | -------------------------------------------------------------------------------- /util/Basis/Error.cpp: -------------------------------------------------------------------------------- 1 | #include "Error.hpp" 2 | 3 | std::ostream &get_error_stream() { 4 | return std::cerr; 5 | } 6 | 7 | std::ostream &get_warning_stream() { 8 | return std::cerr; 9 | } 10 | 11 | std::ostream &get_info_stream() { 12 | return std::cout; 13 | } 14 | -------------------------------------------------------------------------------- /util/Basis/Error.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ERROR_HPP 2 | #define ERROR_HPP 3 | 4 | #include 5 | 6 | std::ostream &get_error_stream(); 7 | //Old, deprecated: 8 | #ifdef COMPAT_ERROR 9 | #undef ERROR 10 | #define ERROR( X ) get_error_stream() << "(deprecated error log fn)" << __FILE__ << __LINE__ << X << std::endl 11 | #endif 12 | #undef LOG_ERROR 13 | #define LOG_ERROR( X ) get_error_stream() << X << std::endl 14 | 15 | std::ostream &get_warning_stream(); 16 | #ifdef COMPAT_ERROR 17 | #undef WARNING 18 | #define WARNING( X ) get_warning_stream() << "(old warning fn)" << __FILE__ << __LINE__ << X << std::endl 19 | #endif 20 | #undef LOG_WARNING 21 | #define LOG_WARNING( X ) get_warning_stream() << X << std::endl 22 | 23 | std::ostream &get_info_stream(); 24 | #ifdef COMPAT_ERROR 25 | #undef INFO 26 | #define INFO( X ) get_info_stream() << "(old info fn)" << __FILE__ << __LINE__ << X << std::endl 27 | #endif 28 | #undef LOG_INFO 29 | #define LOG_INFO( X ) get_info_stream() << X << std::endl 30 | 31 | #endif //ERROR_HPP 32 | -------------------------------------------------------------------------------- /util/Basis/Jamfile: -------------------------------------------------------------------------------- 1 | TOP = .. ; 2 | 3 | SubDir TOP Basis ; 4 | 5 | NAMES = Screen Error ListDir ; 6 | 7 | if $(BASIS_USE_PACKED) { 8 | NAMES += PackedIO ; 9 | } 10 | 11 | BASIS_OBJECTS = $(NAMES:D=$(SUBDIR):S=$(SUFOBJ)) ; 12 | 13 | MyObjects $(NAMES:S=.cpp) ; 14 | 15 | GraphicsFlags $(NAMES) ; 16 | -------------------------------------------------------------------------------- /util/Basis/Jamfile.new: -------------------------------------------------------------------------------- 1 | MySubDir TOP util Basis ; 2 | 3 | local NAMES = Screen ListDir ; 4 | 5 | if $(BASIS_CUSTOM_LOG) { 6 | } else { 7 | NAMES += Error ; 8 | } 9 | 10 | 11 | 12 | if $(BASIS_USE_PACKED) { 13 | NAMES += PackedIO ; 14 | } 15 | 16 | BASIS_OBJECTS = $(NAMES:D=$(LOCATE_TARGET):S=$(SUFOBJ)) ; 17 | 18 | UTIL_OBJECTS += $(BASIS_OBJECTS) ; 19 | 20 | UtilFlags $(NAMES) ; 21 | 22 | MyObjects $(NAMES:S=.cpp) ; 23 | -------------------------------------------------------------------------------- /util/Basis/ListDir.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LISTDIR_HPP 2 | #define LISTDIR_HPP 3 | 4 | #include 5 | #include 6 | 7 | //returns all items in directory in no particular order -- note that 8 | //isn't _just_ files.. 9 | bool list_dir(std::string dir, std::vector< std::string > &items, std::string suffix = ""); 10 | 11 | bool exists(std::string filename); 12 | bool is_file(std::string filename); 13 | bool is_directory(std::string filename); 14 | 15 | 16 | #endif //LISTDIR_HPP 17 | -------------------------------------------------------------------------------- /util/Basis/linux/run_necklace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LD_LIBRARY_PATH=./lib ./necklace 3 | -------------------------------------------------------------------------------- /util/Basis/osx/SDLMain.h: -------------------------------------------------------------------------------- 1 | /* SDLMain.m - main entry point for our Cocoa-ized SDL app 2 | Initial Version: Darrell Walisser 3 | Non-NIB-Code & other changes: Max Horn 4 | 5 | Feel free to customize this file to suit your needs 6 | */ 7 | 8 | #import 9 | 10 | @interface SDLMain : NSObject 11 | @end 12 | -------------------------------------------------------------------------------- /util/Basis/osx/build_app.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # Build a .app hierarchy. 4 | # 5 | 6 | if (@ARGV != 2) { 7 | print "Please pass application name, 4cc.\n"; 8 | return; 9 | } 10 | 11 | my $name = $ARGV[0]; 12 | my $short = $ARGV[1]; 13 | length($short) == 4 || die "$short not four characters"; 14 | 15 | mkdir $name . ".app" || die; 16 | mkdir $name . ".app/Contents" || die; 17 | mkdir $name . ".app/Contents/Resources" || die; 18 | mkdir $name . ".app/Contents/MacOS" || die; 19 | open PLIST, ">", $name . ".app/Contents/Info.plist"; 20 | print PLIST < 22 | 23 | 24 | 25 | CFBundleDevelopmentRegion 26 | English 27 | CFBundleExecutable 28 | $name 29 | CFBundleIconFile 30 | $name.icns 31 | CFBundleIdentifier 32 | com.tchow.$name 33 | CFBundleInfoDictionaryVersion 34 | 6.0 35 | CFBundleName 36 | $name 37 | CFBundlePackageType 38 | APPL 39 | CFBundleSignature 40 | $short 41 | CFBundleVersion 42 | 1.0 43 | 44 | 45 | END 46 | close PLIST; 47 | 48 | print "Executable goes at $name.app/Contents/MacOS/$name\n"; 49 | print "Icon goes at $name.app/Contents/Resources/$name.icns\n"; 50 | -------------------------------------------------------------------------------- /util/Basis/osx/build_info.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | # Build a .app hierarchy. 4 | # 5 | 6 | if (@ARGV != 2) { 7 | print "Please pass application name, 4cc.\n"; 8 | return; 9 | } 10 | 11 | my $name = $ARGV[0]; 12 | my $short = $ARGV[1]; 13 | length($short) == 4 || die "$short not four characters"; 14 | 15 | my $id = $name; 16 | $id =~ s/\s/_/g; 17 | 18 | print < 20 | 21 | 22 | 23 | CFBundleDevelopmentRegion 24 | English 25 | CFBundleExecutable 26 | $name 27 | CFBundleIconFile 28 | $name.icns 29 | CFBundleIdentifier 30 | com.tchow.$id 31 | CFBundleInfoDictionaryVersion 32 | 6.0 33 | CFBundleName 34 | $name 35 | CFBundlePackageType 36 | APPL 37 | CFBundleSignature 38 | $short 39 | CFBundleVersion 40 | 1.0 41 | 42 | 43 | END 44 | -------------------------------------------------------------------------------- /util/Basis/osx/default.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/util/Basis/osx/default.icns -------------------------------------------------------------------------------- /util/Graphics/Font.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHICS_FONT 2 | #define GRAPHICS_FONT 3 | 4 | #include 5 | #include "Cache.hpp" 6 | #include 7 | #include "Graphics.hpp" 8 | extern "C" { 9 | #include "texfont.h" 10 | } 11 | 12 | namespace Graphics { 13 | 14 | using std::string; 15 | 16 | const unsigned int FONT_ID = 0xcaf3caf3; 17 | 18 | class CachedFont : public CachableItem { 19 | public: 20 | CachedFont(TexFont *font); 21 | virtual ~CachedFont(); 22 | virtual void reload(); 23 | float get_length(string const &text, float height) const; 24 | void draw(string const &text, Vector2f const & pos, float height) const; 25 | //justified draws: 26 | void draw_right(string const &text, Vector2f const & pos, float height) const; 27 | void draw_center(string const &text, Vector2f const & pos, float height) const; 28 | TexFont *font; 29 | float scale_factor; 30 | float translation_factor; 31 | }; 32 | 33 | typedef CacheRef< CachedFont > FontRef; 34 | 35 | FontRef get_font(string fontname = "default.txf"); 36 | 37 | } //namespace Graphics 38 | 39 | #endif //GRAPHICS_FONT 40 | -------------------------------------------------------------------------------- /util/Graphics/FrameDumper.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHICS_FRAMEDUMPER_HPP 2 | #define GRAPHICS_FRAMEDUMPER_HPP 3 | 4 | #include 5 | 6 | namespace Graphics { 7 | 8 | /* 9 | * This is a threaded frame-dumper, which I hope will be fast enough 10 | * to use for video recording without degrading performance. 11 | * 12 | * Behind the scenes, this is using threads and SDL timers to figure out 13 | * what is dump-worthy, and to queue it for disk writes. 14 | */ 15 | 16 | 17 | //filename is a pattern of the for file0000.ppm, where those zeros will 18 | //get the frame number. 19 | // -- fps == 0 is a special case where every frame is dumped. -- 20 | void init_dumper(std::string const &basename, float fps); 21 | bool dumper_active(); 22 | void deinit_dumper(); 23 | 24 | //Call this after a frame is finished and before you flip it to 25 | //the front buffer [i.e. it should still be on the back buffer]. 26 | void submit_frame(); 27 | 28 | } 29 | 30 | #endif //GRAPHICS_FRAMEDUMPER_HPP 31 | -------------------------------------------------------------------------------- /util/Graphics/Jamfile: -------------------------------------------------------------------------------- 1 | TOP = .. ; 2 | 3 | SubDir TOP Graphics ; 4 | 5 | NAMES = Graphics GLExtensions Cache Font ; 6 | 7 | CNAMES = texfont ; 8 | 9 | GRAPHICS_LIBS = ; 10 | 11 | if $(GRAPHICS_USE_JPEG) { 12 | GRAPHICS_LIBS += -ljpeg ; 13 | NAMES += load_jpeg ; 14 | ObjectC++Flags load_jpeg : -I/opt/local/include/ ; 15 | ObjectC++Flags Texture : -DGRAPHICS_USE_JPEG ; 16 | } 17 | 18 | if $(GRAPHICS_USE_TEXTURE) || $(GRAPHICS_USE_FRAME_DUMPER) { 19 | Echo "Building with texture support" ; 20 | NAMES += Texture ; 21 | if $(GRAPHICS_DISABLE_LOADSAVE) { 22 | } else { 23 | NAMES += load_save_png ; 24 | } 25 | if $(OS) = NT { 26 | #handled in Jamrules. 27 | } else { 28 | ObjectC++Flags load_save_png Texture : `libpng-config --cflags` ; 29 | GRAPHICS_LIBS += `libpng-config --ldflags` ; 30 | } 31 | } 32 | 33 | if $(GRAPHICS_USE_FRAME_DUMPER) { 34 | Echo "Building with frame dumper support" ; 35 | NAMES += FrameDumper ; 36 | } 37 | 38 | if $(GRAPHICS_USE_SHADER) { 39 | Echo "Building with shader support" ; 40 | NAMES += GLSLShader ; 41 | } 42 | 43 | if $(GRAPHICS_USE_SHADOW) { 44 | Echo "Building with shadow stencil helpers" ; 45 | NAMES += ShadowStencil ; 46 | } 47 | 48 | GRAPHICS_OBJECTS = $(NAMES:D=$(SUBDIR):S=$(SUFOBJ)) $(CNAMES:D=$(SUBDIR):S=$(SUFOBJ)) ; 49 | 50 | MyObjects $(NAMES:S=.cpp) $(CNAMES:S=.c) ; 51 | 52 | #For compatibility with older jamfiles: 53 | ObjectC++Flags $(NAMES) : $(SDLC++FLAGS) ; 54 | ObjectCcFlags $(CNAMES) : $(SDLC++FLAGS) ; 55 | 56 | #For newer jamfiles: 57 | 58 | GraphicsFlags $(NAMES) ; 59 | 60 | GraphicsCFlags $(CNAMES) ; 61 | -------------------------------------------------------------------------------- /util/Graphics/Jamfile.new: -------------------------------------------------------------------------------- 1 | MySubDir TOP util Graphics ; 2 | 3 | local NAMES = Graphics GLExtensions Cache Font ; 4 | 5 | local CNAMES = texfont ; 6 | 7 | if $(GRAPHICS_USE_TEXTURE) || $(GRAPHICS_USE_FRAME_DUMPER) { 8 | GRAPHICS_USE_PNG = 1 ; 9 | } 10 | 11 | rule GraphicsLibs $(1) { 12 | if $(GRAPHICS_USE_JPEG) { 13 | JPEGLibs $(1) ; 14 | } 15 | if $(GRAPHICS_USE_PNG) { 16 | PNGLibs $(1) ; 17 | } 18 | 19 | } 20 | 21 | if $(GRAPHICS_USE_JPEG) { 22 | Echo "Building Graphics with JPEG loading support" ; 23 | NAMES += load_jpeg ; 24 | JPEGFlags load_jpeg ; 25 | ObjectC++Flags Texture : -DGRAPHICS_USE_JPEG ; 26 | } 27 | 28 | if $(GRAPHICS_USE_PNG) { 29 | Echo "Building Graphics with PNG loading support" ; 30 | NAMES += load_save_png ; 31 | PNGFlags load_save_png ; 32 | } 33 | 34 | if $(GRAPHICS_USE_TEXTURE) { 35 | Echo "Building Graphics with cached texture support" ; 36 | NAMES += Texture ; 37 | PNGFlags Texture ; 38 | } 39 | 40 | if $(GRAPHICS_USE_FRAME_DUMPER) { 41 | Echo "Building with frame dumper support" ; 42 | NAMES += FrameDumper ; 43 | } 44 | 45 | if $(GRAPHICS_USE_SHADER) { 46 | Echo "Building Graphics with cached shader support" ; 47 | NAMES += GLSLShader ; 48 | } 49 | 50 | if $(GRAPHICS_USE_SHADOW) { 51 | Echo "Building Graphics with shadow stencil helpers" ; 52 | NAMES += ShadowStencil ; 53 | } 54 | 55 | GRAPHICS_OBJECTS = $(NAMES:D=$(LOCATE_TARGET):S=$(SUFOBJ)) $(CNAMES:D=$(LOCATE_TARGET):S=$(SUFOBJ)) ; 56 | 57 | UTIL_OBJECTS += $(GRAPHICS_OBJECTS) ; 58 | 59 | UtilFlags $(NAMES) $(CNAMES) ; 60 | 61 | MyObjects $(NAMES:S=.cpp) $(CNAMES:S=.c) ; 62 | -------------------------------------------------------------------------------- /util/Graphics/Material.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MATERIAL_HPP 2 | #define MATERIAL_HPP 3 | 4 | #include "Graphics.hpp" 5 | #include 6 | 7 | namespace Graphics { 8 | //Idea: a generic 'Material' class that does it all for the look of objects. 9 | // something that is basic enough to handle simple colormaterial and complicated 10 | // enough to do textures and shaders. All with a uniform interface, of course. 11 | class BaseMaterial { 12 | public: 13 | //call begin before you start outputting geometry 14 | virtual void begin(); 15 | //call end... well, you get it. 16 | virtual void end(); 17 | /* 18 | Vector4f diffuse; 19 | Vector4f ambient; 20 | Vector4f specular; 21 | Vector4f emission; 22 | float shininess; 23 | */ 24 | } 25 | }; 26 | 27 | #endif //MATERIAL_HPP 28 | -------------------------------------------------------------------------------- /util/Graphics/ShadowStencil.cpp: -------------------------------------------------------------------------------- 1 | #include "ShadowStencil.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | using std::cout; 10 | using std::endl; 11 | 12 | //We need one of these two: 13 | REQUEST_GL_EXTENSION(GL_EXT_stencil_two_side); 14 | REQUEST_GL_EXTENSION(GL_ATI_separate_stencil); 15 | 16 | //We absolutely need this one: 17 | REQUEST_GL_EXTENSION(GL_EXT_stencil_wrap); 18 | 19 | namespace Graphics { 20 | 21 | void enable_shadow_stencil() { 22 | assert(have_EXT_stencil_wrap()); 23 | if (have_EXT_stencil_two_side()) { 24 | glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT); 25 | 26 | glActiveStencilFaceEXT(GL_BACK); 27 | glStencilFunc(GL_ALWAYS, 1, ~0U); 28 | glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP); 29 | 30 | glActiveStencilFaceEXT(GL_FRONT); 31 | glStencilFunc(GL_ALWAYS, 1, ~0U); 32 | glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP); 33 | } else if (have_ATI_separate_stencil()) { 34 | glStencilFuncSeparateATI( GL_ALWAYS, GL_ALWAYS, 1, ~0U ); 35 | glStencilOpSeparateATI( GL_BACK, GL_KEEP, GL_KEEP, GL_INCR_WRAP ); 36 | glStencilOpSeparateATI( GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR_WRAP ); 37 | } else { 38 | assert(0); 39 | } 40 | 41 | } 42 | 43 | void disable_shadow_stencil() { 44 | assert(have_EXT_stencil_wrap()); 45 | if (have_EXT_stencil_two_side()) { 46 | glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT); 47 | } else { 48 | /* nothing to disable */ 49 | } 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /util/Graphics/ShadowStencil.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHICS_SHADOWSTENCIL_HPP 2 | #define GRAPHICS_SHADOWSTENCIL_HPP 3 | 4 | namespace Graphics { 5 | 6 | //set up and tear down two-sided shadow state needed for, well, 7 | //two-sided shadow stenciling. 8 | void enable_shadow_stencil(); 9 | void disable_shadow_stencil(); 10 | 11 | } 12 | 13 | #endif //GRAPHICS_SHADOWSTENCIL_HPP 14 | -------------------------------------------------------------------------------- /util/Graphics/Texture.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHICS_TEXTURE_HPP 2 | #define GRAPHICS_TEXTURE_HPP 3 | 4 | #include "Graphics.hpp" 5 | 6 | #include "Cache.hpp" 7 | 8 | #include 9 | #include 10 | 11 | namespace Graphics { 12 | 13 | using std::string; 14 | using std::vector; 15 | 16 | const unsigned int TEXTURE_ID = 0xabadbad1; 17 | 18 | typedef bool (*ProcessFn)(unsigned int *tw, unsigned int *th, uint8_t **data, GLuint *internal_format, GLuint *data_format); 19 | 20 | class CachedTexture : public CachableItem { 21 | public: 22 | CachedTexture(string const &filename, bool pad, bool flip, ProcessFn process); 23 | virtual ~CachedTexture(); 24 | virtual void reload(); 25 | string filename; 26 | bool pad, flip; 27 | GLuint obj; 28 | unsigned int w,h; 29 | unsigned int tw, th; //if pad == true, then texture has been padded to a power of two and is really tw x th. 30 | ProcessFn process; 31 | }; 32 | 33 | typedef CacheRef< CachedTexture > TextureRef; 34 | 35 | //One of these is the function you (Mme. User) need to call: 36 | TextureRef get_texture(string const &filename, bool pad = false, bool flip = true, ProcessFn process = NULL); 37 | inline TextureRef get_texture(string const &filename, ProcessFn process) { 38 | return get_texture(filename, false, false, process); 39 | } 40 | 41 | } //namespace Graphics 42 | 43 | #endif //GRAPHICS_TEXTURE_HPP 44 | -------------------------------------------------------------------------------- /util/Graphics/fonts/gentium.txf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ixchow/Preshack/d8aa0f8ef8cca8d5b1aed759a92202de8355934e/util/Graphics/fonts/gentium.txf -------------------------------------------------------------------------------- /util/Graphics/load_jpeg.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LOAD_JPEG_HPP 2 | #define LOAD_JPEG_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | bool load_jpeg(std::string filename, unsigned int &width, unsigned int &height, std::vector< uint32_t > &data); 9 | 10 | #endif //LOAD_JPEG_HPP 11 | -------------------------------------------------------------------------------- /util/Graphics/load_save_png.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LOAD_SAVE_PNG_HPP 2 | #define LOAD_SAVE_PNG_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | /* 9 | * Load and save PNG files. 10 | * NOTE: these functions perform flipping to place keep the 11 | * pixel origin in the LOWER LEFT! 12 | * (unless you specify otherwise by setting flip to false) 13 | */ 14 | 15 | bool load_png(std::string filename, unsigned int &width, unsigned int &height, std::vector< uint32_t > &data, bool flip = true); 16 | void save_png(std::string filename, unsigned int width, unsigned int height, uint32_t const *data); 17 | 18 | bool load_png(std::istream &from, unsigned int &width, unsigned int &height, std::vector< uint32_t > &data, bool flip = true); 19 | void save_png(std::ostream &to, unsigned int width, unsigned int height, uint32_t const *data); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /util/Jamfile: -------------------------------------------------------------------------------- 1 | GRAPHICS_USE_TEXTURE = 1 ; 2 | GRAPHICS_USE_SHADER = 1 ; 3 | #IS_GAME = 1 ; #build 32-bit & with custom libraries to make redist easier 4 | 5 | SubDir TOP ; 6 | 7 | SubIncludeUtil ; 8 | 9 | MySubDir TOP ; 10 | 11 | NAMES = 12 | main #main program 13 | ; 14 | 15 | 16 | EXECNAME = main ; 17 | 18 | UtilFlags $(NAMES) ; 19 | Objects $(NAMES:S=.cpp) ; 20 | 21 | UtilLibs $(EXECNAME) ; 22 | Executable $(EXECNAME) : $(NAMES:S=$(SUFOBJ)) $(UTIL_OBJECTS) ; 23 | -------------------------------------------------------------------------------- /util/Jamrules: -------------------------------------------------------------------------------- 1 | include util/Basis/Jamrules.new ; 2 | -------------------------------------------------------------------------------- /util/Vector/MatrixGL-loose.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Matrix-loose.hpp" 4 | 5 | inline void glMultMatrix(Transform2d const &xform) { 6 | GLdouble mat[16] = { 7 | GLdouble(xform(0,0)), GLdouble(xform(1,0)), 0.0, 0.0, 8 | GLdouble(xform(0,1)), GLdouble(xform(1,1)), 0.0, 0.0, 9 | 0.0, 0.0, 1.0, 0.0, 10 | GLdouble(xform(0,2)), GLdouble(xform(1,2)), 0.0, 1.0, 11 | }; 12 | glMultMatrixd(mat); 13 | } 14 | 15 | inline void glMultMatrix(Transform2f const &xform) { 16 | GLfloat mat[16] = { 17 | GLfloat(xform(0,0)), GLfloat(xform(1,0)), 0.0f, 0.0f, 18 | GLfloat(xform(0,1)), GLfloat(xform(1,1)), 0.0f, 0.0f, 19 | 0.0f, 0.0f, 1.0f, 0.0f, 20 | GLfloat(xform(0,2)), GLfloat(xform(1,2)), 0.0f, 1.0f, 21 | }; 22 | glMultMatrixf(mat); 23 | } 24 | -------------------------------------------------------------------------------- /util/Vector/Misc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VECTOR_MISC_HPP 2 | #define VECTOR_MISC_HPP 3 | 4 | //Miscellaneous useful but not so useful as to be in the main header functions. 5 | 6 | inline Vector3f rotate_by_yaw(Vector3f const &in, float const yaw) { 7 | float c = cosf(yaw); 8 | float s = sinf(yaw); 9 | return make_vector< float >(s * in.z + c * in.x, in.y, c * in.z - s * in.x); 10 | } 11 | 12 | #endif //VECTOR_MISC_HPP 13 | -------------------------------------------------------------------------------- /util/Vector/QuatGL.hpp: -------------------------------------------------------------------------------- 1 | #ifndef QUAT_GL_HPP 2 | #define QUAT_GL_HPP 3 | 4 | #include "Quat.hpp" 5 | 6 | template< typename NUM > 7 | void quat_to_gl_matrix(Quat< NUM > const &a, NUM *mat) { 8 | NUM wx = a.w * a.x; 9 | NUM wy = a.w * a.y; 10 | NUM wz = a.w * a.z; 11 | 12 | NUM xx = a.x * a.x; 13 | NUM xy = a.x * a.y; 14 | NUM xz = a.x * a.z; 15 | 16 | NUM yy = a.y * a.y; 17 | NUM yz = a.y * a.z; 18 | 19 | NUM zz = a.z * a.z; 20 | 21 | NUM res[16] = { 22 | 1 - 2*yy - 2*zz, 2 * xy + 2 * wz, 2 * xz - 2 * wy, 0, 23 | 2 * xy - 2 * wz, 1 - 2*xx - 2*zz, 2 * yz + 2 * wx, 0, 24 | 2 * xz + 2 * wy, 2 * yz - 2 * wx, 1 - 2*xx - 2*yy, 0, 25 | 0, 0, 0, 1 26 | }; 27 | 28 | for (unsigned int i = 0; i < 16; ++i) { 29 | mat[i] = res[i]; 30 | } 31 | } 32 | 33 | inline void glRotate(Quat< double > const &a) { 34 | double mat[16]; 35 | quat_to_gl_matrix(a, mat); 36 | glMultMatrixd(mat); 37 | } 38 | 39 | inline void glRotate(Quat< float > const &a) { 40 | float mat[16]; 41 | quat_to_gl_matrix(a, mat); 42 | glMultMatrixf(mat); 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /util/Vector/RootedVector.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ROOTED_VECTOR_HPP 2 | #define ROOTED_VECTOR_HPP 3 | 4 | #include "Vector.hpp" 5 | 6 | template< typename NUM, int size > 7 | class RootedVector { 8 | public: 9 | Vector< NUM, size > root; 10 | Vector< NUM, size > vec; 11 | }; 12 | 13 | template< typename NUM, int size > 14 | inline RootedVector< NUM, size > make_rooted_vector( Vector< NUM, size > const &root, Vector< NUM, size > const &vec ) { 15 | RootedVector< NUM, size > ret; 16 | ret.root = root; 17 | ret.vec = vec; 18 | return ret; 19 | } 20 | 21 | 22 | typedef RootedVector< int32_t, 2 > RootedVector2i; 23 | typedef RootedVector< int32_t, 3 > RootedVector3i; 24 | typedef RootedVector< int32_t, 4 > RootedVector4i; 25 | 26 | typedef RootedVector< float, 2 > RootedVector2f; 27 | typedef RootedVector< float, 3 > RootedVector3f; 28 | typedef RootedVector< float, 4 > RootedVector4f; 29 | 30 | typedef RootedVector< double, 2 > RootedVector2d; 31 | typedef RootedVector< double, 3 > RootedVector3d; 32 | typedef RootedVector< double, 4 > RootedVector4d; 33 | 34 | #endif //ROOTED_VECTOR_HPP 35 | --------------------------------------------------------------------------------