You've already forked godot
							
							
				mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-04 12:00:25 +00:00 
			
		
		
		
	Some old APIs that may expect a Vector4 instead require a Plane: this is pretty confusing especially with tangents as one could interpret the API as wanting a value directly representing the tangent plane when in reality the Plane type is just used to carry one Vector3 and one extra sign component. This commit attempts to clear any potential confusion by adding a note to the APIs using Planes in such a way.
		
			
				
	
	
		
			105 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			105 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
<?xml version="1.0" encoding="UTF-8" ?>
 | 
						|
<class name="ImmediateMesh" inherits="Mesh" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
 | 
						|
	<brief_description>
 | 
						|
		Mesh optimized for creating geometry manually.
 | 
						|
	</brief_description>
 | 
						|
	<description>
 | 
						|
		A mesh type optimized for creating geometry manually, similar to OpenGL 1.x immediate mode.
 | 
						|
		Here's a sample on how to generate a triangular face:
 | 
						|
		[codeblocks]
 | 
						|
		[gdscript]
 | 
						|
		var mesh = ImmediateMesh.new()
 | 
						|
		mesh.surface_begin(Mesh.PRIMITIVE_TRIANGLES)
 | 
						|
		mesh.surface_add_vertex(Vector3.LEFT)
 | 
						|
		mesh.surface_add_vertex(Vector3.FORWARD)
 | 
						|
		mesh.surface_add_vertex(Vector3.ZERO)
 | 
						|
		mesh.surface_end()
 | 
						|
		[/gdscript]
 | 
						|
		[csharp]
 | 
						|
		var mesh = new ImmediateMesh();
 | 
						|
		mesh.SurfaceBegin(Mesh.PrimitiveType.Triangles);
 | 
						|
		mesh.SurfaceAddVertex(Vector3.Left);
 | 
						|
		mesh.SurfaceAddVertex(Vector3.Forward);
 | 
						|
		mesh.SurfaceAddVertex(Vector3.Zero);
 | 
						|
		mesh.SurfaceEnd();
 | 
						|
		[/csharp]
 | 
						|
		[/codeblocks]
 | 
						|
		[b]Note:[/b] Generating complex geometries with [ImmediateMesh] is highly inefficient. Instead, it is designed to generate simple geometry that changes often.
 | 
						|
	</description>
 | 
						|
	<tutorials>
 | 
						|
		<link title="Using ImmediateMesh">$DOCS_URL/tutorials/3d/procedural_geometry/immediatemesh.html</link>
 | 
						|
	</tutorials>
 | 
						|
	<methods>
 | 
						|
		<method name="clear_surfaces">
 | 
						|
			<return type="void" />
 | 
						|
			<description>
 | 
						|
				Clear all surfaces.
 | 
						|
			</description>
 | 
						|
		</method>
 | 
						|
		<method name="surface_add_vertex">
 | 
						|
			<return type="void" />
 | 
						|
			<param index="0" name="vertex" type="Vector3" />
 | 
						|
			<description>
 | 
						|
				Add a 3D vertex using the current attributes previously set.
 | 
						|
			</description>
 | 
						|
		</method>
 | 
						|
		<method name="surface_add_vertex_2d">
 | 
						|
			<return type="void" />
 | 
						|
			<param index="0" name="vertex" type="Vector2" />
 | 
						|
			<description>
 | 
						|
				Add a 2D vertex using the current attributes previously set.
 | 
						|
			</description>
 | 
						|
		</method>
 | 
						|
		<method name="surface_begin">
 | 
						|
			<return type="void" />
 | 
						|
			<param index="0" name="primitive" type="int" enum="Mesh.PrimitiveType" />
 | 
						|
			<param index="1" name="material" type="Material" default="null" />
 | 
						|
			<description>
 | 
						|
				Begin a new surface.
 | 
						|
			</description>
 | 
						|
		</method>
 | 
						|
		<method name="surface_end">
 | 
						|
			<return type="void" />
 | 
						|
			<description>
 | 
						|
				End and commit current surface. Note that surface being created will not be visible until this function is called.
 | 
						|
			</description>
 | 
						|
		</method>
 | 
						|
		<method name="surface_set_color">
 | 
						|
			<return type="void" />
 | 
						|
			<param index="0" name="color" type="Color" />
 | 
						|
			<description>
 | 
						|
				Set the color attribute that will be pushed with the next vertex.
 | 
						|
			</description>
 | 
						|
		</method>
 | 
						|
		<method name="surface_set_normal">
 | 
						|
			<return type="void" />
 | 
						|
			<param index="0" name="normal" type="Vector3" />
 | 
						|
			<description>
 | 
						|
				Set the normal attribute that will be pushed with the next vertex.
 | 
						|
			</description>
 | 
						|
		</method>
 | 
						|
		<method name="surface_set_tangent">
 | 
						|
			<return type="void" />
 | 
						|
			<param index="0" name="tangent" type="Plane" />
 | 
						|
			<description>
 | 
						|
				Set the tangent attribute that will be pushed with the next vertex.
 | 
						|
				[b]Note:[/b] Even though [param tangent] is a [Plane], it does not directly represent the tangent plane. Its [member Plane.x], [member Plane.y], and [member Plane.z] represent the tangent vector and [member Plane.d] should be either [code]-1[/code] or [code]1[/code]. See also [constant Mesh.ARRAY_TANGENT].
 | 
						|
			</description>
 | 
						|
		</method>
 | 
						|
		<method name="surface_set_uv">
 | 
						|
			<return type="void" />
 | 
						|
			<param index="0" name="uv" type="Vector2" />
 | 
						|
			<description>
 | 
						|
				Set the UV attribute that will be pushed with the next vertex.
 | 
						|
			</description>
 | 
						|
		</method>
 | 
						|
		<method name="surface_set_uv2">
 | 
						|
			<return type="void" />
 | 
						|
			<param index="0" name="uv2" type="Vector2" />
 | 
						|
			<description>
 | 
						|
				Set the UV2 attribute that will be pushed with the next vertex.
 | 
						|
			</description>
 | 
						|
		</method>
 | 
						|
	</methods>
 | 
						|
</class>
 |