Skip to content

Commit 7e927d2

Browse files
authored
Merge pull request #29 from canhorn/feature/promise-data-type
Added Promise Support!
2 parents ec2f2ec + e71e4a9 commit 7e927d2

File tree

412 files changed

+69733
-45262
lines changed

Some content is hidden

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

412 files changed

+69733
-45262
lines changed

.github/workflows/dotnet-package.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
with:
1616
fetch-depth: '0'
1717
- name: Install GitVersion
18-
uses: gittools/actions/gitversion/[email protected].4
18+
uses: gittools/actions/gitversion/[email protected].6
1919
with:
20-
versionSpec: '5.3.x'
20+
versionSpec: '5.x'
2121
- name: Use GitVersion
22-
id: gitversion # step id used as reference for output values
23-
uses: gittools/actions/gitversion/[email protected].4
22+
id: gitversion
23+
uses: gittools/actions/gitversion/[email protected].6
2424
with:
2525
additionalArguments: '/updateAssemblyInfo'
2626
- run: |

.github/workflows/main-tag-bump.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
with:
1414
fetch-depth: '0'
1515
- name: Install GitVersion
16-
uses: gittools/actions/gitversion/[email protected].4
16+
uses: gittools/actions/gitversion/[email protected].6
1717
with:
18-
versionSpec: '5.3.x'
18+
versionSpec: '5.x'
1919
- name: Use GitVersion
20-
id: gitversion # step id used as reference for output values
21-
uses: gittools/actions/gitversion/[email protected].4
20+
id: gitversion
21+
uses: gittools/actions/gitversion/[email protected].6
2222
- run: |
2323
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.NuGetVersionV2 }}"
2424
- name: Bump version and push tag

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

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ static void Main(string[] args)
5858
"PointerInfo",
5959
"PointerInfoBase",
6060
"SceneLoader",
61+
"ParticleHelper",
62+
"Sound",
63+
"Tools",
6164
};
6265

6366
// Remove any already Generated Source.

Sample/EventHorizon.BabylonJS.Interop.Generator.ConsoleApp/SourceFiles/babylon.d.ts

+45,962-37,942
Large diffs are not rendered by default.

Sample/EventHorizon.BabylonJS.Interop.Generator.ConsoleApp/SourceFiles/babylon.gui.d.ts

+194-99
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using EventHorizon.Blazor.Interop;
2+
3+
namespace EventHorizon.Blazor.Interop
4+
{
5+
public static class CachedEntityExtensions
6+
{
7+
public static T ToEntity<T>(
8+
this CachedEntity entity
9+
) where T : CachedEntity, new()
10+
{
11+
return new T() { ___guid = entity.___guid };
12+
}
13+
}
14+
}
15+
16+
namespace BabylonJS
17+
{
18+
public static class BabylonjsNodeExtensions
19+
{
20+
public static void setParent(
21+
this Node node,
22+
string elementId
23+
)
24+
{
25+
EventHorizonBlazorInterop.FuncClass<CachedEntity>(
26+
entity => new CachedEntity() { ___guid = entity.___guid },
27+
new object[]
28+
{
29+
new string[] { node.___guid, "setParent" },
30+
elementId
31+
}
32+
);
33+
}
34+
35+
public static T clone<T>(
36+
this Node node,
37+
string name
38+
) where T : CachedEntity, new()
39+
{
40+
return EventHorizonBlazorInterop.FuncClass<T>(
41+
entity => new T() { ___guid = entity.___guid },
42+
new object[]
43+
{
44+
new string[] { node.___guid, "clone" },
45+
name
46+
}
47+
);
48+
}
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System.Text.Json.Serialization;
2+
using EventHorizon.Blazor.Interop;
3+
4+
namespace EventHorizon.Blazor.BabylonJS.Model
5+
{
6+
[JsonConverter(typeof(CachedEntityConverter<NodeMetadata>))]
7+
public class NodeMetadata
8+
: CachedEntity
9+
{
10+
public NodeMetadata()
11+
{
12+
var entity = EventHorizonBlazorInterop.New(
13+
new object[]
14+
{
15+
new string[] { "NodeMetadata" }
16+
}
17+
);
18+
___guid = entity.___guid;
19+
}
20+
21+
public string name
22+
{
23+
get
24+
{
25+
return EventHorizonBlazorInterop.Get<string>(
26+
this.___guid,
27+
"name"
28+
);
29+
}
30+
set
31+
{
32+
EventHorizonBlazorInterop.Set(
33+
this.___guid,
34+
"name",
35+
value
36+
);
37+
}
38+
}
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
using System.Text.Json.Serialization;
2+
using BabylonJS;
3+
using EventHorizon.Blazor.Interop;
4+
5+
namespace EventHorizon.Blazor.BabylonJS.Model
6+
{
7+
[JsonConverter(typeof(CachedEntityConverter<SceneLoaderImportMeshEntity>))]
8+
public class SceneLoaderImportMeshEntity
9+
: CachedEntity
10+
{
11+
public AbstractMesh[] meshes
12+
{
13+
get
14+
{
15+
return EventHorizonBlazorInterop.GetArrayClass<AbstractMesh>(
16+
this.___guid,
17+
"meshes",
18+
entity => new AbstractMesh() { ___guid = entity.___guid }
19+
);
20+
}
21+
set
22+
{
23+
EventHorizonBlazorInterop.Set(
24+
this.___guid,
25+
"meshes",
26+
value
27+
);
28+
}
29+
}
30+
public AnimationGroup[] animationGroups
31+
{
32+
get
33+
{
34+
return EventHorizonBlazorInterop.GetArrayClass<AnimationGroup>(
35+
this.___guid,
36+
"animationGroups",
37+
entity => new AnimationGroup() { ___guid = entity.___guid }
38+
);
39+
}
40+
set
41+
{
42+
EventHorizonBlazorInterop.Set(
43+
this.___guid,
44+
"animationGroups",
45+
value
46+
);
47+
}
48+
}
49+
50+
//#region Static Accessors
51+
52+
//#endregion
53+
54+
//#region Static Properties
55+
56+
//#endregion
57+
58+
//#region Static Methods
59+
60+
//#endregion
61+
62+
//#region Accessors
63+
64+
//#endregion
65+
66+
//#region Properties
67+
68+
//public bool isRecording
69+
//{
70+
// get
71+
// {
72+
// return EventHorizonBlazorInterop.Get<bool>(
73+
// this.___guid,
74+
// "isRecording"
75+
// );
76+
// }
77+
// set
78+
// {
79+
80+
// EventHorizonBlazorInterop.Set(
81+
// this.___guid,
82+
// "isRecording",
83+
// value
84+
// );
85+
// }
86+
//}
87+
//#endregion
88+
89+
//#region Constructor
90+
//public HTMLCanvasElementCachedEntity() : base() { }
91+
92+
//public HTMLCanvasElementCachedEntity(
93+
// ICachedEntity entity
94+
//) : base(entity)
95+
//{
96+
//}
97+
98+
99+
//#endregion
100+
101+
//#region Methods
102+
//public void requestPointerLock()
103+
//{
104+
// EventHorizonBlazorInterop.Func<CachedEntity>(
105+
// new object[]
106+
// {
107+
// new string[] { this.___guid, "requestPointerLock" }
108+
// }
109+
// );
110+
//}
111+
112+
//public void msRequestPointerLock()
113+
//{
114+
// EventHorizonBlazorInterop.Func<CachedEntity>(
115+
// new object[]
116+
// {
117+
// new string[] { this.___guid, "msRequestPointerLock" }
118+
// }
119+
// );
120+
//}
121+
122+
//public void mozRequestPointerLock()
123+
//{
124+
// EventHorizonBlazorInterop.Func<CachedEntity>(
125+
// new object[]
126+
// {
127+
// new string[] { this.___guid, "mozRequestPointerLock" }
128+
// }
129+
// );
130+
//}
131+
132+
//public void webkitRequestPointerLock()
133+
//{
134+
// EventHorizonBlazorInterop.Func<CachedEntity>(
135+
// new object[]
136+
// {
137+
// new string[] { this.___guid, "webkitRequestPointerLock" }
138+
// }
139+
// );
140+
//}
141+
142+
//public MediaStream captureStream(System.Nullable<decimal> fps = null)
143+
//{
144+
// return EventHorizonBlazorInterop.FuncClass<MediaStream>(
145+
// entity => new MediaStream() { ___guid = entity.___guid },
146+
// new object[]
147+
// {
148+
// new string[] { this.___guid, "captureStream" }, fps
149+
// }
150+
// );
151+
//}
152+
//#endregion
153+
}
154+
}

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using BabylonJS;
66
using BabylonJS.GUI;
77
using EventHorizon.Blazor.BabylonJS.Model;
8+
using EventHorizon.Blazor.Interop.Callbacks;
89

910
namespace EventHorizon.Blazor.BabylonJS.Pages
1011
{
@@ -39,6 +40,7 @@ public void CreateScene()
3940
var scene = new Scene(
4041
engine
4142
);
43+
scene.clearColor = new Color4(0, 0, 0, 0);
4244
var light0 = new PointLight(
4345
"Omni",
4446
new Vector3(
@@ -72,7 +74,7 @@ public void CreateScene()
7274
"assets/",
7375
"Player.glb",
7476
scene,
75-
new Interop.Callbacks.ActionCallback<AbstractMesh[], IParticleSystem[], Skeleton[], AnimationGroup[]>((arg1, arg2, arg3, arg4) =>
77+
new Interop.Callbacks.ActionCallback<AbstractMesh[], IParticleSystem[], Skeleton[], AnimationGroup[], TransformNode[], Geometry[], Light[]>((arg1, arg2, arg3, arg4, arg5, arg6, arg7) =>
7678
{
7779
foreach (var animation in arg4)
7880
{
@@ -106,10 +108,11 @@ public void CreateScene()
106108
};
107109
scene.activeCamera = camera;
108110
camera.attachControl(
109-
canvas,
110111
false
111112
);
112-
engine.runRenderLoop(() => Task.Run(() => scene.render(true, false)));
113+
engine.runRenderLoop(new ActionCallback(
114+
() => Task.Run(() => scene.render(true, false))
115+
));
113116

114117
_engine = engine;
115118
}

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using BabylonJS;
66
using BabylonJS.GUI;
77
using EventHorizon.Blazor.BabylonJS.Model;
8+
using EventHorizon.Blazor.Interop.Callbacks;
89

910
namespace EventHorizon.Blazor.BabylonJS.Pages
1011
{
@@ -98,10 +99,13 @@ public void CreateScene()
9899
};
99100
scene.activeCamera = freeCamera;
100101
freeCamera.attachControl(
101-
canvas,
102102
false
103103
);
104-
engine.runRenderLoop(() => Task.Run(() => scene.render(true, false)));
104+
engine.runRenderLoop(
105+
new ActionCallback(
106+
() => Task.Run(() => scene.render(true, false))
107+
)
108+
);
105109

106110
_engine = engine;
107111
}

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Threading.Tasks;
55
using BabylonJS;
66
using EventHorizon.Blazor.BabylonJS.Model;
7+
using EventHorizon.Blazor.Interop.Callbacks;
78

89
namespace EventHorizon.Blazor.BabylonJS.Pages
910
{
@@ -75,10 +76,11 @@ public void CreateScene()
7576
};
7677
scene.activeCamera = camera;
7778
camera.attachControl(
78-
canvas,
7979
false
8080
);
81-
engine.runRenderLoop(() => Task.Run(() => scene.render(true, false)));
81+
engine.runRenderLoop(new ActionCallback(
82+
() => Task.Run(() => scene.render(true, false))
83+
));
8284

8385
_engine = engine;
8486
}

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Threading.Tasks;
55
using BabylonJS;
66
using EventHorizon.Blazor.BabylonJS.Model;
7+
using EventHorizon.Blazor.Interop.Callbacks;
78

89
namespace EventHorizon.Blazor.BabylonJS.Pages
910
{
@@ -77,10 +78,11 @@ public void CreateScene()
7778
};
7879
scene.activeCamera = freeCamera;
7980
freeCamera.attachControl(
80-
canvas,
8181
false
8282
);
83-
engine.runRenderLoop(() => Task.Run(() => scene.render(true, false)));
83+
engine.runRenderLoop(new ActionCallback(
84+
() => Task.Run(() => scene.render(true, false))
85+
));
8486

8587
_engine = engine;
8688
}

0 commit comments

Comments
 (0)