So I chose the name Tunnel Man because I wanted to make tunnels. Tunnels have walls and without induces it takes 6 vertices to make a wall. These are 2 units wide. I have decided to do things from scratch because I have used game engines and some things I could not find out how to do, But this was easy when it came to doing this because I could make an object to be my wall and it’s translation is always available. In order to do things within the limits of the computer I must create new walls and delete the ones I don’t need. This is generally how I would remove them in a game engine:
for (int i=0;i < walls.size();i++){
if (abs(walls[i].translation.x - mapx * 2) > 2 && abs(walls[i].translation.z - mapz * 2) > 2) walls[i].delete();
}
This is just made up code but you can understand the idea if you know code.
This is my real OpenGL code to make the wall.
void MazeHolder::addwall(glm::vec3 rotation, glm::vec3 translation, float type)
{
for (int i = 0; i < prevtrans.size(); i++) {
if (translation == prevtrans.at(i).translation) return;
}
WallInfo info;
info.translation = translation;
info.number = wallVertices.size();
prevtrans.push_back(info);
NormalVertex vertex;
float rotx = glm::radians(rotation.x);
float roty = glm::radians(rotation.y);
float rotz = glm::radians(rotation.z);
glm::mat4 rotMatrix = glm::eulerAngleXYZ(rotx, roty, rotz);
glm::mat4 transMatrix = glm::translate(glm::mat4(1.0), translation);
glm::mat4 model = transMatrix * rotMatrix;
glm::vec4 lnorm = rotMatrix * glm::vec4(0, 1, 0, 1);
glm::mat3 trpos = glm::mat3(glm::transpose(glm::inverse(transMatrix)));
vertex.normal = trpos * glm::vec3(lnorm);
vertex.wallType = type;
Pass3 ref;
Pass3 loc;
for (int i = 0; i < 6; i++) {
vertex.position = glm::vec3(model * glm::vec4(ppos[posind[i]], 1));
vertex.texCoord = ptex[texind[i]];
//loc = getTangents(ref, trpos);
wallVertices.push_back(vertex);
}
}
I have tried different ways to do this, here is a remnant of 1 attempt: prevtrans.push_back(info);
I have tried putting 6 vertices in a group but because I didn’t see anything I think that the code couldn’t decode the addresses.