Processing=104=terrence

Page 1

A104

TERRAIN


Set up A Basic Terrain


import processing.opengl.*; import plethora.core.*; import toxi.geom.*; import peasy.*;

void draw() { background(235);

//using peasycam PeasyCam cam;

//declare plethora Terrain Ple_Terrain pTer; Declare

stroke(0,90); strokeWeight(1); noFill(); rect(-DIMX/2,-DIMY/2,

the terrain

//call some of the functions of the terrain stroke(0,90); strokeWeight(2); pTer.display();

int DIMX = 1000; int DIMY = 1000;

void setup() { size(1200, 600, OPENGL); smooth(); cam = new PeasyCam(this, 600);

Set up the terrain

//declare a vector as the location Vec3D location = new Vec3D(-DIMX/2,-DIMY/2,0); //initialize the terrain, specifying columns and rows and cell Size

pTer = new Ple_Terrain(this, location, 200,200, 5, 5); //call some of the functions pTer.noiseHeight(0,30); }

Set up the Height

DIMX,DIMY);

//draw lines (horizontal, vertical or diagonal... or all of them!)

stroke(0,90); strokeWeight(1); pTer.drawLines(true,false,false); }


A PLAN A SWARM A LINE


A PLAN A SWARM A LINE


Set up Terrain With DataMap


void draw() { background(235); import processing.opengl.*; import plethora.core.*; import toxi.geom.*; import peasy.*;

stroke(0,90); strokeWeight(1); noFill(); rect(-DIMX/2,-DIMY/2,

//using peasycam PeasyCam cam;

//call some of the functions of the terrain stroke(0,90); strokeWeight(2); pTer.display();

//declare plethora Terrain Ple_Terrain pTer;

float [][] heights;

DIMX,DIMY);

Declare the Height

//draw lines (horizontal, vertical or diagonal... or all of them!)

stroke(0,90); strokeWeight(1); pTer.drawLines(true,false,false);

int DIMX = 1000; int DIMY = 1000;

void setup() { size(1200, 600, OPENGL); smooth(); cam = new PeasyCam(this, 600);

pTer.drawDataMap(heights, 0,255, 150,255); }

//declare a vector as the location

Set up the color

Vec3D location = new Vec3D(-DIMX/2,-DIMY/2,0); //initialize the terrain, specifying columns and rows and cell Size

pTer = new Ple_Terrain(this, location, 150,150, 7.5, 7.5);

heights = pTer.loadImageToBuffer(“dataMap.jpg"); //load that info into the height of the terrain pTer.loadBufferasHeight(heights, 0 , 100); }

Set up the Min-Max Height

Put your file name here. (Remember to save the map in to your sketch with “Data” folder)




Set up Terrain With 2 DataMap



Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.