Open Processing ( Java Library )

download Open Processing ( Java Library )

of 29

  • date post

    20-Jan-2017
  • Category

    Software

  • view

    108
  • download

    0

Embed Size (px)

Transcript of Open Processing ( Java Library )

  • Open Procecing

  • (:123903)

    (:123896)

    :

  • ; engine Processing

    2D

    3D

  • ...- To 2001 Casey Reas Benjamin Fry MIT

    - Java

    - , animation

    -

    -

    -

  • IDE

    .

    Exception

    . Java

    compile .

    .

    Project.

    IDE

    processing.

    .

    export . Java

    compile.

  • Rendering Engines

    2D ( )

    P2D ( )

    P3D ( )

    PDF ( pdf )

    OpenGL P2D P3D

  • pixel X-1 , Y-1

  • Engine

    setup

    draw

    size

    redraw

    loop

    noLoop

    frameRate

    exit

  • setup() main(String inputArray[]).

    , background

    , .

    size() setup()

    2D 3D

    () () Renderer ,

    compile

    .

    , createGraphics

  • draw() setup() .

    noLoop(),redraw(),loop()

    frameRate()

    redraw() flag draw

    animation

    loop() noLoop() animation

  • loop() draw()

    noLoop() draw()

    events

    redraw() loop()

  • frameRate()

    draw()

    60frames/s

    frameCount

    exit()

    draw()

  • Events Methods

    - :

    - void key()

    - void keyCode()

    - void keyPressed()

    - void keyReleased()

    - void keyTyped()

    - :

    - void mouseButton()

    - void mouseClicked()

    - void mouseDragged()

    - void mouseMoved()

    - void mousePressed()

    - void mouseReleased()

    - void mouseWheel()

  • - translate (x, y, z) :

    x y

    . z

    .

    - rotate (value) :

    value

    . ( 0

    TWO_PI), .

    &

  • - -

    - beginCamera() - endCamera()

    - &

    - camera(eyeX, eyeY, eyeZ, centerX, centerY, centerZ,

    upX, upY, upZ)

    - frustum()

    - ortho()

    - perspective()

    -

    - printCamera()

    - printProjecion()

  • 2 ( 2D ) - 1

    - T -

    - -

  • 2 ( 2D ) - 2

    -

  • 2D

    -

    .

  • 2D

    -

  • 3 ( 3D )

    -

    - box(value) :

    -

    - sphere(radius)

    - sphereDetail(ures, vres)

  • 3D

    , , .

  • 3D

    setup(),draw(),cameraUpdate() locationUpdate().

    setup()

    setup() size()

    .

    .

  • 3D

    draw()

    draw , .

    lights();

    boxSize+=increaseValue;

    box(boxSize);

    draw() cameraUpdate()

    locationUpdate() .

    cameraUpdate();

    locationUpdate();

    camera(x,y,z,tx,ty,tz,0,1,0);

  • 3D

    cameraUpdate()1/3

    public void cameraUpdate(){

    int diffX = mouseX - width/2;

    // /2

    int diffY = mouseY - width/2;

    // /2

    //

    if(abs(diffX) > stillBox){

    angle+= diffX/(sensitivity*10);//

    if(angle < 0)

    // 360

    360

    angle += 360;

    else if (angle >= 360)

    angle -= 360;

  • 3D

    cameraUpdate()2/3

    float newXComp = cameraDistance * sin(radians(angle));

    float newZComp = cameraDistance * cos(radians(angle));

    //

    tx tz

    .

    tx = newXComp + x;

    tz = -newZComp + z;

    }

    if (abs(diffY) > stillBox)// ty

    mouse - width/2

    ty += diffY/(sensitivity/1.5);

    }

  • 3D

    cameraUpdate()3/3

  • 3D

    locationUpdate()

    public void locationUpdate(){

    //

    z += moveZ;

    tz += moveZ;

    x += moveX;

    tx += moveX;

    }

  • 3D

    keyPressed()

    public void keyPressed(){

    if (keyCode=='=')// increaseValue

    draw boxSize.

    increaseValue = 10;

    if (keyCode=='-')

    increaseValue = -10;

    if(keyCode == UP || key == 'w'){

    moveZ = -10;}

    else if(keyCode == DOWN || key == 's'){

    moveZ = 10;}

    else if(keyCode == LEFT || key == 'a'){

    moveX = -10;

    }

    else if(keyCode == RIGHT || key == 'd'){

    moveX = 10;

    }

    // moveZ moveX

    locationUpdate()

    }

  • !

    ; online github: https://github.com/gbourant https://github.com/gtzinos/Open-Processing-Projects