alternative view model rendering mode with rescaled weapon
This commit is contained in:
@@ -25,6 +25,11 @@ namespace Game
|
||||
public override int Order => 110;
|
||||
public override bool CanRender => camera.IsActive;
|
||||
|
||||
private bool useMainCamera = true;
|
||||
public bool rescaleModel = true;
|
||||
|
||||
private Actor viewModelHolder;
|
||||
|
||||
private void CreateTextures(int width, int height)
|
||||
{
|
||||
GPUTextureDescription textureDesc = GPUTextureDescription.New2D(width, height, PixelFormat.R8G8B8A8_UNorm);
|
||||
@@ -45,6 +50,20 @@ namespace Game
|
||||
|
||||
public override void OnAwake()
|
||||
{
|
||||
viewModelHolder = Parent.Parent.Parent.Parent.GetChild("ViewModelHolder");
|
||||
if (useMainCamera)
|
||||
{
|
||||
camera.IsActive = false;
|
||||
void foo(Actor actor)
|
||||
{
|
||||
actor.Layer = 0;
|
||||
foreach (Actor actChild in actor.GetChildren<Actor>())
|
||||
foo(actChild);
|
||||
}
|
||||
|
||||
foo(viewModelHolder);
|
||||
}
|
||||
|
||||
if (!camera.IsActive)
|
||||
return;
|
||||
|
||||
@@ -96,6 +115,7 @@ namespace Game
|
||||
Renderer.DrawPostFxMaterial(context, ref renderContext, materialInstance, output, input.View());
|
||||
}
|
||||
|
||||
private bool lastRescale = false;
|
||||
public override void OnUpdate()
|
||||
{
|
||||
#if FLAX_EDITOR
|
||||
@@ -117,6 +137,15 @@ namespace Game
|
||||
sceneTask2.RenderingPercentage = MainRenderTask.Instance.RenderingPercentage * 0.5f;
|
||||
}
|
||||
|
||||
if (useMainCamera && rescaleModel != lastRescale)
|
||||
{
|
||||
lastRescale = rescaleModel;
|
||||
if (rescaleModel)
|
||||
viewModelHolder.Scale = new Vector3(0.75f);
|
||||
else
|
||||
viewModelHolder.Scale = new Vector3(1.0f);
|
||||
}
|
||||
|
||||
if (!camera.IsActive)
|
||||
return;
|
||||
if (texture == null)
|
||||
|
||||
@@ -219,6 +219,8 @@ namespace Game
|
||||
|
||||
globals.SetValue("Scene Lighting", boolValue);
|
||||
|
||||
// TODO: make sure AO is disabled (it's not)
|
||||
|
||||
Light[] lights = Level.GetActors<Light>();
|
||||
foreach (Light light in lights)
|
||||
light.IsActive = boolValue;
|
||||
|
||||
Reference in New Issue
Block a user