当前位置: 首页>>代码示例>>C#>>正文


C# EffectFlags类代码示例

本文整理汇总了C#中EffectFlags的典型用法代码示例。如果您正苦于以下问题:C# EffectFlags类的具体用法?C# EffectFlags怎么用?C# EffectFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EffectFlags类属于命名空间,在下文中一共展示了EffectFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PixelShader10

 public PixelShader10(Device device,
              string shaderSource,
              string entryPoint,
              ShaderVersion shaderVersion,
              ShaderFlags shaderFlags = ShaderFlags.None,
              EffectFlags effectFlags = EffectFlags.None) :
     base(shaderSource, entryPoint, shaderVersion, shaderFlags, effectFlags)
 {
     m_device = device;
     CreatePixelShader();
 }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:11,代码来源:PixelShader10.cs

示例2: LoadByteCodeFromFile

        public ShaderBytecode LoadByteCodeFromFile(ShaderType shaderType, string fileName, string entryPoint = null, ShaderFlags shaderFlags = ShaderFlags.None, EffectFlags effectFlags = EffectFlags.None)
        {
            #if DEBUG
            shaderFlags |= ShaderFlags.Debug;
            #endif

            var profile = GetProfileFromDevice(shaderType);
            var compilationResult = ShaderBytecode.CompileFromFile(fileName, entryPoint, profile, shaderFlags, effectFlags, include: new IncludeFromDisk());

            return compilationResult.Bytecode;
        }
开发者ID:ernstnaezer,项目名称:sandbox,代码行数:11,代码来源:ShaderCompiler.cs

示例3: ShaderBase

 protected ShaderBase(string shaderSource,
                      string entryPoint,
                      ShaderVersion shaderVersion,
                      ShaderFlags shaderFlags = ShaderFlags.None,
                      EffectFlags effectFlags = EffectFlags.None)
 {
     m_shaderByteCode = ShaderBytecode.Compile(shaderSource,
                                               entryPoint,
                                               shaderVersion.ToShaderVersionString(),
                                               shaderFlags,
                                               effectFlags);
 }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:12,代码来源:ShaderBase.cs

示例4: VertexShader10

 public VertexShader10(Device device,
                      string embeddedSourceResourceName,
                      string entryPoint,
                      ShaderVersion shaderVersion,
                      ShaderFlags shaderFlags = ShaderFlags.None,
                      EffectFlags effectFlags = EffectFlags.None) :
     base(embeddedSourceResourceName,
          entryPoint,
          shaderVersion,
          shaderFlags,
          effectFlags)
 {
     m_device = device;
     CreatePixelShader();
 }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:15,代码来源:VertexShader10.cs

示例5: PrecompileOrLoad

        public static ShaderBytecode PrecompileOrLoad(string fileName, string entryPoint, string profile, ShaderFlags shaderFlags, EffectFlags effectFlags)
        {
            FileInfo sourceFile = new FileInfo(fileName);

            if (!sourceFile.Exists)
                throw new FileNotFoundException();

            FileInfo compiledFile = new FileInfo(@"Precompiled\" + Path.GetFileNameWithoutExtension(sourceFile.Name) + "_" + entryPoint + "_" + profile + ".bin");

            if (compiledFile.Exists && sourceFile.LastWriteTime > compiledFile.LastWriteTime)
            {
                compiledFile.Delete();
                compiledFile.Refresh();
            }

            ShaderBytecode shaderBytecode = null;

            if (compiledFile.Exists)
            {
                byte[] compiledBytes = File.ReadAllBytes(compiledFile.FullName);
                DataStream compiledDataStream = new DataStream(compiledBytes, true, false);

                shaderBytecode = new ShaderBytecode(compiledDataStream);
            }
            else
            {
                shaderBytecode = ShaderBytecode.CompileFromFile(fileName, entryPoint, profile, shaderFlags, effectFlags);

                byte[] compiledBytes = shaderBytecode.Data.ReadRange<byte>((int)shaderBytecode.Data.Length);

                Directory.CreateDirectory(Path.GetDirectoryName(compiledFile.FullName));
                File.WriteAllBytes(compiledFile.FullName, compiledBytes);
            }

            if (shaderBytecode == null)
                throw new D3DCompilerException();

            return shaderBytecode;
        }
开发者ID:barograf,项目名称:VoxelTerrain,代码行数:39,代码来源:ShaderPrecompiler.cs

示例6: Compile

 /// <summary>
 /// Compiles the provided shader or effect source.
 /// </summary>
 /// <param name="shaderSource">A string containing the source of the shader or effect to compile.</param>
 /// <param name="profile">The shader target or set of shader features to compile against.</param>
 /// <param name="shaderFlags">Shader compilation options.</param>
 /// <param name="effectFlags">Effect compilation options.</param>
 /// <param name="sourceFileName">Name of the source file.</param>
 /// <returns>
 /// The compiled shader bytecode, or <c>null</c> if the method fails.
 /// </returns>
 public static CompilationResult Compile(string shaderSource, string profile, ShaderFlags shaderFlags,
                                      EffectFlags effectFlags, string sourceFileName = "unknown")
 {
     if (string.IsNullOrEmpty(shaderSource))
     {
         throw new ArgumentNullException("shaderSource");
     }
     return Compile(Encoding.ASCII.GetBytes(shaderSource), null, profile, shaderFlags, effectFlags, null, null,
                    sourceFileName);
 }
开发者ID:pH200,项目名称:SharpDX,代码行数:21,代码来源:ShaderBytecode.cs

示例7: HasLowTolerance

 /// <summary>
 /// Determines if class has low tolerance to effects.
 /// </summary>
 /// <param name="flags">EffectFlags to test.</param>
 /// <returns>True if low tolerance.</returns>
 bool HasLowTolerance(CFGData cfg, EffectFlags flags)
 {
     return ((cfg.LowToleranceFlags & (byte)flags) == (byte)flags) ? true : false;
 }
开发者ID:Nystul-the-Magician,项目名称:daggerfall-unity,代码行数:9,代码来源:DFCareer.cs

示例8: GetEffectFlagsString

 private static string GetEffectFlagsString(EffectFlags effectFlags)
 {
     var text = effectFlags.ToString();
     return text;
 }
开发者ID:thomasvt,项目名称:EffectEd,代码行数:5,代码来源:CompilerSettingsParser.cs

示例9: CompileFromFile

        /// <summary>
        /// Compiles a shader or effect from a file on disk.
        /// </summary>
        /// <param name="fileName">The name of the source file to compile.</param>
        /// <param name="entryPoint">The name of the shader entry-point function, or <c>null</c> for an effect file.</param>
        /// <param name="profile">The shader target or set of shader features to compile against.</param>
        /// <param name="shaderFlags">Shader compilation options.</param>
        /// <param name="effectFlags">Effect compilation options.</param>
        /// <param name="defines">A set of macros to define during compilation.</param>
        /// <param name="include">An interface for handling include files.</param>
        /// <returns>
        /// The compiled shader bytecode, or <c>null</c> if the method fails.
        /// </returns>
        public static CompilationResult CompileFromFile(string fileName, string entryPoint, string profile, ShaderFlags shaderFlags = ShaderFlags.None, EffectFlags effectFlags = EffectFlags.None, ShaderMacro[] defines = null, Include include = null)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }
            if (!File.Exists(fileName))
            {
                throw new FileNotFoundException("Could not open the shader or effect file.", fileName);
            }

            unsafe
            {
                var resultCode = Result.Ok;

                Blob blobForCode = null;
                Blob blobForErrors = null;

#if DIRECTX11_1
                resultCode = D3D.CompileFromFile(
                    fileName,
                    PrepareMacros(defines),
                    IncludeShadow.ToIntPtr(include),
                    entryPoint,
                    profile,
                    shaderFlags,
                    effectFlags,
                    out blobForCode,
                    out blobForErrors);

                if (resultCode.Failure)
                {
                    if (blobForErrors != null)
                    {
                        if (Configuration.ThrowOnShaderCompileError) throw new CompilationException(resultCode, Utilities.BlobToString(blobForErrors));
                    }
                    else
                    {
                        throw new SharpDXException(resultCode);
                    }
                }

                return new CompilationResult(blobForCode != null ? new ShaderBytecode(blobForCode) : null, resultCode, Utilities.BlobToString(blobForErrors));
#else
                return Compile(File.ReadAllText(fileName), entryPoint, profile, shaderFlags, effectFlags,
                                PrepareMacros(defines), include, fileName);
#endif
            }


        }
开发者ID:pH200,项目名称:SharpDX,代码行数:68,代码来源:ShaderBytecode.cs

示例10: RegisterEffect

 /// <summary>
 /// Register an effect for a set of RenderTechniques.
 /// </summary>
 /// <param name="shaderEffectBytecode">A byte array representing the compiled shader.</param>
 /// <param name="techniques">A set of RenderTechnique objects for which to associate the Effect.</param>
 /// <param name="eFlags"></param>
 protected void RegisterEffect(byte[] shaderEffectBytecode, RenderTechnique[] techniques, EffectFlags eFlags = EffectFlags.None)
 {
     var effect = new Effect(device, shaderEffectBytecode, eFlags);
     foreach (var tech in techniques)
         data[tech.Name] = effect;
 }
开发者ID:ORRNY66,项目名称:helix-toolkit,代码行数:12,代码来源:Effects.cs

示例11: WarpEffectBase

 internal WarpEffectBase(string name, Image image, string submenuName, EffectFlags options)
     : base(name, image, submenuName, options)
 {
 }
开发者ID:metadeta96,项目名称:openpdn,代码行数:4,代码来源:WarpEffectBase.cs

示例12: HasResistance

 /// <summary>
 /// Determines if class is resistant to effects.
 /// </summary>
 /// <param name="flags">EffectFlags to test.</param>
 /// <returns>True if resistant.</returns>
 bool HasResistance(CFGData cfg, EffectFlags flags)
 {
     return ((cfg.ResistanceFlags & (byte)flags) == (byte)flags) ? true : false;
 }
开发者ID:Nystul-the-Magician,项目名称:daggerfall-unity,代码行数:9,代码来源:DFCareer.cs

示例13: Effect

 /// <summary>
 /// Initializes a new instance of the <see cref="Effect"/> class.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="effectByteCode">The effect byte code.</param>
 /// <param name="fxFlags">Effect compile options</param>
 /// <param name="effectPool">Optional. A reference to an memory space for effect variables that are shared across effects (see <see cref="SharpDX.Direct3D10.EffectPool"/>).</param>
 public unsafe Effect(Device device, byte[] effectByteCode, EffectFlags fxFlags = EffectFlags.None, EffectPool effectPool = null) 
 {
     fixed (void* ptr = effectByteCode)
         D3D10.CreateEffectFromMemory((IntPtr)ptr, effectByteCode.Length, (int)fxFlags, device, effectPool, this);
 }
开发者ID:QuantumDeveloper,项目名称:SharpDX,代码行数:12,代码来源:Effect.cs

示例14: HasCriticalWeakness

 /// <summary>
 /// Determines if class has critical weakness to effects.
 /// </summary>
 /// <param name="flags">EffectFlags to test.</param>
 /// <returns>True if critical weakness.</returns>
 bool HasCriticalWeakness(CFGData cfg, EffectFlags flags)
 {
     return ((cfg.CriticalWeaknessFlags & (byte)flags) == (byte)flags) ? true : false;
 }
开发者ID:Nystul-the-Magician,项目名称:daggerfall-unity,代码行数:9,代码来源:DFCareer.cs

示例15: HasImmunity

 /// <summary>
 /// Determines if class is immune to effects.
 /// </summary>
 /// <param name="flags">EffectFlags to test.</param>
 /// <returns>True if immune.</returns>
 bool HasImmunity(CFGData cfg, EffectFlags flags)
 {
     return ((cfg.ImmunityFlags & (byte)flags) == (byte)flags) ? true : false;
 }
开发者ID:Nystul-the-Magician,项目名称:daggerfall-unity,代码行数:9,代码来源:DFCareer.cs


注:本文中的EffectFlags类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。