alternative view model rendering mode with rescaled weapon
This commit is contained in:
@@ -107,7 +107,6 @@
|
||||
"ID": "56eddcef4698702bd3cb0b8a1fb3396f",
|
||||
"TypeName": "FlaxEngine.EmptyActor",
|
||||
"ParentID": "a50f3639419a8306036ecfab7115e772",
|
||||
"IsActive": false,
|
||||
"Name": "ViewModelHolder",
|
||||
"Transform": {
|
||||
"Translation": {
|
||||
@@ -128,17 +127,17 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "9ef0c1b8412a19d04d298c840ca4f456",
|
||||
"ID": "99f2289f4f483aba1fcabdba40a2c899",
|
||||
"PrefabID": "7f0707924e86984317e6a78b55e68245",
|
||||
"PrefabObjectID": "056a93524632b9e0d83c6fbcbd020680",
|
||||
"ParentID": "56eddcef4698702bd3cb0b8a1fb3396f",
|
||||
"StaticFlags": 0
|
||||
},
|
||||
{
|
||||
"ID": "743289494a7bd68f6a28df86ea7a04c8",
|
||||
"ID": "234dca27419c27d758db29953fd9f992",
|
||||
"PrefabID": "7f0707924e86984317e6a78b55e68245",
|
||||
"PrefabObjectID": "bb8115cf4fd8d0906b1e928a171763c5",
|
||||
"ParentID": "9ef0c1b8412a19d04d298c840ca4f456",
|
||||
"ParentID": "99f2289f4f483aba1fcabdba40a2c899",
|
||||
"Buffer": {
|
||||
"Entries": [
|
||||
{}
|
||||
@@ -146,10 +145,10 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "002d17944803ee2ca1f3cd88bc76b68e",
|
||||
"ID": "35b52ef2410d20988207d59d3b9c4a1c",
|
||||
"PrefabID": "7f0707924e86984317e6a78b55e68245",
|
||||
"PrefabObjectID": "a54aa52147b86b56df27fdaa9ba7ca52",
|
||||
"ParentID": "9ef0c1b8412a19d04d298c840ca4f456",
|
||||
"ParentID": "234dca27419c27d758db29953fd9f992",
|
||||
"Buffer": {
|
||||
"Entries": [
|
||||
{}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"Translation": {
|
||||
"X": 7.394218921661377,
|
||||
"Y": -11.22248649597168,
|
||||
"Z": -3.27702260017395
|
||||
"Z": -3.2770228385925295
|
||||
},
|
||||
"Orientation": {
|
||||
"X": 0.6691311001777649,
|
||||
@@ -27,7 +27,7 @@
|
||||
},
|
||||
"Scale": {
|
||||
"X": 0.07999999821186066,
|
||||
"Y": 0.431741327047348,
|
||||
"Y": 0.43174129724502566,
|
||||
"Z": 0.07999999821186066
|
||||
}
|
||||
},
|
||||
@@ -48,24 +48,18 @@
|
||||
{
|
||||
"ID": "a54aa52147b86b56df27fdaa9ba7ca52",
|
||||
"TypeName": "FlaxEngine.StaticModel",
|
||||
"ParentID": "056a93524632b9e0d83c6fbcbd020680",
|
||||
"ParentID": "bb8115cf4fd8d0906b1e928a171763c5",
|
||||
"Name": "Cylinder2",
|
||||
"Transform": {
|
||||
"Translation": {
|
||||
"X": 7.35720682144165,
|
||||
"Y": -9.197076797485352,
|
||||
"Z": 15.981095314025879
|
||||
},
|
||||
"Orientation": {
|
||||
"X": 0.6691311001777649,
|
||||
"Y": 0.0,
|
||||
"Z": 0.0,
|
||||
"W": 0.7431443929672241
|
||||
"X": -0.46265125274658205,
|
||||
"Y": 44.85169982910156,
|
||||
"Z": -0.016492605209350587
|
||||
},
|
||||
"Scale": {
|
||||
"X": 0.09000000357627869,
|
||||
"Y": 0.05855093151330948,
|
||||
"Z": 0.09000000357627869
|
||||
"X": 1.125,
|
||||
"Y": 0.1356157809495926,
|
||||
"Z": 1.125
|
||||
}
|
||||
},
|
||||
"StaticFlags": 0,
|
||||
|
||||
@@ -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