one.empty3.testscopy.tests.tests2.anneaux.TestAnneau Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of empty3-library-3d Show documentation
Show all versions of empty3-library-3d Show documentation
3D rendering engine. Plus modeling. Expected glsl textures 3d and 2d rendering
/*
* Copyright (c) 2022-2023. Manuel Daniel Dahmen
*
*
* Copyright 2012-2023 Manuel Daniel Dahmen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package one.empty3.testscopy.tests.tests2.anneaux;
import one.empty3.library.Camera;
import one.empty3.library.Point3D;
import one.empty3.library.TextureCol;
import one.empty3.library.core.move.Trajectoires;
import one.empty3.library.core.nurbs.CourbeParametriquePolynomialeBezier;
import one.empty3.library.core.testing.TestObjet;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class TestAnneau extends TestObjet {
private int N = 20;
List point3D = new ArrayList<>();
private double latLat = 0.3;
private CourbeParametriquePolynomialeBezier courbeParametriquePolynomialeBezier;
@Override
public void afterRenderFrame() {
}
@Override
public void finit() {
}
@Override
public void ginit() {
}
@Override
public void afterRender() {
}
@Override
public void testScene() throws Exception {
double lgt = 0;
for (int i = 0; ; i++) {
Point3D sphere = Trajectoires.sphere(lgt, Math.random() / latLat, 1);
point3D.add(sphere);
lgt += Math.random() / N;
if (lgt > 1) {
lgt = 1;
break;
}
}
Point3D[] ds = new Point3D[this.point3D.size()];
courbeParametriquePolynomialeBezier = new CourbeParametriquePolynomialeBezier(this.point3D.toArray(ds));
scene().add(courbeParametriquePolynomialeBezier);
courbeParametriquePolynomialeBezier.texture(new TextureCol(Color.BLUE));
courbeParametriquePolynomialeBezier.getParameters().setIncrU(0.0001);
Camera camera = new Camera(Point3D.O0, Point3D.Z.mult(2d));
camera.calculerMatrice(Point3D.Y);
scene().cameraActive(camera);
}
public static void main(String... args) {
TestAnneau testAnneau = new TestAnneau();
Thread thread = new Thread(testAnneau);
testAnneau.setMaxFrames(25 * 60 * 5);
thread.start();
}
}