Fix style nits in Mods.TS.

This commit is contained in:
Paul Chote
2014-12-26 12:01:11 +13:00
parent 44b1647fbe
commit 2012946f06
4 changed files with 10 additions and 11 deletions

View File

@@ -36,8 +36,8 @@ namespace OpenRA.Mods.TS.Traits
public readonly WAngle LightPitch = WAngle.FromDegrees(50);
public readonly WAngle LightYaw = WAngle.FromDegrees(240);
public readonly float[] LightAmbientColor = new float[] {0.6f, 0.6f, 0.6f};
public readonly float[] LightDiffuseColor = new float[] {0.4f, 0.4f, 0.4f};
public readonly float[] LightAmbientColor = new float[] { 0.6f, 0.6f, 0.6f };
public readonly float[] LightDiffuseColor = new float[] { 0.4f, 0.4f, 0.4f };
public virtual object Create(ActorInitializer init) { return new RenderVoxels(init.self, this); }
@@ -59,7 +59,6 @@ namespace OpenRA.Mods.TS.Traits
this.LightYaw, this.LightAmbientColor, this.LightDiffuseColor, body.CameraPitch,
palette, init.WorldRenderer.Palette(NormalsPalette), init.WorldRenderer.Palette("shadow"));
}
}
public class RenderVoxels : IRender, INotifyOwnerChanged
@@ -77,7 +76,7 @@ namespace OpenRA.Mods.TS.Traits
this.info = info;
body = self.Trait<IBodyOrientation>();
camera = new WRot(WAngle.Zero, body.CameraPitch - new WAngle(256), new WAngle(256));
lightSource = new WRot(WAngle.Zero,new WAngle(256) - info.LightPitch, info.LightYaw);
lightSource = new WRot(WAngle.Zero, new WAngle(256) - info.LightPitch, info.LightYaw);
}
bool initializePalettes = true;

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.TS.Traits
var turretOrientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(t.InitialFacing) - orientation.Yaw), facings);
var turretOffset = body.LocalToWorld(t.Offset.Rotate(orientation));
yield return new VoxelAnimation(voxel, () => turretOffset, () => new [] { turretOrientation, orientation },
yield return new VoxelAnimation(voxel, () => turretOffset, () => new[] { turretOrientation, orientation },
() => false, () => 0);
}
}
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.TS.Traits
var turretOrientation = turreted != null ? turreted.LocalOrientation(self) : WRot.Zero;
var quantizedBody = body.QuantizeOrientation(self, self.Orientation);
var quantizedTurret = body.QuantizeOrientation(self, turretOrientation);
var quantizedTurret = body.QuantizeOrientation(self, turretOrientation);
return turretOffset + body.LocalToWorld(localOffset.Rotate(quantizedTurret).Rotate(quantizedBody));
}

View File

@@ -48,12 +48,12 @@ namespace OpenRA.Mods.TS.Traits
var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence);
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
() => new[]{ body.QuantizeOrientation(self, self.Orientation) },
() => new[] { body.QuantizeOrientation(self, self.Orientation) },
() => false, () => 0));
// Selection size
var rvi = self.Info.Traits.Get<RenderVoxelsInfo>();
var s = (int)(rvi.Scale*voxel.Size.Aggregate(Math.Max));
var s = (int)(rvi.Scale * voxel.Size.Aggregate(Math.Max));
size = new int2(s, s);
}

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.TS.Traits
{
// Rotate vectors to expected orientation
// Voxel coordinates are x=forward, y=right, z=up
var channel = new int[] {2,1,0};
var channel = new int[] { 2, 1, 0 };
var n = info.Type == NormalType.RedAlert2 ? RA2Normals : TSNormals;
// Map normals into color range
@@ -48,8 +48,8 @@ namespace OpenRA.Mods.TS.Traits
data[i] = 0xFF000000;
for (var j = 0; j < 3; j++)
{
var t = (n[3*i + j] + 1) / 2;
data[i] |= (uint)((byte)(t*0xFF + 0.5) << (8*channel[j]));
var t = (n[3 * i + j] + 1) / 2;
data[i] |= (uint)((byte)(t * 0xFF + 0.5) << (8 * channel[j]));
}
}