Пример #1
0
        public void SelectSkinning(SkinningSelector selector)
        {
            switch (selector)
            {
            case SkinningSelector.Auto:
                AutoSelectSkinning();
                break;

            case SkinningSelector.ForceGPGPU:
            {
                ComputeShaderSkinningAdapter computeAdapter = new ComputeShaderSkinningAdapter(method, computeShader, chunk, chunk.GetBones(transform.parent), material);

                adapter    = computeAdapter as IRenderAdapter;
                disposable = computeAdapter as IDisposable;
            }
            break;

            case SkinningSelector.ForceGPU:
                throw new ArgumentOutOfRangeException("SkinningSelector selector", "GPU Skinning not support.");

            case SkinningSelector.ForceCPU:
            {
                DefaultSkinningAdapter defaultAdapter = new DefaultSkinningAdapter(method, chunk, chunk.GetBones(transform.parent), material);

                adapter    = defaultAdapter as IRenderAdapter;
                disposable = defaultAdapter as IDisposable;
            }
            break;
            }
        }
Пример #2
0
        public void AutoSelectSkinning()
        {
            if (SystemInfo.supportsComputeShaders)
            {
                ComputeShaderSkinningAdapter computeAdapter = new ComputeShaderSkinningAdapter(method, computeShader, chunk, chunk.GetBones(transform.parent), material);

                adapter    = computeAdapter as IRenderAdapter;
                disposable = computeAdapter as IDisposable;
            }
            else // last fallback
            {
                DefaultSkinningAdapter defaultAdapter = new DefaultSkinningAdapter(method, chunk, chunk.GetBones(transform.parent), material);

                adapter    = defaultAdapter as IRenderAdapter;
                disposable = defaultAdapter as IDisposable;
            }
        }