Compare commits

...
8 Commits
Author SHA1 Message Date
vladislav.khorev 248d5c2efe Some changes 2018-07-13 22:59:13 +05:00
emil.kabirov bfdbf06328 Fixing some stuff 2018-06-18 01:13:04 +05:00
alexander.biryukov 0ce48eaf8f Fix fragment shader 2018-05-31 20:10:02 +05:00
alexander.biryukov 24fd919de3 Coloring 2018-05-31 19:47:36 +05:00
alexander.biryukov c5b64370cc Minor improvements 2018-05-31 19:03:33 +05:00
alexander.biryukov bdef3aca47 Cleanup 2018-05-31 15:33:57 +05:00
alexander.biryukov c613d00511 Simple Shading 2018-05-30 20:36:00 +05:00
alexander.biryukov 46b7b28b2b Threads 2018-05-30 18:09:27 +05:00
19 changed files with 39354 additions and 72 deletions

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

+7
View File
@@ -0,0 +1,7 @@
{
"lines": [
{"start": [-500, -500], "end": [500, -500], "color": [0.3, 0.3, 0.0]},
{"start": [500, -500], "end": [500, 500], "color": [0.0, 0.3, 0.15]},
{"start": [500, 500], "end": [-500, -500], "color": [0.25, 0, 0.4]}
]
}
+12270
View File
File diff suppressed because it is too large. Load diff
+26587
View File
File diff suppressed because it is too large. Load diff
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

+18
View File
@@ -0,0 +1,18 @@
precision mediump float;
uniform sampler2D Texture;
uniform float Transparency;
uniform vec4 LightDirection;
varying vec2 texCoord;
varying vec3 fragNormal;
varying vec3 fragColor;
void main() {
vec4 color = vec4((fragColor.rgb * texture2D(Texture, texCoord).rgb), 1.0);
float intensity = clamp(dot(normalize(LightDirection.xyz), -normalize(fragNormal)), 0, 1);
gl_FragColor = vec4(color.rgb * intensity + vec3(0.2, 0.2, 0.2), color.a * Transparency);
//gl_FragColor = vec4((fragNormal.rgb + vec3(1.0, 1.0, 1.0))*0.5, 1.0);
}
+17
View File
@@ -0,0 +1,17 @@
attribute vec3 vPosition;
attribute vec3 Normal;
attribute vec2 vTexCoord;
attribute vec3 vColor;
uniform mat4 ProjectionMatrix;
varying vec2 texCoord;
varying vec3 fragNormal;
varying vec3 fragColor;
void main() {
gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0);
texCoord = vTexCoord;
fragNormal = Normal;
fragColor = vColor;
}
+16
View File
@@ -0,0 +1,16 @@
precision mediump float;
uniform float Transparency;
uniform vec4 LightDirection;
varying vec3 fragNormal;
varying vec3 fragColor;
void main() {
vec4 color = vec4(fragColor.rgb, 1.0);
float intensity = clamp(dot(normalize(LightDirection.xyz), -normalize(fragNormal)), 0, 1);
gl_FragColor = vec4(color.rgb * intensity + vec3(0.2, 0.2, 0.2), color.a * Transparency);
}
+14
View File
@@ -0,0 +1,14 @@
attribute vec3 vPosition;
attribute vec3 Normal;
attribute vec3 vColor;
uniform mat4 ProjectionMatrix;
varying vec3 fragNormal;
varying vec3 fragColor;
void main() {
gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0);
fragNormal = Normal;
fragColor = vColor;
}
Regular → Executable
+408 -63
View File
@@ -12,6 +12,24 @@
TMyApplication* Application;
std::vector<SE::Vector3f> posArr;
std::vector<SE::Vector3f> normArr;
std::vector<SE::Vector3f> colorArr;
std::vector<SE::Vector2f> texCoordArr;
GLuint posBuffer;
GLuint normBuffer;
GLuint colorBuffer;
GLuint texCoordBuffer;
size_t posArrIndex = 0;
size_t normArrIndex = 0;
size_t colorArrIndex = 0;
size_t texCoordArrIndex = 0;
Matrix3f quatToMatrix(Vector4f q) {
@@ -55,6 +73,7 @@ void TMyApplication::InnerInit()
#ifdef TARGET_WIN32
#ifdef NDEBUG
ST::PathToResources = "resources/";
//ST::PathToResources = "../../../assets/";
#else
ST::PathToResources = "../../../assets/";
#endif
@@ -75,14 +94,36 @@ void TMyApplication::InnerInit()
ResourceManager->ShaderManager.AddShader("ColorShader", "color_vertex.txt", "color_fragment.txt");
ResourceManager->ShaderManager.AddShader("SSAA_4X", "SSAA_4X.vertex", "SSAA_4X.frag");
ResourceManager->ShaderManager.AddShader("ParallaxShader", "parallax_vertex.txt", "parallax_fragment.txt");
//ResourceManager->ShaderManager.AddShader("SimpleShadingNoTex", "simple_shading_no_tex.vertex", "simple_shading_no_tex.fragment");
ResourceManager->ShaderManager.AddShader("SimpleShading", "simple_shading.vertex", "simple_shading.fragment");
Renderer->PushShader("DefaultShader");
ResourceManager->TexList.AddTexture("console_bkg.bmp");
ResourceManager->TexList.AddTexture("background.jpg");
ResourceManager->TexList.AddTexture("pimgpsh.jpg");
ResourceManager->TexList.AddTexture("HeightMap.png");
ResourceManager->TexList.AddTexture("NormalMap.png");
ResourceManager->TexList.AddTexture("linesAll.png");
ResourceManager->TexList.AddTexture("clean-fabric-texture-4-780x585.jpg");
ResourceManager->TexList.AddTexture("free-detailed-tiled-rope-texture-3d-model-low-poly-blend.png");
//
/*
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].reserve(90000000);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB].reserve(90000000);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_COLOR_ATTRIB].reserve(90000000);
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].reserve(90000000);
*/
posArr.resize(20000000);
normArr.resize(20000000);
texCoordArr.resize(20000000);
colorArr.resize(20000000);
ResourceManager->FrameManager.AddFrameRenderBuffer("LevelBuffer", 512, 512);
@@ -90,14 +131,18 @@ void TMyApplication::InnerInit()
float const W = 1000;
float const H = 1000;
Vector2f const backgroundBottomLeft(-1000, -1000);
float const backgroundW = 2000;
float const backgroundH = 2000;
Vector2f const backgroundBottomLeft(-3000, -3000);
float const backgroundW = 6000;
float const backgroundH = 6000;
{
//resolution of background image
float const imageW = 512;
float const imageH = 512;
//float const imageW = 512;
//float const imageH = 512;
float const imageW = 2048;
float const imageH = 2048;
background.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].emplace_back(Vector3f(backgroundBottomLeft[0], 0, backgroundBottomLeft[1]));
@@ -129,75 +174,348 @@ void TMyApplication::InnerInit()
}
{
//resolution of linesAll.png
float const texW = 900;
float const texH = 900;
auto findPlaneBasis = [] (const Vector3f &normal) {
std::vector<Vector3f> result;
float const step = 12;
float const thick = 10;
auto f = [this, texW, texH, thick, W, H] (const Vector3f &p1, const Vector3f &p2) {
auto pv = p2 - p1;
Vector3f ortho(pv[2], 0, pv[0]);
ortho.normalize();
auto p3 = p2 + ortho * thick;
auto p4 = p1 + ortho * thick;
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(p1);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(p2);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(p3);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(p3);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(p4);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(p1);
auto texThick = thick / texW;
auto m = (p1[0] + p2[0]) / 2 / texW;
auto y = H / texH;
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(m, 0));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(m, y));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(m + texThick, y));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(m + texThick, y));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(m + texThick, 0));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(m, 0));
};
Vector3f const stepDirection(1, 0, 0);
Vector3f p1(bottomLeft[0], 0, -bottomLeft[1]);
while (p1[0] < bottomLeft[0] + W) {
auto p2 = p1 - Vector3f(0, 0, W);
f(p1, p2);
auto p3 = p1 + step * stepDirection;
f(p3, p2);
p1 = p3;
Vector3f e0, e1;
if(normal.z() != 0)
{
e0 = Vector3f(1, 0, -normal.x() / normal.z()).normalized();
e1 = Vector3f(0, 1, -normal.y() / normal.z());
}
else if(normal.y() != 0)
{
e0 = Vector3f(1, -normal.x() / normal.y(), 0).normalized();
e1 = Vector3f(0, -normal.z() / normal.y(), 1);
}
else
{
e0 = Vector3f(-normal.y() / normal.x(), 1, 0).normalized();
e1 = Vector3f(-normal.z() / normal.x(), 0, 1);
}
e1 = (e1 - (e1.dot(e0) / e0.dot(e0)) * e0).normalized();
result.push_back(e0);
result.push_back(e1);
return result;
};
{
//float const R = 3;
float const R = 0;
//float const r = 4;
//float const r = 16;
float const r = 19;
//size_t const threadsCount = 3;
size_t const threadsCount = 1;
size_t const edgesCount = 6;
//float const angle = pi / 6;
float const angle = 0;
Vector3f up(0, 1, 0); up.normalize();
//size_t const step = 5;
float const step = 20;
const Vector3f vshift = Vector3f(0.f, 0.002f, 0.f);
int vShiftVal = 0;
auto g = [&] (Vector3f start, Vector3f end, const Vector3f &color, int x) {
Vector3f direction = (end - start).normalized();
end = end - (r + R) * direction;
float iterationsCount = (end - start).norm() / step;
auto e = findPlaneBasis(up);
std::vector<Vector3f> threadCenters;
std::vector<std::vector<Vector4f>> threads;
for(auto i = 0; i < threadsCount; i++) {
std::vector<Vector4f> edges;
Vector3f threadCenter = R * (e[0] * cosf(i * 2 * pi / threadsCount) + e[1] * sinf(i * 2 * pi / threadsCount));
threadCenters.push_back(threadCenter);
for(auto j = 0; j < edgesCount; j++) {
auto verticeCenter = threadCenter + r * (e[0] * cosf(j * 2 * pi / edgesCount) + e[1] * sinf(j * 2 * pi / edgesCount));
edges.push_back(Vector4f(verticeCenter.x(), verticeCenter.y(), verticeCenter.z(), 1));
}
threads.push_back(edges);
}
auto rotateMatrix1 = (
Translation3f((r + R) * direction) *
AngleAxis<float>(
-pi / 8,
direction.cross(up).normalized()
) *
Translation3f(-(r + R) * direction)
).matrix();
auto matrix = (
Translation3f((r + R) * up) *
AngleAxis<float>(
angle,
direction
) *
Translation3f(-(r + R) * up) *
Translation3f(static_cast<int>(step) * direction)
).matrix();
auto rotateMatrix2 = (
Translation3f(static_cast<int>(step) * direction * iterationsCount) *
Translation3f((r + R) * direction) *
AngleAxis<float>(
-pi / 8,
direction.cross(up).normalized()
) *
Translation3f(-(r + R) * direction) *
Translation3f(-static_cast<int>(step) * direction * iterationsCount)
).matrix();
for(int i = -2; i < static_cast<int>(iterationsCount) + 2; i++) {
std::vector<std::vector<Vector4f>> newThreads;
for(auto j = 0; j < threadsCount; j++) {
auto edges = threads[j];
std::vector<Vector4f> newEdges;
for(auto k = 0; k < edgesCount; k++) {
if(i < 0) {
newEdges.push_back(rotateMatrix1 * edges[k]);
} else if(i < iterationsCount) {
newEdges.push_back(matrix * edges[k]);
} else {
newEdges.push_back(rotateMatrix2 * edges[k]);
}
}
newThreads.push_back(newEdges);
auto threadCenter_ = Vector4f(threadCenters[j].x(), threadCenters[j].y(), threadCenters[j].z(), 1);
auto threadCenter = threadCenter_.head(3);
Vector3f newThreadCenter;
if (i < 0) {
newThreadCenter = (rotateMatrix1 * threadCenter_).head(3);
} else if (i < iterationsCount) {
newThreadCenter = (matrix * threadCenter_).head(3);
} else {
newThreadCenter = (rotateMatrix2 * threadCenter_).head(3);
}
threadCenters[j] = newThreadCenter;
for(auto k = 0; k < edgesCount; k++) {
auto vk = edges[k].head(3);
auto vk1 = edges[(k + 1) % edgesCount].head(3);
auto nvk = newEdges[k].head(3);
auto nvk1 = newEdges[(k + 1) % edgesCount].head(3);
posArr[posArrIndex] = start + vk + vshift*x;
posArrIndex++;
posArr[posArrIndex] = start + vk1 + vshift * x;
posArrIndex++;
//posArr[posArrIndex] = start + nvk;
//posArrIndex++;
//posArr[posArrIndex] = start + vk1;
//posArrIndex++;
posArr[posArrIndex] = start + nvk1 + vshift * x;
posArrIndex++;
posArr[posArrIndex] = start + nvk + vshift*x;
posArrIndex++;
normArr[normArrIndex] = vk - threadCenter;
normArrIndex++;
normArr[normArrIndex] = vk1 - threadCenter;
normArrIndex++;
//normArr[normArrIndex] = nvk - newThreadCenter;
//normArrIndex++;
//normArr[normArrIndex] = vk1 - threadCenter;
//normArrIndex++;
normArr[normArrIndex] = nvk1 - newThreadCenter;
normArrIndex++;
normArr[normArrIndex] = nvk - newThreadCenter;
normArrIndex++;
texCoordArr[texCoordArrIndex] = Vector2f((float)(k) / (edgesCount), (i + 2) / 4.f);
texCoordArrIndex++;
texCoordArr[texCoordArrIndex] = Vector2f((float)(k+10) / (edgesCount), (i + 2) / 4.f);
texCoordArrIndex++;
//texCoordArr[texCoordArrIndex] = Vector2f(0.1, 0.2);
//texCoordArrIndex++;
//texCoordArr[texCoordArrIndex] = Vector2f(0.2, 0.1);
//texCoordArrIndex++;
texCoordArr[texCoordArrIndex] = Vector2f((float)(k + 10) / (edgesCount), (i + 3) / 4.f);
texCoordArrIndex++;
texCoordArr[texCoordArrIndex] = Vector2f((float)k / (edgesCount), (i + 3) / 4.f);
texCoordArrIndex++;
colorArr[colorArrIndex] = color;
colorArrIndex++;
colorArr[colorArrIndex] = color;
colorArrIndex++;
colorArr[colorArrIndex] = color;
colorArrIndex++;
//colorArr[colorArrIndex] = color;
//colorArrIndex++;
colorArr[colorArrIndex] = color;
colorArrIndex++;
//colorArr[colorArrIndex] = color;
//colorArrIndex++;
/*
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(start + vk);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(start + vk1);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(start + nvk);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(start + vk1);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(start + nvk1);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(start + nvk);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB].push_back((vk - threadCenter));
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB].push_back((vk1 - threadCenter));
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB].push_back((nvk - newThreadCenter));
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB].push_back((vk1 - threadCenter));
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB].push_back((nvk1 - newThreadCenter));
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB].push_back((nvk - newThreadCenter));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0.1, 0.1));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0.2, 0.1));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0.1, 0.2));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0.2, 0.1));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0.2, 0.2));
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0.1, 0.2));
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_COLOR_ATTRIB].push_back(color);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_COLOR_ATTRIB].push_back(color);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_COLOR_ATTRIB].push_back(color);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_COLOR_ATTRIB].push_back(color);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_COLOR_ATTRIB].push_back(color);
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_COLOR_ATTRIB].push_back(color);
*/
}
}
threads = newThreads;
}
};
{
namespace pt = boost::property_tree;
pt::ptree root;
//pt::read_json(ST::PathToResources + "lines.json", root);
//pt::read_json(ST::PathToResources + "lines100500.json", root);
pt::read_json(ST::PathToResources + "lines100500.json", root);
int x = 0;
for(auto line: root.get_child("lines")) {
std::vector<int> start;
std::vector<int> end;
std::vector<float> color;
for(auto value: line.second.get_child("start")) {
start.push_back(value.second.get_value<int>());
}
for (auto value : line.second.get_child("end")) {
end.push_back(value.second.get_value<int>());
}
for (auto value : line.second.get_child("color")) {
color.push_back(value.second.get_value<float>());
}
g(Vector3f(start[0], 0, start[1]), Vector3f(end[0], 0, end[1]), Vector3f(color[0], color[1], color[2]), x);
x++;
}
}
}
background.first.ShaderName ="DefaultShader";
fabricRender.first.ShaderName = "ParallaxShader";
fabricRender.first.ShaderName = "SimpleShading";
//fabricRender.first.ShaderName = "SimpleShadingNoTex";
/*
* Line below should be in tes-engine/include/ShaderManager/ShaderManager.h
*/
std::string const CONST_STRING_HEIGHTMAP_UNIFORM = "HeightMap";
background.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "background.jpg";
background.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "pimgpsh.jpg";
fabricRender.first.SamplerMap[CONST_STRING_NORMALMAP_UNIFORM] = "NormalMap.png";
fabricRender.first.SamplerMap[CONST_STRING_HEIGHTMAP_UNIFORM] = "HeightMap.png";
fabricRender.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "linesAll.png";
//fabricRender.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "clean-fabric-texture-4-780x585.jpg";
fabricRender.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "free-detailed-tiled-rope-texture-3d-model-low-poly-blend.png";
fabricRender.first.Vec4Map[CONST_STRING_LIGHT_DIRECTION_UNIFORM] = Vector4f(0, -1, 0, 0);
background.second.RefreshBuffer();
fabricRender.second.RefreshBuffer();
//fabricRender.second.RefreshBuffer();
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].clear();
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB].clear();
fabricRender.second.Data.Vec3CoordArr[CONST_STRING_COLOR_ATTRIB].clear();
fabricRender.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].clear();
glGenBuffers(1, &posBuffer);
glBindBuffer(GL_ARRAY_BUFFER, posBuffer);
glBufferData(GL_ARRAY_BUFFER, posArr.size() * 12, &posArr[0], GL_STATIC_DRAW);
glGenBuffers(1, &normBuffer);
glBindBuffer(GL_ARRAY_BUFFER, normBuffer);
glBufferData(GL_ARRAY_BUFFER, normArr.size() * 12, &normArr[0], GL_STATIC_DRAW);
glGenBuffers(1, &colorBuffer);
glBindBuffer(GL_ARRAY_BUFFER, colorBuffer);
glBufferData(GL_ARRAY_BUFFER, colorArr.size() * 12, &colorArr[0], GL_STATIC_DRAW);
glGenBuffers(1, &texCoordBuffer);
glBindBuffer(GL_ARRAY_BUFFER, texCoordBuffer);
glBufferData(GL_ARRAY_BUFFER, texCoordArr.size() * 8, &texCoordArr[0], GL_STATIC_DRAW);
glDisable(GL_DEPTH_TEST);
Inited = true;
}
@@ -215,7 +533,12 @@ void TMyApplication::InnerDeinit()
void TMyApplication::InnerOnTapDown(Vector2f p)
{
posArr.clear();
normArr.clear();
colorArr.clear();
//fabricRender.second.Data.Vec2CoordArr.clear();
//fabricRender.second.Data.Vec3CoordArr.clear();
}
void TMyApplication::InnerOnTapUp(Vector2f p)
@@ -253,10 +576,10 @@ void TMyApplication::OnMouseWheel(short int delta)
{
distance += delta;
if (distance > 2500)
/*if (distance > 2500)
{
distance = 2500;
}
}*/
if (distance < 100)
{
@@ -267,7 +590,7 @@ void TMyApplication::OnMouseWheel(short int delta)
void TMyApplication::InnerDraw()
{
Renderer->SetPerspectiveProjection(pi / 6, 10.f, 10000.f);
Renderer->SetPerspectiveProjection(pi / 6, 100.f, 40000.f);
Renderer->SetFullScreenViewport();
@@ -283,10 +606,8 @@ void TMyApplication::InnerDraw()
Renderer->RotateMatrix(quat2);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glDisable(GL_DEPTH_TEST);
CheckGlError("");
@@ -312,6 +633,13 @@ void TMyApplication::InnerDraw()
Renderer->DrawTriangleList(background.second);
}
//glEnable(GL_CULL_FACE);
{
TRenderParamsSetter params(fabricRender.first);
@@ -324,7 +652,24 @@ void TMyApplication::InnerDraw()
RenderUniformMatrix4fv("ModelViewMatrix", false, Renderer->GetModelviewMatrix().data());
RenderUniformMatrix3fv("ModelViewMatrix3x3", false, Renderer->GetModelviewMatrix().block<3,3>(0,0).data());
Renderer->DrawTriangleList(fabricRender.second);
glBindBuffer(GL_ARRAY_BUFFER, posBuffer);
VertexAttribPointer3fv(CONST_STRING_POSITION_ATTRIB, 0, NULL);
glBindBuffer(GL_ARRAY_BUFFER, normBuffer);
VertexAttribPointer3fv(CONST_STRING_NORMAL_ATTRIB, 0, NULL);
glBindBuffer(GL_ARRAY_BUFFER, colorBuffer);
VertexAttribPointer3fv(CONST_STRING_COLOR_ATTRIB, 0, NULL);
glBindBuffer(GL_ARRAY_BUFFER, texCoordBuffer);
VertexAttribPointer2fv(CONST_STRING_TEXCOORD_ATTRIB, 0, NULL);
glDrawArrays(GL_QUADS, 0, posArrIndex);
//Renderer->DrawTriangleList(fabricRender.second);
}
Regular → Executable
+3
View File
@@ -20,6 +20,9 @@
#include "boost/assign.hpp"
#include "boost/bind.hpp"
#include "boost/property_tree/ptree.hpp"
#include "boost/property_tree/json_parser.hpp"
#include "include/Engine.h"
#include "boost/signals2.hpp"//Signal must be included after asio
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@@ -22,33 +22,34 @@
<ProjectGuid>{1CC98EEE-BBCB-4D79-B6D7-8511789172C5}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>DoubleHitBallswin</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -150,7 +151,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../../game;../../../../tes-engine;../../../../eigen;../../../../boost_1_63_0/;../../../../boost_1_63_0/bin.v2/libs/system/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/date_time/build/msvc-14.0/release/address-model-64/link-static/threading-multi/;../../../../boost_1_63_0/bin.v2/libs/regex/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/thread/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/chrono/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/signals/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../libs/boost-gil-extension;../../../../libs/jpeg-9;../../../../libs/jpeg-9/vc10;../../../../libs/lpng1510</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>../../../game;../../../../tes-engine;../../../../eigen;../../../../boost_1_67_0/;../../../../libs/boost-gil-extension;../../../../libs/jpeg-9;../../../../libs/jpeg-9/vc10;../../../../libs/lpng1510</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4503</DisableSpecificWarnings>
</ClCompile>
<Link>
@@ -158,7 +159,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>../../../game;../../../../tes-engine;../../../../eigen;../../../../boost_1_63_0/stage/x64/lib;../../../../boost_1_63_0/bin.v2/libs/system/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/date_time/build/msvc-14.0/release/address-model-64/link-static/threading-multi/;../../../../boost_1_63_0/bin.v2/libs/regex/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/thread/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/chrono/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../boost_1_63_0/bin.v2/libs/signals/build/msvc-14.0/release/address-model-64/link-static/threading-multi;../../../../libs/boost-gil-extension;../../../../libs/jpeg-9;../../../../libs/jpeg-9/vc10;../../../../libs/lpng1510;../x64/Release</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>../../../game;../../../../tes-engine;../../../../eigen;../../../../boost_1_67_0/stage/lib;../../../../libs/boost-gil-extension;../../../../libs/jpeg-9;../../../../libs/jpeg-9/vc10;../../../../libs/lpng1510;../x64/Release</AdditionalLibraryDirectories>
<AdditionalDependencies>libjpeg.lib;libpng.lib;Engine.lib;opengl32.lib;glu32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
@@ -8,8 +8,8 @@ int APIENTRY WinMain(HINSTANCE hCurrentInst, HINSTANCE hPreviousInst,
LPSTR lpszCmdLine, int nCmdShow)
{
int width = 512;
int height = 512;
int width = 1024;
int height = 1024;
if (CreateEngine(width, height))