Created
August 26, 2023 10:56
-
-
Save ell-shad/d0ed8f8a2ba08da05e721d9a1b8d9243 to your computer and use it in GitHub Desktop.
3D Earth LIve Wallpaper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float angle = 0; | |
float sphereRadius = 350; | |
PVector lightDirection; | |
PImage earth; | |
PShape globe; | |
void setup() { | |
fullScreen(P3D); | |
noStroke(); | |
earth=loadImage("2k_earth_daymap.jpg"); | |
globe = createShape(SPHERE, sphereRadius); | |
globe.setTexture(earth); | |
lightDirection = new PVector(1, 0.5, 0); | |
lightDirection.normalize(); | |
lightFalloff(1.0, 0.0, 0.0); | |
} | |
void draw() { | |
background(0); | |
translate(width/2, height/2); | |
rotateY(radians(angle)); | |
lights(); | |
directionalLight(255, 255, 255, lightDirection.x, lightDirection.y, lightDirection.z); | |
shape(globe); | |
angle+=0.5; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment