Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
PlayerDrawHelper.cs
Go to the documentation of this file.
3
5
6public class PlayerDrawHelper
7{
9 {
14 }
15
16 public static Color DISPLAY_DOLL_DEFAULT_SKIN_COLOR = new Color(163, 121, 92);
17
18 public static int PackShader(int localShaderIndex, ShaderConfiguration shaderType)
19 {
20 return localShaderIndex + (int)shaderType * 1000;
21 }
22
23 public static void UnpackShader(int packedShaderIndex, out int localShaderIndex, out ShaderConfiguration shaderType)
24 {
25 shaderType = (ShaderConfiguration)(packedShaderIndex / 1000);
26 localShaderIndex = packedShaderIndex % 1000;
27 }
28
29 public static void SetShaderForData(Player player, int cHead, ref DrawData cdd)
30 {
31 UnpackShader(cdd.shader, out var localShaderIndex, out var shaderType);
32 switch (shaderType)
33 {
34 case ShaderConfiguration.ArmorShader:
35 GameShaders.Hair.Apply(0, player, cdd);
36 GameShaders.Armor.Apply(localShaderIndex, player, cdd);
37 break;
38 case ShaderConfiguration.HairShader:
39 if (player.head == 0)
40 {
41 GameShaders.Hair.Apply(0, player, cdd);
42 GameShaders.Armor.Apply(cHead, player, cdd);
43 }
44 else
45 {
46 GameShaders.Armor.Apply(0, player, cdd);
47 GameShaders.Hair.Apply((short)localShaderIndex, player, cdd);
48 }
49 break;
50 case ShaderConfiguration.TileShader:
51 Main.tileShader.CurrentTechnique.Passes[localShaderIndex].Apply();
52 break;
53 case ShaderConfiguration.TilePaintID:
54 {
55 int index = Main.ConvertPaintIdToTileShaderIndex(localShaderIndex, isUsedForPaintingGrass: false, useWallShaderHacks: false);
56 Main.tileShader.CurrentTechnique.Passes[index].Apply();
57 break;
58 }
59 }
60 }
61}
static void SetShaderForData(Player player, int cHead, ref DrawData cdd)
static void UnpackShader(int packedShaderIndex, out int localShaderIndex, out ShaderConfiguration shaderType)
static int PackShader(int localShaderIndex, ShaderConfiguration shaderType)
static HairShaderDataSet Hair
Definition GameShaders.cs:9
static ArmorShaderDataSet Armor
Definition GameShaders.cs:7
static Effect tileShader
Definition Main.cs:2768
static int ConvertPaintIdToTileShaderIndex(int paintIndexOnTile, bool isUsedForPaintingGrass, bool useWallShaderHacks)
Definition Main.cs:55654