예제 #1
0
        private static void ComparePass(EffectPass reflectionPass, Fx10.EffectPass pass)
        {
            EffectPassDescription desc = reflectionPass.Description;

            Assert.AreEqual(desc.Name, pass.Name);
            var annotations = reflectionPass.GetAnnotations();

            for (int i = 0; i < desc.AnnotationCount; i++)
            {
                CompareVariable(annotations[i], pass.Annotations[i]);
            }

            /*var pixelShader = pass.Shaders.FirstOrDefault(
             *      s => s.ShaderType == Fx10.EffectShaderType.PixelShader);
             * if(pixelShader != null)
             * {
             *      EffectPassShaderDescription shaderDesc = reflectionPass.PixelShaderDescription;
             *      CompareShader(shaderDesc, pixelShader);
             * }
             * var vertexShader = pass.Shaders.FirstOrDefault(
             *      s => s.ShaderType == Fx10.EffectShaderType.VertexShader);
             * if (vertexShader != null)
             * {
             *      EffectPassShaderDescription shaderDesc = reflectionPass.VertexShaderDescription;
             *      CompareShader(shaderDesc, vertexShader);
             * }
             * var geometryShader = pass.Shaders.FirstOrDefault(
             *      s => s.ShaderType == Fx10.EffectShaderType.GeometryShader);
             * if (geometryShader != null)
             * {
             *      EffectPassShaderDescription shaderDesc = reflectionPass.GeometryShaderDescription;
             *      CompareShader(shaderDesc, geometryShader);
             * }*/
        }
예제 #2
0
 public InputLayout FetchILayout(EffectPassDescription d, API_Device D)
 {
     if (bufferedLayouts.ContainsKey(d.Name))
         return bufferedLayouts[d.Name];
     else
     {
         InputLayout ilayout = new InputLayout(D.HadrwareDevice(), d.Signature, ies);
         bufferedLayouts.Add(d.Name, ilayout);
         return ilayout;
     }
 }
예제 #3
0
파일: Renderer.cs 프로젝트: kkdevs/sb3u
        private void BuildFX()
        {
            try
            {
                PositionColorEffect = new Core.FX.ColorEffect(Device, Path.GetDirectoryName(Application.ExecutablePath) + "/FX/color.fxo");
                EffectPassDescription passDesc = PositionColorEffect.ColorTech.GetPassByIndex(0).Description;
                LineLayout = new InputLayout
                             (
                    Device,
                    passDesc.Signature,
                    new InputElement[]
                {
                    new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                    new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 12, 0, InputClassification.PerVertexData, 0)
                }
                             );

                normalMapEffect     = new Core.FX.ExtendedNormalMapEffect(Device, Path.GetDirectoryName(Application.ExecutablePath) + "/FX/NormalMap.fxo");
                passDesc            = ((Core.FX.ExtendedNormalMapEffect)Effect).MorphTech.GetPassByIndex(0).Description;
                MorphedVertexLayout = new InputLayout
                                      (
                    Device,
                    passDesc.Signature,
                    new InputElement[]
                {
                    new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                    new InputElement("NORMAL", 0, Format.R32G32B32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0),
                    new InputElement("POSITION", 1, Format.R32G32B32_Float, InputElement.AppendAligned, 1, InputClassification.PerVertexData, 0),
                    new InputElement("NORMAL", 1, Format.R32G32B32_Float, InputElement.AppendAligned, 1, InputClassification.PerVertexData, 0),
                    new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 2, InputClassification.PerVertexData, 0),
                }
                                      );
                passDesc            = ((Core.FX.ExtendedNormalMapEffect)Effect).Light1TexAlphaClipSkinnedTech.GetPassByIndex(0).Description;
                BlendedVertexLayout = new InputLayout
                                      (
                    Device,
                    passDesc.Signature,
                    new InputElement[]
                {
                    new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                    new InputElement("NORMAL", 0, Format.R32G32B32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0),
                    new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0),
                    new InputElement("TANGENT", 0, Format.R32G32B32A32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0),
                    new InputElement("BLENDWEIGHT", 0, Format.R32G32B32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0),
                    new InputElement("BLENDINDICES", 0, Format.R32G32B32A32_UInt, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0),
                    new InputElement("COLOR", 0, Format.R32G32B32A32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0)
                }
                                      );
                passDesc           = ((Core.FX.ExtendedNormalMapEffect)Effect).NormalsTech.GetPassByIndex(0).Description;
                VertexNormalLayout = new InputLayout
                                     (
                    Device,
                    passDesc.Signature,
                    new InputElement[]
                {
                    new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                    new InputElement("BLENDWEIGHT", 0, Format.R32G32B32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0),
                    new InputElement("BLENDINDICES", 0, Format.R32G32B32A32_UInt, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0),
                    new InputElement("COLOR", 0, Format.R32G32B32A32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0)
                }
                                     );
                passDesc         = ((Core.FX.ExtendedNormalMapEffect)Effect).BonesTech.GetPassByIndex(0).Description;
                VertexBoneLayout = new InputLayout
                                   (
                    Device,
                    passDesc.Signature,
                    new InputElement[]
                {
                    new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
                    new InputElement("BLENDINDICES", 0, Format.R32_UInt, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0),
                    new InputElement("COLOR", 0, Format.R32G32B32A32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0)
                }
                                   );
            }
            catch (Exception ex)
            {
                Report.ReportLog("BuildFX crashed: " + ex.Message);
                throw ex;
            }
        }