[−][src]Struct gdnative::api::SurfaceTool
core class SurfaceTool
inherits Reference
(reference counted).
Official documentation
See the documentation of this class in the Godot engine's official documentation.
Memory management
The lifetime of this object is automatically managed through reference counting.
Class hierarchy
SurfaceTool inherits methods from:
Safety
All types in the Godot API have "interior mutability" in Rust parlance.
To enforce that the official thread-safety guidelines are
followed, the typestate pattern is used in the Ref
and TRef
smart pointers,
and the Instance
API. The typestate Access
in these types tracks whether the
access is unique, shared, or exclusive to the current thread. For more information,
see the type-level documentation on Ref
.
Implementations
impl SurfaceTool
[src]
pub fn new() -> Ref<SurfaceTool, Unique>
[src]
Creates a new instance of this object.
This is a reference-counted type. The returned object is automatically managed
by Ref
.
pub fn add_bones(&self, bones: TypedArray<i32>)
[src]
Adds an array of bones for the next vertex to use. [code]bones[/code] must contain 4 integers.
pub fn add_color(&self, color: Color)
[src]
Specifies a [Color] for the next vertex to use.
pub fn add_index(&self, index: i64)
[src]
Adds an index to index array if you are using indexed vertices. Does not need to be called before adding vertices.
pub fn add_normal(&self, normal: Vector3D<f32, UnknownUnit>)
[src]
Specifies a normal for the next vertex to use.
pub fn add_smooth_group(&self, smooth: bool)
[src]
Specifies whether the current vertex (if using only vertex arrays) or current index (if also using index arrays) should use smooth normals for normal calculation.
pub fn add_tangent(&self, tangent: Plane)
[src]
Specifies a tangent for the next vertex to use.
pub fn add_triangle_fan(
&self,
vertices: TypedArray<Vector3D<f32, UnknownUnit>>,
uvs: TypedArray<Vector2D<f32, UnknownUnit>>,
colors: TypedArray<Color>,
uv2s: TypedArray<Vector2D<f32, UnknownUnit>>,
normals: TypedArray<Vector3D<f32, UnknownUnit>>,
tangents: VariantArray<Shared>
)
[src]
&self,
vertices: TypedArray<Vector3D<f32, UnknownUnit>>,
uvs: TypedArray<Vector2D<f32, UnknownUnit>>,
colors: TypedArray<Color>,
uv2s: TypedArray<Vector2D<f32, UnknownUnit>>,
normals: TypedArray<Vector3D<f32, UnknownUnit>>,
tangents: VariantArray<Shared>
)
Inserts a triangle fan made of array data into [Mesh] being constructed.
Requires the primitive type be set to [constant Mesh.PRIMITIVE_TRIANGLES].
Default Arguments
uvs
-PoolVector2Array( )
colors
-PoolColorArray( )
uv2s
-PoolVector2Array( )
normals
-PoolVector3Array( )
tangents
-[ ]
pub fn add_uv(&self, uv: Vector2D<f32, UnknownUnit>)
[src]
Specifies a set of UV coordinates to use for the next vertex.
pub fn add_uv2(&self, uv2: Vector2D<f32, UnknownUnit>)
[src]
Specifies an optional second set of UV coordinates to use for the next vertex.
pub fn add_vertex(&self, vertex: Vector3D<f32, UnknownUnit>)
[src]
Specifies the position of current vertex. Should be called after specifying other vertex properties (e.g. Color, UV).
pub fn add_weights(&self, weights: TypedArray<f32>)
[src]
Specifies weight values for next vertex to use. [code]weights[/code] must contain 4 values.
pub fn append_from(
&self,
existing: impl AsArg<Mesh>,
surface: i64,
transform: Transform
)
[src]
&self,
existing: impl AsArg<Mesh>,
surface: i64,
transform: Transform
)
Append vertices from a given [Mesh] surface onto the current vertex array with specified [Transform].
pub fn begin(&self, primitive: i64)
[src]
Called before adding any vertices. Takes the primitive type as an argument (e.g. [constant Mesh.PRIMITIVE_TRIANGLES]).
pub fn clear(&self)
[src]
Clear all information passed into the surface tool so far.
pub fn commit(
&self,
existing: impl AsArg<ArrayMesh>,
flags: i64
) -> Option<Ref<ArrayMesh, Shared>>
[src]
&self,
existing: impl AsArg<ArrayMesh>,
flags: i64
) -> Option<Ref<ArrayMesh, Shared>>
Returns a constructed [ArrayMesh] from current information passed in. If an existing [ArrayMesh] is passed in as an argument, will add an extra surface to the existing [ArrayMesh].
Default flag is [constant Mesh.ARRAY_COMPRESS_DEFAULT]. See [code]ARRAY_COMPRESS_*[/code] constants in [enum Mesh.ArrayFormat] for other flags.
Default Arguments
existing
-null
flags
-97280
pub fn commit_to_arrays(&self) -> VariantArray<Shared>
[src]
Commits the data to the same format used by [method ArrayMesh.add_surface_from_arrays]. This way you can further process the mesh data using the [ArrayMesh] API.
pub fn create_from(&self, existing: impl AsArg<Mesh>, surface: i64)
[src]
Creates a vertex array from an existing [Mesh].
pub fn create_from_blend_shape(
&self,
existing: impl AsArg<Mesh>,
surface: i64,
blend_shape: impl Into<GodotString>
)
[src]
&self,
existing: impl AsArg<Mesh>,
surface: i64,
blend_shape: impl Into<GodotString>
)
Creates a vertex array from the specified blend shape of an existing [Mesh]. This can be used to extract a specific pose from a blend shape.
pub fn deindex(&self)
[src]
Removes the index array by expanding the vertex array.
pub fn generate_normals(&self, flip: bool)
[src]
Generates normals from vertices so you do not have to do it manually. If [code]flip[/code] is [code]true[/code], the resulting normals will be inverted.
Requires the primitive type to be set to [constant Mesh.PRIMITIVE_TRIANGLES].
Default Arguments
flip
-false
pub fn generate_tangents(&self)
[src]
Generates a tangent vector for each vertex. Requires that each vertex have UVs and normals set already.
pub fn index(&self)
[src]
Shrinks the vertex array by creating an index array (avoids reusing vertices).
pub fn set_material(&self, material: impl AsArg<Material>)
[src]
Sets [Material] to be used by the [Mesh] you are constructing.
Methods from Deref<Target = Reference>
pub fn init_ref(&self) -> bool
[src]
Initializes the internal reference counter. Use this only if you really know what you are doing.
Returns whether the initialization was successful.
Trait Implementations
impl Debug for SurfaceTool
[src]
impl Deref for SurfaceTool
[src]
impl DerefMut for SurfaceTool
[src]
impl GodotObject for SurfaceTool
[src]
type RefKind = RefCounted
The memory management kind of this type. This modifies the behavior of the
Ref
smart pointer. See its type-level documentation for more
information. Read more
fn class_name() -> &'static str
[src]
fn null() -> Null<Self>
[src]
fn new() -> Ref<Self, Unique> where
Self: Instanciable,
[src]
Self: Instanciable,
fn cast<T>(&self) -> Option<&T> where
T: GodotObject + SubClass<Self>,
[src]
T: GodotObject + SubClass<Self>,
fn upcast<T>(&self) -> &T where
Self: SubClass<T>,
T: GodotObject,
[src]
Self: SubClass<T>,
T: GodotObject,
unsafe fn assume_shared(&self) -> Ref<Self, Shared>
[src]
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
[src]
Self: GodotObject<RefKind = RefCounted>,
unsafe fn assume_unique(&self) -> Ref<Self, Unique>
[src]
impl Instanciable for SurfaceTool
[src]
fn construct() -> Ref<SurfaceTool, Unique>
[src]
impl SubClass<Object> for SurfaceTool
[src]
impl SubClass<Reference> for SurfaceTool
[src]
Auto Trait Implementations
impl RefUnwindSafe for SurfaceTool
impl !Send for SurfaceTool
impl !Sync for SurfaceTool
impl Unpin for SurfaceTool
impl UnwindSafe for SurfaceTool
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SubClass<T> for T where
T: GodotObject,
[src]
T: GodotObject,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,