示例#1
0
        public static void Build(Vector3i localPos, Vector3i worldPos, OpenCog.Map.OCMap map, OpenCog.Builder.OCMeshBuilder mesh, bool onlyLight)
        {
            OpenCog.Map.OCBlockData block = map.GetBlock(worldPos);
            OCCubeBlock             cube  = (OCCubeBlock)block.block;

            OpenCog.Map.OCBlockDirection direction = block.GetDirection();

            for (int i = 0; i < 6; i++)
            {
                OCCubeBlock.CubeFace face    = faces[i];
                Vector3i             dir     = directions[i];
                Vector3i             nearPos = worldPos + dir;
                if (IsFaceVisible(map, nearPos))
                {
                    if (!onlyLight)
                    {
                        BuildFace(face, cube, direction, localPos, mesh);
                    }
                    BuildFaceLight(face, map, worldPos, mesh);
                }
            }
        }
示例#2
0
        private static void BuildFace(OpenCog.BlockSet.BaseBlockSet.OCCubeBlock.CubeFace face, OpenCog.BlockSet.BaseBlockSet.OCCubeBlock cube, OpenCog.Map.OCBlockDirection direction, Vector3 localPos, OpenCog.Builder.OCMeshBuilder mesh)
        {
            int iFace = (int)face;

            mesh.AddFaceIndices(cube.AtlasID);
            mesh.AddVertices(vertices[iFace], localPos);
            mesh.AddNormals(normals[iFace]);
            mesh.AddTexCoords(cube.GetFaceUV(face, direction));
        }