libgpac
Documentation of the core library of GPAC
BIFS/VRML/X3D Scenegraph

Scenegraph for VRML files. More...

+ Collaboration diagram for BIFS/VRML/X3D Scenegraph:

Data Structures

struct  SFString
 
struct  SFColor
 
struct  SFColorRGBA
 
struct  SFURL
 
struct  SFVec2d
 
struct  SFVec3d
 
struct  SFImage
 
struct  SFCommandBuffer
 
struct  SFScript
 
struct  SFAttrRef
 
struct  GenMFField
 
struct  MFInt32
 
struct  MFInt
 
struct  MFFloat
 
struct  MFDouble
 
struct  MFBool
 
struct  MFColor
 
struct  MFColorRGBA
 
struct  MFRotation
 
struct  MFTime
 
struct  MFVec2f
 
struct  MFVec2d
 
struct  MFVec3f
 
struct  MFVec3d
 
struct  MFVec4f
 
struct  MFURL
 
struct  MFString
 
struct  MFScript
 
struct  MFAttrRef
 
struct  GF_VRMLParent
 

Macros

#define MPEG4_RESERVED_NDT   200
 
#define GF_SG_INTERNAL_PROTO   (PTR_TO_U_CAST -1)
 
#define VRML_CHILDREN
 

Typedefs

typedef u32 SFBool
 
typedef s32 SFInt32
 
typedef s32 SFInt
 
typedef Fixed SFFloat
 
typedef Double SFDouble
 
typedef Double SFTime
 
typedef struct __vec2f SFVec2f
 
typedef struct __vec3f SFVec3f
 
typedef struct __vec4f SFRotation
 
typedef struct __vec4f SFVec4f
 
typedef struct _proto GF_Proto
 
typedef struct _protofield GF_ProtoFieldInterface
 
typedef struct _scriptfield GF_ScriptField
 

Enumerations

enum  {
  NDT_SFMetadataNode = MPEG4_RESERVED_NDT+1 , NDT_SFFillPropertiesNode , NDT_SFX3DLinePropertiesNode , NDT_SFGeoOriginNode ,
  NDT_SFHAnimNode , NDT_SFHAnimDisplacerNode , NDT_SFNurbsControlCurveNode , NDT_SFNurbsSurfaceNode ,
  NDT_SFNurbsCurveNode
}
 
enum  {
  GF_SG_EVENT_FIELD = 0 , GF_SG_EVENT_EXPOSED_FIELD = 1 , GF_SG_EVENT_IN = 2 , GF_SG_EVENT_OUT = 3 ,
  GF_SG_EVENT_UNKNOWN = 4
}
 
enum  {
  GF_SG_FIELD_CODING_ALL = 0 , GF_SG_FIELD_CODING_DEF = 1 , GF_SG_FIELD_CODING_IN = 2 , GF_SG_FIELD_CODING_OUT = 3 ,
  GF_SG_FIELD_CODING_DYN = 4
}
 
enum  {
  GF_SG_VRML_SFBOOL = 0 , GF_SG_VRML_SFFLOAT = 1 , GF_SG_VRML_SFTIME = 2 , GF_SG_VRML_SFINT32 = 3 ,
  GF_SG_VRML_SFSTRING = 4 , GF_SG_VRML_SFVEC3F = 5 , GF_SG_VRML_SFVEC2F = 6 , GF_SG_VRML_SFCOLOR = 7 ,
  GF_SG_VRML_SFROTATION = 8 , GF_SG_VRML_SFIMAGE = 9 , GF_SG_VRML_SFNODE = 10 , GF_SG_VRML_SFVEC4F = 11 ,
  GF_SG_VRML_SFURL , GF_SG_VRML_SFSCRIPT , GF_SG_VRML_SFCOMMANDBUFFER , GF_SG_VRML_SFDOUBLE ,
  GF_SG_VRML_SFCOLORRGBA , GF_SG_VRML_SFVEC2D , GF_SG_VRML_SFVEC3D , GF_SG_VRML_FIRST_MF = 32 ,
  GF_SG_VRML_MFBOOL = GF_SG_VRML_FIRST_MF , GF_SG_VRML_MFFLOAT , GF_SG_VRML_MFTIME , GF_SG_VRML_MFINT32 ,
  GF_SG_VRML_MFSTRING , GF_SG_VRML_MFVEC3F , GF_SG_VRML_MFVEC2F , GF_SG_VRML_MFCOLOR ,
  GF_SG_VRML_MFROTATION , GF_SG_VRML_MFIMAGE , GF_SG_VRML_MFNODE , GF_SG_VRML_MFVEC4F ,
  GF_SG_VRML_SFATTRREF = 45 , GF_SG_VRML_MFATTRREF = 46 , GF_SG_VRML_MFURL , GF_SG_VRML_MFSCRIPT ,
  GF_SG_VRML_MFCOMMANDBUFFER , GF_SG_VRML_MFDOUBLE , GF_SG_VRML_MFCOLORRGBA , GF_SG_VRML_MFVEC2D ,
  GF_SG_VRML_MFVEC3D , GF_SG_VRML_SCRIPT_FUNCTION , GF_SG_VRML_GENERIC_FUNCTION , GF_SG_VRML_UNKNOWN
}
 
enum  { GF_SG_SCRIPT_TYPE_FIELD = 0 , GF_SG_SCRIPT_TYPE_EVENT_IN , GF_SG_SCRIPT_TYPE_EVENT_OUT }
 

Functions

const char * gf_sg_vrml_get_event_type_name (u32 EventType, Bool forX3D)
 
u32 gf_node_get_num_fields_in_mode (GF_Node *n, u8 IndexMode)
 
SFColorRGBA gf_sg_sfcolor_to_rgba (SFColor val)
 
Bool gf_sg_vrml_is_sf_field (u32 FieldType)
 
u32 gf_sg_vrml_get_sf_type (u32 FieldType)
 
GF_Err gf_sg_vrml_mf_insert (void *mf, u32 FieldType, void **new_ptr, u32 InsertAt)
 
GF_Err gf_sg_vrml_mf_reset (void *mf, u32 FieldType)
 
void gf_sg_mfurl_del (MFURL url)
 
void gf_sg_vrml_copy_mfurl (MFURL *dst, MFURL *src)
 
SFRotation gf_sg_sfrotation_interpolate (SFRotation kv1, SFRotation kv2, Fixed f)
 
GF_Err gf_node_insert_child (GF_Node *parent, GF_Node *new_child, s32 pos)
 
GF_Err gf_node_replace_child (GF_Node *node, GF_ChildNodeItem **container, s32 pos, GF_Node *newNode)
 
void gf_sg_vrml_parent_setup (GF_Node *n)
 
void gf_sg_vrml_parent_destroy (GF_Node *n)
 
Bool gf_node_in_table_by_tag (u32 tag, u32 NDTType)
 
const char * gf_sg_vrml_get_field_type_name (u32 FieldType)
 
void * gf_sg_vrml_field_pointer_new (u32 FieldType)
 
void gf_sg_vrml_field_pointer_del (void *field, u32 FieldType)
 
GF_Err gf_sg_vrml_mf_append (void *mf, u32 FieldType, void **new_ptr)
 
GF_Err gf_sg_vrml_mf_remove (void *mf, u32 FieldType, u32 RemoveFrom)
 
GF_Err gf_sg_vrml_mf_alloc (void *mf, u32 FieldType, u32 NbItems)
 
GF_Err gf_sg_vrml_mf_get_item (void *mf, u32 FieldType, void **new_ptr, u32 ItemPos)
 
void gf_sg_vrml_field_copy (void *dest, void *orig, u32 FieldType)
 
void gf_sg_vrml_field_clone (void *dest, void *orig, u32 FieldType, GF_SceneGraph *inScene)
 
Bool gf_sg_vrml_field_equal (void *dest, void *orig, u32 FieldType)
 
GF_Routegf_sg_route_new (GF_SceneGraph *sg, GF_Node *fromNode, u32 fromField, GF_Node *toNode, u32 toField)
 
void gf_sg_route_del (GF_Route *route)
 
GF_Err gf_sg_route_del_by_id (GF_SceneGraph *sg, u32 routeID)
 
GF_Routegf_sg_route_find (GF_SceneGraph *sg, u32 RouteID)
 
GF_Routegf_sg_route_find_by_name (GF_SceneGraph *sg, char *name)
 
GF_Err gf_sg_route_set_id (GF_Route *route, u32 ID)
 
GF_Err gf_sg_route_set_name (GF_Route *route, char *name)
 
char * gf_sg_route_get_name (GF_Route *route)
 
u32 gf_sg_get_next_available_route_id (GF_SceneGraph *sg)
 
void gf_sg_set_max_defined_route_id (GF_SceneGraph *sg, u32 ID)
 
void gf_sg_route_new_to_callback (GF_SceneGraph *sg, GF_Node *fromNode, u32 fromField, void *cbk, void(*route_callback)(void *param, GF_FieldInfo *from_field))
 
void gf_sg_activate_routes (GF_SceneGraph *sg)
 
u32 gf_sg_get_next_available_proto_id (GF_SceneGraph *sg)
 
GF_Protogf_sg_proto_new (GF_SceneGraph *sg, u32 ProtoID, char *name, Bool unregistered)
 
GF_Err gf_sg_proto_del (GF_Proto *proto)
 
GF_SceneGraphgf_sg_proto_get_graph (GF_Proto *proto)
 
GF_Err gf_sg_proto_add_node_code (GF_Proto *proto, GF_Node *n)
 
u32 gf_sg_proto_get_field_count (GF_Proto *proto)
 
GF_ProtoFieldInterfacegf_sg_proto_field_find_by_name (GF_Proto *proto, char *fieldName)
 
GF_ProtoFieldInterfacegf_sg_proto_field_find (GF_Proto *proto, u32 fieldIndex)
 
GF_ProtoFieldInterfacegf_sg_proto_field_new (GF_Proto *proto, u32 fieldType, u32 eventType, char *fieldName)
 
GF_Err gf_sg_proto_field_set_ised (GF_Proto *proto, u32 protoFieldIndex, GF_Node *node, u32 nodeFieldIndex)
 
GF_Err gf_sg_proto_field_get_field (GF_ProtoFieldInterface *field, GF_FieldInfo *info)
 
GF_Nodegf_sg_proto_create_instance (GF_SceneGraph *sg, GF_Proto *proto)
 
GF_Err gf_sg_proto_load_code (GF_Node *proto_inst)
 
GF_Protogf_sg_find_proto (GF_SceneGraph *sg, u32 ProtoID, char *name)
 
GF_Err gf_sg_delete_all_protos (GF_SceneGraph *sg)
 
GF_Protogf_node_get_proto (GF_Node *node)
 
u32 gf_sg_proto_get_id (GF_Proto *proto)
 
const char * gf_sg_proto_get_class_name (GF_Proto *proto)
 
Bool gf_sg_proto_field_is_sftime_offset (GF_Node *node, GF_FieldInfo *field)
 
GF_Err gf_sg_proto_instance_set_ised (GF_Node *protoinst, u32 protoFieldIndex, GF_Node *node, u32 nodeFieldIndex)
 
GF_Nodegf_node_get_proto_root (GF_Node *node)
 
void gf_sg_proto_mark_field_loaded (GF_Node *node, GF_FieldInfo *info)
 
void gf_sg_set_proto_loader (GF_SceneGraph *sg, GF_SceneGraph *(*GetExternProtoLib)(void *SceneCallback, MFURL *lib_url))
 
MFURLgf_sg_proto_get_extern_url (GF_Proto *proto)
 
GF_ScriptFieldgf_sg_script_field_new (GF_Node *script, u32 eventType, u32 fieldType, const char *name)
 
GF_Err gf_sg_script_field_get_info (GF_ScriptField *field, GF_FieldInfo *info)
 
void gf_sg_script_event_in (GF_Node *script, GF_FieldInfo *in_field)
 
void gf_node_event_out (GF_Node *n, u32 FieldIndex)
 
void gf_node_event_out_str (GF_Node *n, const char *eventName)
 
u32 gf_node_mpeg4_type_by_class_name (const char *node_name)
 
u32 gf_node_x3d_type_by_class_name (const char *node_name)
 
Bool gf_node_proto_is_grouping (GF_Node *n)
 
GF_Err gf_node_proto_set_grouping (GF_Node *n)
 
GF_Err gf_node_set_proto_eventin_handler (GF_Node *n, u32 fieldIndex, void(*event_in_cbk)(GF_Node *pThis, struct _route *route))
 

Detailed Description

This section documents the Scenegraph for VRML files.


Data Structure Documentation

◆ SFString

struct SFString

String

Data Fields
char * buffer

◆ SFColor

struct SFColor

RGB color

Data Fields
Fixed red
Fixed green
Fixed blue

◆ SFColorRGBA

struct SFColorRGBA

RGBA color

Data Fields
Fixed red
Fixed green
Fixed blue
Fixed alpha

◆ SFURL

struct SFURL

URL

Data Fields
u32 OD_ID
char * url

◆ SFVec2d

struct SFVec2d

2D vector (double)

Data Fields
Double x
Double y

◆ SFVec3d

struct SFVec3d

3D vector (double)

Data Fields
Double x
Double y
Double z

◆ SFImage

struct SFImage

Image data (rgb pixels)

Data Fields
u32 width
u32 height
u8 numComponents
unsigned char * pixels

◆ SFCommandBuffer

struct SFCommandBuffer

BIFS Command Buffer

Data Fields
u32 bufferSize
u8 * buffer
GF_List * commandList

◆ SFScript

struct SFScript

Script

Note
The javascript or vrml script is handled in its decompressed (textual) format since most JS interpreter work with text
Data Fields
char * script_text

◆ SFAttrRef

struct SFAttrRef

BIFS Attribute Reference

+ Collaboration diagram for SFAttrRef:
Data Fields
GF_Node * node
u32 fieldIndex

◆ GenMFField

struct GenMFField

generic MF field: all MF fields use the same syntax except MFNode which uses GF_List. You can thus use this structure to safely typecast MF field pointers

Data Fields
u32 count
u8 * array

◆ MFInt32

struct MFInt32

Interger array

Data Fields
u32 count
s32 * vals

◆ MFInt

struct MFInt

Interger array

Data Fields
u32 count
s32 * vals

◆ MFFloat

struct MFFloat

Float array

Data Fields
u32 count
Fixed * vals

◆ MFDouble

struct MFDouble

Double array

Data Fields
u32 count
Double * vals

◆ MFBool

struct MFBool

Boolean array

Data Fields
u32 count
u32 * vals

◆ MFColor

struct MFColor

Color RGB array

+ Collaboration diagram for MFColor:
Data Fields
u32 count
SFColor * vals

◆ MFColorRGBA

struct MFColorRGBA

Color RGBA array

+ Collaboration diagram for MFColorRGBA:
Data Fields
u32 count
SFColorRGBA * vals

◆ MFRotation

struct MFRotation

Rotation array

Data Fields
u32 count
SFRotation * vals

◆ MFTime

struct MFTime

Time array

Data Fields
u32 count
Double * vals

◆ MFVec2f

struct MFVec2f

2D Vector (float) array

Data Fields
u32 count
SFVec2f * vals

◆ MFVec2d

struct MFVec2d

2D Vector (double) array

+ Collaboration diagram for MFVec2d:
Data Fields
u32 count
SFVec2d * vals

◆ MFVec3f

struct MFVec3f

3D Vector (float) array

Data Fields
u32 count
SFVec3f * vals

◆ MFVec3d

struct MFVec3d

3D Vector (double) array

+ Collaboration diagram for MFVec3d:
Data Fields
u32 count
SFVec3d * vals

◆ MFVec4f

struct MFVec4f

4D Vector (float) array

Data Fields
u32 count
SFVec4f * vals

◆ MFURL

struct MFURL

URL array

+ Collaboration diagram for MFURL:
Data Fields
u32 count
SFURL * vals

◆ MFString

struct MFString

String array

Data Fields
u32 count
char ** vals

◆ MFScript

struct MFScript

Script array

+ Collaboration diagram for MFScript:
Data Fields
u32 count
SFScript * vals

◆ MFAttrRef

struct MFAttrRef

Attribute Reference array

+ Collaboration diagram for MFAttrRef:
Data Fields
u32 count
SFAttrRef * vals

◆ GF_VRMLParent

struct GF_VRMLParent

generic VRML parent node

Macro Definition Documentation

◆ MPEG4_RESERVED_NDT

#define MPEG4_RESERVED_NDT   200

reserved NDT for MPEG4 (match binary coding)

◆ GF_SG_INTERNAL_PROTO

#define GF_SG_INTERNAL_PROTO   (PTR_TO_U_CAST -1)

internal prototype

◆ VRML_CHILDREN

#define VRML_CHILDREN
Value:
CHILDREN \
GF_ChildNodeItem *addChildren; \
void (*on_addChildren)(GF_Node *pNode, struct _route *route); \
GF_ChildNodeItem *removeChildren; \
void (*on_removeChildren)(GF_Node *pNode, struct _route *route); \
Definition: scenegraph.h:110

VRML grouping nodes macro - note we have inverted the children field to be compatible with the base GF_ParentNode node All grouping nodes (with "children" field) implement the following:

addChildren: chain containing nodes to add passed as eventIn - handled internally through ROUTE void (*on_addChildren)(GF_Node *pNode): add feventIn signaler - this is handled internally by the scene_graph and SHALL NOT BE overridden since it takes care of node(s) routing

removeChildren: chain containing nodes to remove passed as eventIn - handled internally through ROUTE

void (*on_removeChildren)(GF_Node *pNode): remove eventIn signaler - this is handled internally by the scene_graph and SHALL NOT BE overridden since it takes care of node(s) routing

children: list of children SFNodes

Typedef Documentation

◆ SFBool

typedef u32 SFBool

Boolean

◆ SFInt32

typedef s32 SFInt32

Integer

◆ SFInt

typedef s32 SFInt

Integer

◆ SFFloat

typedef Fixed SFFloat

Float

◆ SFDouble

typedef Double SFDouble

Double

◆ SFTime

typedef Double SFTime

Time

◆ SFVec2f

typedef struct __vec2f SFVec2f

2D vector (float)

◆ SFVec3f

typedef struct __vec3f SFVec3f

3D vector (float)

◆ SFRotation

typedef struct __vec4f SFRotation

rotation (float)

◆ SFVec4f

typedef struct __vec4f SFVec4f

4D vector (float)

◆ GF_Proto

typedef struct _proto GF_Proto

proto object

◆ GF_ProtoFieldInterface

typedef struct _protofield GF_ProtoFieldInterface

proto field object

◆ GF_ScriptField

typedef struct _scriptfield GF_ScriptField

script field object

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

the NDTs used in X3D not defined in MPEG4

◆ anonymous enum

anonymous enum

event types of fields, as defined in the specs this should not be needed by non binary codecs

◆ anonymous enum

anonymous enum

field coding mode

BIFS defines the bitstream syntax contextually, and therefore sometimes refer to fields as indexed

in the node ("all" mode) or just as a sub-set (in, out, def, dyn modes) of similar types

◆ anonymous enum

anonymous enum

field types, as defined in BIFS encoding (used for scripts and proto coding)

◆ anonymous enum

anonymous enum

script fields type don't have the same value as the bifs ones...

Function Documentation

◆ gf_sg_vrml_get_event_type_name()

const char* gf_sg_vrml_get_event_type_name ( u32  EventType,
Bool  forX3D 
)

gets the event type name

Parameters
EventTypethe event type
forX3Dfor X3D dumping
Returns
the event name

◆ gf_node_get_num_fields_in_mode()

u32 gf_node_get_num_fields_in_mode ( GF_Node n,
u8  IndexMode 
)

gets the number of field in the given mode (BIFS specific)

Parameters
nthe target node
IndexModethe field indexing mode
Returns
the number of field in this mode

◆ gf_sg_sfcolor_to_rgba()

SFColorRGBA gf_sg_sfcolor_to_rgba ( SFColor  val)

converts an SFColor to an SFColorRGBA by setting the alpha component to 1

Parameters
valthe input color
Returns
the RGBA color

◆ gf_sg_vrml_is_sf_field()

Bool gf_sg_vrml_is_sf_field ( u32  FieldType)

checks if a field is an SF field

Parameters
FieldTypethe tragte filed type
Returns
GF_TRUE if field is a single field

◆ gf_sg_vrml_get_sf_type()

u32 gf_sg_vrml_get_sf_type ( u32  FieldType)

translates MF/SF to SF type

Parameters
FieldTypethe tragte filed type
Returns
SF field type

◆ gf_sg_vrml_mf_insert()

GF_Err gf_sg_vrml_mf_insert ( void *  mf,
u32  FieldType,
void **  new_ptr,
u32  InsertAt 
)

inserts (+alloc) a slot in the MFField with a specified position for insertion and sets the ptr to the newly created slot

Parameters
mfpointer to the MF field
FieldTypethe MF field type
new_ptrset to the allocated slot (do not free)
InsertAtis the 0-based index for the new slot
Returns
error if any

◆ gf_sg_vrml_mf_reset()

GF_Err gf_sg_vrml_mf_reset ( void *  mf,
u32  FieldType 
)

removes all items of the MFField

Parameters
mfpointer to the MF field
FieldTypethe MF field type
Returns
error if any

◆ gf_sg_mfurl_del()

void gf_sg_mfurl_del ( MFURL  url)

deletes an MFUrl field

Note
exported for URL handling in compositor
Parameters
urlthe MF url field to reset

◆ gf_sg_vrml_copy_mfurl()

void gf_sg_vrml_copy_mfurl ( MFURL dst,
MFURL src 
)

copies MFUrl field

Note
exported for URL handling in compositor
Parameters
dstthe destination MF url field to copy
srcthe source MF url field to copy

◆ gf_sg_sfrotation_interpolate()

SFRotation gf_sg_sfrotation_interpolate ( SFRotation  kv1,
SFRotation  kv2,
Fixed  f 
)

interpolates SFRotation

Note
exported for 3D camera in compositor
Parameters
kv1start value for interpolation
kv2end value for interpolation
finterpolation factor
Returns
the interpolated result

◆ gf_node_insert_child()

GF_Err gf_node_insert_child ( GF_Node parent,
GF_Node new_child,
s32  pos 
)

adds a new node to the "children" field

Warning
DOES NOT CHECK CHILD/PARENT type compatibility
Parameters
parentthe target parent node
new_childthe child to insert
posthe 0-BASED index in the list of children, -1 means end of list (append)
Returns
error if any

◆ gf_node_replace_child()

GF_Err gf_node_replace_child ( GF_Node node,
GF_ChildNodeItem **  container,
s32  pos,
GF_Node newNode 
)

removes and replace given child by specified node. If node is NULL, only delete target node

Warning
DOES NOT CHECK CHILD/PARENT type compatibility
Parameters
nodethe target node to replace
containerthe container list
posthe 0-BASED index in the list of children, -1 means end of list (append)
newNodethe new node to use
Returns
error if any

◆ gf_sg_vrml_parent_setup()

void gf_sg_vrml_parent_setup ( GF_Node n)

setup a vrml parent

Parameters
nthe target node

◆ gf_sg_vrml_parent_destroy()

void gf_sg_vrml_parent_destroy ( GF_Node n)

resets all children in a vrml parent node (but does not destroy the node)

Parameters
nthe target node

◆ gf_node_in_table_by_tag()

Bool gf_node_in_table_by_tag ( u32  tag,
u32  NDTType 
)

checks if a given node tag is in a given NDT table

Parameters
tagthe node tag
NDTTypethe NDT type
Returns
GF_TRUE if node tag is in the NDT

◆ gf_sg_vrml_get_field_type_name()

const char* gf_sg_vrml_get_field_type_name ( u32  FieldType)

gets field type name

Parameters
FieldTypethe field type
Returns
the field name

◆ gf_sg_vrml_field_pointer_new()

void* gf_sg_vrml_field_pointer_new ( u32  FieldType)

allocates a new field

Note
GF_SG_VRML_MFNODE will return a pointer to a GF_List structure (eg GF_List *), GF_SG_VRML_SFNODE will return NULL
Parameters
FieldTypethe field type
Returns
the new field pointer

◆ gf_sg_vrml_field_pointer_del()

void gf_sg_vrml_field_pointer_del ( void *  field,
u32  FieldType 
)

deletes a field pointer (including SF an,d MF nodes)

Parameters
fieldthe field pointer value
FieldTypethe field type

◆ gf_sg_vrml_mf_append()

GF_Err gf_sg_vrml_mf_append ( void *  mf,
u32  FieldType,
void **  new_ptr 
)

adds at the end of an MF field

Parameters
mfpointer to the MF field
FieldTypethe MF field type
new_ptrset to the allocated SF field slot - do not destroy
Returns
error if any

◆ gf_sg_vrml_mf_remove()

GF_Err gf_sg_vrml_mf_remove ( void *  mf,
u32  FieldType,
u32  RemoveFrom 
)

removes the desired item of an MF field

Parameters
mfpointer to the MF field
FieldTypethe MF field type
RemoveFromthe 0-based index of item to remove
Returns
error if any

◆ gf_sg_vrml_mf_alloc()

GF_Err gf_sg_vrml_mf_alloc ( void *  mf,
u32  FieldType,
u32  NbItems 
)

allocates an MF array

Parameters
mfpointer to the MF field
FieldTypethe MF field type
NbItemsnumber of items to allocate
Returns
error if any

◆ gf_sg_vrml_mf_get_item()

GF_Err gf_sg_vrml_mf_get_item ( void *  mf,
u32  FieldType,
void **  new_ptr,
u32  ItemPos 
)

gets the item in the MF array

Parameters
mfpointer to the MF field
FieldTypethe MF field type
new_ptrset to the SF field slot - do not destroy
ItemPosthe 0-based index of item to remove
Returns
error if any

◆ gf_sg_vrml_field_copy()

void gf_sg_vrml_field_copy ( void *  dest,
void *  orig,
u32  FieldType 
)

copies a field content EXCEPT SF/MFNode. Pointers to field shall be used

Parameters
destpointer to the MF field
origpointer to the MF field
FieldTypethe MF field type

◆ gf_sg_vrml_field_clone()

void gf_sg_vrml_field_clone ( void *  dest,
void *  orig,
u32  FieldType,
GF_SceneGraph inScene 
)

clones a field content EXCEPT SF/MFNode. Pointers to field shall be used

Parameters
destpointer to the MF field
origpointer to the MF field
FieldTypethe MF field type
inScenetarget scene graph for SFCommandBuffers cloning

◆ gf_sg_vrml_field_equal()

Bool gf_sg_vrml_field_equal ( void *  dest,
void *  orig,
u32  FieldType 
)

indicates whether 2 fields of same type EXCEPT SF/MFNode are equal

Parameters
destpointer to the MF field
origpointer to the MF field
FieldTypethe MF field type
Returns
GF_TRUE if fields equal

◆ gf_sg_route_new()

GF_Route* gf_sg_route_new ( GF_SceneGraph sg,
GF_Node fromNode,
u32  fromField,
GF_Node toNode,
u32  toField 
)

creates a new route

Note
routes are automatically destroyed if either the target or origin node of the route is destroyed
Parameters
sgthe target scene graph of the route
fromNodethe source node triggering the event out
fromFieldthe source field triggering the event out
toNodethe destination node accepting the event in
toFieldthe destination field accepting the event in
Returns
a new route object

◆ gf_sg_route_del()

void gf_sg_route_del ( GF_Route route)

destroys a route

Parameters
routethe target route

◆ gf_sg_route_del_by_id()

GF_Err gf_sg_route_del_by_id ( GF_SceneGraph sg,
u32  routeID 
)

destroys a route by ID

Parameters
sgthe scene graph of the route
routeIDthe ID of the route to destroy
Returns
error if any

◆ gf_sg_route_find()

GF_Route* gf_sg_route_find ( GF_SceneGraph sg,
u32  RouteID 
)

locate a route by ID

Parameters
sgthe scene graph of the route
RouteIDthe ID of the route
Returns
the route object or NULL if not found

◆ gf_sg_route_find_by_name()

GF_Route* gf_sg_route_find_by_name ( GF_SceneGraph sg,
char *  name 
)

locate a route by name

Parameters
sgthe scene graph of the route
namethe name of the route
Returns
the route object or NULL if not found

◆ gf_sg_route_set_id()

GF_Err gf_sg_route_set_id ( GF_Route route,
u32  ID 
)

assigns a route ID

Parameters
routethe target route
IDthe ID to assign
Returns
error if any - fails if a route with same ID already exists

◆ gf_sg_route_set_name()

GF_Err gf_sg_route_set_name ( GF_Route route,
char *  name 
)

assign a route name

Parameters
routethe target route
namethe name to assign
Returns
error if any - fails if a route with same name already exists

◆ gf_sg_route_get_name()

char* gf_sg_route_get_name ( GF_Route route)

gets route name

Parameters
routethe target route
Returns
the route name or NULL if not set

◆ gf_sg_get_next_available_route_id()

u32 gf_sg_get_next_available_route_id ( GF_SceneGraph sg)

retuns next available RouteID

Note
this doesn't track inserted routes, that's the caller responsibility
Parameters
sgthe target scene graph of the route
Returns
the next available ID for routes

◆ gf_sg_set_max_defined_route_id()

void gf_sg_set_max_defined_route_id ( GF_SceneGraph sg,
u32  ID 
)

sets max defined route ID used in the scene - used to handle RouteInsert commands note that this must be called by the user to be effective,; otherwise the max route ID is computed from the routes present in scene

Parameters
sgthe target scene graph of the route
IDthe value of the max defined route ID

◆ gf_sg_route_new_to_callback()

void gf_sg_route_new_to_callback ( GF_SceneGraph sg,
GF_Node fromNode,
u32  fromField,
void *  cbk,
void(*)(void *param, GF_FieldInfo *from_field)  route_callback 
)

creates a new route from a node output to a given callback/function

Parameters
sgthe target scene graph of the route
fromNodethe source node emiting the event out
fromFieldthe source field emiting the event out
cbkopaque data to pass to the callback
route_callbackroute callback function to call

◆ gf_sg_activate_routes()

void gf_sg_activate_routes ( GF_SceneGraph sg)

activates all routes currently triggered - this follows the event cascade model of VRML/MPEG4:

  • routes are collected during eventOut generation
  • routes are activated. If eventOuts are generated during activation the cycle goes on.

A route cannot be activated twice in the same simulation tick, hence this function shall be called ONCE AND ONLY ONCE per simulation tick

Note that children scene graphs register their routes with the top-level graph, so only the main scene graph needs to be activated

Parameters
sgthe target scene graph of the route

◆ gf_sg_get_next_available_proto_id()

u32 gf_sg_get_next_available_proto_id ( GF_SceneGraph sg)

retuns next available proto ID

Parameters
sgthe target scene graph of the proto
Returns
the next available proto ID

◆ gf_sg_proto_new()

GF_Proto* gf_sg_proto_new ( GF_SceneGraph sg,
u32  ProtoID,
char *  name,
Bool  unregistered 
)

constructs a new proto identified by ID/name in the given scene 2 protos in the same scene may not have the same ID/name

Parameters
sgthe target scene graph in which the proto is created
ProtoIDID of the proto to create
namename of the proto to create
unregisteredif GF_TRUE, the proto is not stored in the graph main proto list but in an alternate list (used for memory handling of scene graph only). Several protos with the same ID/Name can be stored unregistered
Returns
a new proto object

◆ gf_sg_proto_del()

GF_Err gf_sg_proto_del ( GF_Proto proto)

destroys a proto - can be used even if instances of the proto are still present

Parameters
protothe target proto
Returns
error if any

◆ gf_sg_proto_get_graph()

GF_SceneGraph* gf_sg_proto_get_graph ( GF_Proto proto)

returns the graph associated with this proto. Such a graph cannot be used for rendering but is needed during construction of proto dictionaries in case of nested protos

Parameters
protothe target proto
Returns
associated scene graph proto the target proto

◆ gf_sg_proto_add_node_code()

GF_Err gf_sg_proto_add_node_code ( GF_Proto proto,
GF_Node n 
)

adds node code - a proto is build of several nodes, the first node is used for rendering and the others are kept private. This set of nodes is referred to as the proto "node code"

Parameters
protothe target proto
nthe node to add to the proto code
Returns
error if any

◆ gf_sg_proto_get_field_count()

u32 gf_sg_proto_get_field_count ( GF_Proto proto)

gets number of field in the proto interface

Parameters
protothe target proto
Returns
the number of fields

◆ gf_sg_proto_field_find_by_name()

GF_ProtoFieldInterface* gf_sg_proto_field_find_by_name ( GF_Proto proto,
char *  fieldName 
)

locates a field declaration by name

Parameters
protothe target proto
fieldNamethe name of the field
Returns
the proto field interface or NULL if not found

◆ gf_sg_proto_field_find()

GF_ProtoFieldInterface* gf_sg_proto_field_find ( GF_Proto proto,
u32  fieldIndex 
)

locates field declaration by index

Parameters
protothe target proto
fieldIndex0-based index of the field to query
Returns
the proto field interface or NULL if not found

◆ gf_sg_proto_field_new()

GF_ProtoFieldInterface* gf_sg_proto_field_new ( GF_Proto proto,
u32  fieldType,
u32  eventType,
char *  fieldName 
)

creates a new field declaration in the proto. of given fieldtype and eventType fieldName can be NULL, if so the name will be fieldN, N being the index of the created field

Parameters
protothe target proto
fieldTypethe data type of the field to create
eventTypethe event type of the field to create
fieldNamethe name of the field to create (may be NULL)
Returns
the new proto field interface

◆ gf_sg_proto_field_set_ised()

GF_Err gf_sg_proto_field_set_ised ( GF_Proto proto,
u32  protoFieldIndex,
GF_Node node,
u32  nodeFieldIndex 
)

assigns the node field to a field of the proto (the node field IS the proto field) the node shall be a node of the proto scenegraph, and the fieldtype/eventType of both fields shall match (except SF/MFString and MF/SFURL which are allowed) due to BIFS semantics

Parameters
protothe target proto
protoFieldIndexthe proto field index to assign
nodethe node (shall be part of the proto node code) to link to
nodeFieldIndexthe field index of the node to link to
Returns
error if any

◆ gf_sg_proto_field_get_field()

GF_Err gf_sg_proto_field_get_field ( GF_ProtoFieldInterface field,
GF_FieldInfo info 
)

returns field info of the field - this is typically used to setup the default value of the field

Parameters
fieldthe proto field interface to query
infofilled with the proto field interface info
Returns
error if any

◆ gf_sg_proto_create_instance()

GF_Node* gf_sg_proto_create_instance ( GF_SceneGraph sg,
GF_Proto proto 
)

creates the proto instance without the proto code

Parameters
sgthe target scene graph of the node
protothe proto to instanciate
Returns
the new prototype instance node

◆ gf_sg_proto_load_code()

GF_Err gf_sg_proto_load_code ( GF_Node proto_inst)

loads code in this instance - all subprotos are automatically created, thus you must only instantiate top-level protos. VRML/BIFS doesn't allow for non top-level proto instanciation in the main graph All nodes created in this proto will be forwarded to the app for initialization

Parameters
proto_instthe proto instance to load
Returns
error if any

◆ gf_sg_find_proto()

GF_Proto* gf_sg_find_proto ( GF_SceneGraph sg,
u32  ProtoID,
char *  name 
)

locates a prototype definition by ID or by name. when looking by name, ID is ignored

Parameters
sgthe target scene graph of the proto
ProtoIDthe ID of the proto to locate
namethe name of the proto to locate
Returns
the proto node or NULL if not found

◆ gf_sg_delete_all_protos()

GF_Err gf_sg_delete_all_protos ( GF_SceneGraph sg)

deletes all protos in given scene - does NOT delete instances of protos, only the proto object is destroyed

Parameters
sgthe target scene graph
Returns
error if any

◆ gf_node_get_proto()

GF_Proto* gf_node_get_proto ( GF_Node node)

gets proto of a prototype instance node

Parameters
nodethe target prototype instance node
Returns
the proto node or NULL if the node is not a prototype instance or the source proto was destroyed

◆ gf_sg_proto_get_id()

u32 gf_sg_proto_get_id ( GF_Proto proto)

returns the ID of a proto

Parameters
protothe target proto
Returns
the proto ID

◆ gf_sg_proto_get_class_name()

const char* gf_sg_proto_get_class_name ( GF_Proto proto)

returns the name of a proto

Parameters
protothe target proto
Returns
the proto name

◆ gf_sg_proto_field_is_sftime_offset()

Bool gf_sg_proto_field_is_sftime_offset ( GF_Node node,
GF_FieldInfo field 
)

checks if a proto instance field is an SFTime routed to a startTime/stopTime field in the proto code (MPEG-4 specific for updates)

Parameters
nodethe target prototype instance node
fieldthe target field info
Returns
GF_TRUE if this is the case

◆ gf_sg_proto_instance_set_ised()

GF_Err gf_sg_proto_instance_set_ised ( GF_Node protoinst,
u32  protoFieldIndex,
GF_Node node,
u32  nodeFieldIndex 
)

sets an ISed (route between proto instance and internal proto code) field in a proto instance (not a proto) - this is needed with dynamic node creation inside a proto instance (conditionals)

Parameters
protoinstthe target prototype instance node
protoFieldIndexfield index in prototype instance node
nodethe target node
nodeFieldIndexfield index in the target node
Returns
error if any

◆ gf_node_get_proto_root()

GF_Node* gf_node_get_proto_root ( GF_Node node)

returns root node (the one and only one being traversed) of this proto instance if any

Parameters
nodethe target prototype instance node
Returns
the root node of the proto code - may be NULL

◆ gf_sg_proto_mark_field_loaded()

void gf_sg_proto_mark_field_loaded ( GF_Node node,
GF_FieldInfo info 
)

indicates proto field has been parsed and its value is valid - this is needed for externProtos not specifying default values

Parameters
nodethe target prototype instance node
infothe target field info

◆ gf_sg_set_proto_loader()

void gf_sg_set_proto_loader ( GF_SceneGraph sg,
GF_SceneGraph *(*)(void *SceneCallback, MFURL *lib_url)  GetExternProtoLib 
)

sets proto loader callback - callback user data is the same as simulation time callback

GetExternProtoLib is a pointer to the proto lib loader - this callback shall return the LPSCENEGRAPH of the extern proto lib if found and loaded, NULL if not found and GF_SG_INTERNAL_PROTO for internal hardcoded protos (extensions of MPEG-4 scene graph used for module deveopment)

Parameters
sgthe target scene graph
GetExternProtoLibthe callback function

◆ gf_sg_proto_get_extern_url()

MFURL* gf_sg_proto_get_extern_url ( GF_Proto proto)

gets a pointer to the MF URL field for externProto info - DO NOT TOUCH THIS FIELD

Parameters
protothe target proto field
Returns
the MFURL associated with an extern proto, or NULL if proto is not an extern proto

◆ gf_sg_script_field_new()

GF_ScriptField* gf_sg_script_field_new ( GF_Node script,
u32  eventType,
u32  fieldType,
const char *  name 
)

creates new sript field - script fields are dynamically added to the node, and thus can be accessed through the same functions as other GF_Node fields

Parameters
scriptthe script node
eventTypethe event type of the new field
fieldTypethe data type of the new field
namethe name of the new field
Returns
a new scritp field

◆ gf_sg_script_field_get_info()

GF_Err gf_sg_script_field_get_info ( GF_ScriptField field,
GF_FieldInfo info 
)

retrieves field info of a script field object, useful to get the field index

Parameters
fieldthe script field to query
infofilled with the field info
Returns
error if any

◆ gf_sg_script_event_in()

void gf_sg_script_event_in ( GF_Node script,
GF_FieldInfo in_field 
)

activates eventIn for script node - needed for BIFS field replace

Parameters
scriptthe target script node
in_fieldthe field info of the activated event in field

◆ gf_node_event_out()

void gf_node_event_out ( GF_Node n,
u32  FieldIndex 
)

signals eventOut has been set by field index

Note
Routes are automatically triggered when the event is signaled
Parameters
nthe target node emitin the event
FieldIndexthe field index emiting the event

◆ gf_node_event_out_str()

void gf_node_event_out_str ( GF_Node n,
const char *  eventName 
)

signals eventOut has been set by event name.

Note
Routes are automatically triggered when the event is signaled
Parameters
nthe target node emitin the event
eventNamethe name of the field emiting the event

◆ gf_node_mpeg4_type_by_class_name()

u32 gf_node_mpeg4_type_by_class_name ( const char *  node_name)

gets MPEG-4 / VRML node tag by class name

Parameters
node_namethe node name
Returns
the node tag

◆ gf_node_x3d_type_by_class_name()

u32 gf_node_x3d_type_by_class_name ( const char *  node_name)

gets X3D node tag by class name

Parameters
node_namethe node name
Returns
the node tag

◆ gf_node_proto_is_grouping()

Bool gf_node_proto_is_grouping ( GF_Node n)

check if a hardcoded prototype node acts as a grouping node

Parameters
nthe target prototype instance node
Returns
GF_TRUE if acting as a grouping node

◆ gf_node_proto_set_grouping()

GF_Err gf_node_proto_set_grouping ( GF_Node n)

tags a hardcoded proto as being a grouping node

Parameters
nthe target prototype instance node
Returns
error if any

◆ gf_node_set_proto_eventin_handler()

GF_Err gf_node_set_proto_eventin_handler ( GF_Node n,
u32  fieldIndex,
void(*)(GF_Node *pThis, struct _route *route)  event_in_cbk 
)

assigns callback to an eventIn field of an hardcoded proto

Parameters
nthe target prototype instance node
fieldIndexthe target field index
event_in_cbkthe event callback function
Returns
error if any