ImmediateMesh

package
v0.0.0-...-ff35923 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 29 Imported by: 0

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

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 Any

type Any interface {
	gd.IsClass
	AsImmediateMesh() Instance
}

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

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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 (self *Extension[T]) AsImmediateMesh() Instance

func (*Extension[T]) AsMesh

func (self *Extension[T]) AsMesh() Mesh.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

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 New

func New() Instance

func (Instance) AsImmediateMesh

func (self Instance) AsImmediateMesh() Instance

func (Instance) AsMesh

func (self Instance) AsMesh() Mesh.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) ClearSurfaces

func (self Instance) ClearSurfaces()

Clear all surfaces.

func (Instance) ID

func (self Instance) ID() ID

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SurfaceAddVertex

func (self Instance) SurfaceAddVertex(vertex Vector3.XYZ)

Add a 3D vertex using the current attributes previously set.

func (Instance) SurfaceAddVertex2d

func (self Instance) SurfaceAddVertex2d(vertex Vector2.XY)

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

func (self Instance) SurfaceSetColor(color Color.RGBA)

Set the color attribute that will be pushed with the next vertex.

func (Instance) SurfaceSetNormal

func (self Instance) SurfaceSetNormal(normal Vector3.XYZ)

Set the normal attribute that will be pushed with the next vertex.

func (Instance) SurfaceSetTangent

func (self Instance) SurfaceSetTangent(tangent Plane.NormalD)

Set the tangent attribute that will be pushed with the next vertex.

func (Instance) SurfaceSetUv

func (self Instance) SurfaceSetUv(uv Vector2.XY)

Set the UV attribute that will be pushed with the next vertex.

func (Instance) SurfaceSetUv2

func (self Instance) SurfaceSetUv2(uv2 Vector2.XY)

Set the UV2 attribute that will be pushed with the next vertex.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL