final touches
This commit is contained in:
parent
75287d106e
commit
f166123a7a
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.
|
@ -2,7 +2,7 @@
|
|||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>C:\Users\Tomek\source\repos\Grafika\GrafikaProjekt\Debug\grk-cw6.exe</FullPath>
|
||||
<FullPath>C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\Debug\grk-cw6.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,2 +1,2 @@
|
|||
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.30.30705:TargetPlatformVersion=10.0.19041.0:
|
||||
Debug|Win32|C:\Users\Tomek\source\repos\Grafika\GrafikaProjekt\|
|
||||
Debug|Win32|C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\|
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1 +1,44 @@
|
|||
projekt.vcxproj -> C:\Users\Tomek\source\repos\Grafika\GrafikaProjekt\Debug\grk-cw6.exe
|
||||
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(510,5): warning MSB8028: Katalog pośredni (Debug\) zawiera pliki udostępnione z innego projektu (grk-cw6.vcxproj). Może to spowodować niepoprawne zachowanie podczas oczyszczania i ponownej kompilacji.
|
||||
Camera.cpp
|
||||
main.cpp
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\main.cpp(316,28): warning C4305: "+=": obcięcie z "double" do "float"
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\main.cpp(321,167): warning C4305: "argument": obcięcie z "double" do "float"
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\main.cpp(369,12): warning C4244: "argument": konwersja z "time_t" do "unsigned int", możliwa utrata danych
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\main.cpp(381,39): warning C4244: "=": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\main.cpp(382,37): warning C4244: "=": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\main.cpp(383,37): warning C4244: "=": konwersja z "double" do "float", możliwa utrata danych
|
||||
Render_Utils.cpp
|
||||
Shader_Loader.cpp
|
||||
Texture.cpp
|
||||
Generowanie kodu...
|
||||
image_DXT.c
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\image_helper.c(325,22): warning C4244: "inicjowanie": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\image_helper.c(366,13): warning C4244: "=": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\image_helper.c(373,20): warning C4244: "=": konwersja z "float" do "int", możliwa utrata danych
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\image_helper.c(415,13): warning C4244: "=": konwersja z "double" do "float", możliwa utrata danych
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\image_helper.c(422,20): warning C4244: "=": konwersja z "float" do "int", możliwa utrata danych
|
||||
SOIL.c
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\SOIL.c(1719,36): warning C4018: "<=": niezgodność typu ze znakiem/bez znaku
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\SOIL.c(1729,19): warning C4018: "<": niezgodność typu ze znakiem/bez znaku
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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.
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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.
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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.
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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.
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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.
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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.
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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.
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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.
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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.
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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.
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\stbi_DDS_aug_c.h(362,19): warning C4018: ">": niezgodność typu ze znakiem/bez znaku
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\stbi_DDS_aug_c.h(366,19): warning C4018: ">": niezgodność typu ze znakiem/bez znaku
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\stbi_DDS_aug_c.h(390,19): warning C4018: "<": niezgodność typu ze znakiem/bez znaku
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\src\SOIL\stbi_DDS_aug_c.h(427,19): warning C4018: "<": niezgodność typu ze znakiem/bez znaku
|
||||
C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\pliki\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...
|
||||
Camera.obj : warning LNK4075: zignorowano opcję „/EDITANDCONTINUE” z powodu określenia opcji „/INCREMENTAL:NO”
|
||||
projekt.vcxproj -> C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\Debug\scenaPodwodna.exe
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\Debug\scenaPodwodna.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
<SatelliteDlls />
|
||||
<NonRecipeFileRefs />
|
||||
</Project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.30.30705:TargetPlatformVersion=10.0.19041.0:
|
||||
Debug|Win32|C:\Users\luksli\Desktop\GrafikaProjekt\GrafikaProjekt\|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -46,7 +46,7 @@
|
|||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>grk-cw6</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>grk-cw6</ProjectName>
|
||||
<ProjectName>scenaPodwodna</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
uniform sampler2D textureSampler;
|
||||
uniform vec3 lightDir;
|
||||
uniform float alpha;
|
||||
|
||||
in vec3 interpNormal;
|
||||
in vec2 interpTexCoord;
|
||||
|
@ -13,5 +14,5 @@ void main()
|
|||
vec3 color = texture2D(textureSampler, modifiedTexCoord).rgb;
|
||||
vec3 normal = normalize(interpNormal);
|
||||
float diffuse = max(dot(normal, -lightDir), 0.0);
|
||||
gl_FragColor = mix(vec4(0.3f, 0.4f, 0.62f, 1.0f), vec4(color * diffuse, 1.0), visibility);
|
||||
gl_FragColor = vec4(mix(vec4(0.3f, 0.4f, 0.62f, 1.0f), vec4(color * diffuse, 1.0), visibility).rgb, alpha);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ Core::Shader_Loader shaderLoader;
|
|||
int random[320];
|
||||
int random2[320];
|
||||
int randomRock[65];
|
||||
float randomBubble[20];
|
||||
float bubbleSize[20];
|
||||
|
||||
Core::RenderContext shipContext;
|
||||
Core::RenderContext sphereContext;
|
||||
|
@ -38,6 +40,7 @@ Core::RenderContext plant5;
|
|||
Core::RenderContext smiglo;
|
||||
Core::RenderContext grass;
|
||||
Core::RenderContext cave;
|
||||
Core::RenderContext sphere;
|
||||
|
||||
float skyboxVertices[] = {
|
||||
-10.0f, 10.0f, -10.0f,
|
||||
|
@ -88,6 +91,7 @@ glm::vec3 cameraDir;
|
|||
glm::vec3 cameraSide;
|
||||
glm::vec3 cameraUp;
|
||||
float cameraAngle = 0;
|
||||
float bubbleLifetime[20];
|
||||
|
||||
int lastMouseX, lastMouseY, mouseX, mouseY;
|
||||
int fishMovement = 0;
|
||||
|
@ -112,13 +116,14 @@ GLuint texturePlant3;
|
|||
GLuint texturePlant4;
|
||||
GLuint texturePlant5;
|
||||
GLuint textureSmiglo;
|
||||
GLuint textureBubble;
|
||||
|
||||
|
||||
void keyboard(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
float angleSpeed = 0.1f;
|
||||
float moveSpeed = 0.4f;
|
||||
float moveSpeed = 0.03f;
|
||||
switch(key)
|
||||
{
|
||||
case 'z': cameraAngle -= angleSpeed; break;
|
||||
|
@ -140,7 +145,7 @@ void mouse(int x, int y)
|
|||
|
||||
glm::mat4 createCameraMatrix()
|
||||
{
|
||||
rotation = glm::normalize(rotation * glm::angleAxis((float)(mouseX * 0.05), cameraUp) * glm::angleAxis((float)(mouseY * 0.05), cameraSide));
|
||||
rotation = glm::normalize(rotation * glm::angleAxis((float)(mouseX * 0.03), cameraUp) * glm::angleAxis((float)(mouseY * 0.03), cameraSide));
|
||||
mouseX = mouseY = 0;
|
||||
cameraDir = glm::inverse(rotation) * glm::vec3(0, 0, -1);
|
||||
cameraSide = glm::inverse(rotation) * glm::vec3(-1, 0, 0);
|
||||
|
@ -181,13 +186,15 @@ unsigned int loadCubemap()
|
|||
return textureID;
|
||||
}
|
||||
|
||||
void drawObjectTexture(Core::RenderContext context, glm::mat4 modelMatrix, GLuint textureId)
|
||||
void drawObjectTexture(Core::RenderContext context, glm::mat4 modelMatrix, GLuint textureId, float alpha = 1.0)
|
||||
{
|
||||
GLuint program = programTexture;
|
||||
|
||||
glUseProgram(program);
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
glUniform3f(glGetUniformLocation(program, "lightDir"), lightDir.x, lightDir.y, lightDir.z);
|
||||
glUniform1f(glGetUniformLocation(program, "alpha"), alpha);
|
||||
Core::SetActiveTexture(textureId, "textureSampler", program, 0);
|
||||
|
||||
glm::mat4 transformation = perspectiveMatrix * cameraMatrix * modelMatrix;
|
||||
|
@ -195,7 +202,7 @@ void drawObjectTexture(Core::RenderContext context, glm::mat4 modelMatrix, GLuin
|
|||
glUniformMatrix4fv(glGetUniformLocation(program, "modelMatrix"), 1, GL_FALSE, (float*)&modelMatrix);
|
||||
|
||||
Core::DrawContext(context);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
|
@ -302,6 +309,19 @@ void moveFish()
|
|||
|
||||
}
|
||||
|
||||
void createBubbles(glm::mat4 smigloPos)
|
||||
{
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
bubbleLifetime[i] += 0.05;
|
||||
if (bubbleLifetime[i] >= 0.5)
|
||||
{
|
||||
bubbleLifetime[i] = 0;
|
||||
}
|
||||
drawObjectTexture(sphere, smigloPos * glm::translate(glm::vec3(randomBubble[i], bubbleLifetime[i], -0.1)) * glm::scale(glm::vec3(bubbleSize[i])), textureBubble, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
void renderScene()
|
||||
{
|
||||
// Aktualizacja macierzy widoku i rzutowania
|
||||
|
@ -319,12 +339,14 @@ void renderScene()
|
|||
|
||||
drawObjectTexture(shipContext, shipModelMatrix, textureSubmarine);
|
||||
drawObjectTexture(sphereContext, glm::translate(glm::vec3(0, -1.2, 0)), textureAsteroid);
|
||||
drawObjectTexture(smiglo, shipModelMatrix * glm::translate(glm::vec3(0, -0.3, -1)) * glm::rotate(glm::degrees((float)fishMovement), glm::vec3(0, 0, 1)), textureSmiglo);
|
||||
glm::mat4 smigloPos = shipModelMatrix* glm::translate(glm::vec3(0, -0.3, -1));
|
||||
drawObjectTexture(smiglo, smigloPos * glm::rotate(glm::degrees((float)fishMovement), glm::vec3(0, 0, 1)), textureSmiglo);
|
||||
drawObjectTexture(cave, glm::translate(glm::vec3(0, -0.6, 0)), textureAsteroid);
|
||||
|
||||
createFlora();
|
||||
createRockFlora();
|
||||
moveFish();
|
||||
createBubbles(smigloPos);
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
@ -354,7 +376,15 @@ void init()
|
|||
{
|
||||
randomRock[i] = rand() % 20 + 30;
|
||||
}
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
randomBubble[i] = (rand() % 24 - 12)/100.0;
|
||||
bubbleLifetime[i] = (rand() % 50) / 100.0;
|
||||
bubbleSize[i] = (rand() % 16 + 4) / 1000.0;
|
||||
}
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
programCubemap = shaderLoader.CreateProgram("shaders/shader_cubemap.vert", "shaders/shader_cubemap.frag");
|
||||
programTexture = shaderLoader.CreateProgram("shaders/shader_tex.vert", "shaders/shader_tex.frag");
|
||||
loadModelToContext("models/submarine1.obj", shipContext);
|
||||
|
@ -370,6 +400,7 @@ void init()
|
|||
loadModelToContext("models/cave.obj", cave);
|
||||
loadModelToContext("models/roslina4.obj", plant4);
|
||||
loadModelToContext("models/roslina5.obj", plant5);
|
||||
loadModelToContext("models/sphere.obj", sphere);
|
||||
|
||||
textureAsteroid = Core::LoadTexture("textures/rock.png");
|
||||
textureSubmarine = Core::LoadTexture("textures/sub1.png");
|
||||
|
@ -382,6 +413,7 @@ void init()
|
|||
textureSmiglo = Core::LoadTexture("textures/metal.png");
|
||||
texturePlant4 = Core::LoadTexture("textures/plant4.png");
|
||||
texturePlant5 = Core::LoadTexture("textures/plant5.png");
|
||||
textureBubble = Core::LoadTexture("textures/bubble.png");
|
||||
cubemapTexture = loadCubemap();
|
||||
|
||||
glGenVertexArrays(1, &skyboxVAO);
|
||||
|
@ -409,7 +441,7 @@ int main(int argc, char ** argv)
|
|||
glutInit(&argc, argv);
|
||||
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
|
||||
glutInitWindowPosition(200, 0);
|
||||
glutInitWindowSize(600, 600);
|
||||
glutInitWindowSize(1000, 1000);
|
||||
glutCreateWindow("Scena podwodna");
|
||||
glewInit();
|
||||
|
||||
|
|
Loading…
Reference in New Issue