reformat code + level load events
This commit is contained in:
@@ -1,30 +1,34 @@
|
||||
using System;
|
||||
using System.Runtime;
|
||||
using Cabrito;
|
||||
using FlaxEditor.Content.Settings;
|
||||
using FlaxEngine;
|
||||
using Console = Cabrito.Console;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
/// <summary>
|
||||
/// CameraRender Script.
|
||||
/// CameraRender Script.
|
||||
/// </summary>
|
||||
[ExecuteInEditMode]
|
||||
public class CameraRender : PostProcessEffect
|
||||
{
|
||||
public Camera camera;
|
||||
public Material material;
|
||||
|
||||
private GPUTexture texture;
|
||||
private GPUTexture texture2;
|
||||
private bool lastEnabled;
|
||||
public Material material;
|
||||
|
||||
private MaterialInstance materialInstance;
|
||||
private SceneRenderTask sceneTask;
|
||||
private SceneRenderTask sceneTask2;
|
||||
|
||||
private GPUTexture texture;
|
||||
private GPUTexture texture2;
|
||||
|
||||
public override PostProcessEffectLocation Location => PostProcessEffectLocation.Default;
|
||||
public override int Order => 110;
|
||||
public override bool CanRender => camera.IsActive;
|
||||
|
||||
private void CreateTextures(int width, int height)
|
||||
{
|
||||
var textureDesc = GPUTextureDescription.New2D(width, height, PixelFormat.R8G8B8A8_UNorm);
|
||||
GPUTextureDescription textureDesc = GPUTextureDescription.New2D(width, height, PixelFormat.R8G8B8A8_UNorm);
|
||||
|
||||
// Prepare texture and SceneRenderTask for viewmodel camera
|
||||
if (texture == null)
|
||||
@@ -82,11 +86,8 @@ namespace Game
|
||||
Destroy(ref texture2);
|
||||
}
|
||||
|
||||
public override PostProcessEffectLocation Location => PostProcessEffectLocation.Default;
|
||||
public override int Order => 110;
|
||||
public override bool CanRender => camera.IsActive;
|
||||
|
||||
public override void Render(GPUContext context, ref RenderContext renderContext, GPUTexture input, GPUTexture output)
|
||||
public override void Render(GPUContext context, ref RenderContext renderContext, GPUTexture input,
|
||||
GPUTexture output)
|
||||
{
|
||||
if (texture == null || texture2 == null)
|
||||
return;
|
||||
@@ -94,13 +95,12 @@ namespace Game
|
||||
Renderer.DrawPostFxMaterial(context, ref renderContext, materialInstance, output, input.View());
|
||||
}
|
||||
|
||||
private bool lastEnabled;
|
||||
public override void OnUpdate()
|
||||
{
|
||||
#if FLAX_EDITOR
|
||||
if (Input.GetKeyDown(KeyboardKeys.F7))
|
||||
{
|
||||
var physicsSettings = GameSettings.Load<PhysicsSettings>();
|
||||
PhysicsSettings physicsSettings = GameSettings.Load<PhysicsSettings>();
|
||||
physicsSettings.EnableSubstepping = !physicsSettings.EnableSubstepping;
|
||||
GameSettings.Save(physicsSettings);
|
||||
//GameSettings.Apply();
|
||||
@@ -130,4 +130,4 @@ namespace Game
|
||||
//OnAwake();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user