public GenericPointMaterialVariable(IEffectsManager manager, IRenderTechnique technique,
                                     GenericMaterialCore materialCore, ConstantBufferDescription constantBufferDescription,
                                     string materialShaderPassName = DefaultPassNames.Default,
                                     string shadowShaderPassName   = DefaultPassNames.ShadowPass)
     : base(manager, technique, materialCore, constantBufferDescription, materialShaderPassName, shadowShaderPassName, "")
 {
 }
            public GenericMaterialVariable(IEffectsManager manager, IRenderTechnique technique,
                                           GenericMaterialCore materialCore, ConstantBufferDescription constantBufferDescription,
                                           string materialShaderPassName = DefaultPassNames.Default,
                                           string shadowShaderPassName   = DefaultPassNames.ShadowPass,
                                           string wireframePassName      = DefaultPassNames.Wireframe,
                                           string depthPassName          = DefaultPassNames.DepthPrepass)
                : base(manager, technique, constantBufferDescription, materialCore)
            {
                this.materialCore = materialCore;
                materialPass      = technique[materialShaderPassName];
                shadowPass        = technique[shadowShaderPassName];
                wireframePass     = technique[wireframePassName];
                depthPass         = technique[depthPassName];
                shaderResources   = new KeyValuePair <int, ShaderResourceViewProxy> [materialPass.PixelShader.ShaderResourceViewMapping.Count];

                for (var i = 0; i < materialPass.PixelShader.ShaderResourceViewMapping.Count; ++i)
                {
                    var mapping = materialPass.PixelShader.ShaderResourceViewMapping.Mappings[i];
                    resourceIdxDict.Add(mapping.Value.Description.Name, i);
                    shaderResources[i] = new KeyValuePair <int, ShaderResourceViewProxy>(mapping.Key, null);
                }

                samplerResources = new KeyValuePair <int, SamplerStateProxy> [materialPass.PixelShader.SamplerMapping.Count];

                for (var i = 0; i < materialPass.PixelShader.SamplerMapping.Count; ++i)
                {
                    var mapping = materialPass.PixelShader.SamplerMapping.Mappings[i];
                    samplerIdxDict.Add(mapping.Value.Name, i);
                    samplerResources[i] = new KeyValuePair <int, SamplerStateProxy>(mapping.Key, null);
                }


                materialCore.UpdatingResource += MaterialCore_UpdatingResource;
            }
 private void CreateGenericPhongMaterial()
 {
     PhongMaterial = new GenericMeshMaterialCore(EffectsManager[DefaultRenderTechniqueNames.Mesh][DefaultPassNames.Default], "cbMesh");
     PhongMaterial.SetProperty(PhongPBRMaterialStruct.DiffuseStr, Color.Red.ToColor4());
     PhongMaterial.SetProperty(PhongPBRMaterialStruct.ReflectStr, Color.Black.ToColor4());
     PhongMaterial.SetProperty(PhongPBRMaterialStruct.UVTransformR1Str, new Vector4(1, 0, 0, 0));
     PhongMaterial.SetProperty(PhongPBRMaterialStruct.UVTransformR2Str, new Vector4(0, 1, 0, 0));
 }
            public GenericMaterialVariable(IEffectsManager manager, IRenderTechnique technique,
                                           GenericMaterialCore materialCore, ConstantBufferDescription constantBufferDescription,
                                           string materialShaderPassName = DefaultPassNames.Default,
                                           string shadowShaderPassName   = DefaultPassNames.ShadowPass,
                                           string wireframePassName      = DefaultPassNames.Wireframe,
                                           string depthPassName          = DefaultPassNames.DepthPrepass)
                : base(manager, technique, constantBufferDescription, materialCore)
            {
                core            = materialCore;
                materialPass    = technique[materialShaderPassName];
                shadowPass      = technique[shadowShaderPassName];
                wireframePass   = technique[wireframePassName];
                depthPass       = technique[depthPassName];
                shaderResources = new KeyValuePair <int, ShaderResourceViewProxy> [materialPass.PixelShader.ShaderResourceViewMapping.Count];

                for (int i = 0; i < materialPass.PixelShader.ShaderResourceViewMapping.Count; ++i)
                {
                    var mapping = materialPass.PixelShader.ShaderResourceViewMapping.Mappings[i];
                    resourceIdxDict.Add(mapping.Value.Description.Name, i);
                    shaderResources[i] = new KeyValuePair <int, ShaderResourceViewProxy>(mapping.Key, null);
                }

                samplerResources = new KeyValuePair <int, SamplerStateProxy> [materialPass.PixelShader.SamplerMapping.Count];

                for (int i = 0; i < materialPass.PixelShader.SamplerMapping.Count; ++i)
                {
                    var mapping = materialPass.PixelShader.SamplerMapping.Mappings[i];
                    samplerIdxDict.Add(mapping.Value.Name, i);
                    samplerResources[i] = new KeyValuePair <int, SamplerStateProxy>(mapping.Key, null);
                }

                foreach (var texture in materialCore.TextureDict)
                {
                    SetTexture(texture.Key, texture.Value);
                }

                foreach (var sampler in materialCore.SamplerDict)
                {
                    SetSampler(sampler.Key, sampler.Value);
                }

                foreach (var prop in materialCore.FloatDict)
                {
                    WriteValue(prop.Key, prop.Value);
                }
                foreach (var prop in materialCore.Vector2Dict)
                {
                    WriteValue(prop.Key, prop.Value);
                }
                foreach (var prop in materialCore.Vector3Dict)
                {
                    WriteValue(prop.Key, prop.Value);
                }
                foreach (var prop in materialCore.Vector4Dict)
                {
                    WriteValue(prop.Key, prop.Value);
                }
                foreach (var prop in materialCore.MatrixDict)
                {
                    WriteValue(prop.Key, prop.Value);
                }
                materialCore.UpdatingResource += MaterialCore_UpdatingResource;
            }