Option to display lighting in sub editor
This commit is contained in:
@@ -286,7 +286,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
ServerListScreen = new ServerListScreen();
|
ServerListScreen = new ServerListScreen();
|
||||||
|
|
||||||
SubEditorScreen = new SubEditorScreen();
|
SubEditorScreen = new SubEditorScreen(Content);
|
||||||
CharacterEditorScreen = new CharacterEditorScreen();
|
CharacterEditorScreen = new CharacterEditorScreen();
|
||||||
ParticleEditorScreen = new ParticleEditorScreen();
|
ParticleEditorScreen = new ParticleEditorScreen();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Barotrauma.Items.Components;
|
using Barotrauma.Items.Components;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -13,6 +14,9 @@ namespace Barotrauma
|
|||||||
class SubEditorScreen : Screen
|
class SubEditorScreen : Screen
|
||||||
{
|
{
|
||||||
private Camera cam;
|
private Camera cam;
|
||||||
|
private BlurEffect lightBlur;
|
||||||
|
|
||||||
|
private bool lightingEnabled;
|
||||||
|
|
||||||
public GUIComponent topPanel, leftPanel;
|
public GUIComponent topPanel, leftPanel;
|
||||||
|
|
||||||
@@ -117,10 +121,15 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SubEditorScreen()
|
public SubEditorScreen(ContentManager content)
|
||||||
{
|
{
|
||||||
cam = new Camera();
|
cam = new Camera();
|
||||||
//cam.Translate(new Vector2(-10.0f, 50.0f));
|
#if LINUX
|
||||||
|
var blurEffect = content.Load<Effect>("blurshader_opengl");
|
||||||
|
#else
|
||||||
|
var blurEffect = content.Load<Effect>("blurshader");
|
||||||
|
#endif
|
||||||
|
lightBlur = new BlurEffect(blurEffect, 0.001f, 0.001f);
|
||||||
|
|
||||||
selectedTab = -1;
|
selectedTab = -1;
|
||||||
|
|
||||||
@@ -258,24 +267,26 @@ namespace Barotrauma
|
|||||||
y += 30;
|
y += 30;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 0, 20), TextManager.Get("ShowEntitiesLabel"), "", leftPanel);
|
new GUITextBlock(new Rectangle(0, y, 0, 20), TextManager.Get("ShowEntitiesLabel"), "", leftPanel);
|
||||||
|
|
||||||
var tickBox = new GUITickBox(new Rectangle(0,y+20,20,20), TextManager.Get("ShowWaypoints"), Alignment.TopLeft, leftPanel);
|
var tickBox = new GUITickBox(new Rectangle(0, y + 20, 20, 20), TextManager.Get("ShowLighting"), Alignment.TopLeft, leftPanel);
|
||||||
|
tickBox.OnSelected = (GUITickBox obj) => { lightingEnabled = !lightingEnabled; return true; };
|
||||||
|
tickBox = new GUITickBox(new Rectangle(0, y + 45, 20, 20), TextManager.Get("ShowWaypoints"), Alignment.TopLeft, leftPanel);
|
||||||
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = !WayPoint.ShowWayPoints; return true; };
|
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = !WayPoint.ShowWayPoints; return true; };
|
||||||
tickBox.Selected = true;
|
tickBox.Selected = true;
|
||||||
tickBox = new GUITickBox(new Rectangle(0, y + 45, 20, 20), TextManager.Get("ShowSpawnpoints"), Alignment.TopLeft, leftPanel);
|
tickBox = new GUITickBox(new Rectangle(0, y + 70, 20, 20), TextManager.Get("ShowSpawnpoints"), Alignment.TopLeft, leftPanel);
|
||||||
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowSpawnPoints = !WayPoint.ShowSpawnPoints; return true; };
|
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowSpawnPoints = !WayPoint.ShowSpawnPoints; return true; };
|
||||||
tickBox.Selected = true;
|
tickBox.Selected = true;
|
||||||
tickBox = new GUITickBox(new Rectangle(0, y + 70, 20, 20), TextManager.Get("ShowLinks"), Alignment.TopLeft, leftPanel);
|
tickBox = new GUITickBox(new Rectangle(0, y + 95, 20, 20), TextManager.Get("ShowLinks"), Alignment.TopLeft, leftPanel);
|
||||||
tickBox.OnSelected = (GUITickBox obj) => { Item.ShowLinks = !Item.ShowLinks; return true; };
|
tickBox.OnSelected = (GUITickBox obj) => { Item.ShowLinks = !Item.ShowLinks; return true; };
|
||||||
tickBox.Selected = true;
|
tickBox.Selected = true;
|
||||||
tickBox = new GUITickBox(new Rectangle(0, y + 95, 20, 20), TextManager.Get("ShowHulls"), Alignment.TopLeft, leftPanel);
|
tickBox = new GUITickBox(new Rectangle(0, y + 120, 20, 20), TextManager.Get("ShowHulls"), Alignment.TopLeft, leftPanel);
|
||||||
tickBox.OnSelected = (GUITickBox obj) => { Hull.ShowHulls = !Hull.ShowHulls; return true; };
|
tickBox.OnSelected = (GUITickBox obj) => { Hull.ShowHulls = !Hull.ShowHulls; return true; };
|
||||||
tickBox.Selected = true;
|
tickBox.Selected = true;
|
||||||
tickBox = new GUITickBox(new Rectangle(0, y + 120, 20, 20), TextManager.Get("ShowGaps"), Alignment.TopLeft, leftPanel);
|
tickBox = new GUITickBox(new Rectangle(0, y + 145, 20, 20), TextManager.Get("ShowGaps"), Alignment.TopLeft, leftPanel);
|
||||||
tickBox.OnSelected = (GUITickBox obj) => { Gap.ShowGaps = !Gap.ShowGaps; return true; };
|
tickBox.OnSelected = (GUITickBox obj) => { Gap.ShowGaps = !Gap.ShowGaps; return true; };
|
||||||
tickBox.Selected = true;
|
tickBox.Selected = true;
|
||||||
|
|
||||||
y+=150;
|
y += 170;
|
||||||
|
|
||||||
if (y < GameMain.GraphicsHeight - 100)
|
if (y < GameMain.GraphicsHeight - 100)
|
||||||
{
|
{
|
||||||
@@ -1382,6 +1393,10 @@ namespace Barotrauma
|
|||||||
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
cam.UpdateTransform();
|
cam.UpdateTransform();
|
||||||
|
if (lightingEnabled)
|
||||||
|
{
|
||||||
|
GameMain.LightManager.UpdateLightMap(graphics, spriteBatch, cam, lightBlur.Effect);
|
||||||
|
}
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||||
BlendState.AlphaBlend,
|
BlendState.AlphaBlend,
|
||||||
@@ -1400,13 +1415,17 @@ namespace Barotrauma
|
|||||||
if (!characterMode && !wiringMode)
|
if (!characterMode && !wiringMode)
|
||||||
{
|
{
|
||||||
if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.DrawPlacing(spriteBatch,cam);
|
if (MapEntityPrefab.Selected != null) MapEntityPrefab.Selected.DrawPlacing(spriteBatch,cam);
|
||||||
|
|
||||||
MapEntity.DrawSelecting(spriteBatch, cam);
|
MapEntity.DrawSelecting(spriteBatch, cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
|
if (GameMain.LightManager.LightingEnabled && lightingEnabled)
|
||||||
|
{
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, Lights.CustomBlendStates.Multiplicative, null, DepthStencilState.None, null, null, null);
|
||||||
|
spriteBatch.Draw(GameMain.LightManager.lightMap, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||||
|
spriteBatch.End();
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------- HUD -----------------------------
|
//-------------------- HUD -----------------------------
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable);
|
spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable);
|
||||||
|
|||||||
@@ -219,6 +219,7 @@
|
|||||||
<GenerateWaypointsButton>Generate waypoints</GenerateWaypointsButton>
|
<GenerateWaypointsButton>Generate waypoints</GenerateWaypointsButton>
|
||||||
<GenerateWaypointsToolTip>AI controlled crew members require waypoints to navigate around the sub.</GenerateWaypointsToolTip>
|
<GenerateWaypointsToolTip>AI controlled crew members require waypoints to navigate around the sub.</GenerateWaypointsToolTip>
|
||||||
<ShowEntitiesLabel>Show</ShowEntitiesLabel>
|
<ShowEntitiesLabel>Show</ShowEntitiesLabel>
|
||||||
|
<ShowLighting>Lighting</ShowLighting>
|
||||||
<ShowWaypoints>Waypoints</ShowWaypoints>
|
<ShowWaypoints>Waypoints</ShowWaypoints>
|
||||||
<ShowSpawnpoints>Spawnpoints</ShowSpawnpoints>
|
<ShowSpawnpoints>Spawnpoints</ShowSpawnpoints>
|
||||||
<ShowLinks>Links</ShowLinks>
|
<ShowLinks>Links</ShowLinks>
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ namespace Barotrauma.Items.Components
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
range = MathHelper.Clamp(value, 0.0f, 2048.0f);
|
range = MathHelper.Clamp(value, 0.0f, 2048.0f);
|
||||||
|
#if CLIENT
|
||||||
|
if (light != null) light.Range = range;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +75,13 @@ namespace Barotrauma.Items.Components
|
|||||||
public Color LightColor
|
public Color LightColor
|
||||||
{
|
{
|
||||||
get { return lightColor; }
|
get { return lightColor; }
|
||||||
set { lightColor = value; }
|
set
|
||||||
|
{
|
||||||
|
lightColor = value;
|
||||||
|
#if CLIENT
|
||||||
|
if (light != null) light.Color = lightColor;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Move(Vector2 amount)
|
public override void Move(Vector2 amount)
|
||||||
|
|||||||
Reference in New Issue
Block a user