浏览代码

Rename Transform to Transform3D in GDNative

Aaron Franke 5 年之前
父节点
当前提交
39e28c49ed

+ 4 - 4
modules/gdnative/gdnative/transform.cpp → modules/gdnative/gdnative/transform_3d.cpp

@@ -28,21 +28,21 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 
-#include "gdnative/transform.h"
+#include "gdnative/transform_3d.h"
 
 #include "core/math/transform_3d.h"
 
-static_assert(sizeof(godot_transform) == sizeof(Transform3D), "Transform3D size mismatch");
+static_assert(sizeof(godot_transform3d) == sizeof(Transform3D), "Transform3D size mismatch");
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-void GDAPI godot_transform_new(godot_transform *p_self) {
+void GDAPI godot_transform3d_new(godot_transform3d *p_self) {
 	memnew_placement(p_self, Transform3D);
 }
 
-void GDAPI godot_transform_new_copy(godot_transform *r_dest, const godot_transform *p_src) {
+void GDAPI godot_transform3d_new_copy(godot_transform3d *r_dest, const godot_transform3d *p_src) {
 	memnew_placement(r_dest, Transform3D(*(Transform3D *)p_src));
 }
 

+ 3 - 3
modules/gdnative/gdnative/variant.cpp

@@ -161,7 +161,7 @@ void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_b
 	memnew_placement_custom(dest, Variant, Variant(*basis));
 }
 
-void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans) {
+void GDAPI godot_variant_new_transform3d(godot_variant *r_dest, const godot_transform3d *p_trans) {
 	Variant *dest = (Variant *)r_dest;
 	const Transform3D *trans = (const Transform3D *)p_trans;
 	memnew_placement_custom(dest, Variant, Variant(*trans));
@@ -402,8 +402,8 @@ godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self) {
 	return raw_dest;
 }
 
-godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self) {
-	godot_transform raw_dest;
+godot_transform3d GDAPI godot_variant_as_transform3d(const godot_variant *p_self) {
+	godot_transform3d raw_dest;
 	const Variant *self = (const Variant *)p_self;
 	Transform3D *dest = (Transform3D *)&raw_dest;
 	*dest = *self;

+ 11 - 11
modules/gdnative/gdnative_api.json

@@ -511,7 +511,7 @@
 				]
 			},
 			{
-				"name": "godot_variant_new_transform",
+				"name": "godot_variant_new_transform3d",
 				"return_type": "void",
 				"arguments": [
 					[
@@ -519,7 +519,7 @@
 						"r_dest"
 					],
 					[
-						"const godot_transform *",
+						"const godot_transform3d *",
 						"p_trans"
 					]
 				]
@@ -923,8 +923,8 @@
 				]
 			},
 			{
-				"name": "godot_variant_as_transform",
-				"return_type": "godot_transform",
+				"name": "godot_variant_as_transform3d",
+				"return_type": "godot_transform3d",
 				"arguments": [
 					[
 						"const godot_variant *",
@@ -4344,25 +4344,25 @@
 				]
 			},
 			{
-				"name": "godot_transform_new",
+				"name": "godot_transform3d_new",
 				"return_type": "void",
 				"arguments": [
 					[
-						"godot_transform *",
+						"godot_transform3d *",
 						"r_dest"
 					]
 				]
 			},
 			{
-				"name": "godot_transform_new_copy",
+				"name": "godot_transform3d_new_copy",
 				"return_type": "void",
 				"arguments": [
 					[
-						"godot_transform *",
+						"godot_transform3d *",
 						"r_dest"
 					],
 					[
-						"const godot_transform *",
+						"const godot_transform3d *",
 						"p_src"
 					]
 				]
@@ -5073,7 +5073,7 @@
 				},
 				{
 					"name": "godot_xr_get_reference_frame",
-					"return_type": "godot_transform",
+					"return_type": "godot_transform3d",
 					"arguments": []
 				},
 				{
@@ -5145,7 +5145,7 @@
 							"p_controller_id"
 						],
 						[
-							"godot_transform *",
+							"godot_transform3d *",
 							"p_transform"
 						],
 						[

+ 2 - 2
modules/gdnative/include/gdnative/gdnative.h

@@ -161,9 +161,9 @@ typedef void godot_object;
 
 #include <gdnative/basis.h>
 
-/////// Transform
+/////// Transform3D
 
-#include <gdnative/transform.h>
+#include <gdnative/transform_3d.h>
 
 /////// Color
 

+ 12 - 10
modules/gdnative/include/gdnative/transform.h → modules/gdnative/include/gdnative/transform_3d.h

@@ -28,8 +28,8 @@
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 
-#ifndef GODOT_TRANSFORM_H
-#define GODOT_TRANSFORM_H
+#ifndef GODOT_TRANSFORM3D_H
+#define GODOT_TRANSFORM3D_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -37,22 +37,24 @@ extern "C" {
 
 #include <gdnative/math_defs.h>
 
-#define GODOT_TRANSFORM_SIZE (sizeof(godot_real_t) * 12)
+#define GODOT_TRANSFORM3D_SIZE (sizeof(godot_real_t) * 12)
 
-#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
-#define GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
+#ifndef GODOT_CORE_API_GODOT_TRANSFORM3D_TYPE_DEFINED
+#define GODOT_CORE_API_GODOT_TRANSFORM3D_TYPE_DEFINED
 typedef struct {
-	uint8_t _dont_touch_that[GODOT_TRANSFORM_SIZE];
-} godot_transform;
+	uint8_t _dont_touch_that[GODOT_TRANSFORM3D_SIZE];
+} godot_transform3d;
 #endif
 
 #include <gdnative/gdnative.h>
 
-void GDAPI godot_transform_new(godot_transform *p_self);
-void GDAPI godot_transform_new_copy(godot_transform *r_dest, const godot_transform *p_src);
+void GDAPI godot_transform3d_new(godot_transform3d *p_self);
+void GDAPI godot_transform3d_new_copy(godot_transform3d *r_dest, const godot_transform3d *p_src);
+godot_vector3 GDAPI *godot_transform3d_operator_index(godot_transform3d *p_self, godot_int p_index);
+const godot_vector3 GDAPI *godot_transform3d_operator_index_const(const godot_transform3d *p_self, godot_int p_index);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif // GODOT_TRANSFORM_H
+#endif // GODOT_TRANSFORM3D_H

+ 3 - 3
modules/gdnative/include/gdnative/variant.h

@@ -183,8 +183,8 @@ typedef void (*godot_ptr_utility_function)(void *r_return, const void **p_argume
 #include <gdnative/signal.h>
 #include <gdnative/string.h>
 #include <gdnative/string_name.h>
-#include <gdnative/transform.h>
 #include <gdnative/transform2d.h>
+#include <gdnative/transform_3d.h>
 #include <gdnative/variant.h>
 #include <gdnative/vector2.h>
 #include <gdnative/vector3.h>
@@ -211,7 +211,7 @@ void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_p
 void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat);
 void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb);
 void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis);
-void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans);
+void GDAPI godot_variant_new_transform3d(godot_variant *r_dest, const godot_transform3d *p_trans);
 void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color);
 void GDAPI godot_variant_new_string_name(godot_variant *r_dest, const godot_string_name *p_s);
 void GDAPI godot_variant_new_node_path(godot_variant *r_dest, const godot_node_path *p_np);
@@ -246,7 +246,7 @@ godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self);
 godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self);
 godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self);
 godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self);
-godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self);
+godot_transform3d GDAPI godot_variant_as_transform3d(const godot_variant *p_self);
 godot_color GDAPI godot_variant_as_color(const godot_variant *p_self);
 godot_string_name GDAPI godot_variant_as_string_name(const godot_variant *p_self);
 godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_self);

+ 3 - 3
modules/gdnative/include/xr/godot_xr.h

@@ -57,7 +57,7 @@ typedef struct {
 	godot_bool (*initialize)(void *);
 	void (*uninitialize)(void *);
 	godot_vector2 (*get_render_targetsize)(const void *);
-	godot_transform (*get_transform_for_eye)(void *, godot_int, godot_transform *);
+	godot_transform3d (*get_transform_for_eye)(void *, godot_int, godot_transform3d *);
 	void (*fill_projection_for_eye)(void *, godot_float *, godot_int, godot_float, godot_float, godot_float);
 	void (*commit_for_eye)(void *, godot_int, godot_rid *, godot_rect2 *);
 	void (*process)(void *);
@@ -70,7 +70,7 @@ void GDAPI godot_xr_register_interface(const godot_xr_interface_gdnative *p_inte
 
 // helper functions to access XRServer data
 godot_float GDAPI godot_xr_get_worldscale();
-godot_transform GDAPI godot_xr_get_reference_frame();
+godot_transform3d GDAPI godot_xr_get_reference_frame();
 
 // helper functions for rendering
 void GDAPI godot_xr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect);
@@ -79,7 +79,7 @@ godot_int GDAPI godot_xr_get_texid(godot_rid *p_render_target);
 // helper functions for updating XR controllers
 godot_int GDAPI godot_xr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position);
 void GDAPI godot_xr_remove_controller(godot_int p_controller_id);
-void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position);
+void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform3d *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position);
 void GDAPI godot_xr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed);
 void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_float p_value, godot_bool p_can_be_negative);
 godot_float GDAPI godot_xr_get_controller_rumble(godot_int p_controller_id);

+ 4 - 4
modules/gdnative/xr/xr_interface_gdnative.cpp

@@ -178,7 +178,7 @@ Transform3D XRInterfaceGDNative::get_transform_for_eye(XRInterface::Eyes p_eye,
 
 	ERR_FAIL_COND_V(interface == nullptr, Transform3D());
 
-	godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform);
+	godot_transform3d t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform3d *)&p_cam_transform);
 
 	ret = (Transform3D *)&t;
 
@@ -241,8 +241,8 @@ godot_float GDAPI godot_xr_get_worldscale() {
 	return xr_server->get_world_scale();
 }
 
-godot_transform GDAPI godot_xr_get_reference_frame() {
-	godot_transform reference_frame;
+godot_transform3d GDAPI godot_xr_get_reference_frame() {
+	godot_transform3d reference_frame;
 	Transform3D *reference_frame_ptr = (Transform3D *)&reference_frame;
 
 	XRServer *xr_server = XRServer::get_singleton();
@@ -356,7 +356,7 @@ void GDAPI godot_xr_remove_controller(godot_int p_controller_id) {
 	}
 }
 
-void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position) {
+void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform3d *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position) {
 	XRServer *xr_server = XRServer::get_singleton();
 	ERR_FAIL_NULL(xr_server);