From 73839b05d90e058cd0dbfd29888cbb2f8ca7d545 Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Mon, 10 Jun 2024 22:17:41 +0300 Subject: [PATCH] Now bump mapping wors --- Template/gameMap.cpp | 3 + Template/log.txt | 236 ++++++++++++------------ Template/main.cpp | 1 + resources/shaders/directlight3.fragment | 21 ++- resources/shaders/directlight3.vertex | 9 +- 5 files changed, 148 insertions(+), 122 deletions(-) diff --git a/Template/gameMap.cpp b/Template/gameMap.cpp index 1a4bd20..fcb75b8 100644 --- a/Template/gameMap.cpp +++ b/Template/gameMap.cpp @@ -190,11 +190,14 @@ void TGameMap::DrawVBO() Land->DrawVBO(); + + Renderer->PushShader("Directlight3"); for (TLiteModelArr::iterator i = StaticModelArr.begin(); i != StaticModelArr.end(); ++i) { //i->DrawImmediate(); i->DrawVBO(); } + Renderer->PopShader(); //PlayerChar->DrawVBO(); diff --git a/Template/log.txt b/Template/log.txt index ac980c0..64ae1f5 100644 --- a/Template/log.txt +++ b/Template/log.txt @@ -1,159 +1,169 @@ -2024-Jun-09 21:40:20: Log started -2024-Jun-09 21:40:20: OpenGL Window created -2024-Jun-09 21:40:20: Script manager ready -2024-Jun-09 21:40:20: Render::OpenGL glVersion = 4.6.0 - Build 31.0.101.4887 -2024-Jun-09 21:40:20: Render::OpenGL glVersion above 2.0 ok -2024-Jun-09 21:40:20: Render::OpenGL GL_ARB_framebuffer_object supported ok -2024-Jun-09 21:40:20: Render::OpenGL GL_ARB_uniform_buffer_object supported ok -2024-Jun-09 21:40:20: Prepare to add shader GUI -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-10 22:16:13: Log started +2024-Jun-10 22:16:13: OpenGL Window created +2024-Jun-10 22:16:13: Script manager ready +2024-Jun-10 22:16:13: Render::OpenGL glVersion = 4.6.0 - Build 31.0.101.4887 +2024-Jun-10 22:16:13: Render::OpenGL glVersion above 2.0 ok +2024-Jun-10 22:16:13: Render::OpenGL GL_ARB_framebuffer_object supported ok +2024-Jun-10 22:16:13: Render::OpenGL GL_ARB_uniform_buffer_object supported ok +2024-Jun-10 22:16:13: Prepare to add shader GUI +2024-Jun-10 22:16: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-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-09 21:40:20: Shader program is - 3 -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader -2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: GUI -2024-Jun-09 21:40:20: Prepare to add shader Parallax -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-10 22:16:13: Shader program is - 3 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: GUI +2024-Jun-10 22:16:13: Prepare to add shader Parallax +2024-Jun-10 22:16: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-10 22:16:13: 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-09 21:40:20: Shader program is - 6 -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader -2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Parallax -2024-Jun-09 21:40:20: Prepare to add shader Directlight -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-10 22:16:13: Shader program is - 6 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: Parallax +2024-Jun-10 22:16:13: Prepare to add shader Directlight +2024-Jun-10 22:16: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-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-09 21:40:20: Shader program is - 9 -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader -2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Directlight -2024-Jun-09 21:40:20: Prepare to add shader Directlight2 -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-10 22:16:13: Shader program is - 9 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: Directlight +2024-Jun-10 22:16:13: Prepare to add shader Directlight2 +2024-Jun-10 22:16: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-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-09 21:40:20: Shader program is - 12 -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader -2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Directlight2 -2024-Jun-09 21:40:20: Prepare to add shader Env -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-10 22:16:13: Shader program is - 12 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: Directlight2 +2024-Jun-10 22:16:13: Prepare to add shader Directlight3 +2024-Jun-10 22:16: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-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-09 21:40:20: Shader program is - 15 -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader -2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Env -2024-Jun-09 21:40:20: Prepare to add shader EnvReverse -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-10 22:16:13: Shader program is - 15 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: Directlight3 +2024-Jun-10 22:16:13: Prepare to add shader Env +2024-Jun-10 22:16: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-10 22:16:13: 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-10 22:16:13: Shader program is - 18 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: Env +2024-Jun-10 22:16:13: Prepare to add shader EnvReverse +2024-Jun-10 22:16: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-10 22:16:13: 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-10 22:16:13: Shader program is - 21 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: EnvReverse +2024-Jun-10 22:16:13: Prepare to add shader EnvReverseNight +2024-Jun-10 22:16: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-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing + + +2024-Jun-10 22:16:13: Shader program is - 24 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: EnvReverseNight +2024-Jun-10 22:16:13: Prepare to add shader Water +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing + + +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing WARNING: 0:29: 'assign' : implicit type conversion allowed from GLSL 1.20 -2024-Jun-09 21:40:20: Shader program is - 24 -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader -2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Water -2024-Jun-09 21:40:20: Prepare to add shader Frame -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-10 22:16:13: Shader program is - 27 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: Water +2024-Jun-10 22:16:13: Prepare to add shader Frame +2024-Jun-10 22:16: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-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-09 21:40:20: Shader program is - 27 -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader -2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Frame -2024-Jun-09 21:40:20: Prepare to add shader Lightview -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:5: '' : #version directive missing +2024-Jun-10 22:16:13: Shader program is - 30 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: Frame +2024-Jun-10 22:16:13: Prepare to add shader Lightview +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:5: '' : #version directive missing -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-09 21:40:20: Shader program is - 30 -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader -2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Lightview -2024-Jun-09 21:40:20: Prepare to add shader Simple3D -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing +2024-Jun-10 22:16:13: Shader program is - 33 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: Lightview +2024-Jun-10 22:16:13: Prepare to add shader Simple3D +2024-Jun-10 22:16: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-10 22:16:13: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing -2024-Jun-09 21:40:20: Shader program is - 33 -2024-Jun-09 21:40:20: ResourceManager::ShaderManager::Shader -2024-Jun-09 21:40:20: ResourceManager::ShaderManager shader loaded: Simple3D -2024-Jun-09 21:40:20: ResourceManager::TexList Texture added: bt_box_yellow.bmp with id = 1 -2024-Jun-09 21:40:20: ResourceManager::TexList Texture added: bt_box_norm.bmp32 with id = 2 -2024-Jun-09 21:40:20: Lite model added successfully: models/bt_box_yellow.lm1 -2024-Jun-09 21:40:20: ResourceManager::TexList Texture added: bt_box_red000.bmp with id = 3 -2024-Jun-09 21:40:20: ResourceManager::TexList Texture reference added: bt_box_norm.bmp32 -2024-Jun-09 21:40:20: Lite model added successfully: models/bt_box_red.lm1 -2024-Jun-09 21:40:20: ResourceManager::TexList Texture added: bt_box_blue00.bmp with id = 4 -2024-Jun-09 21:40:20: ResourceManager::TexList Texture reference added: bt_box_norm.bmp32 -2024-Jun-09 21:40:20: Lite model added successfully: models/bt_box_blue.lm1 -2024-Jun-09 21:40:20: ResourceManager::TexList Texture added: bt_cone.bmp with id = 5 -2024-Jun-09 21:40:20: Lite model added successfully: models/bt_cone.lm1 -2024-Jun-09 21:40:20: Lite model added successfully: models/girl.lm1 -2024-Jun-09 21:40:20: Lite model added successfully: models/bonemodel.lm1 -2024-Jun-09 21:40:21: ResourceManager::TexList Texture added: out.bmp with id = 6 -2024-Jun-09 21:40:21: FrameManager:: frame buffer added: Skybox -2024-Jun-09 21:40:21: ResourceManager::TexList Texture added: normalmap.bmp with id = 8 -2024-Jun-09 21:40:21: 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/negx.bmp -2024-Jun-09 21:40:21: 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/negy.bmp -2024-Jun-09 21:40:21: 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/negz.bmp -2024-Jun-09 21:40:21: ResourceManager::TexList texture added succesfuly: posx.bmp -2024-Jun-09 21:40:21: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_rt.bmp -2024-Jun-09 21:40:22: 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_dn.bmp -2024-Jun-09 21:40:22: 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_bk.bmp -2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_ft.bmp -2024-Jun-09 21:40:22: ResourceManager::TexList texture added succesfuly: yavin_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 21:40:22: 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_up.bmp -2024-Jun-09 21:40:22: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_dn.bmp -2024-Jun-09 21:40:23: 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_ft.bmp -2024-Jun-09 21:40:23: ResourceManager::TexList texture added succesfuly: space_rt.bmp -2024-Jun-09 21:40:23: FrameManager:: frame buffer added: ScreenBlur -2024-Jun-09 21:40:23: FrameManager:: frame buffer added: ShadowBufferGlobal -2024-Jun-09 21:40:23: FrameManager:: frame buffer added: ShadowBufferLocal +2024-Jun-10 22:16:13: Shader program is - 36 +2024-Jun-10 22:16:13: ResourceManager::ShaderManager::Shader +2024-Jun-10 22:16:13: ResourceManager::ShaderManager shader loaded: Simple3D +2024-Jun-10 22:16:13: ResourceManager::TexList Texture added: bt_box_yellow.bmp with id = 1 +2024-Jun-10 22:16:13: ResourceManager::TexList Texture added: bt_box_norm.bmp32 with id = 2 +2024-Jun-10 22:16:13: Lite model added successfully: models/bt_box_yellow.lm1 +2024-Jun-10 22:16:13: ResourceManager::TexList Texture added: bt_box_red000.bmp with id = 3 +2024-Jun-10 22:16:13: ResourceManager::TexList Texture reference added: bt_box_norm.bmp32 +2024-Jun-10 22:16:13: Lite model added successfully: models/bt_box_red.lm1 +2024-Jun-10 22:16:13: ResourceManager::TexList Texture added: bt_box_blue00.bmp with id = 4 +2024-Jun-10 22:16:13: ResourceManager::TexList Texture reference added: bt_box_norm.bmp32 +2024-Jun-10 22:16:13: Lite model added successfully: models/bt_box_blue.lm1 +2024-Jun-10 22:16:13: ResourceManager::TexList Texture added: bt_cone.bmp with id = 5 +2024-Jun-10 22:16:13: Lite model added successfully: models/bt_cone.lm1 +2024-Jun-10 22:16:13: Lite model added successfully: models/girl.lm1 +2024-Jun-10 22:16:13: Lite model added successfully: models/bonemodel.lm1 +2024-Jun-10 22:16:14: ResourceManager::TexList Texture added: out.bmp with id = 6 +2024-Jun-10 22:16:15: FrameManager:: frame buffer added: Skybox +2024-Jun-10 22:16:15: ResourceManager::TexList Texture added: normalmap.bmp with id = 8 +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posx.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negx.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posy.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negy.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/posz.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/negz.bmp +2024-Jun-10 22:16:15: ResourceManager::TexList texture added succesfuly: posx.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_rt.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_lf.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_dn.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_up.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_bk.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/yavin_ft.bmp +2024-Jun-10 22:16:15: ResourceManager::TexList texture added succesfuly: yavin_rt.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_rt.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_lf.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_up.bmp +2024-Jun-10 22:16:15: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_dn.bmp +2024-Jun-10 22:16:16: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_bk.bmp +2024-Jun-10 22:16:16: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/sky/space_ft.bmp +2024-Jun-10 22:16:16: ResourceManager::TexList texture added succesfuly: space_rt.bmp +2024-Jun-10 22:16:16: FrameManager:: frame buffer added: ScreenBlur +2024-Jun-10 22:16:16: FrameManager:: frame buffer added: ShadowBufferGlobal +2024-Jun-10 22:16:16: FrameManager:: frame buffer added: ShadowBufferLocal diff --git a/Template/main.cpp b/Template/main.cpp index 7fb4b32..12b95a4 100644 --- a/Template/main.cpp +++ b/Template/main.cpp @@ -219,6 +219,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("Directlight2", "shaders/directlight2.vertex", "shaders/directlight2.fragment"); + ResourceManager->ShaderManager.AddShader("Directlight3", "shaders/directlight3.vertex", "shaders/directlight3.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("EnvReverseNight", "shaders/env_reverse_night.vertex", "shaders/env_reverse_night.fragment"); diff --git a/resources/shaders/directlight3.fragment b/resources/shaders/directlight3.fragment index 94e25e7..dc20f23 100644 --- a/resources/shaders/directlight3.fragment +++ b/resources/shaders/directlight3.fragment @@ -5,25 +5,32 @@ uniform float FogEndDistance; varying vec2 texCoord; varying vec3 vertexPos; -varying vec3 normal; varying vec3 absoluteVertexPos; +varying vec3 normal; +varying vec3 tangent; +varying vec3 bitangent; 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 norm1 = normalize(normal); + vec3 norm2 = texture2D(NormalMap, texCoord).rgb * 2.0 - 1.0; + + mat3 TBN = mat3(tangent, bitangent, norm1); + + vec3 transformedNormal = normalize(TBN * norm2); + + //gl_FragColor = vec4(transformedNormal*0.5+ vec3(0.5, 0.5, 0.5), 1.0); + vec3 lightPos = vec3(-2, 5, 0); vec3 lightVec = absoluteVertexPos - lightPos; - float coef = max(dot(-normalize(lightVec),norm),0.2); + float coef = max(dot(-normalize(lightVec),transformedNormal),0.2); float coef2 = clamp((15.0 - length(lightVec))/10.0, 0.2, 1.0); - vec4 texColor = texture2D(NormalMap,texCoord).rgba; + vec4 texColor = texture2D(Texture,texCoord).rgba; gl_FragColor = vec4(texColor.rgb*coef2*coef, 1.0); diff --git a/resources/shaders/directlight3.vertex b/resources/shaders/directlight3.vertex index 35fea4d..c9dfb74 100644 --- a/resources/shaders/directlight3.vertex +++ b/resources/shaders/directlight3.vertex @@ -1,6 +1,8 @@ attribute vec3 vPosition; attribute vec2 vTexCoord; attribute vec3 vNormal; +attribute vec3 vTangent; +attribute vec3 vBinormal; uniform mat4 ProjectionMatrix; uniform mat3 ModelRotateMatrix; @@ -10,7 +12,8 @@ varying vec2 texCoord; varying vec3 vertexPos; varying vec3 absoluteVertexPos; varying vec3 normal; - +varying vec3 tangent; +varying vec3 bitangent; void main() { vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0); @@ -21,6 +24,8 @@ void main() texCoord = vTexCoord.st; - normal = vNormal; + normal = normalize(vNormal); + tangent = normalize(vTangent); + bitangent = cross(normal, tangent); } \ No newline at end of file