예제 #1
0
void compositor_init_elevation_grid(GF_Compositor *compositor, GF_Node *node)
{
	M_ElevationGrid *eg = (M_ElevationGrid *)node;
	drawable_3d_new(node);
	gf_node_set_callback_function(node, TraverseElevationGrid);
	eg->on_set_height = ElevationGrid_SetHeight;
}
예제 #2
0
/*this is ugly but we have no choice, we need to clone the conditional stack because of externProto*/
void BIFS_SetupConditionalClone(GF_Node *node, GF_Node *orig)
{
	M_Conditional *ptr;
	u32 i;
	ConditionalStack *priv_orig, *priv;
	priv_orig = (ConditionalStack*)gf_node_get_private(orig);
	/*looks we're not in BIFS*/
	if (!priv_orig) {
		GF_Command *ori_com;
		M_Conditional *c_orig, *c_dest;
		c_orig = (M_Conditional *)orig;
		c_dest = (M_Conditional *)node;
		gf_node_init(node);
		/*and clone all commands*/
		i=0;
		while ((ori_com = (GF_Command*)gf_list_enum(c_orig->buffer.commandList, &i))) {
			GF_Command *dest_com = gf_sg_command_clone(ori_com, gf_node_get_graph(node));
			if (dest_com) gf_list_add(c_dest->buffer.commandList, dest_com);
		}
		return;
	}
	priv = (ConditionalStack*)malloc(sizeof(ConditionalStack));
	priv->codec = priv_orig->codec;
	priv->info = priv_orig->info;
	gf_node_set_callback_function(node, Conditional_PreDestroy);
	gf_node_set_private(node, priv);
	ptr = (M_Conditional *)node;
	ptr->on_activate = Conditional_OnActivate;
	ptr->on_reverseActivate = Conditional_OnReverseActivate;
}
예제 #3
0
void compositor_init_switch(GF_Compositor *compositor, GF_Node *node)
{
	SwitchStack *st = (SwitchStack *)gf_malloc(sizeof(SwitchStack));
	st->last_switch = -1;
	gf_node_set_private(node, st);
	gf_node_set_callback_function(node, TraverseSwitch);
}
예제 #4
0
파일: mpeg4_valuator.c 프로젝트: erelh/gpac
Bool InitValuator(M_Valuator *node)
{
	MFVec4f *temp = gf_sg_vrml_field_pointer_new(GF_SG_VRML_MFROTATION);
	if (!temp) return 1;

	node->on_inSFTime = Valuator_SetInSFTime;
	node->on_inSFBool = Valuator_SetInSFBool;
	node->on_inSFColor = Valuator_SetInSFColor;
	node->on_inSFInt32 = Valuator_SetInSFInt32;
	node->on_inSFFloat = Valuator_SetInSFFloat;
	node->on_inSFVec2f = Valuator_SetInSFVec2f;
	node->on_inSFVec3f = Valuator_SetInSFVec3f;
	node->on_inSFRotation = Valuator_SetInSFRotation;
	node->on_inSFString = Valuator_SetInSFString;
	node->on_inMFColor = Valuator_SetInMFColor;
	node->on_inMFInt32 = Valuator_SetInMFInt32;
	node->on_inMFFloat = Valuator_SetInMFFloat;
	node->on_inMFVec2f = Valuator_SetInMFVec2f;
	node->on_inMFVec3f = Valuator_SetInMFVec3f;
	node->on_inMFRotation = Valuator_SetInMFRotation;
	node->on_inMFString = Valuator_SetInMFString;

	gf_node_set_private((GF_Node*)node, temp);
	gf_node_set_callback_function((GF_Node*)node, valuator_destroy);

	return 1;
}
예제 #5
0
void R2D_InitCompositeTexture2D(Render2D *sr, GF_Node *node)
{
	M_CompositeTexture2D *c2d = (M_CompositeTexture2D *)node;
	Composite2DStack *st;
	GF_SAFEALLOC(st, Composite2DStack);
	gf_sr_texture_setup(&st->txh, sr->compositor, node);
	st->txh.update_texture_fcnt = UpdateComposite2D;

	st->txh.flags = GF_SR_TEXTURE_COMPOSITE;
	if ((c2d->repeatSandT==1) || (c2d->repeatSandT==3) ) st->txh.flags |= GF_SR_TEXTURE_REPEAT_S;
	if (c2d->repeatSandT>1) st->txh.flags |= GF_SR_TEXTURE_REPEAT_T;

	/*create composite surface*/
	st->surf = NewVisualSurface2D();
	st->surf->composite = st;
	st->surf->GetSurfaceAccess = C2D_GetSurfaceAccess;
	st->surf->ReleaseSurfaceAccess = C2D_ReleaseSurfaceAccess;

	/*Bitmap drawn with brush, not hardware since we don't know how the graphics driver handles the texture bytes*/
	st->surf->DrawBitmap = NULL;
	st->surf->SupportsFormat = NULL;
	st->first = 1;
	st->surf->render = sr;
	st->sensors = gf_list_new();
	gf_node_set_private(node, st);
	gf_node_set_callback_function(node, DestroyComposite2D);
	R2D_RegisterSurface(sr, st->surf);

}
예제 #6
0
void compositor_init_bitwrapper(GF_Compositor *compositor, GF_Node *node)
{
	M_BitWrapper *bit;
	bit = (M_BitWrapper *)node;
	gf_node_set_private(node, gf_node_get_private(bit->node));
	gf_node_set_callback_function(node, TraverseBitWrapper);
}
예제 #7
0
void compositor_init_indexed_triangle_strip_set(GF_Compositor *compositor, GF_Node *node)
{
	X_IndexedTriangleStripSet *itss = (X_IndexedTriangleStripSet*)node;
	drawable_3d_new(node);
	gf_node_set_callback_function(node, TraverseIndexedTriangleStripSet);
	itss->on_set_index = ITSS_SetIndex;
}
예제 #8
0
void compositor_init_lod(GF_Compositor *compositor, GF_Node *node)
{
	s32 *stack = (s32*)gf_malloc(sizeof(s32));
	*stack = -1;
	gf_node_set_callback_function(node, TraverseLOD);
	gf_node_set_private(node, stack);
}
예제 #9
0
void compositor_init_group(GF_Compositor *compositor, GF_Node *node)
{
	GroupingNode2D *ptr;
	GF_SAFEALLOC(ptr, GroupingNode2D);
	gf_node_set_private(node, ptr);
	gf_node_set_callback_function(node, TraverseGroup);
}
예제 #10
0
void compositor_init_layer3d(GF_Compositor *compositor, GF_Node *node)
{
	Layer3DStack *stack;
	GF_SAFEALLOC(stack, Layer3DStack);
	if (!stack) {
		GF_LOG(GF_LOG_ERROR, GF_LOG_COMPOSE, ("[Compositor] Failed to allocate layer 3d stack\n"));
		return;
	}

	stack->visual = visual_new(compositor);
	stack->visual->type_3d = 2;
	stack->visual->camera.is_3D = 1;
	stack->visual->camera.visibility = 0;
	stack->visual->camera.speed = FIX_ONE;
	camera_invalidate(&stack->visual->camera);
	stack->first = 1;

	stack->txh.compositor = compositor;
	stack->drawable = drawable_new();
	stack->drawable->node = node;
	stack->drawable->flags = DRAWABLE_USE_TRAVERSE_DRAW;

	gf_node_set_private(node, stack);
	gf_node_set_callback_function(node, TraverseLayer3D);
}
예제 #11
0
void compositor_init_directional_light(GF_Compositor *compositor, GF_Node *node)
{
	Bool *stack = gf_malloc(sizeof(Bool));
	*stack = 0;
	gf_node_set_private(node, stack);
	gf_node_set_callback_function(node, TraverseDirectionalLight);
}
예제 #12
0
void compositor_init_svg_path(GF_Compositor *compositor, GF_Node *node)
{
	Drawable *dr = drawable_stack_new(compositor, node);
	gf_path_del(dr->path);
	dr->path = NULL;
	gf_node_set_callback_function(node, svg_traverse_path);
}
예제 #13
0
void R2D_InitSwitch(Render2D *sr, GF_Node *node)
{
	SwitchStack *st = (SwitchStack *)malloc(sizeof(SwitchStack));
	st->last_switch = -1;
	gf_node_set_private(node, st);
	gf_node_set_callback_function(node, RenderSwitch);
}
예제 #14
0
void R2D_InitGroup(Render2D *sr, GF_Node *node)
{
	GroupingNode2D *stack = (GroupingNode2D *)malloc(sizeof(GroupingNode2D));
	SetupGroupingNode2D(stack, sr, node);
	gf_node_set_private(node, stack);
	gf_node_set_callback_function(node, RenderGroup);
}
예제 #15
0
void compositor_init_orderedgroup(GF_Compositor *compositor, GF_Node *node)
{
	OrderedGroupStack *ptr;
	GF_SAFEALLOC(ptr, OrderedGroupStack);	
	gf_node_set_private(node, ptr);
	gf_node_set_callback_function(node, TraverseOrderedGroup);
}
예제 #16
0
void compositor_init_compositetexture2d(GF_Compositor *compositor, GF_Node *node)
{
	M_CompositeTexture2D *c2d = (M_CompositeTexture2D *)node;
	CompositeTextureStack *st;
	GF_SAFEALLOC(st, CompositeTextureStack);
	st->sensors = gf_list_new();
	st->previous_sensors = gf_list_new();
	gf_sc_texture_setup(&st->txh, compositor, node);
	/*remove texture from compositor and add it at the end, so that any sub-textures are handled before*/
	gf_list_del_item(compositor->textures, &st->txh);
	gf_list_add(compositor->textures, &st->txh);

	st->txh.update_texture_fcnt = composite_update;

	if ((c2d->repeatSandT==1) || (c2d->repeatSandT==3) ) st->txh.flags |= GF_SR_TEXTURE_REPEAT_S;
	if (c2d->repeatSandT>1) st->txh.flags |= GF_SR_TEXTURE_REPEAT_T;

	/*create composite visual*/
	st->visual = visual_new(compositor);
	st->visual->offscreen = node;
	st->visual->GetSurfaceAccess = composite_get_video_access;
	st->visual->ReleaseSurfaceAccess = composite_release_video_access;
	st->visual->raster_surface = compositor->rasterizer->surface_new(compositor->rasterizer, 1);
	st->visual->DrawBitmap = composite2d_draw_bitmap;

	st->first = 1;
	st->visual->compositor = compositor;
	gf_node_set_private(node, st);
	gf_node_set_callback_function(node, composite_traverse);
	gf_sc_visual_register(compositor, st->visual);
}
예제 #17
0
void R2D_InitTransformMatrix2D(Render2D *sr, GF_Node *node)
{
	Transform2DStack *stack = (Transform2DStack *)malloc(sizeof(Transform2DStack));
	SetupGroupingNode2D((GroupingNode2D *)stack, sr, node);
	gf_mx2d_init(stack->mat);
	gf_node_set_private(node, stack);
	gf_node_set_callback_function(node, RenderTransformMatrix2D);
}
예제 #18
0
void R2D_InitColorTransform(Render2D *sr, GF_Node *node)
{
	ColorTransformStack *stack = (ColorTransformStack *)malloc(sizeof(ColorTransformStack));
	SetupGroupingNode2D((GroupingNode2D *)stack, sr, node);
	gf_cmx_init(&stack->cmat);
	gf_node_set_private(node, stack);
	gf_node_set_callback_function(node, RenderColorTransform);
}
예제 #19
0
void compositor_init_svg_g(GF_Compositor *compositor, GF_Node *node)
{
	SVGgStack *stack;
	GF_SAFEALLOC(stack, SVGgStack);
	gf_node_set_private(node, stack);

	gf_node_set_callback_function(node, svg_traverse_g);
}
예제 #20
0
void compositor_init_spot_light(GF_Compositor *compositor, GF_Node *node)
{
	Bool *vis = gf_malloc(sizeof(Bool));
	*vis = 0;
	gf_node_set_private(node, vis);
	/*no need for a stck*/
	gf_node_set_callback_function(node, TraverseSpotLight);
}
예제 #21
0
void compositor_init_svg_switch(GF_Compositor *compositor, GF_Node *node)
{
	s32 *selected_idx;
	GF_SAFEALLOC(selected_idx, u32);
	*selected_idx = -1;
	gf_node_set_private(node, selected_idx);
	gf_node_set_callback_function(node, svg_traverse_switch);
}
예제 #22
0
void compositor_init_ils(GF_Compositor *compositor, GF_Node *node)
{
	M_IndexedLineSet *ils = (M_IndexedLineSet *)node;
	drawable_3d_new(node);
	gf_node_set_callback_function(node, TraverseILS);
	ils->on_set_colorIndex = ILS_SetColorIndex;
	ils->on_set_coordIndex = ILS_SetCoordIndex;
}
예제 #23
0
void InitStringSensor(GF_Scene *scene, GF_Node *node)
{
	StringSensorStack*st;
	GF_SAFEALLOC(st, StringSensorStack)
	st->term = scene->root_od->term;
	gf_node_set_private(node, st);
	gf_node_set_callback_function(node, DestroyStringSensor);
	gf_list_add(scene->root_od->term->x3d_sensors, node);
}
예제 #24
0
void R2D_InitPathLayout(Render2D *sr, GF_Node *node)
{
	PathLayoutStack *stack;
	GF_SAFEALLOC(stack, PathLayoutStack);
	SetupGroupingNode2D((GroupingNode2D*)stack, sr, node);

	gf_node_set_private(node, stack);
	gf_node_set_callback_function(node, RenderPathLayout);
}
예제 #25
0
void compositor_init_indexed_line_set2d(GF_Compositor *compositor, GF_Node *node)
{
	M_IndexedLineSet2D *ils2D = (M_IndexedLineSet2D *)node;
	Drawable *stack = drawable_stack_new(compositor, node);
	stack->flags = DRAWABLE_USE_TRAVERSE_DRAW;
	gf_node_set_callback_function(node, TraverseILS2D);
	ils2D->on_set_colorIndex = ILS2D_SetColorIndex;
	ils2D->on_set_coordIndex = ILS2D_SetCoordIndex;
}
예제 #26
0
void compositor_init_envtest(GF_Compositor *compositor, GF_Node *node)
{
	M_EnvironmentTest *envtest = (M_EnvironmentTest *)node;
	gf_list_add(compositor->env_tests, node);
	gf_node_set_private(node, compositor);
	gf_node_set_callback_function(node, traverse_envtest);

	envtest->on_evaluate = envtest_evaluate;
}
예제 #27
0
void InitInputSensor(GF_Scene *scene, GF_Node *node)
{
	ISStack *stack;
	GF_SAFEALLOC(stack, ISStack);
	stack->is = (M_InputSensor *) node;
	gf_node_set_private(node, stack);
	gf_node_set_callback_function(node, TraverseInputSensor);
	gf_term_queue_node_traverse(scene->root_od->term, node);
}
예제 #28
0
void InitInputSensor(GF_InlineScene *is, GF_Node *node)
{
	ISStack *stack;
	GF_SAFEALLOC(stack, ISStack);
	stack->is = (M_InputSensor *) node;
	gf_node_set_private(node, stack);
	gf_node_set_callback_function(node, RenderInputSensor);
	gf_term_add_render_node(is->root_od->term, node);
}
예제 #29
0
void compositor_init_colortransform(GF_Compositor *compositor, GF_Node *node)
{
	ColorTransformStack *stack;
	GF_SAFEALLOC(stack, ColorTransformStack);

	gf_cmx_init(&stack->cmat);
	gf_node_set_private(node, stack);
	gf_node_set_callback_function(node, TraverseColorTransform);
}
예제 #30
0
void compositor_init_transformmatrix2d(GF_Compositor *compositor, GF_Node *node)
{
	Transform2DStack *stack;
	GF_SAFEALLOC(stack, Transform2DStack);

	gf_mx2d_init(stack->mat);
	gf_node_set_private(node, stack);
	gf_node_set_callback_function(node, TraverseTransformMatrix2D);
}