This commit is contained in:
Dominik Piasecki 2024-01-11 23:37:20 +01:00
parent 66915f4ff7
commit a7af8150db
40 changed files with 30995 additions and 64 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,23 +1,25 @@
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\vc142.pdb d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\vc143.pdb
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\vc142.idb d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\vc143.idb
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\texture.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\main.obj
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\shader_loader.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\texture.obj
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\render_utils.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\shader_loader.obj
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\main.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\render_utils.obj
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\camera.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\camera.obj
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\box.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\box.obj
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\stb_image_aug.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\stb_image_aug.obj
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\soil.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\image_helper.obj
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\image_helper.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\image_dxt.obj
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\image_dxt.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\soil.obj
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\vcpkg.applocal.log c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\vcpkg.applocal.log
c:\users\andrzej\desktop\grk\2021\grk glfw test\debug\grk-cw6.exe d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\debug\grk-cw6.exe
c:\users\andrzej\desktop\grk\2021\grk glfw test\debug\grk-cw6.pdb d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\debug\grk-cw6.pdb
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\main_3_1.obj d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\vc142.idb
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\grk-cw6.tlog\cl.command.1.tlog d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\vc142.pdb
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\grk-cw6.tlog\cl.read.1.tlog d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\grk-cw6.tlog\cl.command.1.tlog
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\grk-cw6.tlog\cl.write.1.tlog d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\grk-cw6.tlog\cl.items.tlog
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\grk-cw6.tlog\grk-cw6.write.1u.tlog d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\grk-cw6.tlog\cl.read.1.tlog
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\grk-cw6.tlog\link.command.1.tlog d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\grk-cw6.tlog\cl.write.1.tlog
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\grk-cw6.tlog\link.read.1.tlog d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\grk-cw6.tlog\grk-cw6.write.1u.tlog
c:\users\andrzej\desktop\grk\2021\grk glfw test\cw 6\debug\grk-cw6.tlog\link.write.1.tlog d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\grk-cw6.tlog\link.command.1.tlog
d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\grk-cw6.tlog\link.read.1.tlog
d:\dane\cppprojects\grk_cw1 (1)\planetcreator\planetcreator\cw 6\debug\grk-cw6.tlog\link.write.1.tlog

View File

@ -1,44 +1,9 @@
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(531,5): warning MSB8028: Katalog pośredni (Debug\) zawiera pliki udostępnione z innego projektu (grk-cw3.vcxproj, grk-cw4.vcxproj, grk-cw5.vcxproj). Może to spowodować niepoprawne zachowanie podczas oczyszczania i ponownej kompilacji. C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(531,5): warning MSB8028: Katalog pośredni (Debug\) zawiera pliki udostępnione z innego projektu (grk-cw3.vcxproj, grk-cw4.vcxproj, grk-cw5.vcxproj). Może to spowodować niepoprawne zachowanie podczas oczyszczania i ponownej kompilacji.
Box.cpp
Camera.cpp
main.cpp main.cpp
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\shared\minwindef.h(130,1): warning C4005: "APIENTRY": ponowna definicja makra
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): message : zobacz poprzednią definicję „APIENTRY” D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123,1): message : zobacz poprzednią definicję „APIENTRY”
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(70,10): warning C4305: "inicjowanie": obcięcie z "double" do "float" D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(88,10): warning C4305: "inicjowanie": obcięcie z "double" do "float"
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(119,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\ex_6_1.hpp(149,13): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
Render_Utils.cpp
Shader_Loader.cpp
Texture.cpp
Generowanie kodu...
image_DXT.c
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\image_DXT.c(92,9): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
image_helper.c
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\image_helper.c(325,17): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\image_helper.c(366,13): warning C4244: "=": konwersja z "double" do "float", możliwa utrata danych
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\image_helper.c(373,20): warning C4244: "=": konwersja z "float" do "int", możliwa utrata danych
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\image_helper.c(415,13): warning C4244: "=": konwersja z "double" do "float", możliwa utrata danych
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\image_helper.c(422,20): warning C4244: "=": konwersja z "float" do "int", możliwa utrata danych
SOIL.c
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\SOIL.c(1719,36): warning C4018: "<=": niezgodność typu ze znakiem/bez znaku
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\SOIL.c(1729,19): warning C4018: "<": niezgodność typu ze znakiem/bez znaku
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\SOIL.c(1841,6): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
stb_image_aug.c
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c(177,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c(251,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c(303,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c(1557,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c(2394,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c(2709,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c(2995,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c(3209,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c(3548,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stb_image_aug.c(3644,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stbi_DDS_aug_c.h(362,19): warning C4018: ">": niezgodność typu ze znakiem/bez znaku
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stbi_DDS_aug_c.h(366,19): warning C4018: ">": niezgodność typu ze znakiem/bez znaku
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stbi_DDS_aug_c.h(390,19): warning C4018: "<": niezgodność typu ze znakiem/bez znaku
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stbi_DDS_aug_c.h(427,19): warning C4018: "<": niezgodność typu ze znakiem/bez znaku
D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\cw 6\src\SOIL\stbi_DDS_aug_c.h(498,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
Generowanie kodu...
Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO” Box.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka LINK : warning LNK4098: domyślna biblioteka „MSVCRT” powoduje konflikt z innymi bibliotekami; użyj opcji /NODEFAULTLIB:biblioteka
grk-cw6.vcxproj -> D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\Debug\grk-cw6.exe grk-cw6.vcxproj -> D:\DANE\CppProjects\grk_cw1 (1)\PlanetCreator\PlanetCreator\Debug\grk-cw6.exe

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -47,6 +47,8 @@
<None Include="shaders\shader_5_1_tex.vert" /> <None Include="shaders\shader_5_1_tex.vert" />
<None Include="shaders\shader_5_sun.frag" /> <None Include="shaders\shader_5_sun.frag" />
<None Include="shaders\shader_5_sun.vert" /> <None Include="shaders\shader_5_sun.vert" />
<None Include="shaders\shader_biomes.frag" />
<None Include="shaders\shader_biomes.vert" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{3952C396-B1C6-44CD-96DD-C1AC15D32978}</ProjectGuid> <ProjectGuid>{3952C396-B1C6-44CD-96DD-C1AC15D32978}</ProjectGuid>

View File

@ -109,5 +109,11 @@
<None Include="shaders\shader_5_1_tex.frag"> <None Include="shaders\shader_5_1_tex.frag">
<Filter>Shader Files</Filter> <Filter>Shader Files</Filter>
</None> </None>
<None Include="shaders\shader_biomes.frag">
<Filter>Shader Files</Filter>
</None>
<None Include="shaders\shader_biomes.vert">
<Filter>Shader Files</Filter>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
ply
format ascii 1.0
comment author
comment File Generated with PlantGL 3D Viewer
element vertex 8
property float x
property float y
property float z
element face 6
property list uchar_t int vertex_indices
end_header
0 0 0
0 0.866025 -0.5
0 -1.73205 -1
0 -2.59808 1.5
0 0 5
0 2.59808 1.5
0 1.73205 -1
0 -0.866025 -0.5
3 0 1 2
3 0 2 3
3 0 3 4
3 0 4 5
3 0 5 6
3 0 6 7

View File

@ -0,0 +1,18 @@
#version 430 core
float AMBIENT = 0.1;
uniform vec3 lightPos;
in vec3 vecNormal;
in vec3 worldPos;
vec3 color;
out vec4 outColor;
void main()
{
vec3 lightDir = normalize(lightPos-worldPos);
vec3 normal = normalize(vecNormal);
float diffuse=max(0,dot(normal,lightDir));
color=vec3(vecNormal.x,vecNormal.y,vecNormal.z);
outColor = vec4(color, 1.0);
}

View File

@ -0,0 +1,18 @@
#version 430 core
layout(location = 0) in vec3 vertexPosition;
layout(location = 1) in vec3 vertexNormal;
layout(location = 2) in vec2 vertexTexCoord;
uniform mat4 transformation;
uniform mat4 modelMatrix;
out vec3 vecNormal;
out vec3 worldPos;
void main()
{
worldPos = (modelMatrix* vec4(vertexPosition,1)).xyz;
vecNormal = (modelMatrix* vec4(vertexNormal,0)).xyz;
gl_Position = transformation * vec4(vertexPosition, 1.0);
}

View File

@ -4,7 +4,9 @@
#include "ext.hpp" #include "ext.hpp"
#include <iostream> #include <iostream>
#include <cmath> #include <cmath>
#include <assimp/Importer.hpp> // C++ importer interface
#include <assimp/scene.h> // Output data structure
#include <assimp/postprocess.h> // Post processing flags
#include "Shader_Loader.h" #include "Shader_Loader.h"
#include "Render_Utils.h" #include "Render_Utils.h"
#include "Texture.h" #include "Texture.h"
@ -33,8 +35,10 @@ namespace texture {
GLuint program; GLuint program;
GLuint programSun; GLuint programSun;
GLuint programTex; GLuint programTex;
GLuint programBiomes;
Core::Shader_Loader shaderLoader; Core::Shader_Loader shaderLoader;
Core::RenderContext plantContext;
Core::RenderContext shipContext; Core::RenderContext shipContext;
Core::RenderContext sphereContext; Core::RenderContext sphereContext;
@ -46,7 +50,21 @@ glm::vec3 spaceshipDir = glm::vec3(1.f, 0.f, 0.f);
GLuint VAO,VBO; GLuint VAO,VBO;
float aspectRatio = 1.f; float aspectRatio = 1.f;
bool DoTheImportThing(const std::string& pFile) {
// Create an instance of the Importer class
Assimp::Importer importer;
// And have it read the given file with some example postprocessing
// Usually - if speed is not the most important aspect for you - you'll
// probably to request more postprocessing than we do in this example.
const aiScene* scene = importer.ReadFile(pFile,
aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType);
return scene;
}
glm::mat4 createCameraMatrix() glm::mat4 createCameraMatrix()
{ {
glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir,glm::vec3(0.f,1.f,0.f))); glm::vec3 cameraSide = glm::normalize(glm::cross(cameraDir,glm::vec3(0.f,1.f,0.f)));
@ -96,6 +114,18 @@ void drawObjectColor(Core::RenderContext& context, glm::mat4 modelMatrix, glm::v
Core::DrawContext(context); Core::DrawContext(context);
glUseProgram(0); glUseProgram(0);
}
void drawObjectBiomes(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint program) {
GLuint prog = program;
glUseProgram(prog);
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(prog, "transformation"), 1, GL_FALSE, (float*)&transformation);
glUniformMatrix4fv(glGetUniformLocation(prog, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
glUniform3f(glGetUniformLocation(prog, "lightPos"), 0, 0, 0);
Core::DrawContext(context);
glUseProgram(0);
} }
void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint program) { void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint textureID, GLuint program) {
program; program;
@ -120,9 +150,8 @@ void renderScene(GLFWwindow* window)
drawObjectColor(sphereContext, glm::mat4(),glm::vec3(1,1,0),programSun); //drawObjectBiomes(sphereContext, glm::mat4(), programBiomes);
drawObjectTexture(sphereContext, glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::scale(glm::vec3(0.3f)),texture::earth, programTex); drawObjectBiomes(plantContext, glm::mat4(), programBiomes);
drawObjectTexture(sphereContext,glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)),texture::moon, programTex);
glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f))); glm::vec3 spaceshipSide = glm::normalize(glm::cross(spaceshipDir, glm::vec3(0.f, 1.f, 0.f)));
glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir)); glm::vec3 spaceshipUp = glm::normalize(glm::cross(spaceshipSide, spaceshipDir));
@ -147,7 +176,22 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{ {
aspectRatio = width / float(height); aspectRatio = width / float(height);
glViewport(0, 0, width, height); glViewport(0, 0, width, height);
} }
//TODO :REMOVE THIS
void loadModelToContext2(std::string path, Core::RenderContext& context)
{
Assimp::Importer import;
const aiScene* scene = import.ReadFile(path, aiProcess_Triangulate| aiProcess_FindInvalidData);
if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode)
{
std::cout << "ERROR::ASSIMP::" << import.GetErrorString() << std::endl;
return;
}
context.initFromAssimpMesh(scene->mMeshes[0]);
}
void loadModelToContext(std::string path, Core::RenderContext& context) void loadModelToContext(std::string path, Core::RenderContext& context)
{ {
Assimp::Importer import; Assimp::Importer import;
@ -169,8 +213,11 @@ void init(GLFWwindow* window)
program = shaderLoader.CreateProgram("shaders/shader_5_1.vert", "shaders/shader_5_1.frag"); program = shaderLoader.CreateProgram("shaders/shader_5_1.vert", "shaders/shader_5_1.frag");
programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag"); programTex = shaderLoader.CreateProgram("shaders/shader_5_1_tex.vert", "shaders/shader_5_1_tex.frag");
programSun = shaderLoader.CreateProgram("shaders/shader_5_sun.vert", "shaders/shader_5_sun.frag"); programSun = shaderLoader.CreateProgram("shaders/shader_5_sun.vert", "shaders/shader_5_sun.frag");
programBiomes = shaderLoader.CreateProgram("shaders/shader_biomes.vert", "shaders/shader_biomes.frag");
loadModelToContext("./models/sphere.obj", sphereContext); loadModelToContext("./models/sphere.obj", sphereContext);
loadModelToContext("./models/spaceship.obj", shipContext); loadModelToContext("./models/spaceship.obj", shipContext);
loadModelToContext2("./models/plants/test_polygon_1.ply",plantContext);
texture::earth=Core::LoadTexture("textures/earth2.png"); texture::earth=Core::LoadTexture("textures/earth2.png");
texture::clouds = Core::LoadTexture("textures/clouds.jpg"); texture::clouds = Core::LoadTexture("textures/clouds.jpg");
texture::moon = Core::LoadTexture("textures/moon_normals.png"); texture::moon = Core::LoadTexture("textures/moon_normals.png");