Template:MatParamDef/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Documentation subpage for Template:MatParam)
 
No edit summary
 
(41 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{Doc/subpage}}
<!-- Please place categories where indicated at the bottom of this page. -->
 
This template is used to generate [[material]] [[shader]] parameter definitions on material shader pages.
This template is used to generate [[material]] [[shader]] parameter definitions on material shader pages.


== Usage ==
== Usage ==
<nowiki>{{MatParam|<name>|<variable type>|<description>}}</nowiki>
<code><nowiki>{{MatParamDef|<name>|<variable type>|<description>}}</nowiki></code>
 
== Examples and Parameters ==
{{warning|The code in the example will not work correctly due to the use of <code><nowiki><kbd></nowiki></code> in the template. Please refer to the {{matparam|$bumpmap}} page code to see the current code.|hidetested=1}}
 
{| class="standard-table" width="100%"
! Parameter
! Description
! Example
! Preview
|-
| align="center" | <code>{{param|text}}</code><br>or</br><code>{{param|3}}</code>
| Description of the parameter.
 
If specified, then you will not encounter the problem of a broken description if there are equal signs in it.


{{note|Don't forget to use [[Template:=]] to escape any "{{=}}" characters in the text.}}
You can also use {{tl|&#61;}}, but this may overload the page.


== Examples and Parameters ==  
If not specified, it is replaced with [[Template:Todo|TODO]].
{| class=standard-table
| <pre style="margin:0">{{MatParamDef
! Parameter || Description || Example || Preview
| $stupidequalsign | bool | text = Wow, I've been fixed! Look at this {{Emoji|point_right}} 2 + 2 = 5
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$stupidequalsign|bool|text=Wow, I've been fixed! Look at this {{Emoji|point_right}} 2 + 2 = 5}}
|-
| align="center" | <code>{{param|described}}</code>
| Replaces the text with a link to the specified material parameter.
| <pre style="margin:0">{{MatParamDef
| $describedcutie | texture | described = true
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$describedcutie|texture|described=true}}
|-
|-
| <code>deprecated</code> || This material parameter is deprecated and should no longer be used. || <code><nowiki>{{MatParam|I'm deprecated|bool|Really, don't use me anymore!|deprecated=1}}</nowiki></code> || {{MatParam|I'm deprecated|bool|Really, don't use me anymore!|deprecated=1}}
| align="center" | <code>{{param|deprecated}}</code>
| This material parameter is deprecated and should no longer be used.
| <pre style="margin:0">{{MatParamDef
| I'm deprecated | bool | deprecated = 1
| Really, don't use me anymore!
}}</pre>
| bgcolor="#262626" | {{MatParamDef|I'm deprecated|bool|deprecated=1|Really, don't use me anymore!}}
|-
|-
| <code>since</code> || This material parameter is available since this game. Uses the template <nowiki>{{<game> add}}</nowiki>. || <code><nowiki>{{MatParam|$likealienswarm|bool|I'm available in Portal 2, too!|since=AS}}</nowiki></code> || {{MatParam|$likealienswarm|bool|I'm available in Portal 2, too!|since=AS}}
| align="center" | <code>{{param|since}}</code>
| This material parameter is available since this game. Uses the template {{tl|Since}}.
| <pre style="margin:0">{{MatParamDef
| $likealienswarm | bool | since = {{as}}
| I'm available in Portal 2, too!
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$likealienswarm|bool|since={{as}}|I'm available in Portal 2, too!}}
|-
|-
| <code>also</code> || This material parameter is also available in this game. Uses the template <nowiki>{{<game> also}}</nowiki>. || <code><nowiki>{{MatParam|$likealienswarm|bool|I'm also available in Garry's Mod!|since=AS|also=GMOD}}</nowiki></code> || {{MatParam|$likealienswarm|bool|I'm also available in Garry's Mod!|since=AS|also=GMOD}}
| align="center" | <code>{{param|also}}</code>
| This material parameter is also available in this game. Uses the template {{tl|Also}}.
| <pre style="margin:0">{{MatParamDef
| $likealienswarm | bool | since = {{as}} | also = {{GMOD}}
| I'm also available in Garry's Mod!
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$likealienswarm|bool|since={{as}}|also={{GMOD}}|I'm also available in Garry's Mod!}}
|-
|-
| <code>only</code> || This material parameter is available only in this game. Uses the template <nowiki>{{<game> only}}</nowiki>. || <code><nowiki>{{MatParam|$lovealienswarm|bool|I'm only available in Alien Swarm!|only=AS}}</nowiki></code> || {{MatParam|$lovealienswarm|integer|I'm only available in Alien Swarm!|only=AS}}
| align="center" | <code>{{param|only}}</code>
| This material parameter is available only in this/these game(s). Uses the template {{tl|Only}}.
| <pre style="margin:0">{{MatParamDef
| $lovealienswarm | integer | only = {{as}}
| I'm only available in Alien Swarm!
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$lovealienswarm|integer|only={{as}}|I'm only available in Alien Swarm!}}
|-
|-
| <code>dx9</code> || This material parameter requires DX9 or higher to function. || <code><nowiki>{{MatParam|$dx9parameter|boolean|I require DX9 to work!|dx9=1}}</nowiki></code> || {{MatParam|$dx9parameter|bool|I require DX9 to work!|dx9=1}}
| align="center" | <code>{{param|removed}}</code>
| This material parameter was removed in this game. Uses the template {{tl|Removed}}.
| <pre style="margin:0">{{MatParamDef
| $dxparameter | int | removed = {{l4d}}
| I was removed in Left 4 Dead!
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$dxparameter|integer|I was removed in Left 4 Dead!|removed={{l4d}}}}
|-
|-
| <code>dx8</code> || This material parameter is for DX8, and should not be used for DX9. || <code><nowiki>{{MatParam|$dx8parameter|boolean|I'm a material parameter for DX8!|dx8=1}}</nowiki></code> || {{MatParam|$dx8parameter|bool|I'm a material parameter for DX8!|dx8=1}}
| align="center" | <code>{{param|dx9}}</code>
| This material parameter requires DX9 or higher to function.
| <pre style="margin:0">{{MatParamDef
| $dx9parameter | bool | dx9 = 1
| I require DX9 to work!
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$dx9parameter|bool|I require DX9 to work!|dx9=1}}
|-
|-
| <code>to</code> || Use this to define a set of material parameters with very similar names. || <code><nowiki>{{MatParam|$basetexture1|to=$basetexture4|texture|There are many of us...}}</nowiki></code> || {{MatParam|$basetexture1|to=$basetexture4|texture|There are many of us...}}
| align="center" | <code>{{param|dx8}}</code>
| This material parameter is for DX8, and should not be used for DX9.
| <pre style="margin:0">{{MatParamDef
| $dx8parameter | bool | dx8 = 1
| I'm a material parameter for DX8!
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$dx8parameter|bool|I'm a material parameter for DX8!|dx8=1}}
|-
|-
| <code>and</code> || Use this to define two material parameters with very similar names. || <code><nowiki>{{MatParam|$bumpmap|and=$bumpmap2|texture|This shader supports two bump maps.}}</nowiki></code> || {{MatParam|$bumpmap|and=$bumpmap2|texture|This shader supports two bump maps.}}
| align="center" | <code>{{param|to}}</code>
| Use this to define a set of material parameters with very similar names.
| <pre style="margin:0">{{MatParamDef
| $basetexture1 | to = $basetexture4 | texture
| There are many of us...
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$basetexture1|to=$basetexture4|texture|There are many of us...}}
|-
| align="center" | <code>{{param|and}}</code>
| Use this to define two material parameters with very similar names.
| <pre style="margin:0">{{MatParamDef
| $bumpmap | and = $bumpmap2 | texture
| This shader supports two bump maps.
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$bumpmap|and=$bumpmap2|texture|This shader supports two bump maps.}}
|-
| align="center" | <code>{{param|shaders}}</code>
| Lists the shaders for a specific material parameter. Uses the template {{tl|Shaders}}.
| <pre style="margin:0">{{MatParamDef
| $shaderspecificparameter | float | shaders = VertexLitGeneric, UnlitGeneric
| I only work with specific shaders!
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$shaderspecificparameter|float|shaders=VertexLitGeneric, UnlitGeneric|I only work with specific shaders!}}
|-
| align="center" | <code>{{param|value}}</code>
| Default value of the parameter.
| <pre style="margin:0">{{MatParamDef
| $defaultvalue | integer | value = 1
| Why do I have such a small value? :(
}}</pre>
| bgcolor="#262626" | {{MatParamDef|$defaultvalue|integer|value=1|Why do I have such a small value? :(}}
|}
|}


== See also ==
== See also ==
* [[Template:KV]]
* {{T|matparam}}
* [[Template:IO]]
* {{T|KV}}
 
* {{T|I}}
<includeonly>{{sandbox other||
* {{T|O}}
<!-- Categories below this line, please -->


}}</includeonly>
{{Doc/Sandbox other
| [[Category:Formatting templates]]
}}

Latest revision as of 01:26, 7 September 2025

Edit-copy.png
This is a documentation subpage for Template:MatParamDef.
Don't forget to purge the contents of the base page upon creating or editing this subpage.

This template is used to generate material shader parameter definitions on material shader pages.

Usage

{{MatParamDef|<name>|<variable type>|<description>}}

Examples and Parameters

Warning.pngWarning:The code in the example will not work correctly due to the use of <kbd> in the template. Please refer to the $bumpmap page code to see the current code.
Parameter Description Example Preview
{{{text}}}
or
{{{3}}}
Description of the parameter.

If specified, then you will not encounter the problem of a broken description if there are equal signs in it.

You can also use {{=}}, but this may overload the page.

If not specified, it is replaced with TODO.

{{MatParamDef
| $stupidequalsign | bool | text = Wow, I've been fixed! Look at this {{Emoji|point_right}} 2 + 2 = 5
}}
Wow, I've been fixed! Look at this {{Emoji|point_right}} 2 + 2 = 5
{{{described}}} Replaces the text with a link to the specified material parameter.
{{MatParamDef
| $describedcutie | texture | described = true
}}
This material shader parameter is described on its own page.
{{{deprecated}}} This material parameter is deprecated and should no longer be used.
{{MatParamDef
| I'm deprecated | bool | deprecated = 1
| Really, don't use me anymore!
}}
Really, don't use me anymore!
{{{since}}} This material parameter is available since this game. Uses the template {{Since}}.
{{MatParamDef
| $likealienswarm | bool | since = {{as}}
| I'm available in Portal 2, too!
}}
$likealienswarm <boolean> (in all games since Alien Swarm)
I'm available in Portal 2, too!
{{{also}}} This material parameter is also available in this game. Uses the template {{Also}}.
{{MatParamDef
| $likealienswarm | bool | since = {{as}} | also = {{GMOD}}
| I'm also available in Garry's Mod!
}}
$likealienswarm <boolean> (in all games since Alien Swarm) (also in Garry's Mod)
I'm also available in Garry's Mod!
{{{only}}} This material parameter is available only in this/these game(s). Uses the template {{Only}}.
{{MatParamDef
| $lovealienswarm | integer | only = {{as}}
| I'm only available in Alien Swarm!
}}
$lovealienswarm <integer> (only in Alien Swarm)
I'm only available in Alien Swarm!
{{{removed}}} This material parameter was removed in this game. Uses the template {{Removed}}.
{{MatParamDef
| $dxparameter | int | removed = {{l4d}}
| I was removed in Left 4 Dead!
}}
$dxparameter <integer> (removed since Left 4 Dead)
I was removed in Left 4 Dead!
{{{dx9}}} This material parameter requires DX9 or higher to function.
{{MatParamDef
| $dx9parameter | bool | dx9 = 1
| I require DX9 to work!
}}
$dx9parameter <boolean> (DX9 SM2)
I require DX9 to work!
{{{dx8}}} This material parameter is for DX8, and should not be used for DX9.
{{MatParamDef
| $dx8parameter | bool | dx8 = 1
| I'm a material parameter for DX8!
}}
I'm a material parameter for DX8!
{{{to}}} Use this to define a set of material parameters with very similar names.
{{MatParamDef
| $basetexture1 | to = $basetexture4 | texture
| There are many of us...
}}
There are many of us...
{{{and}}} Use this to define two material parameters with very similar names.
{{MatParamDef
| $bumpmap | and = $bumpmap2 | texture
| This shader supports two bump maps.
}}
This shader supports two bump maps.
{{{shaders}}} Lists the shaders for a specific material parameter. Uses the template {{Shaders}}.
{{MatParamDef
| $shaderspecificparameter | float | shaders = VertexLitGeneric, UnlitGeneric
| I only work with specific shaders!
}}
Shader(s): VertexLitGeneric, UnlitGeneric
I only work with specific shaders!
{{{value}}} Default value of the parameter.
{{MatParamDef
| $defaultvalue | integer | value = 1
| Why do I have such a small value? :(
}}
Default Value: 1
Why do I have such a small value? :(

See also