Coder Social home page Coder Social logo

kcbf / processing-to-unity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lucascassiano/processing-to-unity

0.0 0.0 0.0 21.9 MB

Send the Processing screen buffer to other softwares (Currently support only to Unity3D 5+)

Processing 19.62% C# 5.31% ASP 75.06%

processing-to-unity's Introduction

Processing to Unity

Render Processing Sketches Screens as an Unity Texture2D (compatible with Windows, OSX and Linux) Preview

Get Started

Download the files from the github repository:

Processing

  • Add the file ScreenBroadcast.pde to your sketch folder
  • Add the methods as showed on the example

Unity

  • Add the file ProcessingToTexture.cs to your Assets folder.
  • Create (or import) any 3D object, for example, a quad (GameObject > 3D Object > Quad)
  • Drag and drop the ProcessingToTexture.cs to the gameObject
  • Set the width and height based on the width and height from processing skecth
  • If you want run interactions on the processing sketchs, enable Unity to run on background (File > Build Settings > Player Settings... > check Run On Bakground)

Basic Example (Processing)

ScreenBroadcast sb;

void setup() {
  sb = new ScreenBroadcast();
  size(800, 800);
}

void draw() {
  //Draw things here!

  sb.BroadcastSplit(get());
  //Add some delay, change to higher values to have higher
  delay(20);
  //Anything bellow this line will be not send to Unity
}

Basic Example (Unity)

Unity example

Data Transference

This simple system sends multiple chunks of byte arrays from processing to Unity, using by default the localhost ip "127.0.0.1" at port "8051".

ScreenBroadcast Methods

Method return Parameters Role
BroadcastSplit void PImage Broadcast Splitted data (split by 4)
Broadcast void PImage Broadcast one package per time (deprecated)
getImageBytes byte[] Pimage Return the bytes from the image encoded as JPG

Example

IMAGE ALT TEXT HERE

processing-to-unity's People

Contributors

lucascassiano avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.