Compare 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
vladislav.khorev 3f2572eaa5 Change height map and normal map 2018-01-22 01:00:58 +03:00
vladislav.khorev 86f0ad59bb Change height map and normal map 2018-01-22 00:37:11 +03:00
samat.agishev 13f3e3ee9b Added heightmap/normalmap for fibers 2018-01-19 19:23:11 +05:00
samat.agishev 95207620f6 Trying to imitate fabric seam 2018-01-18 20:29:21 +05:00
32 changed files with 39440 additions and 33516 deletions

No files matched your search

-1
View File
@@ -70,7 +70,6 @@ iOSInjectionProject/
/windows/DoubleHitBalls-win/DoubleHitBalls-win/Debug /windows/DoubleHitBalls-win/DoubleHitBalls-win/Debug
/windows/DoubleHitBalls-win/DoubleHitBalls-win/Release /windows/DoubleHitBalls-win/DoubleHitBalls-win/Release
/windows/DoubleHitBalls-win/.vs/ /windows/DoubleHitBalls-win/.vs/
/windows/DoubleHitBalls-win/**/*.user
/windows/DoubleHitBalls-win/DoubleHitBalls-win/log.txt /windows/DoubleHitBalls-win/DoubleHitBalls-win/log.txt
/windows/DoubleHitBalls-win/DoubleHitBalls-win/progress.txt /windows/DoubleHitBalls-win/DoubleHitBalls-win/progress.txt
/windows/DoubleHitBalls-win/DoubleHitBalls-win/resources /windows/DoubleHitBalls-win/DoubleHitBalls-win/resources
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 696 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

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

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

+3 -33230
View File
File diff suppressed because it is too large. Load diff
+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
-11
View File
@@ -1,11 +0,0 @@
{
"lines": [
{"start": [-500, -500], "end": [500, 500], "color": [0.25, 0, 0.4]},
{"start": [-500, 500], "end": [500, -500], "color": [0.1, 0.7, 0.4]},
{"start": [-400, -400], "end": [400, -400], "color": [0.3, 0.3, 0.0]},
{"start": [400, -400], "end": [400, 400], "color": [0.0, 0.3, 0.15]},
{"start": [400, 400], "end": [-400, 400], "color": [0.2, 0.6, 0.9]},
{"start": [-400, 400], "end": [-400, -400], "color": [0.5, 0.3, 0.1]}
]
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

+2 -3
View File
@@ -2,7 +2,6 @@ precision mediump float;
uniform sampler2D Texture; uniform sampler2D Texture;
uniform sampler2D NormalMap; uniform sampler2D NormalMap;
uniform sampler2D HeightMap; uniform sampler2D HeightMap;
uniform sampler2D TransparencyMask;
precision highp float; precision highp float;
@@ -13,7 +12,7 @@ varying vec3 ts_frag_pos;
const float num_layers = 16.0; const float num_layers = 16.0;
const float depth_scale = 0.002; const float depth_scale = 0.01;
@@ -64,6 +63,6 @@ void main(void)
// Normal mapping // Normal mapping
vec3 norm = normalize(texture2D(NormalMap, uv).rgb * 2.0 - 1.0); vec3 norm = normalize(texture2D(NormalMap, uv).rgb * 2.0 - 1.0);
float diffuse = max(dot(light_dir, norm), 0.0); float diffuse = max(dot(light_dir, norm), 0.0);
gl_FragColor = vec4(diffuse * albedo + ambient, texture2D(TransparencyMask, uv).a); gl_FragColor = vec4(diffuse * albedo + ambient, 1.0);
} }
+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);
}
@@ -1,14 +1,17 @@
attribute vec3 vPosition; attribute vec3 vPosition;
attribute vec3 vColor; attribute vec3 Normal;
attribute vec2 vTexCoord; attribute vec2 vTexCoord;
attribute vec3 vColor;
varying vec2 texCoord;
varying vec3 fragColor;
uniform mat4 ProjectionMatrix; uniform mat4 ProjectionMatrix;
varying vec2 texCoord;
varying vec3 fragNormal;
varying vec3 fragColor;
void main() { void main() {
gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0); gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0);
texCoord = vTexCoord; texCoord = vTexCoord;
fragNormal = Normal;
fragColor = vColor; 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;
}
-10
View File
@@ -1,10 +0,0 @@
precision mediump float;
uniform sampler2D Texture;
uniform sampler2D TransparencyMask;
varying vec2 texCoord;
void main() {
vec4 color = texture2D(Texture,texCoord).rgba;
gl_FragColor = vec4(color.rgb, texture2D(TransparencyMask, texCoord).a);
}
-11
View File
@@ -1,11 +0,0 @@
attribute vec3 vPosition;
attribute vec2 vTexCoord;
varying vec2 texCoord;
uniform mat4 ProjectionMatrix;
void main() {
gl_Position = ProjectionMatrix * vec4(vPosition.xyz, 1.0);
texCoord = vTexCoord;
}
-11
View File
@@ -1,11 +0,0 @@
precision mediump float;
uniform sampler2D Texture;
uniform sampler2D TransparencyMask;
varying vec2 texCoord;
varying vec3 fragColor;
void main() {
vec3 color = normalize(texture2D(Texture,texCoord).rgb + fragColor);
gl_FragColor = vec4(color, texture2D(TransparencyMask, texCoord).a);
}
+506 -220
View File
@@ -11,7 +11,28 @@
TMyApplication* Application; 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) { Matrix3f quatToMatrix(Vector4f q) {
Matrix3f result; Matrix3f result;
double sqw = q(3)*q(3); double sqw = q(3)*q(3);
@@ -44,13 +65,15 @@ Matrix3f quatToMatrix(Vector4f q) {
} }
void TMyApplication::InnerInit() { void TMyApplication::InnerInit()
{
Application = this; Application = this;
#ifdef TARGET_WIN32 #ifdef TARGET_WIN32
#ifdef NDEBUG #ifdef NDEBUG
ST::PathToResources = "../../../assets/"; ST::PathToResources = "resources/";
//ST::PathToResources = "resources/"; //ST::PathToResources = "../../../assets/";
#else #else
ST::PathToResources = "../../../assets/"; ST::PathToResources = "../../../assets/";
#endif #endif
@@ -60,7 +83,8 @@ void TMyApplication::InnerInit() {
ST::PathToResources = "assets/"; ST::PathToResources = "assets/";
#endif #endif
if (Console != NULL) { if (Console != NULL)
{
*Console<<"APP INIT\n"; *Console<<"APP INIT\n";
} }
srand (static_cast<size_t>(time(NULL))); srand (static_cast<size_t>(time(NULL)));
@@ -70,245 +94,428 @@ void TMyApplication::InnerInit() {
ResourceManager->ShaderManager.AddShader("ColorShader", "color_vertex.txt", "color_fragment.txt"); ResourceManager->ShaderManager.AddShader("ColorShader", "color_vertex.txt", "color_fragment.txt");
ResourceManager->ShaderManager.AddShader("SSAA_4X", "SSAA_4X.vertex", "SSAA_4X.frag"); ResourceManager->ShaderManager.AddShader("SSAA_4X", "SSAA_4X.vertex", "SSAA_4X.frag");
ResourceManager->ShaderManager.AddShader("ParallaxShader", "parallax_vertex.txt", "parallax_fragment.txt"); ResourceManager->ShaderManager.AddShader("ParallaxShader", "parallax_vertex.txt", "parallax_fragment.txt");
ResourceManager->ShaderManager.AddShader("Transparency", "Transparency.vertex", "Transparency.fragment"); //ResourceManager->ShaderManager.AddShader("SimpleShadingNoTex", "simple_shading_no_tex.vertex", "simple_shading_no_tex.fragment");
ResourceManager->ShaderManager.AddShader("TransparencyPlusColor", "transparencyPlusColor.vertex", "transparencyPlusColor.fragment"); ResourceManager->ShaderManager.AddShader("SimpleShading", "simple_shading.vertex", "simple_shading.fragment");
Renderer->PushShader("DefaultShader"); Renderer->PushShader("DefaultShader");
ResourceManager->TexList.AddTexture("console_bkg.bmp"); ResourceManager->TexList.AddTexture("console_bkg.bmp");
ResourceManager->TexList.AddTexture("owl-green.jpg");
ResourceManager->TexList.AddTexture("owl-green-height.png");
ResourceManager->TexList.AddTexture("owl-green-normal.png");
ResourceManager->TexList.AddTexture("background.jpg");
ResourceManager->TexList.AddTexture("pimgpsh.jpg"); ResourceManager->TexList.AddTexture("pimgpsh.jpg");
ResourceManager->TexList.AddTexture("fabric-texture.jpg"); ResourceManager->TexList.AddTexture("HeightMap.png");
ResourceManager->TexList.AddTexture("fabric-normal-map.png"); ResourceManager->TexList.AddTexture("NormalMap.png");
ResourceManager->TexList.AddTexture("fabric-height-map.png"); ResourceManager->TexList.AddTexture("linesAll.png");
ResourceManager->TexList.AddTexture("fabric-transparency-mask.png"); ResourceManager->TexList.AddTexture("clean-fabric-texture-4-780x585.jpg");
ResourceManager->TexList.AddTexture("5f.jpg"); ResourceManager->TexList.AddTexture("free-detailed-tiled-rope-texture-3d-model-low-poly-blend.png");
ResourceManager->TexList.AddTexture("6f.jpg");
ResourceManager->TexList.AddTexture("7f.jpg"); //
/*
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);
Vector2f const bottomLeft(-500, -500);
float const W = 1000;
float const H = 1000;
Vector2f const backgroundBottomLeft(-3000, -3000);
float const backgroundW = 6000;
float const backgroundH = 6000;
{ {
rect.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(-4096, 0, -4096)); //resolution of background image
rect.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(-4096, 0, 4096)); //float const imageW = 512;
rect.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(4096, 0, 4096)); //float const imageH = 512;
rect.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(-4096, 0, -4096));
rect.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(4096, 0, 4096));
rect.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(4096, 0, -4096));
rect.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0, 0)); float const imageW = 2048;
rect.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0, 1)); float const imageH = 2048;
rect.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(1, 1));
rect.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0, 0));
rect.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(1, 1));
rect.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(1, 0)); background.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].emplace_back(Vector3f(backgroundBottomLeft[0], 0, backgroundBottomLeft[1]));
background.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].emplace_back(Vector3f(backgroundBottomLeft[0], 0, backgroundBottomLeft[1] + backgroundH));
background.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].emplace_back(Vector3f(backgroundBottomLeft[0] + backgroundW, 0, backgroundBottomLeft[1] + backgroundH));
background.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].emplace_back(Vector3f(backgroundBottomLeft[0] + backgroundW, 0, backgroundBottomLeft[0] + backgroundH));
background.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].emplace_back(Vector3f(backgroundBottomLeft[0] + backgroundW, 0, backgroundBottomLeft[0]));
background.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].emplace_back(Vector3f(backgroundBottomLeft[0], 0, backgroundBottomLeft[0]));
float const tw = backgroundW / imageW;
float const th = backgroundH / imageH;
background.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].emplace_back(Vector2f(0, th));
background.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].emplace_back(Vector2f(0, 0));
background.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].emplace_back(Vector2f(tw, 0));
background.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].emplace_back(Vector2f(tw, 0));
background.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].emplace_back(Vector2f(tw, th));
background.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].emplace_back(Vector2f(0, th));
background.second.Data.Vec4CoordArr[CONST_STRING_COLOR_ATTRIB].emplace_back(Vector4f(1, 1, 1, 1));
background.second.Data.Vec4CoordArr[CONST_STRING_COLOR_ATTRIB].emplace_back(Vector4f(1, 1, 1, 1));
background.second.Data.Vec4CoordArr[CONST_STRING_COLOR_ATTRIB].emplace_back(Vector4f(1, 1, 1, 1));
background.second.Data.Vec4CoordArr[CONST_STRING_COLOR_ATTRIB].emplace_back(Vector4f(1, 1, 1, 1));
background.second.Data.Vec4CoordArr[CONST_STRING_COLOR_ATTRIB].emplace_back(Vector4f(1, 1, 1, 1));
background.second.Data.Vec4CoordArr[CONST_STRING_COLOR_ATTRIB].emplace_back(Vector4f(1, 1, 1, 1));
rect.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "pimgpsh.jpg";
rect.second.RefreshBuffer();
} }
{ auto findPlaneBasis = [] (const Vector3f &normal) {
size_t const mapWidth = 2048; std::vector<Vector3f> result;
size_t const mapHeight = 2048;
size_t const channelsCount = 4;
char *heightMap = new char[mapWidth * mapHeight * channelsCount];
char *material = new char[mapWidth * mapHeight * channelsCount];
char *normalMap = new char[mapWidth * mapHeight * channelsCount];
for(size_t z = 0; z < mapHeight; z++) { Vector3f e0, e1;
for(size_t x = 0; x < mapWidth; x++) { if(normal.z() != 0)
size_t index = channelsCount * (z * mapWidth + x); {
e0 = Vector3f(1, 0, -normal.x() / normal.z()).normalized();
heightMap[index + 0] = 0; e1 = Vector3f(0, 1, -normal.y() / normal.z());
heightMap[index + 1] = 0; }
heightMap[index + 2] = 0; else if(normal.y() != 0)
heightMap[index + 3] = 255; {
e0 = Vector3f(1, -normal.x() / normal.y(), 0).normalized();
material[index + 0] = 255; e1 = Vector3f(0, -normal.z() / normal.y(), 1);
material[index + 1] = 255; }
material[index + 2] = 255; else
material[index + 3] = 0; {
e0 = Vector3f(-normal.y() / normal.x(), 1, 0).normalized();
normalMap[index + 0] = 128; e1 = Vector3f(-normal.z() / normal.x(), 0, 1);
normalMap[index + 1] = 128;
normalMap[index + 2] = 255;
normalMap[index + 3] = 255;
}
} }
double *heightMapF = new double[mapWidth * mapHeight]; e1 = (e1 - (e1.dot(e0) / e0.dot(e0)) * e0).normalized();
const size_t threadsCount = 3;
const double threadWidth = 4.0;
const auto g = [this, mapWidth, mapHeight, channelsCount, threadWidth, threadsCount, heightMapF, material, normalMap](Vector2d start, Vector2d end, Vector3f &color) {
start = start + Vector2d(mapWidth / 2, mapHeight / 2);
end = end + Vector2d(mapWidth / 2, mapHeight / 2);
const auto length = (end - start).norm(); result.push_back(e0);
const Vector2d e0 = (end - start).normalized(); result.push_back(e1);
const Vector2d e1(-e0.y(), e0.x());
std::vector<Vector2d> corners; return result;
corners.push_back(start + threadWidth * e1); };
corners.push_back(start - threadWidth * e1);
corners.push_back(end + threadWidth * e1);
corners.push_back(end - threadWidth * e1);
auto minXf = corners[0].x(); {
auto maxXf = corners[0].x(); //float const R = 3;
auto minYf = corners[0].y(); float const R = 0;
auto maxYf = corners[0].y(); //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();
for(auto corner: corners) { //size_t const step = 5;
if(corner.x() < minXf) {minXf = corner.x();} float const step = 20;
if(corner.x() > maxXf) {maxXf = corner.x();}
if(corner.y() < minYf) {minYf = corner.y();} const Vector3f vshift = Vector3f(0.f, 0.002f, 0.f);
if(corner.y() > maxYf) {maxYf = corner.y();} 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);
} }
const auto minX = floor(minXf); auto rotateMatrix1 = (
const auto maxX = ceil(maxXf); Translation3f((r + R) * direction) *
const auto minY = floor(minYf); AngleAxis<float>(
const auto maxY = floor(maxYf); -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();
const double r = threadWidth / 2; for(int i = -2; i < static_cast<int>(iterationsCount) + 2; i++) {
Matrix2d basisMatrix; std::vector<std::vector<Vector4f>> newThreads;
basisMatrix << e0.x(), e0.y(), e1.x(), e1.y();
for(auto x = minX; x <= maxX; x++) {
for(auto y = minY; y <= maxY; y++) {
if(x < 0 || x >= mapWidth || y < 0 || y >= mapHeight) {continue;}
Vector2d self = basisMatrix * Vector2d(x - start.x(), y - start.y());
if(self.x() >= 0 && self.x() <= length && self.y() >= -threadWidth && self.y() <= threadWidth) { for(auto j = 0; j < threadsCount; j++) {
const double phase = 6 * pi * self.x() / length; auto edges = threads[j];
std::vector<Vector2d> centers; std::vector<Vector4f> newEdges;
auto maxH = -1.0f; for(auto k = 0; k < edgesCount; k++) {
Vector3d normal; if(i < 0) {
for(size_t i = 0; i < threadsCount; i++) { newEdges.push_back(rotateMatrix1 * edges[k]);
Vector2d center = } else if(i < iterationsCount) {
r * sin(phase + 2 * pi * i / threadsCount) * Vector2d(1, 0) + newEdges.push_back(matrix * edges[k]);
r * cos(phase + 2 * pi * i / threadsCount) * Vector2d(0, 1); } else {
newEdges.push_back(rotateMatrix2 * edges[k]);
auto temp = r * r - (self.y() - center.x()) * (self.y() - center.x());
if(temp < 0) {continue;}
float h = sqrt(temp) + center.y();
if(h > maxH) {
maxH = h;
Vector3d center3d =
self.x() * Vector3d(e0.x(), e0.y(), 0) +
center.x() * Vector3d(e1.x(), e1.y(), 0) +
center.y() * Vector3d(0, 0, 1);
Vector3d intersection3d =
self.x() * Vector3d(e0.x(), e0.y(), 0) +
self.y() * Vector3d(e1.x(), e1.y(), 0) +
maxH * Vector3d(0, 0, 1);
normal = (intersection3d - center3d).normalized();
}
} }
}
size_t index = y * mapWidth + x; newThreads.push_back(newEdges);
if(heightMapF[index] > maxH / (2 * r)) {continue;}
heightMapF[index] = maxH / (2 * r); auto threadCenter_ = Vector4f(threadCenters[j].x(), threadCenters[j].y(), threadCenters[j].z(), 1);
material[4 * index] = 255 * color(0); auto threadCenter = threadCenter_.head(3);
material[4 * index + 1] = 255 * color(1);
material[4 * index + 2] = 255 * color(2);
material[4 * index + 3] = 255;
normalMap[4 * index] = 255 * (normal.x() + 1) / 2; Vector3f newThreadCenter;
normalMap[4 * index + 1] = 255 * (normal.y() + 1) / 2; if (i < 0) {
normalMap[4 * index + 2] = 255 * normal.z(); newThreadCenter = (rotateMatrix1 * threadCenter_).head(3);
normalMap[4 * index + 3] = 255; } 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; namespace pt = boost::property_tree;
pt::read_json(ST::PathToResources + "lines.json", root); pt::ptree root;
size_t counter = 0; //pt::read_json(ST::PathToResources + "lines.json", root);
for (auto line : root.get_child("lines")) { //pt::read_json(ST::PathToResources + "lines100500.json", root);
std::vector<double> start; pt::read_json(ST::PathToResources + "lines100500.json", root);
std::vector<double> end;
std::vector<double> color; int x = 0;
for (auto value : line.second.get_child("start")) {
start.push_back(value.second.get_value<double>()); 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++;
} }
for (auto value : line.second.get_child("end")) {
end.push_back(value.second.get_value<double>());
}
for (auto value : line.second.get_child("color")) {
color.push_back(value.second.get_value<double>());
}
g(Vector2d(start[0] / 4, start[1] / 4), Vector2d(end[0] / 4, end[1] / 4), Vector3f(color[0], color[1], color[2]));
counter++;
//if(counter > 3000) {
// break;
//}
} }
for(size_t i = 0; i < mapWidth; i++) {
for(size_t j = 0; j < mapHeight; j++) {
heightMap[4 * (i * mapWidth + j)] = 255 - 255 * heightMapF[i * mapWidth + j];
heightMap[4 * (i * mapWidth + j) + 1] = 255 - 255 * heightMapF[i * mapWidth + j];
heightMap[4 * (i * mapWidth + j) + 2] = 255 - 255 * heightMapF[i * mapWidth + j];
heightMap[4 * (i * mapWidth + j) + 3] = 255;
}
}
delete[] heightMapF;
SE::TTextureData heightMapTexture;
heightMapTexture.Width = mapWidth;
heightMapTexture.Height = mapHeight;
heightMapTexture.Format = "bmp32";
heightMapTexture.DataSize = mapWidth * mapHeight * channelsCount;
heightMapTexture.Data = boost::shared_array<char>(heightMap);
ResourceManager->TexList.AddTexture("HeightMapTexture", heightMapTexture);
SE::TTextureData materialTexture;
materialTexture.Width = mapWidth;
materialTexture.Height = mapHeight;
materialTexture.Format = "bmp32";
materialTexture.DataSize = mapWidth * mapHeight * channelsCount;
materialTexture.Data = boost::shared_array<char>(material);
ResourceManager->TexList.AddTexture("MaterialTexture", materialTexture);
SE::TTextureData normalMapTexture;
normalMapTexture.Width = mapWidth;
normalMapTexture.Height = mapHeight;
normalMapTexture.Format = "bmp32";
normalMapTexture.DataSize = mapWidth * mapHeight * channelsCount;
normalMapTexture.Data = boost::shared_array<char>(normalMap);
ResourceManager->TexList.AddTexture("NormalMapTexture", normalMapTexture);
} }
{ background.first.ShaderName ="DefaultShader";
pair.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(-2048, 5, -2048)); fabricRender.first.ShaderName = "SimpleShading";
pair.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(-2048, 5, 2048)); //fabricRender.first.ShaderName = "SimpleShadingNoTex";
pair.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(2048, 5, 2048));
pair.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(-2048, 5, -2048));
pair.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(2048, 5, 2048));
pair.second.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB].push_back(Vector3f(2048, 5, -2048));
pair.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0, 0)); /*
pair.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0, 1)); * Line below should be in tes-engine/include/ShaderManager/ShaderManager.h
pair.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(1, 1)); */
pair.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(0, 0)); std::string const CONST_STRING_HEIGHTMAP_UNIFORM = "HeightMap";
pair.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(1, 1));
pair.second.Data.Vec2CoordArr[CONST_STRING_TEXCOORD_ATTRIB].push_back(Vector2f(1, 0));
pair.second.RefreshBuffer(); background.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "pimgpsh.jpg";
pair.first.ShaderName = "ParallaxShader";
pair.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "MaterialTexture"; fabricRender.first.SamplerMap[CONST_STRING_NORMALMAP_UNIFORM] = "NormalMap.png";
pair.first.SamplerMap["HeightMap"] = "HeightMapTexture"; fabricRender.first.SamplerMap[CONST_STRING_HEIGHTMAP_UNIFORM] = "HeightMap.png";
pair.first.SamplerMap["NormalMap"] = "NormalMapTexture"; //fabricRender.first.SamplerMap[CONST_STRING_TEXTURE_UNIFORM] = "clean-fabric-texture-4-780x585.jpg";
pair.first.SamplerMap["TransparencyMask"] = "MaterialTexture"; 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.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; Inited = true;
} }
@@ -321,13 +528,28 @@ void TMyApplication::InnerDeinit()
{ {
*Console<<"APP DEINIT\n"; *Console<<"APP DEINIT\n";
} }
} }
void TMyApplication::InnerOnTapDown(Vector2f p) {} void TMyApplication::InnerOnTapDown(Vector2f p)
{
posArr.clear();
normArr.clear();
colorArr.clear();
void TMyApplication::InnerOnTapUp(Vector2f p) {} //fabricRender.second.Data.Vec2CoordArr.clear();
//fabricRender.second.Data.Vec3CoordArr.clear();
}
void TMyApplication::InnerOnTapUpAfterMove(Vector2f p) {} void TMyApplication::InnerOnTapUp(Vector2f p)
{
}
void TMyApplication::InnerOnTapUpAfterMove(Vector2f p)
{
}
void TMyApplication::InnerOnMove(Vector2f p, Vector2f shift) void TMyApplication::InnerOnMove(Vector2f p, Vector2f shift)
{ {
@@ -353,59 +575,123 @@ void TMyApplication::OnFling(Vector2f v)
void TMyApplication::OnMouseWheel(short int delta) void TMyApplication::OnMouseWheel(short int delta)
{ {
distance += delta; distance += delta;
/*if (distance > 2500)
{
distance = 2500;
}*/
if (distance < 100)
{
distance = 100;
}
} }
void TMyApplication::InnerDraw() void TMyApplication::InnerDraw()
{ {
Renderer->SwitchToScreen();
Renderer->SetPerspectiveProjection(pi / 6, 10.f, 10000.f); Renderer->SetPerspectiveProjection(pi / 6, 100.f, 40000.f);
Renderer->SetFullScreenViewport(); Renderer->SetFullScreenViewport();
Renderer->PushMatrix(); Renderer->PushMatrix();
Renderer->TranslateMatrix(Vector3f(0, 0, -distance)); Renderer->TranslateMatrix(Vector3f(0, 0, -distance));
Vector4f quat1 = Vector4f(sin(phi / 2), 0, 0, cos(phi / 2)); Vector4f quat1 = Vector4f(sin(phi / 2), 0, 0, cos(phi / 2));
Vector4f quat2 = Vector4f(0, sin(alpha / 2), 0, cos(alpha / 2)); Vector4f quat2 = Vector4f(0, sin(alpha / 2), 0, cos(alpha / 2));
Renderer->RotateMatrix(quat1); Renderer->RotateMatrix(quat1);
Renderer->RotateMatrix(quat2); Renderer->RotateMatrix(quat2);
glDisable(GL_DEPTH_TEST);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
CheckGlError(""); CheckGlError("");
auto mat1 = quatToMatrix(quat1); auto mat1 = quatToMatrix(quat1);
auto mat2 = quatToMatrix(quat2); auto mat2 = quatToMatrix(quat2);
Vector3f lightPos = {0.f, 1.f, 1.f}; Vector3f lightPos = {0.f, 1.f, 1.f};
Vector3f eye = mat2 * (mat1 * Vector3f(0.0f, 0.f, -distance));
Vector3f eye = mat2 * mat1 * Vector3f(0.0f, 0.f, -distance);
{ {
TRenderParamsSetter params(rect.first); TRenderParamsSetter params(background.first);
Renderer->DrawTriangleList(rect.second);
}
{
TRenderParamsSetter params(pair.first);
RenderUniform3fv("eye", eye.data()); RenderUniform3fv("eye", eye.data());
RenderUniform3fv("lightPos", lightPos.data()); RenderUniform3fv("lightPos", lightPos.data());
Matrix3f normMatrix = Renderer->GetModelviewMatrix().inverse().transpose().block<3, 3>(0, 0); Matrix3f normMatrix = Renderer->GetModelviewMatrix().inverse().transpose().block<3, 3>(0, 0);
RenderUniformMatrix3fv("NormalMatrix", false, normMatrix.data()); RenderUniformMatrix3fv("NormalMatrix", false, normMatrix.data());
RenderUniformMatrix4fv("ModelViewMatrix", false, Renderer->GetModelviewMatrix().data()); RenderUniformMatrix4fv("ModelViewMatrix", false, Renderer->GetModelviewMatrix().data());
RenderUniformMatrix3fv("ModelViewMatrix3x3", false, Renderer->GetModelviewMatrix().block<3, 3>(0, 0).data()); RenderUniformMatrix3fv("ModelViewMatrix3x3", false, Renderer->GetModelviewMatrix().block<3, 3>(0, 0).data());
Renderer->DrawTriangleList(pair.second);
Renderer->DrawTriangleList(background.second);
} }
//glEnable(GL_CULL_FACE);
{
TRenderParamsSetter params(fabricRender.first);
RenderUniform3fv("eye", eye.data());
RenderUniform3fv("lightPos", lightPos.data());
Matrix3f normMatrix = Renderer->GetModelviewMatrix().inverse().transpose().block<3,3>(0,0);
RenderUniformMatrix3fv("NormalMatrix", false, normMatrix.data());
RenderUniformMatrix4fv("ModelViewMatrix", false, Renderer->GetModelviewMatrix().data());
RenderUniformMatrix3fv("ModelViewMatrix3x3", false, Renderer->GetModelviewMatrix().block<3,3>(0,0).data());
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);
}
Renderer->PopMatrix(); Renderer->PopMatrix();
CheckGlError(""); CheckGlError("");
} }
void TMyApplication::InnerUpdate(size_t dt) {}
bool TMyApplication::IsLoaded() { void TMyApplication::InnerUpdate(size_t dt)
{
}
bool TMyApplication::IsLoaded()
{
return Loaded; return Loaded;
} }
bool TMyApplication::IsInited() { bool TMyApplication::IsInited()
{
return Inited; return Inited;
} }
+5 -7
View File
@@ -20,10 +20,12 @@
#include "boost/assign.hpp" #include "boost/assign.hpp"
#include "boost/bind.hpp" #include "boost/bind.hpp"
#include "boost/property_tree/ptree.hpp"
#include "boost/property_tree/json_parser.hpp"
#include "include/Engine.h" #include "include/Engine.h"
#include "boost/signals2.hpp"//Signal must be included after asio #include "boost/signals2.hpp"//Signal must be included after asio
#include "boost/property_tree/json_parser.hpp"
using namespace SE; using namespace SE;
@@ -34,12 +36,8 @@ protected:
bool Inited; bool Inited;
public: public:
TRenderPair pair; TRenderPair fabricRender;
TRenderPair rect; TRenderPair background;
TRenderPair heightMapPair;
TRenderPair normalMapPair;
TRenderPair texturePair;
bool Loaded; bool Loaded;
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?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"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@@ -22,27 +22,27 @@
<ProjectGuid>{1CC98EEE-BBCB-4D79-B6D7-8511789172C5}</ProjectGuid> <ProjectGuid>{1CC98EEE-BBCB-4D79-B6D7-8511789172C5}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>DoubleHitBallswin</RootNamespace> <RootNamespace>DoubleHitBallswin</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
@@ -147,7 +147,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<Optimization>Disabled</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;TARGET_WIN32;_WIN32_WINNT=0x0501;WIN32_LEAN_AND_MEAN;EIGEN_DONT_ALIGN_STATICALLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -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) LPSTR lpszCmdLine, int nCmdShow)
{ {
int width = 512; int width = 1024;
int height = 512; int height = 1024;
if (CreateEngine(width, height)) if (CreateEngine(width, height))