29.12.2014 Views

FX Composer User Guide - NVIDIA Developer Zone

FX Composer User Guide - NVIDIA Developer Zone

FX Composer User Guide - NVIDIA Developer Zone

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>FX</strong> <strong>Composer</strong> 2.5 Getting Started <strong>User</strong>’s <strong>Guide</strong><br />

<br />

<br />

<br />

Texture and Sampler<br />

Vertex Shader<br />

World View Projection<br />

Some snippets, like the texture and sampler declaration, show a highlighted set of fields. If you<br />

change the variable name in any of these fields, they will all be updated simultaneously. An<br />

example is shown below.<br />

Figure 9. A Snippet with Shared Fields<br />

Creating Custom Snippets<br />

Snippet definitions are stored in snippets.xml, which is located at:<br />

C:\Program Files\<strong>NVIDIA</strong> Corporation\<strong>FX</strong> <strong>Composer</strong> 2.5\Plugins\Services<br />

The structure of a snippet declaration is as follows:<br />

<br />

Put your macro name here<br />

Shortcut text for macro<br />

Description for snippet selection UI widget<br />

Code to be automatically inserted<br />

cgfx or fx – you must have a separate declaration per language<br />

<br />

Here is the sample code for the “Texture and Sampler” snippet shown in Figure 9:<br />

<br />

Texture and Sampler<br />

texandsamp<br />

Texture and sampler snippet<br />

texture $NAME$ &lt;<br />

string ResourceName = "";//Optional default file name<br />

string UIName = "$NAME$ Texture";<br />

string ResourceType = "2D";<br />

&gt;;<br />

sampler2D $NAME$Sampler = sampler_state {<br />

Texture = &lt;$NAME$&gt;;<br />

MinFilter = LinearMipMapLinear;<br />

MagFilter = Linear;<br />

WrapS = Repeat;<br />

WrapT = Repeat;<br />

};<br />

cgfx<br />

<br />

DU-002761-001_v01 22<br />

April 2008

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!