feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
from misc.utility.scons_hints import *
|
||||
|
||||
Import("env")
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "core/input/input.h"
|
||||
|
||||
void XRControllerTracker::_bind_methods(){};
|
||||
void XRControllerTracker::_bind_methods() {}
|
||||
|
||||
XRControllerTracker::XRControllerTracker() {
|
||||
type = XRServer::TRACKER_CONTROLLER;
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include "xr_hand_tracker.h"
|
||||
|
||||
#include "xr_body_tracker.h"
|
||||
|
||||
void XRHandTracker::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_has_tracking_data", "has_data"), &XRHandTracker::set_has_tracking_data);
|
||||
ClassDB::bind_method(D_METHOD("get_has_tracking_data"), &XRHandTracker::get_has_tracking_data);
|
||||
|
|
@ -60,6 +58,7 @@ void XRHandTracker::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(HAND_TRACKING_SOURCE_UNKNOWN);
|
||||
BIND_ENUM_CONSTANT(HAND_TRACKING_SOURCE_UNOBSTRUCTED);
|
||||
BIND_ENUM_CONSTANT(HAND_TRACKING_SOURCE_CONTROLLER);
|
||||
BIND_ENUM_CONSTANT(HAND_TRACKING_SOURCE_NOT_TRACKED);
|
||||
BIND_ENUM_CONSTANT(HAND_TRACKING_SOURCE_MAX);
|
||||
|
||||
BIND_ENUM_CONSTANT(HAND_JOINT_PALM);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public:
|
|||
HAND_TRACKING_SOURCE_UNKNOWN,
|
||||
HAND_TRACKING_SOURCE_UNOBSTRUCTED,
|
||||
HAND_TRACKING_SOURCE_CONTROLLER,
|
||||
HAND_TRACKING_SOURCE_NOT_TRACKED,
|
||||
HAND_TRACKING_SOURCE_MAX
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
/**************************************************************************/
|
||||
|
||||
#include "xr_interface.h"
|
||||
#include "servers/rendering/renderer_compositor.h"
|
||||
|
||||
void XRInterface::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("play_area_changed", PropertyInfo(Variant::INT, "mode")));
|
||||
|
|
@ -108,7 +107,7 @@ void XRInterface::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(XR_ENV_BLEND_MODE_OPAQUE);
|
||||
BIND_ENUM_CONSTANT(XR_ENV_BLEND_MODE_ADDITIVE);
|
||||
BIND_ENUM_CONSTANT(XR_ENV_BLEND_MODE_ALPHA_BLEND);
|
||||
};
|
||||
}
|
||||
|
||||
bool XRInterface::is_primary() {
|
||||
XRServer *xr_server = XRServer::get_singleton();
|
||||
|
|
@ -155,7 +154,7 @@ PackedVector3Array XRInterface::get_play_area() const {
|
|||
// Note implementation is responsible for applying our reference frame and world scale to the raw data.
|
||||
// `play_area_changed` should be emitted if play area data is available and either the reference frame or world scale changes.
|
||||
return PackedVector3Array();
|
||||
};
|
||||
}
|
||||
|
||||
/** these will only be implemented on AR interfaces, so we want dummies for VR **/
|
||||
bool XRInterface::get_anchor_detection_is_enabled() const {
|
||||
|
|
@ -187,6 +186,18 @@ RID XRInterface::get_velocity_texture() {
|
|||
return RID();
|
||||
}
|
||||
|
||||
RID XRInterface::get_velocity_depth_texture() {
|
||||
return RID();
|
||||
}
|
||||
|
||||
Size2i XRInterface::get_velocity_target_size() {
|
||||
return Size2i();
|
||||
}
|
||||
|
||||
Rect2i XRInterface::get_render_region() {
|
||||
return Rect2i();
|
||||
}
|
||||
|
||||
PackedStringArray XRInterface::get_suggested_tracker_names() const {
|
||||
PackedStringArray arr;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ struct BlitToScreen;
|
|||
The idea is that we subclass this class, implement the logic, and then instantiate a singleton of each interface
|
||||
when Godot starts. These instances do not initialize themselves but register themselves with the AR/VR server.
|
||||
|
||||
If the user wants to enable AR/VR the choose the interface they want to use and initialize it.
|
||||
If the user wants to enable AR/VR, they can choose the interface they want to use and initialize it.
|
||||
|
||||
Note that we may make this into a fully instantiable class for GDExtension support.
|
||||
*/
|
||||
|
|
@ -137,10 +137,13 @@ public:
|
|||
virtual RID get_color_texture(); /* obtain color output texture (if applicable) */
|
||||
virtual RID get_depth_texture(); /* obtain depth output texture (if applicable, used for reprojection) */
|
||||
virtual RID get_velocity_texture(); /* obtain velocity output texture (if applicable, used for spacewarp) */
|
||||
virtual void pre_render(){};
|
||||
virtual bool pre_draw_viewport(RID p_render_target) { return true; }; /* inform XR interface we are about to start our viewport draw process */
|
||||
virtual RID get_velocity_depth_texture();
|
||||
virtual Size2i get_velocity_target_size();
|
||||
virtual Rect2i get_render_region();
|
||||
virtual void pre_render() {}
|
||||
virtual bool pre_draw_viewport(RID p_render_target) { return true; } /* inform XR interface we are about to start our viewport draw process */
|
||||
virtual Vector<BlitToScreen> post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) = 0; /* inform XR interface we finished our viewport draw process */
|
||||
virtual void end_frame(){};
|
||||
virtual void end_frame() {}
|
||||
|
||||
/** passthrough **/
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "xr_interface_extension.h"
|
||||
#include "servers/rendering/renderer_rd/storage_rd/texture_storage.h"
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
|
||||
void XRInterfaceExtension::_bind_methods() {
|
||||
GDVIRTUAL_BIND(_get_name);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "xr_positional_tracker.h"
|
||||
|
||||
#include "core/input/input.h"
|
||||
#include "xr_controller_tracker.h"
|
||||
|
||||
void XRPositionalTracker::_bind_methods() {
|
||||
|
|
@ -61,7 +60,7 @@ void XRPositionalTracker::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("input_float_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::FLOAT, "value")));
|
||||
ADD_SIGNAL(MethodInfo("input_vector2_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::VECTOR2, "vector")));
|
||||
ADD_SIGNAL(MethodInfo("profile_changed", PropertyInfo(Variant::STRING, "role")));
|
||||
};
|
||||
}
|
||||
|
||||
void XRPositionalTracker::set_tracker_profile(const String &p_profile) {
|
||||
if (profile != p_profile) {
|
||||
|
|
@ -77,12 +76,12 @@ String XRPositionalTracker::get_tracker_profile() const {
|
|||
|
||||
XRPositionalTracker::TrackerHand XRPositionalTracker::get_tracker_hand() const {
|
||||
return tracker_hand;
|
||||
};
|
||||
}
|
||||
|
||||
void XRPositionalTracker::set_tracker_hand(const XRPositionalTracker::TrackerHand p_hand) {
|
||||
ERR_FAIL_INDEX(p_hand, TRACKER_HAND_MAX);
|
||||
tracker_hand = p_hand;
|
||||
};
|
||||
}
|
||||
|
||||
bool XRPositionalTracker::has_pose(const StringName &p_action_name) const {
|
||||
return poses.has(p_action_name);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
#define XR_POSITIONAL_TRACKER_H
|
||||
|
||||
#include "core/os/thread_safe.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "servers/xr/xr_pose.h"
|
||||
#include "servers/xr/xr_tracker.h"
|
||||
#include "servers/xr_server.h"
|
||||
|
|
|
|||
|
|
@ -42,24 +42,24 @@ void XRTracker::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_tracker_desc"), &XRTracker::get_tracker_desc);
|
||||
ClassDB::bind_method(D_METHOD("set_tracker_desc", "description"), &XRTracker::set_tracker_desc);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "description"), "set_tracker_desc", "get_tracker_desc");
|
||||
};
|
||||
}
|
||||
|
||||
void XRTracker::set_tracker_type(XRServer::TrackerType p_type) {
|
||||
type = p_type;
|
||||
};
|
||||
}
|
||||
|
||||
XRServer::TrackerType XRTracker::get_tracker_type() const {
|
||||
return type;
|
||||
};
|
||||
}
|
||||
|
||||
void XRTracker::set_tracker_name(const StringName &p_name) {
|
||||
// Note: this should not be changed after the tracker is registered with the XRServer!
|
||||
name = p_name;
|
||||
};
|
||||
}
|
||||
|
||||
StringName XRTracker::get_tracker_name() const {
|
||||
return name;
|
||||
};
|
||||
}
|
||||
|
||||
void XRTracker::set_tracker_desc(const String &p_desc) {
|
||||
description = p_desc;
|
||||
|
|
|
|||
|
|
@ -40,8 +40,12 @@ void XRVRS::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_vrs_strength"), &XRVRS::get_vrs_strength);
|
||||
ClassDB::bind_method(D_METHOD("set_vrs_strength", "strength"), &XRVRS::set_vrs_strength);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_vrs_render_region"), &XRVRS::get_vrs_render_region);
|
||||
ClassDB::bind_method(D_METHOD("set_vrs_render_region", "render_region"), &XRVRS::set_vrs_render_region);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "vrs_min_radius", PROPERTY_HINT_RANGE, "1.0,100.0,1.0"), "set_vrs_min_radius", "get_vrs_min_radius");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "vrs_strength", PROPERTY_HINT_RANGE, "0.1,10.0,0.1"), "set_vrs_strength", "get_vrs_strength");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RECT2I, "vrs_render_region"), "set_vrs_render_region", "get_vrs_render_region");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("make_vrs_texture", "target_size", "eye_foci"), &XRVRS::make_vrs_texture);
|
||||
}
|
||||
|
|
@ -88,6 +92,15 @@ void XRVRS::set_vrs_strength(float p_vrs_strength) {
|
|||
}
|
||||
}
|
||||
|
||||
Rect2i XRVRS::get_vrs_render_region() const {
|
||||
return vrs_render_region;
|
||||
}
|
||||
|
||||
void XRVRS::set_vrs_render_region(const Rect2i &p_vrs_render_region) {
|
||||
vrs_render_region = p_vrs_render_region;
|
||||
vrs_dirty = true;
|
||||
}
|
||||
|
||||
RID XRVRS::make_vrs_texture(const Size2 &p_target_size, const PackedVector2Array &p_eye_foci) {
|
||||
ERR_FAIL_COND_V(p_eye_foci.is_empty(), RID());
|
||||
|
||||
|
|
@ -123,19 +136,26 @@ RID XRVRS::make_vrs_texture(const Size2 &p_target_size, const PackedVector2Array
|
|||
target_size = vrs_sizei;
|
||||
eye_foci = p_eye_foci;
|
||||
|
||||
Size2 region_ratio = Size2(1.0, 1.0);
|
||||
Point2i region_offset;
|
||||
if (vrs_render_region != Rect2i()) {
|
||||
region_ratio = (Size2)vrs_render_region.size / p_target_size;
|
||||
region_offset = (Point2)vrs_render_region.position / p_target_size * vrs_sizei;
|
||||
}
|
||||
|
||||
for (int i = 0; i < eye_foci.size() && i < RendererSceneRender::MAX_RENDER_VIEWS; i++) {
|
||||
PackedByteArray data;
|
||||
data.resize(vrs_sizei.x * vrs_sizei.y * 2);
|
||||
uint8_t *data_ptr = data.ptrw();
|
||||
|
||||
Vector2i view_center;
|
||||
view_center.x = int(vrs_size.x * (eye_foci[i].x + 1.0) * 0.5);
|
||||
view_center.y = int(vrs_size.y * (eye_foci[i].y + 1.0) * 0.5);
|
||||
view_center.x = int(vrs_size.x * (eye_foci[i].x + 1.0) * region_ratio.x * 0.5) + region_offset.x;
|
||||
view_center.y = int(vrs_size.y * (eye_foci[i].y + 1.0) * region_ratio.y * 0.5) + region_offset.y;
|
||||
|
||||
int d = 0;
|
||||
for (int y = 0; y < vrs_sizei.y; y++) {
|
||||
for (int x = 0; x < vrs_sizei.x; x++) {
|
||||
Vector2 offset = Vector2(x - view_center.x, y - view_center.y);
|
||||
Vector2 offset = Vector2(x - view_center.x, y - view_center.y) / region_ratio;
|
||||
real_t density = 255.0 * MAX(0.0, (Math::abs(offset.x) - min_radius) / outer_radius);
|
||||
data_ptr[d++] = MIN(255, density);
|
||||
density = 255.0 * MAX(0.0, (Math::abs(offset.y) - min_radius) / outer_radius);
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class XRVRS : public Object {
|
|||
private:
|
||||
float vrs_min_radius = 20.0;
|
||||
float vrs_strength = 1.0;
|
||||
Rect2i vrs_render_region;
|
||||
bool vrs_dirty = true;
|
||||
|
||||
RID vrs_texture;
|
||||
|
|
@ -60,6 +61,8 @@ public:
|
|||
void set_vrs_min_radius(float p_vrs_min_radius);
|
||||
float get_vrs_strength() const;
|
||||
void set_vrs_strength(float p_vrs_strength);
|
||||
Rect2i get_vrs_render_region() const;
|
||||
void set_vrs_render_region(const Rect2i &p_vrs_render_region);
|
||||
|
||||
RID make_vrs_texture(const Size2 &p_target_size, const PackedVector2Array &p_eye_foci);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue