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


C# Material.GetTexture方法代码示例

本文整理汇总了C#中Material.GetTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Material.GetTexture方法的具体用法?C# Material.GetTexture怎么用?C# Material.GetTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Material的用法示例。


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

示例1: Setup

        public override void Setup(Material mat, ref RenderOperation op)
        {
            if (mode == RenderMode.DeferredNormal)
            {
                Matrix mvp = op.Transformation * EffectParams.CurrentCamera.ViewMatrix * EffectParams.CurrentCamera.ProjectionMatrix;

                nrmGenVS.SetValue("mvp", ref mvp);
                nrmGenPS.SetValue("move", move);
                nrmGenPS.SetTexture("dudvMap", mat.GetTexture(0));
                nrmGenPS.SetTexture("normalMap", mat.GetTexture(1));
            }
            else
            {
                Matrix mvp = op.Transformation * EffectParams.CurrentCamera.ViewMatrix * EffectParams.CurrentCamera.ProjectionMatrix;

                Vector3 vpos = EffectParams.CurrentCamera.Position;
                vtxShader.SetValue("mvp", ref mvp);
                vtxShader.SetValue("world", ref op.Transformation);
                vtxShader.SetValue("viewPos", ref vpos);
                Matrix lightPrjTrans;
                Matrix.Multiply(ref op.Transformation, ref EffectParams.DepthViewProj, out lightPrjTrans);

                vtxShader.SetValue("smTrans", lightPrjTrans);


                pixShader.SetTexture("dudvMap", mat.GetTexture(0));
                pixShader.SetTexture("normalMap", mat.GetTexture(1));
                pixShader.SetTexture("reflectionMap", reflection);
                pixShader.SetValue("move", move);

            }
        }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:32,代码来源:WaterEffect.cs

示例2: Setup

        public override void Setup(Material mat, ref RenderOperation op)
        {

            Matrix mvp = op.Transformation * EffectParams.CurrentCamera.ViewMatrix * EffectParams.CurrentCamera.ProjectionMatrix;

            vtxShader.SetValue("mvp", ref mvp);
            //vtxShader.SetValue("cameraZ", EffectParams.InvView.Forward);

            if (!stateSetted)
            {
                ShaderSamplerState state = new ShaderSamplerState();
                state.AddressU = TextureAddressMode.Wrap;
                state.AddressV = TextureAddressMode.Wrap;
                state.AddressW = TextureAddressMode.Wrap;
                state.MinFilter = TextureFilter.Anisotropic;
                state.MagFilter = TextureFilter.Anisotropic;
                state.MipFilter = TextureFilter.Linear;
                state.MaxAnisotropy = 8;
                state.MipMapLODBias = 0;


                pixShader.SetValue("k_a", mat.Ambient);
                pixShader.SetValue("k_d", mat.Diffuse);
                pixShader.SetValue("k_e", mat.Emissive);


                pixShader.SetSamplerState("texDif", ref state);

                ResourceHandle<Texture> clrTex = mat.GetTexture(0);
                if (clrTex == null)
                {
                    pixShader.SetTexture("texDif", noTexture);
                }
                else
                {
                    pixShader.SetTexture("texDif", clrTex);
                }
            }



        }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:42,代码来源:TailEffect.cs

示例3: Setup

        public override void Setup(Material mat, ref RenderOperation op)
        {
            if (mode == RenderMode.Depth)
            {
                Matrix lightPrjTrans;
                Matrix.Multiply(ref op.Transformation, ref EffectParams.DepthViewProj, out lightPrjTrans);
                shdVtxShader.SetValue("mvp", ref lightPrjTrans);
            }
            else if (mode == RenderMode.DeferredNormal) 
            {
                Matrix worldView = op.Transformation * EffectParams.CurrentCamera.ViewMatrix;
                Matrix mvp = worldView * EffectParams.CurrentCamera.ProjectionMatrix;
                nrmGenVShader.SetValue("mvp", ref mvp);
                nrmGenVShader.SetValue("worldView", ref worldView);

                if (!stateSetted)
                {
                    ShaderSamplerState state = new ShaderSamplerState();
                    state.AddressU = TextureAddressMode.Wrap;
                    state.AddressV = TextureAddressMode.Wrap;
                    state.AddressW = TextureAddressMode.Wrap;
                    state.MinFilter = TextureFilter.Linear;
                    state.MagFilter = TextureFilter.Linear;
                    state.MipFilter = TextureFilter.Linear;
                    state.MaxAnisotropy = 8;
                    state.MipMapLODBias = 0;

                    nrmGenPShader.SetSamplerState("texDif", ref state);

                    ResourceHandle<Texture> clrTex = mat.GetTexture(0);
                    if (clrTex == null)
                    {
                        nrmGenPShader.SetTexture("texDif", noTexture);
                    }
                    else
                    {
                        nrmGenPShader.SetTexture("texDif", clrTex);
                    }
                    stateSetted = true;
                }
            }
            else
            {
                Matrix mvp = op.Transformation * EffectParams.CurrentCamera.ViewMatrix * EffectParams.CurrentCamera.ProjectionMatrix;

                vtxShader.SetValue("mvp", ref mvp);
                vtxShader.SetValue("world", ref op.Transformation);

                Matrix lightPrjTrans;
                Matrix.Multiply(ref op.Transformation, ref EffectParams.DepthViewProj, out lightPrjTrans);

                vtxShader.SetValue("smTrans", lightPrjTrans);


                WorldObject wo = op.Sender as WorldObject;
                if (wo != null)
                {
                    pixShader.SetValue("visiblity", wo.Visiblity);
                }
                else
                {
                    pixShader.SetValue("visiblity", 1.0f);
                }


                if (!stateSetted)
                {
                    ShaderSamplerState state = new ShaderSamplerState();
                    state.AddressU = TextureAddressMode.Wrap;
                    state.AddressV = TextureAddressMode.Wrap;
                    state.AddressW = TextureAddressMode.Wrap;
                    state.MinFilter = TextureFilter.Anisotropic;
                    state.MagFilter = TextureFilter.Anisotropic;
                    state.MipFilter = TextureFilter.Linear;
                    state.MaxAnisotropy = 8;
                    state.MipMapLODBias = 0;


                    pixShader.SetValue("k_a", mat.Ambient);
                    pixShader.SetValue("k_d", mat.Diffuse);
                    pixShader.SetValue("k_s", mat.Specular);
                    pixShader.SetValue("k_e", mat.Emissive);
                    pixShader.SetValue("k_power", mat.Power);

                    

                    pixShader.SetSamplerState("texDif", ref state);

                    ResourceHandle<Texture> clrTex = mat.GetTexture(0);
                    if (clrTex == null)
                    {
                        pixShader.SetTexture("texDif", noTexture);
                    }
                    else
                    {
                        pixShader.SetTexture("texDif", clrTex);
                    }

                    if (mat.IsVegetation)
                    {
//.........这里部分代码省略.........
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:101,代码来源:StandardEffect.cs

示例4: Setup

        public override void Setup(Material mat, ref RenderOperation op)
        {
            if (mode == RenderMode.Depth)
            {
                Matrix lightPrjTrans;
                Matrix.Multiply(ref op.Transformation, ref EffectParams.DepthViewProj, out lightPrjTrans);
                shdVtxShader.SetValue("mvp", ref lightPrjTrans);
            }
            else if (mode == RenderMode.DeferredNormal)
            {
                Matrix worldView = op.Transformation * EffectParams.CurrentCamera.ViewMatrix;
                Matrix mvp = worldView * EffectParams.CurrentCamera.ProjectionMatrix;
                nrmGenVShader.SetValue("mvp", ref mvp);
                nrmGenVShader.SetValue("worldView", ref worldView);

                if (!stateSetted)
                {
                    ShaderSamplerState state = new ShaderSamplerState();
                    state.AddressU = TextureAddressMode.Wrap;
                    state.AddressV = TextureAddressMode.Wrap;
                    state.AddressW = TextureAddressMode.Wrap;
                    state.MinFilter = TextureFilter.Linear;
                    state.MagFilter = TextureFilter.Linear;
                    state.MipFilter = TextureFilter.Linear;
                    state.MaxAnisotropy = 8;
                    state.MipMapLODBias = 0;

                    nrmGenPShader.SetSamplerState("texDif", ref state);

                    ResourceHandle<Texture> clrTex = mat.GetTexture(0);
                    if (clrTex == null)
                    {
                        nrmGenPShader.SetTexture("texDif", noTexture);
                    }
                    else
                    {
                        nrmGenPShader.SetTexture("texDif", clrTex);
                    }
                }
            }
            else
            {
                Matrix mvp = op.Transformation * EffectParams.CurrentCamera.ViewMatrix * EffectParams.CurrentCamera.ProjectionMatrix;

                vtxShader.SetValue("mvp", ref mvp);
               
                Matrix lightPrjTrans;
                Matrix.Multiply(ref op.Transformation, ref EffectParams.DepthViewProj, out lightPrjTrans);

                vtxShader.SetValue("smTrans", lightPrjTrans);

                TreeBatchModel mdl = op.Sender as TreeBatchModel;
                if (mdl != null)
                {
                    vtxShader.SetValue("world", ref mdl.TreeOrientation);
                }
                else
                {
                    vtxShader.SetValue("world", ref op.Transformation);
                }

                if (!stateSetted)
                {

                    pixShader.SetValue("k_a", mat.Ambient);
                    pixShader.SetValue("k_d", mat.Diffuse);
                    pixShader.SetValue("k_s", mat.Specular);
                    pixShader.SetValue("k_e", mat.Emissive);
                    pixShader.SetValue("k_power", mat.Power);

                    ResourceHandle<Texture> clrTex = mat.GetTexture(0);
                    if (clrTex == null)
                    {
                        pixShader.SetTexture("texDif", null);
                    }
                    else
                    {
                        pixShader.SetTexture("texDif", clrTex);
                    }
                    pixShader.SetTexture("texFog", TerrainEffect.FogMask);

                    Vector2 isVeg_wind = new Vector2();

                    if (mat.IsVegetation)
                    {
                        isVeg_wind.X = 100;// vtxShader.SetValue("isVeg_wind", new Vector4(100, 100, 100, 100));
                    }
                    isVeg_wind.Y = winding;
                    vtxShader.SetValue("isVeg_wind", ref isVeg_wind);


                    stateSetted = true;
                }
            }
        }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:95,代码来源:TreeEffect.cs

示例5: ApplyMaterial

        private void ApplyMaterial(Material mat)
        {
            if(mat.GetTextureCount(TextureType.Diffuse) > 0) {
                TextureSlot tex = mat.GetTexture(TextureType.Diffuse, 0);
                LoadTexture(tex.FilePath);
            }

            Color4 color = new Color4(.8f, .8f, .8f, 1.0f);
            if(mat.HasColorDiffuse) {
               // color = FromColor(mat.ColorDiffuse);
            }
            GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Diffuse, color);

            color = new Color4(0, 0, 0, 1.0f);
            if(mat.HasColorSpecular) {
                color = FromColor(mat.ColorSpecular);
            }
            GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Specular, color);

            color = new Color4(.2f, .2f, .2f, 1.0f);
            if(mat.HasColorAmbient) {
                color = FromColor(mat.ColorAmbient);
            }
            GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Ambient, color);

            color = new Color4(0, 0, 0, 1.0f);
            if(mat.HasColorEmissive) {
                color = FromColor(mat.ColorEmissive);
            }
            GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Emission, color);

            float shininess = 1;
            float strength = 1;
            if(mat.HasShininess) {
                shininess = mat.Shininess;
            }
            if(mat.HasShininessStrength) {
                strength = mat.ShininessStrength;
            }

            GL.Material(MaterialFace.FrontAndBack, MaterialParameter.Shininess, shininess * strength);
        }
开发者ID:dkushner,项目名称:Assimp-Net,代码行数:42,代码来源:SimpleOpenGLSample.cs

示例6: Setup

        public override void Setup(Material mat, ref RenderOperation op)
        {
            if (mode == RenderMode.Final)
            {
                Matrix mvp = op.Transformation * EffectParams.CurrentCamera.ViewMatrix * EffectParams.CurrentCamera.ProjectionMatrix;

                vtxShader.SetValue("mvp", ref mvp);


                if (!stateSetted)
                {
                    ShaderSamplerState state = new ShaderSamplerState();
                    state.AddressU = TextureAddressMode.Wrap;
                    state.AddressV = TextureAddressMode.Wrap;
                    state.AddressW = TextureAddressMode.Wrap;
                    state.MinFilter = TextureFilter.Anisotropic;
                    state.MagFilter = TextureFilter.Anisotropic;
                    state.MipFilter = TextureFilter.Linear;
                    state.MaxAnisotropy = 8;
                    state.MipMapLODBias = 0;


                    pixShader.SetSamplerState("texDif", ref state);

                    ResourceHandle<Texture> clrTex = mat.GetTexture(0);
                    pixShader.SetTexture("texDif", clrTex != null ? clrTex.Resource : null);

                    stateSetted = true;
                }
            }
            else if (mode == RenderMode.DeferredNormal)
            {
                Matrix worldView = op.Transformation * EffectParams.CurrentCamera.ViewMatrix;
                Matrix mvp = worldView * EffectParams.CurrentCamera.ProjectionMatrix;
                nrmGenVShader.SetValue("mvp", ref mvp);
                nrmGenVShader.SetValue("worldView", ref worldView);

                if (!stateSetted)
                {
                    ShaderSamplerState state = new ShaderSamplerState();
                    state.AddressU = TextureAddressMode.Wrap;
                    state.AddressV = TextureAddressMode.Wrap;
                    state.AddressW = TextureAddressMode.Wrap;
                    state.MinFilter = TextureFilter.Linear;
                    state.MagFilter = TextureFilter.Linear;
                    state.MipFilter = TextureFilter.Linear;
                    state.MaxAnisotropy = 8;
                    state.MipMapLODBias = 0;

                    nrmGenPShader.SetSamplerState("texDif", ref state);

                    ResourceHandle<Texture> clrTex = mat.GetTexture(0);
                    if (clrTex == null)
                    {
                        nrmGenPShader.SetTexture("texDif", null);
                    }
                    else
                    {
                        nrmGenPShader.SetTexture("texDif", clrTex);
                    }
                }
            }
        }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:63,代码来源:CityLinkEffect.cs

示例7: Setup

        public override void Setup(Material mat, ref RenderOperation op)
        {
            if (mode == RenderMode.Depth)
            {
                Matrix lightPrjTrans;
                Matrix.Multiply(ref op.Transformation, ref EffectParams.DepthViewProj, out lightPrjTrans);
                shdVtxShader.SetValue("mvp", ref lightPrjTrans);
            }
            else if (mode == RenderMode.DeferredNormal)
            {
                Matrix worldView = op.Transformation * EffectParams.CurrentCamera.ViewMatrix;
                Matrix mvp = worldView * EffectParams.CurrentCamera.ProjectionMatrix;
                nrmGenVShader.SetValue("mvp", ref mvp);
                nrmGenVShader.SetValue("worldView", ref worldView);

                if (!stateSetted)
                {
                    ShaderSamplerState state = new ShaderSamplerState();
                    state.AddressU = TextureAddressMode.Wrap;
                    state.AddressV = TextureAddressMode.Wrap;
                    state.AddressW = TextureAddressMode.Wrap;
                    state.MinFilter = TextureFilter.Linear;
                    state.MagFilter = TextureFilter.Linear;
                    state.MipFilter = TextureFilter.Linear;
                    state.MaxAnisotropy = 8;
                    state.MipMapLODBias = 0;

                    nrmGenPShader.SetSamplerState("texDif", ref state);

                    ResourceHandle<Texture> clrTex = mat.GetTexture(0);
                    if (clrTex != null)
                    {
                        nrmGenPShader.SetTexture("texDif", clrTex);
                    }
                }
            }
            else
            {
                Matrix mvp = op.Transformation * EffectParams.CurrentCamera.ViewMatrix * EffectParams.CurrentCamera.ProjectionMatrix;

                vtxShader.SetValue("mvp", ref mvp);
                vtxShader.SetValue("world", ref op.Transformation);

                Matrix lightPrjTrans;
                Matrix.Multiply(ref op.Transformation, ref EffectParams.DepthViewProj, out lightPrjTrans);

                vtxShader.SetValue("smTrans", lightPrjTrans);

                City sender = op.Sender as City;

                pixShader.SetValue("k_a", mat.Ambient);
                if (sender != null && sender.IsCaptured)
                {
                    Color4F color = new Color4F(sender.Owner.SideColor);
                    pixShader.SetValue("k_d", color);
                }
                else
                {
                    pixShader.SetValue("k_d", mat.Diffuse);
                }

                if (!stateSetted)
                {
                    ShaderSamplerState state = new ShaderSamplerState();
                    state.AddressU = TextureAddressMode.Wrap;
                    state.AddressV = TextureAddressMode.Wrap;
                    state.AddressW = TextureAddressMode.Wrap;
                    state.MinFilter = TextureFilter.Anisotropic;
                    state.MagFilter = TextureFilter.Anisotropic;
                    state.MipFilter = TextureFilter.Linear;
                    state.MaxAnisotropy = 8;
                    state.MipMapLODBias = 0;

                    pixShader.SetSamplerState("texDif", ref state);

                    ResourceHandle<Texture> clrTex = mat.GetTexture(0);
                    if (clrTex != null)
                    {
                        pixShader.SetTexture("texDif", clrTex);
                    }

                    stateSetted = true;
                }
            }
        }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:85,代码来源:CityRingEffect.cs


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