⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scenegraph_dev.h

📁 一个用于智能手机的多媒体库适合S60 WinCE的跨平台开发库
💻 H
📖 第 1 页 / 共 2 页
字号:
/* *			GPAC - Multimedia Framework C SDK * *			Copyright (c) Jean Le Feuvre 2000-2005 *					All rights reserved * *  This file is part of GPAC / Scene Graph sub-project * *  GPAC is free software; you can redistribute it and/or modify *  it under the terms of the GNU Lesser General Public License as published by *  the Free Software Foundation; either version 2, or (at your option) *  any later version. *    *  GPAC is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU Lesser General Public License for more details. *    *  You should have received a copy of the GNU Lesser General Public *  License along with this library; see the file COPYING.  If not, write to *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  * */#ifndef _GF_SCENEGRAPH_DEV_H_#define _GF_SCENEGRAPH_DEV_H_//#define GF_NODE_USE_POINTERS/*defined this macro to enable cyclic render*/#define GF_CYCLIC_RENDER_ON/*defined this macro to enable scene replacement from inside (through conditional)*///#define GF_SELF_REPLACE_ENABLE/*for vrml base types, ROUTEs and PROTOs*/#include <gpac/scenegraph_vrml.h>#include <gpac/scenegraph_svg.h>#ifdef GPAC_HAS_SPIDERMONKEY/*WIN32 and WinCE config (no configure script)*/#if defined(WIN32) || defined(_WIN32_WCE) || defined(__SYMBIAN32__)#ifndef XP_PC#define XP_PC#endif/*WINCE specific config*/#if defined(_WIN32_WCE)#include <windows.h>#define XP_WINCE#endif#endif/*other platforms should be setup through configure*/#include <jsapi.h> #endifvoid gf_node_setup(GF_Node *p, u32 tag);typedef struct _parent_list{	struct _parent_list *next;	GF_Node *node;} GF_ParentList;/*internal flags reserved for NodeID*/#define GF_NODE_IS_DEF			0x80000000	// 1<<31#define GF_NODE_IS_DEACTIVATED	0x40000000	// 1<<30#ifdef GF_CYCLIC_RENDER_ON#define GF_NODE_IN_RENDER		0x20000000	//	1<<29#define GF_NODE_INTERNAL_FLAGS	0xE0000000#else#define GF_NODE_INTERNAL_FLAGS	0xC0000000#endifstruct _node_interactive_ext{	/*routes on eventOut, ISed routes, ... for VRML-based scene graphs	event listeners for all others - THIS IS DYNAMICALLY CREATED*/	GF_List *events;	/* SVG animations are registered in the target node  - THIS IS DYNAMICALLY CREATED*/	GF_List *animations;};typedef struct _nodepriv{	/*node type*/	u16 tag;	/*number of instances of this node in the graph (VRML/MPEG-4 only*/	u16 num_instances;	/*node flags*/	u32 flags;	/*scenegraph holding the node*/	struct __tag_scene_graph *scenegraph;#ifdef GF_NODE_USE_POINTERS	const char *name;	u32 (*get_field_count)(struct _base_node *node, u8 IndexMode);	void (*node_del)(struct _base_node *node);	GF_Err (*get_field) (struct _base_node *node, GF_FieldInfo *info);#endif	/*user defined callback function */	void (*UserCallback)(struct _base_node *node, void *render_stack, Bool node_destroy);	/*user defined stack*/	void *UserPrivate;	/*list of all parent nodes (whether DEF or not, needed to invalidate parent tree)*/	GF_ParentList *parents;		/*holder for all interactive stuff - THIS IS DYNAMICALLY CREATED*/	struct _node_interactive_ext *interact;} NodePriv;typedef struct __tag_node_id{	struct __tag_node_id *next;	GF_Node *node;	/*node ID*/	u32 NodeID;	/*node def name*/	char *NodeName;} NodeIDedItem;struct __tag_scene_graph {	/*all DEF nodes (explicit)*/	NodeIDedItem *id_node, *id_node_last;	/*all routes available*/	GF_List *Routes;	/*when a proto is instanciated it creates its own scene graph. BIFS/VRML specify that the namespace is the same 	(eg cannot reuse a NodeID or route name/ID), but this could be done differently by some other stds	if NULL this is the main scenegraph*/	struct _proto_instance *pOwningProto;	/*all first-level protos of the graph (the only ones that can be instanciated in this graph)*/	GF_List *protos;	/*all first-level protos of the graph not currently registered - memory handling of graph only*/	GF_List *unregistered_protos;	/*pointer to the root node*/	GF_Node *RootNode;	/*routes to be activated (cascade model). This is used at the top-level graph only (eg	proto routes use that too, ecept ISed fields). It is the app responsability to 	correctly connect or browse scene graphs connected through Inline*/	GF_List *routes_to_activate;	/*since events may trigger deletion of objects we use a 2 step delete*/	GF_List *routes_to_destroy;	u32 simulation_tick;	/*user private data*/	void *userpriv;	/*callback routines*/	/*node callback*/	void (*NodeCallback)(void *user_priv, u32 type, GF_Node *node, void *ctxdata);	/*real scene time callback*/	Double (*GetSceneTime)(void *userpriv);	GF_SceneGraph *(*GetExternProtoLib)(void *userpriv, MFURL *lib_url);	/*parent scene if any*/	struct __tag_scene_graph *parent_scene;	/*size info and pixel metrics - this is not used internally, however it helps when rendering	and decoding modules don't know each-other (as in MPEG4)*/	u32 width, height;	Bool usePixelMetrics;	/*application interface for javascript*/	gf_sg_script_action script_action;	void *script_action_cbck;	/*script loader*/	void (*script_load)(GF_Node *node);	u32 max_defined_route_id;#ifdef GF_SELF_REPLACE_ENABLE	/*to detect replace scene from within conditionals*/	Bool graph_has_been_reset;#endif#ifndef GPAC_DISABLE_SVG	GF_List *xlink_hrefs;	GF_List *smil_timed_elements;	Bool update_smil_timing;	/*listeners to add*/	GF_List *listeners_to_add;#ifdef GPAC_HAS_SPIDERMONKEY	struct __tag_svg_script_ctx *svg_js;#endif#endif#ifdef GPAC_HAS_SPIDERMONKEY	GF_List *scripts;	/*			Note about reference counter	  A DOM document (<=> scenegraph) may be created through javascript, and the JS object having created the 	  document may be destroyed while the document is still in use. Moreover with XMLHttpRequest, the	  "associated" doc is re-created at each request, but the script may still refer to the original document.	  Since the document doesn't have a fixed owner, a reference counter is use and the scenegraph is kept alive 	  until the last object using it is destroyed.	If this counter is set to 0 when creating DOM Elements/..., this means the scenegraph is hold by an external	entity (typically the player), and cannot be destroyed from the scripting engine	*/	u32 reference_count;	/*DOM nodes*/	GF_List *objects;	/*DOM document*/	JSObject *document;#endif};void gf_sg_parent_setup(GF_Node *pNode);void gf_sg_parent_reset(GF_Node *pNode);void *gf_node_get_name_address(GF_Node*node);struct _route{	u8 is_setup;	/*set to true for proto IS fields*/	u8 IS_route;	u32 ID;	char *name;	GF_Node *FromNode;	GF_FieldInfo FromField;	GF_Node *ToNode;	GF_FieldInfo ToField;	/*scope of this route*/	GF_SceneGraph *graph;	u32 lastActivateTime;};void gf_sg_route_unqueue(GF_SceneGraph *sg, GF_Route *r);/*returns TRUE if route modified destination node*/Bool gf_sg_route_activate(GF_Route *r);void gf_sg_route_queue(GF_SceneGraph *pSG, GF_Route *r);void gf_sg_destroy_routes(GF_SceneGraph *sg);/*MPEG4 def*/GF_Node *gf_sg_mpeg4_node_new(u32 NodeTag);u32 gf_sg_mpeg4_node_get_child_ndt(GF_Node *node);GF_Err gf_sg_mpeg4_node_get_field_index(GF_Node *node, u32 inField, u8 code_mode, u32 *fieldIndex);#ifndef GF_NODE_USE_POINTERSGF_Err gf_sg_mpeg4_node_get_field(GF_Node *node, GF_FieldInfo *field);u32 gf_sg_mpeg4_node_get_field_count(GF_Node *node, u8 code_mode);void gf_sg_mpeg4_node_del(GF_Node *node);const char *gf_sg_mpeg4_node_get_class_name(u32 NodeTag);#endifBool gf_sg_mpeg4_node_get_aq_info(GF_Node *node, u32 FieldIndex, u8 *QType, u8 *AType, Fixed *b_min, Fixed *b_max, u32 *QT13_bits);s32 gf_sg_mpeg4_node_get_field_index_by_name(GF_Node *node, char *name);/*X3D def*/GF_Node *gf_sg_x3d_node_new(u32 NodeTag);#ifndef GF_NODE_USE_POINTERSGF_Err gf_sg_x3d_node_get_field(GF_Node *node, GF_FieldInfo *field);u32 gf_sg_x3d_node_get_field_count(GF_Node *node);void gf_sg_x3d_node_del(GF_Node *node);const char *gf_sg_x3d_node_get_class_name(u32 NodeTag);#endifs32 gf_sg_x3d_node_get_field_index_by_name(GF_Node *node, char *name);void gf_sg_mfint32_del(MFInt32 par);void gf_sg_mffloat_del(MFFloat par);void gf_sg_mfdouble_del(MFDouble par);void gf_sg_mfbool_del(MFBool par);void gf_sg_mfcolor_del(MFColor par);void gf_sg_mfcolor_rgba_del(MFColorRGBA par);void gf_sg_mfrotation_del(MFRotation par);void gf_sg_mfstring_del(MFString par);void gf_sg_mftime_del(MFTime par);void gf_sg_mfvec2f_del(MFVec2f par);void gf_sg_mfvec3f_del(MFVec3f par);void gf_sg_mfvec4f_del(MFVec4f par);void gf_sg_mfvec2d_del(MFVec2d par);void gf_sg_mfvec3d_del(MFVec3d par);void gf_sg_mfurl_del(MFURL url);void gf_sg_sfimage_del(SFImage im);void gf_sg_sfstring_del(SFString par);void gf_sg_mfscript_del(MFScript sc);void gf_sg_sfcommand_del(SFCommandBuffer cb);void gf_sg_sfurl_del(SFURL url);Bool gf_sg_vrml_node_init(GF_Node *node);Bool gf_sg_vrml_node_changed(GF_Node *node, GF_FieldInfo *field);#ifndef GPAC_DISABLE_SVG/* reset functions for SVG types */void gf_svg_reset_path(SVG_PathData path);void gf_svg_reset_iri(GF_SceneGraph *sg, XMLRI*iri);/* delete functions for SVG types */void gf_svg_delete_paint		(GF_SceneGraph *sg, SVG_Paint *paint);void gf_smil_delete_times		(GF_List *l);void gf_svg_delete_points		(GF_List *l);void gf_svg_delete_coordinates	(GF_List *l);/*for keyTimes, keyPoints and keySplines*/void gf_smil_delete_key_types	(GF_List *l);/*SMIL anim tools*/typedef struct __xlink_attrip_ptrs {	XMLRI *href;	SVG_ContentType *type;	SVG_String *title;	XMLRI *arcrole; 	XMLRI *role;	SVG_String *show;	SVG_String *actuate;} XLinkAttributesPointers;typedef struct __smil_time_attrip_ptrs {	SMIL_Times *begin, *end;	SVG_Clock *clipBegin, *clipEnd;	SMIL_Duration *dur;	SMIL_RepeatCount *repeatCount;	SMIL_Duration *repeatDur;	SMIL_Restart *restart;	SMIL_Fill *fill;	SMIL_Duration *max;	SMIL_Duration *min;	struct _smil_timing_rti *runtime; /* contains values for runtime handling of the SMIL timing */} SMILTimingAttributesPointers;typedef struct __smil_sync_attrip_ptrs {	SMIL_SyncBehavior *syncBehavior, *syncBehaviorDefault;	SMIL_SyncTolerance *syncTolerance, *syncToleranceDefault;	SVG_Boolean *syncMaster;	XMLRI *syncReference;} SMILSyncAttributesPointers;typedef struct __smil_anim_attrip_ptrs {	SMIL_AttributeName *attributeName; 	SMIL_AttributeType *attributeType;	SMIL_AnimateValue *to, *by, *from;	SMIL_AnimateValues *values;	SMIL_CalcMode *calcMode;	SMIL_Accumulate *accumulate;	SMIL_Additive *additive;	SMIL_KeySplines *keySplines;	SMIL_KeyTimes *keyTimes;	SVG_TransformType *type;	SVG_Boolean *lsr_enabled;	SMIL_KeyPoints *keyPoints;	SVG_String *origin;	SVG_Rotate *rotate;	SVG_PathData *path;} SMILAnimationAttributesPointers;typedef struct {	GF_DOM_BASE_NODE	/*shortcuts for xlink, anim, timing attributes*/	XLinkAttributesPointers *xlinkp;	SMILAnimationAttributesPointers *animp;	SMILTimingAttributesPointers *timingp;} SVGTimedAnimBaseElement;GF_Err gf_node_animation_add(GF_Node *node, void *animation);GF_Err gf_node_animation_del(GF_Node *node);u32 gf_node_animation_count(GF_Node *node);void *gf_node_animation_get(GF_Node *node, u32 i);Bool gf_svg_is_inherit(GF_FieldInfo *a);Bool gf_svg_is_current_color(GF_FieldInfo *a);void gf_svg_reset_animate_values(SMIL_AnimateValues anim_values, GF_SceneGraph *sg);void gf_svg_reset_animate_value(SMIL_AnimateValue anim_value, GF_SceneGraph *sg);Bool gf_svg_is_timing_tag(u32 tag);Bool gf_svg_is_animation_tag(u32 tag);u32 gf_svg_get_rendering_flag_if_modified(SVG_Element *n, GF_FieldInfo *info);Bool gf_svg_resolve_smil_times(GF_SceneGraph *sg, void *anim_parent, GF_List *smil_times, Bool is_end, const char *node_name);/* SMIL Timing structures *//* status of an SMIL timed element */ enum {	SMIL_STATUS_WAITING_TO_BEGIN = 0,	SMIL_STATUS_ACTIVE,	SMIL_STATUS_POST_ACTIVE,	SMIL_STATUS_FROZEN,	SMIL_STATUS_DONE};typedef struct {	u32 activation_cycle;	u32 nb_iterations;	/* negative values mean indefinite */	Double begin, 		   end,		   simple_duration, 		   active_duration;} SMIL_Interval;enum{	SMIL_TIMING_EVAL_NONE = 0,	SMIL_TIMING_EVAL_UPDATE,	SMIL_TIMING_EVAL_FREEZE,	SMIL_TIMING_EVAL_REMOVE,	SMIL_TIMING_EVAL_REPEAT,	SMIL_TIMING_EVAL_FRACTION,	SMIL_TIMING_EVAL_DISCARD,	/*signaled the animation element has been inserted in the DOM tree*/	SMIL_TIMING_EVAL_ACTIVATE,	/*signaled the animation element has been removed from the DOM tree*/	SMIL_TIMING_EVAL_DEACTIVATE,};typedef struct _smil_timing_rti{	GF_Node *timed_elt;	SMILTimingAttributesPointers *timingp;	Double scene_time;	/* SMIL element life-cycle status */	u8 status;	u32 cycle_number;	u32 first_frozen;	/* List of possible intervals for activation of the element */	GF_List *intervals;	s32	current_interval_index;	SMIL_Interval *current_interval;	/* Evaluation of animations is postponed untill tree traversal, so that inherit values can be computed	Other timed elements (audio, video, animation) are evaluated directly and do not require	scene tree traversal.*/	Bool postpone;	void (*evaluate)(struct _smil_timing_rti *rti, Fixed normalized_simple_time, u32 state);	u32 evaluate_status;#if 0	/* is called only when the timed element is active */	void (*activation)(struct _smil_timing_rti *rti, Fixed normalized_simple_time);	/* is called (possibly many times) when the timed element is frozen */	void (*freeze)(struct _smil_timing_rti *rti, Fixed normalized_simple_time);	/* is called (only once) when the timed element is restored */	void (*restore)(struct _smil_timing_rti *rti, Fixed normalized_simple_time);	/* is called only when the timed element is inactive and receives a fraction event, the second parameter is ignored */	void (*fraction_activation)(struct _smil_timing_rti *rti, Fixed normalized_simple_time);#endif	/* simulated normalized simple time */	Fixed fraction;	Double media_duration;} SMIL_Timing_RTI;void gf_smil_timing_modified(GF_Node *node, GF_FieldInfo *field);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -