Add QuadMesh back as a subclass of PlaneMesh.
This simplifies the creation of billboarded meshes without any code overhead.
This commit is contained in:
parent
99e06740cf
commit
87710517fa
|
@ -31,10 +31,10 @@
|
||||||
[PlaneMesh] will face the positive X-axis.
|
[PlaneMesh] will face the positive X-axis.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="FACE_Y" value="1" enum="Orientation">
|
<constant name="FACE_Y" value="1" enum="Orientation">
|
||||||
[PlaneMesh] will face the positive Y-axis. This matches the behaviour of the [PlaneMesh] in Godot 3.x.
|
[PlaneMesh] will face the positive Y-axis. This matches the behavior of the [PlaneMesh] in Godot 3.x.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="FACE_Z" value="2" enum="Orientation">
|
<constant name="FACE_Z" value="2" enum="Orientation">
|
||||||
[PlaneMesh] will face the positive Z-axis. This matches the behvaiour of the QuadMesh in Godot 3.x.
|
[PlaneMesh] will face the positive Z-axis. This matches the behavior of the QuadMesh in Godot 3.x.
|
||||||
</constant>
|
</constant>
|
||||||
</constants>
|
</constants>
|
||||||
</class>
|
</class>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<class name="QuadMesh" inherits="PlaneMesh" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
||||||
|
<brief_description>
|
||||||
|
Class representing a square mesh facing the camera.
|
||||||
|
</brief_description>
|
||||||
|
<description>
|
||||||
|
Class representing a square [PrimitiveMesh]. This flat mesh does not have a thickness. By default, this mesh is aligned on the X and Y axes; this rotation is more suited for use with billboarded materials. A [QuadMesh] is equivalent to a [PlaneMesh] except its default [member PlaneMesh.orientation] is [constant PlaneMesh.FACE_Z].
|
||||||
|
</description>
|
||||||
|
<tutorials>
|
||||||
|
<link title="GUI in 3D Demo">https://godotengine.org/asset-library/asset/127</link>
|
||||||
|
<link title="2D in 3D Demo">https://godotengine.org/asset-library/asset/129</link>
|
||||||
|
</tutorials>
|
||||||
|
<members>
|
||||||
|
<member name="orientation" type="int" setter="set_orientation" getter="get_orientation" overrides="PlaneMesh" enum="PlaneMesh.Orientation" default="2" />
|
||||||
|
</members>
|
||||||
|
</class>
|
|
@ -794,6 +794,7 @@ void register_scene_types() {
|
||||||
GDREGISTER_CLASS(CylinderMesh);
|
GDREGISTER_CLASS(CylinderMesh);
|
||||||
GDREGISTER_CLASS(PlaneMesh);
|
GDREGISTER_CLASS(PlaneMesh);
|
||||||
GDREGISTER_CLASS(PrismMesh);
|
GDREGISTER_CLASS(PrismMesh);
|
||||||
|
GDREGISTER_CLASS(QuadMesh);
|
||||||
GDREGISTER_CLASS(SphereMesh);
|
GDREGISTER_CLASS(SphereMesh);
|
||||||
GDREGISTER_CLASS(TextMesh);
|
GDREGISTER_CLASS(TextMesh);
|
||||||
GDREGISTER_CLASS(TorusMesh);
|
GDREGISTER_CLASS(TorusMesh);
|
||||||
|
@ -959,7 +960,6 @@ void register_scene_types() {
|
||||||
ClassDB::add_compatibility_class("Navigation3D", "Node3D");
|
ClassDB::add_compatibility_class("Navigation3D", "Node3D");
|
||||||
ClassDB::add_compatibility_class("Navigation2D", "Node2D");
|
ClassDB::add_compatibility_class("Navigation2D", "Node2D");
|
||||||
ClassDB::add_compatibility_class("OpenSimplexNoise", "FastNoiseLite");
|
ClassDB::add_compatibility_class("OpenSimplexNoise", "FastNoiseLite");
|
||||||
ClassDB::add_compatibility_class("QuadMesh", "PlaneMesh");
|
|
||||||
ClassDB::add_compatibility_class("ToolButton", "Button");
|
ClassDB::add_compatibility_class("ToolButton", "Button");
|
||||||
ClassDB::add_compatibility_class("YSort", "Node2D");
|
ClassDB::add_compatibility_class("YSort", "Node2D");
|
||||||
// Portal and room occlusion was replaced by raster occlusion (OccluderInstance3D node).
|
// Portal and room occlusion was replaced by raster occlusion (OccluderInstance3D node).
|
||||||
|
|
|
@ -262,6 +262,18 @@ public:
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(PlaneMesh::Orientation)
|
VARIANT_ENUM_CAST(PlaneMesh::Orientation)
|
||||||
|
|
||||||
|
/*
|
||||||
|
A flat rectangle, inherits from PlaneMesh but defaults to facing the Z-plane.
|
||||||
|
*/
|
||||||
|
class QuadMesh : public PlaneMesh {
|
||||||
|
GDCLASS(QuadMesh, PlaneMesh);
|
||||||
|
|
||||||
|
public:
|
||||||
|
QuadMesh() {
|
||||||
|
set_orientation(FACE_Z);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A prism shapen, handy for ramps, triangles, etc.
|
A prism shapen, handy for ramps, triangles, etc.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue