From d6ee36c07158a7a47e34a678e72b490aec25f318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Tue, 18 Nov 2014 13:09:55 +0100 Subject: [PATCH] changed terrain normals to consider 8 vertices, looks the same --- Levels/heightmapLvlTest2.png | Bin 0 -> 16012 bytes terrain.cc | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 Levels/heightmapLvlTest2.png diff --git a/Levels/heightmapLvlTest2.png b/Levels/heightmapLvlTest2.png new file mode 100644 index 0000000000000000000000000000000000000000..75621db6ec969d49188ba96eea4ef7278efd9216 GIT binary patch literal 16012 zcmZ{LRZtvE(=G|NIE!0w4G`RYad&ruySuYkaCZn2AV_d`cXwxTch~>@F3-ienCTkn zs+p;&nST1|j#N^RL_s7#go1)Xk(Lru`AZ_^ltNo`tV^&dwS8*G?o7;kfh9qy&gn43(B`sEL|4yVBZ;s5L#F0JJ7<~dCpL|Dd zjL6x%I|_&+I|l0c`Ni4U%<@J*DL zh>ft@^7J^c10*D@17Fh`i|t05vQ|bs5MJGp_I+L(vG5z>874Zgarsf;Ae`HFdfoR0 zeBKTF|De$^FO@gx>t>Z()mI{5|%PCh@N;Z<6vL%%vVUPT`=_K$R9k1$M*FfHUCsnJ)2 zU!C=Ts)9bcqaExnuWqm9m`KM>U0N7`)ZJ+l2S@bC8B=Dn>Yw?1yWK4Pz@Nc?@<8VF;l=T`Xr(@p{Y4^Idcy29_`p?L3}TqsvKV zEp3ILm4W>a7w2nD4x4XJFB5H*Ir;{b=^<3$W3gyK`m8bBUw4Mc+6)JE$5_-Vi(SCk zrXz>FTiyk_w^$;-{CJxFtBc9FD*vaUfY0}?k0_`n(Rv2fyUJby@CYTksJ-SBT$gdC zX0Dt;HhaS0)5*}116PxWyBV6XF)RWCJsN0`K4t8#wic$KPb*hI-eVHK8H?DfpD8W1 zC6DcyKn13h!>*3Cm_Q&T&eg~x&1~$phc%9bBi#>ASNa&AO`=XbR-(*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cc +++ b/terrain.cc @@ -114,12 +114,20 @@ void Terrain::set_abData(float* abData, unsigned int dataCount, unsigned int row glm::vec3 sumNormals = glm::vec3(0.0f, 0.0f, 0.0f); for (int i=-1; i<2; i+=2) { for (int j=-1; j<2; j+=2) { - glm::vec3 vecA, vecB, normal; - vecA = glm::vec3((float)i, (heightmap[rowNum+i][columnNum] - heightmap[rowNum][columnNum]), 0.0f); - vecB = glm::vec3(0.0f, (heightmap[rowNum][columnNum+j] - heightmap[rowNum][columnNum]), (float)j); + glm::vec3 vecA, vecB, vecC, normal; + vecA = glm::normalize(glm::vec3((float)i, (heightmap[rowNum+i][columnNum] - heightmap[rowNum][columnNum]), 0.0f)); + vecB = glm::normalize(glm::vec3((float)i, (heightmap[rowNum+i][columnNum+j] - heightmap[rowNum][columnNum]), (float)j)); normal = glm::normalize(glm::cross(vecA, vecB)); - if(i+j!=0) + if(i+j!=0){ normal = normal*(-1.0f); + } + sumNormals += normal; + + vecC = glm::normalize(glm::vec3(0.0f, (heightmap[rowNum][columnNum+j] - heightmap[rowNum][columnNum]), (float)j)); + normal = glm::normalize(glm::cross(vecB, vecC)); + if(i+j!=0){ + normal = normal*(-1.0f); + } sumNormals += normal; } }