skybox, bloom, instancing presentation

This commit is contained in:
dompia5 2024-02-08 10:10:49 +01:00
parent 1a8b4cd64e
commit 4a27bc5ac4
13 changed files with 460 additions and 99 deletions

View File

@ -11,6 +11,6 @@ Pos=4,3
Size=218,129
[Window][Dodawanie nowej planety]
Pos=1,-20
Size=282,158
Pos=109,-18
Size=282,169

View File

@ -0,0 +1,40 @@
# Blender v2.90.0 OBJ File: ''
# www.blender.org
mtllib cube.mtl
o Cube
v -10.000000 -10.000000 10.000000
v -10.000000 10.000000 10.000000
v -10.000000 -10.000000 -10.000000
v -10.000000 10.000000 -10.000000
v 10.000000 -10.000000 10.000000
v 10.000000 10.000000 10.000000
v 10.000000 -10.000000 -10.000000
v 10.000000 10.000000 -10.000000
vt 0.375000 0.000000
vt 0.625000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.250000
vt 0.625000 0.500000
vt 0.375000 0.500000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.625000 1.000000
vt 0.375000 1.000000
vt 0.125000 0.500000
vt 0.125000 0.750000
vt 0.875000 0.500000
vt 0.875000 0.750000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl _PBR
s 1
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 8/5/2 7/6/2
f 7/6/3 8/5/3 6/7/3 5/8/3
f 5/8/4 6/7/4 2/9/4 1/10/4
f 3/11/5 7/6/5 5/8/5 1/12/5
f 8/5/6 4/13/6 2/14/6 6/7/6

View File

@ -0,0 +1,23 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoords;
uniform sampler2D scene;
uniform sampler2D bloomBlur;
uniform bool bloom;
uniform float exposure;
void main()
{
const float gamma = 2.2;
vec3 hdrColor = texture(scene, TexCoords).rgb;
vec3 bloomColor = texture(bloomBlur, TexCoords).rgb;
if(bloom)
hdrColor += bloomColor; // additive blending
// tone mapping
vec3 result = vec3(1.0) - exp(-hdrColor * exposure);
// also gamma correct while we're at it
result = pow(result, vec3(1.0 / gamma));
FragColor = vec4(result, 1.0);
}

View File

@ -0,0 +1,11 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoords;
out vec2 TexCoords;
void main()
{
TexCoords = aTexCoords;
gl_Position = vec4(aPos, 1.0);
}

View File

@ -0,0 +1,32 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoords;
uniform sampler2D image;
uniform bool horizontal;
uniform float weight[5] = float[] (0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162);
void main()
{
vec2 tex_offset = 1.0 / textureSize(image, 0); // gets size of single texel
vec3 result = texture(image, TexCoords).rgb * weight[0];
if(horizontal)
{
for(int i = 1; i < 8; ++i)
{
result += texture(image, TexCoords + vec2(tex_offset.x * i, 0.0)).rgb * weight[i];
result += texture(image, TexCoords - vec2(tex_offset.x * i, 0.0)).rgb * weight[i];
}
}
else
{
for(int i = 1; i < 5; ++i)
{
result += texture(image, TexCoords + vec2(0.0, tex_offset.y * i)).rgb * weight[i];
result += texture(image, TexCoords - vec2(0.0, tex_offset.y * i)).rgb * weight[i];
}
}
FragColor = vec4(result, 1.0);
}

View File

@ -0,0 +1,11 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoords;
out vec2 TexCoords;
void main()
{
TexCoords = aTexCoords;
gl_Position = vec4(aPos, 1.0);
}

View File

@ -1,6 +1,7 @@
#version 430 core
#define PI 3.14159265359
layout (location = 0) out vec4 outColor;
layout (location = 1) out vec4 BrightColor;
float AMBIENT = 0.1;
uniform vec3 albedo;
@ -16,7 +17,7 @@ in vec3 fragNormal;
in vec3 fragPosition;
in vec2 texCoords;
out vec4 outColor;
//out vec4 outColor;
float specularD(float NdotH, float roughness)
{
@ -68,5 +69,10 @@ void main()
vec3 finalColor = ambient + (diffuse + specular) * NdotL;
float brightness = dot(finalColor, vec3(0.2126, 0.7152, 0.0722));
if(brightness > 1.0)
BrightColor = vec4(finalColor, 1.0);
else
BrightColor = vec4(0.0, 0.0, 0.0, 1.0);
outColor = vec4(finalColor, 1.0);
}

View File

@ -0,0 +1,19 @@
#version 430 core
layout (location = 0) out vec4 out_color;
layout (location = 1) out vec4 BrightColor;
uniform samplerCube skybox;
in vec3 texCoord;
//out vec4 out_color;
void main()
{
vec4 finalColor =texture(skybox,texCoord);
float brightness = dot(vec3(finalColor.x,finalColor.y, finalColor.z ), vec3(0.2126, 0.7152, 0.0722));
if(brightness > 1.0)
BrightColor = vec4(vec3(finalColor.x,finalColor.y, finalColor.z ), 1.0);
else
BrightColor = vec4(0.0, 0.0, 0.0, 1.0);
out_color = texture(skybox,texCoord);
}

View File

@ -0,0 +1,13 @@
#version 430 core
layout(location = 0) in vec3 vertexPosition;
uniform mat4 transformation;
out vec3 texCoord;
void main()
{
texCoord = vertexPosition;
gl_Position = transformation * vec4(vertexPosition, 1.0);
}

View File

@ -28,6 +28,27 @@ GLuint Core::LoadTexture( const char * filepath )
return id;
}
GLuint Core::LoadCubeMap(const char * filepath ) {
GLuint id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_CUBE_MAP, id);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_REPEAT);
int w, h;
unsigned char* image = SOIL_load_image(filepath, &w, &h, 0, SOIL_LOAD_RGBA);
for (int i = 0; i < 6; i++) {
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);
}
return id;
}
@ -37,3 +58,9 @@ void Core::SetActiveTexture(GLuint textureID, const char * shaderVariableName, G
glActiveTexture(GL_TEXTURE0 + textureUnit);
glBindTexture(GL_TEXTURE_2D, textureID);
}
void Core::SetActiveBackground(GLuint textureID, const char* shaderVariableName, GLuint programID, int textureUnit)
{
glUniform1i(glGetUniformLocation(programID, shaderVariableName), textureUnit);
glActiveTexture(GL_TEXTURE0 + textureUnit);
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
}

View File

@ -6,10 +6,11 @@
namespace Core
{
GLuint LoadTexture(const char * filepath);
GLuint LoadCubeMap(const char* filepath);
// textureID - identyfikator tekstury otrzymany z funkcji LoadTexture
// shaderVariableName - nazwa zmiennej typu 'sampler2D' w shaderze, z ktora ma zostac powiazana tekstura
// programID - identyfikator aktualnego programu karty graficznej
// textureUnit - indeks jednostki teksturujacej - liczba od 0 do 7. Jezeli uzywa sie wielu tekstur w jednym shaderze, to kazda z nich nalezy powiazac z inna jednostka.
void SetActiveTexture(GLuint textureID, const char * shaderVariableName, GLuint programID, int textureUnit);
void SetActiveBackground(GLuint textureID, const char* shaderVariableName, GLuint programID, int textureUnit);
}

View File

@ -196,7 +196,7 @@ PlanetParams populatePlanet(PlanetParams planet, std::vector<Plant::Plant> plant
float probability = 0.5f;
int HOW_MANY_PLANTS = 10000;
int PRECISION = 10000;
float NOTHING_SPAWNS_CUTOFF = 0.2;
float NOTHING_SPAWNS_CUTOFF = 0.02;
int sum = 0;
int chosen_number = 0;
std::vector<std::tuple<int, int>> probabilities;
@ -272,7 +272,36 @@ PlanetParams populatePlanet(PlanetParams planet, std::vector<Plant::Plant> plant
}
PlanetParams populatePlanet2(PlanetParams planet, std::vector<Plant::Plant> plants)
{
int HOW_MANY_PLANTS = 1000;
int eachSpecie = int(HOW_MANY_PLANTS / plant_specimens.size());
for (int i = 0; i < plant_specimens.size(); i++)
{
planet.Plant_type_count.push_back(eachSpecie);
for (int j = 0; j < eachSpecie; j++)
{
Plant::Plant plant = plants[i];
plant.pos = glm::vec3((2.0 * (rand() / (RAND_MAX + 1.0)) - 1), (2.0 * (rand() / (RAND_MAX + 1.0)) - 1), (2.0 * (rand() / (RAND_MAX + 1.0))) - 1);
planet.Plant_info.push_back(std::make_tuple(i, plant.pos));
}
}
planet.texture = defaultTexture;
for (const auto& climate : climates) {
if (planet.temperature >= climate.tempMin && planet.temperature <= climate.tempMax &&
planet.humidity >= climate.precipMin && planet.humidity <= climate.precipMax) {
planet.texture = climate.textureID;
}
}
return planet;
}
namespace texture {
@ -285,6 +314,8 @@ namespace texture {
GLuint sun;
GLuint earthNormal;
GLuint asteroidNormal;
GLuint background;
}
GLuint program;
@ -293,7 +324,11 @@ GLuint programTex;
GLuint program_pbr;
GLuint plantProgram;
GLuint program_pbr_instanced;
GLuint program_sky;
GLuint program_blur;
GLuint program_bloom_final;
Core::Shader_Loader shaderLoader;
Core::RenderContext cubeContext;
GLuint programBiomes;
@ -318,9 +353,10 @@ Core::RenderContext plant2_1Context;
glm::vec3 cameraPos = glm::vec3(-4.f, 0, 0);
glm::vec3 cameraDir = glm::vec3(1.f, 0.f, 0.f);
glm::vec3 sunPosition = glm::vec3(0.0f, 0.0f, 0.0f); // Позиция солнца
glm::vec3 sunPosition = glm::vec3(0.0f, 10.0f, 10.0f); // Позиция солнца
glm::vec3 sunColor = glm::vec3(1.0f, 1.0f, 1.0f); // Цвет солнца
glm::vec3 skyPos = glm::vec3(0.f, 0.f, 0.f);
float skySize = 4.f;
GLuint VAO, VBO;
@ -352,7 +388,7 @@ void DrawContextInstanced(Core::RenderContext& context, std::vector<glm::mat4> t
glVertexAttribDivisor(10 + i, 1);
}
glUniform3f(glGetUniformLocation(program, "lightPos"), 0, 0, 0);
glUniform3f(glGetUniformLocation(program, "lightPos"), sunPosition.x, sunPosition.y, sunPosition.z);
//Material
glUniform1f(glGetUniformLocation(program, "shininess"), material.Ns);
glUniform3f(glGetUniformLocation(program, "ambientColor"), material.Ka.r, material.Ka.g, material.Ka.b);
@ -438,16 +474,137 @@ void renderImGui() {
ImGui::SliderFloat("Temperatura", &newPlanetParams.temperature, 0.0f, 100.0f); // Слайдер для осадков
if (ImGui::Button("Dodac")) {
planets.clear();
newPlanetParams = populatePlanet(newPlanetParams, plant_specimens);
planets.push_back(newPlanetParams);
newPlanetParams.Plant_info.clear();
newPlanetParams.Plant_type_count.clear();
}
if (ImGui::Button("Instancing")) {
planets.clear();
newPlanetParams = populatePlanet2(newPlanetParams, plant_specimens);
planets.push_back(newPlanetParams);
newPlanetParams.Plant_info.clear();
newPlanetParams.Plant_type_count.clear();
}
ImGui::End();
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
unsigned int hdrFBO;
unsigned int colorBuffers[2];
unsigned int rboDepth;
unsigned int attachments[2] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 };
unsigned int pingpongFBO[2];
unsigned int pingpongColorbuffers[2];
int SCR_WIDTH = 1024, SCR_HEIGHT = 1024;
void bloomConfig(GLFWwindow* window) {
glfwGetWindowSize(window, &SCR_WIDTH, &SCR_HEIGHT);
glGenFramebuffers(1, &hdrFBO);
glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);
glGenTextures(2, colorBuffers);
for (unsigned int i = 0; i < 2; i++)
{
glBindTexture(GL_TEXTURE_2D, colorBuffers[i]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // we clamp to the edge as the blur filter would otherwise sample repeated texture values!
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// attach texture to framebuffer
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, colorBuffers[i], 0);
glGenRenderbuffers(1, &rboDepth);
glBindRenderbuffer(GL_RENDERBUFFER, rboDepth);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, SCR_WIDTH, SCR_HEIGHT);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepth);
glDrawBuffers(2, attachments);
// finally check if framebuffer is complete
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
std::cout << "Framebuffer not complete!" << std::endl;
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glGenFramebuffers(2, pingpongFBO);
glGenTextures(2, pingpongColorbuffers);
for (unsigned int i = 0; i < 2; i++)
{
glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[i]);
glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[i]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // we clamp to the edge as the blur filter would otherwise sample repeated texture values!
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pingpongColorbuffers[i], 0);
// also check if framebuffers are complete (no need for depth buffer)
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
std::cout << "Framebuffer not complete!" << std::endl;
}
}
glUseProgram(program_blur);
glUniform1i(glGetUniformLocation(program_blur, "image"), 0);
glUseProgram(program_bloom_final);
glUniform1i(glGetUniformLocation(program_bloom_final, "scene"), 0);
glUniform1i(glGetUniformLocation(program_bloom_final, "bloomBlur"), 1);
}
unsigned int quadVAO = 0;
unsigned int quadVBO;
void renderQuad()
{
if (quadVAO == 0)
{
float quadVertices[] = {
// positions // texture Coords
-1.0f, 1.0f, 0.0f, 0.0f, 1.0f,
-1.0f, -1.0f, 0.0f, 0.0f, 0.0f,
1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
1.0f, -1.0f, 0.0f, 1.0f, 0.0f,
};
// setup plane VAO
glGenVertexArrays(1, &quadVAO);
glGenBuffers(1, &quadVBO);
glBindVertexArray(quadVAO);
glBindBuffer(GL_ARRAY_BUFFER, quadVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(quadVertices), &quadVertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));
}
glBindVertexArray(quadVAO);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindVertexArray(0);
}
float exposure = 0.5f;
bool bloom = true;
void applyBloom() {
bool horizontal = true, first_iteration = true;
unsigned int amount = 10;
glUseProgram(program_blur);
for (unsigned int i = 0; i < amount; i++)
{
glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[horizontal]);
glUniform1i(glGetUniformLocation(program_blur, "horizontal"), horizontal);
glBindTexture(GL_TEXTURE_2D, first_iteration ? colorBuffers[1] : pingpongColorbuffers[!horizontal]); // bind texture of other framebuffer (or scene if first iteration)
renderQuad();
horizontal = !horizontal;
if (first_iteration)
first_iteration = false;
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(program_bloom_final);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, colorBuffers[0]);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[!horizontal]);
glUniform1i(glGetUniformLocation(program_bloom_final, "bloom"), bloom);
glUniform1f(glGetUniformLocation(program_bloom_final, "exposure"), exposure);
renderQuad();
}
glm::mat4 createPerspectiveMatrix()
{
@ -469,6 +626,16 @@ glm::mat4 createPerspectiveMatrix()
return perspectiveMatrix;
}
void drawSky(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture) {
glUseProgram(program_sky);
Core::SetActiveBackground(texture, "skybox", program_sky, 0);
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(program_sky, "transformation"), 1, GL_FALSE, (float*)&transformation);
glUniformMatrix4fv(glGetUniformLocation(program_sky, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
Core::DrawContext(context);
glUseProgram(0);
}
void drawObjectColor(Core::RenderContext& context, glm::mat4 modelMatrix, glm::vec3 color, GLuint program) {
GLuint prog = program;
@ -698,6 +865,8 @@ void animateGrowingTree(float& elapsedTime, float deltaTime, float firstTreeDura
void renderScene(GLFWwindow* window)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);
glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glm::mat4 transformation;
@ -771,10 +940,14 @@ void renderScene(GLFWwindow* window)
//animateGrowingTree(elapsedTime, deltaTime, firstTreeDuration, secondTreeDuration, thirdTreeDuration, plant.pos, scaleFactor, plant_2_1_small_Context, plant_2_1_med_Context, plant_2_1Context, plantModelMatrix, plant2_1Material, program_pbr);
}
skyPos = cameraPos;
glm::mat4 skyMatrix = glm::scale(glm::vec3(skySize));
glm::mat4 skyTranslate = glm::translate(skyPos);
drawSky(cubeContext, skyTranslate * skyMatrix, texture::background);
//placeObjectOnPlanet(plant2Context, glm::scale(glm::mat4(), glm::vec3(0.2)), normalize(glm::vec3(1.0, 0.0, 1.0)), sphereContext, planetMatrix);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
applyBloom();
renderSun();
@ -792,11 +965,14 @@ void renderScene(GLFWwindow* window)
//animateGrowingTree(elapsedTime, deltaTime, firstTreeDuration, secondTreeDuration, thirdTreeDuration, plantPosition2, scaleFactor, plant_2_1_small_Context, plant_2_1_med_Context, plant_2_1Context, plantModelMatrix, plant2_1Material, program_pbr);
//glfwSwapBuffers(window);
renderImGui();
glfwSwapBuffers(window);
}
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
aspectRatio = width / float(height);
bloomConfig(window);
glViewport(0, 0, width, height);
}
@ -813,6 +989,7 @@ void init(GLFWwindow* window)
{
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
bloomConfig(window);
glm::vec3 lightPosition = glm::vec3(0.0f, 10.0f, 0.0f);
glm::vec3 lightColor = glm::vec3(1.0f, 1.0f, 1.0f);
@ -825,6 +1002,9 @@ void init(GLFWwindow* window)
programBiomes = shaderLoader.CreateProgram("shaders/shader_biomes.vert", "shaders/shader_biomes.frag");
program_pbr = shaderLoader.CreateProgram("shaders/shader_pbr.vert", "shaders/shader_pbr.frag");
program_pbr_instanced = shaderLoader.CreateProgram("shaders/shader_pbr_instanced.vert", "shaders/shader_pbr_instanced.frag");
program_sky = shaderLoader.CreateProgram("shaders/shader_sky.vert", "shaders/shader_sky.frag");
program_blur = shaderLoader.CreateProgram("shaders/blur.vert", "shaders/blur.frag");
program_bloom_final = shaderLoader.CreateProgram("shaders/bloom_final.vert", "shaders/bloom_final.frag");
loadModelToContext2("./models/plants/polygon.obj", plantContext);
loadModelToContext("./models/sphere.obj", sphereContext);
@ -849,7 +1029,8 @@ void init(GLFWwindow* window)
loadMTLAndGetTextureID("./models/plant_1_1.mtl", plant3Material);
loadMTLAndGetTextureID("./models/plant_2_1_small.mtl", plant2_1Material);
loadMTLAndGetTextureID("./models/plant_2_1_small.mtl", plant2_1Material);
loadModelToContext("./models/cube.obj", cubeContext);
texture::background = Core::LoadCubeMap("./textures/skyCut.jpg");
plant_specimens.push_back(Plant::Plant(7, 5, 7, 5, "plant1_s", "./models/plant_1_1.obj", plant3Material));
plant_specimens.push_back(Plant::Plant(5, 5, 5, 5, "plant1_m", "./models/plant_2_1.obj", plant2_1Material));
@ -929,11 +1110,8 @@ void renderLoop(GLFWwindow* window) {
renderScene(window);
// Рендеринг ImGui
renderImGui();
glEnable(GL_DEPTH_TEST);
glfwSwapBuffers(window);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 KiB