protected override void OnRender(RenderContext context, DeviceContextProxy deviceContext)
 {
     ShaderPass pass = MaterialVariables.GetPass(this, context);
     if (pass.IsNULL)
     { return; }
     pass.BindShader(deviceContext);
     pass.BindStates(deviceContext, DefaultStateBinding);
     if (!BindMaterialTextures(deviceContext, pass))
     {
         return;
     }
     if (context.RenderHost.IsShadowMapEnabled)
     {
         pass.PixelShader.BindTexture(deviceContext, shadowMapSlot, context.SharedResource.ShadowView);
     }
     DynamicReflector?.BindCubeMap(deviceContext);
     OnDraw(deviceContext, InstanceBuffer);
     DynamicReflector?.UnBindCubeMap(deviceContext);
     if (RenderWireframe && WireframePass != ShaderPass.NullPass)
     {
         if (RenderType == RenderType.Transparent && context.IsOITPass)
         {
             pass = WireframeOITPass;
         }
         else
         {
             pass = WireframePass;
         }
         pass.BindShader(deviceContext, false);
         pass.BindStates(deviceContext, DefaultStateBinding);
         deviceContext.SetRasterState(RasterStateWireframe);
         OnDraw(deviceContext, InstanceBuffer);
     }
 }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="shader"></param>
 /// <returns></returns>
 public bool BindMaterialTextures(DeviceContextProxy context, ShaderPass shader)
 {
     return(MaterialVariables.BindMaterialTextures(context, shader));
 }
Esempio n. 3
0
 /// <summary>
 /// <see cref="RenderCoreBase{TModelStruct}.OnUpdatePerModelStruct(ref TModelStruct, RenderContext)"/>
 /// </summary>
 /// <param name="model"></param>
 /// <param name="context"></param>
 protected override void OnUpdatePerModelStruct(ref ModelStruct model, RenderContext context)
 {
     model.World        = ModelMatrix;// * context.WorldMatrix;
     model.HasInstances = InstanceBuffer == null ? 0 : InstanceBuffer.HasElements ? 1 : 0;
     MaterialVariables.UpdateMaterialVariables(ref model);
 }