Further lighting optimization, fixed (railgun) controller movement, physicsbody collisioncategory changes, command room reactor controls in Vellamo
This commit is contained in:
@@ -664,7 +664,7 @@ int currentTargetIndex = 1;
|
||||
edgeBody.UserData = cell;
|
||||
edgeBody.SleepingAllowed = false;
|
||||
edgeBody.BodyType = BodyType.Kinematic;
|
||||
edgeBody.CollisionCategories = Physics.CollisionWall | Physics.CollisionLevel;
|
||||
edgeBody.CollisionCategories = Physics.CollisionLevel;
|
||||
|
||||
cell.body = edgeBody;
|
||||
bodies.Add(edgeBody);
|
||||
@@ -674,7 +674,7 @@ int currentTargetIndex = 1;
|
||||
{
|
||||
Body shaftBody = BodyFactory.CreateRectangle(GameMain.World, 100.0f, 10.0f, 5.0f);
|
||||
shaftBody.BodyType = BodyType.Kinematic;
|
||||
shaftBody.CollisionCategories = Physics.CollisionWall | Physics.CollisionLevel;
|
||||
shaftBody.CollisionCategories = Physics.CollisionLevel;
|
||||
shaftBody.SetTransform(ConvertUnits.ToSimUnits((i==0) ? startPosition : endPosition), 0.0f);
|
||||
shaftBody.SleepingAllowed = false;
|
||||
bodies.Add(shaftBody);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Subsurface.Lights
|
||||
public Color AmbientLight;
|
||||
|
||||
RenderTarget2D lightMap;
|
||||
|
||||
|
||||
private static Texture2D alphaClearTexture;
|
||||
|
||||
private List<LightSource> lights;
|
||||
@@ -21,10 +21,10 @@ namespace Subsurface.Lights
|
||||
|
||||
public bool LightingEnabled = true;
|
||||
|
||||
public RenderTarget2D LightMap
|
||||
{
|
||||
get { return lightMap; }
|
||||
}
|
||||
//public RenderTarget2D LightMap
|
||||
//{
|
||||
// get { return lightMap; }
|
||||
//}
|
||||
|
||||
public LightManager(GraphicsDevice graphics)
|
||||
{
|
||||
@@ -34,7 +34,8 @@ namespace Subsurface.Lights
|
||||
|
||||
var pp = graphics.PresentationParameters;
|
||||
|
||||
lightMap = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight, false,
|
||||
lightMap = new RenderTarget2D(graphics,
|
||||
GameMain.GraphicsWidth, GameMain.GraphicsHeight, false,
|
||||
pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
|
||||
RenderTargetUsage.DiscardContents);
|
||||
|
||||
@@ -81,8 +82,10 @@ namespace Subsurface.Lights
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawLightmap(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam)
|
||||
public void UpdateLightMap(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
if (!LightingEnabled) return;
|
||||
|
||||
Matrix shadowTransform = cam.ShaderTransform
|
||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||
|
||||
@@ -96,7 +99,7 @@ namespace Subsurface.Lights
|
||||
|
||||
foreach (LightSource light in lights)
|
||||
{
|
||||
if (light.Color.A < 0.01f || light.Range < 0.01f || light.hullsInRange.Count == 0) continue;
|
||||
if (light.hullsInRange.Count == 0 || light.Color.A < 0.01f || light.Range < 1.0f) continue;
|
||||
if (!MathUtils.CircleIntersectsRectangle(light.Position, light.Range, viewRect)) continue;
|
||||
|
||||
//clear alpha to 1
|
||||
@@ -126,7 +129,7 @@ namespace Subsurface.Lights
|
||||
|
||||
//foreach (LightSource light in lights)
|
||||
//{
|
||||
// if (light.Color.A < 0.01f || light.Range < 0.01f || light.hullsInRange.Count > 0) continue;
|
||||
// if (light.hullsInRange.Count > 0 || light.Color.A < 0.01f || light.Range < 1.0f) continue;
|
||||
// if (!MathUtils.CircleIntersectsRectangle(light.Position, light.Range, viewRect)) continue;
|
||||
|
||||
// light.Draw(spriteBatch);
|
||||
@@ -145,6 +148,16 @@ namespace Subsurface.Lights
|
||||
spriteBatch.Draw(alphaClearTexture, new Rectangle(0, 0,graphics.Viewport.Width, graphics.Viewport.Height), Color.White);
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
public void DrawLightMap(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
if (!LightingEnabled) return;
|
||||
|
||||
//multiply scene with lightmap
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, CustomBlendStates.Multiplicative);
|
||||
spriteBatch.Draw(lightMap, Vector2.Zero, Color.White);
|
||||
spriteBatch.End();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Subsurface.Lights
|
||||
public void UpdateHullsInRange()
|
||||
{
|
||||
hullsInRange.Clear();
|
||||
if (range < 1.0f) return;
|
||||
if (range < 1.0f || color.A < 0.01f) return;
|
||||
|
||||
foreach (ConvexHull ch in ConvexHull.list)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user