Skip to Content
defold-typescript libraries
indiesoftby

indiesoftby/defold-scene3d/scene3d

C++ helper functions

  • GitHub: indiesoftby/defold-scene3d — pinned to 1.2.1 (released while Defold 1.9.0 was current)
    1. Pick a release from indiesoftby/defold-scene3d releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as scene3d from "scene3d"
  • Asset Portal: defold-scene3d

Functions

scene3d.frustum_set(proj_view_m4: matrix4)

Parameters

  • proj_view_m4: matrix4

scene3d.frustum_is_box_visible(min_v3: vector3, max_v3: vector3): boolean

Parameters

  • min_v3: vector3
  • max_v3: vector3

Returns

  • result: boolean

scene3d.frustum_mesh_acquire(): integer

Returns

  • id: integer

scene3d.frustum_mesh_release(id: integer)

Parameters

  • id: integer

scene3d.frustum_mesh_vis_changed(id: integer, max_dimension: number, use_world_pos: boolean, custom_position?: vector3): LuaMultiReturn<[boolean, hash]>

Parameters

  • id: integer
  • max_dimension: number
  • use_world_pos: boolean
  • custom_position?: vector3

Returns

  • changed: boolean
  • message: hash

scene3d.frustum_mesh_vis_changed_box(id: integer, min_v3: vector3, max_v3: vector3): LuaMultiReturn<[boolean, hash]>

Parameters

  • id: integer
  • min_v3: vector3
  • max_v3: vector3

Returns

  • changed: boolean
  • message: hash

scene3d.is_vector3(v: vector3): boolean

Parameters

  • v: vector3

Returns

  • result: boolean

scene3d.is_vector4(v: vector4): boolean

Parameters

  • v: vector4

Returns

  • result: boolean

scene3d.is_quat(q: quat): boolean

Parameters

  • q: quat

Returns

  • result: boolean

scene3d.get_position_to(id: string | hash | url, v: vector3)

Gets the position of a game object instance.

Parameters

  • id: string | hash | url
  • v: vector3

scene3d.get_world_position_to(id: string | hash | url, v: vector3)

Gets the game object instance world position.

Parameters

  • id: string | hash | url
  • v: vector3

scene3d.get_rotation_to(id: string | hash | url, q: quat)

Gets the rotation of the game object instance.

Parameters

  • id: string | hash | url
  • q: quat

scene3d.get_world_rotation_to(id: string | hash | url, q: quat)

Gets the world rotation of the game object instance.

Parameters

  • id: string | hash | url
  • q: quat

scene3d.get_scale_to(id: string | hash | url, v: vector3)

Gets the scale of a game object instance.

Parameters

  • id: string | hash | url
  • v: vector3

scene3d.get_world_scale_to(id: string | hash | url, v: vector3)

Gets the game object instance world scale.

Parameters

  • id: string | hash | url
  • v: vector3

scene3d.prerender_register(callback: function, priority?: integer): integer

Register the callback. It is called after all update functions have been called.

Parameters

  • callback: function
  • priority?: integer

Returns

  • id: integer

scene3d.prerender_unregister(callback_id: integer): boolean

Unregister the callback.

Parameters

  • callback_id: integer

Returns

  • success: boolean

scene3d.simplex_seed(x: integer)

Parameters

  • x: integer

scene3d.simplex_noise2(x: number, y: number, octaves?: integer, persistence?: number, lacunarity?: number): number

Return simplex noise value for specified 2D coordinate. Output range is [0, 1].

Parameters

  • x: number
  • y: number
  • octaves?: integer — Specifies the number of passes, defaults to 1 (simple noise).
  • persistence?: number — Specifies the amplitude of each successive octave relative to the one below it. Defaults to 0.5 (each higher octave's amplitude is halved). Note the amplitude of the first pass is always 1.0.
  • lacunarity?: number — Specifies the frequency of each successive octave relative to the one below it, similar to persistence. Defaults to 2.0.

Returns

  • value: number

scene3d.simplex_noise3(x: number, y: number, z: number, octaves?: integer, persistence?: number, lacunarity?: number): number

Return simplex noise value for specified 3D coordinate. Output range is [0, 1].

Parameters

  • x: number
  • y: number
  • z: number
  • octaves?: integer — Specifies the number of passes, defaults to 1 (simple noise).
  • persistence?: number — Specifies the amplitude of each successive octave relative to the one below it. Defaults to 0.5 (each higher octave's amplitude is halved). Note the amplitude of the first pass is always 1.0.
  • lacunarity?: number — Specifies the frequency of each successive octave relative to the one below it, similar to persistence. Defaults to 2.0.

Returns

  • value: number

scene3d.simplex_noise4(x: number, y: number, z: number, w: number, octaves?: integer, persistence?: number, lacunarity?: number): number

Return simplex noise value for specified 4D coordinate. Output range is [0, 1].

Parameters

  • x: number
  • y: number
  • z: number
  • w: number
  • octaves?: integer — Specifies the number of passes, defaults to 1 (simple noise).
  • persistence?: number — Specifies the amplitude of each successive octave relative to the one below it. Defaults to 0.5 (each higher octave's amplitude is halved). Note the amplitude of the first pass is always 1.0.
  • lacunarity?: number — Specifies the frequency of each successive octave relative to the one below it, similar to persistence. Defaults to 2.0.

Returns

  • value: number

On this page