Commit Graph

17 Commits

Author SHA1 Message Date
Tomeu Vizoso
b6318bd821 Make clutter_shader_effect_set_uniform_value accept G_TYPE_DOUBLE
For users of gobject-introspection that cannot know which
non-integer type to pass.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2471
2010-12-09 11:57:06 +00:00
Emmanuele Bassi
850a35f069 shader-effect: Remove unused function
The reset_uniforms() internal function is not used any more because the
CoglProgram cannot be reset post-creation - hence the uniforms cannot
change.
2010-11-29 10:59:16 +00:00
Neil Roberts
08087c965b ClutterShaderEffect: Don't throw away the program for a new actor
Previously when the shader effect is used with a new actor it would
end up throwing away the old program. I don't think this is neccessary
and it means if you use an effect to temporarily bind to an actor then
it will recompile the shader whenever it is applied.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2454
2010-11-29 10:55:53 +00:00
Emmanuele Bassi
215d87abe9 shader-effect: Zero out ShaderUniform
Do not use the compiler to zero the first field of the GValue member,
since it's apparently non-portable. As we're allocating memory anyway we
can let the slice allocator do the zero-ing for us.

Mentioned in: http://bugzilla.clutter-project.org/show_bug.cgi?id=2455
2010-11-29 08:58:08 +00:00
Tomeu Vizoso
6a552e27ab Fix API docs for ClutterShaderEffects
It can implement now both fragment and vertex shaders.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2442
2010-11-24 11:51:42 +00:00
Emmanuele Bassi
78d4073f8e Remove unused variables 2010-10-19 01:42:19 +01:00
Emmanuele Bassi
050e775da2 Move more classes to install_properties() 2010-10-18 11:26:45 +01:00
Emmanuele Bassi
daf6e73936 Remove last uses of cogl_program_uniform*
Following the commits:

  c03544da - clutter-shader: use cogl_program_set_uniform_xyz API
  a26119b5 - tests: Remove use of cogl_program_use

Remove the users of cogl_program_uniform_* and cogl_program_use() in the
shader-based effects.
2010-08-12 17:08:26 +01:00
Emmanuele Bassi
eb4dee46b7 shader-effect: Attach the program to the target material
Instead of calling cogl_program_use() around the paint_target()
chain-up, we can use the newly added API in CoglMaterial to attach
user-defined shaders to the offscreen target material.
2010-08-11 14:21:23 +01:00
Neil Roberts
8d51617979 Conditionally use g_object_notify_by_pspec
This adds a wrapper macro to clutter-private that will use
g_object_notify_by_pspec if it's compiled against a version of GLib
that is sufficiently new. Otherwise it will notify by the property
name as before by extracting the name from the pspec. The objects can
then store a static array of GParamSpecs and notify using those as
suggested in the documentation for g_object_notify_by_pspec.

Note that the name of the variable used for storing the array of
GParamSpecs is obj_props instead of properties as used in the
documentation because some places in Clutter uses 'properties' as the
name of a local variable.

Mose of the classes in Clutter have been converted using the script in
the bug report. Some classes have not been modified even though the
script picked them up as described here:

json-generator:

 We probably don't want to modify the internal copy of JSON

behaviour-depth:
rectangle:
score:
stage-manager:

 These aren't using the separate GParamSpec* variable style.

blur-effect:
win32/device-manager:

 Don't actually define any properties even though it has the enum.

box-layout:
flow-layout:

  Have some per-child properties that don't work automatically with
  the script.

clutter-model:

  The script gets confused with ClutterModelIter

stage:

  Script gets confused because PROP_USER_RESIZE doesn't match
  "user-resizable"

test-layout:

  Don't really want to modify the tests

http://bugzilla.clutter-project.org/show_bug.cgi?id=2150
2010-08-10 17:12:06 +01:00
Roman Kudiyarov
c1f0b59911 test: Fixed test-rotate for osx platfom
There was a bug in clutter-shader-effect. We have to set to zero new object
of type GValue before we can use it in g_value_init.
2010-08-04 15:13:11 +01:00
Emmanuele Bassi
fd27ca7398 Mark property strings for translation
Both the nick and the blurb fields should be translatable, for UI
builders and other introspection-based tools.
2010-07-15 14:07:07 +01:00
Emmanuele Bassi
698cce8276 shader-effect: Add a size check
Similar to the one in commit 2a354d9650
that went into clutter_value_set_shader_*. We end up in the same
situation, but it's better to fail from within ClutterShaderEffect.
2010-06-16 17:17:27 +01:00
Emmanuele Bassi
d816acd834 shader-effect: Allow creating vertex shaders
By default, ShaderEffect creates a fragment shader; in order to be able
to deprecate ClutterShader we need a way for ShaderEffect sub-classes to
create a vertex shader if needed - By using a write-only, constructor
only property.

ClutterShader has, internally, a ClutterShaderType enumeration that can
be used exactly for this. We just need to expose it and create a GObject
property for ClutterShaderEffect.
2010-06-11 14:47:48 +01:00
Emmanuele Bassi
23084b9768 docs: Effects fixes for the API reference 2010-06-03 14:34:41 +01:00
Emmanuele Bassi
0e9a1dee6d shader-effect: Simplify setting the shader source
Sub-classes of ShaderEffect currently have to get the handle for the
Cogl shader and call cogl_shader_source(); this makes it awkward to
implement a ShaderEffect, and it exposes handles and Cogl API that we
might want to change in the future.

We should provide a ClutterShaderEffect method that allows to (safely)
set the shader source at the right time for sub-classes to use.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
c260da79e3 effect: Add ShaderEffect
The ShaderEffect class is an abstract base type for shader-based
effects. GLSL-based effects should be implemented by sub-classing
ShaderEffect and overriding ActorMeta::set_actor() to set the source
code of the shader, and Effect::pre_paint() to update the uniform
values, if any.

The ShaderEffect has a generic API for sub-classes to set the values
of the uniforms defined by their shaders, and it uses the shader
types we defined for ClutterShader, to avoid re-inventing the wheel
every time.
2010-06-03 14:10:55 +01:00