tracerstar / haxademic

A personal toolkit for Java/Processing projects in Eclipse

Home Page:http://haxademic.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Haxademic

Haxademic

Haxademic is my personal Processing-based creative coding toolkit, built to run in Eclipse with Java and the latest version of Processing. It's a starting point for interactive visuals, installations, rendering and writing Processing "sketches" in a more robust environment. It loads a bunch of useful Java/Processing libraries and contains a ton of other useful tools that I've written.

State of affairs

While the code has been open-sourced, I don't plan on making it easy/viable for others to use - I don't have the time or desire to support it. This repository is more about sharing the interesting code within, and I fully endorse borrowing it however you see fit.

Notable code

Below you'll find a long list of classes and utilities that I've built to make my life easier. I've tried to make as many basic demos as possible for all of these features. The demo package mostly mirrors the core directory and should give you an idea of how to implement these object on your own.

App

com.haxademic.core.app

  • PAppletHax - This is the base class for every Processing app that I build. It initializes tools for app-level concerns, rendering, multiple input devices, audio FFT, and debugging tools. Tons of additional tools and utilities can be found in the library.

  • P - This class holds static references and methods - primarily to the app instance so I don't have to pass it around everywhere.

com.haxademic.core.app.config

  • AppSettings - Static constants to help set app properties and initialize special objects in PAppletHax. Used in tandem with P5Properties.

  • P5Properties - Loads properties from data/properties/run.properties (or an alternate specified .properties file), using the same string constants in AppSettings. All of these properties can be overridden in PAppletHax in the automatically-called overridePropsFile() function on app initialization.

Audio

com.haxademic.core.audio

  • NormalizeMonoWav - Normalizes a mono .wav file without any external libraries.

  • WavPlayer - Play a .wav file with Beads and cache for future plays.

  • WavRecorder - Record a .wav file with Minim.

com.haxademic.core.audio.analysis.input

Data

com.haxademic.core.data

  • ConvertUtil - A collection of basic Java type-conversion methods.

  • Patterns - A collection of pattern generators for step sequencer.

com.haxademic.core.data.constants

  • GLBlendModes - Fancy OpenGL blend modes with helper methods to set them on a given PGraphics context.

  • PBlendModes - Static constants list of Processing blend modes.

  • PRenderers - Static constants list of Processing renderers.

com.haxademic.core.data.store

  • AppStore - A singleton data store and emitter. As values are updated, subscribers are notified. Uses IAppStoreListener as the callback interface for AppStore updates.

  • AppStoreDistributed - A WebSockets-enabled extension of AppStore to keep multiple machines in sync with a shared data structure.

Debug

com.haxademic.core.debug

  • DebugView - Instantiated with every PAppletHax app, allows us to toggle and add properties to the DebugView HashMap to show realtime values on-screen, rather than trying to watch Java console values fly by. Press / to toggle. Also includes a panel for key commands and extra developer-defined info.

Draw

com.haxademic.core.draw.camera

  • CameraUtil - Primarily just a helper method to increase the camera distance on a PGraphics context.

com.haxademic.core.draw.color

  • ColorUtil - Handy color conversion methods.

  • EasingColor - An object that represents a single color with interpolation and helpful getter/setter methods. Has some overlap with ColorUtil - the two classes should possibly be merged.

  • ImageGradient - Loads an image and samples its colors horizontally. Works well for gradients and comes with a library of presets.

com.haxademic.core.draw.context

  • DrawUtil - Lots of static helper methods to set properties on the specified PGraphics context. I use this constantly.

  • OpenGL32Util - Some helper methods to move graphics between 8-bit Processing graphics for display and PixelFlow 32-bit graphics contexts for higher-resolution drawing and shaders.

  • OpenGLUtil - Lower-level helper methods to set OpenGL flags that aren't obviously available in Processing.

  • OrientationUtil - Helper methods to orient the graphics context rotation towards a specific 3d location. These utilities help point 3d objects toward each other.

com.haxademic.core.draw.filters.pgraphics

  • A collection of PGraphics-based image/video filters. These effects redraw an image in traditional Processing style on a PGraphics buffer.

com.haxademic.core.draw.filters.pshader

  • A collection of (over 100) PShader filter effects. These Java classes are convenience wrappers for GLSL programs/files and provide a common interface and (as minimal as) one-line implementations for shader filters. Shader uniforms are exposed through public setter methods.

com.haxademic.core.draw.image

  • AnimatedGifEncoder - Renders a gif file directly out of a Processing app. I've mostly abandoned this in favor of rendering a video, then using conversion tools like ffmpeg to more precisely convert to gif.

  • Base64Image - Encodes and decodes between a PImage and a base64-encoded string.

  • BufferActivityMonitor - Gives us an "activity" rating of a moving image, like a webcam, video, or other PGraphics instance that animates. Useful for motion detection.

  • BufferColorObjectDetection - Finds the center of mass of a specific color (within a threshold) on an image. Useful for object tracking in controlled situations.

  • BufferMotionDetectionMap - Uses shaders for fast frame-diffing to detect motion between video/camera frames. Includes helpers to find random motion points in the motion map result.

  • BufferThresholdMonitor - Copies an image to a low-res buffer, runs a threshold filter, and counts white vs black pixels. Useful as a step in certain CV processes.

  • ImageCyclerBuffer - Uses GLSL transitions to create a slideshow from an array of PImages.

  • ImageSequenceMovieClip - Loads and plays back an image sequence like a Movie object does for video files.

  • ImageSequenceRecorder - Builds an array of PGraphics objects to record recent video frames and play them back for time distortion effects or short video compiling.

  • ImageUtil - Lots of tools for dealing with images and drawing them to screen.

  • MovieToImageSequence - Loads frames from a video into an array of PImages in realtime. Useful for fancier & faster playback/scrubbing through video frames without relying on Movie decoding once the frames are extracted.

  • SimplexNoiseTexture - Fast simplex noise.

  • TickerScroller - Repeats a texture across a PGraphics and scrolls.

  • TiledTexture - A drawing helper that takes advantage of OpenGL's texture repeat function and lets us draw a rectangle with a texture fill. Includes zoom & rotation controls for fancy texture & pattern tiling.

com.haxademic.core.draw.mapping

  • BaseSavedQuadUI - Base class for CaptureKeystoneToRectBuffer and PGraphicsKeystone. Stores/recalls a quad to text file and provides a GUI and keyboard controls to move the vertices.

  • CaptureKeystoneToRectBuffer - Reverse-projection-mapping tool. Pulls from an image with a configurable quad and draws to a PGraphics instance.

  • PGraphicsKeystone - Projection-mapping tool. Draws a PGraphics buffer to screen, with custom keystoning backed by a text file.

  • SavedRectangle - Basic mapping tool. Provides rectangle data controlled by a mouse-based UI, backed by a text file.

com.haxademic.core.draw.particle

com.haxademic.core.draw.shapes

  • Extrude2dPoints - Turns a set of 2d points into a 3d extrusion.

  • Icosahedron - Icosahedron generator, with optional texture application.

  • MarchingCubes - Marching cubes implementation.

  • MeshShapes - A collection of interesting generative mesh shape drawing functions.

  • LinesDeformAndTextureFilter - GPU displacement shader for a textured LINES PShape.

  • MeshDeformAndTextureFilter - GPU displacement shader for a standard PShape.

  • PointsDeformAndTextureFilter - GPU displacement shader for a textured POINTS PShape.

  • PShapeSolid - Accepts a SPhape and tracks shared vertices, providing multiple deformation strategies without letting connected triangles diverge.

  • PShapeUtil - A large collection of normalization, texturing and other manipulation methods to apply to PShape objects.

  • Shapes - Some custom mesh-drawing tools.

  • Superformula - A superformula implementation.

  • TextToPShape - Text with a custom font turned into a 2d or 3d mesh.

com.haxademic.core.draw.textures.pgraphics

  • A collection of PGraphics-based realtime textures, originally built as "VJ" clips/layers.

com.haxademic.core.draw.textures.pshader

  • A collection of (over 100) realtime shader textures, both original creations (prefixed with 'cacheflowe') and shaders ported from other artists on the web. Check the GLSL source for credits.

File

  • DemoAssets - A collection of media files (svg, obj, png, ttf, mp4) to help quickly load an asset for demo purposes. Files are pulled from data/haxademic/.

  • FileUtil - File & directory methods to help with file creation, deletion & listing.

  • PrefToText - Saves & retries a float/int/String value from a text file.

  • WatchDir - Watches a directory & provides a delegate callback when files have changed.

Hardware

  • DMXWrapper - Helper to "easily" connect and send messages to an ENTTEC DMX USB Pro.

  • GamepadListener - Uses JInput to receive messages from a gamepad controller.

  • MidiText - Parses a MIDI file.

  • InputTrigger - Accepts multiple inputs to trigger the same action. Keystrokes, MIDI, OSC, HTTP and more.

  • IWebCamCallback - Interface to work in tandem with WebCamWrapper to provide callbacks when new webcam frames are available.

  • IKinectWrapper - Interface for KinectWrapperV1 and KinectWrapperV2.

  • KinectAmbientActivityMonitor - Provides a general ambient activity value for a room.

  • KinectRoomScanDiff - Scans a room with the Kinect, then watches for depth differences from scan.

  • KinectDepthSilhouetteSmoothed - A hardware-accelerated smoothed silhouette image from raw depth data.

  • KinectRegionGrid - Breaks up kinect raw data into an x/z grid, with center-of-mass (joystick) and active readings for each quadrant.

  • MouseUtil - Automates, moves & clicks the system mouse with a Java Robot.

  • OscWrapper - Wraps up OSC i/o functionality.

  • PrintPageDirect - Print an image to a physical printer directly from Processing.

  • SerialDevice - Basic input/output wrapping for Arduino and similar USB serial devices.

  • WebCamWrapper - Init a webcam with AppSettings.WEBCAM_INDEX, and receive new frames by implementing IWebCamCallback

Math

  • BooleanSwitch - Lerps towards true or false over time. Switches when it reaches the end. Useful for dealing with noisy data.

  • DisplacementPoint - Elastic displacement from a static point, based on an influencing external point.

  • EasingFloat - Lerps towards a target. Includes optional frame delay and acceleration.

  • ElasticFloat - Lerps towards a target with Hooke's law springiness. Configurable friction and acceleration.

  • FloatBuffer - A FIFO buffer of incoming float values for smoothing purposes.

  • LinearFloat - Linearly lerps towards a target. Includes optional frame delay. Works great in tandem with Penner equations.

  • Penner - Robert Penner's easing equations.

  • MathUtil - Lots of useful math utility functions.

  • SphericalCoord - Spherical coordinate helper functions.

Net

Render

System

  • AppRestart - Kills & restarts the app!

  • AppUtil - Set app window properties and generate the script that was used to launch the app.

  • CrashMonitor - Launches a 2nd app window to monitor the first, in case of a crash.

  • JavaInfo - Tons of methods to print out Java & system properties.

  • SecondScreenViewer - Launches a 2nd, scaled-down window to monitor the main window from a 2nd monitor.

  • ScriptRunner - Cross-platform script runner - makes up for the difference between .cmd/bat and .sh scripts. Works with IScriptCallback delegate to callback when the script finishes.

  • SystemUtil - Get a timestamp, take a screenshot, copy text to clipboard, open a web browser, check/kill system processes, run a Timer.

Text

UI

  • UISlider - A text file-backed slider UI.

  • UIButton - A Button object with optional toggle mode.

  • UIControlPanel - A collection of IUIControl objects, auto-initialized with PAppletHax. Press \ to toggle paneL, and add new sliders/buttons by accessing p.ui.

Dependencies

Haxademic uses the following Java & Processing libraries, which I've included in this repository so you don't have to find them yourself (more on that below):

Installing / Compiling

  • If you're on OS X, it's helpful to see hidden files. Run this command in Terminal:
    • defaults write com.apple.finder AppleShowAllFiles YES
  • Download the standard Eclipse IDE for Java development, and the Java Development Kit itself:
    • Eclipse
    • Java 8 - After installing JDK 1.8, open Eclipse, go to Preferences then Java -> Installed JREs, and click Search... to have Eclipse find the newly-installed library.
  • Clone or download the haxademic project
  • Open Eclipse and: File -> Import -> General / Existing Projects into Workspace
    • Choose the haxademic directory that you cloned/downloaded, press Finish, and the project should be ready to use.
  • In the Package Explorer in Eclipse, right-click the lib directory and select Refresh. This will let Eclipse know that you've added the appropriate libraries on your file system.
  • Make sure you're compiling with Java 1.8:
    • Right-click the haxademic project in the Package Explorer or Navigator window and click Properties
    • Click the Java Compiler section and check the Enable project specific settings box on the right
    • Select 1.8 as your Compiler compliance level, if possible
    • If "Configure the Installed JREs" is shown at the bottom of this window, click that, make sure the 1.8 item is checked, then click OK.
  • Right-click on any of the demo apps within src/com/demo/ and choose Run As -> Java Application from the menu. This will create a run configuration for the app.
  • If it's necessary to add more RAM to the app, go to Run -> Run Configurations, select your app and add the following VM Arguments when running the Java Application to increase memory allocated to your app. This is a minimum of 1gb and a maximum of 4gb of RAM:
    • -Xms1G
    • -Xmx4G

Licensing

The Haxademic codebase and apps are MIT licensed, so do what you want with these files. Feel free to let me know that you're using it for something cool. I've added 3rd-party .jar files and compiled Java libraries that I'm probably not actually allowed to redistribute here, so if you're the owner of one of those libraries and would like the files removed, let me know. I've included them to aid those who would like a quick start and not have to search for the many dependencies of this project. Some of these libraries have disappeared from the web entirely, so searching for them may be futile anyway. I just want people to make cool things with this library, and hope you understand.

About

A personal toolkit for Java/Processing projects in Eclipse

http://haxademic.com/

License:MIT License


Languages

Language:Java 87.0%Language:GLSL 10.3%Language:JavaScript 0.7%Language:PHP 0.5%Language:HTML 0.5%Language:Batchfile 0.4%Language:Shell 0.3%Language:CSS 0.1%Language:SuperCollider 0.1%