Skip to content

Commit f92885c

Browse files
committed
Works again. Bugs:
- Spheres plates - Sol ligné
1 parent 421e6a5 commit f92885c

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/main/java/one/empty3/apps/opad/JoglDrawer.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,23 @@ public void display(GLAutoDrawable gLDrawable) {
197197

198198
//Point3D normale = /*dir.prodVect(pos);*/getTerrain()
199199
// .calcNormale(pos.getX(), pos.getY()).norme1();
200-
Point3D posCam = pos.moins(dir.norme1());
200+
Point3D posCam = pos;//.moins(dir.norme1());
201201
Point3D vertical = camera.getVerticale().getElem().norme1();
202202
Point3D vert2 = vertical.prodVect(dir).mult(-1);
203-
glu.gluLookAt(pos.get(0), pos.get(1), pos.get(2),
203+
Point3D positionCamRear = posCam
204+
.plus(camera.getLookat().moins(posCam).mult(-0.05));
205+
206+
posCam = positionCamRear;
207+
208+
glu.gluLookAt(posCam.get(0), posCam.get(1), posCam.get(2),
204209
dir.get(0), dir.get(1), dir.get(2),
205210
up.get(0), up.get(1), up.get(2));
206211
/*if(circuit==null)
207212
circuit = mover.getCircuit();
208213
if(circuit!=null)
209214
draw((TRIConteneur)circuit, glu, gl);
210215
*/
216+
211217
if (toggleMenu == null)
212218
return;
213219
if (toggleMenu.isDisplayBonus()) {
@@ -244,6 +250,9 @@ public void display(GLAutoDrawable gLDrawable) {
244250
displayArcs(glu, gl);
245251
}
246252
if (toggleMenu.isDisplayCharacter()) {
253+
Cube object = vaisseau.getObject();
254+
object.setPosition(mover.calcCposition());
255+
draw(object, glu, gl);
247256
if (getPlotter3D()!=null&&getPlotter3D().isActive()) {
248257
CourbeParametriquePolynomiale courbeParametriquePolynomiale = null;
249258
// TubulaireN2<CourbeParametriquePolynomiale> segmentDroiteTubulaireN2 = new TubulaireN2<>();
@@ -253,9 +262,6 @@ public void display(GLAutoDrawable gLDrawable) {
253262
// segmentDroiteTubulaireN2.generate();
254263
// draw(courbeParametriquePolynomiale, glu, gl);
255264
} else {
256-
Cube object = vaisseau.getObject();
257-
object.setPosition(mover.calcCposition());
258-
draw(object, glu, gl);
259265
}
260266
}
261267

src/main/java/one/empty3/apps/opad/Lines.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,15 @@ public Lines(Path path) {
4343
this.path = path;
4444
}
4545

46-
remainder(double t, double n) {
47-
double sign = Math.sign(t*n);
48-
if(sign! =0) {
46+
public double remainder(double t, double n) {
47+
double sign = Math.signum(t*n);
48+
if(sign!=0) {
4949
double N = Math. abs(n) ;
5050
double T = Math. abs(t);
51-
double r =T/N-((int)) T*N) /((int) N) ;
52-
53-
51+
double r = (T/N-(int)( T*N)) /((int) N) ;
5452
return r;
5553
}
56-
return n==0?Double.Nan:0;
54+
return n==0?Double.NaN:0;
5755
}
5856
@Override
5957
public Point3D calculerPoint3D(double t) {

0 commit comments

Comments
 (0)