add textures and programs for plants
This commit is contained in:
parent
1ecf2d309f
commit
c99d7d76db
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
<ShowAllFiles>false</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
11202
grafika_projekt/models/arch.obj
Normal file
11202
grafika_projekt/models/arch.obj
Normal file
File diff suppressed because it is too large
Load Diff
2183
grafika_projekt/models/coral01.obj
Normal file
2183
grafika_projekt/models/coral01.obj
Normal file
File diff suppressed because it is too large
Load Diff
1191
grafika_projekt/models/plant1.obj
Normal file
1191
grafika_projekt/models/plant1.obj
Normal file
File diff suppressed because it is too large
Load Diff
2520
grafika_projekt/models/plant2.obj
Normal file
2520
grafika_projekt/models/plant2.obj
Normal file
File diff suppressed because it is too large
Load Diff
12299
grafika_projekt/models/plant3.obj
Normal file
12299
grafika_projekt/models/plant3.obj
Normal file
File diff suppressed because it is too large
Load Diff
10003
grafika_projekt/models/rocktower1.obj
Normal file
10003
grafika_projekt/models/rocktower1.obj
Normal file
File diff suppressed because it is too large
Load Diff
@ -35,6 +35,8 @@ void main()
|
||||
vec3 R = reflect(-normalize(lightDir),normal);
|
||||
float ambient = 0.2;
|
||||
float specular = pow(max(0,dot(R,V)),1000);
|
||||
gl_FragColor = vec4(color*(ambient + (1-ambient)*diffuse)+vec3(1)*specular*0.2, 1.0) * (1.0f - depth) + vec4(depth * vec3(0.0f, 0.109f, 0.447f), 1.0f);;
|
||||
gl_FragColor = vec4(color*(ambient + (1-ambient)*diffuse)+vec3(1)*specular*0.2, 1.0);
|
||||
|
||||
//gl_FragColor = vec4(color*(ambient + (1-ambient)*diffuse)+vec3(1)*specular*0.2, 1.0) * (1.0f - depth) + vec4(depth * vec3(0.0f, 0.109f, 0.447f), 1.0f);;
|
||||
|
||||
}
|
||||
|
@ -17,6 +17,13 @@ void Core::Engine::initRenderContexts() {
|
||||
loadModelToContext("models/fish.obj", this->fishContext);
|
||||
loadModelToContext("models/submarine.obj", this->submarineContext);
|
||||
loadModelToContext("models/sphere.obj", this->bubbleContext);
|
||||
loadModelToContext("models/arch.obj", this->archContext);
|
||||
loadModelToContext("models/coral01.obj", this->coral1Context);
|
||||
loadModelToContext("models/plant1.obj", this->plant1Context);
|
||||
loadModelToContext("models/plant2.obj", this->plant2Context);
|
||||
loadModelToContext("models/plant3.obj", this->plant3Context);
|
||||
loadModelToContext("models/rocktower1.obj", this->rocktower1Context);
|
||||
|
||||
|
||||
this->terrain = Terrain(this->heightGenerator);
|
||||
obj::Model model = this->terrain.generateTerrain();
|
||||
@ -28,6 +35,12 @@ void Core::Engine::loadTextures() {
|
||||
this->submarineTexture = LoadTexture("textures/submarine.png");
|
||||
this->bubbleTexture = LoadTexture("textures/bubble.png");
|
||||
this->terrainTexture = LoadTexture("textures/sand2.jpg");
|
||||
this->archTexture = LoadTexture("textures/arch.png");
|
||||
this->coral1Texture = LoadTexture("textures/coral01.png");
|
||||
this->plant1Texture = LoadTexture("textures/plant1.png");
|
||||
this->plant2Texture = LoadTexture("textures/plant2.png");
|
||||
this->plant3Texture = LoadTexture("textures/plant3.png");
|
||||
this->rocktowerTexture = LoadTexture("textures/rocktower1.png");
|
||||
this->skyboxTexture = loadCubemap();
|
||||
}
|
||||
|
||||
@ -84,6 +97,14 @@ void Core::Engine::generateBubbleArray() {
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Engine::generateGrassArray() {
|
||||
for (int i = 0; i < 200; i++) {
|
||||
float random1 = this->distr(this->gen);
|
||||
float random2 = this->distr(this->gen);
|
||||
grassArray[i] = glm::vec3(random1, -skyboxVerticeParameter + 10, random2);
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Engine::initBubbles() {
|
||||
this->generateBubbleArray();
|
||||
}
|
||||
|
@ -15,10 +15,11 @@ namespace Core {
|
||||
class Engine {
|
||||
public:
|
||||
GLuint textureShader, skyboxShader, bubbleShader;
|
||||
GLuint submarineTexture, bubbleTexture, fishTexture, terrainTexture, skyboxTexture;
|
||||
GLuint submarineTexture, bubbleTexture, fishTexture, terrainTexture, skyboxTexture, plant1Texture, plant2Texture, plant3Texture, coral1Texture, rocktowerTexture, archTexture ;
|
||||
GLuint skyboxVAO;
|
||||
Core::RenderContext submarineContext, fishContext, bubbleContext, terrainContext;
|
||||
Core::RenderContext submarineContext, fishContext, bubbleContext, terrainContext, plant1Context, plant2Context, plant3Context, coral1Context, rocktower1Context, archContext;
|
||||
std::vector<glm::vec3> bubbleArray[300];
|
||||
glm::vec3 grassArray[200];
|
||||
void initShaderPrograms();
|
||||
void shutdownShaderPrograms();
|
||||
void initRenderContexts();
|
||||
@ -37,6 +38,7 @@ namespace Core {
|
||||
std::default_random_engine gen;
|
||||
void initCube();
|
||||
void generateBubbleArray();
|
||||
void generateGrassArray();
|
||||
std::vector<glm::vec3> genBubbleKeyPoints();
|
||||
};
|
||||
|
||||
|
@ -232,7 +232,6 @@ void renderScene()
|
||||
Core::drawObjectTexture(engine.fishContext, animationMatrix(time + 15, change2, fishKeyPoints, glm::vec3(0.25f), 1.f), engine.fishTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
|
||||
Core::drawObjectTexture(engine.fishContext, animationMatrix(time + 15, change3, fishKeyPoints, glm::vec3(0.25f), 1.f), engine.fishTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
|
||||
Core::drawObjectTexture(engine.fishContext, animationMatrix(time + 15, change4, fishKeyPoints, glm::vec3(0.25f), 1.f), engine.fishTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
|
||||
|
||||
time -= 6;
|
||||
}
|
||||
}
|
||||
@ -242,7 +241,6 @@ void renderScene()
|
||||
glm::mat4 terrainTransformation = glm::translate(glm::vec3(200, -185, 200)) * glm::rotate(glm::radians(180.f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(8.f));
|
||||
|
||||
Core::drawObjectTexture(engine.terrainContext, terrainTransformation, engine.terrainTexture, engine.textureShader, lightDir, cameraMatrix, perspectiveMatrix);
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
BIN
grafika_projekt/textures/arch.png
Normal file
BIN
grafika_projekt/textures/arch.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 MiB |
BIN
grafika_projekt/textures/coral01.png
Normal file
BIN
grafika_projekt/textures/coral01.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 122 KiB |
BIN
grafika_projekt/textures/plant1.png
Normal file
BIN
grafika_projekt/textures/plant1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
grafika_projekt/textures/plant2.png
Normal file
BIN
grafika_projekt/textures/plant2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
grafika_projekt/textures/plant3.png
Normal file
BIN
grafika_projekt/textures/plant3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 248 KiB |
BIN
grafika_projekt/textures/rocktower1.png
Normal file
BIN
grafika_projekt/textures/rocktower1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in New Issue
Block a user