@quenty/viewport 6.0.0-canary.367.e9fdcbc.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +124 -1
- package/package.json +17 -17
- package/src/Client/Viewport.lua +43 -24
- package/src/Client/ViewportControls.lua +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,130 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [6.0.0
|
|
6
|
+
# [6.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.36.0...@quenty/viewport@6.0.0) (2023-10-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Viewport looks much better and has no outline if you set the background color3 ([5aa3676](https://github.com/Quenty/NevermoreEngine/commit/5aa3676ac6aec10b1a0e10632e28ffb9ab8bcb13))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [5.36.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.35.0...@quenty/viewport@5.36.0) (2023-09-21)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [5.35.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.34.0...@quenty/viewport@5.35.0) (2023-09-04)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [5.34.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.33.0...@quenty/viewport@5.34.0) (2023-08-23)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# [5.33.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.32.0...@quenty/viewport@5.33.0) (2023-08-01)
|
|
42
|
+
|
|
43
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# [5.32.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.31.0...@quenty/viewport@5.32.0) (2023-07-28)
|
|
50
|
+
|
|
51
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# [5.31.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.30.0...@quenty/viewport@5.31.0) (2023-07-28)
|
|
58
|
+
|
|
59
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# [5.30.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.29.0...@quenty/viewport@5.30.0) (2023-07-25)
|
|
66
|
+
|
|
67
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# [5.29.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.28.0...@quenty/viewport@5.29.0) (2023-07-23)
|
|
74
|
+
|
|
75
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# [5.28.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.27.1...@quenty/viewport@5.28.0) (2023-07-15)
|
|
82
|
+
|
|
83
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## [5.27.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.27.0...@quenty/viewport@5.27.1) (2023-07-11)
|
|
90
|
+
|
|
91
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# [5.27.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.26.0...@quenty/viewport@5.27.0) (2023-07-10)
|
|
98
|
+
|
|
99
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
# [5.26.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.25.0...@quenty/viewport@5.26.0) (2023-06-24)
|
|
106
|
+
|
|
107
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# [5.25.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.24.0...@quenty/viewport@5.25.0) (2023-06-18)
|
|
114
|
+
|
|
115
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
# [5.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.23.0...@quenty/viewport@5.24.0) (2023-06-17)
|
|
122
|
+
|
|
123
|
+
**Note:** Version bump only for package @quenty/viewport
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
# [5.23.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.22.0...@quenty/viewport@5.23.0) (2023-06-05)
|
|
7
130
|
|
|
8
131
|
**Note:** Version bump only for package @quenty/viewport
|
|
9
132
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/viewport",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Rendering functionality for viewportFrames",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -24,26 +24,26 @@
|
|
|
24
24
|
"Quenty"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@quenty/adorneeutils": "3.1.0",
|
|
28
|
-
"@quenty/baseobject": "
|
|
29
|
-
"@quenty/basicpane": "
|
|
30
|
-
"@quenty/blend": "7.0.0
|
|
31
|
-
"@quenty/camera": "10.0.0
|
|
32
|
-
"@quenty/geometryutils": "
|
|
33
|
-
"@quenty/inputobjectutils": "4.1.0",
|
|
34
|
-
"@quenty/loader": "
|
|
35
|
-
"@quenty/maid": "2.
|
|
36
|
-
"@quenty/math": "
|
|
37
|
-
"@quenty/rx": "
|
|
38
|
-
"@quenty/signal": "
|
|
39
|
-
"@quenty/spring": "
|
|
40
|
-
"@quenty/valueobject": "8.0.0
|
|
27
|
+
"@quenty/adorneeutils": "^3.1.0",
|
|
28
|
+
"@quenty/baseobject": "^7.0.0",
|
|
29
|
+
"@quenty/basicpane": "^8.0.0",
|
|
30
|
+
"@quenty/blend": "^7.0.0",
|
|
31
|
+
"@quenty/camera": "^10.0.0",
|
|
32
|
+
"@quenty/geometryutils": "^3.0.0",
|
|
33
|
+
"@quenty/inputobjectutils": "^4.1.0",
|
|
34
|
+
"@quenty/loader": "^7.0.0",
|
|
35
|
+
"@quenty/maid": "^2.6.0",
|
|
36
|
+
"@quenty/math": "^2.5.0",
|
|
37
|
+
"@quenty/rx": "^8.0.0",
|
|
38
|
+
"@quenty/signal": "^3.0.0",
|
|
39
|
+
"@quenty/spring": "^7.0.0",
|
|
40
|
+
"@quenty/valueobject": "^8.0.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@quenty/insertserviceutils": "
|
|
46
|
+
"@quenty/insertserviceutils": "^7.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "fdeae46099587019ec5fc15317dc673aed379400"
|
|
49
49
|
}
|
package/src/Client/Viewport.lua
CHANGED
|
@@ -48,28 +48,18 @@ Viewport.__index = Viewport
|
|
|
48
48
|
function Viewport.new()
|
|
49
49
|
local self = setmetatable(BasicPane.new(), Viewport)
|
|
50
50
|
|
|
51
|
-
self._current = ValueObject.new(nil)
|
|
52
|
-
self._maid:
|
|
51
|
+
self._current = self._maid:Add(ValueObject.new(nil))
|
|
52
|
+
self._transparency = self._maid:Add(ValueObject.new(0, "number"))
|
|
53
|
+
self._absoluteSize = self._maid:Add(ValueObject.new(Vector2.zero, "Vector2"))
|
|
54
|
+
self._fieldOfView = self._maid:Add(ValueObject.new(20, "number"))
|
|
53
55
|
|
|
54
|
-
self.
|
|
55
|
-
self._maid:GiveTask(self._transparency)
|
|
56
|
-
|
|
57
|
-
self._absoluteSize = ValueObject.new(Vector2.zero, "Vector2")
|
|
58
|
-
self._maid:GiveTask(self._absoluteSize)
|
|
59
|
-
|
|
60
|
-
self._fieldOfView = ValueObject.new(20, "number")
|
|
61
|
-
self._maid:GiveTask(self._fieldOfView)
|
|
62
|
-
|
|
63
|
-
self._rotationYawSpring = SpringObject.new(math.pi/4)
|
|
56
|
+
self._rotationYawSpring = self._maid:Add(SpringObject.new(math.rad(90 + 90 - 30)))
|
|
64
57
|
self._rotationYawSpring.Speed = 30
|
|
65
|
-
self._maid:GiveTask(self._rotationYawSpring)
|
|
66
58
|
|
|
67
|
-
self._rotationPitchSpring = SpringObject.new(
|
|
59
|
+
self._rotationPitchSpring = self._maid:Add(SpringObject.new(math.rad(-15)))
|
|
68
60
|
self._rotationPitchSpring.Speed = 30
|
|
69
|
-
self._maid:GiveTask(self._rotationPitchSpring)
|
|
70
61
|
|
|
71
|
-
self._notifyInstanceSizeChanged = Signal.new()
|
|
72
|
-
self._maid:GiveTask(self._notifyInstanceSizeChanged)
|
|
62
|
+
self._notifyInstanceSizeChanged = self._maid:Add(Signal.new())
|
|
73
63
|
|
|
74
64
|
return self
|
|
75
65
|
end
|
|
@@ -132,6 +122,9 @@ function Viewport.blend(props)
|
|
|
132
122
|
end)
|
|
133
123
|
end
|
|
134
124
|
|
|
125
|
+
function Viewport:ObserveTransparency()
|
|
126
|
+
return self._transparency:Observe()
|
|
127
|
+
end
|
|
135
128
|
|
|
136
129
|
--[=[
|
|
137
130
|
Sets the field of view on the viewport.
|
|
@@ -171,6 +164,12 @@ function Viewport:SetInstance(instance)
|
|
|
171
164
|
assert(typeof(instance) == "Instance" or instance == nil, "Bad instance")
|
|
172
165
|
|
|
173
166
|
self._current.Value = instance
|
|
167
|
+
|
|
168
|
+
return function()
|
|
169
|
+
if self._current.Value == instance then
|
|
170
|
+
self._current.Value = nil
|
|
171
|
+
end
|
|
172
|
+
end
|
|
174
173
|
end
|
|
175
174
|
|
|
176
175
|
--[=[
|
|
@@ -181,26 +180,34 @@ function Viewport:NotifyInstanceSizeChanged()
|
|
|
181
180
|
self._notifyInstanceSizeChanged:Fire()
|
|
182
181
|
end
|
|
183
182
|
|
|
184
|
-
function Viewport:
|
|
185
|
-
|
|
186
|
-
self._rotationYawSpring.Position = CircleUtils.updatePositionToSmallestDistOnCircle(self._rotationYawSpring.Position, target, TAU)
|
|
183
|
+
function Viewport:SetYaw(yaw, doNotAnimate)
|
|
184
|
+
yaw = yaw % TAU
|
|
187
185
|
|
|
188
|
-
self._rotationYawSpring.
|
|
186
|
+
self._rotationYawSpring.Position = CircleUtils.updatePositionToSmallestDistOnCircle(self._rotationYawSpring.Position, yaw, TAU)
|
|
187
|
+
self._rotationYawSpring.Target = yaw
|
|
189
188
|
|
|
190
189
|
if doNotAnimate then
|
|
191
190
|
self._rotationYawSpring.Position = self._rotationYawSpring.Target
|
|
192
191
|
end
|
|
192
|
+
end
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
function Viewport:SetPitch(pitch, doNotAnimate)
|
|
195
|
+
self._rotationPitchSpring.Target = math.clamp(pitch, MIN_PITCH, MAX_PITCH)
|
|
195
196
|
if doNotAnimate then
|
|
196
197
|
self._rotationPitchSpring.Position = self._rotationPitchSpring.Target
|
|
197
198
|
end
|
|
198
199
|
end
|
|
199
200
|
|
|
201
|
+
function Viewport:RotateBy(deltaV2, doNotAnimate)
|
|
202
|
+
self:SetYaw(self._rotationYawSpring.Value + deltaV2.x, doNotAnimate)
|
|
203
|
+
self:SetPitch(self._rotationPitchSpring.Value + deltaV2.y, doNotAnimate)
|
|
204
|
+
end
|
|
205
|
+
|
|
200
206
|
--[=[
|
|
201
207
|
Renders the viewport. Allows the following properties.
|
|
202
208
|
|
|
203
209
|
* Ambient - Color3
|
|
210
|
+
* ImageColor3 - Color3
|
|
204
211
|
* AnchorPoint - Vector2
|
|
205
212
|
* LayoutOrder - number
|
|
206
213
|
* LightColor - Color3
|
|
@@ -221,16 +228,25 @@ function Viewport:Render(props)
|
|
|
221
228
|
local currentCamera = ValueObject.new()
|
|
222
229
|
self._maid:GiveTask(currentCamera)
|
|
223
230
|
|
|
231
|
+
local lightDirectionCFrame = (CFrame.Angles(0, math.rad(180), 0)
|
|
232
|
+
* CFrame.Angles(math.rad(-45), 0, 0))
|
|
233
|
+
local brightness = 1.25
|
|
234
|
+
local ambientBrightness = 0.75
|
|
235
|
+
|
|
224
236
|
return Blend.New "ViewportFrame" {
|
|
225
237
|
Parent = props.Parent;
|
|
226
238
|
Size = props.Size or UDim2.new(1, 0, 1, 0);
|
|
227
239
|
AnchorPoint = props.AnchorPoint;
|
|
228
240
|
Position = props.Position;
|
|
241
|
+
ImageColor3 = props.ImageColor3;
|
|
229
242
|
LayoutOrder = props.LayoutOrder;
|
|
230
243
|
BackgroundTransparency = 1;
|
|
244
|
+
BackgroundColor3 = props.BackgroundColor3;
|
|
231
245
|
CurrentCamera = currentCamera;
|
|
232
|
-
|
|
233
|
-
|
|
246
|
+
-- selene:allow(roblox_incorrect_color3_new_bounds)
|
|
247
|
+
LightColor = props.LightColor or Color3.new(brightness, brightness, brightness + 0.15);
|
|
248
|
+
LightDirection = props.LightDirection or lightDirectionCFrame:vectorToWorldSpace(Vector3.new(0, 0, -1));
|
|
249
|
+
Ambient = props.Ambient or Color3.new(ambientBrightness, ambientBrightness, ambientBrightness + 0.15);
|
|
234
250
|
ImageTransparency = Blend.Computed(props.Transparency or 0, self._transparency,
|
|
235
251
|
function(propTransparency, selfTransparency)
|
|
236
252
|
return Math.map(propTransparency, 0, 1, selfTransparency, 1)
|
|
@@ -265,7 +281,10 @@ function Viewport:Render(props)
|
|
|
265
281
|
return maid
|
|
266
282
|
end)] = true;
|
|
267
283
|
[Blend.Children] = {
|
|
284
|
+
props[Blend.Children];
|
|
285
|
+
|
|
268
286
|
self._current;
|
|
287
|
+
|
|
269
288
|
Blend.New "Camera" {
|
|
270
289
|
[Blend.Instance] = currentCamera;
|
|
271
290
|
Name = "CurrentCamera";
|