Skip to content

Commit 854b34f

Browse files
authored
Enhancement of Parsing Optional Parameters (#74)
* feat: Enhancement of Parsing Optional Parameters Added better parsing for optional types in callback/predicate parameters. chore: Formatting updates caused by updating formatting tool. * feat: Updated Package Reference Version for Server Interop Project * feat: Added Physics to Samples Regenerated Sample Projects with Physics Interop.
1 parent 1f2b1ff commit 854b34f

File tree

163 files changed

+23016
-1830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+23016
-1830
lines changed

Sample/EventHorizon.BabylonJS.Interop.Generator.ConsoleApp/Program.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static void Main(string[] args)
2323
AstParser.Model.ASTParserType.NodeJS,
2424
useWasm: true,
2525
projectAssembly: "EventHorizon.Blazor.BabylonJS.NodeJS",
26-
sourceFiles: ["babylon.d.ts", "babylon.gui.d.ts",],
26+
sourceFiles: ["babylon.d.ts", "babylon.gui.d.ts"],
2727
maxDegreeOfParallelism: 4
2828
);
2929

@@ -79,6 +79,10 @@ int maxDegreeOfParallelism
7979
{
8080
// "Everything",
8181
"Scene",
82+
"AmmoJSPlugin",
83+
"HavokPlugin",
84+
"ExecuteCodeAction",
85+
"PhysicsAggregate",
8286
"VertexBuffer",
8387
"ICameraInput",
8488
"AbstractActionManager",
@@ -127,7 +131,7 @@ int maxDegreeOfParallelism
127131
writer,
128132
textFormatter,
129133
new Dictionary<string, string> { ["BABYLON.PointerInfoBase | type"] = "int" },
130-
["BABYLON.Matrix.T[PropertyDeclaration]",],
134+
["BABYLON.Matrix.T[PropertyDeclaration]"],
131135
type,
132136
maxDegreeOfParallelism
133137
);
@@ -154,9 +158,9 @@ int maxDegreeOfParallelism
154158
{
155159
[".ThinEngine | onBeforeTextureInitObservable"] =
156160
"Observable<CachedEntityObject>",
157-
["BABYLON.PointerInfoBase | type"] = "int"
161+
["BABYLON.PointerInfoBase | type"] = "int",
158162
},
159-
["BABYLON.Tensor.R[PropertySignature]", "BABYLON.Matrix.T[PropertyDeclaration]",],
163+
["BABYLON.Tensor.R[PropertySignature]", "BABYLON.Matrix.T[PropertyDeclaration]"],
160164
type,
161165
maxDegreeOfParallelism
162166
);

Sample/EventHorizon.Blazor.BabylonJS/Layout/NavMenu.razor

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
<span class="oi oi-home" aria-hidden="true"></span> Button
3535
</NavLink>
3636
</div>
37+
<div class="nav-item px-3">
38+
<NavLink class="nav-link" href="physics">
39+
<span class="oi oi-home" aria-hidden="true"></span> Physics
40+
</NavLink>
41+
</div>
3742
<div class="nav-item px-3">
3843
<NavLink class="nav-link" href="pirate-fort">
3944
<span class="oi oi-home" aria-hidden="true"></span> Pirate Fort
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace EventHorizon.Blazor.BabylonJS.Model;
2+
3+
using System.Text.Json.Serialization;
4+
using EventHorizon.Blazor.Interop;
5+
6+
[JsonConverter(typeof(CachedEntityConverter<ClientObject>))]
7+
public class ClientObject : CachedEntityObject
8+
{
9+
public ClientObject(object data)
10+
{
11+
var entity = EventHorizonBlazorInterop.New(
12+
new object[] { new string[] { "ClientObject" } },
13+
data
14+
);
15+
___guid = entity.___guid;
16+
}
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace EventHorizon.Blazor.BabylonJS.Model;
2+
3+
using BABYLON;
4+
using EventHorizon.Blazor.Interop;
5+
6+
public static class SceneExtensions
7+
{
8+
public static void enablePhysics(
9+
this Scene scene,
10+
Vector3 gravity,
11+
IPhysicsEnginePluginV2 plugin
12+
)
13+
{
14+
EventHorizonBlazorInterop.Func<bool>(
15+
new object[] { new string[] { scene.___guid, "enablePhysics" }, gravity, plugin }
16+
);
17+
}
18+
}
Lines changed: 126 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,138 @@
1+
namespace EventHorizon.Blazor.BabylonJS.Model;
2+
13
using System.Text.Json.Serialization;
24
using BABYLON;
35
using EventHorizon.Blazor.Interop;
46

5-
namespace EventHorizon.Blazor.BabylonJS.Model
7+
[JsonConverter(typeof(CachedEntityConverter<SceneLoaderImportMeshEntity>))]
8+
public class SceneLoaderImportMeshEntity : CachedEntity
69
{
7-
[JsonConverter(typeof(CachedEntityConverter<SceneLoaderImportMeshEntity>))]
8-
public class SceneLoaderImportMeshEntity : CachedEntity
10+
public AbstractMesh[] meshes
911
{
10-
public AbstractMesh[] meshes
12+
get
1113
{
12-
get
13-
{
14-
return EventHorizonBlazorInterop.GetArrayClass<AbstractMesh>(
15-
this.___guid,
16-
"meshes",
17-
entity => new AbstractMesh() { ___guid = entity.___guid }
18-
);
19-
}
20-
set { EventHorizonBlazorInterop.Set(this.___guid, "meshes", value); }
14+
return EventHorizonBlazorInterop.GetArrayClass<AbstractMesh>(
15+
this.___guid,
16+
"meshes",
17+
entity => new AbstractMesh() { ___guid = entity.___guid }
18+
);
2119
}
22-
public AnimationGroup[] animationGroups
20+
set { EventHorizonBlazorInterop.Set(this.___guid, "meshes", value); }
21+
}
22+
public AnimationGroup[] animationGroups
23+
{
24+
get
2325
{
24-
get
25-
{
26-
return EventHorizonBlazorInterop.GetArrayClass<AnimationGroup>(
27-
this.___guid,
28-
"animationGroups",
29-
entity => new AnimationGroup() { ___guid = entity.___guid }
30-
);
31-
}
32-
set { EventHorizonBlazorInterop.Set(this.___guid, "animationGroups", value); }
26+
return EventHorizonBlazorInterop.GetArrayClass<AnimationGroup>(
27+
this.___guid,
28+
"animationGroups",
29+
entity => new AnimationGroup() { ___guid = entity.___guid }
30+
);
3331
}
34-
35-
//#region Static Accessors
36-
37-
//#endregion
38-
39-
//#region Static Properties
40-
41-
//#endregion
42-
43-
//#region Static Methods
44-
45-
//#endregion
46-
47-
//#region Accessors
48-
49-
//#endregion
50-
51-
//#region Properties
52-
53-
//public bool isRecording
54-
//{
55-
// get
56-
// {
57-
// return EventHorizonBlazorInterop.Get<bool>(
58-
// this.___guid,
59-
// "isRecording"
60-
// );
61-
// }
62-
// set
63-
// {
64-
65-
// EventHorizonBlazorInterop.Set(
66-
// this.___guid,
67-
// "isRecording",
68-
// value
69-
// );
70-
// }
71-
//}
72-
//#endregion
73-
74-
//#region Constructor
75-
//public HTMLCanvasElementCachedEntity() : base() { }
76-
77-
//public HTMLCanvasElementCachedEntity(
78-
// ICachedEntity entity
79-
//) : base(entity)
80-
//{
81-
//}
82-
83-
84-
//#endregion
85-
86-
//#region Methods
87-
//public void requestPointerLock()
88-
//{
89-
// EventHorizonBlazorInterop.Func<CachedEntity>(
90-
// new object[]
91-
// {
92-
// new string[] { this.___guid, "requestPointerLock" }
93-
// }
94-
// );
95-
//}
96-
97-
//public void msRequestPointerLock()
98-
//{
99-
// EventHorizonBlazorInterop.Func<CachedEntity>(
100-
// new object[]
101-
// {
102-
// new string[] { this.___guid, "msRequestPointerLock" }
103-
// }
104-
// );
105-
//}
106-
107-
//public void mozRequestPointerLock()
108-
//{
109-
// EventHorizonBlazorInterop.Func<CachedEntity>(
110-
// new object[]
111-
// {
112-
// new string[] { this.___guid, "mozRequestPointerLock" }
113-
// }
114-
// );
115-
//}
116-
117-
//public void webkitRequestPointerLock()
118-
//{
119-
// EventHorizonBlazorInterop.Func<CachedEntity>(
120-
// new object[]
121-
// {
122-
// new string[] { this.___guid, "webkitRequestPointerLock" }
123-
// }
124-
// );
125-
//}
126-
127-
//public MediaStream captureStream(System.Nullable<decimal> fps = null)
128-
//{
129-
// return EventHorizonBlazorInterop.FuncClass<MediaStream>(
130-
// entity => new MediaStream() { ___guid = entity.___guid },
131-
// new object[]
132-
// {
133-
// new string[] { this.___guid, "captureStream" }, fps
134-
// }
135-
// );
136-
//}
137-
//#endregion
32+
set { EventHorizonBlazorInterop.Set(this.___guid, "animationGroups", value); }
13833
}
34+
35+
//#region Static Accessors
36+
37+
//#endregion
38+
39+
//#region Static Properties
40+
41+
//#endregion
42+
43+
//#region Static Methods
44+
45+
//#endregion
46+
47+
//#region Accessors
48+
49+
//#endregion
50+
51+
//#region Properties
52+
53+
//public bool isRecording
54+
//{
55+
// get
56+
// {
57+
// return EventHorizonBlazorInterop.Get<bool>(
58+
// this.___guid,
59+
// "isRecording"
60+
// );
61+
// }
62+
// set
63+
// {
64+
65+
// EventHorizonBlazorInterop.Set(
66+
// this.___guid,
67+
// "isRecording",
68+
// value
69+
// );
70+
// }
71+
//}
72+
//#endregion
73+
74+
//#region Constructor
75+
//public HTMLCanvasElementCachedEntity() : base() { }
76+
77+
//public HTMLCanvasElementCachedEntity(
78+
// ICachedEntity entity
79+
//) : base(entity)
80+
//{
81+
//}
82+
83+
84+
//#endregion
85+
86+
//#region Methods
87+
//public void requestPointerLock()
88+
//{
89+
// EventHorizonBlazorInterop.Func<CachedEntity>(
90+
// new object[]
91+
// {
92+
// new string[] { this.___guid, "requestPointerLock" }
93+
// }
94+
// );
95+
//}
96+
97+
//public void msRequestPointerLock()
98+
//{
99+
// EventHorizonBlazorInterop.Func<CachedEntity>(
100+
// new object[]
101+
// {
102+
// new string[] { this.___guid, "msRequestPointerLock" }
103+
// }
104+
// );
105+
//}
106+
107+
//public void mozRequestPointerLock()
108+
//{
109+
// EventHorizonBlazorInterop.Func<CachedEntity>(
110+
// new object[]
111+
// {
112+
// new string[] { this.___guid, "mozRequestPointerLock" }
113+
// }
114+
// );
115+
//}
116+
117+
//public void webkitRequestPointerLock()
118+
//{
119+
// EventHorizonBlazorInterop.Func<CachedEntity>(
120+
// new object[]
121+
// {
122+
// new string[] { this.___guid, "webkitRequestPointerLock" }
123+
// }
124+
// );
125+
//}
126+
127+
//public MediaStream captureStream(System.Nullable<decimal> fps = null)
128+
//{
129+
// return EventHorizonBlazorInterop.FuncClass<MediaStream>(
130+
// entity => new MediaStream() { ___guid = entity.___guid },
131+
// new object[]
132+
// {
133+
// new string[] { this.___guid, "captureStream" }, fps
134+
// }
135+
// );
136+
//}
137+
//#endregion
139138
}

Sample/EventHorizon.Blazor.BabylonJS/Pages/AnimationExample.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void CreateScene()
4343
width = "220px",
4444
fontSize = "14px",
4545
horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_RIGHT,
46-
verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER
46+
verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER,
4747
};
4848
advancedTexture.addControl(UiPanel);
4949

@@ -88,7 +88,7 @@ public void CreateScene()
8888
{
8989
lowerRadiusLimit = 2,
9090
upperRadiusLimit = 10,
91-
wheelDeltaPercentage = 0.01m
91+
wheelDeltaPercentage = 0.01m,
9292
};
9393
scene.activeCamera = camera;
9494
camera.attachControl(false);

Sample/EventHorizon.Blazor.BabylonJS/Pages/Home.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void CreateScene()
4141
{
4242
lowerRadiusLimit = 2,
4343
upperRadiusLimit = 10,
44-
wheelDeltaPercentage = 0.01m
44+
wheelDeltaPercentage = 0.01m,
4545
};
4646
scene.activeCamera = camera;
4747
camera.attachControl(false);

Sample/EventHorizon.Blazor.BabylonJS/Pages/MeshBuilderExample.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void CreateScene()
5757
width = 1,
5858
height = 2,
5959
depth = 3,
60-
faceColors = new List<Color4> { green, green, green, green, blue, red }
60+
faceColors = new List<Color4> { green, green, green, green, blue, red },
6161
};
6262

6363
var box = MeshBuilder.CreateBox("box", options, scene);

0 commit comments

Comments
 (0)