Пример #1
0
 protected void createEffectHeatVision()
 {
     /// Heat vision effect
     CompositorPtr comp4 = new CompositorPtr(ResourcePtr.getCPtr(CompositorManager.Instance.GetAsResourceManager().Create(
                                                                     "Heat Vision", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)).Handle, false);
     CompositionTechnique t = comp4.Get().createTechnique();
     {
         CTTextureDefinition def = t.CreateTextureDefinition("scene");
         def.setWidth(256);
         def.setHeight(256);
         def.setFormat(OgreDotNet.PixelFormat.PF_R8G8B8);
     }
     {
         CTTextureDefinition def = t.CreateTextureDefinition("temp");
         def.setWidth(256);
         def.setHeight(256);
         def.setFormat(OgreDotNet.PixelFormat.PF_R8G8B8);
     }
     /// Render scene
     {
         CompositionTargetPass tp = t.createTargetPass();
         tp.setInputMode(CompositionTargetPass.InputMode.IM_PREVIOUS);
         tp.SetOutputName("scene");
     }
     /// Light to heat pass
     {
         CompositionTargetPass tp = t.createTargetPass();
         tp.setInputMode(CompositionTargetPass.InputMode.IM_NONE);
         tp.SetOutputName("temp");
         {
             CompositionPass pass = tp.createPass();
             pass.setType(CompositionPass.PassType.PT_RENDERQUAD);
             pass.setIdentifier(0xDEADBABE);                               /// Identify pass for use in listener
             pass.setMaterialName("Fury/HeatVision/LightToHeat");
             pass.setInput(0, "scene");
         }
     }
     /// Display result
     {
         CompositionTargetPass tp = t.getOutputTargetPass();
         tp.setInputMode(CompositionTargetPass.InputMode.IM_NONE);
         {
             CompositionPass pass = tp.createPass();
             pass.setType(CompositionPass.PassType.PT_RENDERQUAD);
             pass.setMaterialName("Fury/HeatVision/Blur");
             pass.setInput(0, "temp");
         }
     }
 }
Пример #2
0
 protected void createEffectMotionBlur()
 {
     /// Motion blur effect
     CompositorPtr comp3 = new CompositorPtr(ResourcePtr.getCPtr(CompositorManager.Instance.GetAsResourceManager().Create(
                                                                     "Motion Blur", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME)).Handle, false);
     CompositionTechnique t = comp3.Get().createTechnique();
     {
         CTTextureDefinition def = t.CreateTextureDefinition("scene");
         def.setWidth(0);
         def.setHeight(0);
         def.setFormat(PixelFormat.PF_R8G8B8);
     }
     {
         CTTextureDefinition def = t.CreateTextureDefinition("sum");
         def.setWidth(0);
         def.setHeight(0);
         def.setFormat(PixelFormat.PF_R8G8B8);
     }
     {
         CTTextureDefinition def = t.CreateTextureDefinition("temp");
         def.setWidth(0);
         def.setHeight(0);
         def.setFormat(PixelFormat.PF_R8G8B8);
     }
     /// Render scene
     {
         CompositionTargetPass tp = t.createTargetPass();
         tp.setInputMode(CompositionTargetPass.InputMode.IM_PREVIOUS);
         tp.SetOutputName("scene");
     }
     /// Initialisation pass for sum texture
     {
         CompositionTargetPass tp = t.createTargetPass();
         tp.setInputMode(CompositionTargetPass.InputMode.IM_PREVIOUS);
         tp.SetOutputName("sum");
         tp.setOnlyInitial(true);
     }
     /// Do the motion blur
     {
         CompositionTargetPass tp = t.createTargetPass();
         tp.setInputMode(CompositionTargetPass.InputMode.IM_NONE);
         tp.SetOutputName("temp");
         {
             CompositionPass pass = tp.createPass();
             pass.setType(CompositionPass.PassType.PT_RENDERQUAD);
             pass.setMaterialName("Ogre/Compositor/Combine");
             pass.setInput(0, "scene");
             pass.setInput(1, "sum");
         }
     }
     /// Copy back sum texture
     {
         CompositionTargetPass tp = t.createTargetPass();
         tp.setInputMode(CompositionTargetPass.InputMode.IM_NONE);
         tp.SetOutputName("sum");
         {
             CompositionPass pass = tp.createPass();
             pass.setType(CompositionPass.PassType.PT_RENDERQUAD);
             pass.setMaterialName("Ogre/Compositor/Copyback");
             pass.setInput(0, "temp");
         }
     }
     /// Display result
     {
         CompositionTargetPass tp = t.getOutputTargetPass();
         tp.setInputMode(CompositionTargetPass.InputMode.IM_NONE);
         {
             CompositionPass pass = tp.createPass();
             pass.setType(CompositionPass.PassType.PT_RENDERQUAD);
             pass.setMaterialName("Ogre/Compositor/MotionBlur");
             pass.setInput(0, "sum");
         }
     }
 }