I'm trying to figure out how to specify texture parameters such as the wrap mode, min/mag filter, etc, to a texture that's used in a fixed-function material, such as <phong>. It looks like I want to use the <sampler2D> element for that, but I can't find any examples. When I export a textured model from Max it just hooks up the <diffuse> element directly to a <texture> element (via <bind_material>) and doesn't use a sampler.
In the spec I found this example in the <profile_COMMON> documentation:
Note the <newparam> and <param> usage. So would I do something similar, except inside the <newparam> put a <sampler2D> instead of a <float3>? Also I think the example above is using <param> wrong; in the schema it says that <param> needs a "ref" attribute, and I'm not sure that it's allowed to have content. So would it be <param ref="myDiffuseColor"/> instead? Should the <newparam> element definitely be a child of <profile_COMMON> and not of <technique>? In <sampler*>, what exactly does the <source> element refer to? An <image>?Code :<profile_COMMON> <newparam sid="myDiffuseColor"> <float3> 0.2 0.56 0.35 </float3> </newparam> <technique sid="phong1"> <phong> <emission><color>1.0 0.0 0.0 1.0</color></emission> <ambient><color>1.0 0.0 0.0 1.0</color></ambient> <diffuse><param>myDiffuseColor</param></diffuse> <specular><color>1.0 0.0 0.0 1.0</color></specular> <shininess><float>50.0</float></shininess> <reflective><color>1.0 1.0 1.0 1.0</color></reflective> <reflectivity><float>0.5</float></reflectivity> <transparent><color>0.0 0.0 1.0 1.0</color></transparent> <transparency><float>1.0</float></transparency> </phong> </technique> </profile_COMMON>
Also some more minor errors in the spec:
<sampler*> isn't listed as a valid parent element of <source>, and material elements such as <diffuse>, <ambient>, etc aren't listed as valid parent elements of <param>.
Thanks for any help.