Example #1
0
        protected override void InitializeCore()
        {
            base.InitializeCore();

            if (SceneCameraRenderer == null)
            {
                return;
            }

            var forwardMode = SceneCameraRenderer.Mode;
            var effectName  = forwardMode.ModelEffect;

            if (effectName == null)
            {
                throw new InvalidOperationException("ModelEffect cannot be null");
            }

            isPickingRendering = Context.IsPicking();
            if (isPickingRendering)
            {
                effectName += ".Picking";
                Context.Parameters.Set(XenkoEffectBaseKeys.ExtensionPostVertexStageShader, PickingEffect);
            }

            modelRenderer.EffectName = effectName;
            modelRenderer            = ToLoadAndUnload(modelRenderer);

            // Setup the ModelComponentRenderer as the main renderer for the scene Camera Renderer
            // This is used by the LightComponentForwardRenderer
            // TODO: Check if we could discover declared renderers in a better way than just hacking the tags of a component
            ModelComponentRenderer.Attach(SceneCameraRenderer, modelRenderer);
        }
        protected override void InitializeCore()
        {
            base.InitializeCore();

            if (SceneCameraRenderer == null)
            {
                return;
            }

            var forwardMode = SceneCameraRenderer.Mode;
            var effectName =  forwardMode.ModelEffect;
            if (effectName == null)
            {
                throw new InvalidOperationException("ModelEffect cannot be null");
            }

            isPickingRendering = Context.IsPicking();
            if (isPickingRendering)
            {
                effectName += ".Picking";
                Context.Parameters.Set(XenkoEffectBaseKeys.ExtensionPostVertexStageShader, PickingEffect);
            }

            modelRenderer.EffectName = effectName;
            modelRenderer = ToLoadAndUnload(modelRenderer);

            // Setup the ModelComponentRenderer as the main renderer for the scene Camera Renderer
            // This is used by the LightComponentForwardRenderer
            // TODO: Check if we could discover declared renderers in a better way than just hacking the tags of a component
            ModelComponentRenderer.Attach(SceneCameraRenderer, modelRenderer);
        }
Example #3
0
 /// <summary>
 /// Attaches a <see cref="ModelComponentRenderer"/> to the specified component.
 /// </summary>
 /// <param name="component">The component.</param>
 /// <param name="renderer">The renderer.</param>
 /// <exception cref="System.ArgumentNullException">component</exception>
 public static void Attach(ComponentBase component, ModelComponentRenderer renderer)
 {
     if (component == null)
     {
         throw new ArgumentNullException("component");
     }
     component.Tags.Set(Current, renderer);
 }
Example #4
0
 public ModelComponentAndPickingRenderer()
 {
     modelRenderer = new ModelComponentRenderer();
 }
Example #5
0
 /// <summary>
 /// Attaches a <see cref="ModelComponentRenderer"/> to the specified component.
 /// </summary>
 /// <param name="component">The component.</param>
 /// <param name="renderer">The renderer.</param>
 /// <exception cref="System.ArgumentNullException">component</exception>
 public static void Attach(ComponentBase component, ModelComponentRenderer renderer)
 {
     if (component == null) throw new ArgumentNullException("component");
     component.Tags.Set(Current, renderer);
 }
 public ModelComponentAndPickingRenderer()
 {
     modelRenderer = new ModelComponentRenderer();
 }