This commit is contained in:
s473621 2024-01-29 12:05:14 +01:00 committed by Deni
parent c9fbf89cc3
commit 06362ba989
7 changed files with 82938 additions and 5 deletions

View File

@ -17,6 +17,7 @@
<ItemGroup>
<ClCompile Include="src\Box.cpp" />
<ClCompile Include="src\Camera.cpp" />
<ClCompile Include="src\Distribution.cpp" />
<ClCompile Include="src\imgui.cpp" />
<ClCompile Include="src\imgui_demo.cpp" />
<ClCompile Include="src\imgui_draw.cpp" />
@ -35,6 +36,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Camera.h" />
<ClInclude Include="src\Distribution.h" />
<ClInclude Include="src\ex_6_1.hpp" />
<ClInclude Include="src\imconfig.h" />
<ClInclude Include="src\imgui.h" />
@ -54,6 +56,7 @@
<ClInclude Include="src\SOIL\stbi_DDS_aug.h" />
<ClInclude Include="src\SOIL\stbi_DDS_aug_c.h" />
<ClInclude Include="src\SOIL\stb_image_aug.h" />
<ClInclude Include="src\stb_image.h" />
<ClInclude Include="src\Texture.h" />
</ItemGroup>
<ItemGroup>

View File

@ -51,6 +51,30 @@
<ClCompile Include="src\SOIL\image_helper.c">
<Filter>Source Files\SOIL</Filter>
</ClCompile>
<ClCompile Include="src\imgui.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\imgui_demo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\imgui_draw.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\imgui_impl_glfw.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\imgui_impl_opengl3.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\imgui_tables.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\imgui_widgets.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Distribution.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\objload.h">
@ -89,6 +113,39 @@
<ClInclude Include="src\ex_6_1.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\imconfig.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\imgui.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\imgui_impl_glfw.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\imgui_impl_opengl3.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\imgui_impl_opengl3_loader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\imgui_internal.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\imstb_rectpack.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\imstb_textedit.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\imstb_truetype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Distribution.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="src\stb_image.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="shaders\shader_5_sun.frag">
@ -115,5 +172,6 @@
<None Include="shaders\shader_biomes.vert">
<Filter>Shader Files</Filter>
</None>
<None Include="packages.config" />
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

View File

@ -0,0 +1,12 @@
# Blender 4.0.2 MTL File: 'None'
# www.blender.org
newmtl Material.001
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd red.jpg

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,7 @@ struct PlanetParams {
std::vector<PlanetParams> planets; // Список всех планет
#include <vector>
namespace texture {
GLuint earth;
GLuint clouds;
@ -49,7 +50,6 @@ namespace texture {
GLuint asteroidNormal;
}
GLuint program;
GLuint programSun;
GLuint programTex;
@ -73,6 +73,19 @@ GLuint VAO,VBO;
glm::mat4 planetMatrix = glm::mat4();
struct Vertex {
glm::vec3 position;
glm::vec3 normal;
glm::vec2 texCoords;
};
struct ModelContext {
std::vector<Vertex> vertices;
std::vector<unsigned int> indices;
GLuint VAO;
GLuint VBO;
GLuint EBO;
};
float aspectRatio = 1.f;
bool DoTheImportThing(const std::string& pFile) {
// Create an instance of the Importer class
@ -233,6 +246,7 @@ void placeObjectOnPlanet(Core::RenderContext& objectContext, glm::mat4 objectMat
}
void renderScene(GLFWwindow* window)
{
glClearColor(0.0f, 0.3f, 0.3f, 1.0f);
@ -270,7 +284,8 @@ void renderScene(GLFWwindow* window)
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);
//glfwSwapBuffers(window);
}
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
@ -294,6 +309,7 @@ void loadModelToContext2(std::string path, Core::RenderContext& context)
context.initFromAssimpMesh2(scene->mMeshes[0]);
}
void loadModelToContext(std::string path, Core::RenderContext& context)
{
Assimp::Importer import;
@ -310,6 +326,8 @@ void loadModelToContext(std::string path, Core::RenderContext& context)
}
void init(GLFWwindow* window)
{
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
@ -324,9 +342,10 @@ void init(GLFWwindow* window)
loadModelToContext("./models/sphere.obj", sphereContext);
loadModelToContext("models/plant_2.ply", plant2Context);
loadModelToContext("models/plant_4.ply", plant3Context);
loadModelToContext("./models/plants/test5.obj", plant2Context);
loadModelToContext("./models/plants/test5.obj", plant3Context);
// setupBuffers(plantContex_test);
texture::earth=Core::LoadTexture("textures/earth2.png");
texture::clouds = Core::LoadTexture("textures/clouds.jpg");
texture::moon = Core::LoadTexture("textures/moon_normals.png");
@ -337,6 +356,7 @@ void init(GLFWwindow* window)
}
void shutdown(GLFWwindow* window)
{
shaderLoader.DeleteProgram(program);
@ -384,7 +404,6 @@ void processInput(GLFWwindow* window)
void renderLoop(GLFWwindow* window) {
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();

File diff suppressed because it is too large Load Diff