예제 #1
0
        public override void LoadContent(DeviceContext context)
        {
            _milkShapeMeshfactory.LoadMesh(@"\Meshes\block.txt", out _cubeMeshBluePrint, 0);

            _cubeTextureView = _config.CubeTextureManager.CubeArrayTexture;
            //ArrayTexture.CreateTexture2DFromFiles(_d3DEngine.Device, _d3DEngine.ImmediateContext, ClientSettings.TexturePack + @"Terran/", @"ct*.png", FilterFlags.Point, "ArrayTexture_DefaultEntityRenderer", out _cubeTextureView);

            foreach (var cube in _config.WorldParameters.Configuration.GetAllCubesProfiles())
            {
                CubePack pack;

                //Prapare to creation of a new mesh with the correct texture mapping ID
                var materialChangeMapping = new Dictionary <int, int>();
                materialChangeMapping[0] = cube.Tex_Back.TextureArrayId;    //Change the Back Texture Id
                materialChangeMapping[1] = cube.Tex_Front.TextureArrayId;   //Change the Front Texture Id
                materialChangeMapping[2] = cube.Tex_Bottom.TextureArrayId;  //Change the Bottom Texture Id
                materialChangeMapping[3] = cube.Tex_Top.TextureArrayId;     //Change the Top Texture Id
                materialChangeMapping[4] = cube.Tex_Left.TextureArrayId;    //Change the Left Texture Id
                materialChangeMapping[5] = cube.Tex_Right.TextureArrayId;   //Change the Right Texture Id

                pack.Mesh = _cubeMeshBluePrint.Clone(materialChangeMapping);

                pack.Vb = ToDispose(new VertexBuffer <VertexMesh>(_d3DEngine.Device, _cubeMeshBluePrint.Vertices.Length, SharpDX.Direct3D.PrimitiveTopology.TriangleList, "Block VB"));
                pack.Ib = ToDispose(new IndexBuffer <ushort>(_d3DEngine.Device, _cubeMeshBluePrint.Indices.Length, "Block IB"));

                pack.Vb.SetData(_d3DEngine.ImmediateContext, pack.Mesh.Vertices);
                pack.Ib.SetData(_d3DEngine.ImmediateContext, pack.Mesh.Indices);

                _cache.Add(cube.Id, pack);
            }

            _cubeEffect = ToDispose(new HLSLCubeTool(_d3DEngine.Device, ClientSettings.EffectPack + @"Entities/CubeTool.hlsl", VertexMesh.VertexDeclaration));
            _cubeEffect.DiffuseTexture.Value = _cubeTextureView;
            _cubeEffect.SamplerDiffuse.Value = RenderStatesRepo.GetSamplerState(DXStates.Samplers.UVClamp_MinMagMipPoint);
        }
예제 #2
0
        public override void Initialize()
        {
            _milkShapeMeshfactory = new MilkShape3DMeshFactory();
            //Prepare Textured Block rendering when equiped ==============================================================
            _milkShapeMeshfactory.LoadMesh(@"\Meshes\block.txt", out _cubeMeshBluePrint, 0);

            base.Initialize();
        }
예제 #3
0
        public override void Initialize()
        {
            if (ClientSettings.Current.Settings.GraphicalParameters.StaticEntityViewSize > (ClientSettings.Current.Settings.GraphicalParameters.WorldSize / 2) - 2.5)
            {
                _staticEntityViewRange = (int)((ClientSettings.Current.Settings.GraphicalParameters.WorldSize / 2) - 2.5) * 16;
            }
            else
            {
                _staticEntityViewRange = ClientSettings.Current.Settings.GraphicalParameters.StaticEntityViewSize * 16;
            }

            _milkShapeMeshfactory = new MilkShape3DMeshFactory();
            //Prepare Textured Block rendering when equiped ==============================================================
            _milkShapeMeshfactory.LoadMesh(@"\Meshes\block.txt", out _cubeMeshBluePrint, 0);
        }
예제 #4
0
        public void LoadContent(DeviceContext context)
        {
            //Prepare Textured Block rendering when equiped ==============================================================
            _milkShapeMeshfactory.LoadMesh(@"\Meshes\block.txt", out _cubeMeshBluePrint, 0);

            _cubeTextureView = _visualWorldParameters.CubeTextureManager.CubeArrayTexture;

            //Create Vertex/Index Buffer to store the loaded cube mesh.
            _cubeVb = ToDispose(new VertexBuffer <VertexMesh>(context.Device, _cubeMeshBluePrint.Vertices.Length, SharpDX.Direct3D.PrimitiveTopology.TriangleList, "Block VB"));
            _cubeIb = ToDispose(new IndexBuffer <ushort>(context.Device, _cubeMeshBluePrint.Indices.Length, "Block IB"));

            _cubeToolEffect = ToDispose(new HLSLCubeTool(context.Device, ClientSettings.EffectPack + @"Entities/CubeTool.hlsl", VertexMesh.VertexDeclaration));
            _cubeToolEffect.DiffuseTexture.Value = _cubeTextureView;
            _cubeToolEffect.SamplerDiffuse.Value = RenderStatesRepo.GetSamplerState(DXStates.Samplers.UVClamp_MinMagMipPoint);
        }