bąbelki w gure
This commit is contained in:
parent
956fec9a4f
commit
e618a37b96
@ -33,8 +33,11 @@ Core::RenderContext shipwreckContext;
|
||||
int firstFishPositions[15][3];
|
||||
int secondFishPositions[15][3];
|
||||
int thirdFishPositions[15][3];
|
||||
int bubblePosition[100][3];
|
||||
float firstFishSpreadFactor = 15.0;
|
||||
|
||||
|
||||
|
||||
int resolution[2] = { 600, 600 };
|
||||
glm::vec2 centerOfTheWindow = { resolution[0] / 2, resolution[1] / 2 };
|
||||
|
||||
@ -160,10 +163,16 @@ void drawObjectTexture(Core::RenderContext context, glm::mat4 modelMatrix, GLuin
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void drawTranslucentObjects() {
|
||||
void drawTranslucentObjects(int x, int y) {
|
||||
|
||||
float time = glutGet(GLUT_ELAPSED_TIME) / 1000.f;
|
||||
|
||||
glEnable(GL_BLEND); // enable blending
|
||||
|
||||
drawObjectTexture(sphereContext, glm::translate(glm::vec3(0, 5, 0)) * glm::scale(glm::vec3(5.0f, 5.0f, 5.0f)), bubbleTexture);
|
||||
for (int i = x; i < y; i++) drawObjectTexture(sphereContext, glm::translate(glm::vec3(bubblePosition[i][0], (bubblePosition[i][1] + (int(time * 1000)) % 10000) / 1000.0f, bubblePosition[i][2])) * glm::scale(glm::vec3(0.1f)), bubbleTexture);
|
||||
for (int i = x; i < y; i++) drawObjectTexture(sphereContext, glm::translate(glm::vec3(bubblePosition[i][0], (bubblePosition[i][1] + (int(time * 1000)) % 20000) / 1000.0f, bubblePosition[i][2])) * glm::scale(glm::vec3(0.1f)), bubbleTexture);
|
||||
for (int i = x; i < y; i++) drawObjectTexture(sphereContext, glm::translate(glm::vec3(bubblePosition[i][0], (bubblePosition[i][1] + (int(time * 1000)) % 30000) / 1000.0f, bubblePosition[i][2])) * glm::scale(glm::vec3(0.1f)), bubbleTexture);
|
||||
|
||||
|
||||
glDisable(GL_BLEND); // disable blending
|
||||
}
|
||||
@ -198,7 +207,9 @@ void renderScene()
|
||||
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));
|
||||
|
||||
drawTranslucentObjects();
|
||||
drawTranslucentObjects(0, 20);
|
||||
drawTranslucentObjects(20, 40);
|
||||
drawTranslucentObjects(40, 100);
|
||||
|
||||
drawObjectTexture(shipwreckContext, glm::translate(glm::vec3(20, -15, 0)) * glm::rotate(glm::radians(255.f), glm::vec3(1, 0, 0)) * glm::scale(glm::vec3(0.003f)), textureBoards);
|
||||
|
||||
@ -249,6 +260,12 @@ void init()
|
||||
textureCrab = Core::LoadTexture("textures/crab.png");
|
||||
textureSand = Core::LoadTexture("textures/sand.png");
|
||||
textureBoards = Core::LoadTexture("textures/boards.png");
|
||||
for (int i = 0; i < 100; i++) {
|
||||
bubblePosition[i][0] = rand() % 30 - 15;
|
||||
bubblePosition[i][1] = rand() % 50 - 50;
|
||||
bubblePosition[i][2] = rand() % 50 - 25;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 15; i++) {
|
||||
firstFishPositions[i][0] = rand() % 30 - 15;
|
||||
firstFishPositions[i][1] = rand() % 25 - 10;
|
||||
|
Loading…
Reference in New Issue
Block a user