diff --git a/Template/log.txt b/Template/log.txt index 06b12fe..93edda9 100644 --- a/Template/log.txt +++ b/Template/log.txt @@ -1,108 +1,133 @@ -2024-Jun-08 23:23:28: Log started -2024-Jun-08 23:23:28: OpenGL Window created -2024-Jun-08 23:23:28: Script manager ready -2024-Jun-08 23:23:28: Render::OpenGL glVersion = 4.6.0 - Build 31.0.101.4887 -2024-Jun-08 23:23:28: Render::OpenGL glVersion above 2.0 ok -2024-Jun-08 23:23:28: Render::OpenGL GL_ARB_framebuffer_object supported ok -2024-Jun-08 23:23:28: Render::OpenGL GL_ARB_uniform_buffer_object supported ok -2024-Jun-08 23:23:28: Prepare to add shader GUI -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: Log started +2024-Jun-09 01:08:21: OpenGL Window created +2024-Jun-09 01:08:21: Script manager ready +2024-Jun-09 01:08:21: Render::OpenGL glVersion = 4.6.0 - Build 31.0.101.4887 +2024-Jun-09 01:08:21: Render::OpenGL glVersion above 2.0 ok +2024-Jun-09 01:08:21: Render::OpenGL GL_ARB_framebuffer_object supported ok +2024-Jun-09 01:08:21: Render::OpenGL GL_ARB_uniform_buffer_object supported ok +2024-Jun-09 01:08:21: Prepare to add shader GUI +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: Shader program is - 3 -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader -2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: GUI -2024-Jun-08 23:23:28: Prepare to add shader Parallax -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: Shader program is - 3 +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader +2024-Jun-09 01:08:21: ResourceManager::ShaderManager shader loaded: GUI +2024-Jun-09 01:08:21: Prepare to add shader Parallax +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing WARNING: 0:27: 'assign' : implicit type conversion allowed from GLSL 1.20 WARNING: 0:27: 'assign' : implicit type conversion allowed from GLSL 1.20 WARNING: 0:27: 'assign' : implicit type conversion allowed -2024-Jun-08 23:23:28: Shader program is - 6 -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader -2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Parallax -2024-Jun-08 23:23:28: Prepare to add shader Directlight -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: Shader program is - 6 +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader +2024-Jun-09 01:08:21: ResourceManager::ShaderManager shader loaded: Parallax +2024-Jun-09 01:08:21: Prepare to add shader Directlight +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: Shader program is - 9 -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader -2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Directlight -2024-Jun-08 23:23:28: Prepare to add shader Env -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: Shader program is - 9 +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader +2024-Jun-09 01:08:21: ResourceManager::ShaderManager shader loaded: Directlight +2024-Jun-09 01:08:21: Prepare to add shader Env +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: Shader program is - 12 -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader -2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Env -2024-Jun-08 23:23:28: Prepare to add shader Water -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: Shader program is - 12 +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader +2024-Jun-09 01:08:21: ResourceManager::ShaderManager shader loaded: Env +2024-Jun-09 01:08:21: Prepare to add shader EnvReverse +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: Shader program is - 15 -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader -2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Water -2024-Jun-08 23:23:28: Prepare to add shader Frame -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: Shader program is - 15 +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader +2024-Jun-09 01:08:21: ResourceManager::ShaderManager shader loaded: EnvReverse +2024-Jun-09 01:08:21: Prepare to add shader Water +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +WARNING: 0:29: 'assign' : implicit type conversion allowed from GLSL 1.20 -2024-Jun-08 23:23:28: Shader program is - 18 -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader -2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Frame -2024-Jun-08 23:23:28: Prepare to add shader Lightview -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:5: '' : #version directive missing +2024-Jun-09 01:08:21: Shader program is - 18 +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader +2024-Jun-09 01:08:21: ResourceManager::ShaderManager shader loaded: Water +2024-Jun-09 01:08:21: Prepare to add shader Frame +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: Shader program is - 21 -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader -2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Lightview -2024-Jun-08 23:23:28: Prepare to add shader Simple3D -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: Shader program is - 21 +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader +2024-Jun-09 01:08:21: ResourceManager::ShaderManager shader loaded: Frame +2024-Jun-09 01:08:21: Prepare to add shader Lightview +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:5: '' : #version directive missing -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-08 23:23:28: Shader program is - 24 -2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader -2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Simple3D -2024-Jun-08 23:23:28: ResourceManager::TexList Texture added: bt_box_yellow.bmp with id = 1 -2024-Jun-08 23:23:28: ResourceManager::TexList Texture added: bt_box_norm.bmp32 with id = 2 -2024-Jun-08 23:23:28: Lite model added successfully: models/bt_box_yellow.lm1 -2024-Jun-08 23:23:28: ResourceManager::TexList Texture added: bt_cone.bmp with id = 3 -2024-Jun-08 23:23:28: Lite model added successfully: models/bt_cone.lm1 -2024-Jun-08 23:23:28: Lite model added successfully: models/girl.lm1 -2024-Jun-08 23:23:29: Lite model added successfully: models/bonemodel.lm1 -2024-Jun-08 23:23:30: ResourceManager::TexList Texture added: out.bmp with id = 4 -2024-Jun-08 23:23:30: FrameManager:: frame buffer added: Skybox -2024-Jun-08 23:23:30: ResourceManager::TexList Texture added: normalmap.bmp with id = 6 -2024-Jun-08 23:23:30: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/posx.bmp -2024-Jun-08 23:23:30: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/negx.bmp -2024-Jun-08 23:23:30: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/posy.bmp -2024-Jun-08 23:23:30: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/negy.bmp -2024-Jun-08 23:23:30: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/posz.bmp -2024-Jun-08 23:23:30: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/negz.bmp -2024-Jun-08 23:23:30: ResourceManager::TexList texture added succesfuly: posx.bmp -2024-Jun-08 23:23:30: FrameManager:: frame buffer added: ScreenBlur -2024-Jun-08 23:23:30: FrameManager:: frame buffer added: ShadowBufferGlobal -2024-Jun-08 23:23:30: FrameManager:: frame buffer added: ShadowBufferLocal +2024-Jun-09 01:08:21: Shader program is - 24 +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader +2024-Jun-09 01:08:21: ResourceManager::ShaderManager shader loaded: Lightview +2024-Jun-09 01:08:21: Prepare to add shader Simple3D +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing + + +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing + + +2024-Jun-09 01:08:21: Shader program is - 27 +2024-Jun-09 01:08:21: ResourceManager::ShaderManager::Shader +2024-Jun-09 01:08:21: ResourceManager::ShaderManager shader loaded: Simple3D +2024-Jun-09 01:08:21: ResourceManager::TexList Texture added: bt_box_yellow.bmp with id = 1 +2024-Jun-09 01:08:21: ResourceManager::TexList Texture added: bt_box_norm.bmp32 with id = 2 +2024-Jun-09 01:08:21: Lite model added successfully: models/bt_box_yellow.lm1 +2024-Jun-09 01:08:21: ResourceManager::TexList Texture added: bt_cone.bmp with id = 3 +2024-Jun-09 01:08:21: Lite model added successfully: models/bt_cone.lm1 +2024-Jun-09 01:08:22: Lite model added successfully: models/girl.lm1 +2024-Jun-09 01:08:22: Lite model added successfully: models/bonemodel.lm1 +2024-Jun-09 01:08:23: ResourceManager::TexList Texture added: out.bmp with id = 4 +2024-Jun-09 01:08:23: FrameManager:: frame buffer added: Skybox +2024-Jun-09 01:08:23: ResourceManager::TexList Texture added: normalmap.bmp with id = 6 +2024-Jun-09 01:08:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posx.bmp +2024-Jun-09 01:08:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negx.bmp +2024-Jun-09 01:08:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posy.bmp +2024-Jun-09 01:08:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negy.bmp +2024-Jun-09 01:08:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posz.bmp +2024-Jun-09 01:08:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negz.bmp +2024-Jun-09 01:08:23: ResourceManager::TexList texture added succesfuly: posx.bmp +2024-Jun-09 01:08:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_rt.bmp +2024-Jun-09 01:08:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_lf.bmp +2024-Jun-09 01:08:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_dn.bmp +2024-Jun-09 01:08:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_up.bmp +2024-Jun-09 01:08:24: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_bk.bmp +2024-Jun-09 01:08:24: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_ft.bmp +2024-Jun-09 01:08:24: ResourceManager::TexList texture added succesfuly: yavin_rt.bmp +2024-Jun-09 01:08:24: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_rt.bmp +2024-Jun-09 01:08:24: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_lf.bmp +2024-Jun-09 01:08:24: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_up.bmp +2024-Jun-09 01:08:24: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_dn.bmp +2024-Jun-09 01:08:24: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_bk.bmp +2024-Jun-09 01:08:24: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_ft.bmp +2024-Jun-09 01:08:25: ResourceManager::TexList texture added succesfuly: space_rt.bmp +2024-Jun-09 01:08:25: FrameManager:: frame buffer added: ScreenBlur +2024-Jun-09 01:08:25: FrameManager:: frame buffer added: ShadowBufferGlobal +2024-Jun-09 01:08:25: FrameManager:: frame buffer added: ShadowBufferLocal diff --git a/Template/main.cpp b/Template/main.cpp index 6d658d3..3c9089c 100644 --- a/Template/main.cpp +++ b/Template/main.cpp @@ -13,42 +13,54 @@ void TMyApplication::DrawToCubemap() Renderer->PushShader("Directlight"); Renderer->SwitchToCubemapBuffer("Skybox",0); - Renderer->SetGlPosXView(true); - DrawSceneWithoutWater(); + Renderer->SetGlPosXView(false, true); + DrawCubemapDay(); + Renderer->SetGlPosXView(true, true); + GameMap.DrawVBO(); //glClearColor() //glClearColor(1.0f, 0.0f, 0.0f, 1.0f); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); Renderer->SwitchToCubemapBuffer("Skybox",1); - Renderer->SetGlNegXView(true); + Renderer->SetGlNegXView(false, true); + DrawCubemapDay(); + Renderer->SetGlNegXView(true, true); //glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - DrawSceneWithoutWater(); + GameMap.DrawVBO(); Renderer->SwitchToCubemapBuffer("Skybox",2); - Renderer->SetGlPosYView(true); - DrawSceneWithoutWater(); + Renderer->SetGlPosYView(false, true); + DrawCubemapDay(); + Renderer->SetGlPosYView(true, true); + GameMap.DrawVBO(); //glClearColor(0.0f, 1.0f, 0.0f, 1.0f); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); Renderer->SwitchToCubemapBuffer("Skybox",3); - Renderer->SetGlNegYView(true); + Renderer->SetGlNegYView(false, true); + DrawCubemapDay(); + Renderer->SetGlNegYView(true, true); //glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - DrawSceneWithoutWater(); + GameMap.DrawVBO(); Renderer->SwitchToCubemapBuffer("Skybox",4); - Renderer->SetGlPosZView(true); - DrawSceneWithoutWater(); + Renderer->SetGlPosZView(false, true); + DrawCubemapDay(); + Renderer->SetGlPosZView(true, true); + GameMap.DrawVBO(); //glClearColor(0.0f, 0.0f, 1.0f, 1.0f); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); Renderer->SwitchToCubemapBuffer("Skybox",5); - Renderer->SetGlNegZView(true); + Renderer->SetGlNegZView(false, true); + DrawCubemapDay(); + Renderer->SetGlNegZView(true, true); //glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - DrawSceneWithoutWater(); + GameMap.DrawVBO(); Renderer->SwitchToScreen(); @@ -71,6 +83,9 @@ void TMyApplication::DrawToShadowMap() void TMyApplication::DrawSceneWithoutWater() { + Renderer->SetGLCamAngleView(); + DrawCubemapDay(); + Renderer->SetGLCamView(); GameMap.DrawVBO(); } @@ -122,6 +137,29 @@ void TMyApplication::DrawCubemap() Renderer->PopShader(); } +void TMyApplication::DrawCubemapDay() +{ + Renderer->PushShader("EnvReverse"); + //Renderer->SetGLCamAngleView(); + //Renderer->SetGLCamAngleView(); + //Renderer->LoadIdentity(); + RenderUniformMatrix3fv(CONST_STRING_MODELROTATEMATRIX_UNIFORM, false, (float*)IdentityMatrix.m); + RenderUniform3fv(CONST_STRING_MODELTRANSLATEVECTOR_UNIFORM, (float*)ZeroVec3.v); + + //glBindTexture(GL_TEXTURE_CUBE_MAP, ResourceManager->FrameManager.GetFrameTexture("Skybox")); + glBindTexture(GL_TEXTURE_CUBE_MAP, cubemapTextureDay); + + EnableVertexAttribArray("vPosition"); + + DrawVertexDataStruct(cubemapVertexDataStruct); + + DisableVertexAttribArray("vPosition"); + + glClear(GL_DEPTH_BUFFER_BIT); + + Renderer->PopShader(); +} + //What to do on init void TMyApplication::InnerInit() { @@ -134,6 +172,7 @@ void TMyApplication::InnerInit() ResourceManager->ShaderManager.AddShader("Parallax", "shaders/directlight_parallax_shadow.vertex", "shaders/directlight_parallax_shadow.fragment"); ResourceManager->ShaderManager.AddShader("Directlight", "shaders/directlight.vertex", "shaders/directlight.fragment"); ResourceManager->ShaderManager.AddShader("Env", "shaders/env.vertex", "shaders/env.fragment"); + ResourceManager->ShaderManager.AddShader("EnvReverse", "shaders/env_reverse.vertex", "shaders/env_reverse.fragment"); ResourceManager->ShaderManager.AddShader("Water", "shaders/water.vertex", "shaders/water.fragment"); ResourceManager->ShaderManager.AddShader("Frame", "shaders/frame.vertex", "shaders/frame.fragment"); ResourceManager->ShaderManager.AddShader("Lightview", "shaders/lightview.vertex", "shaders/lightview.fragment"); @@ -168,17 +207,31 @@ void TMyApplication::InnerInit() //ResourceManager->LightManager.SetLightPos(0, vec4(-len * cos(pi/4), len * sin(pi/4), 0.0f, 0.0f)); - ResourceManager->FrameManager.AddCubemapBuffer("Skybox",256,256); + ResourceManager->FrameManager.AddCubemapBuffer("Skybox",512,512); Renderer->SetBackgroundCubemap(ResourceManager->FrameManager.GetFrameTexture("Skybox")); ResourceManager->TexList.AddTexture("../resources/normalmap.bmp"); std::array cubemapTextureStr = { - "../resources/posx.bmp", "../resources/negx.bmp", "../resources/posy.bmp", "../resources/negy.bmp", "../resources/posz.bmp", "../resources/negz.bmp" + "../resources/sky/posx.bmp", "../resources/sky/negx.bmp", "../resources/sky/posy.bmp", "../resources/sky/negy.bmp", "../resources/sky/posz.bmp", "../resources/sky/negz.bmp" }; cubemapTexture = ResourceManager->TexList.AddCubemapTexture(cubemapTextureStr); + + //!!!! for some reason up and down switched + std::array cubemapTextureDayStr = { + "../resources/sky/yavin_rt.bmp", "../resources/sky/yavin_lf.bmp", "../resources/sky/yavin_dn.bmp", "../resources/sky/yavin_up.bmp", "../resources/sky/yavin_bk.bmp", "../resources/sky/yavin_ft.bmp" + }; + + + cubemapTextureDay = ResourceManager->TexList.AddCubemapTexture(cubemapTextureDayStr); + + std::array cubemapTextureNightStr = { + "../resources/sky/space_rt.bmp", "../resources/sky/space_lf.bmp", "../resources/sky/space_up.bmp", "../resources/sky/space_dn.bmp", "../resources/sky/space_bk.bmp", "../resources/sky/space_ft.bmp" + }; + + cubemapTextureNight = ResourceManager->TexList.AddCubemapTexture(cubemapTextureNightStr); //."posx.bmp","negx.bmp","posy.bmp","negy.bmp","posz.bmp","negz.bmp" ResourceManager->FrameManager.AddFrameRenderBuffer("ScreenBlur", 512, 512); @@ -358,15 +411,17 @@ void TMyApplication::InnerDraw() Renderer->PushShader("Directlight"); + //DrawCubemapDay(); DrawToCubemap(); //Renderer->SwitchToCubemapBuffer("Skybox", 0); //Renderer->SetGlPosXView(); - //DrawSceneWithoutWater(); + + DrawSceneWithoutWater(); //DrawCubemap(); - + /* if (view % 3 == 0) { //DrawCubemap(); @@ -380,12 +435,12 @@ void TMyApplication::InnerDraw() else { DrawSceneWithoutWater(); - } + }*/ Renderer->PopShader(); - //DrawWaterSurface(); + DrawWaterSurface(); /* diff --git a/Template/main.h b/Template/main.h index 83a251c..ef3c055 100644 --- a/Template/main.h +++ b/Template/main.h @@ -39,15 +39,21 @@ class TMyApplication : public SE::TApplication void DrawWaterSurface(); void DrawCubemap(); + void DrawCubemapDay(); cardinal cubemapTexture; + cardinal cubemapTextureDay; + cardinal cubemapTextureNight; VertexDataStruct cubemapVertexDataStruct; VertexDataStruct waterVertexDataStruct; public: //Constructor - TMyApplication() : MouseRightButtonPressed(false), MouseLeftButtonPressed(false), WaterTimer(0) { } + TMyApplication() : MouseRightButtonPressed(false), MouseLeftButtonPressed(false), WaterTimer(0) { + Width = 1920; + Height = 1080; + } virtual void InnerInit(); //What to do on init diff --git a/resources/shaders/env_reverse.fragment b/resources/shaders/env_reverse.fragment new file mode 100644 index 0000000..3a81eba --- /dev/null +++ b/resources/shaders/env_reverse.fragment @@ -0,0 +1,21 @@ +uniform samplerCube Env; + +varying vec3 dir; + +void main(){ + gl_FragColor = textureCube(Env, normalize(dir)); + + vec4 fogColor = vec4(0.25, 0.55, 1.0, 1.0); + + float coef = dir.y+1.0; + coef = clamp(coef, 0.0, 1.0); + + gl_FragColor = mix(gl_FragColor,fogColor, coef); + + //if (dir.z < 0) + //{ + // gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); + //} + //gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); + +} \ No newline at end of file diff --git a/resources/shaders/env_reverse.vertex b/resources/shaders/env_reverse.vertex new file mode 100644 index 0000000..d4a4d03 --- /dev/null +++ b/resources/shaders/env_reverse.vertex @@ -0,0 +1,14 @@ +attribute vec3 vPosition; + +uniform mat4 ProjectionMatrix; +uniform mat3 ModelRotateMatrix; +uniform vec3 ModelTranslateVector; + +varying vec3 dir; + +void main(){ + vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0); + gl_Position = ProjectionMatrix * realVertexPos; + + dir = -vPosition; +} \ No newline at end of file diff --git a/resources/shaders/water.fragment b/resources/shaders/water.fragment index cff3e6e..54896b1 100644 --- a/resources/shaders/water.fragment +++ b/resources/shaders/water.fragment @@ -13,11 +13,13 @@ void main() { vec3 camVec2 = normalize(camVec); + /*camVec2.y = -camVec2.y; + vec4 reflectColor = textureCube(Env, camVec2); gl_FragColor = vec4(reflectColor.xyz, 1.0f); + */ - /* mat3 rot; rot[0] = vec3(0.0,0.0,1.0); @@ -44,9 +46,9 @@ void main() vec4 reflectColor = textureCube(Env, dir1); vec4 refractColor = textureCube(Env, dir2); - vec4 texColor = reflectColor*0.2 + refractColor*0.8; + vec4 texColor = reflectColor*0.5 + refractColor*0.5; - gl_FragColor = vec4(texColor.xyz, 1.0f);*/ + gl_FragColor = vec4(texColor.xyz, 1.0f); diff --git a/resources/shaders/water.vertex b/resources/shaders/water.vertex index f3d82c8..d8176ef 100644 --- a/resources/shaders/water.vertex +++ b/resources/shaders/water.vertex @@ -17,7 +17,7 @@ void main() texCoord = vTexCoord; - camVec = -(vPosition.xyz - CamPos); + camVec = (vPosition.xyz - CamPos); //camVec = vec3(0, 1, 0); diff --git a/resources/negx.bmp b/resources/sky/negx.bmp similarity index 100% rename from resources/negx.bmp rename to resources/sky/negx.bmp diff --git a/resources/negy.bmp b/resources/sky/negy.bmp similarity index 100% rename from resources/negy.bmp rename to resources/sky/negy.bmp diff --git a/resources/negz.bmp b/resources/sky/negz.bmp similarity index 100% rename from resources/negz.bmp rename to resources/sky/negz.bmp diff --git a/resources/posx.bmp b/resources/sky/posx.bmp similarity index 100% rename from resources/posx.bmp rename to resources/sky/posx.bmp diff --git a/resources/posy.bmp b/resources/sky/posy.bmp similarity index 100% rename from resources/posy.bmp rename to resources/sky/posy.bmp diff --git a/resources/posz.bmp b/resources/sky/posz.bmp similarity index 100% rename from resources/posz.bmp rename to resources/sky/posz.bmp diff --git a/resources/sky/space_bk.bmp b/resources/sky/space_bk.bmp new file mode 100644 index 0000000..f76543b Binary files /dev/null and b/resources/sky/space_bk.bmp differ diff --git a/resources/sky/space_dn.bmp b/resources/sky/space_dn.bmp new file mode 100644 index 0000000..a3d6302 Binary files /dev/null and b/resources/sky/space_dn.bmp differ diff --git a/resources/sky/space_ft.bmp b/resources/sky/space_ft.bmp new file mode 100644 index 0000000..c30caa9 Binary files /dev/null and b/resources/sky/space_ft.bmp differ diff --git a/resources/sky/space_lf.bmp b/resources/sky/space_lf.bmp new file mode 100644 index 0000000..29bcc19 Binary files /dev/null and b/resources/sky/space_lf.bmp differ diff --git a/resources/sky/space_rt.bmp b/resources/sky/space_rt.bmp new file mode 100644 index 0000000..7d96610 Binary files /dev/null and b/resources/sky/space_rt.bmp differ diff --git a/resources/sky/space_up.bmp b/resources/sky/space_up.bmp new file mode 100644 index 0000000..51e4852 Binary files /dev/null and b/resources/sky/space_up.bmp differ diff --git a/resources/sky/yavin_bk.bmp b/resources/sky/yavin_bk.bmp new file mode 100644 index 0000000..a121c4b Binary files /dev/null and b/resources/sky/yavin_bk.bmp differ diff --git a/resources/sky/yavin_dn.bmp b/resources/sky/yavin_dn.bmp new file mode 100644 index 0000000..33018cd Binary files /dev/null and b/resources/sky/yavin_dn.bmp differ diff --git a/resources/sky/yavin_ft.bmp b/resources/sky/yavin_ft.bmp new file mode 100644 index 0000000..a435d20 Binary files /dev/null and b/resources/sky/yavin_ft.bmp differ diff --git a/resources/sky/yavin_lf.bmp b/resources/sky/yavin_lf.bmp new file mode 100644 index 0000000..381746e Binary files /dev/null and b/resources/sky/yavin_lf.bmp differ diff --git a/resources/sky/yavin_rt.bmp b/resources/sky/yavin_rt.bmp new file mode 100644 index 0000000..f6134f8 Binary files /dev/null and b/resources/sky/yavin_rt.bmp differ diff --git a/resources/sky/yavin_up.bmp b/resources/sky/yavin_up.bmp new file mode 100644 index 0000000..ceffc5a Binary files /dev/null and b/resources/sky/yavin_up.bmp differ