Template:MatParamDef: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added and parameter)
(Added {{{described}}})
 
(54 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<noinclude>
{{Doc}}
This template is used to generate [[material]] [[shader]] parameter definitions on material shader pages.


== Basic usage ==
<includeonly>
<nowiki>{{MatParam|<name>|<variable type>|<description>}}</nowiki>


{{note|Don't forget to use [[Template:=]] to escape any "{{=}}" characters in the text.}}
<onlyinclude><div id="{{{1|}}}" style="display:grid; margin-bottom:16px"><!--
--><div style="display:flex; flex-wrap:wrap; box-shadow:0 2px 0 rgb(0 0 0 / 10%); background-image:linear-gradient(90deg, rgb(49 49 49) 60%, rgb(45 45 45)); border:thick double rgb(255 255 255 / 3%); border-radius:.3em .3em 0 0; position:sticky; padding:.5em 1em; top:0; z-index:10">
<div><!--
--><kbd><!--
-->{{ {{#if:{{{nolink|}}}|Strong|Lx}} |{{{1}}}}}<!--
-->{{#if:{{{to|}}}|&nbsp;to {{ {{#if:{{{nolink|}}}|Strong|Lx}} |{{{to}}}}}}}<!--
-->{{#if:{{{and|}}}|&nbsp;and {{ {{#if:{{{nolink|}}}|Strong|Lx}} |{{{and}}}}}}}<!--
--></kbd><!--
-->&nbsp;{{VT|{{{2|}}}}}<!--
-->{{#if:{{{deprecated|}}} | &nbsp;{{obs}} }}<!--
-->{{#if:{{{dx8|}}} | &nbsp;{{Dx8}} }}<!--
-->{{#if:{{{dx9|}}} | &nbsp;{{Dx9}} }}<!--
-->{{#if:{{{since|}}} | &nbsp;{{since|{{{since|}}}}} }}<!--
-->{{#if:{{{only|}}} | &nbsp;{{only|{{{only|}}}}} }}<!--
-->{{#if:{{{also|}}} | &nbsp;{{also|{{{also|}}}}} }}<!--
-->{{#if:{{{removed|}}} | &nbsp;{{removed|{{{removed|}}}}} }}
</div><!--
-->{{#if:{{{value|}}} | &ensp;<span style="display:flex; background:#202020; border-radius:2px; font-size:0.9em; padding:0 4px">'''Default Value:'''&nbsp;{{{value|}}}</span> }}<!--
-->{{#if:{{{shaders|}}} | &ensp;<span style="display:flex; background:#202020; border-radius:2px; font-size:0.9em; padding:0 4px">'''Shader(s):'''&nbsp;{{{shaders|}}}</span> }}
</div>
<div style="background-color:rgb(40 40 40); border:thick double rgb(255 255 255 / 3%); border-top:0; border-radius:0 0 .3em .3em; padding:.5em 1em">{{#switch:{{{described|}}}
| true = This [[material]] [[shader]] parameter is described on [[{{{1}}}|its own page]].
| #default = {{#if:{{{text|}}}{{{3|}}}|{{{text|{{{3}}}}}}|{{todo|This [[material]] [[shader]] parameter has not been described.}}}}
}}</div></div></onlyinclude>


== Named parameters ==
</includeonly>
{| class=standard-table
! Parameter || Description || Example || Preview
|-
| <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}}
|-
| <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}}
|-
| <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}}
|-
| <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}}
|-
| <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}}
|-
| <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}}
|-
| <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...}}
|-
| <code>and</code> || Use this to define two material parameters with very similar names. || <code><nowiki>{{MatParam|$bumpmap|and=$bumpmap2|texture|Two bump maps.}}</nowiki></code> || {{MatParam|$bumpmap|and=$bumpmap2|texture|This shader supports two bump maps.}}
|}
 
== See also ==
* [[Template:KV]]
* [[Template:IO]]
 
<hr>
</noinclude>; {{#if: {{{deprecated|}}} | <del> }}<code>{{{1}}}</code> {{#if: {{{to|}}} | <span style="font-weight: normal;">to</span> <code>{{{to}}}</code> }} {{#if: {{{and|}}} | <span style="font-weight: normal;">and</span> <code>{{{and}}}</code> }} {{#if: {{{2|}}} | {{KV Type|{{{2}}}}} }}{{#if: {{{deprecated|}}} | </del> }}{{#if: {{{since|}}} | &nbsp;{{{{{since}}} add}} }}{{#if: {{{only|}}} | &nbsp;{{{{{only}}} only}} }}{{#if: {{{also|}}} | &nbsp;{{{{{also}}} also}} }}{{#if: {{{dx8|}}} | &nbsp;{{Dx8}} }}{{#if: {{{dx9|}}} | &nbsp;{{Dx9}} }} {{#if: {{{deprecated|}}} | &nbsp;{{obs}} }}
: {{#if: {{{deprecated|}}} | Deprecated.&nbsp; }} {{#if: {{{3|}}} | {{{3}}}}}

Latest revision as of 09:59, 27 August 2025

English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Curly brackets white.pngTemplate Documentation [view] [edit]
Icon-translate.png Available doc translations
View
Page history

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