Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e60ecf7
lights: Add separate prefab for inserts.
freezy Oct 4, 2021
4f52e6d
patcher: Position some of T2's insert lights.
freezy Oct 4, 2021
6f908d6
editor: Fix lamps mapping not being persisted.
freezy Oct 4, 2021
8de5bb6
editor: Match lamps case insensitively.
freezy Oct 4, 2021
8fe1473
lamps: Fix exiting loop after first unmapped entry. Also turns off la…
freezy Oct 4, 2021
f6abb7a
dmd: Add emission node.
freezy Oct 5, 2021
9efb14c
patcher: Position all insert lights.
freezy Oct 5, 2021
dffc8b8
lights: Add support for multiple sources per light.
freezy Oct 5, 2021
c111426
lamps: Simplify RGB handling and add GI support.
freezy Oct 6, 2021
324ed97
lamps: Add fading steps for GI.
freezy Oct 7, 2021
763787d
Revert "lights: Add support for multiple sources per light."
freezy Oct 7, 2021
fd1c3de
lights: Fix multi-light support and add proper fading.
freezy Oct 7, 2021
22d626e
lights: Fix population tests.
freezy Oct 7, 2021
093199c
light: Add light group.
freezy Oct 7, 2021
bf6f303
patcher: Add abstract table patcher.
freezy Oct 7, 2021
12b40ac
lights: Add light group component.
freezy Oct 10, 2021
5282370
t2: Fix material for playfield and inserts.
freezy Oct 10, 2021
a89aa64
t2: More patches.
freezy Oct 10, 2021
f31d658
t2: Fix slingshots.
freezy Oct 11, 2021
14d4d2f
editor: Add icons for flasher and light group.
freezy Oct 11, 2021
40f1417
mapping: Properly auto-populate coil lamps.
freezy Oct 11, 2021
14d6c04
kicker: Add direction gizmo.
freezy Oct 11, 2021
9ce5690
editor: Add toggle to lamp manager.
freezy Oct 12, 2021
7e20dea
editor: Add selection to lamp manager.
freezy Oct 12, 2021
273d1ad
patcher: Fix trough setup.
freezy Oct 12, 2021
b2d7d9c
lights: Don't fade flashers.
freezy Oct 12, 2021
2fd2e60
mapping: Setup data for dynamic wires.
freezy Oct 12, 2021
7d38eec
mapping: Setup player for dynamic wires.
freezy Oct 13, 2021
dc31539
chore: Minor cleanups.
freezy Oct 13, 2021
6257250
t2: add cannon component
jsm174 Oct 14, 2021
fd8b558
gle: Add configurable flipper lag to default GLE.
freezy Oct 13, 2021
5e3db49
player: Fix dynamic wire matching for key switches.
freezy Oct 14, 2021
12296d3
player: Handle edge case for dynamic wire activation.
freezy Oct 14, 2021
830495f
player: Detect coil deactivation at GLE.
freezy Oct 14, 2021
e25f593
player: Handle coils signals without switch.
freezy Oct 15, 2021
8aafc73
player: Scope dynamic wires by switch status.
freezy Oct 15, 2021
7925cb0
player: Add dynamic wire support to switches.
freezy Oct 15, 2021
38d6a4b
doc: Add fast flip doc and update CHANGELOG.
freezy Oct 15, 2021
37c2d55
editor: Measure and display lag in wire manager.
freezy Oct 16, 2021
9b271d9
cannon: move business logic from component to api
jsm174 Oct 16, 2021
b3d4532
editor: Make wires auto-populatable.
freezy Oct 16, 2021
da20a93
doc: Update links and include patcher in API generation.
freezy Oct 16, 2021
0aec43f
patcher: Fix namespace and ignore pinmame in test project.
freezy Oct 16, 2021
9b1b5bc
editor: Fix internal ID of lamps.
freezy Oct 16, 2021
2750130
editor: Right-align coil ID in lamp manager.
freezy Oct 16, 2021
c969eac
cannon: updated to use OnUpdate in api
jsm174 Oct 16, 2021
66077bb
doc: Add documentation for light groups.
freezy Oct 16, 2021
e1a5dfd
doc: Update lamp manager documentation.
freezy Oct 16, 2021
cf046aa
doc: Update screenshot for wire manager.
freezy Oct 16, 2021
c0aaac2
doc: Replace relative links with GUIDs.
freezy Oct 17, 2021
27686f9
patcher: Group lights when there's more than one source per output.
freezy Oct 17, 2021
b4c9746
Fix a couple typos in camera-settings.md
dekay Oct 17, 2021
c1633d3
t2: Position remaining flashers.
freezy Oct 17, 2021
fb581eb
editor: Add "selected" toggle to lamp manager.
freezy Oct 17, 2021
7a56b02
editor: Make light pairing easier.
freezy Oct 17, 2021
cd276c4
t2: Add DMD.
freezy Oct 17, 2021
4a450bb
t2: Fix flashers.
freezy Oct 17, 2021
fbb0bb0
fix: Standard light type.
freezy Oct 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
Built with Unity 2020.3.

### Added
- Support for dynamic wires, also known as *Fast Flip* ([#330](https://github.com/freezy/VisualPinball.Engine/pull/330), [Documentation](https://docs.visualpinball.org/creators-guide/editor/wire-manager.html#dynamic)).
- Component for light groups, allowing easy grouping of GI lamps. ([#330](https://github.com/freezy/VisualPinball.Engine/pull/330) ([Documentation](https://docs.visualpinball.org/creators-guide/manual/mechanisms/light-groups.html))).
- Slingshot component ([#329](https://github.com/freezy/VisualPinball.Engine/pull/329), [Documentation](https://docs.visualpinball.org/creators-guide/manual/mechanisms/slingshots.html)).
- Create insert meshes ([#320](https://github.com/freezy/VisualPinball.Engine/pull/320))
- Create insert meshes ([#320](https://github.com/freezy/VisualPinball.Engine/pull/320)).
- Full support for custom playfield meshes.
- Remove Hybrid Renderer ([#316](https://github.com/freezy/VisualPinball.Engine/pull/316)).
- Create and use Unity assets when importing ([#320](https://github.com/freezy/VisualPinball.Engine/pull/302)).
Expand Down Expand Up @@ -37,6 +39,7 @@ Built with Unity 2020.3.
- Put game-, mesh-, collision- animation data into separate components ([#227](https://github.com/freezy/VisualPinball.Engine/pull/227), [Documentation](https://docs.visualpinball.org/creators-guide/editor/unity-components.html)).

### Fixed
- Lighting setup. It's now usable ([#330](https://github.com/freezy/VisualPinball.Engine/pull/330)).
- Ball passing through collider plane and disappearing.
- Alpha channel of color values is now correctly written ([#291](https://github.com/freezy/VisualPinball.Engine/pull/291)).
- Layer names are correctly computed when importing a 10.6 file ([#291](https://github.com/freezy/VisualPinball.Engine/pull/291)).
Expand Down
6 changes: 4 additions & 2 deletions VisualPinball.Engine/Game/Engines/GamelogicEngineCoil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class GamelogicEngineCoil : IGamelogicEngineDeviceItem
public string Description { get => _description; set => _description = value; }

public int InternalId;
public string DeviceHint;
public string DeviceItemHint;
public string DeviceHint { get => _deviceHint; set => _deviceHint = value; }
public string DeviceItemHint { get => _deviceItemHint; set => _deviceItemHint = value; }
public bool IsLamp;

/// <summary>
Expand All @@ -38,6 +38,8 @@ public class GamelogicEngineCoil : IGamelogicEngineDeviceItem

private string _description;
private string _id;
private string _deviceHint;
private string _deviceItemHint;

public GamelogicEngineCoil(string id)
{
Expand Down
80 changes: 64 additions & 16 deletions VisualPinball.Engine/Game/Engines/GamelogicEngineLamp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,78 @@
// ReSharper disable InconsistentNaming

using System;
using VisualPinball.Engine.Math;

namespace VisualPinball.Engine.Game.Engines
{
[Serializable]
public class GamelogicEngineLamp : IGamelogicEngineDeviceItem
{
public string Id { get; set; }
public int InternalId;
public string Description { get; set; }
public string DeviceHint;
public string DeviceItemHint;
public string MainLampIdOfGreen;
public string MainLampIdOfBlue;

public GamelogicEngineLamp(string id)
{
Id = id;
InternalId = int.TryParse(id, out var internalId) ? internalId : 0;
/// <summary>
/// The unique ID of this lamp, as the gamelogic engine addresses it.
/// </summary>
public string Id { get => _id; set => _id = value; }

/// <summary>
/// Some gamelogic engines use integers for the ID. In order to avoid repetitive casting, we store it as integer as well.
/// </summary>
public int InternalId;

/// <summary>
/// Which channel this lamp corresponds to.
/// </summary>
public ColorChannel Channel = ColorChannel.Alpha;

/// <summary>
/// If it's a fading light, this is the value at maximal intensity.
/// </summary>
public int FadingSteps;

/// <summary>
/// An optional description of the lamp.
/// </summary>
public string Description { get => _description; set => _description = value; }

/// <summary>
/// How the gamelogic engine triggers the lamp. Either through GI or through the normal lamp API.
/// </summary>
///
/// <remarks>
/// Note that lamps connected to coils will appear under coils.
/// </remarks>
public LampSource Source = LampSource.Lamp;

/// <summary>
/// A regular expression to match the component on the playfield.
/// </summary>
public string DeviceHint { get => _deviceHint; set => _deviceHint = value; }

/// <summary>
/// A regular expression to match the lamp component within the component.
/// </summary>
public string DeviceItemHint { get => _deviceItemHint; set => _deviceItemHint = value; }

private string _description;
private string _id;
private string _deviceHint;
private string _deviceItemHint;

public GamelogicEngineLamp(string id)
{
Id = id;
InternalId = int.TryParse(id, out var internalId) ? internalId : 0;
}

public GamelogicEngineLamp(string id, int internalId)
{
Id = id;
InternalId = internalId;
}
}

public GamelogicEngineLamp(string id, int internalId)
public enum LampSource
{
Id = id;
InternalId = internalId;
}
Lamp = 0,
GI = 1,
}
}
7 changes: 5 additions & 2 deletions VisualPinball.Engine/Game/Engines/GamelogicEngineSwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ public class GamelogicEngineSwitch : IGamelogicEngineDeviceItem
public string Description { get => _description; set => _description = value; }
public string InputActionHint;
public string InputMapHint;
public string DeviceHint;
public string DeviceItemHint;

public string DeviceHint { get => _deviceHint; set => _deviceHint = value; }
public string DeviceItemHint { get => _deviceItemHint; set => _deviceItemHint = value; }
public SwitchConstantHint ConstantHint = SwitchConstantHint.None;

private string _description;
private string _id;
private string _deviceHint;
private string _deviceItemHint;

public GamelogicEngineSwitch(string id)
{
Expand Down
44 changes: 44 additions & 0 deletions VisualPinball.Engine/Game/Engines/GamelogicEngineWire.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Visual Pinball Engine
// Copyright (C) 2021 freezy and VPE Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// ReSharper disable InconsistentNaming

using System;

namespace VisualPinball.Engine.Game.Engines
{
[Serializable]
public class GamelogicEngineWire
{
public string Description;
public string SourceId;
public string DestinationId;
public DestinationType DestinationType;

public GamelogicEngineWire(string srcId, string destId, DestinationType type, string description = "")
{
Description = description;
SourceId = srcId;
DestinationId = destId;
DestinationType = type;
}
}

public enum DestinationType
{
Coil, Lamp, GI
}
}
11 changes: 11 additions & 0 deletions VisualPinball.Engine/Game/Engines/GamelogicEngineWire.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ public interface IGamelogicEngineDeviceItem
{
string Id { get; }
string Description { get; }
string DeviceHint { get; }
string DeviceItemHint { get; }
}
}
20 changes: 19 additions & 1 deletion VisualPinball.Engine/Math/Color.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,25 @@ public enum ColorFormat

public enum ColorChannel
{
Red, Green, Blue, Alpha
/// <summary>
/// The red channel for RGB lamps.
/// </summary>
Red,

/// <summary>
/// The green channel for RGB lamps.
/// </summary>
Green,

/// <summary>
/// The blue channel for RBG lamps.
/// </summary>
Blue,

/// <summary>
/// The intensity for white lamps.
/// </summary>
Alpha,
}

public static class Colors
Expand Down
11 changes: 7 additions & 4 deletions VisualPinball.Engine/VPT/Light/Light.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

using System;
using System.IO;
using VisualPinball.Engine.Game;
using VisualPinball.Engine.Math;
Expand All @@ -29,6 +30,8 @@ public class Light : Item<LightData>, IRenderable

private readonly LightMeshGenerator _meshGenerator;

public bool IsInsertLight(Table.Table table) => !Data.ShowBulbMesh && string.Equals(Data.OffImage, table.Data.Image, StringComparison.OrdinalIgnoreCase);

public Light(LightData data) : base(data)
{
_meshGenerator = new LightMeshGenerator(Data);
Expand All @@ -38,11 +41,9 @@ public Light(BinaryReader reader, string itemName) : this(new LightData(reader,
{
}

public static Light GetDefault(Table.Table table)
public static Light GetDefault(string name, float x, float y)
{
var x = table.Width / 2f;
var y = table.Height / 2f;
var lightData = new LightData(table.GetNewName<Light>("Light"), table.Width / 2f, table.Height / 2f) {
var lightData = new LightData(name, x, y) {
DragPoints = new[] {
new DragPointData(x, y - 50f) {IsSmooth = true },
new DragPointData(x - 50f * MathF.Cos(MathF.PI / 4), y - 50f * MathF.Sin(MathF.PI / 4)) {IsSmooth = true },
Expand All @@ -56,6 +57,8 @@ public static Light GetDefault(Table.Table table)
};
return new Light(lightData);
}

public static Light GetDefault(Table.Table table) => GetDefault(table.GetNewName<Light>("Light"), table.Width / 2f, table.Height / 2f);

#region IRenderable

Expand Down
2 changes: 2 additions & 0 deletions VisualPinball.Engine/VPT/Material.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#region ReSharper
// ReSharper disable FieldCanBeMadeReadOnly.Global
// ReSharper disable InconsistentNaming
#endregion

using System;
Expand Down Expand Up @@ -140,6 +141,7 @@ public Material(string name) : this()
BaseColor = new Color(255, 255, 255, 255);
Glossiness = new Color(0, 0, 0, 255);
ClearCoat = new Color(0, 0, 0, 255);
Opacity = 1f;

UpdateData();
}
Expand Down
20 changes: 20 additions & 0 deletions VisualPinball.Engine/VPT/PbrMaterial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public class PbrMaterial
public bool IsOpacityActive => _material?.IsOpacityActive ?? false;
public float Opacity => MathF.Min(1, MathF.Max(0, _material?.Opacity ?? 1f));
public float Roughness => _material?.Roughness ?? 0.5f;

public MaterialType MaterialType = MaterialType.Translucent;
public DiffusionProfileTemplate DiffusionProfile = DiffusionProfileTemplate.None;

private float Edge => _material?.Edge ?? 0f;

public const string NameNoMaterial = "__std";
Expand Down Expand Up @@ -155,4 +159,20 @@ public enum BlendMode
Cutout,
Translucent
}

public enum DiffusionProfileTemplate
{
None,
Plastics
}

public enum MaterialType
{
SubsurfaceScattering = 0,
Standard = 1,
Anisotropy = 2,
Iridescence = 3,
SpecularColor = 4,
Translucent = 5,
}
}
4 changes: 3 additions & 1 deletion VisualPinball.Engine/VPT/Table/TableMeshGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public Mesh GetMesh(Table table, bool asRightHanded = true)

public PbrMaterial GetMaterial(Table table)
{
return new PbrMaterial(table.GetMaterial(_data.PlayfieldMaterial), table.GetTexture(_data.Image));
return new PbrMaterial(table.GetMaterial(_data.PlayfieldMaterial), table.GetTexture(_data.Image)) {
MaterialType = MaterialType.Standard
};
}

public void SetFromPrimitive(Primitive.Primitive primitive)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading