/[pcsx2_0.9.7]/trunk/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZF.cs
ViewVC logotype

Contents of /trunk/tools/GSDumpGUI/Library/GSDump/GSData/GIFPacket/GIFReg/GIFRegXYZF.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 313 - (show annotations) (download)
Sun Dec 26 16:21:07 2010 UTC (9 years, 9 months ago) by william
File size: 2745 byte(s)
Auto Commited Import of: pcsx2-0.9.7-DEBUG (upstream: v0.9.7.4151 local: v0.9.7.293-latest) in ./trunk
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace GSDumpGUI
6 {
7 public class GIFRegXYZF : GIFReg
8 {
9 public double X;
10 public double Y;
11 public UInt32 Z;
12 public UInt16 F;
13
14 public bool IsXYZF;
15
16 public GIFRegXYZF(int addr, UInt64 LowData, UInt64 HighData, bool PackedFormat) : base(addr, LowData, HighData, PackedFormat) { }
17
18 static public GIFReg UnpackXYZ(GIFTag tag, int addr, UInt64 LowData, UInt64 HighData, bool PackedFormat)
19 {
20 GIFRegXYZF xyzf = new GIFRegXYZF(addr, LowData, HighData, PackedFormat);
21
22 xyzf.IsXYZF = false;
23 if (PackedFormat && addr == (int)GIFRegDescriptor.XYZ2 && GetBit(HighData, 47, 1) == 1)
24 xyzf.Descriptor = GIFRegDescriptor.XYZ3;
25 else
26 xyzf.Descriptor = (GIFRegDescriptor)addr;
27
28 if (PackedFormat)
29 {
30 xyzf.X = GetBit(LowData, 0, 16) / 16d;
31 xyzf.Y = GetBit(LowData, 32, 16) / 16d;
32 xyzf.Z = (UInt32)(GetBit(HighData, 0, 32));
33 }
34 else
35 {
36 xyzf.X = GetBit(LowData, 0, 16) / 16d;
37 xyzf.Y = GetBit(LowData, 16, 16) / 16d;
38 xyzf.Z = (UInt32)(GetBit(LowData, 32, 32));
39 }
40 return xyzf;
41 }
42
43 static public GIFReg Unpack(GIFTag tag, int addr, UInt64 LowData, UInt64 HighData, bool PackedFormat)
44 {
45 GIFRegXYZF xyzf = new GIFRegXYZF(addr, LowData, HighData, PackedFormat);
46
47 xyzf.IsXYZF = true;
48 if (PackedFormat && addr == (int)GIFRegDescriptor.XYZF2 && GetBit(HighData, 47, 1) == 1)
49 xyzf.Descriptor = GIFRegDescriptor.XYZF3;
50 else
51 xyzf.Descriptor = (GIFRegDescriptor)addr;
52
53 if (PackedFormat)
54 {
55 xyzf.X = GetBit(LowData, 0, 16) / 16d;
56 xyzf.Y = GetBit(LowData, 32, 16) / 16d;
57 xyzf.Z = (UInt32)(GetBit(HighData, 4, 24));
58 xyzf.F = (UInt16)(GetBit(HighData, 36, 8));
59 }
60 else
61 {
62 xyzf.X = GetBit(LowData, 0, 16) / 16d;
63 xyzf.Y = GetBit(LowData, 16, 16) / 16d;
64 xyzf.Z = (UInt32)(GetBit(LowData, 32, 24));
65 xyzf.F = (UInt16)(GetBit(LowData, 56, 8));
66 }
67 return xyzf;
68 }
69
70 public override string ToString()
71 {
72 return Descriptor.ToString() + "@X : " + X.ToString("F4") + "@Y : " + Y.ToString("F4") + "@Z : " + Z.ToString() + (IsXYZF ? "@F : " + F.ToString() : "");
73 }
74 }
75 }

  ViewVC Help
Powered by ViewVC 1.1.22