Beispiel #1
0
        public void GetCulledVertices_Test()
        {
            Chunk chunk = new Chunk();

            //Covering left and right of a block.
            chunk.SetBlock(new Vector3(5, 5, 5), BlockType.Dirt);
            chunk.SetBlock(new Vector3(4, 5, 5), BlockType.Dirt);
            chunk.SetBlock(new Vector3(6, 5, 5), BlockType.Dirt);

            int usedVertCount = 0;
            var result        = BlockMesh.GetCulledVertices(chunk.SidesExposedToAir(new Vector3(5, 5, 5)), out usedVertCount,
                                                            new Vector3(0, 0, 0)).ToList();

            Assert.AreEqual(new Vector3[]
            {
                new Vector3(-0.5f, 0.5f, 0.5f),   //Left Top Front 7
                new Vector3(0.5f, 0.5f, 0.5f),    //Right Top Front 6
                new Vector3(0.5f, 0.5f, -0.5f),   //Right Top Back 2
                new Vector3(-0.5f, 0.5f, -0.5f),  //Left Top Back 3
                new Vector3(-0.5f, -0.5f, -0.5f), //Left Bottom Back 0
                new Vector3(0.5f, -0.5f, -0.5f),  //Right Bottom Back 1
                new Vector3(0.5f, -0.5f, 0.5f),   //Right Bottom Front 5
                new Vector3(-0.5f, -0.5f, 0.5f),  //Left Bottom Front 4
                new Vector3(-0.5f, -0.5f, -0.5f), //Left Bottom Back 0
                new Vector3(0.5f, -0.5f, -0.5f),  //Right Bottom Back 1
                new Vector3(0.5f, 0.5f, -0.5f),   //Right Top Back 2
                new Vector3(-0.5f, 0.5f, -0.5f),  //Left Top Back 3
                new Vector3(-0.5f, -0.5f, 0.5f),  //Left Bottom Front 4
                new Vector3(0.5f, -0.5f, 0.5f),   //Right Bottom Front 5
                new Vector3(0.5f, 0.5f, 0.5f),    //Right Top Front 6
                new Vector3(-0.5f, 0.5f, 0.5f)    //Left Top Front 7
            }, result);

            Assert.AreEqual(16, usedVertCount);
        }
Beispiel #2
0
        /// <summary>
        /// InterBlockMesh の頂点情報とエフェクト情報をもとに BlockMesh を生成します。
        /// </summary>
        /// <param name="interMesh">頂点情報とエフェクト情報を提供する InterBlockMesh。</param>
        /// <returns>生成された BlockMesh。</returns>
        public BlockMesh Create(InterBlockMesh interMesh)
        {
            var lodCount = interMesh.MeshLods.Length;

            var mesh = new BlockMesh();

            mesh.SetMeshMaterials(interMesh.MeshMaterials);

            mesh.AllocateMeshLods(lodCount);

            for (int lod = 0; lod < lodCount; lod++)
            {
                var interMeshLod = interMesh.MeshLods[lod];
                var meshLod      = mesh.MeshLods[lod];

                var meshPartCount = interMeshLod.MeshParts.Length;
                meshLod.AllocateMeshParts(GraphicsDevice, meshPartCount);

                for (int i = 0; i < meshPartCount; i++)
                {
                    var interMeshPart = interMeshLod.MeshParts[i];
                    var meshPart      = meshLod.MeshParts[i];

                    meshPart.MeshMaterial = mesh.MeshMaterials[interMeshPart.MeshMaterialIndex];
                    meshPart.PopulateVertices(interMeshPart.Vertices);
                    meshPart.PopulateIndices(interMeshPart.Indices);
                }
            }

            return(mesh);
        }
Beispiel #3
0
 void InterBlockMeshLoadTaskCallback(string name, InterBlockMesh result)
 {
     if (meshName == name)
     {
         mesh = workspace.LoadBlockMesh(result);
     }
 }
        /// <summary>
        /// 分割ロード対応の BlockMesh を生成します。
        /// </summary>
        /// <param name="graphicsDevice">GraphicsDevice。</param>
        /// <param name="interBlockMesh">BlockMesh のロード元となる InterBlockMesh。</param>
        /// <returns>分割ロード対応の BlockMesh。</returns>
        BlockMesh CreatePhasedBlockMesh(GraphicsDevice graphicsDevice, InterBlockMesh interBlockMesh)
        {
            var lodCount = interBlockMesh.MeshLods.Length;

            var blockMesh = new BlockMesh();

            blockMesh.SetMeshMaterials(interBlockMesh.MeshMaterials);
            blockMesh.AllocateMeshLods(lodCount);

            for (int lod = 0; lod < lodCount; lod++)
            {
                var interMeshLod  = interBlockMesh.MeshLods[lod];
                var meshPartCount = interMeshLod.MeshParts.Length;
                var meshLod       = blockMesh.MeshLods[lod];

                meshLod.AllocateMeshParts(graphicsDevice, meshPartCount);

                for (int i = 0; i < meshPartCount; i++)
                {
                    var interMeshPart = interMeshLod.MeshParts[i];
                    var meshPart      = meshLod.MeshParts[i];

                    meshPart.MeshMaterial = blockMesh.MeshMaterials[interMeshPart.MeshMaterialIndex];
                }
            }

            return(blockMesh);
        }
Beispiel #5
0
        public ItemOreChunk(string name_, int id_, Color color, bool isIngot_) : base(id_, name_)
        {
            Model  model  = isIngot_ ? ContentManager.Get <Model>("Models/Ingots") : ContentManager.Get <Model>("Models/Chunk");
            Matrix matrix = BlockMesh.GetBoneAbsoluteTransform(model.Meshes[0].ParentBone);

            m_standaloneBlockMesh.AppendModelMeshPart(model.Meshes[0].MeshParts[0], matrix, makeEmissive: false, flipWindingOrder: false, doubleSided: false, flipNormals: false, color);
        }
Beispiel #6
0
        public override void GenerateTerrainVertices(Block block, BlockGeometryGenerator generator, TerrainGeometrySubsets geometry, int value, int x, int y, int z)
        {
            BlockMesh drawMesh = new BlockMesh();
            Point3    p        = new Point3(x, y, z);
            Terrain   terrain  = generator.Terrain;

            for (int i = 0; i < 6; i++)
            {
                Point3 pp = p + Fixdirection[i];
                int    v  = terrain.GetCellContents(pp.X, pp.Y, pp.Z);
                if (v == 1003)
                {
                    BlockMesh blockMesh = new BlockMesh();
                    Matrix    matrix    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh(eles[i]).ParentBone);
                    blockMesh.AppendModelMeshPart(model.FindMesh(eles[i]).MeshParts[0], matrix * Matrix.CreateScale(0.7f), false, false, false, false, Color.White);
                    drawMesh.AppendBlockMesh(blockMesh);
                }
            }
            BlockMesh blockMeshd = new BlockMesh();
            Matrix    matrixd    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh(eles[6]).ParentBone);

            blockMeshd.AppendModelMeshPart(model.FindMesh(eles[6]).MeshParts[0], matrixd * Matrix.CreateScale(0.7f), false, false, false, false, Color.White);
            drawMesh.AppendBlockMesh(blockMeshd);
            drawMesh.TransformPositions(Matrix.CreateTranslation(0.5f, 0.5f, 0.5f));
            if (!ComponentPlayUpdate.duliBlocks.ContainsKey(p))
            {
                ComponentPlayUpdate.duliBlocks.Add(p, texture);
            }
            generator.GenerateMeshVertices(block, x, y, z, drawMesh, Color.White, Matrix.Identity, ComponentPlayUpdate.GTV(x, y, z, geometry).SubsetTransparent);
            boundmesh = drawMesh;
        }
 /// <summary>
 /// 指定の LOD についての分割ロード要求をキューへ追加します。
 /// </summary>
 /// <param name="interBlockMesh">BlockMesh のロード元となる InterBlockMesh。</param>
 /// <param name="blockMesh">分割ロード対応の BlockMesh。</param>
 /// <param name="levelOfDetail">対象とする LOD。</param>
 void Enqueue(InterBlockMesh interBlockMesh, BlockMesh blockMesh, int levelOfDetail)
 {
     for (int i = 0; i < blockMesh.MeshLods[levelOfDetail].MeshParts.Count; i++)
     {
         Enqueue(interBlockMesh, blockMesh, levelOfDetail, i);
     }
 }
Beispiel #8
0
 /// <summary>
 /// BlockMesh をアンロードします。
 /// </summary>
 /// <param name="mesh">アンロードする BlockMesh。</param>
 public void Unload(BlockMesh mesh)
 {
     if (!meshes.Remove(mesh))
     {
         throw new InvalidOperationException("The specified BlockMesh is not managed.");
     }
     mesh.Dispose();
 }
Beispiel #9
0
        public void drawSign(Camera camera)
        {
            TexturedBatch3D texturedBatch3D = primitivesRenderer3D.TexturedBatch(m_renderTarget, false, 0, DepthStencilState.None, RasterizerState.CullCounterClockwiseScissor, BlendState.AlphaBlend, SamplerState.PointWrap);

            foreach (KeyValuePair <Point3, int> item in pointlist)
            {
                renderPoint = item.Key;
                if (Vector3.DistanceSquared(new Vector3(renderPoint), camera.ViewPosition) > 400f)
                {
                    continue;                                                                                               //超出20f视野
                }
                ComponentSingleChest singleChest = subsystemBlockEntities.GetBlockEntity(renderPoint.X, renderPoint.Y, renderPoint.Z).Entity.FindComponent <ComponentSingleChest>(true);
                if (singleChest == null || singleChest.GetSlotCount(0) == 0)
                {
                    continue;
                }
                int       mvalue = subsystemTerrain.Terrain.GetCellValue(renderPoint.X, renderPoint.Y, renderPoint.Z);
                int       mpos   = ILibrary.GetDirection(mvalue);
                BlockMesh signSurfaceBlockMesh = MekiasmInit.faceMeshes.Array[ILibrary.normalpos[mpos]];
                float     s                 = LightingManager.LightIntensityByLightValue[Terrain.ExtractLight(mvalue)];
                Color     color             = new Color(s, s, s);
                Vector3   signSurfaceNormal = MekiasmInit.faceNormals.Array[ILibrary.normalface[ILibrary.normalpos[mpos]]];
                Vector3   vector            = new Vector3(renderPoint);
                float     num3              = Vector3.Dot(camera.ViewPosition - (vector + new Vector3(0.5f)), signSurfaceNormal);
                Vector3   v                 = MathUtils.Max(0.01f * num3, 0.005f) * signSurfaceNormal;
                int       indecies          = signSurfaceBlockMesh.Indices.Count / 3;
                for (int i = 0; i < indecies; i += 2)
                {
                    if (i >= indecies)
                    {
                        break;
                    }
                    BlockMeshVertex blockMeshVertex  = signSurfaceBlockMesh.Vertices.Array[signSurfaceBlockMesh.Indices.Array[i * 3]];
                    BlockMeshVertex blockMeshVertex2 = signSurfaceBlockMesh.Vertices.Array[signSurfaceBlockMesh.Indices.Array[i * 3 + 1]];
                    BlockMeshVertex blockMeshVertex3 = signSurfaceBlockMesh.Vertices.Array[signSurfaceBlockMesh.Indices.Array[i * 3 + 2]];
                    Vector3         p  = blockMeshVertex.Position + vector + v;
                    Vector3         p2 = blockMeshVertex2.Position + vector + v;
                    Vector3         p3 = blockMeshVertex3.Position + vector + v;
                    Vector2         textureCoordinates  = ILibrary.getTexcoord(2);
                    Vector2         textureCoordinates2 = ILibrary.getTexcoord(3);
                    Vector2         textureCoordinates3 = ILibrary.getTexcoord(4);
                    texturedBatch3D.QueueTriangle(p, p2, p3, textureCoordinates, textureCoordinates2, textureCoordinates3, color);
                    BlockMeshVertex blockMeshVertex11 = signSurfaceBlockMesh.Vertices.Array[signSurfaceBlockMesh.Indices.Array[++i * 3]];
                    BlockMeshVertex blockMeshVertex22 = signSurfaceBlockMesh.Vertices.Array[signSurfaceBlockMesh.Indices.Array[i * 3 + 1]];
                    BlockMeshVertex blockMeshVertex33 = signSurfaceBlockMesh.Vertices.Array[signSurfaceBlockMesh.Indices.Array[i * 3 + 2]];
                    Vector3         p11 = blockMeshVertex11.Position + vector + v;
                    Vector3         p22 = blockMeshVertex22.Position + vector + v;
                    Vector3         p33 = blockMeshVertex33.Position + vector + v;
                    Vector2         textureCoordinates11 = ILibrary.getTexcoord(2);
                    Vector2         textureCoordinates22 = ILibrary.getTexcoord(4);
                    Vector2         textureCoordinates33 = ILibrary.getTexcoord(1);
                    texturedBatch3D.QueueTriangle(p11, p22, p33, textureCoordinates11, textureCoordinates22, textureCoordinates33, color);
                }
                Updated(singleChest.GetSlotValue(0), singleChest.GetSlotCount(0));
                primitivesRenderer3D.Flush(camera.ViewProjectionMatrix);
            }
        }
 void Start()
 {
     filter = GetComponent<MeshFilter> ();
     data = new MeshData();
     //indicees = new MeshIndices[Chunk.WIDTH,Chunk.HEIGHT,Chunk.WIDTH];
     blockMesh = new BlockMesh();
     myChunk = new Chunk (transform.position.x, transform.position.z);
     StartCoroutine ("completeDraw");
 }
Beispiel #11
0
        public ItemBucket(string n, int d, Color color) : base(d, n)
        {
            Model  model = ContentManager.Get <Model>("Models/FullBucket");
            Matrix boneAbsoluteTransform  = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Bucket").ParentBone);
            Matrix boneAbsoluteTransform2 = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Contents").ParentBone);

            m_standaloneBlockMesh.AppendModelMeshPart(model.FindMesh("Contents").MeshParts[0], boneAbsoluteTransform2 * Matrix.CreateRotationY(MathUtils.DegToRad(180f)) * Matrix.CreateTranslation(0f, -0.3f, 0f), makeEmissive: false, flipWindingOrder: false, doubleSided: false, flipNormals: false, color);
            m_standaloneBlockMesh.AppendModelMeshPart(model.FindMesh("Bucket").MeshParts[0], boneAbsoluteTransform * Matrix.CreateRotationY(MathUtils.DegToRad(180f)) * Matrix.CreateTranslation(0f, -0.3f, 0f), makeEmissive: false, flipWindingOrder: false, doubleSided: false, flipNormals: false, Color.White);
        }
Beispiel #12
0
        public override void Initialize()
        {
            Model  model = ContentManager.Get <Model>("Mekiasm/Models/AtomicDecomposer");
            Matrix bone  = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Atom_main").ParentBone);

            texture = ContentManager.Get <Texture2D>("Mekiasm/Textures/AtmoicDecomposer");
            BlockMesh mesh = new BlockMesh();

            mesh.AppendModelMeshPart(model.FindMesh("Atom_main").MeshParts[0], bone, false, false, false, false, Color.White);
            blockMesh.AppendBlockMesh(mesh);
        }
        public static AABB?GetBoundingBox(this BlockData block, Vector3Int position, IWorld world, bool checkCollisionFlags)
        {
            if (block == null || (checkCollisionFlags && block.HasFlag(BlockFlags.IgnoreCollisions)))
            {
                return(null);
            }

            BlockMesh  mesh     = world.BlockDataTable.GetMesh(block.Mesh.Value);
            Quaternion rotation = world.RWAccessor.GetBlockRotation(position.x, position.y, position.z, Quaternion.identity);

            return(AABB.Rotate(mesh.BoundingBox, rotation, mesh.Pivot) + position);
        }
Beispiel #14
0
        public FengliAnimate()
        {
            Model     model   = ContentManager.Get <Model>("Mekiasm/Models/风力发电机");
            Texture2D texture = ContentManager.Get <Texture2D>("Mekiasm/Textures/风力发电机");

            for (int i = 0; i < eles.Length; i++)
            {
                Matrix matrix = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh(eles[i]).ParentBone);
                blockMesh.AppendModelMeshPart(model.FindMesh(eles[i]).MeshParts[0], matrix, false, false, false, false, Color.White);
            }
            texturedBatch3D = primitives.TexturedBatch(texture, false, 0, DepthStencilState.DepthWrite, RasterizerState.CullCounterClockwiseScissor, BlendState.Opaque);
        }
Beispiel #15
0
        public ItemMekWire(int id, string str) : base(id, str)
        {
            model   = ContentManager.Get <Model>("Mekiasm/Models/Wire");
            texture = ContentManager.Get <Texture2D>("Mekiasm/Textures/Wire");
            BlockMesh blockMesh = new BlockMesh();
            Matrix    matrix    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh(eles[1]).ParentBone);

            blockMesh.AppendModelMeshPart(model.FindMesh(eles[1]).MeshParts[0], matrix, false, false, false, true, Color.White);
            mainMesh.AppendBlockMesh(blockMesh);
            mainMesh.TransformPositions(Matrix.CreateTranslation(0.5f, 0.5f, 0.5f));
            drawMesh.AppendModelMeshPart(model.FindMesh(eles[6]).MeshParts[0], matrix, false, false, false, true, Color.White);
            drawMesh.TransformPositions(Matrix.CreateTranslation(0.5f, 0.5f, 0.5f));
        }
        public MekFengliGenerator(int id, string str) : base(id, str)
        {
            Model model = ContentManager.Get <Model>("Mekiasm/Models/风力发电机");

            texture = ContentManager.Get <Texture2D>("Mekiasm/Textures/风力发电机");
            for (int i = 0; i < eles.Count; i++)
            {
                BlockMesh blockMesh = new BlockMesh();
                Matrix    matrix    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh(eles[i]).ParentBone);
                blockMesh.AppendModelMeshPart(model.FindMesh(eles[i]).MeshParts[0], matrix, false, false, false, false, Color.White);
                drawMesh.AppendBlockMesh(blockMesh);
            }
        }
        public void AddBlock(Vector3Int pos, Vector3Int renderOffset, BlockData block, IWorldRAccessor accessor)
        {
            Quaternion rotation = accessor.GetBlockRotation(pos.x, pos.y, pos.z, Quaternion.identity);
            BlockMesh  mesh     = accessor.World.BlockDataTable.GetMesh(block.Mesh.Value);

            for (int i = 0; i < mesh.Faces.Length; i++)
            {
                BlockMesh.FaceData face    = mesh.Faces[i];
                BlockFace          faceDir = RotateFace(face.Face, rotation);

                if (EnableFaceClipping)
                {
                    // 没有撑满一格的方块所有的面都渲染
                    Vector3 size      = mesh.BoundingBox.Size;
                    bool    neverClip = face.NeverClip | size.x < 1 | size.y < 1 | size.z < 1;

                    if (!neverClip && ClipFace(pos, block, faceDir, accessor))
                    {
                        continue;
                    }
                }

                int?[] texIndices = block.Textures[i];

                // !!! must add indices first
                for (int j = 0; j < face.Indices.Length; j++)
                {
                    AddIndex(face.Indices[j], block.Material.Value);
                }

                for (int j = 0; j < face.Vertices.Length; j++)
                {
                    BlockVertexData vertex = face.Vertices[j];
                    vertex.Position = MathUtility.RotatePoint(vertex.Position, rotation, mesh.Pivot);

                    float   emission = block.GetEmissionValue();
                    Vector2 ambient  = LightingUtility.AmbientOcclusion(pos, faceDir, vertex.CornerInFace, accessor, !EnableAmbientOcclusion);

                    Vector3 posWS = WriteBlockWSPosToVertexData ? (pos + accessor.WorldSpaceOrigin) : Vector3.down;

                    AddVertex(new BlockMeshVertexData
                    {
                        PositionOS      = vertex.Position + pos + renderOffset,
                        UV              = vertex.UV,
                        TexIndices      = new Vector3Int(texIndices[0].Value, texIndices[1].Value, texIndices[2].Value),
                        Lights          = new Vector3(emission, ambient.x, ambient.y),
                        BlockPositionWS = posWS
                    });
                }
            }
        }
Beispiel #18
0
        public void GetCulledIndices_Test()
        {
            List <Direction> directions = new List <Direction> {
                Direction.Above, Direction.East, Direction.West
            };
            var result = BlockMesh.GetCulledIndices(directions);

            Assert.AreEqual(result, new int[]
            {
                0, 1, 2, 2, 3, 0,
                4, 5, 6, 6, 7, 4,
                8, 9, 10, 10, 11, 8
            });
        }
Beispiel #19
0
        public MekAdvanceSolarPanel(int id, string str) : base(id, str)
        {
            Model model = ContentManager.Get <Model>("Mekiasm/Models/AdvanceSolarPlane");

            texture = ContentManager.Get <Texture2D>("Mekiasm/Textures/AdvanceSolarPlane");
            for (int i = 0; i < eles.Count; i++)
            {
                BlockMesh blockMesh = new BlockMesh();
                Matrix    matrix    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh(eles[i]).ParentBone);
                blockMesh.AppendModelMeshPart(model.FindMesh(eles[i]).MeshParts[0], matrix * Matrix.CreateScale(0.5f) * Matrix.CreateTranslation(0.5f, 0.5f, 0.5f), false, false, false, false, Color.White);
                mainMesh.AppendBlockMesh(blockMesh);
                boundingBoxes.Add(blockMesh.CalculateBoundingBox());
            }
        }
        public static Mesh GenerateBlockMesh(BlockMesh block)
        {
            Mesh lMesh = new Mesh();

            int numTriangles = block.Triangles.Count + block.SideTriangles.Count;

            var vertices  = new Vector3[numTriangles * 3]; //Not the most optimized way, because same vertex can be stored more than once
            var triangles = new int[numTriangles * 3];

            //Add front panels
            for (int i = 0; i < block.Triangles.Count; i++)
            {
                //Change the Vectors (Y will be up vector)
                Vector3 A = new Vector3(block.Triangles[i].A.x, block.Height, block.Triangles[i].A.y);
                Vector3 B = new Vector3(block.Triangles[i].B.x, block.Height, block.Triangles[i].B.y);
                Vector3 C = new Vector3(block.Triangles[i].C.x, block.Height, block.Triangles[i].C.y);

                //Add attributes to Mesh
                vertices[3 * i]     = A;
                vertices[3 * i + 1] = B;
                vertices[3 * i + 2] = C;

                triangles[3 * i]     = 3 * i;
                triangles[3 * i + 1] = 3 * i + 1;
                triangles[3 * i + 2] = 3 * i + 2;
            }

            //Add side panels
            for (int i = block.Triangles.Count; i < numTriangles; i++)
            {
                vertices[3 * i]     = block.SideTriangles[i - block.Triangles.Count].A;
                vertices[3 * i + 1] = block.SideTriangles[i - block.Triangles.Count].B;
                vertices[3 * i + 2] = block.SideTriangles[i - block.Triangles.Count].C;

                triangles[3 * i]     = 3 * i;
                triangles[3 * i + 1] = 3 * i + 1;
                triangles[3 * i + 2] = 3 * i + 2;
            }

            lMesh.vertices  = vertices;
            lMesh.triangles = triangles;

            lMesh.RecalculateNormals();

            return(lMesh);
        }
Beispiel #21
0
        public void GetAllVertices_Offset_Test()
        {
            //offset 5 blocks to the right, 1 up, 1 in.
            var result = BlockMesh.GetAllVertices(new Vector3(5, 1, 1));

            Assert.AreEqual(new Vector3[]
            {
                new Vector3(4.5f, 0.5f, 0.5f),  //Left Bottom Back
                new Vector3(5.5f, 0.5f, 0.5f),  //Right Bottom Back
                new Vector3(5.5f, 1.5f, 0.5f),  //Right Top Back
                new Vector3(4.5f, 1.5f, 0.5f),  //Left Top Back - One face is completed!
                new Vector3(4.5f, 0.5f, 1.5f),  //Left Bottom Front
                new Vector3(5.5f, 0.5f, 1.5f),  //Right Bottom Front
                new Vector3(5.5f, 1.5f, 1.5f),  //Right Top Front
                new Vector3(4.5f, 1.5f, 1.5f),  //Left Top Front
            }, result);
        }
        protected bool ClipFace(Vector3Int pos, BlockData block, BlockFace face, IWorldRAccessor accessor)
        {
            switch (face)
            {
            case BlockFace.PositiveX: pos.x++; break;

            case BlockFace.PositiveY: pos.y++; break;

            case BlockFace.PositiveZ: pos.z++; break;

            case BlockFace.NegativeX: pos.x--; break;

            case BlockFace.NegativeY: pos.y--; break;

            case BlockFace.NegativeZ: pos.z--; break;

            default: throw new NotSupportedException("Unknown BlockFace.");
            }

            BlockData neighbor = accessor.GetBlock(pos.x, pos.y, pos.z);

            if (neighbor == null)
            {
                return(AggressiveBlockFaceClipping);
            }

            BlockMesh mesh = accessor.World.BlockDataTable.GetMesh(neighbor.Mesh.Value);
            Vector3   size = mesh.BoundingBox.Size;

            if (size.x < 1 || size.y < 1 || size.z < 1)
            {
                return(false);
            }

            switch (block.PhysicState)
            {
            case PhysicState.Fluid:
                return((block == neighbor) || neighbor.IsOpaqueBlock());

            case PhysicState.Solid:
                return(neighbor.IsOpaqueBlock());

            default:
                throw new NotSupportedException("Unknown BlockPhysicalState");
            }
        }
Beispiel #23
0
    public override void Initialize()
    {
        Colors = new[] { new Color(30, 30, 30), default(Color), new Color(184, 134, 11), new Color(160, 82, 45), new Color(255, 231, 186) };
        var model     = ContentManager.Get <Model>("Models/FullBucket");
        var meshParts = model.FindMesh("Contents").MeshParts;

        StandaloneBlockMesh.AppendModelMeshPart(meshParts[0], BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Contents").ParentBone) * Matrix.CreateRotationY(MathUtils.DegToRad(180f)) * Matrix.CreateTranslation(0f, -0.3f, 0f), false, false, false, false, new Color(30, 30, 30));
        StandaloneBlockMesh.TransformTextureCoordinates(Matrix.CreateTranslation(0.8125f, 0.6875f, 0f));
        meshParts = model.FindMesh("Bucket").MeshParts;
        StandaloneBlockMesh.AppendModelMeshPart(meshParts[0], BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Bucket").ParentBone) * Matrix.CreateRotationY(MathUtils.DegToRad(180f)) * Matrix.CreateTranslation(0f, -0.3f, 0f), false, false, false, false, Color.White);
        var rottenMeatBlock = new Game.RottenMeatBlock()
        {
            DefaultShadowStrength = -1
        };

        rottenMeatBlock.Initialize();
        m_standaloneBlockMesh = rottenMeatBlock.m_standaloneBlockMesh;
        base.Initialize();
    }
        /// <summary>
        /// 指定の BlockMeshPart のロード要求をキューへ追加します。
        /// </summary>
        /// <param name="interBlockMesh">BlockMesh のロード元となる InterBlockMesh。</param>
        /// <param name="blockMesh">分割ロード対応の BlockMesh。</param>
        /// <param name="levelOfDetail">対象とする LOD。</param>
        /// <param name="meshPartIndex">対象とする BlockMeshPart のインデックス。</param>
        void Enqueue(InterBlockMesh interBlockMesh, BlockMesh blockMesh, int levelOfDetail, int meshPartIndex)
        {
            lock (this)
            {
                if (queue.Count == MaxCapacity)
                {
                    throw new InvalidOperationException("This queue is full.");
                }

                var item = new Item
                {
                    InterBlockMesh = interBlockMesh,
                    BlockMesh      = blockMesh,
                    LevelOfDetail  = levelOfDetail,
                    MeshPartIndex  = meshPartIndex
                };

                queue.Add(item);
            }
        }
Beispiel #25
0
        internal WallBlock(string name, string namedId, string texture, string postModel, string extensionModel,
                           string extensionStraight) :
            base(
                name,
                namedId,
                texture,
                postModel,
                extensionModel,
                new BoundingBox(new Vector3(x: 0.5f, y: 0.5f, z: 0.5f), new Vector3(x: 0.25f, y: 0.5f, z: 0.25f)))
        {
            BlockModel straightZModel = BlockModel.Load(extensionStraight);

            straightZModel.OverwriteTexture(texture);

            BlockModel straightXModel = straightZModel.Copy();

            straightXModel.RotateY(rotations: 1, rotateTopAndBottomTexture: false);

            straightX = straightXModel.GetMesh();
            straightZ = straightZModel.GetMesh();
        }
Beispiel #26
0
        /// <summary>
        /// BlockMesh をロードします。
        /// </summary>
        void LoadBlockMesh()
        {
            var blockLoader = new StringBlockLoader(blockData);

            var meshFactory = new BlockMeshFactory(GraphicsDevice);

            meshManager = new BlockMeshManager(blockLoader, meshFactory);

            // 通常の IBlockEffect をロードします。
            blockEffect = new BasicBlockEffect(GraphicsDevice);
            blockEffect.EnableDefaultLighting();

            // インスタンシング用の IBlockEffect をロードします。
            var instancingEffect = Content.Load <Effect>("Effects/Instancing");

            instancingBlockEffect = new InstancingBlockEffect(instancingEffect);
            instancingBlockEffect.EnableDefaultLighting();

            // 実際のアプリケーションではファイルの Block から BlockMesh をロードします。
            // BlockMesh をロードします。
            mesh = meshManager.Load("Dummy", lodCount);
        }
Beispiel #27
0
        private void RenderingFieldsGUI(ref VerticalGUIRect guiRect, BlockData block)
        {
            MainWnd.BlockMeshes.ElementGUI(guiRect.Next, s_MeshContent, ref block.Mesh);

            AssetPtr  meshPtr = MainWnd.BlockMeshes[block.Mesh];
            BlockMesh mesh    = EditorAssetUtility.LoadAssetByGUID <BlockMesh>(meshPtr.AssetGUID);

            if (!mesh)
            {
                EditorGUI.HelpBox(guiRect.GetNext(40, true, true), "You should assign an empty mesh if you do not want this block to be rendered.", MessageType.Error);
            }
            else if (mesh.Faces.Length == 0)
            {
                EditorGUI.HelpBox(guiRect.GetNext(40, true, true), "This block will never be rendered.", MessageType.Warning);
            }
            else
            {
                MainWnd.BlockMaterials.ElementGUI(guiRect.Next, s_MaterialContent, ref block.Material);

                BlockMesh.FaceData[] faces = mesh.Faces;
                ArrayUtility.EnsureArrayReferenceAndSize(ref block.Textures, faces.Length, true);

                for (int i = 0; i < faces.Length; i++)
                {
                    BlockFace face = faces[i].Face;
                    EditorGUI.LabelField(guiRect.Next, face.ToString(), EditorStyles.boldLabel);

                    ArrayUtility.EnsureArrayReferenceAndSize(ref block.Textures[i], 3, true);

                    EditorGUI.indentLevel++;
                    for (int j = 0; j < 3; j++)
                    {
                        MainWnd.BlockTextures.ElementGUI(guiRect.Next, s_TextureContents[j], ref block.Textures[i][j]);
                    }
                    EditorGUI.indentLevel--;
                }
            }
        }
        /// <summary>
        /// BlockMesh をロードします。
        /// </summary>
        void LoadBlockMesh()
        {
            var blockLoader = new StringBlockLoader(blockData);

            var meshFactory = new BlockMeshFactory(GraphicsDevice);
            meshManager = new BlockMeshManager(blockLoader, meshFactory);

            // 通常の IBlockEffect をロードします。
            blockEffect = new BasicBlockEffect(GraphicsDevice);
            blockEffect.EnableDefaultLighting();

            // インスタンシング用の IBlockEffect をロードします。
            var instancingEffect = Content.Load<Effect>("Effects/Instancing");
            instancingBlockEffect = new InstancingBlockEffect(instancingEffect);
            instancingBlockEffect.EnableDefaultLighting();

            // 実際のアプリケーションではファイルの Block から BlockMesh をロードします。
            // BlockMesh をロードします。
            mesh = meshManager.Load("Dummy", lodCount);
        }
 // Use this for initialization
 void Start()
 {
     filter = GetComponent<MeshFilter>();
     mesh = new BlockMesh();
 }
 public void Cancel(BlockMesh blockMesh)
 {
     queue.RemoveAll((i) => i.BlockMesh == blockMesh);
 }
Beispiel #31
0
        public override void Initialize()
        {
            int num = 0;
            Dictionary <int, MekClothData> dictionary = new Dictionary <int, MekClothData>();
            IEnumerator <XElement>         enumerator = XmlUtils.LoadXmlFromStream(ModsManager.GetEntries(".xclo")[0].Stream, Encoding.UTF8, true).Elements().GetEnumerator();

            while (enumerator.MoveNext())
            {
                XElement     current      = enumerator.Current;
                MekClothData clothingData = new MekClothData
                {
                    Index                    = XmlUtils.GetAttributeValue <int>(current, "Index"),
                    DisplayIndex             = num++,
                    DisplayName              = XmlUtils.GetAttributeValue <string>(current, "DisplayName"),
                    Slot                     = XmlUtils.GetAttributeValue <ClothingSlot>(current, "Slot"),
                    ArmorProtection          = XmlUtils.GetAttributeValue <float>(current, "ArmorProtection"),
                    Sturdiness               = XmlUtils.GetAttributeValue <float>(current, "Sturdiness"),
                    Insulation               = XmlUtils.GetAttributeValue <float>(current, "Insulation"),
                    MovementSpeedFactor      = XmlUtils.GetAttributeValue <float>(current, "MovementSpeedFactor"),
                    SteedMovementSpeedFactor = XmlUtils.GetAttributeValue <float>(current, "SteedMovementSpeedFactor"),
                    DensityModifier          = XmlUtils.GetAttributeValue <float>(current, "DensityModifier"),
                    IsOuter                  = XmlUtils.GetAttributeValue <bool>(current, "IsOuter"),
                    CanBeDyed                = XmlUtils.GetAttributeValue <bool>(current, "CanBeDyed"),
                    Layer                    = XmlUtils.GetAttributeValue <int>(current, "Layer"),
                    PlayerLevelRequired      = XmlUtils.GetAttributeValue <int>(current, "PlayerLevelRequired"),
                    Texture                  = ContentManager.Get <Texture2D>(XmlUtils.GetAttributeValue <string>(current, "TextureName")),
                    ImpactSoundsFolder       = XmlUtils.GetAttributeValue <string>(current, "ImpactSoundsFolder"),
                    Description              = XmlUtils.GetAttributeValue <string>(current, "Description")
                };
                dictionary[clothingData.Index] = clothingData;
            }
            clothingData = new MekClothData[dictionary.Count];
            int i = 0;

            foreach (KeyValuePair <int, MekClothData> keyValuePair in dictionary)
            {
                clothingData[i] = keyValuePair.Value;
                ++i;
            }
            Model playerModel = CharacterSkinsManager.GetPlayerModel(PlayerClass.Male);

            Matrix[] array = new Matrix[playerModel.Bones.Count];
            playerModel.CopyAbsoluteBoneTransformsTo(array);
            i = playerModel.FindBone("Hand1").Index;
            int index = playerModel.FindBone("Hand2").Index;

            array[i]     = Matrix.CreateRotationY(0.1f) * array[i];
            array[index] = Matrix.CreateRotationY(-0.1f) * array[index];
            m_innerMesh  = new BlockMesh();
            foreach (ModelMesh mesh in playerModel.Meshes)
            {
                Matrix matrix = array[mesh.ParentBone.Index];
                foreach (ModelMeshPart meshPart in mesh.MeshParts)
                {
                    Color color = Color.White * 0.8f;
                    color.A = byte.MaxValue;
                    m_innerMesh.AppendModelMeshPart(meshPart, matrix, makeEmissive: false, flipWindingOrder: false, doubleSided: false, flipNormals: false, Color.White);
                    m_innerMesh.AppendModelMeshPart(meshPart, matrix, makeEmissive: false, flipWindingOrder: true, doubleSided: false, flipNormals: true, color);
                }
            }
            Model outerClothingModel = CharacterSkinsManager.GetOuterClothingModel(PlayerClass.Male);

            Matrix[] array2 = new Matrix[outerClothingModel.Bones.Count];
            outerClothingModel.CopyAbsoluteBoneTransformsTo(array2);
            int index2 = outerClothingModel.FindBone("Leg1").Index;
            int index3 = outerClothingModel.FindBone("Leg2").Index;

            array2[index2] = Matrix.CreateTranslation(-0.02f, 0f, 0f) * array2[index2];
            array2[index3] = Matrix.CreateTranslation(0.02f, 0f, 0f) * array2[index3];
            m_outerMesh    = new BlockMesh();
            foreach (ModelMesh mesh2 in outerClothingModel.Meshes)
            {
                Matrix matrix2 = array2[mesh2.ParentBone.Index];
                foreach (ModelMeshPart meshPart2 in mesh2.MeshParts)
                {
                    Color color2 = Color.White * 0.8f;
                    color2.A = byte.MaxValue;
                    m_outerMesh.AppendModelMeshPart(meshPart2, matrix2, makeEmissive: false, flipWindingOrder: false, doubleSided: false, flipNormals: false, Color.White);
                    m_outerMesh.AppendModelMeshPart(meshPart2, matrix2, makeEmissive: false, flipWindingOrder: true, doubleSided: false, flipNormals: true, color2);
                }
            }
        }
Beispiel #32
0
    /// <summary>
    /// Update the block mesh in regards to its neighbours.
    /// </summary>
    /// <param name="terrain">The terrain.</param>
    /// <param name="chunkX">The x position in chunk coordinates.</param>
    /// <param name="chunkY">The y position in chunk coordinates.</param>
    /// <param name="chunk">The chunk.</param>
    /// <param name="chunkIndex">The index of the chunk.</param>
    /// <param name="chunkUp">The chunk above.</param>
    /// <param name="chunkRight">The chunk to the right.</param>
    /// <param name="chunkDown">The chunk below.</param>
    /// <param name="chunkLeft">The chunk to the left.</param>
    protected virtual void UpdateBlockMesh(
        Terrain terrain,
        int chunkX,
        int chunkY,
        Chunk chunk,
        Vector2I chunkIndex,
        Chunk chunkUp,
        Chunk chunkRight,
        Chunk chunkDown,
        Chunk chunkLeft)
    {
        // Get the block index
        int index = Chunk.GetBlockIndex(chunkX, chunkY);

        // Get the block
        Block block = chunk[index];

        // Calculate the block position in world coordinates
        var blockPos = new Vector2I((chunkIndex.X * Chunk.SizeX) + chunkX, (chunkIndex.Y * Chunk.SizeY) + chunkY);

        // If there is no block here, remove any mesh that may exist at this position and continue
        if (block.BlockType == BlockType.None)
        {
            terrain.Mesh.RemoveMesh(blockPos);
            return;
        }

        // Get the block above this one
        Block blockUp;

        if (chunkY != Chunk.SizeY - 1)
        {
            blockUp = chunk[chunkX, chunkY + 1];
        }
        else if (chunkUp != null)
        {
            blockUp = chunkUp[chunkX, 0];
        }
        else
        {
            blockUp = Block.None;
        }

        // Get the block to the right of this one
        Block blockRight;

        if (chunkX != Chunk.SizeX - 1)
        {
            blockRight = chunk[chunkX + 1, chunkY];
        }
        else if (chunkRight != null)
        {
            blockRight = chunkRight[0, chunkY];
        }
        else
        {
            blockRight = Block.None;
        }

        // Get the block below this one
        Block blockDown;

        if (chunkY != 0)
        {
            blockDown = chunk[chunkX, chunkY - 1];
        }
        else if (chunkDown != null)
        {
            blockDown = chunkDown[chunkX, Chunk.SizeY - 1];
        }
        else
        {
            blockDown = Block.None;
        }

        // Get the block to the left of this one
        Block blockLeft;

        if (chunkX != 0)
        {
            blockLeft = chunk[chunkX - 1, chunkY];
        }
        else if (chunkLeft != null)
        {
            blockLeft = chunkLeft[Chunk.SizeX - 1, chunkY];
        }
        else
        {
            blockLeft = Block.None;
        }

        // Create the mesh for this block
        BlockMesh mesh = this.CreateBlockMesh(block, blockPos, blockUp, blockRight, blockDown, blockLeft);

        // Add the mesh to the cloud
        terrain.Mesh.SetMesh(blockPos, mesh);
    }
Beispiel #33
0
        public static void init_()
        {
            Model model = ContentManager.Get <Model>("Mekiasm/Models/Cube");

            CubeModel = model;
            for (int i = 0; i < 6; i++)
            {
                Matrix m1 = Matrix.CreateRotationY((float)i * (float)Math.PI / 4f) * Matrix.CreateTranslation(0.5f, 0f, 0.5f);
                faceNormals.Add(-m1.Forward);
            }
            for (int i = 0; i < 6; i++)
            {
                Matrix m1 = Matrix.CreateRotationX((float)i * (float)Math.PI / 4f) * Matrix.CreateTranslation(0.5f, 0f, 0.5f);
                faceNormals.Add(-m1.Forward);
            }
            for (int i = 0; i < 6; i++)
            {
                Matrix m1 = Matrix.CreateRotationZ((float)i * (float)Math.PI / 4f) * Matrix.CreateTranslation(0.5f, 0f, 0.5f);
                faceNormals.Add(-m1.Forward);
            }
            Matrix    matrix    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Front").ParentBone);
            BlockMesh blockMesh = new BlockMesh();

            blockMesh.AppendModelMeshPart(model.FindMesh("Front").MeshParts[0], matrix * Matrix.CreateTranslation(0.5f, 0.5f, 0.5f), false, false, false, false, Color.White);
            faceMeshes.Add(blockMesh);

            Matrix    matrix1    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Right").ParentBone);
            BlockMesh blockMesh1 = new BlockMesh();

            blockMesh1.AppendModelMeshPart(model.FindMesh("Right").MeshParts[0], matrix1 * Matrix.CreateTranslation(0.5f, 0.5f, 0.5f), false, false, false, false, Color.White);
            faceMeshes.Add(blockMesh1);


            Matrix    matrix2    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Behind").ParentBone);
            BlockMesh blockMesh2 = new BlockMesh();

            blockMesh2.AppendModelMeshPart(model.FindMesh("Behind").MeshParts[0], matrix2 * Matrix.CreateTranslation(0.5f, 0.5f, 0.5f), false, false, false, false, Color.White);
            faceMeshes.Add(blockMesh2);


            Matrix    matrix3    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Left").ParentBone);
            BlockMesh blockMesh3 = new BlockMesh();

            blockMesh3.AppendModelMeshPart(model.FindMesh("Left").MeshParts[0], matrix3 * Matrix.CreateTranslation(0.5f, 0.5f, 0.5f), false, false, false, false, Color.White);
            faceMeshes.Add(blockMesh3);


            Matrix    matrix4    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Top").ParentBone);
            BlockMesh blockMesh4 = new BlockMesh();

            blockMesh4.AppendModelMeshPart(model.FindMesh("Top").MeshParts[0], matrix4 * Matrix.CreateTranslation(0.5f, 0.5f, 0.5f), false, false, false, false, Color.White);
            faceMeshes.Add(blockMesh4);


            Matrix    matrix5    = BlockMesh.GetBoneAbsoluteTransform(model.FindMesh("Bottom").ParentBone);
            BlockMesh blockMesh5 = new BlockMesh();

            blockMesh5.AppendModelMeshPart(model.FindMesh("Bottom").MeshParts[0], matrix5 * Matrix.CreateTranslation(0.5f, 0.5f, 0.5f), false, false, false, false, Color.White);
            faceMeshes.Add(blockMesh5);
            //id表示textureslot位置
            //oreblock
            {
                items_ore.Add(new ItemCube(0, "金矿石"));
                items_ore.Add(new ItemCube(1, "铀矿石"));
                items_ore.Add(new ItemCube(2, "锇矿石"));
                items_ore.Add(new ItemCube(3, "钚矿石"));
                items_ore.Add(new ItemCube(4, "锂矿石"));
                items_ore.Add(new ItemCube(5, "镁矿石"));
                items_ore.Add(new ItemCube(6, "硼矿石"));
                items_ore.Add(new ItemCube(7, "铅矿石"));
                items_ore.Add(new ItemCube(9, "钍矿石"));
                items_ore.Add(new ItemCube(10, "锡矿石"));
                items_ore.Add(new ItemCube(11, "红石矿石"));
            }

            //orechunkblock
            {
                items_orechunk.Add(new ItemOreChunk("金块", 0, Color.Yellow, false));
                items_orechunk.Add(new ItemOreChunk("铀块", 1, Color.LightGreen, false));
                items_orechunk.Add(new ItemOreChunk("锇块", 2, new Color(122, 188, 230), false));
                items_orechunk.Add(new ItemOreChunk("钚块", 3, new Color(188, 203, 213), false));
                items_orechunk.Add(new ItemOreChunk("锂块", 4, Color.White, false));
                items_orechunk.Add(new ItemOreChunk("镁块", 5, Color.LightMagenta, false));
                items_orechunk.Add(new ItemOreChunk("硼块", 6, Color.LightGray, false));
                items_orechunk.Add(new ItemOreChunk("铅块", 7, new Color(90, 148, 148), false));
                items_orechunk.Add(new ItemOreChunk("钍块", 9, Color.Black, false));
                items_orechunk.Add(new ItemOreChunk("锡块", 10, Color.DarkGray, false));
                items_orechunk.Add(new ItemOreChunk("金锭", 11, Color.Yellow, true));
                items_orechunk.Add(new ItemOreChunk("铀锭", 12, Color.LightGreen, true));
                items_orechunk.Add(new ItemOreChunk("锇锭", 13, new Color(122, 188, 230), true));
                items_orechunk.Add(new ItemOreChunk("钚锭", 14, new Color(188, 203, 213), true));
                items_orechunk.Add(new ItemOreChunk("锂锭", 15, Color.White, true));
                items_orechunk.Add(new ItemOreChunk("镁锭", 16, Color.LightMagenta, true));
                items_orechunk.Add(new ItemOreChunk("硼锭", 17, Color.LightGray, true));
                items_orechunk.Add(new ItemOreChunk("铅锭", 18, new Color(90, 148, 148), true));
                items_orechunk.Add(new ItemOreChunk("钍锭", 19, Color.Black, true));
                items_orechunk.Add(new ItemOreChunk("锡锭", 20, Color.DarkGray, true));
            }

            //electric
            {//1003
                items_electric.Add(new ItemBucket("氘桶", 0, Color.DarkBlue));
                items_electric.Add(new ItemBucket("氚桶", 1, Color.LightBlue));
                items_electric.Add(new ItemBucket("氦桶", 2, Color.Magenta));
                items_electric.Add(new MekCoalGenerator(27, "燃煤发电机"));       //and26
                items_electric.Add(new AspSolarGenerator(30, "ASP基础太阳能发电")); //and29,28
                items_electric.Add(new ItemCube(31, "钢质框架"));
                items_electric.Add(new ItemCube(32, "基础能量输导元件"));
                items_electric.Add(new ItemCube(33, "高级能量输导元件"));
                items_electric.Add(new ItemCube(34, "精英能量输导元件"));
                items_electric.Add(new ItemCube(35, "终级能量输导元件"));
                items_electric.Add(new ItemCube(36, "输导端口"));//and37
                items_electric.Add(new ItemCube(38, "输导套管"));
                items_electric.Add(new ItemCube(40, "动态阀门"));
                items_electric.Add(new ItemCube(41, "动态储罐"));
                items_electric.Add(new ItemCube(42, "热力蒸馏方块"));
                items_electric.Add(new ItemCube(43, "热力蒸馏控制阀门"));
                items_electric.Add(new MekDistillController(44, "热力蒸馏控制器"));//and45
                items_electric.Add(new ItemCrusher(47, "粉碎机"));
                items_electric.Add(new ItemEnergyBase(63, "基础能量立方"));
                items_electric.Add(new ItemCube(64, "传送机"));
                items_electric.Add(new MekTransmitBox(65, "传送框架"));
                items_electric.Add(new MekWire(48, "基础能量传输导线"));
                items_electric.Add(new MekWire(49, "高级能量传输导线"));
                items_electric.Add(new MekWire(50, "精英能量传输导线"));
                items_electric.Add(new MekWire(51, "终极能量传输导线"));
                items_electric.Add(new ItemCube(66, "基础能量输导核心"));
                items_electric.Add(new ItemCube(67, "高级能量输导核心"));
                items_electric.Add(new ItemCube(68, "精英能量输导核心"));
                items_electric.Add(new ItemCube(70, "终极能量输导核心"));
                items_electric.Add(new AlloyFurnace(80, "合金炉"));
                items_electric.Add(new Manufactory(82, "制造厂"));
                items_electric.Add(new MekSmelt(72, "充能冶炼炉"));
                items_electric.Add(new MekEnrich(78, "富集仓"));
                items_electric.Add(new ItemCube(81, "裂变结构方块"));
                items_electric.Add(new FissionController(89, "裂变控制器"));
                items_electric.Add(new FusionElectromagnet(90, "电磁铁"));
                items_electric.Add(new ItemCube(96, "镁冷凝器"));
                items_electric.Add(new ItemCube(97, "金冷凝器"));
                items_electric.Add(new ItemCube(98, "青晶石冷凝器"));
                items_electric.Add(new ItemCube(99, "水冷凝器"));
                items_electric.Add(new ItemCube(101, "锡冷凝器"));
                items_electric.Add(new ItemCube(102, "氦冷凝器"));
                items_electric.Add(new ItemCube(103, "金刚石冷凝器"));
                items_electric.Add(new MekIsotopeSeparator(104, "同位素分离机"));
                items_electric.Add(new MekCombiner(107, "融合机"));
                items_electric.Add(new MekPurification(108, "净化仓"));
                items_electric.Add(new MekElectrolyzer(119, "电解机"));
                items_electric.Add(new MekChemicalReactor(121, "化学反应器"));
                items_electric.Add(new MekSaltMixer(123, "盐混合器"));
                items_flat.Add(new ItemFlat(500, "便携传送器", ContentManager.Get <Texture2D>(itemFlatPath + "portableteleporter")));
                items_flat.Add(new ItemFlat(501, "压缩碳", ContentManager.Get <Texture2D>(itemFlatPath + "compressedcarbon")));
                items_flat.Add(new ItemFlat(502, "压缩红石", ContentManager.Get <Texture2D>(itemFlatPath + "compressedredstone")));
                items_flat.Add(new ItemFlat(503, "压缩钻石", ContentManager.Get <Texture2D>(itemFlatPath + "compresseddiamond")));
                items_flat.Add(new ItemFlat(504, "压缩黑曜石", ContentManager.Get <Texture2D>(itemFlatPath + "compressedobsidian")));
                items_flat.Add(new ItemFlat(505, "基础电路板", ContentManager.Get <Texture2D>(itemFlatPath + "basiccontrolcircuit")));
                items_flat.Add(new ItemFlat(506, "高级电路板", ContentManager.Get <Texture2D>(itemFlatPath + "advancedcontrolcircuit")));
                items_flat.Add(new ItemFlat(507, "精英电路板", ContentManager.Get <Texture2D>(itemFlatPath + "elitecontrolcircuit")));
                items_flat.Add(new ItemFlat(508, "终极电路板", ContentManager.Get <Texture2D>(itemFlatPath + "ultimatecontrolcircuit")));
                items_flat.Add(new ItemFlat(510, "调整器", ContentManager.Get <Texture2D>(itemFlatPath + "configurator")));
                items_flat.Add(new ItemFlat(511, "石墨粉", ContentManager.Get <Texture2D>(itemFlatPath + "dust_graphite")));
                items_flat.Add(new ItemFlat(512, "石墨锭", ContentManager.Get <Texture2D>(itemFlatPath + "ingot_graphite")));
                items_flat.Add(new ItemFlat(513, "钢粉", ContentManager.Get <Texture2D>(itemFlatPath + "steeldust")));
                items_flat.Add(new ItemFlat(514, "钢锭", ContentManager.Get <Texture2D>(itemFlatPath + "steelingot")));
                items_flat.Add(new ItemFlat(515, "能量升级", ContentManager.Get <Texture2D>(itemFlatPath + "upgrade_energy")));
                items_flat.Add(new ItemFlat(516, "速度升级", ContentManager.Get <Texture2D>(itemFlatPath + "upgrade_speed")));
                items_flat.Add(new ItemFlat(517, "盐", ContentManager.Get <Texture2D>(itemFlatPath + "salt")));
                items_flat.Add(new ItemFlat(518, "镅-241", ContentManager.Get <Texture2D>(itemFlatPath + "americium_241")));
                items_flat.Add(new ItemFlat(519, "镅-242", ContentManager.Get <Texture2D>(itemFlatPath + "americium_242")));
                items_flat.Add(new ItemFlat(520, "氧化镅-241", ContentManager.Get <Texture2D>(itemFlatPath + "americium_241_oxide")));
                items_flat.Add(new ItemFlat(521, "氧化镅-242", ContentManager.Get <Texture2D>(itemFlatPath + "americium_242_oxide")));
                items_flat.Add(new ItemFlat(522, "镅-243", ContentManager.Get <Texture2D>(itemFlatPath + "americium_243")));
                items_flat.Add(new ItemFlat(523, "氧化镅-243", ContentManager.Get <Texture2D>(itemFlatPath + "americium_243_oxide")));
                items_flat.Add(new ItemFlat(524, "锫-247", ContentManager.Get <Texture2D>(itemFlatPath + "berkelium_247")));
                items_flat.Add(new ItemFlat(525, "锫-248", ContentManager.Get <Texture2D>(itemFlatPath + "berkelium_248")));
                items_flat.Add(new ItemFlat(526, "氧化锫-247", ContentManager.Get <Texture2D>(itemFlatPath + "berkelium_247_oxide")));
                items_flat.Add(new ItemFlat(527, "氧化锫-248", ContentManager.Get <Texture2D>(itemFlatPath + "berkelium_248_oxide")));
                items_flat.Add(new ItemFlat(528, "生物燃料", ContentManager.Get <Texture2D>(itemFlatPath + "biofuel")));
                items_flat.Add(new ItemFlat(529, "硼-10", ContentManager.Get <Texture2D>(itemFlatPath + "boron_10")));
                items_flat.Add(new ItemFlat(530, "硼-11", ContentManager.Get <Texture2D>(itemFlatPath + "boron_11")));
                items_flat.Add(new ItemFlat(531, "锎-249", ContentManager.Get <Texture2D>(itemFlatPath + "californium_249")));
                items_flat.Add(new ItemFlat(532, "锎-250", ContentManager.Get <Texture2D>(itemFlatPath + "californium_250")));
                items_flat.Add(new ItemFlat(533, "锎-251", ContentManager.Get <Texture2D>(itemFlatPath + "californium_251")));
                items_flat.Add(new ItemFlat(534, "氧化锎-249", ContentManager.Get <Texture2D>(itemFlatPath + "californium_249_oxide")));
                items_flat.Add(new ItemFlat(535, "氧化锎-250", ContentManager.Get <Texture2D>(itemFlatPath + "californium_250_oxide")));
                items_flat.Add(new ItemFlat(536, "氧化锎-251", ContentManager.Get <Texture2D>(itemFlatPath + "californium_251_oxide")));
                items_flat.Add(new ItemFlat(537, "锔-243", ContentManager.Get <Texture2D>(itemFlatPath + "curium_243")));
                items_flat.Add(new ItemFlat(538, "锔-245", ContentManager.Get <Texture2D>(itemFlatPath + "curium_245")));
                items_flat.Add(new ItemFlat(539, "锔-246", ContentManager.Get <Texture2D>(itemFlatPath + "curium_246")));
                items_flat.Add(new ItemFlat(540, "锔-247", ContentManager.Get <Texture2D>(itemFlatPath + "curium_247")));
                items_flat.Add(new ItemFlat(541, "氧化锔-243", ContentManager.Get <Texture2D>(itemFlatPath + "curium_243_oxide")));
                items_flat.Add(new ItemFlat(542, "氧化锔-245", ContentManager.Get <Texture2D>(itemFlatPath + "curium_245_oxide")));
                items_flat.Add(new ItemFlat(543, "氧化锔-246", ContentManager.Get <Texture2D>(itemFlatPath + "curium_246_oxide")));
                items_flat.Add(new ItemFlat(544, "氧化锔-247", ContentManager.Get <Texture2D>(itemFlatPath + "curium_247_oxide")));
                items_flat.Add(new ItemFlat(545, "TBU-钍燃料", ContentManager.Get <Texture2D>(itemFlatPath + "fuel_thorium_tbu")));
                items_flat.Add(new ItemFlat(546, "TBU-氧化钍燃料", ContentManager.Get <Texture2D>(itemFlatPath + "fuel_thorium_tbu_oxide")));
                items_flat.Add(new ItemFlat(547, "HEU-铀233燃料", ContentManager.Get <Texture2D>(itemFlatPath + "fuel_uranium_heu_233")));
                items_flat.Add(new ItemFlat(548, "HEU-氧化铀233燃料", ContentManager.Get <Texture2D>(itemFlatPath + "fuel_uranium_heu_233_oxide")));
                items_flat.Add(new ItemFlat(549, "HEU-铀235燃料", ContentManager.Get <Texture2D>(itemFlatPath + "fuel_uranium_heu_235")));
                items_flat.Add(new ItemFlat(550, "HEU-氧化铀235燃料", ContentManager.Get <Texture2D>(itemFlatPath + "fuel_uranium_heu_235_oxide")));
                items_flat.Add(new ItemFlat(551, "LEU-铀233燃料", ContentManager.Get <Texture2D>(itemFlatPath + "fuel_uranium_leu_233")));
                items_flat.Add(new ItemFlat(552, "LEU-氧化铀233燃料", ContentManager.Get <Texture2D>(itemFlatPath + "fuel_uranium_leu_233_oxide")));
                items_flat.Add(new ItemFlat(553, "LEU-铀235燃料", ContentManager.Get <Texture2D>(itemFlatPath + "fuel_uranium_leu_235")));
                items_flat.Add(new ItemFlat(554, "LEU-氧化铀235燃料", ContentManager.Get <Texture2D>(itemFlatPath + "fuel_uranium_leu_235_oxide")));
                items_flat.Add(new ItemFlat(555, "高级工厂安装器", ContentManager.Get <Texture2D>(itemFlatPath + "advancedtierinstaller")));
                items_flat.Add(new ItemFlat(556, "基础工厂安装器", ContentManager.Get <Texture2D>(itemFlatPath + "basictierinstaller")));
                items_flat.Add(new ItemFlat(557, "精英工厂安装器", ContentManager.Get <Texture2D>(itemFlatPath + "elitetierinstaller")));
                items_flat.Add(new ItemFlat(558, "终极工厂安装器", ContentManager.Get <Texture2D>(itemFlatPath + "compressedcarbon")));
                items_flat.Add(new ItemFlat(559, "能量板", ContentManager.Get <Texture2D>(itemFlatPath + "energytablet")));
                items_flat.Add(new ItemFlat(560, "富集合金", ContentManager.Get <Texture2D>(itemFlatPath + "enrichedalloy")));
                items_flat.Add(new ItemFlat(561, "富集铁", ContentManager.Get <Texture2D>(itemFlatPath + "enrichediron")));
                items_flat.Add(new ItemFlat(562, "富集铁锭", ContentManager.Get <Texture2D>(itemFlatPath + "enrichediron_alt")));
                items_flat.Add(new ItemFlat(563, "金粉", ContentManager.Get <Texture2D>(itemFlatPath + "golddust")));
                items_flat.Add(new ItemFlat(564, "金碎片", ContentManager.Get <Texture2D>(itemFlatPath + "goldshard")));
                items_flat.Add(new ItemFlat(565, "金块", ContentManager.Get <Texture2D>(itemFlatPath + "goldclump")));
                items_flat.Add(new ItemFlat(566, "金晶体", ContentManager.Get <Texture2D>(itemFlatPath + "goldclump")));
                items_flat.Add(new ItemFlat(567, "硫粉", ContentManager.Get <Texture2D>(itemFlatPath + "gem_dust_sulfur")));
                items_flat.Add(new ItemFlat(568, "铁粉", ContentManager.Get <Texture2D>(itemFlatPath + "irondust")));
                items_flat.Add(new ItemFlat(569, "铁碎片", ContentManager.Get <Texture2D>(itemFlatPath + "ironshard")));
                items_flat.Add(new ItemFlat(570, "铁块", ContentManager.Get <Texture2D>(itemFlatPath + "ironclump")));
                items_flat.Add(new ItemFlat(571, "铁晶体", ContentManager.Get <Texture2D>(itemFlatPath + "ironcrystal")));
                items_flat.Add(new ItemFlat(572, "铜粉", ContentManager.Get <Texture2D>(itemFlatPath + "copperdust")));
                items_flat.Add(new ItemFlat(573, "铜碎片", ContentManager.Get <Texture2D>(itemFlatPath + "coppershard")));
                items_flat.Add(new ItemFlat(574, "铜块", ContentManager.Get <Texture2D>(itemFlatPath + "copperclump")));
                items_flat.Add(new ItemFlat(575, "铜晶体", ContentManager.Get <Texture2D>(itemFlatPath + "coppercrystal")));
                items_flat.Add(new ItemFlat(576, "锇粉", ContentManager.Get <Texture2D>(itemFlatPath + "osmiumdust")));
                items_flat.Add(new ItemFlat(577, "锇碎片", ContentManager.Get <Texture2D>(itemFlatPath + "osmiumshard")));
                items_flat.Add(new ItemFlat(578, "锇块", ContentManager.Get <Texture2D>(itemFlatPath + "osmiumclump")));
                items_flat.Add(new ItemFlat(579, "锇晶体", ContentManager.Get <Texture2D>(itemFlatPath + "osmiumcrystal")));
                items_flat.Add(new ItemFlat(580, "锂-6", ContentManager.Get <Texture2D>(itemFlatPath + "lithium_6")));
                items_flat.Add(new ItemFlat(581, "锂-7", ContentManager.Get <Texture2D>(itemFlatPath + "lithium_7")));
                items_flat.Add(new ItemFlat(582, "污浊的铜粉", ContentManager.Get <Texture2D>(itemFlatPath + "dirtycopperdust")));
                items_flat.Add(new ItemFlat(583, "污浊的铁粉", ContentManager.Get <Texture2D>(itemFlatPath + "dirtyirondust")));
                items_flat.Add(new ItemFlat(584, "污浊的金粉", ContentManager.Get <Texture2D>(itemFlatPath + "dirtygolddust")));
                items_flat.Add(new ItemFlat(585, "污浊的锇粉", ContentManager.Get <Texture2D>(itemFlatPath + "dirtyosmiumdust")));
                items_flat.Add(new ItemFlat(586, "污浊的铅粉", ContentManager.Get <Texture2D>(itemFlatPath + "dirtyleaddust")));
                items_flat.Add(new ItemFlat(587, "铅粉", ContentManager.Get <Texture2D>(itemFlatPath + "leaddust")));
                items_flat.Add(new ItemFlat(588, "污浊的银粉", ContentManager.Get <Texture2D>(itemFlatPath + "dirtysilverdust")));
                items_flat.Add(new ItemFlat(589, "辐射药剂", ContentManager.Get <Texture2D>(itemFlatPath + "rad_x")));
                items_flat.Add(new ItemFlat(590, "辐射清除剂", ContentManager.Get <Texture2D>(itemFlatPath + "radaway")));
                items_flat.Add(new ItemFlat(591, "辐射清除剂(缓慢)", ContentManager.Get <Texture2D>(itemFlatPath + "radaway_slow")));
            }

            //chest
            {
                items_chest.Add(new BaseSingleChest(0, "基础储柜"));
                items_chest.Add(new BaseSingleChest(1, "高级储柜"));
                items_chest.Add(new BaseSingleChest(2, "精英储柜"));
                items_chest.Add(new BaseSingleChest(3, "终极储柜"));
            }
            //item-pipe
            items_electric.Add(new MekWire(52, "基础加压管道"));
            items_electric.Add(new MekWire(53, "高级加压管道"));
            items_electric.Add(new MekWire(54, "精英加压管道"));
            items_electric.Add(new MekWire(55, "终极加压管道"));
            items_electric.Add(new MekWire(56, "基础热导线缆"));
            items_electric.Add(new MekWire(57, "高级热导线缆"));
            items_electric.Add(new MekWire(58, "精英热导线缆"));
            items_electric.Add(new MekWire(59, "终极热导线缆"));


            //alphablock-1007
            items_alpha.Add(new ItemFliud(0, new Color(0, 0, 0, 125), "传送门方块"));
            items_alpha.Add(new MekBaseSolarPanel(25, "基础太阳能板"));
            items_alpha.Add(new ItemMekWire(26, "线缆"));
            items_alpha.Add(new StructGlass(39, "结构玻璃"));
            items_alpha.Add(new ItemCube(100, "空的冷凝器"));
            items_alpha.Add(new MekAdvanceSolarPanel(101, "高级太阳能发电机"));
            items_alpha.Add(new MekFengliGenerator(102, "风力发电机"));

            items_fluid.Add(new ItemHFluid(0, "氘", 7, Color.Gray, Color.Gray));
            items_fluid.Add(new ItemHFluid(1, "氚", 7, Color.Magenta, Color.Magenta));

            items_plant.Add(new ItemPlant(0, "橡胶树苗"));
            BlocksManager.m_categories.Add("通用机械-地形");
            BlocksManager.m_categories.Add("通用机械-机器");
            BlocksManager.m_categories.Add("通用机械-工具");
            BlocksManager.m_categories.Add("通用机械-核电");
            BlocksManager.m_categories.Add("通用机械-管道");
            mfont = ContentManager.Get <BitmapFont>("Fonts/SignFont");
        }