/[gr2lib]/trunk/gr2lib/core/coretypes/implementation/ArtToolInfo.cs
ViewVC logotype

Contents of /trunk/gr2lib/core/coretypes/implementation/ArtToolInfo.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (show annotations) (download)
Thu Jul 15 23:36:04 2010 UTC (10 years, 7 months ago) by william
File size: 3863 byte(s)
move ExtenededData to it's own interface and make the classes, that need it, implement it.

1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using gr2lib.core.typedefs;
5 using gr2lib.core.helpers;
6 using Microsoft.Xna.Framework;
7 using gr2lib.core.interfaces;
8 namespace gr2lib.core.coretypes.implementation
9 {
10
11
12 public class ArtToolInfo : IArtToolInfo
13 {
14 private FilePath _fromArtToolName;
15 private granny_int32 _artToolMajorRevision;
16 private granny_int32 _artToolMinorRevision;
17 private granny_real32 _unitsPerMeter;
18
19
20
21
22 private Vector3 _Origin;
23 private Vector3 _Right;
24 private Vector3 _Up;
25 private Vector3 _Back;
26
27 public ArtToolInfo()
28 {
29 this.FromArtToolName = "";
30 this.ArtToolMajorRevision = 0;
31 this.ArtToolMinorRevision = 0;
32 this.UnitsPerMeter = 1;
33 this.ExtendedData = IntPtr.Zero;
34 this.NativePointer = IntPtr.Zero;
35 this.Origin = new Vector3(0, 0, 0);
36 this.Right = new Vector3(0, 0, 0);
37 this.Up = new Vector3(0, 0, 0);
38 this.Back = new Vector3(0, 0, 0);
39
40
41 }
42 internal static ArtToolInfo ReadFromMemory(IntPtr pointer)
43 {
44 if (pointer == IntPtr.Zero) return null;
45 native.ArtToolInfo native = Helpers.ReadFromMemory<native.ArtToolInfo>(pointer);
46 ArtToolInfo managed = ReadFromNative(native);
47 managed.NativePointer = pointer;
48 return managed;
49 }
50 internal static ArtToolInfo ReadFromNative(gr2lib.core.coretypes.native.ArtToolInfo native)
51 {
52 ArtToolInfo managed = new ArtToolInfo();
53 managed.FromArtToolName = string.IsNullOrEmpty(native.FromArtToolName) ? "{null}" : native.FromArtToolName;
54 managed.ArtToolMajorRevision = native.ArtToolMajorRevision;
55 managed.ArtToolMinorRevision = native.ArtToolMinorRevision;
56 //managed.ArtToolPointerSize = native.ArtToolPointerSize;
57 managed.UnitsPerMeter = native.UnitsPerMeter;
58 managed.Origin = new Vector3(native.Origin.X, native.Origin.Y, native.Origin.Z );
59 managed.Right = new Vector3( native.Right.X, native.Right.Y, native.Right.Z );
60 managed.Up = new Vector3(native.Up.X, native.Up.Y, native.Up.Z );
61 managed.Back = new Vector3(native.Back.X, native.Back.Y, native.Back.Z);
62 managed.ExtendedData = native.ExtendedData;
63 //managed.OnInvalidate();
64 return managed;
65 }
66
67 #region IArtToolInfo Members
68 public FilePath FromArtToolName { get { return _fromArtToolName; } set { _fromArtToolName = value; } }
69 public granny_int32 ArtToolMajorRevision { get { return _artToolMajorRevision; } set { _artToolMajorRevision = value; } }
70 public granny_int32 ArtToolMinorRevision { get { return _artToolMinorRevision; } set { _artToolMinorRevision = value; } }
71 public granny_real32 UnitsPerMeter { get { return _unitsPerMeter; } set { _unitsPerMeter = value; } }
72 public Vector3 Origin { get { return _Origin; } set { _Origin = value; } }
73 public Vector3 Right { get { return _Right; } set { _Right = value; } }
74 public Vector3 Up { get { return _Up; } set { _Up = value; } }
75 public Vector3 Back { get { return _Back; } set { _Back = value; } }
76
77 #endregion
78
79 #region INativePointer Members
80 private IntPtr _NativePointer;
81 public IntPtr NativePointer { get { return _NativePointer; } set { _NativePointer = value; } }
82 #endregion
83
84 #region IExtendedData Members
85 private IntPtr _ExtendedData;
86 public IntPtr ExtendedData { get { return _ExtendedData; } set { _ExtendedData = value; } }
87 #endregion
88
89 }
90 }
91

  ViewVC Help
Powered by ViewVC 1.1.22