Finalizing render
This commit is contained in:
parent
3f567533bf
commit
ac296727de
@ -1,42 +1,42 @@
|
|||||||
{
|
{
|
||||||
"ices": [
|
"ices": [
|
||||||
{
|
{
|
||||||
"position": [ -20, 0, -50 ],
|
"position": [ -20, 0.8, -50 ],
|
||||||
"scale": 1,
|
"scale": 1,
|
||||||
"angle": 0,
|
"angle": 0,
|
||||||
"type": 1,
|
"type": 1,
|
||||||
"texture": 1
|
"texture": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"position": [ 30, 0, 30 ],
|
"position": [ 30, 0.7, 30 ],
|
||||||
"scale": 0.3,
|
"scale": 0.3,
|
||||||
"angle": 0,
|
"angle": 0,
|
||||||
"type": 2,
|
"type": 2,
|
||||||
"texture": 2
|
"texture": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"position": [ -10, 0, 50 ],
|
"position": [ -10, 0.7, 50 ],
|
||||||
"scale": 0.1,
|
"scale": 0.1,
|
||||||
"angle": 0,
|
"angle": 0,
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"texture": 3
|
"texture": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"position": [ 0, 0, 50 ],
|
"position": [ 0, 0.7, 50 ],
|
||||||
"scale": 0.1,
|
"scale": 0.1,
|
||||||
"angle": 0,
|
"angle": 0,
|
||||||
"type": 4,
|
"type": 4,
|
||||||
"texture": 1
|
"texture": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"position": [ 30, 0, 30 ],
|
"position": [ 30, 0.7, 30 ],
|
||||||
"scale": 0.2,
|
"scale": 0.2,
|
||||||
"angle": 0,
|
"angle": 0,
|
||||||
"type": 5,
|
"type": 5,
|
||||||
"texture": 2
|
"texture": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"position": [ 50, 0, -50 ],
|
"position": [ 50, 0.7, -50 ],
|
||||||
"scale": 2,
|
"scale": 2,
|
||||||
"angle": 0,
|
"angle": 0,
|
||||||
"type": 6,
|
"type": 6,
|
||||||
|
@ -5,6 +5,7 @@ uniform sampler2D NormalMap;
|
|||||||
uniform vec3 LightDirection;
|
uniform vec3 LightDirection;
|
||||||
uniform float TimeOfDayCoef1;
|
uniform float TimeOfDayCoef1;
|
||||||
uniform float TimeOfDayCoef2;
|
uniform float TimeOfDayCoef2;
|
||||||
|
uniform float invCoef;
|
||||||
uniform vec3 TimeOfDayColor;
|
uniform vec3 TimeOfDayColor;
|
||||||
varying vec2 texCoord;
|
varying vec2 texCoord;
|
||||||
|
|
||||||
@ -24,4 +25,10 @@ void main()
|
|||||||
//gl_FragColor = vec4(((texture2D(Texture, texCoord).rgb + vec3(0.0, 0.1, 0.2)) * (0.4)), 1.0);
|
//gl_FragColor = vec4(((texture2D(Texture, texCoord).rgb + vec3(0.0, 0.1, 0.2)) * (0.4)), 1.0);
|
||||||
|
|
||||||
gl_FragColor = vec4(((texture2D(Texture, texCoord).rgb + TimeOfDayColor) * (cosf * TimeOfDayCoef1 + TimeOfDayCoef2)), 1.0);
|
gl_FragColor = vec4(((texture2D(Texture, texCoord).rgb + TimeOfDayColor) * (cosf * TimeOfDayCoef1 + TimeOfDayCoef2)), 1.0);
|
||||||
|
|
||||||
|
if (posVec.y < 0.0)
|
||||||
|
{
|
||||||
|
discard;
|
||||||
|
//gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ attribute vec3 Tangent;
|
|||||||
attribute vec3 Binormal;
|
attribute vec3 Binormal;
|
||||||
attribute vec2 vTexCoord;
|
attribute vec2 vTexCoord;
|
||||||
|
|
||||||
|
uniform mat4 ModelViewMatrix;
|
||||||
uniform mat4 ProjectionMatrix;
|
uniform mat4 ProjectionMatrix;
|
||||||
uniform vec3 CamPos;
|
uniform vec3 CamPos;
|
||||||
|
|
||||||
@ -29,5 +30,5 @@ void main()
|
|||||||
|
|
||||||
normVec = Normal;
|
normVec = Normal;
|
||||||
|
|
||||||
posVec = vPosition;
|
posVec = vPosition.xyz;
|
||||||
}
|
}
|
@ -21,7 +21,7 @@ extern float lastOffsetX;
|
|||||||
|
|
||||||
#ifdef TARGET_WIN32
|
#ifdef TARGET_WIN32
|
||||||
int TimeOfDayPref = 0;
|
int TimeOfDayPref = 0;
|
||||||
bool SnowPref = false;
|
bool SnowPref = true;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
extern int TimeOfDayPref;
|
extern int TimeOfDayPref;
|
||||||
@ -94,7 +94,14 @@ void TAndroidApplication::LoadModels()
|
|||||||
Vector3f size = objData.models[0].maxCorner - objData.models[0].minCorner;
|
Vector3f size = objData.models[0].maxCorner - objData.models[0].minCorner;
|
||||||
float radius = myMax(size[0], myMax(size[1], size[2])) / 2;
|
float radius = myMax(size[0], myMax(size[1], size[2])) / 2;
|
||||||
|
|
||||||
mountainTransformation = Affine3f(Scaling(cameraDistance / radius * 0.25f)).matrix();
|
SE::MoveDataTriangleList(mountain.second.Data, Vector3f(0, -10.0, 0));
|
||||||
|
|
||||||
|
mountain.second.RefreshBuffer();
|
||||||
|
|
||||||
|
|
||||||
|
mountainTransformation = Affine3f(Scaling(cameraDistance / radius * 0.5f)).matrix();
|
||||||
|
//mountainTransformation = Affine3f(Translation3f(0, -size[1] * 0.02f, 0)).matrix() * mountainTransformation;
|
||||||
|
|
||||||
//mountainTransformation = Affine3f(Translation3f(0, -size[1] / 20 * cameraDistance / radius * 0.25f, 0)).matrix() * mountainTransformation;
|
//mountainTransformation = Affine3f(Translation3f(0, -size[1] / 20 * cameraDistance / radius * 0.25f, 0)).matrix() * mountainTransformation;
|
||||||
//Matrix3f rotation(Quaternionf(0, 1 * sin(pi / 8 + pi / 2), 0, 1 * cos(pi / 8 + pi / 2)).toRotationMatrix());
|
//Matrix3f rotation(Quaternionf(0, 1 * sin(pi / 8 + pi / 2), 0, 1 * cos(pi / 8 + pi / 2)).toRotationMatrix());
|
||||||
//mountainTransformation = Affine3f(rotation).matrix() * mountainTransformation;
|
//mountainTransformation = Affine3f(rotation).matrix() * mountainTransformation;
|
||||||
@ -104,6 +111,13 @@ void TAndroidApplication::LoadModels()
|
|||||||
{
|
{
|
||||||
objData = loadObjFile("ice/ice" + std::to_string(i) + ".obj", "");
|
objData = loadObjFile("ice/ice" + std::to_string(i) + ".obj", "");
|
||||||
ices[i - 1] = ObjDataToRenderPairs(objData)[0][0].second;
|
ices[i - 1] = ObjDataToRenderPairs(objData)[0][0].second;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//SE::MoveDataTriangleList(ices[i - 1].Data, Vector3f(0, 0.1f, 0));
|
||||||
|
|
||||||
|
ices[i - 1].RefreshBuffer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size = objData.models[0].maxCorner - objData.models[0].minCorner;
|
size = objData.models[0].maxCorner - objData.models[0].minCorner;
|
||||||
@ -130,7 +144,9 @@ void TAndroidApplication::LoadModels()
|
|||||||
iceParams.push_back(params);
|
iceParams.push_back(params);
|
||||||
|
|
||||||
Matrix4f iceTransformation = Affine3f(Translation3f(centerShift)).matrix();
|
Matrix4f iceTransformation = Affine3f(Translation3f(centerShift)).matrix();
|
||||||
iceTransformation = Affine3f(Scaling(cameraDistance / radius * 0.1f * scale)).matrix() * iceTransformation;
|
//iceTransformation = Affine3f(Scaling(cameraDistance / radius * 0.1f * scale)).matrix() * iceTransformation;
|
||||||
|
|
||||||
|
|
||||||
//Matrix3f rotation(Quaternionf(0, cos(angle*pi / 360.f), 0, sin(angle*pi / 360.f)).toRotationMatrix());
|
//Matrix3f rotation(Quaternionf(0, cos(angle*pi / 360.f), 0, sin(angle*pi / 360.f)).toRotationMatrix());
|
||||||
//iceTransformation = Affine3f(rotation).matrix() * iceTransformation;
|
//iceTransformation = Affine3f(rotation).matrix() * iceTransformation;
|
||||||
iceTransformation = Affine3f(Translation3f(position)).matrix() * iceTransformation;
|
iceTransformation = Affine3f(Translation3f(position)).matrix() * iceTransformation;
|
||||||
@ -155,7 +171,6 @@ void TAndroidApplication::DrawSceneWithoutWater(bool inv)
|
|||||||
|
|
||||||
Renderer->PushProjectionMatrix(1,1);
|
Renderer->PushProjectionMatrix(1,1);
|
||||||
Renderer->LoadIdentity();
|
Renderer->LoadIdentity();
|
||||||
//Renderer->PushSpecialMatrix(Matrix4f::Identity());
|
|
||||||
|
|
||||||
if (inv)
|
if (inv)
|
||||||
{
|
{
|
||||||
@ -169,13 +184,13 @@ void TAndroidApplication::DrawSceneWithoutWater(bool inv)
|
|||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky.png"]);
|
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky.png"]);
|
||||||
}
|
}
|
||||||
Renderer->DrawRect(Vector2f(0.0f, 0.56f), Vector2f(1.f, 0.f), Vector2f(0.5f + SkyTexShift, 0.f), Vector2f(1.f + SkyTexShift, 1.f));
|
Renderer->DrawRect(Vector2f(0.0f, 0.55f), Vector2f(1.f, 0.f), Vector2f(0.5f + SkyTexShift, 0.f), Vector2f(1.f + SkyTexShift, 1.f));
|
||||||
|
|
||||||
if (TimeOfDayPref == 1)
|
if (TimeOfDayPref == 1)
|
||||||
{
|
{
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["final_cloud.png"]);
|
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["final_cloud.png"]);
|
||||||
Renderer->DrawRect(Vector2f(0.0f, 0.56f), Vector2f(4.f, 0.f), Vector2f(0.0f + SkyTexShift + CloudTimer, 0.f), Vector2f(1.f + SkyTexShift + CloudTimer, 0.5f));
|
Renderer->DrawRect(Vector2f(0.0f, 0.55f), Vector2f(4.f, 0.f), Vector2f(0.0f + SkyTexShift + CloudTimer, 0.f), Vector2f(1.f + SkyTexShift + CloudTimer, 0.5f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -188,13 +203,13 @@ void TAndroidApplication::DrawSceneWithoutWater(bool inv)
|
|||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky.png"]);
|
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["sky.png"]);
|
||||||
}
|
}
|
||||||
Renderer->DrawRect(Vector2f(0.0f, 0.54f), Vector2f(1.f, 1.f), Vector2f(0.5f + SkyTexShift, 0.f), Vector2f(1.f + SkyTexShift, 1.f));
|
Renderer->DrawRect(Vector2f(0.0f, 0.55f), Vector2f(1.f, 1.f), Vector2f(0.5f + SkyTexShift, 0.f), Vector2f(1.f + SkyTexShift, 1.f));
|
||||||
|
|
||||||
if (TimeOfDayPref == 1)
|
if (TimeOfDayPref == 1)
|
||||||
{
|
{
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["final_cloud.png"]);
|
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["final_cloud.png"]);
|
||||||
Renderer->DrawRect(Vector2f(0.0f, 0.54f), Vector2f(4.f, 1.f), Vector2f(0.0f + SkyTexShift + CloudTimer, 0.f), Vector2f(1.f + SkyTexShift + CloudTimer, 0.5f));
|
Renderer->DrawRect(Vector2f(0.0f, 0.55f), Vector2f(4.f, 1.f), Vector2f(0.0f + SkyTexShift + CloudTimer, 0.f), Vector2f(1.f + SkyTexShift + CloudTimer, 0.5f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,15 +241,31 @@ void TAndroidApplication::DrawSceneWithoutWater(bool inv)
|
|||||||
|
|
||||||
if (inv)
|
if (inv)
|
||||||
{
|
{
|
||||||
//Renderer->PushMatrix();
|
Renderer->TranslateMatrix(Vector3f(0, 0.0f, 0));
|
||||||
Renderer->TranslateMatrix(Vector3f(0,0.1f,0));
|
|
||||||
Renderer->ScaleMatrix(Vector3f(1, -1, 1));
|
Renderer->ScaleMatrix(Vector3f(1, -1, 1));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Renderer->TranslateMatrix(Vector3f(0, 0.0f, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Renderer->PushShader("SimplelightShader");
|
Renderer->PushShader("SimplelightShader");
|
||||||
|
|
||||||
RenderUniform3fv("LightDirection", Vector3f(1, 1, 1).data());
|
RenderUniform3fv("LightDirection", Vector3f(1, 1, 1).data());
|
||||||
|
|
||||||
|
if (inv)
|
||||||
|
{
|
||||||
|
RenderUniform1f("invCoef", -1.0f);
|
||||||
|
RenderUniform1f("extraSpace", 2.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RenderUniform1f("invCoef", 1.0f);
|
||||||
|
RenderUniform1f("extraSpace", 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Vector3f dayColor = Vector3f(0,0,0);
|
Vector3f dayColor = Vector3f(0,0,0);
|
||||||
Vector3f nightColor = Vector3f(0, 0.1f, 0.2f);
|
Vector3f nightColor = Vector3f(0, 0.1f, 0.2f);
|
||||||
@ -322,8 +353,8 @@ void TAndroidApplication::DrawSnow()
|
|||||||
|
|
||||||
void TAndroidApplication::DrawAllScene(bool toScreen)
|
void TAndroidApplication::DrawAllScene(bool toScreen)
|
||||||
{
|
{
|
||||||
glClearColor(1.f, 0.f, 1.f, 1.0f);
|
//glClearColor(1.f, 0.f, 1.f, 1.0f);
|
||||||
//glClearColor(1.f, 1.f, 1.f, 1.0f);
|
glClearColor(0.9f, 0.9f, 1.f, 1.0f);
|
||||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
Renderer->PushMatrix();
|
Renderer->PushMatrix();
|
||||||
@ -332,6 +363,8 @@ void TAndroidApplication::DrawAllScene(bool toScreen)
|
|||||||
Renderer->PushShader("ClipShader");
|
Renderer->PushShader("ClipShader");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Renderer->SwitchToFrameBuffer("WaterFrame");
|
Renderer->SwitchToFrameBuffer("WaterFrame");
|
||||||
Renderer->SetGLCamView();
|
Renderer->SetGLCamView();
|
||||||
Renderer->ScaleMatrix(Vector3f(1, -1, 1));
|
Renderer->ScaleMatrix(Vector3f(1, -1, 1));
|
||||||
@ -376,12 +409,13 @@ void TAndroidApplication::DrawAllScene(bool toScreen)
|
|||||||
Renderer->SetFrameViewport("ScreenshotFrame");
|
Renderer->SetFrameViewport("ScreenshotFrame");
|
||||||
}
|
}
|
||||||
|
|
||||||
Renderer->DrawFramePartScreen("WaterFrame", Vector2f(0, 0), Vector2f(1.f, 0.54f));
|
Renderer->DrawFramePartScreen("WaterFrame", Vector2f(0, 0), Vector2f(1.f, 0.55f));
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0); // return back
|
glActiveTexture(GL_TEXTURE0); // return back
|
||||||
|
|
||||||
Renderer->PopShader();
|
Renderer->PopShader();
|
||||||
|
|
||||||
|
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
Renderer->SetGLCamView();
|
Renderer->SetGLCamView();
|
||||||
@ -393,10 +427,10 @@ void TAndroidApplication::DrawAllScene(bool toScreen)
|
|||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["snow.png"]);
|
glBindTexture(GL_TEXTURE_2D, ResourceManager->TexList["snow.png"]);
|
||||||
|
|
||||||
//if (SnowPref)
|
if (SnowPref)
|
||||||
//{
|
{
|
||||||
// DrawSnow();
|
DrawSnow();
|
||||||
//}
|
}
|
||||||
|
|
||||||
Renderer->PopShader();
|
Renderer->PopShader();
|
||||||
|
|
||||||
@ -455,7 +489,6 @@ void TAndroidApplication::InnerInit()
|
|||||||
boost::get<TPanoramicCamera>(Renderer->Camera).MovePhi(pi / 360.f * 5);
|
boost::get<TPanoramicCamera>(Renderer->Camera).MovePhi(pi / 360.f * 5);
|
||||||
mCamera.MovePhi(pi / 360.f * 5);
|
mCamera.MovePhi(pi / 360.f * 5);
|
||||||
|
|
||||||
|
|
||||||
if (Renderer->GetScreenWidth() > Renderer->GetScreenHeight())
|
if (Renderer->GetScreenWidth() > Renderer->GetScreenHeight())
|
||||||
{
|
{
|
||||||
boost::get<TPanoramicCamera>(Renderer->Camera).MoveDist(150.f);
|
boost::get<TPanoramicCamera>(Renderer->Camera).MoveDist(150.f);
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "boost/shared_ptr.hpp"
|
#include "boost/shared_ptr.hpp"
|
||||||
#include "boost/thread/thread.hpp"
|
#include "boost/thread/thread.hpp"
|
||||||
#include "boost/asio.hpp"
|
#include "boost/asio.hpp"
|
||||||
#include "boost/signal.hpp"
|
|
||||||
#include "boost/assign.hpp"
|
#include "boost/assign.hpp"
|
||||||
#include "boost/variant.hpp"
|
#include "boost/variant.hpp"
|
||||||
#include "boost/function.hpp"
|
#include "boost/function.hpp"
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>../../jni/;../../../boost_1_67_0;../../../eigen-3.3.4;../../../tes-engine;../../../libs/jpeg-9;../../../libs/jpeg-9/vc10;../../../libs/lpng1510;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../../jni/;../../../boost_1_67_0;../../../eigen;../../../tes-engine;../../../libs/jpeg-9;../../../libs/jpeg-9/vc10;../../../libs/lpng1510;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<ExceptionHandling>Sync</ExceptionHandling>
|
<ExceptionHandling>Sync</ExceptionHandling>
|
||||||
<PreprocessorDefinitions>TARGET_WIN32;DEBUG;_WIN32_WINNT=0x0600;EIGEN_DONT_ALIGN_STATICALLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>TARGET_WIN32;DEBUG;_WIN32_WINNT=0x0600;EIGEN_DONT_ALIGN_STATICALLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
@ -114,7 +114,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>../../jni/;../../../boost_1_67_0;../../../eigen-3.3.4;../../../tes-engine;../../../libs/jpeg-9;../../../libs/jpeg-9/vc10;../../../libs/lpng1510;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>../../jni/;../../../boost_1_67_0;../../../eigen;../../../tes-engine;../../../libs/jpeg-9;../../../libs/jpeg-9/vc10;../../../libs/lpng1510;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<ExceptionHandling>Async</ExceptionHandling>
|
<ExceptionHandling>Async</ExceptionHandling>
|
||||||
<PreprocessorDefinitions>TARGET_WIN32;NDEBUG;_WIN32_WINNT=0x0501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>TARGET_WIN32;NDEBUG;_WIN32_WINNT=0x0501;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
Loading…
Reference in New Issue
Block a user