Template:MatParamDef/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
 
(34 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Doc/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 ==
{{Code|<nowiki>{{MatParam|<name>|<variable type>|<description>}}</nowiki>}}
<code><nowiki>{{MatParamDef|<name>|<variable type>|<description>}}</nowiki></code>


{{ModernNote|Don't forget to use [[Template:=]] to escape any "{{=}}" characters in the text.}}
== 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}}


== Examples and Parameters ==
{| class="standard-table" width="100%"
{| class="standard-table"
! Parameter
! Parameter
! Description
! Description
Line 15: Line 15:
! Preview
! Preview
|-
|-
| align="center" | {{Param|deprecated}}
| 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.
 
You can also use {{tl|&#61;}}, but this may overload the page.
 
If not specified, it is replaced with [[Template:Todo|TODO]].
| <pre style="margin:0">{{MatParamDef
| $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}}
|-
| align="center" | <code>{{param|deprecated}}</code>
| This material parameter is deprecated and should no longer be used.
| This material parameter is deprecated and should no longer be used.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| I'm deprecated | bool | deprecated = 1
| I'm deprecated | bool | deprecated = 1
| Really, don't use me anymore!
| Really, don't use me anymore!
}}</nowiki>}}
}}</pre>
| {{MatParam|I'm deprecated|bool|deprecated=1|Really, don't use me anymore!}}
| bgcolor="#262626" | {{MatParamDef|I'm deprecated|bool|deprecated=1|Really, don't use me anymore!}}
|-
|-
| align="center" | {{Param|since}}
| align="center" | <code>{{param|since}}</code>
| This material parameter is available since this game. Uses the template {{tl|Since}}.
| This material parameter is available since this game. Uses the template {{tl|Since}}.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| $likealienswarm | bool | since = {{as}}
| $likealienswarm | bool | since = {{as}}
| I'm available in Portal 2, too!
| I'm available in Portal 2, too!
}}</nowiki>}}
}}</pre>
| {{MatParam|$likealienswarm|bool|since={{as}}|I'm available in Portal 2, too!}}
| bgcolor="#262626" | {{MatParamDef|$likealienswarm|bool|since={{as}}|I'm available in Portal 2, too!}}
|-
|-
| align="center" | {{Param|also}}
| align="center" | <code>{{param|also}}</code>
| This material parameter is also available in this game. Uses the template {{tl|Also}}.
| This material parameter is also available in this game. Uses the template {{tl|Also}}.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| $likealienswarm | bool | since = {{as}} | also = {{GMOD}}
| $likealienswarm | bool | since = {{as}} | also = {{GMOD}}
| I'm also available in Garry's Mod!
| I'm also available in Garry's Mod!
}}</nowiki>}}
}}</pre>
| {{MatParam|$likealienswarm|bool|since={{as}}|also={{GMOD}}|I'm also available in Garry's Mod!}}
| bgcolor="#262626" | {{MatParamDef|$likealienswarm|bool|since={{as}}|also={{GMOD}}|I'm also available in Garry's Mod!}}
|-
|-
| align="center" | {{Param|only}}
| align="center" | <code>{{param|only}}</code>
| This material parameter is available only in this/these game(s). Uses the template {{tl|Only}}.
| This material parameter is available only in this/these game(s). Uses the template {{tl|Only}}.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| $lovealienswarm | integer | only = {{as}}
| $lovealienswarm | integer | only = {{as}}
| I'm only available in Alien Swarm!
| I'm only available in Alien Swarm!
}}</nowiki>}}
}}</pre>
| {{MatParam|$lovealienswarm|integer|only={{as}}|I'm only available in Alien Swarm!}}
| bgcolor="#262626" | {{MatParamDef|$lovealienswarm|integer|only={{as}}|I'm only available in Alien Swarm!}}
|-
|-
| align="center" | {{Param|removed}}
| align="center" | <code>{{param|removed}}</code>
| This material parameter was removed in this game. Uses the template {{tl|Removed}}.
| This material parameter was removed in this game. Uses the template {{tl|Removed}}.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| $dxparameter | int | removed = {{l4d}}
| $dxparameter | int | removed = {{l4d}}
| I was removed in Left 4 Dead!
| I was removed in Left 4 Dead!
}}</nowiki>}}
}}</pre>
| {{MatParam|$dxparameter|integer|I was removed in Left 4 Dead!|removed={{l4d}}}}
| bgcolor="#262626" | {{MatParamDef|$dxparameter|integer|I was removed in Left 4 Dead!|removed={{l4d}}}}
|-
|-
| align="center" | {{Param|dx9}}
| align="center" | <code>{{param|dx9}}</code>
| This material parameter requires DX9 or higher to function.
| This material parameter requires DX9 or higher to function.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| $dx9parameter | bool | dx9 = 1
| $dx9parameter | bool | dx9 = 1
| I require DX9 to work!
| I require DX9 to work!
}}</nowiki>}}
}}</pre>
| {{MatParam|$dx9parameter|bool|I require DX9 to work!|dx9=1}}
| bgcolor="#262626" | {{MatParamDef|$dx9parameter|bool|I require DX9 to work!|dx9=1}}
|-
|-
| align="center" | {{Param|dx8}}
| align="center" | <code>{{param|dx8}}</code>
| This material parameter is for DX8, and should not be used for DX9.
| This material parameter is for DX8, and should not be used for DX9.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| $dx8parameter | bool | dx8 = 1
| $dx8parameter | bool | dx8 = 1
| I'm a material parameter for DX8!
| I'm a material parameter for DX8!
}}</nowiki>}}
}}</pre>
| {{MatParam|$dx8parameter|bool|I'm a material parameter for DX8!|dx8=1}}
| bgcolor="#262626" | {{MatParamDef|$dx8parameter|bool|I'm a material parameter for DX8!|dx8=1}}
|-
|-
| align="center" | {{Param|to}}
| align="center" | <code>{{param|to}}</code>
| Use this to define a set of material parameters with very similar names.
| Use this to define a set of material parameters with very similar names.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| $basetexture1 | to = $basetexture4 | texture
| $basetexture1 | to = $basetexture4 | texture
| There are many of us...
| There are many of us...
}}</nowiki>}}
}}</pre>
| {{MatParam|$basetexture1|to=$basetexture4|texture|There are many of us...}}
| bgcolor="#262626" | {{MatParamDef|$basetexture1|to=$basetexture4|texture|There are many of us...}}
|-
|-
| align="center" | {{Param|and}}
| align="center" | <code>{{param|and}}</code>
| Use this to define two material parameters with very similar names.
| Use this to define two material parameters with very similar names.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| $bumpmap | and = $bumpmap2 | texture
| $bumpmap | and = $bumpmap2 | texture
| This shader supports two bump maps.
| This shader supports two bump maps.
}}</nowiki>}}
}}</pre>
| {{MatParam|$bumpmap|and=$bumpmap2|texture|This shader supports two bump maps.}}
| bgcolor="#262626" | {{MatParamDef|$bumpmap|and=$bumpmap2|texture|This shader supports two bump maps.}}
|-
|-
| align="center" | {{Param|shaders}}
| align="center" | <code>{{param|shaders}}</code>
| Lists the shaders for a specific material parameter. Uses the template {{tl|Shaders}}.
| Lists the shaders for a specific material parameter. Uses the template {{tl|Shaders}}.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| $shaderspecificparameter | float
| $shaderspecificparameter | float | shaders = VertexLitGeneric, UnlitGeneric
| shaders = VertexLitGeneric, UnlitGeneric
| I only work with specific shaders!
| I only work with specific shaders!
}}</nowiki>}}
}}</pre>
| {{MatParam|$shaderspecificparameter|float|I only work with specific shaders!|shaders=VertexLitGeneric, UnlitGeneric}}
| bgcolor="#262626" | {{MatParamDef|$shaderspecificparameter|float|shaders=VertexLitGeneric, UnlitGeneric|I only work with specific shaders!}}
|-
|-
| align="center" | {{Param|value}}
| align="center" | <code>{{param|value}}</code>
| Default Value
| Default value of the parameter.
| {{CodeBlock|margin=5px|<nowiki>{{MatParam
| <pre style="margin:0">{{MatParamDef
| $defaultvalue | integer | value = 1
| $defaultvalue | integer | value = 1
| Bla bla bla
| Why do I have such a small value? :(
}}</nowiki>}}
}}</pre>
| {{MatParam|$defaultvalue|integer|Bla bla bla|value=1}}
| 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}}
* {{T|O}}


{{Doc/Sandbox other| [[Category:Formatting templates]] }}
{{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