Rename VoxelAnimation to ModelAnimation.

This commit is contained in:
Paul Chote
2017-06-09 00:32:48 +01:00
committed by reaperrr
parent e1cd00c1dd
commit 4f42778d26
12 changed files with 40 additions and 37 deletions

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Graphics
{
public class VoxelPreview : IActorPreview
{
readonly VoxelAnimation[] components;
readonly ModelAnimation[] components;
readonly float scale;
readonly float[] lightAmbientColor;
readonly float[] lightDiffuseColor;
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Graphics
readonly WVec offset;
readonly int zOffset;
public VoxelPreview(VoxelAnimation[] components, WVec offset, int zOffset, float scale, WAngle lightPitch, WAngle lightYaw,
public VoxelPreview(ModelAnimation[] components, WVec offset, int zOffset, float scale, WAngle lightPitch, WAngle lightYaw,
float[] lightAmbientColor, float[] lightDiffuseColor, WAngle cameraPitch,
PaletteReference colorPalette, PaletteReference normalsPalette, PaletteReference shadowPalette)
{

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Graphics
{
public struct VoxelRenderable : IRenderable
{
readonly IEnumerable<VoxelAnimation> voxels;
readonly IEnumerable<ModelAnimation> voxels;
readonly WPos pos;
readonly int zOffset;
readonly WRot camera;
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Graphics
readonly float scale;
public VoxelRenderable(
IEnumerable<VoxelAnimation> voxels, WPos pos, int zOffset, WRot camera, float scale,
IEnumerable<ModelAnimation> voxels, WPos pos, int zOffset, WRot camera, float scale,
WRot lightSource, float[] lightAmbientColor, float[] lightDiffuseColor,
PaletteReference color, PaletteReference normals, PaletteReference shadow)
{
@@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Graphics
foreach (var v in draw)
{
var bounds = v.Voxel.Bounds(v.FrameFunc());
var bounds = v.Model.Bounds(v.FrameFunc());
var worldTransform = v.RotationFunc().Reverse().Aggregate(scaleTransform,
(x, y) => OpenRA.Graphics.Util.MatrixMultiply(x, OpenRA.Graphics.Util.MakeFloatMatrix(y.AsMatrix())));
@@ -216,7 +216,7 @@ namespace OpenRA.Mods.Common.Graphics
foreach (var v in draw)
{
var bounds = v.Voxel.Bounds(v.FrameFunc());
var bounds = v.Model.Bounds(v.FrameFunc());
var worldTransform = v.RotationFunc().Reverse().Aggregate(scaleTransform,
(x, y) => OpenRA.Graphics.Util.MatrixMultiply(x, OpenRA.Graphics.Util.MakeFloatMatrix(y.AsMatrix())));

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits.Render
{
public interface IRenderActorPreviewVoxelsInfo : ITraitInfo
{
IEnumerable<VoxelAnimation> RenderPreviewVoxels(
IEnumerable<ModelAnimation> RenderPreviewVoxels(
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p);
}
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public class RenderVoxels : IRender, INotifyOwnerChanged
{
readonly List<VoxelAnimation> components = new List<VoxelAnimation>();
readonly List<ModelAnimation> components = new List<ModelAnimation>();
readonly Actor self;
readonly RenderVoxelsInfo info;
readonly BodyOrientation body;
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Traits.Render
}
public string Image { get { return info.Image ?? self.Info.Name; } }
public void Add(VoxelAnimation v) { components.Add(v); }
public void Remove(VoxelAnimation v) { components.Remove(v); }
public void Add(ModelAnimation v) { components.Add(v); }
public void Remove(ModelAnimation v) { components.Remove(v); }
}
}

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public override object Create(ActorInitializer init) { return new WithVoxelBarrel(init.Self, this); }
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
{
if (!EnabledByDefault)
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits.Render
Func<WRot> quantizedBody = () => body.QuantizeOrientation(orientation(), facings);
Func<WVec> barrelOffset = () => body.LocalToWorld((t.Offset + LocalOffset.Rotate(quantizedTurret())).Rotate(quantizedBody()));
yield return new VoxelAnimation(voxel, barrelOffset, () => new[] { turretOrientation(), orientation() },
yield return new ModelAnimation(voxel, barrelOffset, () => new[] { turretOrientation(), orientation() },
() => false, () => 0, ShowShadow);
}
}
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits.Render
buildComplete = !self.Info.HasTraitInfo<BuildingInfo>(); // always render instantly for units
var rv = self.Trait<RenderVoxels>();
rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, Info.Sequence),
rv.Add(new ModelAnimation(VoxelProvider.GetVoxel(rv.Image, Info.Sequence),
BarrelOffset, BarrelRotation,
() => IsTraitDisabled || !buildComplete, () => 0, info.ShowShadow));
}

View File

@@ -28,12 +28,12 @@ namespace OpenRA.Mods.Common.Traits.Render
public override object Create(ActorInitializer init) { return new WithVoxelBody(init.Self, this); }
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
{
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
var voxel = VoxelProvider.GetVoxel(image, Sequence);
yield return new VoxelAnimation(voxel, () => WVec.Zero,
yield return new ModelAnimation(voxel, () => WVec.Zero,
() => new[] { body.QuantizeOrientation(orientation(), facings) },
() => false, () => 0, ShowShadow);
}
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits.Render
var rv = self.Trait<RenderVoxels>();
var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence);
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
rv.Add(new ModelAnimation(voxel, () => WVec.Zero,
() => new[] { body.QuantizeOrientation(self, self.Orientation) },
() => IsTraitDisabled, () => 0, info.ShowShadow));

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public override object Create(ActorInitializer init) { return new WithVoxelTurret(init.Self, this); }
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
{
if (!EnabledByDefault)
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits.Render
var turretFacing = Turreted.TurretFacingFromInit(init, t.InitialFacing, Turret);
Func<WRot> turretBodyOrientation = () => WRot.FromYaw(WAngle.FromFacing(turretFacing()) - orientation().Yaw);
yield return new VoxelAnimation(voxel, turretOffset,
yield return new ModelAnimation(voxel, turretOffset,
() => new[] { turretBodyOrientation(), body.QuantizeOrientation(orientation(), facings) }, () => false, () => 0, ShowShadow);
}
}
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits.Render
buildComplete = !self.Info.HasTraitInfo<BuildingInfo>(); // always render instantly for units
var rv = self.Trait<RenderVoxels>();
rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, Info.Sequence),
rv.Add(new ModelAnimation(VoxelProvider.GetVoxel(rv.Image, Info.Sequence),
() => turreted.Position(self), TurretRotation,
() => IsTraitDisabled || !buildComplete, () => 0, info.ShowShadow));
}