light working

This commit is contained in:
Vladislav Khorev 2024-06-09 21:42:23 +03:00
parent d2a081588f
commit 7fc9a5e5d6
9 changed files with 356 additions and 111 deletions

View File

@ -1,139 +1,159 @@
2024-Jun-09 10:36:12: Log started 2024-Jun-09 21:40:20: Log started
2024-Jun-09 10:36:13: OpenGL Window created 2024-Jun-09 21:40:20: OpenGL Window created
2024-Jun-09 10:36:13: Script manager ready 2024-Jun-09 21:40:20: Script manager ready
2024-Jun-09 10:36:13: Render::OpenGL glVersion = 4.6.0 - Build 31.0.101.4887 2024-Jun-09 21:40:20: Render::OpenGL glVersion = 4.6.0 - Build 31.0.101.4887
2024-Jun-09 10:36:13: Render::OpenGL glVersion above 2.0 ok 2024-Jun-09 21:40:20: Render::OpenGL glVersion above 2.0 ok
2024-Jun-09 10:36:13: Render::OpenGL GL_ARB_framebuffer_object supported ok 2024-Jun-09 21:40:20: Render::OpenGL GL_ARB_framebuffer_object supported ok
2024-Jun-09 10:36:13: Render::OpenGL GL_ARB_uniform_buffer_object supported ok 2024-Jun-09 21:40:20: Render::OpenGL GL_ARB_uniform_buffer_object supported ok
2024-Jun-09 10:36:13: Prepare to add shader GUI 2024-Jun-09 21:40:20: Prepare to add shader GUI
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: Shader program is - 3 2024-Jun-09 21:40:20: Shader program is - 3
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 10:36:13: ResourceManager::ShaderManager shader loaded: GUI 2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: GUI
2024-Jun-09 10:36:13: Prepare to add shader Parallax 2024-Jun-09 21:40:20: Prepare to add shader Parallax
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: 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 from GLSL 1.20 WARNING: 0:27: 'assign' : implicit type conversion allowed from GLSL 1.20
WARNING: 0:27: 'assign' : implicit type conversion allowed WARNING: 0:27: 'assign' : implicit type conversion allowed
2024-Jun-09 10:36:13: Shader program is - 6 2024-Jun-09 21:40:20: Shader program is - 6
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 10:36:13: ResourceManager::ShaderManager shader loaded: Parallax 2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Parallax
2024-Jun-09 10:36:13: Prepare to add shader Directlight 2024-Jun-09 21:40:20: Prepare to add shader Directlight
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: Shader program is - 9 2024-Jun-09 21:40:20: Shader program is - 9
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 10:36:13: ResourceManager::ShaderManager shader loaded: Directlight 2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Directlight
2024-Jun-09 10:36:13: Prepare to add shader Env 2024-Jun-09 21:40:20: Prepare to add shader Directlight2
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: Shader program is - 12 2024-Jun-09 21:40:20: Shader program is - 12
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 10:36:13: ResourceManager::ShaderManager shader loaded: Env 2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Directlight2
2024-Jun-09 10:36:13: Prepare to add shader EnvReverse 2024-Jun-09 21:40:20: Prepare to add shader Env
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: Shader program is - 15 2024-Jun-09 21:40:20: Shader program is - 15
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 10:36:13: ResourceManager::ShaderManager shader loaded: EnvReverse 2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Env
2024-Jun-09 10:36:13: Prepare to add shader Water 2024-Jun-09 21:40:20: Prepare to add shader EnvReverse
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 21:40:20: Shader program is - 18
2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: EnvReverse
2024-Jun-09 21:40:20: Prepare to add shader EnvReverseNight
2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 21:40:20: Shader program is - 21
2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: EnvReverseNight
2024-Jun-09 21:40:20: Prepare to add shader Water
2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
WARNING: 0:29: 'assign' : implicit type conversion allowed from GLSL 1.20 WARNING: 0:29: 'assign' : implicit type conversion allowed from GLSL 1.20
2024-Jun-09 10:36:13: Shader program is - 18 2024-Jun-09 21:40:20: Shader program is - 24
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 10:36:13: ResourceManager::ShaderManager shader loaded: Water 2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Water
2024-Jun-09 10:36:13: Prepare to add shader Frame 2024-Jun-09 21:40:20: Prepare to add shader Frame
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: Shader program is - 21 2024-Jun-09 21:40:20: Shader program is - 27
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 10:36:13: ResourceManager::ShaderManager shader loaded: Frame 2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Frame
2024-Jun-09 10:36:13: Prepare to add shader Lightview 2024-Jun-09 21:40:20: Prepare to add shader Lightview
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:5: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:5: '' : #version directive missing
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: Shader program is - 24 2024-Jun-09 21:40:20: Shader program is - 30
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 10:36:13: ResourceManager::ShaderManager shader loaded: Lightview 2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Lightview
2024-Jun-09 10:36:13: Prepare to add shader Simple3D 2024-Jun-09 21:40:20: Prepare to add shader Simple3D
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
2024-Jun-09 10:36:13: Shader program is - 27 2024-Jun-09 21:40:20: Shader program is - 33
2024-Jun-09 10:36:13: ResourceManager::ShaderManager::Shader 2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader
2024-Jun-09 10:36:13: ResourceManager::ShaderManager shader loaded: Simple3D 2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Simple3D
2024-Jun-09 10:36:13: ResourceManager::TexList Texture added: bt_box_yellow.bmp with id = 1 2024-Jun-09 21:40:20: ResourceManager::TexList Texture added: bt_box_yellow.bmp with id = 1
2024-Jun-09 10:36:13: ResourceManager::TexList Texture added: bt_box_norm.bmp32 with id = 2 2024-Jun-09 21:40:20: ResourceManager::TexList Texture added: bt_box_norm.bmp32 with id = 2
2024-Jun-09 10:36:13: Lite model added successfully: models/bt_box_yellow.lm1 2024-Jun-09 21:40:20: Lite model added successfully: models/bt_box_yellow.lm1
2024-Jun-09 10:36:13: ResourceManager::TexList Texture added: bt_box_red000.bmp with id = 3 2024-Jun-09 21:40:20: ResourceManager::TexList Texture added: bt_box_red000.bmp with id = 3
2024-Jun-09 10:36:13: ResourceManager::TexList Texture reference added: bt_box_norm.bmp32 2024-Jun-09 21:40:20: ResourceManager::TexList Texture reference added: bt_box_norm.bmp32
2024-Jun-09 10:36:13: Lite model added successfully: models/bt_box_red.lm1 2024-Jun-09 21:40:20: Lite model added successfully: models/bt_box_red.lm1
2024-Jun-09 10:36:13: ResourceManager::TexList Texture added: bt_box_blue00.bmp with id = 4 2024-Jun-09 21:40:20: ResourceManager::TexList Texture added: bt_box_blue00.bmp with id = 4
2024-Jun-09 10:36:13: ResourceManager::TexList Texture reference added: bt_box_norm.bmp32 2024-Jun-09 21:40:20: ResourceManager::TexList Texture reference added: bt_box_norm.bmp32
2024-Jun-09 10:36:13: Lite model added successfully: models/bt_box_blue.lm1 2024-Jun-09 21:40:20: Lite model added successfully: models/bt_box_blue.lm1
2024-Jun-09 10:36:13: ResourceManager::TexList Texture added: bt_cone.bmp with id = 5 2024-Jun-09 21:40:20: ResourceManager::TexList Texture added: bt_cone.bmp with id = 5
2024-Jun-09 10:36:13: Lite model added successfully: models/bt_cone.lm1 2024-Jun-09 21:40:20: Lite model added successfully: models/bt_cone.lm1
2024-Jun-09 10:36:13: Lite model added successfully: models/girl.lm1 2024-Jun-09 21:40:20: Lite model added successfully: models/girl.lm1
2024-Jun-09 10:36:14: Lite model added successfully: models/bonemodel.lm1 2024-Jun-09 21:40:20: Lite model added successfully: models/bonemodel.lm1
2024-Jun-09 10:36:16: ResourceManager::TexList Texture added: out.bmp with id = 6 2024-Jun-09 21:40:21: ResourceManager::TexList Texture added: out.bmp with id = 6
2024-Jun-09 10:36:16: FrameManager:: frame buffer added: Skybox 2024-Jun-09 21:40:21: FrameManager:: frame buffer added: Skybox
2024-Jun-09 10:36:16: ResourceManager::TexList Texture added: normalmap.bmp with id = 8 2024-Jun-09 21:40:21: ResourceManager::TexList Texture added: normalmap.bmp with id = 8
2024-Jun-09 10:36:16: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posx.bmp 2024-Jun-09 21:40:21: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posx.bmp
2024-Jun-09 10:36:16: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negx.bmp 2024-Jun-09 21:40:21: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negx.bmp
2024-Jun-09 10:36:17: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posy.bmp 2024-Jun-09 21:40:21: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posy.bmp
2024-Jun-09 10:36:17: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negy.bmp 2024-Jun-09 21:40:21: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negy.bmp
2024-Jun-09 10:36:17: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posz.bmp 2024-Jun-09 21:40:21: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posz.bmp
2024-Jun-09 10:36:17: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negz.bmp 2024-Jun-09 21:40:21: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negz.bmp
2024-Jun-09 10:36:17: ResourceManager::TexList texture added succesfuly: posx.bmp 2024-Jun-09 21:40:21: ResourceManager::TexList texture added succesfuly: posx.bmp
2024-Jun-09 10:36:17: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_rt.bmp 2024-Jun-09 21:40:21: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_rt.bmp
2024-Jun-09 10:36:17: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_lf.bmp 2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_lf.bmp
2024-Jun-09 10:36:17: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_dn.bmp 2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_dn.bmp
2024-Jun-09 10:36:17: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_up.bmp 2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_up.bmp
2024-Jun-09 10:36:18: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_bk.bmp 2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_bk.bmp
2024-Jun-09 10:36:18: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_ft.bmp 2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_ft.bmp
2024-Jun-09 10:36:18: ResourceManager::TexList texture added succesfuly: yavin_rt.bmp 2024-Jun-09 21:40:22: ResourceManager::TexList texture added succesfuly: yavin_rt.bmp
2024-Jun-09 10:36:18: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_rt.bmp 2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_rt.bmp
2024-Jun-09 10:36:18: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_lf.bmp 2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_lf.bmp
2024-Jun-09 10:36:19: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_up.bmp 2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_up.bmp
2024-Jun-09 10:36:19: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_dn.bmp 2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_dn.bmp
2024-Jun-09 10:36:19: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_bk.bmp 2024-Jun-09 21:40:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_bk.bmp
2024-Jun-09 10:36:19: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_ft.bmp 2024-Jun-09 21:40:23: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_ft.bmp
2024-Jun-09 10:36:20: ResourceManager::TexList texture added succesfuly: space_rt.bmp 2024-Jun-09 21:40:23: ResourceManager::TexList texture added succesfuly: space_rt.bmp
2024-Jun-09 10:36:20: FrameManager:: frame buffer added: ScreenBlur 2024-Jun-09 21:40:23: FrameManager:: frame buffer added: ScreenBlur
2024-Jun-09 10:36:20: FrameManager:: frame buffer added: ShadowBufferGlobal 2024-Jun-09 21:40:23: FrameManager:: frame buffer added: ShadowBufferGlobal
2024-Jun-09 10:36:20: FrameManager:: frame buffer added: ShadowBufferLocal 2024-Jun-09 21:40:23: FrameManager:: frame buffer added: ShadowBufferLocal

View File

@ -14,53 +14,68 @@ void TMyApplication::DrawToCubemap()
Renderer->SwitchToCubemapBuffer("Skybox",0); Renderer->SwitchToCubemapBuffer("Skybox",0);
Renderer->SetGlPosXView(false, true); Renderer->SetGlPosXView(false, true);
DrawCubemapDay(); //DrawCubemapDay();
DrawCubemapNight();
Renderer->PushShader("Directlight2");
Renderer->SetGlPosXView(true, true); Renderer->SetGlPosXView(true, true);
GameMap.DrawVBO(); GameMap.DrawVBO();
Renderer->PopShader();
//glClearColor() //glClearColor()
//glClearColor(1.0f, 0.0f, 0.0f, 1.0f); //glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
Renderer->SwitchToCubemapBuffer("Skybox",1); Renderer->SwitchToCubemapBuffer("Skybox",1);
Renderer->SetGlNegXView(false, true); Renderer->SetGlNegXView(false, true);
DrawCubemapDay(); //DrawCubemapDay();
DrawCubemapNight();
Renderer->PushShader("Directlight2");
Renderer->SetGlNegXView(true, true); Renderer->SetGlNegXView(true, true);
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
GameMap.DrawVBO(); GameMap.DrawVBO();
Renderer->PopShader();
Renderer->SwitchToCubemapBuffer("Skybox",2); Renderer->SwitchToCubemapBuffer("Skybox",2);
Renderer->SetGlPosYView(false, true); Renderer->SetGlPosYView(false, true);
DrawCubemapDay(); //DrawCubemapDay();
DrawCubemapNight();
Renderer->PushShader("Directlight2");
Renderer->SetGlPosYView(true, true); Renderer->SetGlPosYView(true, true);
GameMap.DrawVBO(); GameMap.DrawVBO();
//glClearColor(0.0f, 1.0f, 0.0f, 1.0f); //glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
Renderer->PopShader();
Renderer->SwitchToCubemapBuffer("Skybox",3); Renderer->SwitchToCubemapBuffer("Skybox",3);
Renderer->SetGlNegYView(false, true); Renderer->SetGlNegYView(false, true);
DrawCubemapDay(); //DrawCubemapDay();
DrawCubemapNight();
Renderer->PushShader("Directlight2");
Renderer->SetGlNegYView(true, true); Renderer->SetGlNegYView(true, true);
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
GameMap.DrawVBO(); GameMap.DrawVBO();
Renderer->PopShader();
Renderer->SwitchToCubemapBuffer("Skybox",4); Renderer->SwitchToCubemapBuffer("Skybox",4);
Renderer->SetGlPosZView(false, true); Renderer->SetGlPosZView(false, true);
DrawCubemapDay(); //DrawCubemapDay();
DrawCubemapNight();
Renderer->PushShader("Directlight2");
Renderer->SetGlPosZView(true, true); Renderer->SetGlPosZView(true, true);
GameMap.DrawVBO(); GameMap.DrawVBO();
//glClearColor(0.0f, 0.0f, 1.0f, 1.0f); //glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
Renderer->PopShader();
Renderer->SwitchToCubemapBuffer("Skybox",5); Renderer->SwitchToCubemapBuffer("Skybox",5);
Renderer->SetGlNegZView(false, true); Renderer->SetGlNegZView(false, true);
DrawCubemapDay(); //DrawCubemapDay();
DrawCubemapNight();
Renderer->PushShader("Directlight2");
Renderer->SetGlNegZView(true, true); Renderer->SetGlNegZView(true, true);
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); //glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
GameMap.DrawVBO(); GameMap.DrawVBO();
Renderer->PopShader();
Renderer->SwitchToScreen(); Renderer->SwitchToScreen();
@ -84,9 +99,12 @@ void TMyApplication::DrawToShadowMap()
void TMyApplication::DrawSceneWithoutWater() void TMyApplication::DrawSceneWithoutWater()
{ {
Renderer->SetGLCamAngleView(); Renderer->SetGLCamAngleView();
DrawCubemapDay(); //DrawCubemapDay();
DrawCubemapNight();
Renderer->PushShader("Directlight2");
Renderer->SetGLCamView(); Renderer->SetGLCamView();
GameMap.DrawVBO(); GameMap.DrawVBO();
Renderer->PopShader();
} }
void TMyApplication::DrawWaterSurface() void TMyApplication::DrawWaterSurface()
@ -160,6 +178,30 @@ void TMyApplication::DrawCubemapDay()
Renderer->PopShader(); Renderer->PopShader();
} }
void TMyApplication::DrawCubemapNight()
{
Renderer->PushShader("EnvReverseNight");
//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, cubemapTextureNight);
EnableVertexAttribArray("vPosition");
DrawVertexDataStruct(cubemapVertexDataStruct);
DisableVertexAttribArray("vPosition");
glClear(GL_DEPTH_BUFFER_BIT);
Renderer->PopShader();
}
void TMyApplication::DrawFrameFullScreen() void TMyApplication::DrawFrameFullScreen()
{ {
@ -176,8 +218,10 @@ void TMyApplication::InnerInit()
ResourceManager->ShaderManager.AddShader("GUI", "shaders/gui_transparent.vertex", "shaders/gui_transparent.fragment"); ResourceManager->ShaderManager.AddShader("GUI", "shaders/gui_transparent.vertex", "shaders/gui_transparent.fragment");
ResourceManager->ShaderManager.AddShader("Parallax", "shaders/directlight_parallax_shadow.vertex", "shaders/directlight_parallax_shadow.fragment"); 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("Directlight", "shaders/directlight.vertex", "shaders/directlight.fragment");
ResourceManager->ShaderManager.AddShader("Directlight2", "shaders/directlight2.vertex", "shaders/directlight2.fragment");
ResourceManager->ShaderManager.AddShader("Env", "shaders/env.vertex", "shaders/env.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("EnvReverse", "shaders/env_reverse.vertex", "shaders/env_reverse.fragment");
ResourceManager->ShaderManager.AddShader("EnvReverseNight", "shaders/env_reverse_night.vertex", "shaders/env_reverse_night.fragment");
ResourceManager->ShaderManager.AddShader("Water", "shaders/water.vertex", "shaders/water.fragment"); ResourceManager->ShaderManager.AddShader("Water", "shaders/water.vertex", "shaders/water.fragment");
ResourceManager->ShaderManager.AddShader("Frame", "shaders/frame.vertex", "shaders/frame.fragment"); ResourceManager->ShaderManager.AddShader("Frame", "shaders/frame.vertex", "shaders/frame.fragment");
ResourceManager->ShaderManager.AddShader("Lightview", "shaders/lightview.vertex", "shaders/lightview.fragment"); ResourceManager->ShaderManager.AddShader("Lightview", "shaders/lightview.vertex", "shaders/lightview.fragment");

View File

@ -40,6 +40,7 @@ class TMyApplication : public SE::TApplication
void DrawCubemap(); void DrawCubemap();
void DrawCubemapDay(); void DrawCubemapDay();
void DrawCubemapNight();
void DrawFrameFullScreen(); void DrawFrameFullScreen();

View File

@ -0,0 +1,46 @@
uniform sampler2D Texture;
uniform float FogBeginDistance;
uniform float FogEndDistance;
varying vec2 texCoord;
varying vec3 vertexPos;
varying vec3 normal;
varying vec3 absoluteVertexPos;
void main()
{
//vec3 norm = normalize(normal)*0.5 + vec3(0.5, 0.5, 0.5);
//gl_FragColor = vec4(norm, 1.0);
vec3 norm = normalize(normal);
vec3 lightPos = vec3(-2, 5, 0);
vec3 lightVec = absoluteVertexPos - lightPos;
float coef = max(dot(-normalize(lightVec),norm),0.2);
float coef2 = clamp((15.0 - length(lightVec))/10.0, 0.2, 1.0);
vec4 texColor = texture2D(Texture,texCoord).rgba;
gl_FragColor = vec4(texColor.rgb*coef2*coef, 1.0);
/*
//Night
//vec4 fogColor = vec4(0.25, 0.55, 1.0, 1.0);
vec4 fogColor = vec4(0.05, 0.05, 0.1, 1.0);
float fogDistCoef = (vertexPos.z - FogBeginDistance) / (FogEndDistance - FogBeginDistance);
fogDistCoef = clamp(fogDistCoef, 0.0, 1.0);
vec4 resultColor = mix(texColor*coef2, fogColor, fogDistCoef);
gl_FragColor = vec4(resultColor.rgb, 1.0);*/
}

View File

@ -0,0 +1,26 @@
attribute vec3 vPosition;
attribute vec2 vTexCoord;
attribute vec3 vNormal;
uniform mat4 ProjectionMatrix;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
varying vec2 texCoord;
varying vec3 vertexPos;
varying vec3 absoluteVertexPos;
varying vec3 normal;
void main()
{
vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0);
gl_Position = ProjectionMatrix * realVertexPos;
vertexPos = gl_Position.xyz;
absoluteVertexPos = vPosition;
texCoord = vTexCoord.st;
normal = vNormal;
}

View File

@ -0,0 +1,47 @@
uniform sampler2D Texture;
uniform sampler2D NormalMap;
uniform float FogBeginDistance;
uniform float FogEndDistance;
varying vec2 texCoord;
varying vec3 vertexPos;
varying vec3 normal;
varying vec3 absoluteVertexPos;
void main()
{
//vec3 norm = normalize(normal)*0.5 + vec3(0.5, 0.5, 0.5);
//gl_FragColor = vec4(norm, 1.0);
vec3 norm = normalize(normal);
vec3 lightPos = vec3(-2, 5, 0);
vec3 lightVec = absoluteVertexPos - lightPos;
float coef = max(dot(-normalize(lightVec),norm),0.2);
float coef2 = clamp((15.0 - length(lightVec))/10.0, 0.2, 1.0);
vec4 texColor = texture2D(NormalMap,texCoord).rgba;
gl_FragColor = vec4(texColor.rgb*coef2*coef, 1.0);
/*
//Night
//vec4 fogColor = vec4(0.25, 0.55, 1.0, 1.0);
vec4 fogColor = vec4(0.05, 0.05, 0.1, 1.0);
float fogDistCoef = (vertexPos.z - FogBeginDistance) / (FogEndDistance - FogBeginDistance);
fogDistCoef = clamp(fogDistCoef, 0.0, 1.0);
vec4 resultColor = mix(texColor*coef2, fogColor, fogDistCoef);
gl_FragColor = vec4(resultColor.rgb, 1.0);*/
}

View File

@ -0,0 +1,26 @@
attribute vec3 vPosition;
attribute vec2 vTexCoord;
attribute vec3 vNormal;
uniform mat4 ProjectionMatrix;
uniform mat3 ModelRotateMatrix;
uniform vec3 ModelTranslateVector;
varying vec2 texCoord;
varying vec3 vertexPos;
varying vec3 absoluteVertexPos;
varying vec3 normal;
void main()
{
vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0);
gl_Position = ProjectionMatrix * realVertexPos;
vertexPos = gl_Position.xyz;
absoluteVertexPos = vPosition;
texCoord = vTexCoord.st;
normal = vNormal;
}

View File

@ -0,0 +1,21 @@
uniform samplerCube Env;
varying vec3 dir;
void main(){
gl_FragColor = textureCube(Env, normalize(dir));
vec4 fogColor = vec4(0.05, 0.05, 0.1, 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);
}

View File

@ -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;
}