示例#1
0
 //============================================================
 public void LoadResource(FDxRsTextureBitmapPack resource)
 {
     using (MemoryStream stream = new MemoryStream()) {
         resource.Bitmap.Save(stream, ImageFormat.Png);
         stream.Position = 0;
         _nativeTexture  = Texture2D.FromStream(_device.NativeAdapter, stream, (int)stream.Length);
         _nativeResource = new ShaderResourceView(_device.NativeAdapter, _nativeTexture);
     }
 }
示例#2
0
        //============================================================
        public FDxModelTexture Get(FDxDevice3D device, string code, int typeCd)
        {
            string          name    = code + "|" + typeCd;
            FDxModelTexture texture = _textures.Find(name);

            if (null == texture)
            {
                // 创建模型
                texture        = new FDxModelTexture();
                texture.Device = device;
                // 加载模型资源
                FDxRsTexturePack       rsTexture = RDxCore.TextureResourceConsole.Get(code);
                FDxRsTextureBitmapPack rsPack    = rsTexture.Packs[typeCd];
                texture.LoadResource(rsPack);
                // 存储模型
                _textures.Set(name, texture);
            }
            return(texture);
        }