diff --git a/cogl/cogl/cogl-pipeline-state.c b/cogl/cogl/cogl-pipeline-state.c index 8c059e41b..9841d9c0c 100644 --- a/cogl/cogl/cogl-pipeline-state.c +++ b/cogl/cogl/cogl-pipeline-state.c @@ -478,264 +478,6 @@ _cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline, pipeline->dirty_real_blend_enable = TRUE; } -void -cogl_pipeline_get_ambient (CoglPipeline *pipeline, - CoglColor *ambient) -{ - CoglPipeline *authority; - - g_return_if_fail (cogl_is_pipeline (pipeline)); - - authority = - _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); - - cogl_color_init_from_4fv (ambient, - authority->big_state->lighting_state.ambient); -} - -void -cogl_pipeline_set_ambient (CoglPipeline *pipeline, - const CoglColor *ambient) -{ - CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; - CoglPipeline *authority; - CoglPipelineLightingState *lighting_state; - - g_return_if_fail (cogl_is_pipeline (pipeline)); - - authority = _cogl_pipeline_get_authority (pipeline, state); - - lighting_state = &authority->big_state->lighting_state; - if (cogl_color_equal (ambient, &lighting_state->ambient)) - return; - - /* - Flush journal primitives referencing the current state. - * - Make sure the pipeline has no dependants so it may be modified. - * - If the pipeline isn't currently an authority for the state being - * changed, then initialize that state from the current authority. - */ - _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); - - lighting_state = &pipeline->big_state->lighting_state; - lighting_state->ambient[0] = cogl_color_get_red_float (ambient); - lighting_state->ambient[1] = cogl_color_get_green_float (ambient); - lighting_state->ambient[2] = cogl_color_get_blue_float (ambient); - lighting_state->ambient[3] = cogl_color_get_alpha_float (ambient); - - _cogl_pipeline_update_authority (pipeline, authority, state, - _cogl_pipeline_lighting_state_equal); - - pipeline->dirty_real_blend_enable = TRUE; -} - -void -cogl_pipeline_get_diffuse (CoglPipeline *pipeline, - CoglColor *diffuse) -{ - CoglPipeline *authority; - - g_return_if_fail (cogl_is_pipeline (pipeline)); - - authority = - _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); - - cogl_color_init_from_4fv (diffuse, - authority->big_state->lighting_state.diffuse); -} - -void -cogl_pipeline_set_diffuse (CoglPipeline *pipeline, - const CoglColor *diffuse) -{ - CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; - CoglPipeline *authority; - CoglPipelineLightingState *lighting_state; - - g_return_if_fail (cogl_is_pipeline (pipeline)); - - authority = _cogl_pipeline_get_authority (pipeline, state); - - lighting_state = &authority->big_state->lighting_state; - if (cogl_color_equal (diffuse, &lighting_state->diffuse)) - return; - - /* - Flush journal primitives referencing the current state. - * - Make sure the pipeline has no dependants so it may be modified. - * - If the pipeline isn't currently an authority for the state being - * changed, then initialize that state from the current authority. - */ - _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); - - lighting_state = &pipeline->big_state->lighting_state; - lighting_state->diffuse[0] = cogl_color_get_red_float (diffuse); - lighting_state->diffuse[1] = cogl_color_get_green_float (diffuse); - lighting_state->diffuse[2] = cogl_color_get_blue_float (diffuse); - lighting_state->diffuse[3] = cogl_color_get_alpha_float (diffuse); - - - _cogl_pipeline_update_authority (pipeline, authority, state, - _cogl_pipeline_lighting_state_equal); - - pipeline->dirty_real_blend_enable = TRUE; -} - -void -cogl_pipeline_set_ambient_and_diffuse (CoglPipeline *pipeline, - const CoglColor *color) -{ - cogl_pipeline_set_ambient (pipeline, color); - cogl_pipeline_set_diffuse (pipeline, color); -} - -void -cogl_pipeline_get_specular (CoglPipeline *pipeline, - CoglColor *specular) -{ - CoglPipeline *authority; - - g_return_if_fail (cogl_is_pipeline (pipeline)); - - authority = - _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); - - cogl_color_init_from_4fv (specular, - authority->big_state->lighting_state.specular); -} - -void -cogl_pipeline_set_specular (CoglPipeline *pipeline, const CoglColor *specular) -{ - CoglPipeline *authority; - CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; - CoglPipelineLightingState *lighting_state; - - g_return_if_fail (cogl_is_pipeline (pipeline)); - - authority = _cogl_pipeline_get_authority (pipeline, state); - - lighting_state = &authority->big_state->lighting_state; - if (cogl_color_equal (specular, &lighting_state->specular)) - return; - - /* - Flush journal primitives referencing the current state. - * - Make sure the pipeline has no dependants so it may be modified. - * - If the pipeline isn't currently an authority for the state being - * changed, then initialize that state from the current authority. - */ - _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); - - lighting_state = &pipeline->big_state->lighting_state; - lighting_state->specular[0] = cogl_color_get_red_float (specular); - lighting_state->specular[1] = cogl_color_get_green_float (specular); - lighting_state->specular[2] = cogl_color_get_blue_float (specular); - lighting_state->specular[3] = cogl_color_get_alpha_float (specular); - - _cogl_pipeline_update_authority (pipeline, authority, state, - _cogl_pipeline_lighting_state_equal); - - pipeline->dirty_real_blend_enable = TRUE; -} - -float -cogl_pipeline_get_shininess (CoglPipeline *pipeline) -{ - CoglPipeline *authority; - - g_return_val_if_fail (cogl_is_pipeline (pipeline), 0); - - authority = - _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); - - return authority->big_state->lighting_state.shininess; -} - -void -cogl_pipeline_set_shininess (CoglPipeline *pipeline, - float shininess) -{ - CoglPipeline *authority; - CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; - CoglPipelineLightingState *lighting_state; - - g_return_if_fail (cogl_is_pipeline (pipeline)); - - if (shininess < 0.0) - { - g_warning ("Out of range shininess %f supplied for pipeline\n", - shininess); - return; - } - - authority = _cogl_pipeline_get_authority (pipeline, state); - - lighting_state = &authority->big_state->lighting_state; - - if (lighting_state->shininess == shininess) - return; - - /* - Flush journal primitives referencing the current state. - * - Make sure the pipeline has no dependants so it may be modified. - * - If the pipeline isn't currently an authority for the state being - * changed, then initialize that state from the current authority. - */ - _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); - - lighting_state = &pipeline->big_state->lighting_state; - lighting_state->shininess = shininess; - - _cogl_pipeline_update_authority (pipeline, authority, state, - _cogl_pipeline_lighting_state_equal); -} - -void -cogl_pipeline_get_emission (CoglPipeline *pipeline, - CoglColor *emission) -{ - CoglPipeline *authority; - - g_return_if_fail (cogl_is_pipeline (pipeline)); - - authority = - _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); - - cogl_color_init_from_4fv (emission, - authority->big_state->lighting_state.emission); -} - -void -cogl_pipeline_set_emission (CoglPipeline *pipeline, const CoglColor *emission) -{ - CoglPipeline *authority; - CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; - CoglPipelineLightingState *lighting_state; - - g_return_if_fail (cogl_is_pipeline (pipeline)); - - authority = _cogl_pipeline_get_authority (pipeline, state); - - lighting_state = &authority->big_state->lighting_state; - if (cogl_color_equal (emission, &lighting_state->emission)) - return; - - /* - Flush journal primitives referencing the current state. - * - Make sure the pipeline has no dependants so it may be modified. - * - If the pipeline isn't currently an authority for the state being - * changed, then initialize that state from the current authority. - */ - _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); - - lighting_state = &pipeline->big_state->lighting_state; - lighting_state->emission[0] = cogl_color_get_red_float (emission); - lighting_state->emission[1] = cogl_color_get_green_float (emission); - lighting_state->emission[2] = cogl_color_get_blue_float (emission); - lighting_state->emission[3] = cogl_color_get_alpha_float (emission); - - _cogl_pipeline_update_authority (pipeline, authority, state, - _cogl_pipeline_lighting_state_equal); - - pipeline->dirty_real_blend_enable = TRUE; -} - static void _cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline, CoglPipelineAlphaFunc alpha_func) diff --git a/cogl/cogl/cogl-pipeline-state.h b/cogl/cogl/cogl-pipeline-state.h index 319320cc0..ff5e1ebe2 100644 --- a/cogl/cogl/cogl-pipeline-state.h +++ b/cogl/cogl/cogl-pipeline-state.h @@ -120,189 +120,6 @@ void cogl_pipeline_get_color (CoglPipeline *pipeline, CoglColor *color); -/** - * cogl_pipeline_set_ambient: - * @pipeline: A #CoglPipeline object - * @ambient: The components of the desired ambient color - * - * Sets the pipeline's ambient color, in the standard OpenGL lighting - * model. The ambient color affects the overall color of the object. - * - * Since the diffuse color will be intense when the light hits the surface - * directly, the ambient will be most apparent where the light hits at a - * slant. - * - * The default value is (0.2, 0.2, 0.2, 1.0) - * - * Since: 2.0 - * Stability: Unstable - */ -void -cogl_pipeline_set_ambient (CoglPipeline *pipeline, - const CoglColor *ambient); - -/** - * cogl_pipeline_get_ambient: - * @pipeline: A #CoglPipeline object - * @ambient: The location to store the ambient color - * - * Retrieves the current ambient color for @pipeline - * - * Since: 2.0 - * Stability: Unstable - */ -void -cogl_pipeline_get_ambient (CoglPipeline *pipeline, - CoglColor *ambient); - -/** - * cogl_pipeline_set_diffuse: - * @pipeline: A #CoglPipeline object - * @diffuse: The components of the desired diffuse color - * - * Sets the pipeline's diffuse color, in the standard OpenGL lighting - * model. The diffuse color is most intense where the light hits the - * surface directly - perpendicular to the surface. - * - * The default value is (0.8, 0.8, 0.8, 1.0) - * - * Since: 2.0 - * Stability: Unstable - */ -void -cogl_pipeline_set_diffuse (CoglPipeline *pipeline, - const CoglColor *diffuse); - -/** - * cogl_pipeline_get_diffuse: - * @pipeline: A #CoglPipeline object - * @diffuse: The location to store the diffuse color - * - * Retrieves the current diffuse color for @pipeline - * - * Since: 2.0 - * Stability: Unstable - */ -void -cogl_pipeline_get_diffuse (CoglPipeline *pipeline, - CoglColor *diffuse); - -/** - * cogl_pipeline_set_ambient_and_diffuse: - * @pipeline: A #CoglPipeline object - * @color: The components of the desired ambient and diffuse colors - * - * Conveniently sets the diffuse and ambient color of @pipeline at the same - * time. See cogl_pipeline_set_ambient() and cogl_pipeline_set_diffuse(). - * - * The default ambient color is (0.2, 0.2, 0.2, 1.0) - * - * The default diffuse color is (0.8, 0.8, 0.8, 1.0) - * - * Since: 2.0 - * Stability: Unstable - */ -void -cogl_pipeline_set_ambient_and_diffuse (CoglPipeline *pipeline, - const CoglColor *color); - -/** - * cogl_pipeline_set_specular: - * @pipeline: A #CoglPipeline object - * @specular: The components of the desired specular color - * - * Sets the pipeline's specular color, in the standard OpenGL lighting - * model. The intensity of the specular color depends on the viewport - * position, and is brightest along the lines of reflection. - * - * The default value is (0.0, 0.0, 0.0, 1.0) - * - * Since: 2.0 - * Stability: Unstable - */ -void -cogl_pipeline_set_specular (CoglPipeline *pipeline, - const CoglColor *specular); - -/** - * cogl_pipeline_get_specular: - * @pipeline: A #CoglPipeline object - * @specular: The location to store the specular color - * - * Retrieves the pipelines current specular color. - * - * Since: 2.0 - * Stability: Unstable - */ -void -cogl_pipeline_get_specular (CoglPipeline *pipeline, - CoglColor *specular); - -/** - * cogl_pipeline_set_shininess: - * @pipeline: A #CoglPipeline object - * @shininess: The desired shininess; must be >= 0.0 - * - * Sets the shininess of the pipeline, in the standard OpenGL lighting - * model, which determines the size of the specular highlights. A - * higher @shininess will produce smaller highlights which makes the - * object appear more shiny. - * - * The default value is 0.0 - * - * Since: 2.0 - * Stability: Unstable - */ -void -cogl_pipeline_set_shininess (CoglPipeline *pipeline, - float shininess); - -/** - * cogl_pipeline_get_shininess: - * @pipeline: A #CoglPipeline object - * - * Retrieves the pipelines current emission color. - * - * Return value: The pipelines current shininess value - * - * Since: 2.0 - * Stability: Unstable - */ -float -cogl_pipeline_get_shininess (CoglPipeline *pipeline); - -/** - * cogl_pipeline_set_emission: - * @pipeline: A #CoglPipeline object - * @emission: The components of the desired emissive color - * - * Sets the pipeline's emissive color, in the standard OpenGL lighting - * model. It will look like the surface is a light source emitting this - * color. - * - * The default value is (0.0, 0.0, 0.0, 1.0) - * - * Since: 2.0 - * Stability: Unstable - */ -void -cogl_pipeline_set_emission (CoglPipeline *pipeline, - const CoglColor *emission); - -/** - * cogl_pipeline_get_emission: - * @pipeline: A #CoglPipeline object - * @emission: The location to store the emission color - * - * Retrieves the pipelines current emission color. - * - * Since: 2.0 - * Stability: Unstable - */ -void -cogl_pipeline_get_emission (CoglPipeline *pipeline, - CoglColor *emission); - /** * CoglPipelineAlphaFunc: * @COGL_PIPELINE_ALPHA_FUNC_NEVER: Never let the fragment through. diff --git a/cogl/cogl/cogl.symbols b/cogl/cogl/cogl.symbols index c61e186b7..86d1dfbf9 100644 --- a/cogl/cogl/cogl.symbols +++ b/cogl/cogl/cogl.symbols @@ -556,12 +556,9 @@ cogl_pipeline_copy cogl_pipeline_foreach_layer cogl_pipeline_get_alpha_test_function cogl_pipeline_get_alpha_test_reference -cogl_pipeline_get_ambient cogl_pipeline_get_color cogl_pipeline_get_cull_face_mode cogl_pipeline_get_depth_state -cogl_pipeline_get_diffuse -cogl_pipeline_get_emission cogl_pipeline_get_front_face_winding #ifdef COGL_HAS_GTYPE_SUPPORT cogl_pipeline_get_gtype @@ -576,14 +573,10 @@ cogl_pipeline_get_layer_wrap_mode_t cogl_pipeline_get_n_layers cogl_pipeline_get_per_vertex_point_size cogl_pipeline_get_point_size -cogl_pipeline_get_shininess -cogl_pipeline_get_specular cogl_pipeline_get_uniform_location cogl_pipeline_get_user_program cogl_pipeline_new cogl_pipeline_set_alpha_test_function -cogl_pipeline_set_ambient -cogl_pipeline_set_ambient_and_diffuse cogl_pipeline_set_blend cogl_pipeline_set_blend_constant cogl_pipeline_set_color @@ -591,8 +584,6 @@ cogl_pipeline_set_color4f cogl_pipeline_set_color4ub cogl_pipeline_set_cull_face_mode cogl_pipeline_set_depth_state -cogl_pipeline_set_diffuse -cogl_pipeline_set_emission cogl_pipeline_set_front_face_winding cogl_pipeline_set_layer_combine cogl_pipeline_set_layer_combine_constant @@ -608,8 +599,6 @@ cogl_pipeline_set_layer_wrap_mode_t cogl_pipeline_set_per_vertex_point_size cogl_pipeline_set_point_size cogl_pipeline_remove_layer -cogl_pipeline_set_shininess -cogl_pipeline_set_specular cogl_pipeline_set_uniform_float cogl_pipeline_set_uniform_int cogl_pipeline_set_uniform_matrix