:)))
This commit is contained in:
parent
354af7cef5
commit
01482ed96a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,24 +1,32 @@
|
||||
main.cpp
|
||||
C:\Windows Kits\10\Include\10.0.22000.0\shared\minwindef.h(130,1): warning C4005: APIENTRY: изменение макроопределения
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : см. предыдущее определение "APIENTRY"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(136,15): warning C4244: инициализация: преобразование "double" в "float", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(157,23): warning C4244: инициализация: преобразование "double" в "float", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(205,30): warning C4244: =: преобразование "float" в "int", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(211,20): warning C4244: =: преобразование "int" в "float", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(365,61): warning C4305: аргумент: усечение из "double" в "GLfloat"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(366,61): warning C4305: аргумент: усечение из "double" в "GLfloat"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(441,16): warning C4305: инициализация: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(545,61): warning C4305: аргумент: усечение из "double" в "GLfloat"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(546,61): warning C4305: аргумент: усечение из "double" в "GLfloat"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(595,30): warning C4305: инициализация: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(644,17): warning C4244: инициализация: преобразование "double" в "float", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(759,13): warning C4244: инициализация: преобразование "double" в "float", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(906,90): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(907,94): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(908,98): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(909,100): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(912,104): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(913,94): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(138,15): warning C4244: инициализация: преобразование "double" в "float", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(159,23): warning C4244: инициализация: преобразование "double" в "float", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(207,30): warning C4244: =: преобразование "float" в "int", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(213,20): warning C4244: =: преобразование "int" в "float", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(388,61): warning C4305: аргумент: усечение из "double" в "GLfloat"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(389,61): warning C4305: аргумент: усечение из "double" в "GLfloat"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(467,16): warning C4305: инициализация: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(571,61): warning C4305: аргумент: усечение из "double" в "GLfloat"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(572,61): warning C4305: аргумент: усечение из "double" в "GLfloat"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(621,30): warning C4305: инициализация: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(670,17): warning C4244: инициализация: преобразование "double" в "float", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(777,16): warning C4244: инициализация: преобразование "_Rep" в "unsigned int", возможна потеря данных
|
||||
with
|
||||
[
|
||||
_Rep=std::chrono::system_clock::rep
|
||||
]
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(816,13): warning C4244: инициализация: преобразование "double" в "float", возможна потеря данных
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(983,90): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(984,94): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(985,98): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(986,100): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(989,104): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(990,94): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(991,102): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(992,105): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(993,95): warning C4305: аргумент: усечение из "double" в "float"
|
||||
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\tuple(158,47): warning C4244: инициализация: преобразование "_Ty" в "_Ty", возможна потеря данных
|
||||
with
|
||||
[
|
||||
@ -94,8 +102,8 @@ C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.2
|
||||
_Tag=std::_Unpack_tuple_t,
|
||||
_Tpl=std::tuple<int,float>
|
||||
]
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(212): message : выполняется компиляция ссылки на экземпляр шаблон функции "std::tuple<int,int>::tuple<int,float,0>(std::tuple<int,float> &&) noexcept"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(212): message : выполняется компиляция ссылки на экземпляр шаблон функции "std::tuple<int,int>::tuple<int,float,0>(std::tuple<int,float> &&) noexcept"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(214): message : выполняется компиляция ссылки на экземпляр шаблон функции "std::tuple<int,int>::tuple<int,float,0>(std::tuple<int,float> &&) noexcept"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(214): message : выполняется компиляция ссылки на экземпляр шаблон функции "std::tuple<int,int>::tuple<int,float,0>(std::tuple<int,float> &&) noexcept"
|
||||
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\tuple(158,47): warning C4244: инициализация: преобразование "const int" в "_Ty", возможна потеря данных
|
||||
with
|
||||
[
|
||||
@ -178,7 +186,7 @@ C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.2
|
||||
_RanIt=std::tuple<int,int> *,
|
||||
_Pr=bool (__cdecl *)(std::tuple<int,float>,std::tuple<int,float>)
|
||||
]
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(220): message : выполняется компиляция ссылки на экземпляр шаблон функции "void std::sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>,bool(__cdecl *)(std::tuple<int,float>,std::tuple<int,float>)>(const _RanIt,const _RanIt,_Pr)"
|
||||
C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(222): message : выполняется компиляция ссылки на экземпляр шаблон функции "void std::sort<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>,bool(__cdecl *)(std::tuple<int,float>,std::tuple<int,float>)>(const _RanIt,const _RanIt,_Pr)"
|
||||
with
|
||||
[
|
||||
_Ty=std::tuple<int,int>,
|
||||
@ -186,8 +194,8 @@ C:\Users\neryt\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(220): message : в
|
||||
_Pr=bool (__cdecl *)(std::tuple<int,float>,std::tuple<int,float>)
|
||||
]
|
||||
Создание кода
|
||||
46 of 2621 functions ( 1.8%) were compiled, the rest were copied from previous compilation.
|
||||
174 of 2522 functions ( 6.9%) were compiled, the rest were copied from previous compilation.
|
||||
0 functions were new in current compilation
|
||||
28 functions had inline decision re-evaluated but remain unchanged
|
||||
41 functions had inline decision re-evaluated but remain unchanged
|
||||
Создание кода завершено
|
||||
grk-cw6.vcxproj -> C:\Users\neryt\Grafika2023\PlanetCreator\Release\grk-cw6.exe
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -73,6 +73,8 @@
|
||||
<None Include="shaders\shader_pbr.vert" />
|
||||
<None Include="shaders\shader_pbr_instanced.frag" />
|
||||
<None Include="shaders\shader_pbr_instanced.vert" />
|
||||
<None Include="shaders\shader_sky.frag" />
|
||||
<None Include="shaders\shader_sky.vert" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{3952C396-B1C6-44CD-96DD-C1AC15D32978}</ProjectGuid>
|
||||
|
@ -144,7 +144,7 @@
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\ex_6_1.hpp">
|
||||
<Filter>Shader Files</Filter>
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -185,5 +185,11 @@
|
||||
<None Include="shaders\shader_pbr_instanced.vert">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
<None Include="shaders\shader_sky.frag">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
<None Include="shaders\shader_sky.vert">
|
||||
<Filter>Shader Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -11,6 +11,6 @@ Pos=4,3
|
||||
Size=218,129
|
||||
|
||||
[Window][Dodawanie nowej planety]
|
||||
Pos=23,7
|
||||
Pos=16,7
|
||||
Size=282,158
|
||||
|
||||
|
25389
PlanetCreator/cw 6/models/plant_3_1.obj
Normal file
25389
PlanetCreator/cw 6/models/plant_3_1.obj
Normal file
File diff suppressed because it is too large
Load Diff
25256
PlanetCreator/cw 6/models/plant_3_1.ply
Normal file
25256
PlanetCreator/cw 6/models/plant_3_1.ply
Normal file
File diff suppressed because it is too large
Load Diff
18670
PlanetCreator/cw 6/models/plant_3_1_med.obj
Normal file
18670
PlanetCreator/cw 6/models/plant_3_1_med.obj
Normal file
File diff suppressed because it is too large
Load Diff
18670
PlanetCreator/cw 6/models/plant_3_1_small.obj
Normal file
18670
PlanetCreator/cw 6/models/plant_3_1_small.obj
Normal file
File diff suppressed because it is too large
Load Diff
10232
PlanetCreator/cw 6/models/plant_3_1_small.ply
Normal file
10232
PlanetCreator/cw 6/models/plant_3_1_small.ply
Normal file
File diff suppressed because it is too large
Load Diff
21498
PlanetCreator/cw 6/models/plant_4_1.ply
Normal file
21498
PlanetCreator/cw 6/models/plant_4_1.ply
Normal file
File diff suppressed because it is too large
Load Diff
10452
PlanetCreator/cw 6/models/plant_4_1_med.ply
Normal file
10452
PlanetCreator/cw 6/models/plant_4_1_med.ply
Normal file
File diff suppressed because it is too large
Load Diff
3294
PlanetCreator/cw 6/models/plant_4_1_small.ply
Normal file
3294
PlanetCreator/cw 6/models/plant_4_1_small.ply
Normal file
File diff suppressed because it is too large
Load Diff
31834
PlanetCreator/cw 6/models/plant_7_1.obj
Normal file
31834
PlanetCreator/cw 6/models/plant_7_1.obj
Normal file
File diff suppressed because it is too large
Load Diff
25125
PlanetCreator/cw 6/models/plant_7_1_med.obj
Normal file
25125
PlanetCreator/cw 6/models/plant_7_1_med.obj
Normal file
File diff suppressed because it is too large
Load Diff
9257
PlanetCreator/cw 6/models/plant_7_1_small.obj
Normal file
9257
PlanetCreator/cw 6/models/plant_7_1_small.obj
Normal file
File diff suppressed because it is too large
Load Diff
19
PlanetCreator/cw 6/shaders/shader_sky.frag
Normal file
19
PlanetCreator/cw 6/shaders/shader_sky.frag
Normal 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;
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
13
PlanetCreator/cw 6/shaders/shader_sky.vert
Normal file
13
PlanetCreator/cw 6/shaders/shader_sky.vert
Normal 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);
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
#include "Texture.h"
|
||||
#include "Texture.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include "SOIL/SOIL.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include "SOIL/SOIL.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
||||
GLuint Core::LoadTexture( const char * filepath )
|
||||
GLuint Core::LoadTexture(const char* filepath)
|
||||
{
|
||||
GLuint id;
|
||||
glGenTextures(1, &id);
|
||||
@ -20,7 +20,7 @@ GLuint Core::LoadTexture( const char * filepath )
|
||||
|
||||
int w, h;
|
||||
unsigned char* image = SOIL_load_image(filepath, &w, &h, 0, SOIL_LOAD_RGBA);
|
||||
|
||||
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image);
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
@ -28,12 +28,39 @@ 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Core::SetActiveTexture(GLuint textureID, const char * shaderVariableName, GLuint programID, int textureUnit)
|
||||
void Core::SetActiveTexture(GLuint textureID, const char* shaderVariableName, GLuint programID, int textureUnit)
|
||||
{
|
||||
glUniform1i(glGetUniformLocation(programID, shaderVariableName), textureUnit);
|
||||
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);
|
||||
}
|
||||
|
@ -6,10 +6,13 @@
|
||||
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);
|
||||
|
||||
}
|
@ -17,6 +17,8 @@
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/postprocess.h>
|
||||
#include <string>
|
||||
#include <random>
|
||||
#include <chrono>
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_glfw.h"
|
||||
@ -277,17 +279,29 @@ namespace texture {
|
||||
GLuint earthNormal;
|
||||
GLuint asteroidNormal;
|
||||
}
|
||||
GLuint program_sky;
|
||||
GLuint program_blur;
|
||||
GLuint program_bloom_final;
|
||||
|
||||
GLuint program;
|
||||
GLuint programSun;
|
||||
GLuint programTex;
|
||||
GLuint program_pbr;
|
||||
GLuint program_pbr_instanced;
|
||||
GLuint plantProgram;
|
||||
|
||||
|
||||
Core::Shader_Loader shaderLoader;
|
||||
Core::RenderContext cubeContext;
|
||||
GLuint plantProgram;
|
||||
|
||||
|
||||
GLuint programBiomes;
|
||||
|
||||
|
||||
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;
|
||||
Core::RenderContext plantContext;
|
||||
|
||||
Core::RenderContext sphereContext;
|
||||
@ -299,14 +313,23 @@ Core::RenderContext plant_2_1Context;
|
||||
Core::RenderContext plant_2_1_small_Context;
|
||||
Core::RenderContext plant_2_1_med_Context;
|
||||
|
||||
Core::RenderContext plant_4_1Context;
|
||||
Core::RenderContext plant_4_1_small_Context;
|
||||
Core::RenderContext plant_4_1_med_Context;
|
||||
|
||||
|
||||
Core::RenderContext plant_7_1Context;
|
||||
Core::RenderContext plant_7_1_small_Context;
|
||||
Core::RenderContext plant_7_1_med_Context;
|
||||
|
||||
Core::RenderContext plant3Context;
|
||||
Core::RenderContext plant2Context;
|
||||
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 sunColor = glm::vec3(1.0f, 1.0f, 1.0f); // Цвет солнца
|
||||
//glm::vec3 sunPosition = glm::vec3(0.0f, 0.0f, 0.0f); // Позиция солнца
|
||||
//glm::vec3 sunColor = glm::vec3(1.0f, 1.0f, 1.0f); // Цвет солнца
|
||||
|
||||
|
||||
|
||||
@ -375,7 +398,9 @@ void DrawContextInstanced(Core::RenderContext& context, std::vector<glm::mat4> t
|
||||
glBindVertexArray(0);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
||||
//glClear(GL_ELEMENT_ARRAY_BUFFER);
|
||||
glClear(GL_ARRAY_BUFFER);
|
||||
|
||||
}
|
||||
|
||||
float aspectRatio = 1.f;
|
||||
@ -425,6 +450,7 @@ void renderImGui() {
|
||||
ImGui::SliderFloat("Temperatura", &newPlanetParams.temperature, 0.0f, 10.0f); // Слайдер для осадков
|
||||
|
||||
if (ImGui::Button("Dodac")) {
|
||||
//planets.clear();
|
||||
newPlanetParams = populatePlanet(newPlanetParams, plant_specimens);
|
||||
planets.push_back(newPlanetParams);
|
||||
}
|
||||
@ -544,7 +570,7 @@ void drawObjectTexture_plant(Core::RenderContext &context, glm::mat4 modelMatrix
|
||||
glUniform1i(glGetUniformLocation(program, "illuminationModel"), material.illum);
|
||||
glUniform1f(glGetUniformLocation(program, "metallic"), 0.05);
|
||||
glUniform1f(glGetUniformLocation(program, "roughness"), 0.2);
|
||||
std::cout << "DRAWWW " << std::endl;
|
||||
// std::cout << "DRAWWW " << std::endl;
|
||||
Core::DrawContext(context);
|
||||
glUseProgram(0);
|
||||
}
|
||||
@ -681,6 +707,7 @@ struct TexturePlantData {
|
||||
};
|
||||
std::vector<TexturePlantData> texturePlantDataList;
|
||||
#include <cmath>
|
||||
#include <random>
|
||||
float thirdTreeStartScale = 0.0f;
|
||||
float secTreeStartScale = 0.0f;
|
||||
void animateGrowingTree(float& elapsedTime, float deltaTime, float firstTreeDuration, float secondTreeDuration, float thirdTreeDuration,
|
||||
@ -725,15 +752,15 @@ void animateGrowingTree(float& elapsedTime, float deltaTime, float firstTreeDura
|
||||
elapsedTime += deltaTime;
|
||||
}
|
||||
else {
|
||||
elapsedTime = 0.0;
|
||||
//elapsedTime = 0.0;
|
||||
//plantModelMatrix = glm::translate(plantPosition) * glm::scale(glm::vec3(scaleFactor + scaleFactor));
|
||||
plantModelMatrix = plantModelMatrix * glm::scale(glm::vec3(thirdTreeStartScale*3 + scaleFactor));
|
||||
TexturePlantData newData;
|
||||
newData.thirdTreeContext = thirdTreeContext;
|
||||
newData.plantModelMatrix = plantModelMatrix;
|
||||
newData.plant3Material = plant3Material;
|
||||
newData.program_pbr = program_pbr;
|
||||
texturePlantDataList.push_back(newData);
|
||||
//plantModelMatrix = plantModelMatrix * glm::scale(glm::vec3(thirdTreeStartScale*3 + scaleFactor));
|
||||
//TexturePlantData newData;
|
||||
//newData.thirdTreeContext = thirdTreeContext;
|
||||
//newData.plantModelMatrix = plantModelMatrix;
|
||||
//newData.plant3Material = plant3Material;
|
||||
//newData.program_pbr = program_pbr;
|
||||
//texturePlantDataList.push_back(newData);
|
||||
// drawObjectTexture_plant(thirdTreeContext, plantModelMatrix, plant3Material, program_pbr);
|
||||
|
||||
}
|
||||
@ -746,15 +773,45 @@ void animateGrowingTree(float& elapsedTime, float deltaTime, float firstTreeDura
|
||||
|
||||
|
||||
|
||||
Core::RenderContext& getRandomContext(Plant::Plant& plant) {
|
||||
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
|
||||
std::default_random_engine engine(seed);
|
||||
std::uniform_int_distribution<int> distribution(0, 2); // Диапазон от 0 до 2 включительно
|
||||
|
||||
int choice = distribution(engine);
|
||||
|
||||
switch (choice) {
|
||||
case 0:
|
||||
return plant.modelContext;
|
||||
case 1:
|
||||
return plant.stageContext1;
|
||||
case 2:
|
||||
return plant.stageContext2;
|
||||
default:
|
||||
return plant.stageContext3; // На случай, если что-то пойдет не так, вернем stageContext3
|
||||
}
|
||||
}
|
||||
|
||||
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 renderScene(GLFWwindow* window)
|
||||
{
|
||||
glClearColor(0.05f, 0.05f, 0.2f, 1.0f);
|
||||
//glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
|
||||
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
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;
|
||||
float time = glfwGetTime();
|
||||
|
||||
@ -801,24 +858,30 @@ void renderScene(GLFWwindow* window)
|
||||
|
||||
// Теперь используем материал, связанный с каждым растением
|
||||
// const Material& plantMaterial = plant.material; // Предполагаем, что у Plant есть поле Material material
|
||||
|
||||
// drawObjectTexture_plant(const_cast<Plant::Plant&>(plant).modelContext, plantMatrix, plant3Material, program_pbr);
|
||||
// static Core::RenderContext& chosenContext = getRandomContext(const_cast<Plant::Plant&>(plant));
|
||||
drawObjectTexture_plant(const_cast<Plant::Plant&>(plant).modelContext, plantMatrix, plant3Material, program_pbr);
|
||||
//drawObjectTexture_plant(chosenContext, plantMatrix, plant3Material, program_pbr);
|
||||
std::vector<glm::vec3> positions = { plant.pos };
|
||||
//animateGrowingTree(const_cast<Plant::Plant&>(plant).elapsedTime, deltaTime, firstTreeDuration, secondTreeDuration, thirdTreeDuration, plant.pos, scaleFactor, const_cast<Plant::Plant&>(plant).stageContext1, const_cast<Plant::Plant&>(plant).stageContext2, const_cast<Plant::Plant&>(plant).stageContext3, plantMatrix, plant2_1Material, program_pbr);
|
||||
animateGrowingTree(const_cast<Plant::Plant&>(plant).elapsedTime, deltaTime, firstTreeDuration, secondTreeDuration, thirdTreeDuration, positions, scaleFactor, const_cast<Plant::Plant&>(plant).stageContext1, const_cast<Plant::Plant&>(plant).stageContext2, const_cast<Plant::Plant&>(plant).stageContext3, plantMatrix, plant2_1Material, program_pbr, planet);
|
||||
//animateGrowingTree(const_cast<Plant::Plant&>(plant).elapsedTime, deltaTime, firstTreeDuration, secondTreeDuration, thirdTreeDuration, positions, scaleFactor, const_cast<Plant::Plant&>(plant).stageContext1, const_cast<Plant::Plant&>(plant).stageContext2, const_cast<Plant::Plant&>(plant).stageContext3, plantMatrix, plant2_1Material, program_pbr_instanced, planet);
|
||||
|
||||
//drawObjectTexture_plantInstanced(const_cast<Plant::Plant&>(plant).stageContext3, plant3Material, program_pbr_instanced, 15, positions, planet, plantMatrix);
|
||||
// drawObjectTexture_plantInstanced(const_cast<Plant::Plant&>(plant).stageContext3, plant3Material, program_pbr, 15, positions, planet, plantMatrix);
|
||||
//(Core::RenderContext & context, std::vector<glm::mat4> modelMatrices, Material & material, GLuint program, int count, std::vector<glm::vec3>placePoints, PlanetParams planetParams)
|
||||
}
|
||||
// animateGrowingTree(const_cast<Plant::Plant&>(plant).elapsedTime, deltaTime, firstTreeDuration, secondTreeDuration, thirdTreeDuration, positions, scaleFactor, const_cast<Plant::Plant&>(plant).stageContext1, const_cast<Plant::Plant&>(plant).stageContext2, const_cast<Plant::Plant&>(plant).stageContext3, plantMatrix, plant2_1Material, program_pbr, planet);
|
||||
|
||||
}
|
||||
|
||||
//placeObjectOnPlanet(plant2Context, glm::scale(glm::mat4(), glm::vec3(0.2)), normalize(glm::vec3(1.0, 0.0, 1.0)), sphereContext, planetMatrix);
|
||||
|
||||
renderSun();
|
||||
skyPos = cameraPos;
|
||||
glm::mat4 skyMatrix = glm::scale(glm::vec3(skySize));
|
||||
glm::mat4 skyTranslate = glm::translate(skyPos);
|
||||
drawSky(cubeContext, skyTranslate * skyMatrix, Core::LoadTexture("textures/1.png"));
|
||||
|
||||
|
||||
//drawObjectColor(plant2Context, plantModelMatrix, glm::vec3(1,1,1), program);
|
||||
drawObjectColor(plant3Context,glm::translate(glm::vec3(1.0f, 0.5f, 3.0f)) *glm::scale(glm::vec3(0.03f)) *glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)),glm::vec3(1, 1, 1), program);
|
||||
//drawObjectColor(plant3Context,glm::translate(glm::vec3(1.0f, 0.5f, 3.0f)) *glm::scale(glm::vec3(0.03f)) *glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)),glm::vec3(1, 1, 1), program);
|
||||
//drawObjectTexture_plant(plant_1_1_small_Context, plantModelMatrix, plant3Material, program_pbr);
|
||||
//drawObjectTexture_plant(plant_2_1_small_Context, plantModelMatrix, plant2_1Material, program_pbr);
|
||||
|
||||
@ -832,6 +895,7 @@ 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);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
@ -879,6 +943,10 @@ 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);
|
||||
@ -892,6 +960,15 @@ void init(GLFWwindow* window)
|
||||
loadModelToContext("./models/plant_2_1.obj", plant_2_1Context);
|
||||
loadModelToContext2("./models/plant_4.ply", plant3Context);
|
||||
|
||||
loadModelToContext("./models/plant_3_1_small.obj", plant_4_1_small_Context);
|
||||
loadModelToContext("./models/plant_3_1_med.obj", plant_4_1_med_Context);
|
||||
loadModelToContext("./models/plant_3_1.obj", plant_4_1Context);
|
||||
|
||||
loadModelToContext("./models/plant_7_1_small.obj", plant_7_1_small_Context);
|
||||
loadModelToContext("./models/plant_7_1_med.obj", plant_7_1_med_Context);
|
||||
loadModelToContext("./models/plant_7_1.obj", plant_7_1Context);
|
||||
|
||||
|
||||
// setupBuffers(plantContex_test);
|
||||
texture::earth=Core::LoadTexture("textures/earth2.png");
|
||||
texture::clouds = Core::LoadTexture("textures/clouds.jpg");
|
||||
@ -903,14 +980,18 @@ void init(GLFWwindow* window)
|
||||
loadMTLAndGetTextureID("./models/plant_1_1.mtl", plant3Material);
|
||||
loadMTLAndGetTextureID("./models/plant_2_1_small.mtl", plant2_1Material);
|
||||
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.99, 1, 1, "testPlant2", "./models/plant_2_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.99, 1, 1, "testPlant2", "./models/plant_3_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.95, 1, 1, "testPlantXXXXX", "./models/plant_2_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.93, 1, 1, "testPlantAAAAAAAAA", "./models/plant_2_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.90, 1, 1, "testPlantCCCCCCCCCCC", "./models/plant_1_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.93, 1, 1, "testPlantAAAAAAAAA", "./models/plant_7_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.90, 1, 1, "testPlantCCCCCCCCCCC", "./models/plant_3_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.5, 1, 1, "testPlantBBBBBBBBB", "./models/plant_2_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 1, 1, 1, "testPlantFFFFFFFFFFFF", "./models/plant_2_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.2, 1, 1, "testPlant!!!!!!!!!!!!!!!!", "./models/plant_2_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.1, 1, 1, "testPlant_MAYBE", "./models/plant_2_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 1, 1, 1, "testPlantFFFFFFFFFFFF", "./models/plant_7_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.2, 1, 1, "testPlant!!!!!!!!!!!!!!!!", "./models/plant_3_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.1, 1, 1, "testPlant_MAYBE", "./models/plant_7_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.85, 1, 1, "testPlantFFFFFFFFFFFF1", "./models/plant_2_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.2, 1, 1, "testPlant!!!!!!!!!!!!!!!!1", "./models/plant_3_1"));
|
||||
plant_specimens.push_back(Plant::Plant(1, 0.1, 1, 1, "testPlant_MAYBE1", "./models/plant_7_1"));
|
||||
|
||||
|
||||
defaultTexture = Core::LoadTexture("textures/1.png");
|
||||
if (defaultTexture == 0) {
|
||||
|
BIN
PlanetCreator/cw 6/textures/photo_5341269364676089473_y.jpg
Normal file
BIN
PlanetCreator/cw 6/textures/photo_5341269364676089473_y.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 175 KiB |
BIN
PlanetCreator/cw 6/textures/photo_5341269364676089475_y.jpg
Normal file
BIN
PlanetCreator/cw 6/textures/photo_5341269364676089475_y.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 168 KiB |
BIN
PlanetCreator/cw 6/textures/photo_5341269364676089477_y.jpg
Normal file
BIN
PlanetCreator/cw 6/textures/photo_5341269364676089477_y.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 299 KiB |
Loading…
Reference in New Issue
Block a user