-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path0b810995-4148-47ae-a053-6cfc1ec995ba.mop
162 lines (162 loc) · 5.99 KB
/
0b810995-4148-47ae-a053-6cfc1ec995ba.mop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
{
"Name": "LocatorScreen",
"_id": "0b810995-4148-47ae-a053-6cfc1ec995ba",
"Namespace": "lib.basic",
"Description": "Gets the current object position in screen coordinates. Depth contains the plain depth value (not z!).",
"Inputs": [
{
"Name": "Input",
"MetaInstanceID": "60196cb3-1632-414f-b22d-44b77304fbd9",
"DefaultValue": {
"Type": "Scene",
"Value": "Framefield.Core.Scene"
},
"MetaID": "79122951-7bc4-4c68-b085-866eab828248",
"IsMultiInput": "False",
"Relevance": "Relevant",
"Description": "",
"Min": "-100000",
"Max": "100000",
"Scale": "0.1",
"ScaleType": "Linear",
"EnumValues": []
}
],
"Outputs": [
{
"Name": "Output",
"MetaInstanceID": "1c3a3b6e-e532-418f-aaf4-edfe63ad3a49",
"MetaID": "79122951-7bc4-4c68-b085-866eab828248"
},
{
"Name": "Position.X",
"MetaInstanceID": "c92be6c9-7f39-4674-9634-3d60b1940f40",
"MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506"
},
{
"Name": "Position.Y",
"MetaInstanceID": "8cd7079d-7a9d-48a2-ab02-cb00f11e2b65",
"MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506"
},
{
"Name": "Position.Depth",
"MetaInstanceID": "0e987a1a-3d93-4513-85ed-28874543cbd6",
"MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506"
}
],
"OperatorParts": [
{
"MetaInstanceID": "06fc5c4c-2c64-4bb2-b788-5aadf94e80ea",
"MetaID": "8ac787a9-f9a3-47a5-8afb-4fc9eafdc09e",
"Name": "LocatorScreenFunc",
"Version": "3b2f8c64-80c7-494e-8008-e669e0032d53",
"Type": "Float",
"IsMultiInput": "True",
"Script": [
"//>>> _using",
"using System;",
"using System.Collections.Generic;",
"using System.Linq;",
"using System.Text;",
"using SharpDX;",
"using SharpDX.Direct3D11;",
"using SharpDX.Windows;",
"//<<< _using",
"",
"namespace Framefield.Core.ID8ac787a9_f9a3_47a5_8afb_4fc9eafdc09e",
"{",
" public class Class_LocatorScreen : OperatorPart.Function",
" {",
" //>>> _inputids",
" private enum InputId",
" {",
" Input = 0",
" }",
" //<<< _inputids",
" ",
" //>>> _outputids",
" private enum OutputId",
" {",
" Output = 0,",
" PositionX = 1,",
" PositionY = 2,",
" PositionDepth = 3",
" }",
" //<<< _outputids",
"",
" public override OperatorPartContext Eval(OperatorPartContext context, List<OperatorPart> inputs, int outputIdx)",
" {",
" //>>> _params",
" var Input = inputs[(int)InputId.Input];",
" //<<< _params",
" ",
" switch (outputIdx)",
" {",
" case (int)OutputId.Output:",
" {",
" context.ObjectTWorld.Decompose(out _scale, out _rotation, out _position);",
" Matrix worldToView = context.WorldToCamera*context.CameraProjection;",
" _screenPosition = Vector3.TransformCoordinate(_position, worldToView);",
"",
" Input.Eval(context);",
"",
" //because these outputs are dependent on this evaluation, we need to invalidate them here",
" OperatorPart.EmitChangedEventForOutput((int)OutputId.PositionX);",
" OperatorPart.EmitChangedEventForOutput((int)OutputId.PositionY);",
" OperatorPart.EmitChangedEventForOutput((int)OutputId.PositionDepth);",
" break;",
" }",
" case (int)OutputId.PositionX: context.Value = _screenPosition.X; break;",
" case (int)OutputId.PositionY: context.Value = _screenPosition.Y; break;",
" case (int)OutputId.PositionDepth: context.Value = _screenPosition.Z; break;",
" }",
"",
" return context;",
" }",
"",
" Vector3 _scale;",
" Quaternion _rotation;",
" Vector3 _position;",
" Vector3 _screenPosition;",
" }",
"}",
"",
""
],
"AdditionalAssemblies": []
}
],
"Operators": [],
"Connections": [
{
"SourceOp": "00000000-0000-0000-0000-000000000000",
"SourceOpPart": "06fc5c4c-2c64-4bb2-b788-5aadf94e80ea",
"TargetOp": "00000000-0000-0000-0000-000000000000",
"TargetOpPart": "1c3a3b6e-e532-418f-aaf4-edfe63ad3a49"
},
{
"SourceOp": "00000000-0000-0000-0000-000000000000",
"SourceOpPart": "06fc5c4c-2c64-4bb2-b788-5aadf94e80ea",
"TargetOp": "00000000-0000-0000-0000-000000000000",
"TargetOpPart": "c92be6c9-7f39-4674-9634-3d60b1940f40"
},
{
"SourceOp": "00000000-0000-0000-0000-000000000000",
"SourceOpPart": "06fc5c4c-2c64-4bb2-b788-5aadf94e80ea",
"TargetOp": "00000000-0000-0000-0000-000000000000",
"TargetOpPart": "8cd7079d-7a9d-48a2-ab02-cb00f11e2b65"
},
{
"SourceOp": "00000000-0000-0000-0000-000000000000",
"SourceOpPart": "60196cb3-1632-414f-b22d-44b77304fbd9",
"TargetOp": "00000000-0000-0000-0000-000000000000",
"TargetOpPart": "06fc5c4c-2c64-4bb2-b788-5aadf94e80ea"
},
{
"SourceOp": "00000000-0000-0000-0000-000000000000",
"SourceOpPart": "06fc5c4c-2c64-4bb2-b788-5aadf94e80ea",
"TargetOp": "00000000-0000-0000-0000-000000000000",
"TargetOpPart": "0e987a1a-3d93-4513-85ed-28874543cbd6"
}
]
}