[−][src]Struct gdnative::api::PrimitiveMesh
core class PrimitiveMesh
inherits Mesh
(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
PrimitiveMesh 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 PrimitiveMesh
[src]
pub fn custom_aabb(&self) -> Aabb
[src]
Overrides the [AABB] with one defined by user for use with frustum culling. Especially useful to avoid unnexpected culling when using a shader to offset vertices.
pub fn flip_faces(&self) -> bool
[src]
If set, the order of the vertices in each triangle are reversed resulting in the backside of the mesh being drawn.
This gives the same result as using [constant SpatialMaterial.CULL_BACK] in [member SpatialMaterial.params_cull_mode].
pub fn material(&self) -> Option<Ref<Material, Shared>>
[src]
The current [Material] of the primitive mesh.
pub fn get_mesh_arrays(&self) -> VariantArray<Shared>
[src]
Returns mesh arrays used to constitute surface of [Mesh]. The result can be passed to [method ArrayMesh.add_surface_from_arrays] to create a new surface. For example:
[codeblock]
var c := CylinderMesh.new()
var arr_mesh := ArrayMesh.new()
arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, c.get_mesh_arrays())
[/codeblock]
pub fn set_custom_aabb(&self, aabb: Aabb)
[src]
Overrides the [AABB] with one defined by user for use with frustum culling. Especially useful to avoid unnexpected culling when using a shader to offset vertices.
pub fn set_flip_faces(&self, flip_faces: bool)
[src]
If set, the order of the vertices in each triangle are reversed resulting in the backside of the mesh being drawn.
This gives the same result as using [constant SpatialMaterial.CULL_BACK] in [member SpatialMaterial.params_cull_mode].
pub fn set_material(&self, material: impl AsArg<Material>)
[src]
The current [Material] of the primitive mesh.
Methods from Deref<Target = Mesh>
pub const ARRAY_BONES: i64
[src]
pub const ARRAY_COLOR: i64
[src]
pub const ARRAY_COMPRESS_BASE: i64
[src]
pub const ARRAY_COMPRESS_BONES: i64
[src]
pub const ARRAY_COMPRESS_COLOR: i64
[src]
pub const ARRAY_COMPRESS_DEFAULT: i64
[src]
pub const ARRAY_COMPRESS_INDEX: i64
[src]
pub const ARRAY_COMPRESS_NORMAL: i64
[src]
pub const ARRAY_COMPRESS_TANGENT: i64
[src]
pub const ARRAY_COMPRESS_TEX_UV: i64
[src]
pub const ARRAY_COMPRESS_TEX_UV2: i64
[src]
pub const ARRAY_COMPRESS_VERTEX: i64
[src]
pub const ARRAY_COMPRESS_WEIGHTS: i64
[src]
pub const ARRAY_FLAG_USE_16_BIT_BONES: i64
[src]
pub const ARRAY_FLAG_USE_2D_VERTICES: i64
[src]
pub const ARRAY_FORMAT_BONES: i64
[src]
pub const ARRAY_FORMAT_COLOR: i64
[src]
pub const ARRAY_FORMAT_INDEX: i64
[src]
pub const ARRAY_FORMAT_NORMAL: i64
[src]
pub const ARRAY_FORMAT_TANGENT: i64
[src]
pub const ARRAY_FORMAT_TEX_UV: i64
[src]
pub const ARRAY_FORMAT_TEX_UV2: i64
[src]
pub const ARRAY_FORMAT_VERTEX: i64
[src]
pub const ARRAY_FORMAT_WEIGHTS: i64
[src]
pub const ARRAY_INDEX: i64
[src]
pub const ARRAY_MAX: i64
[src]
pub const ARRAY_NORMAL: i64
[src]
pub const ARRAY_TANGENT: i64
[src]
pub const ARRAY_TEX_UV: i64
[src]
pub const ARRAY_TEX_UV2: i64
[src]
pub const ARRAY_VERTEX: i64
[src]
pub const ARRAY_WEIGHTS: i64
[src]
pub const BLEND_SHAPE_MODE_NORMALIZED: i64
[src]
pub const BLEND_SHAPE_MODE_RELATIVE: i64
[src]
pub const PRIMITIVE_LINES: i64
[src]
pub const PRIMITIVE_LINE_LOOP: i64
[src]
pub const PRIMITIVE_LINE_STRIP: i64
[src]
pub const PRIMITIVE_POINTS: i64
[src]
pub const PRIMITIVE_TRIANGLES: i64
[src]
pub const PRIMITIVE_TRIANGLE_FAN: i64
[src]
pub const PRIMITIVE_TRIANGLE_STRIP: i64
[src]
pub fn create_convex_shape(&self) -> Option<Ref<Shape, Shared>>
[src]
Calculate a [ConvexPolygonShape] from the mesh.
pub fn create_outline(&self, margin: f64) -> Option<Ref<Mesh, Shared>>
[src]
Calculate an outline mesh at a defined offset (margin) from the original mesh.
[b]Note:[/b] This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
pub fn create_trimesh_shape(&self) -> Option<Ref<Shape, Shared>>
[src]
Calculate a [ConcavePolygonShape] from the mesh.
pub fn generate_triangle_mesh(&self) -> Option<Ref<TriangleMesh, Shared>>
[src]
Generate a [TriangleMesh] from the mesh.
pub fn get_aabb(&self) -> Aabb
[src]
Returns the smallest [AABB] enclosing this mesh in local space. Not affected by [code]custom_aabb[/code]. See also [method VisualInstance.get_transformed_aabb].
[b]Note:[/b] This is only implemented for [ArrayMesh] and [PrimitiveMesh].
pub fn get_faces(&self) -> TypedArray<Vector3D<f32, UnknownUnit>>
[src]
Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
pub fn lightmap_size_hint(&self) -> Vector2D<f32, UnknownUnit>
[src]
Sets a hint to be used for lightmap resolution in [BakedLightmap]. Overrides [member BakedLightmap.bake_default_texels_per_unit].
pub fn get_surface_count(&self) -> i64
[src]
Returns the amount of surfaces that the [Mesh] holds.
pub fn set_lightmap_size_hint(&self, size: Vector2D<f32, UnknownUnit>)
[src]
Sets a hint to be used for lightmap resolution in [BakedLightmap]. Overrides [member BakedLightmap.bake_default_texels_per_unit].
pub fn surface_get_arrays(&self, surf_idx: i64) -> VariantArray<Shared>
[src]
Returns the arrays for the vertices, normals, uvs, etc. that make up the requested surface (see [method ArrayMesh.add_surface_from_arrays]).
pub fn surface_get_blend_shape_arrays(
&self,
surf_idx: i64
) -> VariantArray<Shared>
[src]
&self,
surf_idx: i64
) -> VariantArray<Shared>
Returns the blend shape arrays for the requested surface.
pub fn surface_get_material(
&self,
surf_idx: i64
) -> Option<Ref<Material, Shared>>
[src]
&self,
surf_idx: i64
) -> Option<Ref<Material, Shared>>
Returns a [Material] in a given surface. Surface is rendered using this material.
pub fn surface_set_material(
&self,
surf_idx: i64,
material: impl AsArg<Material>
)
[src]
&self,
surf_idx: i64,
material: impl AsArg<Material>
)
Sets a [Material] for a given surface. Surface will be rendered using this material.
Trait Implementations
impl Debug for PrimitiveMesh
[src]
impl Deref for PrimitiveMesh
[src]
impl DerefMut for PrimitiveMesh
[src]
impl GodotObject for PrimitiveMesh
[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 SubClass<Mesh> for PrimitiveMesh
[src]
impl SubClass<Object> for PrimitiveMesh
[src]
impl SubClass<PrimitiveMesh> for PrismMesh
[src]
impl SubClass<PrimitiveMesh> for CylinderMesh
[src]
impl SubClass<PrimitiveMesh> for SphereMesh
[src]
impl SubClass<PrimitiveMesh> for CapsuleMesh
[src]
impl SubClass<PrimitiveMesh> for PointMesh
[src]
impl SubClass<PrimitiveMesh> for PlaneMesh
[src]
impl SubClass<PrimitiveMesh> for CubeMesh
[src]
impl SubClass<PrimitiveMesh> for QuadMesh
[src]
impl SubClass<Reference> for PrimitiveMesh
[src]
impl SubClass<Resource> for PrimitiveMesh
[src]
Auto Trait Implementations
impl RefUnwindSafe for PrimitiveMesh
impl !Send for PrimitiveMesh
impl !Sync for PrimitiveMesh
impl Unpin for PrimitiveMesh
impl UnwindSafe for PrimitiveMesh
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>,