示例#1
0
        private void GenerateFace(OctreeNode <NodeParms> node)
        {
            //需要找到该节点的端点位置
            byte cubeConfig = node.Parms.Config;
            int  index      = 0;

            while (MCTable.TriTable[cubeConfig, index] != -1)
            {
                int ei1 = MCTable.TriTable[cubeConfig, index];
                int ei2 = MCTable.TriTable[cubeConfig, index + 1];
                int ei3 = MCTable.TriTable[cubeConfig, index + 2];

                int normalTypeId = OctreeTable.ConfigToNormalTypeId[node.Parms.Config];

                Int16Triple p1 = GetIntersetedPointAtEdge(node, ei1, OctreeTable.NormalTypeIdToNormal[normalTypeId], node.Parms.D);
                Int16Triple p2 = GetIntersetedPointAtEdge(node, ei2, OctreeTable.NormalTypeIdToNormal[normalTypeId], node.Parms.D);
                Int16Triple p3 = GetIntersetedPointAtEdge(node, ei3, OctreeTable.NormalTypeIdToNormal[normalTypeId], node.Parms.D);

                mb.AddTriangle(p1, p2, p3);
                index += 3;
            }
        }
示例#2
0
        }//get copnfig

        private void ExtractTriangles(ref Cube cube, byte value, MeshBuilder_IntegerVertex builder)
        {
            if (SMCTable.TableFat[value, 0] != -1)
            {
                int index = 0;
                while (SMCTable.TableFat[value, index] != -1)
                {
                    Int16Triple t0 = cube.cubeImageIndices[SMCTable.TableFat[value, index]];
                    Int16Triple t1 = cube.cubeImageIndices[SMCTable.TableFat[value, index + 1]];
                    Int16Triple t2 = cube.cubeImageIndices[SMCTable.TableFat[value, index + 2]];
                    builder.AddTriangle(t0, t1, t2);
                    //builder.AddTriangle(new Point3d(t0.X,t0.Y,t0.Z), new Point3d(t1.X,t1.Y,t1.Z), new Point3d(t2.X,t2.Y,t2.Z ));
                    index += 3;
                }
            }
        }//extract triangles and put them into meshbuilder