Add three plants.

This commit is contained in:
Michal Zaporski 2022-01-23 15:33:38 +01:00
parent bfa4483f76
commit 770cdb4b47
4 changed files with 529649 additions and 1 deletions

180992
cw 6/models/coral.obj Normal file

File diff suppressed because it is too large Load Diff

210286
cw 6/models/coral_tree.obj Normal file

File diff suppressed because it is too large Load Diff

138359
cw 6/models/gorgonian_coral.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,9 @@ Core::RenderContext secondFishContext;
Core::RenderContext thirdFishContext;
Core::RenderContext seaTurtleContext;
Core::RenderContext crabContext;
Core::RenderContext coralTreeContext;
Core::RenderContext coralContext;
Core::RenderContext gorgonianCoralContext;
int firstFishPositions[15][3];
int secondFishPositions[15][3];
@ -159,13 +162,18 @@ void renderScene()
drawObjectTexture(skyboxContext, glm::translate(glm::vec3(0, -15, 0)) * glm::scale(glm::vec3(1.0f, 1.0f, 1.0f)), textureSkybox);
// Animals
drawObjectTexture(seaTurtleContext, glm::translate(glm::vec3(0, cos(time) - 3, 0)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.015f)), textureSeaTurtle);
drawObjectTexture(crabContext, glm::translate(glm::vec3(cos(time / 7) * 10, -13, 0)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.2f)), textureCrab);
for (int i = 0; i < 15; i++) drawObjectTexture(firstFishContext, glm::translate(glm::vec3(firstFishPositions[i][0], firstFishPositions[i][1], firstFishPositions[i][2])) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(-20, 0, 0)) * glm::rotate(glm::radians(cos(8 * time) * 8), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.6f)), textureFirstFish);
for (int i = 0; i < 15; i++) drawObjectTexture(secondFishContext, glm::translate(glm::vec3(secondFishPositions[i][0], secondFishPositions[i][1], secondFishPositions[i][2])) * glm::eulerAngleY(float(-time / 1.75)) * glm::translate(glm::vec3(20, 0, 0)) * glm::rotate(glm::radians(cos(10 * time) * 12), glm::vec3(0, 1, 0)) * glm::rotate(glm::radians(90.f), glm::vec3(0, 1, 0)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.1f)), textureSecondFish);
for (int i = 0; i < 15; i++) drawObjectTexture(thirdFishContext, glm::translate(glm::vec3(thirdFishPositions[i][0], thirdFishPositions[i][1], thirdFishPositions[i][2])) * glm::eulerAngleY(float(time / 2.5)) * glm::translate(glm::vec3(-20, 0, 0)) * glm::rotate(glm::radians(cos(8 * time) * 8), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.5f)), textureThirdFish);
// Plants
drawObjectColor(coralTreeContext, glm::translate(glm::vec3(0, -14, 2)) * glm::scale(glm::vec3(0.5f)), glm::vec3(0.5802f, 0.1406f, 0.74f));
drawObjectColor(coralContext, glm::translate(glm::vec3(0, -14, 8)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.1f)), glm::vec3(0.85f, 0.0255f, 0.6027f));
drawObjectColor(gorgonianCoralContext, glm::translate(glm::vec3(0, -14, 16)) * glm::rotate(glm::radians(270.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.07f)), glm::vec3(0.f, 1.f, 0.f));
glutSwapBuffers();
}
@ -196,6 +204,9 @@ void init()
loadModelToContext("models/third_fish.obj", thirdFishContext);
loadModelToContext("models/sea_turtle.obj", seaTurtleContext);
loadModelToContext("models/crab.obj", crabContext);
loadModelToContext("models/coral_tree.obj", coralTreeContext);
loadModelToContext("models/coral.obj", coralContext);
loadModelToContext("models/gorgonian_coral.obj", gorgonianCoralContext);
textureSkybox = Core::LoadTexture("textures/skybox.png");
textureFirstFish = Core::LoadTexture("textures/first_fish.png");
textureSecondFish = Core::LoadTexture("textures/second_fish.png");