Beispiel #1
0
        /// <summary>
        /// Initialise la texture qui contient les indices correspondant aux "sprites" que l'on souhaite afficher
        /// </summary>
        private void InitializeTileMapTexture()
        {
            tilemaptex_ = new TImage(Width, Height);

            for (int i = 0; i < Height; i++)
            {
                for (int j = 0; j < Width; j++)
                {
                    tilemaptex_.SetPixel(j, i, 0.0f / 1000.0f, 0.0f, 0.0f, 0.0f);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Crée une image, "vide" (comprendre tout pixel à 0 0 0 0), pour effectuer ses traitements
        /// </summary>
        public ImageProcessing(int width, int height)
        {
            TImage image = new TImage(width, height);

            for (int i = 0; i < image.Height; i++)
            {
                for (int j = 0; j < image.Width; j++)
                {
                    image.SetPixel(j, i, 0.0f, 1.0f, 0.0f, 1.0f);
                }
            }

            m_initialImage = new ShaderResourceView(ApplicationDX11.Instance.Device, image.GetTexture2D());
            Initialize(width, height);
        }
Beispiel #3
0
        public SceneGrid()
        {
            MaterialDX11 mat    = new MaterialDX11();
            TImage       timage = new TImage(401, 401);

            for (int i = 0; i < timage.Height; i++)
            {
                for (int j = 0; j < timage.Width; j++)
                {
                    if (i % 40 == 0 || j % 40 == 0 || i == 1 || i == 399 || j == 1 || j == 399)
                    {
                        timage.SetPixel(j, i, 1.0f, 1.0f, 1.0f, 1.0f);
                    }
                    else
                    {
                        timage.SetPixel(j, i, 0.0f, 0.0f, 0.0f, 0.0f);
                    }
                }
            }

            SamplerState state = new SamplerState(ApplicationDX11.Instance.Device, new SamplerStateDescription()
            {
                AddressU           = TextureAddressMode.Wrap,
                AddressV           = TextureAddressMode.Wrap,
                AddressW           = TextureAddressMode.Wrap,
                BorderColor        = new Color4(0.0f, 1.0f, 0.0f, 1.0f),
                ComparisonFunction = Comparison.LessEqual,
                Filter             = Filter.MinLinearMagMipPoint,
                MaximumAnisotropy  = 0,
                MaximumLod         = 0,
                MinimumLod         = 0,
                MipLodBias         = 0
            });


            float scaleValue = 40.0f;

            mat.AddTexture(timage.GetTexture2D());
            mat.SetTextureHeight(0.1f * scaleValue);
            mat.SetTextureWidth(0.1f * scaleValue);
            mat.samplers.Add(state);
            //modelrenderer_ = new MeshRenderer( mat, Quad.GetMesh() );
            transform_.RotateEuler(0.0f, 3.141592f / 2.0f, 0.0f);
            transform_.SetScale(scaleValue, scaleValue, 1.0f);

            IsPickingActivated = false;
        }