Value Texture (metaclass)

ValueTexture server can be created using metaclasses.

Basics

The ValueTexture server is similar to a Package in that it depends on channels. Channels defined for evaluation input are read into the channels struct, and those for nodal evaluation are then overwritten if they are wired for nodal evaluation. All of that is handled automatically by setting the proper state in the CLxAttributeDesc object.

1
2
        desc.eval_flag (LXfECHAN_READ);
        desc.nodal_input ();

The client’s texture returns a pointer to the destination for the channel values, and computes the texture output in its eval() method.

 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
class MyValueTexture : public CLxValueTexture
{
    public:
        MyChannels               my;

                void *
        struct_ptr ()                                   LXx_OVERRIDE
        {
                return reinterpret_cast<void *> (&my);
        }
                void
        eval (
                ILxUnknownID             vector,
                CLxPkg_TextureInput     &tInp,
                CLxPkg_TextureOutput    &tOut)          LXx_OVERRIDE
        {
                LXtFVector               rgb;

                ...

                tOut.Set (rgb);
        }
};

static CLxMeta_ValueTexture<MyValueTexture>      vtex_meta ("myValueTextureServerName");

If UI settings for channels are set the ChannelUI metaclass will need to be added.

1
        vtex_meta.add_channel_ui<CLxChannelUI> ();