Value Texture (metaclass)

From The Foundry MODO SDK wiki
Revision as of 17:36, 15 June 2016 by Shf (Talk | contribs) (Created page with "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 eva...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

	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.

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.

	vtex_meta.add_channel_ui<CLxChannelUI> ();