Fix style nits in Mods.TS.
This commit is contained in:
@@ -36,8 +36,8 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
|
|
||||||
public readonly WAngle LightPitch = WAngle.FromDegrees(50);
|
public readonly WAngle LightPitch = WAngle.FromDegrees(50);
|
||||||
public readonly WAngle LightYaw = WAngle.FromDegrees(240);
|
public readonly WAngle LightYaw = WAngle.FromDegrees(240);
|
||||||
public readonly float[] LightAmbientColor = new float[] {0.6f, 0.6f, 0.6f};
|
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[] LightDiffuseColor = new float[] { 0.4f, 0.4f, 0.4f };
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new RenderVoxels(init.self, this); }
|
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,
|
this.LightYaw, this.LightAmbientColor, this.LightDiffuseColor, body.CameraPitch,
|
||||||
palette, init.WorldRenderer.Palette(NormalsPalette), init.WorldRenderer.Palette("shadow"));
|
palette, init.WorldRenderer.Palette(NormalsPalette), init.WorldRenderer.Palette("shadow"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RenderVoxels : IRender, INotifyOwnerChanged
|
public class RenderVoxels : IRender, INotifyOwnerChanged
|
||||||
@@ -77,7 +76,7 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
body = self.Trait<IBodyOrientation>();
|
body = self.Trait<IBodyOrientation>();
|
||||||
camera = new WRot(WAngle.Zero, body.CameraPitch - new WAngle(256), new WAngle(256));
|
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;
|
bool initializePalettes = true;
|
||||||
|
|||||||
@@ -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 turretOrientation = body.QuantizeOrientation(new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(t.InitialFacing) - orientation.Yaw), facings);
|
||||||
var turretOffset = body.LocalToWorld(t.Offset.Rotate(orientation));
|
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);
|
() => false, () => 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
var turretOrientation = turreted != null ? turreted.LocalOrientation(self) : WRot.Zero;
|
var turretOrientation = turreted != null ? turreted.LocalOrientation(self) : WRot.Zero;
|
||||||
|
|
||||||
var quantizedBody = body.QuantizeOrientation(self, self.Orientation);
|
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));
|
return turretOffset + body.LocalToWorld(localOffset.Rotate(quantizedTurret).Rotate(quantizedBody));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
|
|
||||||
var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence);
|
var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence);
|
||||||
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
|
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
|
||||||
() => new[]{ body.QuantizeOrientation(self, self.Orientation) },
|
() => new[] { body.QuantizeOrientation(self, self.Orientation) },
|
||||||
() => false, () => 0));
|
() => false, () => 0));
|
||||||
|
|
||||||
// Selection size
|
// Selection size
|
||||||
var rvi = self.Info.Traits.Get<RenderVoxelsInfo>();
|
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);
|
size = new int2(s, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
{
|
{
|
||||||
// Rotate vectors to expected orientation
|
// Rotate vectors to expected orientation
|
||||||
// Voxel coordinates are x=forward, y=right, z=up
|
// 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;
|
var n = info.Type == NormalType.RedAlert2 ? RA2Normals : TSNormals;
|
||||||
|
|
||||||
// Map normals into color range
|
// Map normals into color range
|
||||||
@@ -48,8 +48,8 @@ namespace OpenRA.Mods.TS.Traits
|
|||||||
data[i] = 0xFF000000;
|
data[i] = 0xFF000000;
|
||||||
for (var j = 0; j < 3; j++)
|
for (var j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
var t = (n[3*i + j] + 1) / 2;
|
var t = (n[3 * i + j] + 1) / 2;
|
||||||
data[i] |= (uint)((byte)(t*0xFF + 0.5) << (8*channel[j]));
|
data[i] |= (uint)((byte)(t * 0xFF + 0.5) << (8 * channel[j]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user