Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HairShaderDataSet.cs
Go to the documentation of this file.
1using System;
5
7
8public class HairShaderDataSet
9{
11
13
14 protected byte _shaderDataCount;
15
16 public T BindShader<T>(int itemId, T shaderData) where T : HairShaderData
17 {
18 if (_shaderDataCount == byte.MaxValue)
19 {
20 throw new Exception("Too many shaders bound.");
21 }
24 return shaderData;
25 }
26
27 public void Apply(short shaderId, Player player, DrawData? drawData = null)
28 {
29 if (shaderId != 0 && shaderId <= _shaderDataCount)
30 {
31 _shaderData[shaderId - 1].Apply(player, drawData);
32 }
33 else
34 {
35 Main.pixelShader.CurrentTechnique.Passes[0].Apply();
36 }
37 }
38
39 public Color GetColor(short shaderId, Player player, Color lightColor)
40 {
41 if (shaderId != 0 && shaderId <= _shaderDataCount)
42 {
43 return _shaderData[shaderId - 1].GetColor(player, lightColor);
44 }
45 return new Color(lightColor.ToVector4() * player.hairColor.ToVector4());
46 }
47
49 {
51 {
53 }
54 return null;
55 }
56
57 public short GetShaderIdFromItemId(int type)
58 {
60 {
62 }
63 return -1;
64 }
65}
void Add(TKey key, TValue value)
void Apply(short shaderId, Player player, DrawData? drawData=null)
Color GetColor(short shaderId, Player player, Color lightColor)
static Effect pixelShader
Definition Main.cs:2764
Color hairColor
Definition Player.cs:2133