コード例 #1
0
ファイル: RenderVoxels.cs プロジェクト: hadow/Commander
        public virtual IEnumerable <IActorPreview> RenderPreview(ActorPreviewInitializer init)
        {
            var body             = init.Actor.TraitInfo <BodyOrientationInfo>();
            var faction          = init.Get <FactionInit, string>();
            var ownerName        = init.Get <OwnerInit>().PlayerName;
            var sequenceProvider = init.World.Map.Rules.Sequences;
            var image            = Image ?? init.Actor.Name;
            var facings          = body.QuantizedFacings == -1 ? init.Actor.TraitInfo <IQuantizeBodyOrientationInfo>().QuantizedBodyFacings(init.Actor, sequenceProvider, faction) :
                                   body.QuantizedFacings;

            var palette = init.WorldRenderer.Palette(Palette ?? PlayerPalette + ownerName);

            var components = init.Actor.TraitInfos <IRenderActorPreviewVoxelsInfo>().SelectMany(rvpi => rvpi.RenderPreviewVoxels(init, this, image, init.GetOrientation(), facings, palette)).ToArray();

            yield return(new ModelPreview(components, WVec.Zero, 0, Scale, LightPitch, LightYaw, LightAmbientColor, LightDiffuseColor, body.CameraPitch, palette, init.WorldRenderer.Palette(NormalsPalette), init.WorldRenderer.Palette(ShadowPalette)));
        }