4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2011 Intel Corporation.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see
20 * <http://www.gnu.org/licenses/>.
23 * Robert Bragg <robert@linux.intel.com>
30 #include "cogl-util.h"
31 #include "cogl-depth-state-private.h"
32 #include "cogl-depth-state.h"
35 cogl_depth_state_init (CoglDepthState *state)
37 state->magic = COGL_DEPTH_STATE_MAGIC;
39 /* The same as the GL defaults */
40 state->test_enabled = FALSE;
41 state->write_enabled = TRUE;
42 state->test_function = COGL_DEPTH_TEST_FUNCTION_LESS;
43 state->range_near = 0;
48 cogl_depth_state_set_test_enabled (CoglDepthState *state,
51 _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
52 state->test_enabled = enabled;
56 cogl_depth_state_get_test_enabled (CoglDepthState *state)
58 _COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
59 return state->test_enabled;
63 cogl_depth_state_set_write_enabled (CoglDepthState *state,
66 _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
67 state->write_enabled = enabled;
71 cogl_depth_state_get_write_enabled (CoglDepthState *state)
73 _COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
74 return state->write_enabled;
78 cogl_depth_state_set_test_function (CoglDepthState *state,
79 CoglDepthTestFunction function)
81 _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
82 state->test_function = function;
86 cogl_depth_state_get_test_function (CoglDepthState *state)
88 _COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
89 return state->test_function;
93 cogl_depth_state_set_range (CoglDepthState *state,
97 _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
98 state->range_near = near;
99 state->range_far = far;
103 cogl_depth_state_get_range (CoglDepthState *state,
107 _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
108 *near_out = state->range_near;
109 *far_out = state->range_far;