api:documentation:grafik3d:licht:start
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende Überarbeitung | |||
api:documentation:grafik3d:licht:start [2025/01/18 10:42] – [AmbientLight3d] martin | api:documentation:grafik3d:licht:start [2025/01/18 11:22] (aktuell) – [AmbientLight3d] martin | ||
---|---|---|---|
Zeile 103: | Zeile 103: | ||
int color = 0x10000 * red + 0x100 * green + blue; | int color = 0x10000 * red + 0x100 * green + blue; | ||
ambientLight.setColor(color); | ambientLight.setColor(color); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===== DirectionalLight3d ===== | ||
+ | |||
+ | < | ||
+ | <div class=" | ||
+ | |||
+ | <script type=" | ||
+ | new MyActor(); | ||
+ | |||
+ | class MyActor extends Actor { | ||
+ | | ||
+ | | ||
+ | | ||
+ | Box3d box = new Box3d(); | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | t = new Torus3d(); | ||
+ | t.scale(0.5); | ||
+ | t.rotateX(45); | ||
+ | box.scale(0.2); | ||
+ | PhongMaterial3d pm = new PhongMaterial3d(0xffffff, | ||
+ | t.setMaterial(pm); | ||
+ | world = World3d.getWorld3d(); | ||
+ | directionalLight = new DirectionalLight3d(); | ||
+ | directionalLight.moveTo(0, | ||
+ | directionalLight.setTarget(box); | ||
+ | world.removeAllLights(); | ||
+ | world.addLight(directionalLight); | ||
+ | | ||
+ | |||
+ | | ||
+ | angle += 0.5; | ||
+ | double angleRad = Math.toRadians(angle); | ||
+ | |||
+ | box.moveTo(2 * Math.cos(angleRad), | ||
+ | |||
} | } | ||
api/documentation/grafik3d/licht/start.1737196977.txt.gz · Zuletzt geändert: 2025/01/18 10:42 von martin