ImmediateGeometry

Inherits: GeometryInstance < VisualInstance < CullInstance < Spatial < Node < Object Draws simple geometry from code.

Description

Draws simple geometry from code. Uses a drawing mode similar to OpenGL 1.x. ArrayMesh, MeshDataTool and SurfaceTool for procedural geometry generation. Note: ImmediateGeometry3D is best suited to small amounts of mesh data that change every frame. It will be slow when handling large amounts of mesh data. If mesh data doesn’t change often, use ArrayMesh, MeshDataTool or SurfaceTool instead. Note: Godot uses clockwise winding order for front faces of triangle primitive modes. Note: In case of missing points when handling large amounts of mesh data, try increasing its buffer size limit under ProjectSettings.rendering/limits/buffers/immediate_buffer_size_kb.

Methods

Method Descriptions

  • add_sphere ( int lats, int lons, float radius, bool add_uv=true ) Simple helper to draw an UV sphere with given latitude, longitude and radius.

  • add_vertex ( Vector3 position ) Adds a vertex in local coordinate space with the currently set color/uv/etc.

  • begin ( PrimitiveType primitive, Texture texture=null ) end. For more information on how this works, search for glBegin() and glEnd() references. PrimitiveType enum.

  • clear ( ) Clears everything that was drawn using begin/end.

  • end ( ) Ends a drawing context and displays the results.

  • set_color ( Color color ) The current drawing color.

  • set_normal ( Vector3 normal ) The next vertex’s normal.

  • set_tangent ( Plane tangent ) The next vertex’s tangent (and binormal facing).

  • set_uv ( Vector2 uv ) The next vertex’s UV.

  • set_uv2 ( Vector2 uv ) The next vertex’s second layer UV.