lights() adds light to the opposite side expected on the tubes I create with shapes3D. The box and sphere have the expected light.
If I add scale(-1, 1, 1); to the tubes, the light appears correct except for the end caps (you must observe each end cap to see this).
Can someone please help with this? @quark
lagers.org.uk/s3d4p/index.html
// Requires the Shapes3D library.
import shapes3d.utils.*;
import shapes3d.animation.*;
import shapes3d.*;
Tube tube02;
Tube tube01;
float angleX, angleY, angleZ;
void setup()
{
size(1000, 1000, P3D);
tube01 = new Tube(this, 4, 50);
tube01.setSize(50, 50, 50, 50, 400);
tube01.fill(color(255, 255, 0));
// tube01.fill(#FFFF00, S3D.BOTH_CAP);
tube01.drawMode(S3D.SOLID);
tube01.visible(false, S3D.BOTH_CAP);
tube02 = new Tube(this, 4, 50);
tube02.setSize(50, 50, 50, 50, 400);
tube02.fill(color(255, 255, 0));
tube02.fill(#FFFF00, S3D.BOTH_CAP);
tube02.drawMode(S3D.SOLID);
tube02.visible(true, S3D.BOTH_CAP);
}
void draw()
{
background(0);
// scale(1, 1, 1);
translate(width/2, height/2);
// lights();
ambientLight(128, 128, 128); //default
// directionalLight(128, 128, 128, 0, 0, -1); //default
directionalLight(128, 128, 128, -1, 0, 0); //custom
lightFalloff(1, 0, 0); //default
lightSpecular(0, 0, 0); //default
// translate(width/2, height/2);
pushMatrix();
noStroke();
strokeWeight(0);
fill(color(255, 255, 0));
angleX += PI/1000;
angleY += PI/1000;
angleZ += PI/1000;
rotateX(angleX);
rotateY(angleY);
rotateZ(angleZ);
pushMatrix();
translate(-300,0, 0);
fill(255, 255, 0);
sphere(50);
popMatrix();
pushMatrix();
translate(300, 0, 0);
fill(255, 255, 0);
box(100, 400, 100);
popMatrix();
pushMatrix();
translate(100, 0, 0);
// scale(-1, 1, 1);
tube01.draw();
popMatrix();
pushMatrix();
translate(-100, 0, 0);
// scale(-1, 1, 1);
tube02.draw();
popMatrix();
popMatrix();
}