コード例 #1
0
            public AudioSignalNode(NodeDescription description, IResourceHandle <GlobalEngine> engineHandle, NodeContext nodeContext) : base(nodeContext)
            {
                this.description = description;
                FSignalInstance  = (AudioSignal)Activator.CreateInstance(description.Signal);
                FEngineHandle    = engineHandle;

                foreach (var input in description.Inputs)
                {
                    FInputsMap.Add(input.Name, new MyPin()
                    {
                        Name = input.Name, Type = input.Type, Value = input.DefaultValue
                    });
                }

                Inputs = FInputsMap.Values.ToArray();

                foreach (var output in description.Outputs)
                {
                    FOutputsMap.Add(output.Name, new MyPin()
                    {
                        Name = output.Name, Type = output.Type, Value = output.DefaultValue
                    });
                }

                Outputs = FOutputsMap.Values.ToArray();
            }
コード例 #2
0
 public LoadResourceFromBytesTask(IResourceHandle handle, byte[] bytes, AccessLevel al, GameType type)
 {
     this.handle      = handle;
     this.bytes       = bytes;
     this.AccessLevel = al;
     Game             = type;
 }
コード例 #3
0
 void EnsureDeviceOpen()
 {
     if (FOutDeviceHandle == null)
     {
         FOutDeviceHandle = FOutDeviceProvider.GetHandle();
     }
 }
コード例 #4
0
 public LoadResourceFromFileTask(IResourceHandle handle, string file, AccessLevel al, GameType type)
 {
     this.handle      = handle;
     this.file        = file;
     this.AccessLevel = al;
     this.Game        = type;
 }
コード例 #5
0
 public void OnResourceLoaded(IResourceHandle handle)
 {
     if (Resource != null && Resource.TryLock())
     {
         CreateSubmeshes();
         OnWorldMatrixChanged();
         Renderer.AddBackgroundUploadTask((d, cl) =>
         {
             if (Submeshes != null && Resource.TryLock())
             {
                 foreach (var sm in Submeshes)
                 {
                     sm.CreateDeviceObjects(d, cl, null);
                 }
                 if (AutoRegister)
                 {
                     RegisterWithScene(RenderScene);
                 }
                 Created = true;
                 Resource.Unlock();
             }
         });
         Resource.Unlock();
     }
 }
コード例 #6
0
 void CloseDevice()
 {
     if (FOutDeviceHandle != null)
     {
         FOutDeviceHandle.Dispose();
         FOutDeviceHandle = null;
     }
 }
コード例 #7
0
ファイル: MeshProvider.cs プロジェクト: Philiquaz/DSMapStudio
 public void OnResourceLoaded(IResourceHandle handle)
 {
     if (_resource != null && _resource.TryLock())
     {
         _resource.Unlock();
         NotifyAvailable();
     }
 }
コード例 #8
0
ファイル: StrideRenderHandler.cs プロジェクト: vvvv/VL.CEF
        public StrideRenderHandler(NodeContext nodeContext)
        {
            var gameProvider = nodeContext.Factory.CreateService <IResourceProvider <Game> >(nodeContext);

            gameHandle = gameProvider?.GetHandle() ?? throw new ArgumentNullException(nameof(nodeContext), "The game service wasn't found");
            var renderContext = RenderContext.GetShared(gameHandle.Resource.Services);

            Initialize(renderContext);
        }
コード例 #9
0
ファイル: MeshProvider.cs プロジェクト: Philiquaz/DSMapStudio
 public void OnResourceUnloaded(IResourceHandle handle)
 {
     foreach (var submesh in _submeshes)
     {
         submesh.Invalidate();
     }
     _submeshes.Clear();
     NotifyUnavailable();
 }
コード例 #10
0
 public void OnResourceUnloaded(IResourceHandle handle)
 {
     if (Resource != null)
     {
         Created = false;
         UnregisterWithScene();
         Submeshes = null;
     }
 }
コード例 #11
0
        public override void OnCreate(PlayableGraph gragh, IResourceHandle resourceHandle)
        {
            m_resourceHandle = resourceHandle;

            AnimationClip clip = resourceHandle.GetResource <AnimationClip>();

            m_clipPlayable = AnimationClipPlayable.Create(gragh, clip);

            Output = m_clipPlayable;
        }
コード例 #12
0
        /// <summary>
        /// Start the current pool manager instance.
        /// </summary>
        public void Start(IResourceHandle <T> resourceHandle)
        {
            if (resourceHandle == null)
            {
                throw new Exception("The resource handle was not supplied.");
            }

            this.ResourceHandle = resourceHandle;

            #region Create all resources instance by PoolSize field

            lock (this.AllAllocatedResources)
            {
                for (int _resIndex = 0; _resIndex < this.PoolSize; _resIndex++)
                {
                    var _resource = new Resource <T>();
                    _resource.Current        = this.CreateResourceInstance();
                    _resource.ResourceHandle = this.ResourceHandle;
                    this.AllAllocatedResources.Add(_resource);
                }
            }

            #endregion

            #region Traversal all resources and recreate resources that were disconnected or had exception

            this.MonitorTimer = new Timer(new TimerCallback((state) =>
            {
                lock (this.AllAllocatedResources)
                {
                    this.AllAllocatedResources.ForEach(item =>
                    {
                        item.InUse = false;
                        if (!item.Available)
                        {
                            item.Current = this.CreateResourceInstance();
                        }
                    });
                }
            }), null, this.MonitorInterval, this.MonitorInterval);

            #endregion
        }
コード例 #13
0
        public VideoPlayer(NodeContext nodeContext)
        {
            renderDrawContextHandle = nodeContext.GetGameProvider()
                                      .Bind(g => RenderContext.GetShared(g.Services).GetThreadContext())
                                      .GetHandle() ?? throw new ServiceNotFoundException(typeof(IResourceProvider <Game>));

            colorSpaceConverter = new ColorSpaceConverter(renderDrawContextHandle.Resource);

            // Initialize MediaFoundation
            MediaManagerService.Initialize();

            using var mediaEngineAttributes = new MediaEngineAttributes()
                  {
                      // _SRGB doesn't work :/ Getting invalid argument exception later in TransferVideoFrame
                      AudioCategory     = SharpDX.Multimedia.AudioStreamCategory.GameMedia,
                      AudioEndpointRole = SharpDX.Multimedia.AudioEndpointRole.Multimedia,
                      VideoOutputFormat = (int)SharpDX.DXGI.Format.B8G8R8A8_UNorm
                  };

            var graphicsDevice = renderDrawContextHandle.Resource.GraphicsDevice;
            var device         = SharpDXInterop.GetNativeDevice(graphicsDevice) as Device;

            if (device != null)
            {
                // Add multi thread protection on device (MF is multi-threaded)
                using var deviceMultithread = device.QueryInterface <DeviceMultithread>();
                deviceMultithread.SetMultithreadProtected(true);


                // Reset device
                using var manager = new DXGIDeviceManager();
                manager.ResetDevice(device);
                mediaEngineAttributes.DxgiManager = manager;
            }

            using var classFactory = new MediaEngineClassFactory();
            engine = new MediaEngine(classFactory, mediaEngineAttributes);
            engine.PlaybackEvent += Engine_PlaybackEvent;
        }
コード例 #14
0
 public void OnResourceUnloaded(IResourceHandle handle)
 {
     UpdateMaterial();
 }
コード例 #15
0
ファイル: MeshProvider.cs プロジェクト: Philiquaz/DSMapStudio
 public void OnResourceUnloaded(IResourceHandle handle)
 {
     NotifyUnavailable();
 }
コード例 #16
0
            public void ProcessBinder()
            {
                if (Binder == null)
                {
                    string o;
                    var    path = ResourceManager.Locator.VirtualToRealPath(BinderVirtualPath, out o);
                    Binder = InstantiateBinderReaderForFile(path, ResourceManager.Locator.Type);
                    if (Binder == null)
                    {
                        return;
                    }
                }

                for (int i = 0; i < Binder.Files.Count(); i++)
                {
                    var f = Binder.Files[i];
                    if (BinderLoadMask != null && !BinderLoadMask.Contains(i))
                    {
                        continue;
                    }
                    var binderpath   = f.Name;
                    var filevirtpath = ResourceManager.Locator.GetBinderVirtualPath(BinderVirtualPath, binderpath);
                    if (AssetWhitelist != null && !AssetWhitelist.Contains(filevirtpath))
                    {
                        continue;
                    }
                    IResourceHandle handle = null;

                    /*if (ResourceMan.ResourceDatabase.ContainsKey(filevirtpath))
                     * {
                     *  handle = ResourceMan.ResourceDatabase[filevirtpath];
                     * }*/

                    if (filevirtpath.ToUpper().EndsWith(".TPF") || filevirtpath.ToUpper().EndsWith(".TPF.DCX"))
                    {
                        string virt = BinderVirtualPath;
                        if (virt.StartsWith($@"map/tex"))
                        {
                            var regex = new Regex(@"\d{4}$");
                            if (regex.IsMatch(virt))
                            {
                                virt = virt.Substring(0, virt.Length - 5);
                            }
                            else if (virt.EndsWith("tex"))
                            {
                                virt = virt.Substring(0, virt.Length - 4);
                            }
                        }
                        PendingTPFs.Add(new Tuple <string, BinderFileHeader>(virt, f));
                    }
                    else
                    {
                        if (ResourceMask.HasFlag(ResourceType.Flver) &&
                            (filevirtpath.ToUpper().EndsWith(".FLVER") ||
                             filevirtpath.ToUpper().EndsWith(".FLV") ||
                             filevirtpath.ToUpper().EndsWith(".FLV.DCX")))
                        {
                            //handle = new ResourceHandle<FlverResource>();
                            handle = ResourceManager.GetResource <FlverResource>(filevirtpath);
                        }
                        else if (ResourceMask.HasFlag(ResourceType.CollisionHKX) &&
                                 (filevirtpath.ToUpper().EndsWith(".HKX") ||
                                  filevirtpath.ToUpper().EndsWith(".HKX.DCX")))
                        {
                            handle = ResourceManager.GetResource <HavokCollisionResource>(filevirtpath);
                        }
                        else if (ResourceMask.HasFlag(ResourceType.Navmesh) && filevirtpath.ToUpper().EndsWith(".NVM"))
                        {
                            handle = ResourceManager.GetResource <NVMNavmeshResource>(filevirtpath);
                        }
                        else if (ResourceMask.HasFlag(ResourceType.NavmeshHKX) &&
                                 (filevirtpath.ToUpper().EndsWith(".HKX") ||
                                  filevirtpath.ToUpper().EndsWith(".HKX.DCX")))
                        {
                            handle = ResourceManager.GetResource <HavokNavmeshResource>(filevirtpath);
                        }

                        if (handle != null)
                        {
                            PendingResources.Add(new Tuple <IResourceHandle, string, BinderFileHeader>(handle, filevirtpath, f));
                        }
                    }
                }
            }
コード例 #17
0
 public VideoCapture(NodeContext nodeContext)
 {
     renderDrawContextHandle = GetRenderDrawContextHandle(nodeContext) ?? throw new ServiceNotFoundException(typeof(IResourceProvider <Game>));
     colorSpaceConverter     = new ColorSpaceConverter(renderDrawContextHandle.Resource);
 }
コード例 #18
0
 /// <summary>
 /// 创建状态
 /// </summary>
 public abstract void OnCreate(PlayableGraph gragh, IResourceHandle resourceHandle);