[API Review] FX 8 3D API
joe andresen
joseph.andresen at oracle.com
Thu Feb 7 15:11:02 PST 2013
Just a thought,
I would think that Color, ImagePattern, and the Gradients could be
instances of Materials.
A Material is a texture that is applied to a surface. In todays graphics
pipeline, the texture on the surface is calculated with shaders, float3
color variables, and any other types of variables the shaders might use.
If you were to to extend this methodology to prism, setting the fill of
a Shape with a material would give a more detailed interface for what
will be processed on those pixels.
For Example, if Color was a Material it would look something like:
//pseudo code
Material color_Material;
//any other initialize code
color.setPixelShader(color_Shader);
color.setFloat3(red_Color);
Rectangle rect = new Rectangle();
rect.setFill(color_Material);
Now this totally breaks down with prism's shape rendering
implementation, but from an API standpoint, this makes sense to me. (the
problem being that in prism, what 2d shape you are rendering is
determined by a pixel shader.)
Here are a couple of other somewhat random libraries' abstraction of a
Material.
http://clb.demon.fi/gfxapi/docs/Material_summary.php
http://docs.unity3d.com/Documentation/ScriptReference/Material.html
Interesting how Unity has specific variables that are meant for a Main
Color. I think this has to do with their public and not standard shader
architecture. (Surface Shaders)
Flash 3d has no such thing, where instead you have to set shader
variables from a context, which in my opinion is nasty.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display3D/Context3D.html
-Joe
The current way does not limit us from doing this in the future so that
is why it is just a thought :) .
More information about the openjfx-dev
mailing list