#WALLS OF BABYLON WINDOWS#
When d doors and ww windows have been calculated using PolygonMeshBuilder then the form of the positions for interior wall w isĤ window inner positions number of windows More generally w+1 must be calculated using modulo nbWalls to complete the final wall of the house. These wall positions can be added to the house positions array and their indices incremented by nbIndices. Where nbIndices is the current number of indices. Using polygonMeshBuilder would create an interior wall positions array with Let V label be the position of a corner with the given label in the form of the triple x, y, z. Inner and Outer Walls with Doors and Windows MeshĪ flat shaded mesh will be created so the the normals for all surfaces will be at right angles to the surface.Ĭonsider inner wall w with one door and one window added as in Fig 6 showing corner labels. It was decided that edges to doors and windows would be exterior. Also because the interior and exterior walls were now separate it gave the possibility of applying different materials and colors to these walls.
This simplified the procedures for adding in the edges to doors and windows. To stop this effect a flat shaded mesh is necessary and rather than just converting the existing mesh to a flat shaded one it was decided to re-code for a flat shaded mesh from the start. However as you can see in the following playground sharing vertices and normals made the triangular facets stand out.
#WALLS OF BABYLON CODE#
Since for polygonMeshBuilder corners have to be in counter clockwise consecutive order, all doorspaces for each wall will have to be sorted in increasing order of their left value.Īt this stage code was written to add in the doors using existing positions. Also for each window, surfaces will have to be created at right angles to the inner and outer walls at the edges of the window.
Whereas the top surface between the inner and outer walls will not be changed the base surface will now have to accommodate vertical sections to form the gaps for the doors. This will be used to triangulate the wall polygons and a new method wallBuild (based on the existing build method) can be created that will correctly correlate indices to vertices to form the necessary 3D mesh. Luckily there is already a method of triangulating a polygon using PolygonMeshBuilder. Then the placement of the window positions will add holes to the polygon. Once the inner corner positions for the doors and windows are added then their outer corner positions are easily calculated.Īdding in the door positions will turn the wall from a rectangle to a concave polygon. To include the doors and walls the positions of their corners have to be added to the positions array.Īnd each group of corners has 3 * nbWalls entries. Top must be greater than zero and less than wall height - window height. A windowspace has three properties - a window, left and top, which, when it is part of wall w, are its horizonal distance from the inner corner w and the vertical distance from the top of the wall to the top of the window. A doorspace has two properties - a door and left, which, when it is part of wall w, is its horizontal distance from the inner corner w.Ī window has two properties, width and height.
These conditions are not checked by the code.Ī door has two properties, width and height. They must not overlap and must be contained wholly within a wall. The placement of door and window spaces must be checked by the user. Both types of spaces are cut at right angles to the wall they belong in. However a door space is assumed to be a space cut from the base and upwards, whereas a window space can be cut anywhere in the wall. Door and Window Spaces.įor this project doors and windows must be rectangular and are just defined by their width and height. So far fairly straight forward, now to add door and window spaces. Outer facets : w + 1 + 3nbWalls, w + 3nbWalls, w + nbWalls, w + 1 + nbWalls, w + 1 + 3nbWalls, w + nbWalls Top facets : w + 1 + 3nbWalls, w + 1 + 2nbWalls, w + 2nbWalls, w + 3nbWalls, w + 1 + nbWalls, w + 2nbWalls Inner wall facets : w, w + 2nbWalls, w + 1 + 2nbWalls, w, w + 1 + 2nbWalls, w + 1
Base facets : w, w + 1, w + 1 + nbWalls, w, w + 1 + nbWalls, w + nbWalls