Hi guys, well i´ve been using the Shapes3D library, y downloaded a sketch for a tunnel and used the examples from the library, this example had 2 java codes added, it showed me the tunnel full at the display but didn´t let me add images, use the displayWidth and displayHeight commands or use present ir at full screen, so i took out the java codes added, now it works perfectly, but doesn´t get the whole tunel just the center of it, like if the camera had smaller vision o was far from the composition. I´ve tried everything, closing up the camera, scaling, making bigger the tunnel, nothing works.
/* OpenProcessing Tweak of *@*http://www.openprocessing.org/sketch/25597*@* */
/* !do not delete the line above, required for linking your tweak if you upload again */
import shapes3d.utils.*;
import shapes3d.animation.*;
import shapes3d.*;
int enviar=0;
// Path dependent variables
I_PathGen[] path;
int nbrPaths = 1;
int currPath = 0;
float[] speedFactor;
// The tubes
PathTube atube, wtube;
int tubeType = 0;
int nbrTubeTypes = 2;
final int SLICES = 300, SEGMENTS = 8;
// The shuttle
//Toroid train;
Box[] bcar;
final int nbrBoxCars = 0;
// Used for train/car orientation to the tube
final PVector FORWARD_AXIS = new PVector(0, 1, 0);
final PVector LEFT_AXIS = new PVector(-1, 0, 0);
final PVector RIGHT_AXIS = new PVector(0, 0, -1);
PVector normal, tangent, position;
PVector camPos, camLookAt, camUp;
Rot rot;
float[] ang;
// SHUTTLE SPEED CONTROL VARIABLES
float speed = 0.06, pathFactor = 1, elapsed;
float paraT = 0.5; // starting position on curve
float camParaT;
long st, ct; // keep track of running time
void setup() {
size(1280, 690, P3D);
// Create the path generator
// path = new Tube (this,4,6);
path = new I_PathGen[nbrPaths];
// hacer una clase para definir el parámetro
path[0] = new Lissajous(1, 1, 1);
speedFactor = new float[nbrPaths];
// Create the tube
atube = new PathTube(this, path[currPath], 40, SLICES, 35, false);
atube.drawMode(Shape3D.SOLID);
atube.visible(false, Shape3D.BOTH_CAP);
// Create path cage
wtube = new PathTube(this, path[currPath], 38, (SLICES/2), 8, true);
wtube.stroke(color(120, 120, 255));
wtube.strokeWeight(1);
wtube.drawMode(Shape3D.WIRE); // estructura alámbrica
wtube.visible(false, Shape3D.BOTH_CAP);
// Initialise spacing and speed factors
float l = atube.length(400);
speedFactor[currPath] = 800 / l;
// Create the box cars
bcar = new Box[nbrBoxCars];
for (int i = 0; i < nbrBoxCars; i++) {
bcar[i] = new Box(this, 0);
}
// Initialise times
st = ct = millis();
}
void draw() {
// scale(10,10,10);
background(16);
lights();
// Used to get frame-rate independent speed
ct = millis();
//image(img, 0, 0);
elapsed = (ct - st)/1000.0;
st = ct;
paraT += elapsed * speed * speedFactor[currPath];
paraT = (paraT > 1) ? paraT-1 : paraT;
normal = atube.getNormal(paraT);
tangent = atube.getTangent(paraT);
position = atube.getPoint(paraT);
// Calculate camera position to move with the shuttle
normal.normalize();
camUp = PVector.mult(normal, -1);
println (camLookAt);
camParaT = paraT - 0.0;
camParaT = (camParaT > 1) ? camParaT: camParaT;
camPos = atube.getPoint(camParaT);
camPos.add(camUp);
camLookAt = PVector.mult(tangent, 90);
camLookAt.add(camPos);
camera(camPos.x, camPos.y, camPos.z,
camLookAt.x, camLookAt.y, camLookAt.z,
camUp.x, camUp.y, camUp.z);
float bparaT = paraT;
for (int i = 0; i < nbrBoxCars; i++) {
bparaT = (bparaT < 0) ? bparaT + 1 : bparaT;
normal = atube.getNormal(bparaT);
position = atube.getPoint(bparaT);
rot = new Rot(FORWARD_AXIS, RIGHT_AXIS, tangent, normal);
ang = rot.getAngles(RotOrder.XYZ);
bcar[i].moveTo(position);
bcar[i].rotateTo(ang);
bcar[i].draw();
}
wtube.draw();
atube.draw();
}
void keyReleased() {
// Adjust speed
if (key >= '0' && key <= '9') {
speed = (key - 48) / 50.0;
}
}