@quenty/viewport 5.1.0 → 5.1.1

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 CHANGED
@@ -3,6 +3,17 @@
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
+ ## [5.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.1.0...@quenty/viewport@5.1.1) (2022-10-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Viewport has nicer default signal rendering ([b9440e6](https://github.com/Quenty/NevermoreEngine/commit/b9440e65a5aba795f40f9e2df56f78c2ee77ceaf))
12
+
13
+
14
+
15
+
16
+
6
17
  # [5.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/viewport@5.0.0...@quenty/viewport@5.1.0) (2022-10-11)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/viewport
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/viewport",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "Rendering functionality for viewportFrames",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,14 +27,15 @@
27
27
  "@quenty/adorneeutils": "^3.0.0",
28
28
  "@quenty/baseobject": "^6.0.0",
29
29
  "@quenty/basicpane": "^7.1.0",
30
- "@quenty/blend": "^6.1.0",
31
- "@quenty/camera": "^9.1.0",
30
+ "@quenty/blend": "^6.1.1",
31
+ "@quenty/camera": "^9.1.1",
32
32
  "@quenty/geometryutils": "^2.2.0",
33
33
  "@quenty/inputobjectutils": "^4.0.0",
34
34
  "@quenty/loader": "^6.0.0",
35
35
  "@quenty/maid": "^2.4.0",
36
36
  "@quenty/math": "^2.2.0",
37
37
  "@quenty/rx": "^7.1.0",
38
+ "@quenty/signal": "^2.3.0",
38
39
  "@quenty/spring": "^6.0.0",
39
40
  "@quenty/valueobject": "^7.1.0"
40
41
  },
@@ -44,5 +45,5 @@
44
45
  "devDependencies": {
45
46
  "@quenty/insertserviceutils": "^6.0.0"
46
47
  },
47
- "gitHead": "69c2153865684748d0a8d6806f1ff999685c2e55"
48
+ "gitHead": "5fc8df6d4a62c0c774ebc78b275898f7f383935b"
48
49
  }
@@ -4,17 +4,19 @@
4
4
 
5
5
  local require = require(script.Parent.loader).load(script)
6
6
 
7
+ local AdorneeUtils = require("AdorneeUtils")
7
8
  local BasicPane = require("BasicPane")
8
9
  local Blend = require("Blend")
9
- local ValueObject = require("ValueObject")
10
10
  local CameraUtils = require("CameraUtils")
11
- local AdorneeUtils = require("AdorneeUtils")
11
+ local CircleUtils = require("CircleUtils")
12
12
  local Maid = require("Maid")
13
+ local Math = require("Math")
13
14
  local Observable = require("Observable")
14
- local ViewportControls = require("ViewportControls")
15
15
  local SpringObject = require("SpringObject")
16
- local CircleUtils = require("CircleUtils")
17
- local Math = require("Math")
16
+ local ValueObject = require("ValueObject")
17
+ local ViewportControls = require("ViewportControls")
18
+ local Signal = require("Signal")
19
+ local Rx = require("Rx")
18
20
 
19
21
  local MAX_PITCH = math.pi/3
20
22
  local MIN_PITCH = -math.pi/3
@@ -47,6 +49,9 @@ function Viewport.new()
47
49
  self._rotationPitchSpring.Speed = 30
48
50
  self._maid:GiveTask(self._rotationPitchSpring)
49
51
 
52
+ self._notifyInstanceSizeChanged = Signal.new()
53
+ self._maid:GiveTask(self._notifyInstanceSizeChanged)
54
+
50
55
  return self
51
56
  end
52
57
 
@@ -106,6 +111,10 @@ function Viewport:SetInstance(instance)
106
111
  self._current.Value = instance
107
112
  end
108
113
 
114
+ function Viewport:NotifyInstanceSizeChanged()
115
+ self._notifyInstanceSizeChanged:Fire()
116
+ end
117
+
109
118
  function Viewport:RotateBy(deltaV2, doNotAnimate)
110
119
  local target = (self._rotationYawSpring.Value + deltaV2.x) % TAU
111
120
  self._rotationYawSpring.Position = CircleUtils.updatePositionToSmallestDistOnCircle(self._rotationYawSpring.Position, target, TAU)
@@ -134,8 +143,8 @@ function Viewport:Render(props)
134
143
  LayoutOrder = props.LayoutOrder;
135
144
  BackgroundTransparency = 1;
136
145
  CurrentCamera = currentCamera;
137
- LightColor = props.LightColor or Color3.new(1, 1, 1);
138
- Ambient = props.Ambient or Color3.new(1, 1, 1);
146
+ LightColor = props.LightColor or Color3.fromRGB(200, 200, 200);
147
+ Ambient = props.Ambient or Color3.fromRGB(140, 140, 140);
139
148
  ImageTransparency = Blend.Computed(props.Transparency or 0, self._transparency,
140
149
  function(propTransparency, selfTransparency)
141
150
  return Math.map(propTransparency, 0, 1, selfTransparency, 1)
@@ -175,9 +184,13 @@ function Viewport:Render(props)
175
184
  [Blend.Instance] = currentCamera;
176
185
  Name = "CurrentCamera";
177
186
  FieldOfView = self._fieldOfView;
178
- CFrame = Blend.Computed(self._current, self._absoluteSize, self._fieldOfView,
187
+ CFrame = Blend.Computed(
188
+ self._current,
189
+ self._absoluteSize,
190
+ self._fieldOfView,
179
191
  self._rotationYawSpring:ObserveRenderStepped(),
180
192
  self._rotationPitchSpring:ObserveRenderStepped(),
193
+ Rx.fromSignal(self._notifyInstanceSizeChanged),
181
194
  function(inst, absSize, fov, rotationYaw, rotationPitch)
182
195
  if typeof(inst) ~= "Instance" then
183
196
  return CFrame.new()