modele i tekstury

This commit is contained in:
Tomasz Kaczmarek 2022-02-08 01:08:58 +01:00
parent f31ed04dd6
commit 870aec4a9a
32 changed files with 109631 additions and 14 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\Debug\grk-cw6.exe</FullPath>
<FullPath>C:\Users\Tomek\Source\Repos\GrafikaProjekt\GrafikaProjekt\Debug\grk-cw6.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />

View File

@ -1,2 +1,2 @@
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30037:VCServicingVersionCrtHeaders=14.29.30040:VCServicingVersionCompilers=14.29.30040:TargetPlatformVersion=10.0.16299.0:
Debug|Win32|C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\|
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.30.30705:TargetPlatformVersion=10.0.19041.0:
Debug|Win32|C:\Users\Tomek\Source\Repos\GrafikaProjekt\GrafikaProjekt\|

Binary file not shown.

View File

@ -1,4 +1,4 @@
 main.cpp
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\main.cpp(140,12): warning C4244: "argument": konwersja z "time_t" do "unsigned int", możliwa utrata danych
C:\Users\Tomek\source\repos\GrafikaProjekt\GrafikaProjekt\pliki\src\main.cpp(145,12): warning C4244: "argument": konwersja z "time_t" do "unsigned int", możliwa utrata danych
Camera.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
projekt.vcxproj -> C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\Debug\grk-cw6.exe
projekt.vcxproj -> C:\Users\Tomek\Source\Repos\GrafikaProjekt\GrafikaProjekt\Debug\grk-cw6.exe

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -52,14 +52,14 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">

View File

@ -18,6 +18,7 @@ Core::Shader_Loader shaderLoader;
Core::RenderContext shipContext;
Core::RenderContext sphereContext;
Core::RenderContext fishContext;
glm::vec3 cameraPos = glm::vec3(0, 0, 5);
glm::vec3 cameraDir; // Wektor "do przodu" kamery
@ -34,12 +35,14 @@ glm::vec3 lightDir = glm::normalize(glm::vec3(1.0f, -0.9f, -1.0f));
glm::quat rotation = glm::quat(1, 0, 0, 0);
GLuint textureAsteroid;
GLuint textureSubmarine;
GLuint textureFish1;
void keyboard(unsigned char key, int x, int y)
{
float angleSpeed = 0.1f;
float moveSpeed = 0.1f;
float moveSpeed = 0.01f;
switch(key)
{
case 'z': cameraAngle -= angleSpeed; break;
@ -113,11 +116,13 @@ void renderScene()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.0f, 0.2f, 0.5f, 1.0f);
glm::mat4 shipInitialTransformation = glm::translate(glm::vec3(0,-0.25f,0)) * glm::rotate(glm::radians(180.0f), glm::vec3(0,1,0)) * glm::scale(glm::vec3(0.25f));
glm::mat4 shipInitialTransformation = glm::translate(glm::vec3(0,0,0)) * glm::rotate(glm::radians(180.0f), glm::vec3(0,1,0)) * glm::scale(glm::vec3(0.25f));
glm::mat4 shipModelMatrix = glm::translate(cameraPos + cameraDir * 0.5f) * glm::mat4_cast(glm::inverse(rotation)) * shipInitialTransformation;
drawObjectColor(shipContext, shipModelMatrix, glm::vec3(0.6f));
//drawObjectColor(shipContext, shipModelMatrix, glm::vec3(0.6f));
drawObjectTexture(sphereContext, glm::translate(glm::vec3(0,0,0)), textureAsteroid);
drawObjectTexture(shipContext, shipModelMatrix, textureSubmarine);
drawObjectTexture(sphereContext, glm::translate(glm::vec3(0, -1.2, 0)), textureAsteroid);
drawObjectTexture(fishContext, glm::translate(glm::vec3(0, 0, 0)), textureFish1);
glutSwapBuffers();
}
@ -141,9 +146,11 @@ void init()
glEnable(GL_DEPTH_TEST);
programColor = shaderLoader.CreateProgram("shaders/shader_color.vert", "shaders/shader_color.frag");
programTexture = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
loadModelToContext("models/spaceship.obj", shipContext);
loadModelToContext("models/sphere.obj", sphereContext);
textureAsteroid = Core::LoadTexture("textures/asteroid.png");
loadModelToContext("models/submarine.obj", shipContext);
loadModelToContext("models/teren1.obj", sphereContext);
loadModelToContext("models/fish1.obj", fishContext);
textureAsteroid = Core::LoadTexture("textures/sub.png");
textureSubmarine = Core::LoadTexture("textures/sub.png");
}
void shutdown()

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 MiB