dodanie obrotu planet wokół własnej osi, uporządkowanie kodu
This commit is contained in:
parent
da2cd749bc
commit
75a5e451e1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,9 +3,8 @@
|
||||
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra
|
||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): message : zobacz poprzednią definicję „APIENTRY”
|
||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(91,10): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(166,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(184,29): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(187,29): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(174,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
||||
D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\projekt_grk\src\ex_7_1.hpp(192,29): warning C4305: "inicjowanie": obcięcie z "double" do "float"
|
||||
Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
|
||||
LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka
|
||||
grk-cw7.vcxproj -> D:\STUDIA_sem5\GRAFIKA-PROJEKT\grk\Debug\projekt_grk.exe
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -161,11 +161,19 @@ void drawObjectSkyBox(Core::RenderContext& context, glm::mat4 modelMatrix) {
|
||||
}
|
||||
|
||||
|
||||
void renderPlanet(float time, float orbitRadius, float orbitRotationSpeed, float selfRotationSpeed, float scale, GLuint planetTexture, GLuint normalTexture) {
|
||||
glm::mat4 planetTransform = glm::rotate(glm::mat4(1.0f), time * orbitRotationSpeed, glm::vec3(0, 1, 0)) // orbitowanie dooko³a s³oñca
|
||||
* glm::translate(glm::vec3(orbitRadius, 0, 0)) // translacja na odp. odleg³oœæ
|
||||
* glm::rotate(glm::mat4(1.0f), time * selfRotationSpeed, glm::vec3(0, 1, 0)) //obrót planety wokó³ w³asnej osi
|
||||
* glm::scale(glm::vec3(scale)); //skalowanie planety
|
||||
|
||||
drawObjectTexture(sphereContext, planetTransform, planetTexture, normalTexture);
|
||||
}
|
||||
|
||||
void renderPlanets() {
|
||||
float time = glfwGetTime();
|
||||
|
||||
float mercuryOrbitRadius = 1.0f;
|
||||
float mercuryOrbitRadius = 1.3f;
|
||||
float venusOrbitRadius = 2.0f;
|
||||
float earthOrbitRadius = 5.0f;
|
||||
float moonOrbitRadius = 0.8f;
|
||||
@ -178,79 +186,49 @@ void renderPlanets() {
|
||||
// im mniejsze tym szybciej
|
||||
float mercuryRotationSpeed = 1.0f / 10;
|
||||
float venusRotationSpeed = 1.0f / 7;
|
||||
float earthRotationSpeed = 1.0f / 5;
|
||||
float moonRotationSpeed = 1.0f / 0.5;
|
||||
float marsRotationSpeed = 1.0f / 4;
|
||||
float jupiterRotationSpeed = 1.0f / 6.5;
|
||||
float saturnRotationSpeed = 1.0f / 4;
|
||||
float uranusRotationSpeed = 1.0f / 8;
|
||||
float neptuneRotationSpeed = 1.0f / 8.5;
|
||||
float earthRotationSpeed = 1.0f / 6;
|
||||
float moonRotationSpeed = 1.0f / 2;
|
||||
float marsRotationSpeed = 1.0f / 5;
|
||||
float jupiterRotationSpeed = 1.0f / 8.5;
|
||||
float saturnRotationSpeed = 1.0f / 5;
|
||||
float uranusRotationSpeed = 1.0f / 9;
|
||||
float neptuneRotationSpeed = 1.0f / 10;
|
||||
|
||||
float mercurySelfRotationSpeed = 1.0f;
|
||||
float venusSelfRotationSpeed = 1.0f;
|
||||
float earthSelfRotationSpeed = 1.0f;
|
||||
float moonSelfRotationSpeed = 1.0f / 2;
|
||||
float marsSelfRotationSpeed = 1.0f;
|
||||
float jupiterSelfRotationSpeed = 1.0f;
|
||||
float saturnSelfRotationSpeed = 1.0f;
|
||||
float uranusSelfRotationSpeed = 1.0f / 2;
|
||||
float neptuneSelfRotationSpeed = 1.0f;
|
||||
|
||||
float mercuryScale = 0.11f;
|
||||
float venusScale = 0.14f;
|
||||
float earthScale = 0.3f;
|
||||
float moonScale = 0.09f;
|
||||
float moonScale = 0.055f;
|
||||
float marsScale = 0.2f;
|
||||
float jupiterScale = 0.7f;
|
||||
float saturnScale = 0.5f;
|
||||
float uranusScale = 0.3f;
|
||||
float neptuneScale = 0.32f;
|
||||
|
||||
renderPlanet(time, mercuryOrbitRadius, mercuryRotationSpeed, mercurySelfRotationSpeed, mercuryScale, texture::mercury, texture::mercuryNormal);
|
||||
renderPlanet(time, venusOrbitRadius, venusRotationSpeed, venusSelfRotationSpeed, venusScale, texture::venus, texture::venusNormal);
|
||||
renderPlanet(time, earthOrbitRadius, earthRotationSpeed, earthSelfRotationSpeed, earthScale, texture::earth, texture::earthNormal);
|
||||
|
||||
//mercury
|
||||
drawObjectTexture(sphereContext,
|
||||
glm::eulerAngleY(time * mercuryRotationSpeed) * glm::translate(glm::vec3(mercuryOrbitRadius, 0, 0)) * glm::scale(glm::vec3(mercuryScale)),
|
||||
texture::mercury,
|
||||
texture::mercuryNormal);
|
||||
|
||||
//venus
|
||||
drawObjectTexture(sphereContext,
|
||||
glm::eulerAngleY(time * venusRotationSpeed) * glm::translate(glm::vec3(venusOrbitRadius, 0, 0)) * glm::scale(glm::vec3(venusScale)),
|
||||
texture::venus,
|
||||
texture::venusNormal);
|
||||
|
||||
//earth
|
||||
//earths moon, musi byæ inaczej renderowany bo on nie orbituje wokó³ s³oñca tylko ziemi. PóŸniej to mo¿na jakoœ lepiej rozwi¹zaæ.
|
||||
drawObjectTexture(sphereContext,
|
||||
glm::eulerAngleY(time * earthRotationSpeed) * glm::translate(glm::vec3(earthOrbitRadius, 0, 0)) * glm::scale(glm::vec3(earthScale)),
|
||||
texture::earth,
|
||||
texture::earthNormal);
|
||||
|
||||
//earths moon
|
||||
drawObjectTexture(sphereContext,
|
||||
glm::eulerAngleY(time * earthRotationSpeed) * glm::translate(glm::vec3(earthOrbitRadius, 0, 0)) * glm::eulerAngleY(time * moonRotationSpeed) * glm::translate(glm::vec3(moonOrbitRadius, 0, 0)) * glm::scale(glm::vec3(moonScale)),
|
||||
texture::moon,
|
||||
texture::asteroidNormal);
|
||||
|
||||
//mars
|
||||
drawObjectTexture(sphereContext,
|
||||
glm::eulerAngleY(time * marsRotationSpeed) * glm::translate(glm::vec3(marsOrbitRadius, 0, 0)) * glm::scale(glm::vec3(marsScale)),
|
||||
texture::mars,
|
||||
texture::marsNormal);
|
||||
|
||||
//jupiter
|
||||
drawObjectTexture(sphereContext,
|
||||
glm::eulerAngleY(time * jupiterRotationSpeed) * glm::translate(glm::vec3(jupiterOrbitRadius, 0, 0)) * glm::scale(glm::vec3(jupiterScale)),
|
||||
texture::jupiter,
|
||||
texture::jupiterNormal);
|
||||
|
||||
//saturn
|
||||
drawObjectTexture(sphereContext,
|
||||
glm::eulerAngleY(time * saturnRotationSpeed) * glm::translate(glm::vec3(saturnOrbitRadius, 0, 0)) * glm::scale(glm::vec3(saturnScale)),
|
||||
texture::saturn,
|
||||
texture::saturnNormal);
|
||||
|
||||
//uranus
|
||||
drawObjectTexture(sphereContext,
|
||||
glm::eulerAngleY(time * uranusRotationSpeed) * glm::translate(glm::vec3(uranusOrbitRadius, 0, 0)) * glm::scale(glm::vec3(uranusScale)),
|
||||
texture::uranus,
|
||||
texture::uranusNormal);
|
||||
|
||||
//neptune
|
||||
drawObjectTexture(sphereContext,
|
||||
glm::eulerAngleY(time * neptuneRotationSpeed) * glm::translate(glm::vec3(neptuneOrbitRadius, 0, 0)) * glm::scale(glm::vec3(neptuneScale)),
|
||||
texture::neptune,
|
||||
texture::neptuneNormal);
|
||||
glm::eulerAngleY(time * earthRotationSpeed) * glm::translate(glm::vec3(earthOrbitRadius, 0, 0)) * glm::eulerAngleY(time * moonRotationSpeed) * glm::translate(glm::vec3(moonOrbitRadius, 0, 0)) * glm::scale(glm::vec3(moonScale)),
|
||||
texture::moon,
|
||||
texture::asteroidNormal);
|
||||
|
||||
renderPlanet(time, marsOrbitRadius, marsRotationSpeed, marsSelfRotationSpeed, marsScale, texture::mars, texture::marsNormal);
|
||||
renderPlanet(time, jupiterOrbitRadius, jupiterRotationSpeed, jupiterSelfRotationSpeed, jupiterScale, texture::jupiter, texture::jupiterNormal);
|
||||
renderPlanet(time, saturnOrbitRadius, saturnRotationSpeed, saturnSelfRotationSpeed, saturnScale, texture::saturn, texture::saturnNormal);
|
||||
renderPlanet(time, uranusOrbitRadius, uranusRotationSpeed, uranusSelfRotationSpeed, uranusScale, texture::uranus, texture::uranusNormal);
|
||||
renderPlanet(time, neptuneOrbitRadius, neptuneRotationSpeed, neptuneSelfRotationSpeed, neptuneScale, texture::neptune, texture::neptuneNormal);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user