1 using System.Collections.Generic;
6 using Microsoft.Xna.Framework;
7 using Microsoft.Xna.Framework.Graphics;
11 namespace Loot.Api.Graphics
19 public List<ShaderEntity> ShaderEntities {
get;
internal set; } =
new List<ShaderEntity>();
20 public List<GlowmaskEntity> GlowmaskEntities {
get;
internal set; } =
new List<GlowmaskEntity>();
22 public override bool InstancePerEntity =>
true;
23 public override bool CloneNewInstances =>
true;
27 public bool HasShaders => ShaderEntities.Count(x => x != null) > 0;
28 public bool HasGlowmasks => GlowmaskEntities.Count(x => x != null) > 0;
33 info.
ShaderEntities = modifiers.Select(mod => mod.GetShaderEntity(item)).OrderBy(mod => mod?.Order ?? 0).ToList();
34 info.GlowmaskEntities = modifiers.Select(mod => mod.GetGlowmaskEntity(item)).OrderBy(mod => mod?.Order ?? 0).ToList();
35 var clone = item.Clone();
36 info.ShaderEntities.ForEach(mod => mod?.SetIdentity(clone));
37 info.GlowmaskEntities.ForEach(mod => mod?.SetIdentity(clone));
52 ShaderEntities.ForEach(entity => entity?.SetIdentity(item));
53 GlowmaskEntities.ForEach(entity => entity?.SetIdentity(item));
56 public override bool PreDrawInWorld(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref
float rotation, ref
float scale,
int whoAmI)
61 for (
int i = 0; i < ShaderEntities.Count; i++)
67 entity.
DoDrawLayeredEntity(spriteBatch, lightColor, alphaColor, scale, rotation, GlowmaskEntities[i]);
74 public override void PostDrawInWorld(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor,
float rotation,
float scale,
int whoAmI)
76 if (HasShaders)
return;
78 foreach (var entity
in GlowmaskEntities)
82 entity.DoDrawGlowmask(spriteBatch, lightColor, alphaColor, rotation, scale, whoAmI);
83 entity.DoDrawHitbox(spriteBatch);
static void UpdateGraphicsEntities(List< Modifier > modifiers, Item item)
override void UpdateEquip(Item item, Player player)
This class is responsible for handling ShaderEntity and GlowmaskEntity that come from the Modifiers o...
Defines a Shader entity, part of GraphicsEntity<T> The entity defines a particular 'shader' "of" the ...
void UpdateIdentity(Item item)
override void UpdateInventory(Item item, Player player)
override void PostDrawInWorld(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
List< ShaderEntity > ShaderEntities
override bool PreDrawInWorld(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
void DoDrawLayeredEntity(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float scale, float rotation, GlowmaskEntity glowmaskEntity=null, Texture2D suppliedShaderTexture=null, Texture2D suppliedSubjectTexture=null, Texture2D suppliedGlowmaskTexture=null)
Will draw all the layers (subject, glowmask, shader) in the proper order