-
Notifications
You must be signed in to change notification settings - Fork 520
RealityKit macOS xcode16.0 b1
Rolf Bjarne Kvinge edited this page Sep 3, 2024
·
2 revisions
#RealityKit.framework https://github.com/xamarin/xamarin-macios/issues/6239
diff -ruN /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitGeometryModifier.h /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitGeometryModifier.h
--- /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitGeometryModifier.h 2024-04-13 22:48:28
+++ /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitGeometryModifier.h 2024-05-30 08:21:38
@@ -77,8 +77,35 @@
RK_API float2 uv1(thread geometry_data_t &data);
RK_API void set_uv1(float2 value, thread geometry_data_t &data);
+RK_API float4 uv2(thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API float4 uv3(thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API float4 uv4(thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API float4 uv5(thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API float4 uv6(thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API float4 uv7(thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
+RK_API void set_uv2(float4 value, thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API void set_uv3(float4 value, thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API void set_uv4(float4 value, thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API void set_uv5(float4 value, thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API void set_uv6(float4 value, thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API void set_uv7(float4 value, thread geometry_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
RK_API float4 custom_attribute(thread geometry_data_t &data);
RK_API void set_custom_attribute(float4 value, thread geometry_data_t &data);
+
+RK_API thread hover_state_t &hover_state(thread geometry_data_t &data);
+
+// Hover State
+
+RK_API float hover_intensity(thread hover_state_t &) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
+RK_API float3 hover_position(thread hover_state_t &) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
+RK_API float time_since_hover_start(thread hover_state_t &) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
+RK_API bool is_active(thread hover_state_t &) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
}
// MARK: - Uniforms
@@ -214,6 +241,35 @@
thread geometry_data_t &data;
};
+// MARK: - Hover State
+
+struct hover_state
+{
+ RK_INLINE hover_state(thread hover_state_t &_data)
+ : data(_data)
+ {
+ }
+
+ RK_INLINE float hover_intensity() thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15 {
+ return api::hover_intensity(data);
+ }
+
+ RK_INLINE float3 hover_position() thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15 {
+ return api::hover_position(data);
+ }
+
+ RK_INLINE float time_since_hover_start() thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15 {
+ return api::time_since_hover_start(data);
+ }
+
+ RK_INLINE bool is_active() thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15 {
+ return api::is_active(data);
+ }
+
+private:
+ thread hover_state_t &data;
+};
+
// MARK: - Geometry
/// Geometry gives you access to values contained on each vertex within a model,
@@ -347,6 +403,78 @@
geometry_modifier::api::set_uv1(value, data);
}
+ /// Returns uv2 for the current vertex, if any.
+ RK_INLINE float4 uv2() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return geometry_modifier::api::uv2(data);
+ }
+
+ /// Sets uv2 for the current vertex.
+ RK_INLINE void set_uv2(float4 value) thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ geometry_modifier::api::set_uv2(value, data);
+ }
+
+ /// Returns uv3 for the current vertex, if any.
+ RK_INLINE float4 uv3() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return geometry_modifier::api::uv3(data);
+ }
+
+ /// Sets uv3 for the current vertex.
+ RK_INLINE void set_uv3(float4 value) thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ geometry_modifier::api::set_uv3(value, data);
+ }
+
+ /// Returns uv4 for the current vertex, if any.
+ RK_INLINE float4 uv4() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return geometry_modifier::api::uv4(data);
+ }
+
+ /// Sets uv4 for the current vertex.
+ RK_INLINE void set_uv4(float4 value) thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ geometry_modifier::api::set_uv4(value, data);
+ }
+
+ /// Returns uv5 for the current vertex, if any.
+ RK_INLINE float4 uv5() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return geometry_modifier::api::uv5(data);
+ }
+
+ /// Sets uv5 for the current vertex.
+ RK_INLINE void set_uv5(float4 value) thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ geometry_modifier::api::set_uv5(value, data);
+ }
+
+ /// Returns uv6 for the current vertex, if any.
+ RK_INLINE float4 uv6() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return geometry_modifier::api::uv6(data);
+ }
+
+ /// Sets uv6 for the current vertex.
+ RK_INLINE void set_uv6(float4 value) thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ geometry_modifier::api::set_uv6(value, data);
+ }
+
+ /// Returns uv7 for the current vertex, if any.
+ RK_INLINE float4 uv7() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return geometry_modifier::api::uv7(data);
+ }
+
+ /// Sets uv7 for the current vertex.
+ RK_INLINE void set_uv7(float4 value) thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ geometry_modifier::api::set_uv7(value, data);
+ }
+
/// Returns any user-specified attribute on the current vertex.
///
/// Defaults to `(0,0,0,0)` unless previously set via set_custom_attribute.
@@ -359,6 +487,12 @@
RK_INLINE void set_custom_attribute(float4 value) thread
{
geometry_modifier::api::set_custom_attribute(value, data);
+ }
+
+ RK_INLINE hover_state hover_state() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+
+ {
+ return geometry_modifier::api::hover_state(data);
}
private:
diff -ruN /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitSurfaceShader.h /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitSurfaceShader.h
--- /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitSurfaceShader.h 2024-04-13 21:52:15
+++ /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitSurfaceShader.h 2024-05-30 12:45:43
@@ -57,9 +57,18 @@
RK_API float3 geometry_tangent(thread surface_data_t &data);
RK_API float3 geometry_bitangent(thread surface_data_t &data);
+///
RK_API float2 uv0(thread surface_data_t &data);
RK_API float2 uv1(thread surface_data_t &data);
+/// UV2-7 have 4-channels each
+RK_API float4 uv2(thread surface_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API float4 uv3(thread surface_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API float4 uv4(thread surface_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API float4 uv5(thread surface_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API float4 uv6(thread surface_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API float4 uv7(thread surface_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
RK_API float4 custom_attribute(thread surface_data_t &data);
// Surface
@@ -76,6 +85,8 @@
RK_API half roughness(thread surface_data_t &data);
RK_API void set_roughness(half value, thread surface_data_t &data);
+RK_API thread hover_state_t &hover_state(thread surface_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
RK_API half metallic(thread surface_data_t &data);
RK_API void set_metallic(half value, thread surface_data_t &data);
@@ -94,6 +105,29 @@
RK_API half clearcoat_roughness(thread surface_data_t &data);
RK_API void set_clearcoat_roughness(half value, thread surface_data_t &data);
+// clearcoat normal
+RK_API half3 clearcoat_normal(thread surface_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+RK_API void set_clearcoat_normal(half3 value, thread surface_data_t &data) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
+// Hover State
+
+RK_API void environment_radiance(thread surface_data_t &data,
+ thread half3 &diffuseRadiance,
+ thread half3 &specularRadiance,
+ half3 baseColor,
+ half roughness,
+ half specular,
+ half metallic,
+ float3 normal) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
+RK_API float hover_intensity(thread hover_state_t &) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
+RK_API float3 hover_position(thread hover_state_t &) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
+RK_API float time_since_hover_start(thread hover_state_t &) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
+RK_API bool is_active(thread hover_state_t &) RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15;
+
} // namespace api
// MARK: - Uniforms
@@ -158,6 +192,35 @@
thread surface::surface_data_t &data;
};
+// MARK: - Hover State
+
+struct hover_state
+{
+ RK_INLINE hover_state(thread hover_state_t &_data)
+ : data(_data)
+ {
+ }
+
+ RK_INLINE float hover_intensity() thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15 {
+ return api::hover_intensity(data);
+ }
+
+ RK_INLINE float3 hover_position() thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15 {
+ return api::hover_position(data);
+ }
+
+ RK_INLINE float time_since_hover_start() thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15 {
+ return api::time_since_hover_start(data);
+ }
+
+ RK_INLINE bool is_active() thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15 {
+ return api::is_active(data);
+ }
+
+private:
+ thread hover_state_t &data;
+};
+
// MARK: - Geometry
/// Geometry properties for a surface shader.
@@ -232,6 +295,42 @@
return surface::api::uv1(data);
}
+ /// Returns the interpolated uv2 for the current fragment.
+ RK_INLINE float4 uv2() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return surface::api::uv2(data);
+ }
+
+ /// Returns the interpolated uv3 for the current fragment.
+ RK_INLINE float4 uv3() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return surface::api::uv3(data);
+ }
+
+ /// Returns the interpolated uv4 for the current fragment.
+ RK_INLINE float4 uv4() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return surface::api::uv4(data);
+ }
+
+ /// Returns the interpolated uv5 for the current fragment.
+ RK_INLINE float4 uv5() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return surface::api::uv5(data);
+ }
+
+ /// Returns the interpolated uv6 for the current fragment.
+ RK_INLINE float4 uv6() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return surface::api::uv6(data);
+ }
+
+ /// Returns the interpolated uv7 for the current fragment.
+ RK_INLINE float4 uv7() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return surface::api::uv7(data);
+ }
+
/// Returns a user attribute set by a geometry modifier.
///
/// You set this value in a geometry modifier and the value is interpolated per-fragment,
@@ -251,6 +350,57 @@
thread surface::surface_data_t &data;
};
+/// Lighting evaluation for a surface shader
+struct lighting
+{
+ RK_INLINE lighting(thread surface::surface_data_t &_data)
+ : data(_data)
+ {
+ }
+
+ /// Radiance broken down into diffuse and specular components.
+ struct separated_radiance
+ {
+ half3 diffuse;
+ half3 specular;
+ };
+
+ /// Returns reflected radiance in respose to environment lighting
+ ///
+ /// @discussion This function convolves environment lighting with RealityKit's physically based material model, resulting in
+ /// a reflected radiance, reflected from the surface fragment to the eye. The radiance is returned in separate
+ /// components, which are typically summed for total radiance.
+ ///
+ /// @param base_color RGB color of the surface for convolving (integrating) the environment lighting
+ /// @param roughness Roughness value used for convolving (integrating) the envirnment lighting
+ /// @param metallic Mteallic value used for convolving (integrating) the envirnment lighting
+ /// @param specular Scale for an additional highlight comonent associated with the environment
+ /// @param normal The worldspace normal used for convolving environment lighting.
+ /// This would typically be the surface normal,
+ ///
+ RK_INLINE separated_radiance environment_radiance(half3 base_color,
+ half roughness,
+ half metallic,
+ half specular,
+ float3 normal) const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+
+ {
+ half3 diffuse_radiance;
+ half3 specular_radiance;
+ surface::api::environment_radiance(data,
+ diffuse_radiance,
+ specular_radiance,
+ base_color,
+ roughness,
+ specular,
+ metallic,
+ normal);
+ return { diffuse_radiance, specular_radiance };
+ }
+private:
+ thread surface::surface_data_t &data;
+};
+
// MARK: - Surface Properties
/// Surface properties for a surface shader.
@@ -377,6 +527,12 @@
return surface::api::roughness(data);
}
+ RK_INLINE hover_state hover_state() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+
+ {
+ return surface::api::hover_state(data);
+ }
+
/// Set the roughness value of this fragment.
RK_INLINE void set_roughness(half value) thread
{
@@ -463,7 +619,23 @@
{
surface::api::set_clearcoat_roughness(value, data);
}
+
+ /// Returns any previously set clearcoat normal for this fragment. The default value is (0,0,1).
+ RK_INLINE half3 clearcoat_normal() const thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return surface::api::clearcoat_normal(data);
+ }
+ /// Set the clearcoat normal for this fragment.
+ ///
+ /// @discussion This requires that the CustomMaterial's lighting model is clearcoat, otherwise
+ /// its value will be ignored. You can set this value to influence lighting calculations. The value will
+ /// be normalized before storing.
+ RK_INLINE void set_clearcoat_normal(half3 value) thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ surface::api::set_clearcoat_normal(metal::normalize(value), data);
+ }
+
private:
thread surface::surface_data_t &data;
};
@@ -524,6 +696,12 @@
RK_INLINE surface::surface_properties surface() thread
{
return surface::surface_properties(data);
+ }
+
+ /// Returns results after applying lighting.
+ RK_INLINE surface::lighting lighting() thread RK_AVAILABILITY_IOS_18 RK_AVAILABILITY_MACOS_15
+ {
+ return surface::lighting(data);
}
/// Returns the textures associated with this model, allowing you to retrieve
diff -ruN /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitTextures.h /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitTextures.h
--- /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitTextures.h 2024-04-13 16:12:30
+++ /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitTextures.h 2024-05-30 12:36:40
@@ -89,6 +89,7 @@
RK_API metal::texture2d<half> specular(thread texture_data_t &data);
RK_API metal::texture2d<half> clearcoat(thread texture_data_t &data);
RK_API metal::texture2d<half> clearcoat_roughness(thread texture_data_t &data);
+RK_API metal::texture2d<half> clearcoat_normal(thread texture_data_t &data);
RK_API metal::texture2d<half> custom(thread texture_data_t &data);
} // namespace api
@@ -201,6 +202,15 @@
RK_INLINE metal::texture2d<half> clearcoat_roughness() const thread
{
return texture::api::clearcoat_roughness(data);
+ }
+
+ /// Returns any clearcoat normal texture assigned to the model.
+ ///
+ /// If no texture is assigned, returns a texture containing a blue color,
+ /// representing a default clearcoat normal.
+ RK_INLINE metal::texture2d<half> clearcoat_normal() const thread
+ {
+ return texture::api::clearcoat_normal(data);
}
/// Returns a custom texture you have previously set on the CustomMaterial. You can use
diff -ruN /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitTypes.h /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitTypes.h
--- /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitTypes.h 2024-04-13 21:52:15
+++ /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/RealityKit.framework/Headers/RealityKitTypes.h 2024-05-30 08:21:38
@@ -14,27 +14,25 @@
#warning "Metal version 2.3 is required for surface shaders"
#endif
-#if RK_BUILD_TIME_LINKING
+#define RK_API [[visible]]
-// Temporary flags during experimentation or development on older OS'es. In this
-// mode, the shader is linked at compile-time.
-#define RK_API extern
#define RK_INLINE inline __attribute__((__always_inline__))
-#else
+#ifndef RK_INTERNAL_STRIP_OUT_AVAILABILITY
-#if __HAVE_VISIBLE_FUNCTIONS__
-#define RK_API [[visible]]
+#define RK_AVAILABILITY_IOS_18 __attribute__((availability(ios, introduced=18.0, strict)))
+#define RK_AVAILABILITY_MACOS_15 __attribute__((availability(macos, introduced=15.0, strict)))
+
#else
-#define RK_API
-#endif
-#define RK_INLINE inline __attribute__((__always_inline__))
+#define RK_AVAILABILITY_IOS_18
+#define RK_AVAILABILITY_MACOS_15
#endif
-
namespace realitykit
{
+
+struct hover_state_t;
namespace geometry_modifier
{