@@ -12,6 +12,20 @@ type AmbientLight3D = {
1212 Intensity: float32
1313}
1414
15+ /// <summary >Convenience builders for <see cref =" T:Mibo.Elmish.Graphics3D.AmbientLight3D " />.</summary >
16+ module AmbientLight3D =
17+
18+ /// <summary >Creates an ambient light. Defaults: Intensity=1.</summary >
19+ let create ( color : Color ) : AmbientLight3D = {
20+ Color = color
21+ Intensity = 1.0 f
22+ }
23+
24+ let inline withIntensity ( v : float32 ) ( l : AmbientLight3D ) = {
25+ l with
26+ Intensity = v
27+ }
28+
1529/// <summary >Directional light configuration for 3D scenes.</summary >
1630[<Struct>]
1731type DirectionalLight3D = {
@@ -32,6 +46,29 @@ type DirectionalLight3D = {
3246 CastsShadows: bool
3347}
3448
49+ /// <summary >Convenience builders for <see cref =" T:Mibo.Elmish.Graphics3D.DirectionalLight3D " />.</summary >
50+ module DirectionalLight3D =
51+
52+ /// <summary >Creates a directional light. Defaults: Color=White, Intensity=1, CastsShadows=true.</summary >
53+ let create ( direction : Vector3 ) : DirectionalLight3D = {
54+ Direction = direction
55+ Color = Color.White
56+ Intensity = 1.0 f
57+ CastsShadows = true
58+ }
59+
60+ let inline withColor ( v : Color ) ( l : DirectionalLight3D ) = { l with Color = v }
61+
62+ let inline withIntensity ( v : float32 ) ( l : DirectionalLight3D ) = {
63+ l with
64+ Intensity = v
65+ }
66+
67+ let inline withCastsShadows ( v : bool ) ( l : DirectionalLight3D ) = {
68+ l with
69+ CastsShadows = v
70+ }
71+
3572/// <summary >Point light configuration for 3D scenes.</summary >
3673[<Struct>]
3774type PointLight3D = {
@@ -61,6 +98,30 @@ type PointLight3D = {
6198 ShadowBias: float32 voption
6299}
63100
101+ /// <summary >Convenience builders for <see cref =" T:Mibo.Elmish.Graphics3D.PointLight3D " />.</summary >
102+ module PointLight3D =
103+
104+ /// <summary >Creates a point light. Defaults: Color=White, CastsShadows=false, ShadowBias=None.</summary >
105+ let create ( position : Vector3 , radius : float32 ) : PointLight3D = {
106+ Position = position
107+ Color = Color.White
108+ Radius = radius
109+ CastsShadows = false
110+ ShadowBias = ValueNone
111+ }
112+
113+ let inline withColor ( v : Color ) ( l : PointLight3D ) = { l with Color = v }
114+
115+ let inline withCastsShadows ( v : bool ) ( l : PointLight3D ) = {
116+ l with
117+ CastsShadows = v
118+ }
119+
120+ let inline withShadowBias ( v : float32 ) ( l : PointLight3D ) = {
121+ l with
122+ ShadowBias = ValueSome v
123+ }
124+
64125/// <summary >Spot light configuration for cone-shaped lights with distance attenuation.</summary >
65126[<Struct>]
66127type SpotLight3D = {
@@ -97,3 +158,45 @@ type SpotLight3D = {
97158 /// </remarks >
98159 ShadowBias: float32 voption
99160}
161+
162+ /// <summary >Convenience builders for <see cref =" T:Mibo.Elmish.Graphics3D.SpotLight3D " />.</summary >
163+ module SpotLight3D =
164+
165+ /// <summary >Creates a spot light. Defaults: Color=White, Intensity=1, InnerCutoff=0.5, OuterCutoff=0.7, CastsShadows=false, ShadowBias=None.</summary >
166+ let create
167+ ( position : Vector3 , direction : Vector3 , radius : float32 )
168+ : SpotLight3D =
169+ {
170+ Position = position
171+ Direction = direction
172+ Color = Color.White
173+ Intensity = 1.0 f
174+ Radius = radius
175+ InnerCutoff = 0.5 f
176+ OuterCutoff = 0.7 f
177+ CastsShadows = false
178+ ShadowBias = ValueNone
179+ }
180+
181+ let inline withColor ( v : Color ) ( l : SpotLight3D ) = { l with Color = v }
182+
183+ let inline withIntensity ( v : float32 ) ( l : SpotLight3D ) = {
184+ l with
185+ Intensity = v
186+ }
187+
188+ let inline withCutoff ( inner : float32 ) ( outer : float32 ) ( l : SpotLight3D ) = {
189+ l with
190+ InnerCutoff = inner
191+ OuterCutoff = outer
192+ }
193+
194+ let inline withCastsShadows ( v : bool ) ( l : SpotLight3D ) = {
195+ l with
196+ CastsShadows = v
197+ }
198+
199+ let inline withShadowBias ( v : float32 ) ( l : SpotLight3D ) = {
200+ l with
201+ ShadowBias = ValueSome v
202+ }
0 commit comments