Finally cubemap working
This commit is contained in:
parent
f413bbe265
commit
c475b1ecac
151
Template/log.txt
151
Template/log.txt
@ -1,109 +1,108 @@
|
|||||||
2024-Jun-08 20:53:34: Log started
|
2024-Jun-08 23:23:28: Log started
|
||||||
2024-Jun-08 20:53:34: OpenGL Window created
|
2024-Jun-08 23:23:28: OpenGL Window created
|
||||||
2024-Jun-08 20:53:34: Script manager ready
|
2024-Jun-08 23:23:28: Script manager ready
|
||||||
2024-Jun-08 20:53:34: Render::OpenGL glVersion = 4.6.0 - Build 31.0.101.4887
|
2024-Jun-08 23:23:28: Render::OpenGL glVersion = 4.6.0 - Build 31.0.101.4887
|
||||||
2024-Jun-08 20:53:34: Render::OpenGL glVersion above 2.0 ok
|
2024-Jun-08 23:23:28: Render::OpenGL glVersion above 2.0 ok
|
||||||
2024-Jun-08 20:53:34: Render::OpenGL GL_ARB_framebuffer_object supported ok
|
2024-Jun-08 23:23:28: Render::OpenGL GL_ARB_framebuffer_object supported ok
|
||||||
2024-Jun-08 20:53:34: Render::OpenGL GL_ARB_uniform_buffer_object supported ok
|
2024-Jun-08 23:23:28: Render::OpenGL GL_ARB_uniform_buffer_object supported ok
|
||||||
2024-Jun-08 20:53:34: Prepare to add shader GUI
|
2024-Jun-08 23:23:28: Prepare to add shader GUI
|
||||||
2024-Jun-08 20:53:34: 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-08 20:53:34: 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-08 20:53:34: Shader program is - 3
|
2024-Jun-08 23:23:28: Shader program is - 3
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager::Shader
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager shader loaded: GUI
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: GUI
|
||||||
2024-Jun-08 20:53:34: Prepare to add shader Parallax
|
2024-Jun-08 23:23:28: Prepare to add shader Parallax
|
||||||
2024-Jun-08 20:53:34: 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-08 20:53:34: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
|
2024-Jun-08 23:23:28: 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-08 20:53:34: Shader program is - 6
|
2024-Jun-08 23:23:28: Shader program is - 6
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager::Shader
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager shader loaded: Parallax
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Parallax
|
||||||
2024-Jun-08 20:53:34: Prepare to add shader Directlight
|
2024-Jun-08 23:23:28: Prepare to add shader Directlight
|
||||||
2024-Jun-08 20:53:34: 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-08 20:53:34: 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-08 20:53:34: Shader program is - 9
|
2024-Jun-08 23:23:28: Shader program is - 9
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager::Shader
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager shader loaded: Directlight
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Directlight
|
||||||
2024-Jun-08 20:53:34: Prepare to add shader Env
|
2024-Jun-08 23:23:28: Prepare to add shader Env
|
||||||
2024-Jun-08 20:53:34: 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-08 20:53:34: 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-08 20:53:34: Shader program is - 12
|
2024-Jun-08 23:23:28: Shader program is - 12
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager::Shader
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager shader loaded: Env
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Env
|
||||||
2024-Jun-08 20:53:34: Prepare to add shader Water
|
2024-Jun-08 23:23:28: Prepare to add shader Water
|
||||||
2024-Jun-08 20:53:34: 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-08 20:53:34: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:1: '' : #version directive missing
|
||||||
WARNING: 0:20: 'assign' : implicit type conversion allowed from GLSL 1.20
|
|
||||||
|
|
||||||
|
|
||||||
2024-Jun-08 20:53:34: Shader program is - 15
|
2024-Jun-08 23:23:28: Shader program is - 15
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager::Shader
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager shader loaded: Water
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Water
|
||||||
2024-Jun-08 20:53:34: Prepare to add shader Frame
|
2024-Jun-08 23:23:28: Prepare to add shader Frame
|
||||||
2024-Jun-08 20:53:34: 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-08 20:53:34: 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-08 20:53:34: Shader program is - 18
|
2024-Jun-08 23:23:28: Shader program is - 18
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager::Shader
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager shader loaded: Frame
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Frame
|
||||||
2024-Jun-08 20:53:34: Prepare to add shader Lightview
|
2024-Jun-08 23:23:28: Prepare to add shader Lightview
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager::Shader WARNING: 0:5: '' : #version directive missing
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader WARNING: 0:5: '' : #version directive missing
|
||||||
|
|
||||||
|
|
||||||
2024-Jun-08 20:53:34: 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-08 20:53:34: Shader program is - 21
|
2024-Jun-08 23:23:28: Shader program is - 21
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager::Shader
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager shader loaded: Lightview
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Lightview
|
||||||
2024-Jun-08 20:53:34: Prepare to add shader Simple3D
|
2024-Jun-08 23:23:28: Prepare to add shader Simple3D
|
||||||
2024-Jun-08 20:53:34: 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-08 20:53:34: 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-08 20:53:34: Shader program is - 24
|
2024-Jun-08 23:23:28: Shader program is - 24
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager::Shader
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager::Shader
|
||||||
2024-Jun-08 20:53:34: ResourceManager::ShaderManager shader loaded: Simple3D
|
2024-Jun-08 23:23:28: ResourceManager::ShaderManager shader loaded: Simple3D
|
||||||
2024-Jun-08 20:53:34: ResourceManager::TexList Texture added: bt_box_yellow.bmp with id = 1
|
2024-Jun-08 23:23:28: ResourceManager::TexList Texture added: bt_box_yellow.bmp with id = 1
|
||||||
2024-Jun-08 20:53:34: ResourceManager::TexList Texture added: bt_box_norm.bmp32 with id = 2
|
2024-Jun-08 23:23:28: ResourceManager::TexList Texture added: bt_box_norm.bmp32 with id = 2
|
||||||
2024-Jun-08 20:53:34: Lite model added successfully: models/bt_box_yellow.lm1
|
2024-Jun-08 23:23:28: Lite model added successfully: models/bt_box_yellow.lm1
|
||||||
2024-Jun-08 20:53:34: ResourceManager::TexList Texture added: bt_cone.bmp with id = 3
|
2024-Jun-08 23:23:28: ResourceManager::TexList Texture added: bt_cone.bmp with id = 3
|
||||||
2024-Jun-08 20:53:34: Lite model added successfully: models/bt_cone.lm1
|
2024-Jun-08 23:23:28: Lite model added successfully: models/bt_cone.lm1
|
||||||
2024-Jun-08 20:53:34: Lite model added successfully: models/girl.lm1
|
2024-Jun-08 23:23:28: Lite model added successfully: models/girl.lm1
|
||||||
2024-Jun-08 20:53:34: Lite model added successfully: models/bonemodel.lm1
|
2024-Jun-08 23:23:29: Lite model added successfully: models/bonemodel.lm1
|
||||||
2024-Jun-08 20:53:35: ResourceManager::TexList Texture added: out.bmp with id = 4
|
2024-Jun-08 23:23:30: ResourceManager::TexList Texture added: out.bmp with id = 4
|
||||||
2024-Jun-08 20:53:35: FrameManager:: frame buffer added: Skybox
|
2024-Jun-08 23:23:30: FrameManager:: frame buffer added: Skybox
|
||||||
2024-Jun-08 20:53:35: ResourceManager::TexList Texture added: normalmap.bmp with id = 6
|
2024-Jun-08 23:23:30: ResourceManager::TexList Texture added: normalmap.bmp with id = 6
|
||||||
2024-Jun-08 20:53:35: 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/posx.bmp
|
||||||
2024-Jun-08 20:53:35: 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/negx.bmp
|
||||||
2024-Jun-08 20:53:35: 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/posy.bmp
|
||||||
2024-Jun-08 20:53:35: 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/negy.bmp
|
||||||
2024-Jun-08 20:53:35: 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/posz.bmp
|
||||||
2024-Jun-08 20:53:35: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/negz.bmp
|
2024-Jun-08 23:23:30: Going to add texture: C:\Work\OldProjects\ho3\resources\../resources/negz.bmp
|
||||||
2024-Jun-08 20:53:35: ResourceManager::TexList texture added succesfuly: posx.bmp
|
2024-Jun-08 23:23:30: ResourceManager::TexList texture added succesfuly: posx.bmp
|
||||||
2024-Jun-08 20:53:35: FrameManager:: frame buffer added: ScreenBlur
|
2024-Jun-08 23:23:30: FrameManager:: frame buffer added: ScreenBlur
|
||||||
2024-Jun-08 20:53:35: FrameManager:: frame buffer added: ShadowBufferGlobal
|
2024-Jun-08 23:23:30: FrameManager:: frame buffer added: ShadowBufferGlobal
|
||||||
2024-Jun-08 20:53:35: FrameManager:: frame buffer added: ShadowBufferLocal
|
2024-Jun-08 23:23:30: FrameManager:: frame buffer added: ShadowBufferLocal
|
||||||
|
@ -10,38 +10,49 @@ cardinal CONST_CUBEMAP_UPDATE_INTERVAL = 5000;
|
|||||||
|
|
||||||
void TMyApplication::DrawToCubemap()
|
void TMyApplication::DrawToCubemap()
|
||||||
{
|
{
|
||||||
Renderer->PushPerspectiveProjectionMatrix(pi/2, 1.0, 1, 1000);
|
|
||||||
Renderer->PushShader("Directlight");
|
Renderer->PushShader("Directlight");
|
||||||
|
|
||||||
Renderer->SwitchToCubemapBuffer("Skybox",0);
|
Renderer->SwitchToCubemapBuffer("Skybox",0);
|
||||||
Renderer->SetGlPosXView();
|
Renderer->SetGlPosXView(true);
|
||||||
DrawSceneWithoutWater();
|
DrawSceneWithoutWater();
|
||||||
|
//glClearColor()
|
||||||
|
//glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
Renderer->SwitchToCubemapBuffer("Skybox",1);
|
Renderer->SwitchToCubemapBuffer("Skybox",1);
|
||||||
Renderer->SetGlNegXView();
|
Renderer->SetGlNegXView(true);
|
||||||
|
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
DrawSceneWithoutWater();
|
DrawSceneWithoutWater();
|
||||||
|
|
||||||
Renderer->SwitchToCubemapBuffer("Skybox",2);
|
Renderer->SwitchToCubemapBuffer("Skybox",2);
|
||||||
Renderer->SetGlPosYView();
|
Renderer->SetGlPosYView(true);
|
||||||
DrawSceneWithoutWater();
|
DrawSceneWithoutWater();
|
||||||
|
//glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
|
||||||
|
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
Renderer->SwitchToCubemapBuffer("Skybox",3);
|
Renderer->SwitchToCubemapBuffer("Skybox",3);
|
||||||
Renderer->SetGlNegYView();
|
Renderer->SetGlNegYView(true);
|
||||||
|
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
DrawSceneWithoutWater();
|
DrawSceneWithoutWater();
|
||||||
|
|
||||||
Renderer->SwitchToCubemapBuffer("Skybox",4);
|
Renderer->SwitchToCubemapBuffer("Skybox",4);
|
||||||
Renderer->SetGlPosZView();
|
Renderer->SetGlPosZView(true);
|
||||||
DrawSceneWithoutWater();
|
DrawSceneWithoutWater();
|
||||||
|
//glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
|
||||||
|
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
|
||||||
Renderer->SwitchToCubemapBuffer("Skybox",5);
|
Renderer->SwitchToCubemapBuffer("Skybox",5);
|
||||||
Renderer->SetGlNegZView();
|
Renderer->SetGlNegZView(true);
|
||||||
|
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
//glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
DrawSceneWithoutWater();
|
DrawSceneWithoutWater();
|
||||||
|
|
||||||
Renderer->SwitchToScreen();
|
Renderer->SwitchToScreen();
|
||||||
|
|
||||||
Renderer->PopShader();
|
Renderer->PopShader();
|
||||||
|
|
||||||
Renderer->PopProjectionMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMyApplication::DrawToShadowMap()
|
void TMyApplication::DrawToShadowMap()
|
||||||
@ -74,17 +85,18 @@ void TMyApplication::DrawWaterSurface()
|
|||||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["normalmap.bmp"]);
|
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["normalmap.bmp"]);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, ResourceManager->FrameManager.GetFrameTexture("Skybox"));
|
glBindTexture(GL_TEXTURE_CUBE_MAP, ResourceManager->FrameManager.GetFrameTexture("Skybox"));
|
||||||
|
RenderUniformMatrix3fv(CONST_STRING_MODELROTATEMATRIX_UNIFORM, false, (float*)IdentityMatrix.m);
|
||||||
|
RenderUniform3fv(CONST_STRING_MODELTRANSLATEVECTOR_UNIFORM, (float*)ZeroVec3.v);
|
||||||
|
|
||||||
|
EnableVertexAttribArray("vPosition");
|
||||||
|
EnableVertexAttribArray("vTexCoord");
|
||||||
|
|
||||||
|
//Renderer->DrawTriangleList(TriangleList);
|
||||||
|
DrawVertexDataStruct(waterVertexDataStruct);
|
||||||
|
|
||||||
|
DisableVertexAttribArray("vPosition");
|
||||||
|
DisableVertexAttribArray("vTexCoord");
|
||||||
|
|
||||||
glBegin(GL_POLYGON);
|
|
||||||
glTexCoord2f(2, 2);
|
|
||||||
glVertex3f(20, 0, 20);
|
|
||||||
glTexCoord2f(2, 0);
|
|
||||||
glVertex3f(20, 0, -20);
|
|
||||||
glTexCoord2f(0, 0);
|
|
||||||
glVertex3f(-20, 0, -20);
|
|
||||||
glTexCoord2f(0, 2);
|
|
||||||
glVertex3f(-20, 0, 20);
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
Renderer->PopShader();
|
Renderer->PopShader();
|
||||||
}
|
}
|
||||||
@ -92,6 +104,7 @@ void TMyApplication::DrawWaterSurface()
|
|||||||
void TMyApplication::DrawCubemap()
|
void TMyApplication::DrawCubemap()
|
||||||
{
|
{
|
||||||
Renderer->PushShader("Env");
|
Renderer->PushShader("Env");
|
||||||
|
//Renderer->SetGLCamAngleView();
|
||||||
Renderer->SetGLCamAngleView();
|
Renderer->SetGLCamAngleView();
|
||||||
//Renderer->LoadIdentity();
|
//Renderer->LoadIdentity();
|
||||||
RenderUniformMatrix3fv(CONST_STRING_MODELROTATEMATRIX_UNIFORM, false, (float*)IdentityMatrix.m);
|
RenderUniformMatrix3fv(CONST_STRING_MODELROTATEMATRIX_UNIFORM, false, (float*)IdentityMatrix.m);
|
||||||
@ -296,6 +309,36 @@ void TMyApplication::InnerInit()
|
|||||||
|
|
||||||
|
|
||||||
cubemapVertexDataStruct.RefreshVBO();
|
cubemapVertexDataStruct.RefreshVBO();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
glBegin(GL_POLYGON);
|
||||||
|
glTexCoord2f(2, 2);
|
||||||
|
glVertex3f(20, 0, 20);
|
||||||
|
glTexCoord2f(2, 0);
|
||||||
|
glVertex3f(20, 0, -20);
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex3f(-20, 0, -20);
|
||||||
|
glTexCoord2f(0, 2);
|
||||||
|
glVertex3f(-20, 0, 20);
|
||||||
|
glEnd();*/
|
||||||
|
|
||||||
|
waterVertexDataStruct.PositionData.push_back({ -20, 0, -20 });
|
||||||
|
waterVertexDataStruct.PositionData.push_back({ 20, 0, -20 });
|
||||||
|
waterVertexDataStruct.PositionData.push_back({ 20, 0, 20 });
|
||||||
|
|
||||||
|
waterVertexDataStruct.PositionData.push_back({ -20, 0, -20 });
|
||||||
|
waterVertexDataStruct.PositionData.push_back({ 20, 0, 20 });
|
||||||
|
waterVertexDataStruct.PositionData.push_back({ -20, 0, 20 });
|
||||||
|
|
||||||
|
waterVertexDataStruct.TexCoordData.push_back({ 0.0, 0.0 });
|
||||||
|
waterVertexDataStruct.TexCoordData.push_back({ 2.0, 0.0 });
|
||||||
|
waterVertexDataStruct.TexCoordData.push_back({ 2.0, 2.0 });
|
||||||
|
|
||||||
|
waterVertexDataStruct.TexCoordData.push_back({ 0.0, 0.0 });
|
||||||
|
waterVertexDataStruct.TexCoordData.push_back({ 2.0, 2.0 });
|
||||||
|
waterVertexDataStruct.TexCoordData.push_back({ 0.0, 2.0 });
|
||||||
|
waterVertexDataStruct.RefreshVBO();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -321,45 +364,28 @@ void TMyApplication::InnerDraw()
|
|||||||
//Renderer->SwitchToCubemapBuffer("Skybox", 0);
|
//Renderer->SwitchToCubemapBuffer("Skybox", 0);
|
||||||
//Renderer->SetGlPosXView();
|
//Renderer->SetGlPosXView();
|
||||||
//DrawSceneWithoutWater();
|
//DrawSceneWithoutWater();
|
||||||
if (view == 6)
|
|
||||||
|
//DrawCubemap();
|
||||||
|
|
||||||
|
if (view % 3 == 0)
|
||||||
|
{
|
||||||
|
//DrawCubemap();
|
||||||
|
Renderer->SetGlPosXView();
|
||||||
|
DrawSceneWithoutWater();
|
||||||
|
}
|
||||||
|
else if (view % 3 == 1)
|
||||||
{
|
{
|
||||||
DrawCubemap();
|
DrawCubemap();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
Renderer->PushPerspectiveProjectionMatrix(pi / 2, 1.0, 1, 1000);
|
|
||||||
if (view == 0)
|
|
||||||
{
|
|
||||||
Renderer->SetGlNegZView();
|
|
||||||
}
|
|
||||||
else if (view == 1)
|
|
||||||
{
|
|
||||||
Renderer->SetGlNegYView();
|
|
||||||
}
|
|
||||||
else if (view == 2)
|
|
||||||
{
|
|
||||||
Renderer->SetGlPosXView();
|
|
||||||
}
|
|
||||||
else if (view == 3)
|
|
||||||
{
|
|
||||||
Renderer->SetGlNegXView();
|
|
||||||
}
|
|
||||||
else if (view == 4)
|
|
||||||
{
|
|
||||||
Renderer->SetGlPosZView();
|
|
||||||
}
|
|
||||||
else if (view == 5)
|
|
||||||
{
|
|
||||||
Renderer->SetGlPosYView();
|
|
||||||
}
|
|
||||||
DrawSceneWithoutWater();
|
DrawSceneWithoutWater();
|
||||||
Renderer->PopProjectionMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//DrawCubemap();
|
|
||||||
|
|
||||||
Renderer->PopShader();
|
Renderer->PopShader();
|
||||||
|
|
||||||
|
|
||||||
|
//DrawWaterSurface();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -42,6 +42,7 @@ class TMyApplication : public SE::TApplication
|
|||||||
|
|
||||||
cardinal cubemapTexture;
|
cardinal cubemapTexture;
|
||||||
VertexDataStruct cubemapVertexDataStruct;
|
VertexDataStruct cubemapVertexDataStruct;
|
||||||
|
VertexDataStruct waterVertexDataStruct;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -4,6 +4,10 @@ varying vec3 dir;
|
|||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
gl_FragColor = textureCube(Env, normalize(dir));
|
gl_FragColor = textureCube(Env, normalize(dir));
|
||||||
|
//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);
|
//gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
}
|
}
|
@ -10,5 +10,5 @@ void main(){
|
|||||||
vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0);
|
vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0);
|
||||||
gl_Position = ProjectionMatrix * realVertexPos;
|
gl_Position = ProjectionMatrix * realVertexPos;
|
||||||
|
|
||||||
dir = -vPosition;
|
dir = vPosition;
|
||||||
}
|
}
|
@ -4,13 +4,20 @@ uniform vec3 CamPos;
|
|||||||
uniform float WaterTimer;
|
uniform float WaterTimer;
|
||||||
|
|
||||||
|
|
||||||
|
varying vec2 texCoord;
|
||||||
|
varying vec3 vertexPos;
|
||||||
varying vec3 camVec;
|
varying vec3 camVec;
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 texCoord = gl_TexCoord[0].st;
|
vec3 camVec2 = normalize(camVec);
|
||||||
|
|
||||||
|
vec4 reflectColor = textureCube(Env, camVec2);
|
||||||
|
|
||||||
|
gl_FragColor = vec4(reflectColor.xyz, 1.0f);
|
||||||
|
|
||||||
|
/*
|
||||||
mat3 rot;
|
mat3 rot;
|
||||||
|
|
||||||
rot[0] = vec3(0.0,0.0,1.0);
|
rot[0] = vec3(0.0,0.0,1.0);
|
||||||
@ -29,9 +36,9 @@ void main()
|
|||||||
vec3 NVecReflect = normalize(rot * (NVec1 + NVec2) + vec3(0,8,0));
|
vec3 NVecReflect = normalize(rot * (NVec1 + NVec2) + vec3(0,8,0));
|
||||||
vec3 NVecRefract = normalize(rot * (NVec1 + NVec2));
|
vec3 NVecRefract = normalize(rot * (NVec1 + NVec2));
|
||||||
|
|
||||||
vec3 dir1 = reflect((camVec),NVecReflect);
|
vec3 dir1 = reflect((camVec2),NVecReflect);
|
||||||
//vec3 dir2 = refract((camVec),NVecRefract,0.9);
|
//vec3 dir2 = refract((camVec2),NVecRefract,0.9);
|
||||||
vec3 dir2 = reflect((camVec),NVecReflect);
|
vec3 dir2 = reflect((camVec2),NVecReflect);
|
||||||
dir2.y = - dir2.y;
|
dir2.y = - dir2.y;
|
||||||
|
|
||||||
vec4 reflectColor = textureCube(Env, dir1);
|
vec4 reflectColor = textureCube(Env, dir1);
|
||||||
@ -39,7 +46,8 @@ void main()
|
|||||||
|
|
||||||
vec4 texColor = reflectColor*0.2 + refractColor*0.8;
|
vec4 texColor = reflectColor*0.2 + refractColor*0.8;
|
||||||
|
|
||||||
gl_FragColor = vec4(texColor.xyz, 1.0f);
|
gl_FragColor = vec4(texColor.xyz, 1.0f);*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,13 +1,26 @@
|
|||||||
|
attribute vec3 vPosition;
|
||||||
|
attribute vec2 vTexCoord;
|
||||||
|
|
||||||
|
uniform mat4 ProjectionMatrix;
|
||||||
|
uniform mat3 ModelRotateMatrix;
|
||||||
|
uniform vec3 ModelTranslateVector;
|
||||||
uniform vec3 CamPos;
|
uniform vec3 CamPos;
|
||||||
|
|
||||||
|
varying vec2 texCoord;
|
||||||
|
varying vec3 vertexPos;
|
||||||
varying vec3 camVec;
|
varying vec3 camVec;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = ftransform();
|
vec4 realVertexPos = vec4(ModelRotateMatrix * vPosition.xyz + ModelTranslateVector, 1.0);
|
||||||
|
gl_Position = ProjectionMatrix * realVertexPos;
|
||||||
|
|
||||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
texCoord = vTexCoord;
|
||||||
|
|
||||||
camVec = (gl_Vertex.xyz - CamPos);
|
camVec = -(vPosition.xyz - CamPos);
|
||||||
|
|
||||||
|
//camVec = vec3(0, 1, 0);
|
||||||
|
|
||||||
|
//camVec.y = -camVec.y;
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user