corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | /* |
2 | * Copyright (c) 2006-2014, openmetaverse.org |
||
3 | * All rights reserved. |
||
4 | * |
||
5 | * - Redistribution and use in source and binary forms, with or without |
||
6 | * modification, are permitted provided that the following conditions are met: |
||
7 | * |
||
8 | * - Redistributions of source code must retain the above copyright notice, this |
||
9 | * list of conditions and the following disclaimer. |
||
10 | * - Neither the name of the openmetaverse.org nor the names |
||
11 | * of its contributors may be used to endorse or promote products derived from |
||
12 | * this software without specific prior written permission. |
||
13 | * |
||
14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
||
18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
24 | * POSSIBILITY OF SUCH DAMAGE. |
||
25 | */ |
||
26 | |||
27 | using System; |
||
28 | |||
29 | namespace OpenMetaverse |
||
30 | { |
||
31 | public partial class AgentManager |
||
32 | { |
||
33 | public partial class AgentMovement |
||
34 | { |
||
35 | /// <summary> |
||
36 | /// Camera controls for the agent, mostly a thin wrapper around |
||
37 | /// CoordinateFrame. This class is only responsible for state |
||
38 | /// tracking and math, it does not send any packets |
||
39 | /// </summary> |
||
40 | public class AgentCamera |
||
41 | { |
||
42 | /// <summary></summary> |
||
43 | public float Far; |
||
44 | |||
45 | /// <summary>The camera is a local frame of reference inside of |
||
46 | /// the larger grid space. This is where the math happens</summary> |
||
47 | private CoordinateFrame Frame; |
||
48 | |||
49 | /// <summary></summary> |
||
50 | public Vector3 Position |
||
51 | { |
||
52 | get { return Frame.Origin; } |
||
53 | set { Frame.Origin = value; } |
||
54 | } |
||
55 | /// <summary></summary> |
||
56 | public Vector3 AtAxis |
||
57 | { |
||
58 | get { return Frame.YAxis; } |
||
59 | set { Frame.YAxis = value; } |
||
60 | } |
||
61 | /// <summary></summary> |
||
62 | public Vector3 LeftAxis |
||
63 | { |
||
64 | get { return Frame.XAxis; } |
||
65 | set { Frame.XAxis = value; } |
||
66 | } |
||
67 | /// <summary></summary> |
||
68 | public Vector3 UpAxis |
||
69 | { |
||
70 | get { return Frame.ZAxis; } |
||
71 | set { Frame.ZAxis = value; } |
||
72 | } |
||
73 | |||
74 | /// <summary> |
||
75 | /// Default constructor |
||
76 | /// </summary> |
||
77 | public AgentCamera() |
||
78 | { |
||
79 | Frame = new CoordinateFrame(new Vector3(128f, 128f, 20f)); |
||
80 | Far = 128f; |
||
81 | } |
||
82 | |||
83 | public void Roll(float angle) |
||
84 | { |
||
85 | Frame.Roll(angle); |
||
86 | } |
||
87 | |||
88 | public void Pitch(float angle) |
||
89 | { |
||
90 | Frame.Pitch(angle); |
||
91 | } |
||
92 | |||
93 | public void Yaw(float angle) |
||
94 | { |
||
95 | Frame.Yaw(angle); |
||
96 | } |
||
97 | |||
98 | public void LookDirection(Vector3 target) |
||
99 | { |
||
100 | Frame.LookDirection(target); |
||
101 | } |
||
102 | |||
103 | public void LookDirection(Vector3 target, Vector3 upDirection) |
||
104 | { |
||
105 | Frame.LookDirection(target, upDirection); |
||
106 | } |
||
107 | |||
108 | public void LookDirection(double heading) |
||
109 | { |
||
110 | Frame.LookDirection(heading); |
||
111 | } |
||
112 | |||
113 | public void LookAt(Vector3 position, Vector3 target) |
||
114 | { |
||
115 | Frame.LookAt(position, target); |
||
116 | } |
||
117 | |||
118 | public void LookAt(Vector3 position, Vector3 target, Vector3 upDirection) |
||
119 | { |
||
120 | Frame.LookAt(position, target, upDirection); |
||
121 | } |
||
122 | |||
123 | public void SetPositionOrientation(Vector3 position, float roll, float pitch, float yaw) |
||
124 | { |
||
125 | Frame.Origin = position; |
||
126 | |||
127 | Frame.ResetAxes(); |
||
128 | |||
129 | Frame.Roll(roll); |
||
130 | Frame.Pitch(pitch); |
||
131 | Frame.Yaw(yaw); |
||
132 | } |
||
133 | } |
||
134 | } |
||
135 | } |
||
136 | } |