Skip to content

Commit 1d8c573

Browse files
committed
Add support for enabling XR_FB_composition_layer_alpha_blend on the projection layer
1 parent 37e2d10 commit 1d8c573

File tree

4 files changed

+181
-85
lines changed

4 files changed

+181
-85
lines changed

doc_classes/OpenXRFbCompositionLayerAlphaBlendExtension.xml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,37 @@
88
</description>
99
<tutorials>
1010
</tutorials>
11+
<methods>
12+
<method name="is_enabled" qualifiers="const">
13+
<return type="bool" />
14+
<description>
15+
Checks if the extension is enabled or not.
16+
</description>
17+
</method>
18+
</methods>
19+
<members>
20+
<member name="projection_layer_alpha_blend_enabled" type="bool" setter="set_projection_layer_alpha_blend_enabled" getter="is_projection_layer_alpha_blend_enabled">
21+
Enables alpha blending for the projection layer.
22+
</member>
23+
<member name="projection_layer_destination_alpha_blend_factor" type="int" setter="set_projection_layer_destination_alpha_blend_factor" getter="get_projection_layer_destination_alpha_blend_factor" enum="OpenXRFbCompositionLayerAlphaBlendExtension.BlendFactor" default="0">
24+
Determines the destination's contribution to the alpha blending.
25+
</member>
26+
<member name="projection_layer_destination_color_blend_factor" type="int" setter="set_projection_layer_destination_color_blend_factor" getter="get_projection_layer_destination_color_blend_factor" enum="OpenXRFbCompositionLayerAlphaBlendExtension.BlendFactor" default="0">
27+
Determines the destination's contribution to the color blending.
28+
</member>
29+
<member name="projection_layer_source_alpha_blend_factor" type="int" setter="set_projection_layer_source_alpha_blend_factor" getter="get_projection_layer_source_alpha_blend_factor" enum="OpenXRFbCompositionLayerAlphaBlendExtension.BlendFactor" default="1">
30+
Determines the source's contribution to the alpha blending.
31+
</member>
32+
<member name="projection_layer_source_color_blend_factor" type="int" setter="set_projection_layer_source_color_blend_factor" getter="get_projection_layer_source_color_blend_factor" enum="OpenXRFbCompositionLayerAlphaBlendExtension.BlendFactor" default="1">
33+
Determines the source's contribution to the color blending.
34+
</member>
35+
</members>
1136
<constants>
1237
<constant name="BLEND_FACTOR_ZERO" value="0" enum="BlendFactor">
13-
Blending factor set to zero, resulting in no contribution from the source.
38+
Blending factor set to zero, resulting in no contribution.
1439
</constant>
1540
<constant name="BLEND_FACTOR_ONE" value="1" enum="BlendFactor">
16-
Blending factor set to one, resulting in full contribution from the source.
41+
Blending factor set to one, resulting in full contribution.
1742
</constant>
1843
<constant name="BLEND_FACTOR_SRC_ALPHA" value="2" enum="BlendFactor">
1944
Blending factor using the source alpha value.

plugin/src/main/cpp/extensions/openxr_fb_composition_layer_alpha_blend_extension.cpp

Lines changed: 122 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,29 @@ OpenXRFbCompositionLayerAlphaBlendExtension::~OpenXRFbCompositionLayerAlphaBlend
6262
}
6363

6464
void OpenXRFbCompositionLayerAlphaBlendExtension::_bind_methods() {
65+
ClassDB::bind_method(D_METHOD("is_enabled"), &OpenXRFbCompositionLayerAlphaBlendExtension::is_enabled);
66+
67+
ClassDB::bind_method(D_METHOD("set_projection_layer_alpha_blend_enabled", "enabled"), &OpenXRFbCompositionLayerAlphaBlendExtension::set_projection_layer_alpha_blend_enabled);
68+
ClassDB::bind_method(D_METHOD("is_projection_layer_alpha_blend_enabled"), &OpenXRFbCompositionLayerAlphaBlendExtension::is_projection_layer_alpha_blend_enabled);
69+
70+
ClassDB::bind_method(D_METHOD("set_projection_layer_source_color_blend_factor", "source_color_blend_factor"), &OpenXRFbCompositionLayerAlphaBlendExtension::set_projection_layer_source_color_blend_factor);
71+
ClassDB::bind_method(D_METHOD("get_projection_layer_source_color_blend_factor"), &OpenXRFbCompositionLayerAlphaBlendExtension::get_projection_layer_source_color_blend_factor);
72+
73+
ClassDB::bind_method(D_METHOD("set_projection_layer_destination_color_blend_factor", "destination_color_blend_factor"), &OpenXRFbCompositionLayerAlphaBlendExtension::set_projection_layer_destination_color_blend_factor);
74+
ClassDB::bind_method(D_METHOD("get_projection_layer_destination_color_blend_factor"), &OpenXRFbCompositionLayerAlphaBlendExtension::get_projection_layer_destination_color_blend_factor);
75+
76+
ClassDB::bind_method(D_METHOD("set_projection_layer_source_alpha_blend_factor", "source_alpha_blend_factor"), &OpenXRFbCompositionLayerAlphaBlendExtension::set_projection_layer_source_alpha_blend_factor);
77+
ClassDB::bind_method(D_METHOD("get_projection_layer_source_alpha_blend_factor"), &OpenXRFbCompositionLayerAlphaBlendExtension::get_projection_layer_source_alpha_blend_factor);
78+
79+
ClassDB::bind_method(D_METHOD("set_projection_layer_destination_alpha_blend_factor", "destination_alpha_blend_factor"), &OpenXRFbCompositionLayerAlphaBlendExtension::set_projection_layer_destination_alpha_blend_factor);
80+
ClassDB::bind_method(D_METHOD("get_projection_layer_destination_alpha_blend_factor"), &OpenXRFbCompositionLayerAlphaBlendExtension::get_projection_layer_destination_alpha_blend_factor);
81+
82+
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "projection_layer_alpha_blend_enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_projection_layer_alpha_blend_enabled", "is_projection_layer_alpha_blend_enabled");
83+
ADD_PROPERTY(PropertyInfo(Variant::INT, "projection_layer_source_color_blend_factor", PROPERTY_HINT_ENUM, "Zero,One,Source Alpha,One Minus Source Alpha,Destination Alpha,One Minus Destination Alpha"), "set_projection_layer_source_color_blend_factor", "get_projection_layer_source_color_blend_factor");
84+
ADD_PROPERTY(PropertyInfo(Variant::INT, "projection_layer_destination_color_blend_factor", PROPERTY_HINT_ENUM, "Zero,One,Source Alpha,One Minus Source Alpha,Destination Alpha,One Minus Destination Alpha"), "set_projection_layer_destination_color_blend_factor", "get_projection_layer_destination_color_blend_factor");
85+
ADD_PROPERTY(PropertyInfo(Variant::INT, "projection_layer_source_alpha_blend_factor", PROPERTY_HINT_ENUM, "Zero,One,Source Alpha,One Minus Source Alpha,Destination Alpha,One Minus Destination Alpha"), "set_projection_layer_source_alpha_blend_factor", "get_projection_layer_source_alpha_blend_factor");
86+
ADD_PROPERTY(PropertyInfo(Variant::INT, "projection_layer_destination_alpha_blend_factor", PROPERTY_HINT_ENUM, "Zero,One,Source Alpha,One Minus Source Alpha,Destination Alpha,One Minus Destination Alpha"), "set_projection_layer_destination_alpha_blend_factor", "get_projection_layer_destination_alpha_blend_factor");
87+
6588
BIND_ENUM_CONSTANT(BLEND_FACTOR_ZERO);
6689
BIND_ENUM_CONSTANT(BLEND_FACTOR_ONE);
6790
BIND_ENUM_CONSTANT(BLEND_FACTOR_SRC_ALPHA);
@@ -70,6 +93,20 @@ void OpenXRFbCompositionLayerAlphaBlendExtension::_bind_methods() {
7093
BIND_ENUM_CONSTANT(BLEND_FACTOR_ONE_MINUS_DST_ALPHA);
7194
}
7295

96+
void OpenXRFbCompositionLayerAlphaBlendExtension::_on_session_created(uint64_t p_session) {
97+
if (!fb_composition_layer_alpha_blend) {
98+
return;
99+
}
100+
get_openxr_api()->register_projection_layer_extension(this);
101+
}
102+
103+
void OpenXRFbCompositionLayerAlphaBlendExtension::_on_session_destroyed() {
104+
if (!fb_composition_layer_alpha_blend) {
105+
return;
106+
}
107+
get_openxr_api()->unregister_projection_layer_extension(this);
108+
}
109+
73110
void OpenXRFbCompositionLayerAlphaBlendExtension::cleanup() {
74111
fb_composition_layer_alpha_blend = false;
75112
}
@@ -83,6 +120,87 @@ Dictionary OpenXRFbCompositionLayerAlphaBlendExtension::_get_requested_extension
83120
return result;
84121
}
85122

123+
bool OpenXRFbCompositionLayerAlphaBlendExtension::is_enabled() const {
124+
return fb_composition_layer_alpha_blend;
125+
}
126+
127+
void OpenXRFbCompositionLayerAlphaBlendExtension::set_projection_layer_alpha_blend_enabled(bool p_enabled) {
128+
ERR_FAIL_COND_MSG(!fb_composition_layer_alpha_blend, "XR_FB_composition_layer_alpha_blend is not enabled");
129+
projection_layer_alpha_blend_enabled = p_enabled;
130+
}
131+
132+
bool OpenXRFbCompositionLayerAlphaBlendExtension::is_projection_layer_alpha_blend_enabled() const {
133+
return projection_layer_alpha_blend_enabled;
134+
}
135+
136+
void OpenXRFbCompositionLayerAlphaBlendExtension::set_projection_layer_source_color_blend_factor(OpenXRFbCompositionLayerAlphaBlendExtension::BlendFactor p_source_color_blend_factor) {
137+
ERR_FAIL_COND_MSG(!fb_composition_layer_alpha_blend, "XR_FB_composition_layer_alpha_blend is not enabled");
138+
projection_layer_source_color_blend_factor = p_source_color_blend_factor;
139+
}
140+
141+
OpenXRFbCompositionLayerAlphaBlendExtension::BlendFactor OpenXRFbCompositionLayerAlphaBlendExtension::get_projection_layer_source_color_blend_factor() const {
142+
return projection_layer_source_color_blend_factor;
143+
}
144+
145+
void OpenXRFbCompositionLayerAlphaBlendExtension::set_projection_layer_destination_color_blend_factor(OpenXRFbCompositionLayerAlphaBlendExtension::BlendFactor p_destination_color_blend_factor) {
146+
ERR_FAIL_COND_MSG(!fb_composition_layer_alpha_blend, "XR_FB_composition_layer_alpha_blend is not enabled");
147+
projection_layer_destination_color_blend_factor = p_destination_color_blend_factor;
148+
}
149+
150+
OpenXRFbCompositionLayerAlphaBlendExtension::BlendFactor OpenXRFbCompositionLayerAlphaBlendExtension::get_projection_layer_destination_color_blend_factor() const {
151+
return projection_layer_destination_color_blend_factor;
152+
}
153+
154+
void OpenXRFbCompositionLayerAlphaBlendExtension::set_projection_layer_source_alpha_blend_factor(OpenXRFbCompositionLayerAlphaBlendExtension::BlendFactor p_source_alpha_blend_factor) {
155+
ERR_FAIL_COND_MSG(!fb_composition_layer_alpha_blend, "XR_FB_composition_layer_alpha_blend is not enabled");
156+
projection_layer_source_alpha_blend_factor = p_source_alpha_blend_factor;
157+
}
158+
159+
OpenXRFbCompositionLayerAlphaBlendExtension::BlendFactor OpenXRFbCompositionLayerAlphaBlendExtension::get_projection_layer_source_alpha_blend_factor() const {
160+
return projection_layer_source_alpha_blend_factor;
161+
}
162+
163+
void OpenXRFbCompositionLayerAlphaBlendExtension::set_projection_layer_destination_alpha_blend_factor(OpenXRFbCompositionLayerAlphaBlendExtension::BlendFactor p_destination_alpha_blend_factor) {
164+
ERR_FAIL_COND_MSG(!fb_composition_layer_alpha_blend, "XR_FB_composition_layer_alpha_blend is not enabled");
165+
projection_layer_destination_alpha_blend_factor = p_destination_alpha_blend_factor;
166+
}
167+
168+
OpenXRFbCompositionLayerAlphaBlendExtension::BlendFactor OpenXRFbCompositionLayerAlphaBlendExtension::get_projection_layer_destination_alpha_blend_factor() const {
169+
return projection_layer_destination_alpha_blend_factor;
170+
}
171+
172+
XrBlendFactorFB OpenXRFbCompositionLayerAlphaBlendExtension::_from_blend_factor(OpenXRFbCompositionLayerAlphaBlendExtension::BlendFactor p_blend_factor) {
173+
switch (p_blend_factor) {
174+
case BLEND_FACTOR_ZERO:
175+
return XR_BLEND_FACTOR_ZERO_FB;
176+
case BLEND_FACTOR_ONE:
177+
return XR_BLEND_FACTOR_ONE_FB;
178+
case BLEND_FACTOR_SRC_ALPHA:
179+
return XR_BLEND_FACTOR_SRC_ALPHA_FB;
180+
case BLEND_FACTOR_ONE_MINUS_SRC_ALPHA:
181+
return XR_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA_FB;
182+
case BLEND_FACTOR_DST_ALPHA:
183+
return XR_BLEND_FACTOR_DST_ALPHA_FB;
184+
case BLEND_FACTOR_ONE_MINUS_DST_ALPHA:
185+
return XR_BLEND_FACTOR_ONE_MINUS_DST_ALPHA_FB;
186+
}
187+
}
188+
189+
uint64_t OpenXRFbCompositionLayerAlphaBlendExtension::_set_projection_layer_and_get_next_pointer(void *p_next_pointer) {
190+
if (!fb_composition_layer_alpha_blend || !projection_layer_alpha_blend_enabled) {
191+
return reinterpret_cast<uint64_t>(p_next_pointer);
192+
}
193+
194+
projection_layer_alpha_blend.next = p_next_pointer;
195+
196+
projection_layer_alpha_blend.srcFactorColor = _from_blend_factor(projection_layer_source_color_blend_factor);
197+
projection_layer_alpha_blend.dstFactorColor = _from_blend_factor(projection_layer_destination_color_blend_factor);
198+
projection_layer_alpha_blend.srcFactorAlpha = _from_blend_factor(projection_layer_source_alpha_blend_factor);
199+
projection_layer_alpha_blend.dstFactorAlpha = _from_blend_factor(projection_layer_destination_alpha_blend_factor);
200+
201+
return reinterpret_cast<uint64_t>(&projection_layer_alpha_blend);
202+
}
203+
86204
uint64_t OpenXRFbCompositionLayerAlphaBlendExtension::_set_viewport_composition_layer_and_get_next_pointer(const void *p_layer, const Dictionary &p_property_values, void *p_next_pointer) {
87205
if (!fb_composition_layer_alpha_blend || !p_property_values.get(ENABLE_ALPHA_BLEND_EXTENSION_PROPERTY_NAME, false)) {
88206
return reinterpret_cast<uint64_t>(p_next_pointer);
@@ -99,89 +217,10 @@ uint64_t OpenXRFbCompositionLayerAlphaBlendExtension::_set_viewport_composition_
99217

100218
XrCompositionLayerAlphaBlendFB *alpha_blend = layer_structs.getptr(layer);
101219

102-
switch ((BlendFactor)(int)p_property_values.get(SOURCE_COLOR_BLEND_FACTOR_PROPERTY_NAME, BLEND_FACTOR_ONE)) {
103-
case BLEND_FACTOR_ZERO: {
104-
alpha_blend->srcFactorColor = XR_BLEND_FACTOR_ZERO_FB;
105-
} break;
106-
case BLEND_FACTOR_ONE: {
107-
alpha_blend->srcFactorColor = XR_BLEND_FACTOR_ONE_FB;
108-
} break;
109-
case BLEND_FACTOR_SRC_ALPHA: {
110-
alpha_blend->srcFactorColor = XR_BLEND_FACTOR_SRC_ALPHA_FB;
111-
} break;
112-
case BLEND_FACTOR_ONE_MINUS_SRC_ALPHA: {
113-
alpha_blend->srcFactorColor = XR_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA_FB;
114-
} break;
115-
case BLEND_FACTOR_DST_ALPHA: {
116-
alpha_blend->srcFactorColor = XR_BLEND_FACTOR_DST_ALPHA_FB;
117-
} break;
118-
case BLEND_FACTOR_ONE_MINUS_DST_ALPHA: {
119-
alpha_blend->srcFactorColor = XR_BLEND_FACTOR_ONE_MINUS_DST_ALPHA_FB;
120-
} break;
121-
}
122-
123-
switch ((BlendFactor)(int)p_property_values.get(DESTINATION_COLOR_BLEND_FACTOR_PROPERTY_NAME, BLEND_FACTOR_ZERO)) {
124-
case BLEND_FACTOR_ZERO: {
125-
alpha_blend->dstFactorColor = XR_BLEND_FACTOR_ZERO_FB;
126-
} break;
127-
case BLEND_FACTOR_ONE: {
128-
alpha_blend->dstFactorColor = XR_BLEND_FACTOR_ONE_FB;
129-
} break;
130-
case BLEND_FACTOR_SRC_ALPHA: {
131-
alpha_blend->dstFactorColor = XR_BLEND_FACTOR_SRC_ALPHA_FB;
132-
} break;
133-
case BLEND_FACTOR_ONE_MINUS_SRC_ALPHA: {
134-
alpha_blend->dstFactorColor = XR_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA_FB;
135-
} break;
136-
case BLEND_FACTOR_DST_ALPHA: {
137-
alpha_blend->dstFactorColor = XR_BLEND_FACTOR_DST_ALPHA_FB;
138-
} break;
139-
case BLEND_FACTOR_ONE_MINUS_DST_ALPHA: {
140-
alpha_blend->dstFactorColor = XR_BLEND_FACTOR_ONE_MINUS_DST_ALPHA_FB;
141-
} break;
142-
}
143-
144-
switch ((BlendFactor)(int)p_property_values.get(SOURCE_ALPHA_BLEND_FACTOR_PROPERTY_NAME, BLEND_FACTOR_ONE)) {
145-
case BLEND_FACTOR_ZERO: {
146-
alpha_blend->srcFactorAlpha = XR_BLEND_FACTOR_ZERO_FB;
147-
} break;
148-
case BLEND_FACTOR_ONE: {
149-
alpha_blend->srcFactorAlpha = XR_BLEND_FACTOR_ONE_FB;
150-
} break;
151-
case BLEND_FACTOR_SRC_ALPHA: {
152-
alpha_blend->srcFactorAlpha = XR_BLEND_FACTOR_SRC_ALPHA_FB;
153-
} break;
154-
case BLEND_FACTOR_ONE_MINUS_SRC_ALPHA: {
155-
alpha_blend->srcFactorAlpha = XR_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA_FB;
156-
} break;
157-
case BLEND_FACTOR_DST_ALPHA: {
158-
alpha_blend->srcFactorAlpha = XR_BLEND_FACTOR_DST_ALPHA_FB;
159-
} break;
160-
case BLEND_FACTOR_ONE_MINUS_DST_ALPHA: {
161-
alpha_blend->srcFactorAlpha = XR_BLEND_FACTOR_ONE_MINUS_DST_ALPHA_FB;
162-
} break;
163-
}
164-
165-
switch ((BlendFactor)(int)p_property_values.get(DESTINATION_ALPHA_BLEND_FACTOR_PROPERTY_NAME, BLEND_FACTOR_ZERO)) {
166-
case BLEND_FACTOR_ZERO: {
167-
alpha_blend->dstFactorAlpha = XR_BLEND_FACTOR_ZERO_FB;
168-
} break;
169-
case BLEND_FACTOR_ONE: {
170-
alpha_blend->dstFactorAlpha = XR_BLEND_FACTOR_ONE_FB;
171-
} break;
172-
case BLEND_FACTOR_SRC_ALPHA: {
173-
alpha_blend->dstFactorAlpha = XR_BLEND_FACTOR_SRC_ALPHA_FB;
174-
} break;
175-
case BLEND_FACTOR_ONE_MINUS_SRC_ALPHA: {
176-
alpha_blend->dstFactorAlpha = XR_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA_FB;
177-
} break;
178-
case BLEND_FACTOR_DST_ALPHA: {
179-
alpha_blend->dstFactorAlpha = XR_BLEND_FACTOR_DST_ALPHA_FB;
180-
} break;
181-
case BLEND_FACTOR_ONE_MINUS_DST_ALPHA: {
182-
alpha_blend->dstFactorAlpha = XR_BLEND_FACTOR_ONE_MINUS_DST_ALPHA_FB;
183-
} break;
184-
}
220+
alpha_blend->srcFactorColor = _from_blend_factor((BlendFactor)(int)p_property_values.get(SOURCE_COLOR_BLEND_FACTOR_PROPERTY_NAME, BLEND_FACTOR_ONE));
221+
alpha_blend->dstFactorColor = _from_blend_factor((BlendFactor)(int)p_property_values.get(DESTINATION_COLOR_BLEND_FACTOR_PROPERTY_NAME, BLEND_FACTOR_ZERO));
222+
alpha_blend->srcFactorAlpha = _from_blend_factor((BlendFactor)(int)p_property_values.get(SOURCE_ALPHA_BLEND_FACTOR_PROPERTY_NAME, BLEND_FACTOR_ONE));
223+
alpha_blend->dstFactorAlpha = _from_blend_factor((BlendFactor)(int)p_property_values.get(DESTINATION_ALPHA_BLEND_FACTOR_PROPERTY_NAME, BLEND_FACTOR_ZERO));
185224

186225
alpha_blend->next = p_next_pointer;
187226
return reinterpret_cast<uint64_t>(alpha_blend);

plugin/src/main/cpp/include/extensions/openxr_fb_composition_layer_alpha_blend_extension.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,31 @@ class OpenXRFbCompositionLayerAlphaBlendExtension : public OpenXRExtensionWrappe
5555
};
5656

5757
virtual uint64_t _set_viewport_composition_layer_and_get_next_pointer(const void *p_layer, const Dictionary &p_property_values, void *p_next_pointer) override;
58+
virtual uint64_t _set_projection_layer_and_get_next_pointer(void *p_next_pointer) override;
5859
virtual void _on_viewport_composition_layer_destroyed(const void *p_layer) override;
5960
virtual TypedArray<Dictionary> _get_viewport_composition_layer_extension_properties() override;
6061
virtual Dictionary _get_viewport_composition_layer_extension_property_defaults() override;
6162

63+
virtual void _on_session_created(uint64_t p_session) override;
64+
virtual void _on_session_destroyed() override;
65+
6266
bool is_enabled() const;
6367

68+
void set_projection_layer_alpha_blend_enabled(bool p_enabled);
69+
bool is_projection_layer_alpha_blend_enabled() const;
70+
71+
void set_projection_layer_source_color_blend_factor(BlendFactor p_source_color_blend_factor);
72+
BlendFactor get_projection_layer_source_color_blend_factor() const;
73+
74+
void set_projection_layer_destination_color_blend_factor(BlendFactor p_destination_color_blend_factor);
75+
BlendFactor get_projection_layer_destination_color_blend_factor() const;
76+
77+
void set_projection_layer_source_alpha_blend_factor(BlendFactor p_source_alpha_blend_factor);
78+
BlendFactor get_projection_layer_source_alpha_blend_factor() const;
79+
80+
void set_projection_layer_destination_alpha_blend_factor(BlendFactor p_destination_alpha_blend_factor);
81+
BlendFactor get_projection_layer_destination_alpha_blend_factor() const;
82+
6483
OpenXRFbCompositionLayerAlphaBlendExtension();
6584
~OpenXRFbCompositionLayerAlphaBlendExtension();
6685

@@ -69,6 +88,7 @@ class OpenXRFbCompositionLayerAlphaBlendExtension : public OpenXRExtensionWrappe
6988

7089
private:
7190
void cleanup();
91+
XrBlendFactorFB _from_blend_factor(BlendFactor p_blend_factor);
7292

7393
static OpenXRFbCompositionLayerAlphaBlendExtension *singleton;
7494

@@ -77,6 +97,17 @@ class OpenXRFbCompositionLayerAlphaBlendExtension : public OpenXRExtensionWrappe
7797
bool fb_composition_layer_alpha_blend = false;
7898

7999
HashMap<const XrCompositionLayerBaseHeader *, XrCompositionLayerAlphaBlendFB> layer_structs;
100+
101+
XrCompositionLayerAlphaBlendFB projection_layer_alpha_blend = {
102+
XR_TYPE_COMPOSITION_LAYER_ALPHA_BLEND_FB, // type
103+
nullptr // next
104+
};
105+
106+
bool projection_layer_alpha_blend_enabled = false;
107+
BlendFactor projection_layer_source_color_blend_factor = BLEND_FACTOR_ONE;
108+
BlendFactor projection_layer_destination_color_blend_factor = BLEND_FACTOR_ZERO;
109+
BlendFactor projection_layer_source_alpha_blend_factor = BLEND_FACTOR_ONE;
110+
BlendFactor projection_layer_destination_alpha_blend_factor = BLEND_FACTOR_ZERO;
80111
};
81112

82113
VARIANT_ENUM_CAST(OpenXRFbCompositionLayerAlphaBlendExtension::BlendFactor);

plugin/src/main/cpp/register_types.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ void initialize_plugin_module(ModuleInitializationLevel p_level) {
405405
_register_extension_as_singleton(OpenXRFbCompositionLayerDepthTestExtension::get_singleton());
406406
_register_extension_as_singleton(OpenXRFbCompositionLayerImageLayoutExtension::get_singleton());
407407
_register_extension_as_singleton(OpenXRFbCompositionLayerSecureContentExtension::get_singleton());
408+
_register_extension_as_singleton(OpenXRFbCompositionLayerAlphaBlendExtension::get_singleton());
408409

409410
// @todo GH Issue 304: Remove check for meta headers when feature becomes part of OpenXR spec.
410411
#ifdef META_HEADERS_ENABLED

0 commit comments

Comments
 (0)