Documentation
¶
Overview ¶
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:
package main import ( "graphics.gd/classdb/ImmediateMesh" "graphics.gd/classdb/Mesh" "graphics.gd/variant/Vector3" ) func ExampleImmediateMesh() { var mesh = ImmediateMesh.New() mesh.SurfaceBegin(Mesh.PrimitiveTriangles) mesh.SurfaceAddVertex(Vector3.Left) mesh.SurfaceAddVertex(Vector3.Forward) mesh.SurfaceAddVertex(Vector3.Zero) mesh.SurfaceEnd() }
Note: Generating complex geometries with graphics.gd/classdb/ImmediateMesh is highly inefficient. Instead, it is designed to generate simple geometry that changes often.
Index ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AsImmediateMesh() Instance
- func (self Instance) AsMesh() Mesh.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) ClearSurfaces()
- func (self Instance) ID() ID
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SurfaceAddVertex(vertex Vector3.XYZ)
- func (self Instance) SurfaceAddVertex2d(vertex Vector2.XY)
- func (self Instance) SurfaceBegin(primitive Mesh.PrimitiveType)
- func (self Instance) SurfaceEnd()
- func (self Instance) SurfaceSetColor(color Color.RGBA)
- func (self Instance) SurfaceSetNormal(normal Vector3.XYZ)
- func (self Instance) SurfaceSetTangent(tangent Plane.NormalD)
- func (self Instance) SurfaceSetUv(uv Vector2.XY)
- func (self Instance) SurfaceSetUv2(uv2 Vector2.XY)
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Expanded ¶
type Expanded [1]gdclass.ImmediateMesh
func (Expanded) SurfaceBegin ¶
func (self Expanded) SurfaceBegin(primitive Mesh.PrimitiveType, material Material.Instance)
Begin a new surface.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsImmediateMesh ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.ImmediateMesh
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsImmediateMesh ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) SurfaceAddVertex ¶
Add a 3D vertex using the current attributes previously set.
func (Instance) SurfaceAddVertex2d ¶
Add a 2D vertex using the current attributes previously set.
func (Instance) SurfaceBegin ¶
func (self Instance) SurfaceBegin(primitive Mesh.PrimitiveType)
Begin a new surface.
func (Instance) SurfaceEnd ¶
func (self Instance) SurfaceEnd()
End and commit current surface. Note that surface being created will not be visible until this function is called.
func (Instance) SurfaceSetColor ¶
Set the color attribute that will be pushed with the next vertex.
func (Instance) SurfaceSetNormal ¶
Set the normal attribute that will be pushed with the next vertex.
func (Instance) SurfaceSetTangent ¶
Set the tangent attribute that will be pushed with the next vertex.
func (Instance) SurfaceSetUv ¶
Set the UV attribute that will be pushed with the next vertex.
func (Instance) SurfaceSetUv2 ¶
Set the UV2 attribute that will be pushed with the next vertex.