importing ply objects
This commit is contained in:
parent
0beb51445f
commit
0d4cfed3be
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.
@ -2,8 +2,8 @@
|
||||
main.cpp
|
||||
C:\Windows Kits\10\Include\10.0.22000.0\shared\minwindef.h(130,1): warning C4005: APIENTRY: изменение макроопределения
|
||||
C:\Users\neryt\OneDrive\Рабочий стол\Grafika2023\PlanetCreator\dependencies\glfw-3.3.8.bin.WIN32\include\GLFW\glfw3.h(123): message : см. предыдущее определение "APIENTRY"
|
||||
C:\Users\neryt\OneDrive\Рабочий стол\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(69,16): warning C4305: инициализация: усечение из "double" в "float"
|
||||
C:\Users\neryt\OneDrive\Рабочий стол\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(128,13): warning C4244: инициализация: преобразование "double" в "float", возможна потеря данных
|
||||
C:\Users\neryt\OneDrive\Рабочий стол\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(72,16): warning C4305: инициализация: усечение из "double" в "float"
|
||||
C:\Users\neryt\OneDrive\Рабочий стол\Grafika2023\PlanetCreator\cw 6\src\ex_6_1.hpp(131,13): warning C4244: инициализация: преобразование "double" в "float", возможна потеря данных
|
||||
Box.obj : warning LNK4075: не учитывается "/EDITANDCONTINUE" из-за спецификации "/INCREMENTAL:NO"
|
||||
LINK : warning LNK4098: библиотека по умолчанию "MSVCRT" конфликтует с использованием других библиотек; используйте /NODEFAULTLIB:library
|
||||
grk-cw6.vcxproj -> C:\Users\neryt\OneDrive\Рабочий стол\Grafika2023\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.
Binary file not shown.
Binary file not shown.
BIN
PlanetCreator/cw 6/models/plant_2.ply
Normal file
BIN
PlanetCreator/cw 6/models/plant_2.ply
Normal file
Binary file not shown.
BIN
PlanetCreator/cw 6/models/plant_4.ply
Normal file
BIN
PlanetCreator/cw 6/models/plant_4.ply
Normal file
Binary file not shown.
@ -33,11 +33,14 @@ namespace texture {
|
||||
GLuint program;
|
||||
GLuint programSun;
|
||||
GLuint programTex;
|
||||
|
||||
GLuint plantProgram;
|
||||
Core::Shader_Loader shaderLoader;
|
||||
|
||||
|
||||
Core::RenderContext sphereContext;
|
||||
|
||||
Core::RenderContext plant2Context;
|
||||
Core::RenderContext plant3Context;
|
||||
glm::vec3 cameraPos = glm::vec3(-4.f, 0, 0);
|
||||
glm::vec3 cameraDir = glm::vec3(1.f, 0.f, 0.f);
|
||||
|
||||
@ -129,13 +132,17 @@ void renderScene(GLFWwindow* window)
|
||||
|
||||
|
||||
|
||||
drawObjectColor(sphereContext, glm::mat4(),glm::vec3(1,1,0), programSun);
|
||||
drawObjectColor(sphereContext, glm::mat4(), glm::vec3(1, 1, 0), programSun);
|
||||
drawObjectTexture(sphereContext, glm::translate(glm::vec3(0.f, 0, -3.f)) * glm::scale(glm::vec3(0.6f)), texture::planet1, programTex);
|
||||
drawObjectTexture(sphereContext, glm::translate(glm::vec3(0.f, 0, 3.f)) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.6f)), texture::moon, programTex);
|
||||
|
||||
glm::vec3 plantPosition = glm::vec3(1.f, 0.f, 3.5f) ;
|
||||
float scaleFactor = 0.1f;
|
||||
glm::mat4 plantModelMatrix = glm::translate(plantPosition) * glm::scale(glm::vec3(scaleFactor));
|
||||
|
||||
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)
|
||||
@ -153,7 +160,10 @@ void loadModelToContext(std::string path, Core::RenderContext& context)
|
||||
std::cout << "ERROR::ASSIMP::" << import.GetErrorString() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
context.initFromAssimpMesh(scene->mMeshes[0]);
|
||||
|
||||
}
|
||||
|
||||
void init(GLFWwindow* window)
|
||||
@ -165,12 +175,17 @@ void init(GLFWwindow* window)
|
||||
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");
|
||||
loadModelToContext("./models/sphere.obj", sphereContext);
|
||||
// plantProgram = shaderLoader.CreateProgram("shaders/plant_vertex_shader.vert", "shaders/plant_fragment_shader.frag");
|
||||
|
||||
loadModelToContext("models/plant_2.ply", plant2Context);
|
||||
loadModelToContext("models/plant_4.ply", plant3Context);
|
||||
|
||||
texture::earth=Core::LoadTexture("textures/earth2.png");
|
||||
texture::clouds = Core::LoadTexture("textures/clouds.jpg");
|
||||
texture::moon = Core::LoadTexture("textures/moon_normals.png");
|
||||
texture::grid = Core::LoadTexture("textures/grid.png");
|
||||
texture::planet1 = Core::LoadTexture("textures/tek_1.jpg");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user