1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/* tidy-depth-group.c: Simple ClutterGroup extension that enables depth testing
*
* Copyright (C) 2008 OpenedHand
*
* This library 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 of the License, or (at your option) any later version.
*
* This library 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; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Written by: Chris Lord <chris@openedhand.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <clutter/clutter.h>
#include <cogl/cogl.h>
#include "tidy-depth-group.h"
/**
* SECTION:tidy-depth-group
* @short_description: A container with depth testing
*
* #TidyDepthGroup is a special subclass of #ClutterGroup that enables
* GL depth testing when painting its children.
*/
G_DEFINE_TYPE (TidyDepthGroup, tidy_depth_group, CLUTTER_TYPE_GROUP)
static void
tidy_depth_group_paint (ClutterActor *actor)
{
cogl_enable_depth_test (TRUE);
CLUTTER_ACTOR_CLASS (tidy_depth_group_parent_class)->paint (actor);
cogl_enable_depth_test (FALSE);
}
static void
tidy_depth_group_class_init (TidyDepthGroupClass *klass)
{
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
actor_class->paint = tidy_depth_group_paint;
}
static void
tidy_depth_group_init (TidyDepthGroup *self)
{
}
ClutterActor *
tidy_depth_group_new (void)
{
return CLUTTER_ACTOR (g_object_new (TIDY_TYPE_DEPTH_GROUP, NULL));
}
|