summaryrefslogtreecommitdiff
path: root/materialsystem/genshadermacro.pl
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /materialsystem/genshadermacro.pl
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'materialsystem/genshadermacro.pl')
-rw-r--r--materialsystem/genshadermacro.pl105
1 files changed, 105 insertions, 0 deletions
diff --git a/materialsystem/genshadermacro.pl b/materialsystem/genshadermacro.pl
new file mode 100644
index 0000000..0f51d65
--- /dev/null
+++ b/materialsystem/genshadermacro.pl
@@ -0,0 +1,105 @@
+for( $i = 0; $i < 16; $i++ )
+{
+ print "\#define SHADER_CLASS$i(name,help";
+ for( $j = 0; $j < $i; $j++ )
+ {
+ print ",p$j,p$j" . "type,p$j" . "default,p$j" . "help\\\n\t\t";
+ }
+ print ")\\\n";
+ print "\tstatic const char *s_HelpString = help;\\\n";
+ print "\tstatic const char *s_ParamNames[] = {";
+ if( $i == 0 )
+ {
+ print "NULL";
+ }
+ else
+ {
+ for( $j = 0; $j < $i; $j++ )
+ {
+ print "\\\n\t\t\"\$\" #p$j";
+ if( $j != $i - 1 )
+ {
+ print ",";
+ }
+ }
+ }
+ print "\\\n\t};\\\n";
+
+ print "\tstatic ShaderParamType_t s_ParamType[] = {";
+ if( $i == 0 )
+ {
+ print "SHADER_PARAM_TYPE_INTEGER";
+ }
+ else
+ {
+ for( $j = 0; $j < $i; $j++ )
+ {
+ print "\\\n\t\tp$j" . "type";
+ if( $j != $i - 1 )
+ {
+ print ",";
+ }
+ }
+ }
+ print "\\\n\t};\\\n";
+
+ print "\tstatic const char *s_ParamDefault[] = {";
+ if( $i == 0 )
+ {
+ print "\"\"";
+ }
+ else
+ {
+ for( $j = 0; $j < $i; $j++ )
+ {
+ print "\\\n\t\tp$j" . "default";
+ if( $j != $i - 1 )
+ {
+ print ",";
+ }
+ }
+ }
+ print "\\\n\t};\\\n";
+
+ print "\tstatic const char *s_ParamHelp[] = {";
+ if( $i == 0 )
+ {
+ print "\"\"";
+ }
+ else
+ {
+ for( $j = 0; $j < $i; $j++ )
+ {
+ print "\\\n\t\tp$j" . "help";
+ if( $j != $i - 1 )
+ {
+ print ",";
+ }
+ }
+ }
+ print "\\\n\t};\\\n";
+
+
+ print "\\\n\tenum {";
+ if( $i == 0 )
+ {
+ print "DUMMY_PARAM";
+ }
+ else
+ {
+ for( $j = 0; $j < $i; $j++ )
+ {
+ print "\\\n\t\tp$j";
+ if( $j == 0 )
+ {
+ print " = NUM_SHADER_MATERIAL_VARS";
+ }
+ if( $j != $i - 1 )
+ {
+ print ",";
+ }
+ }
+ }
+ print "\\\n\t};\\\n";
+ print "\tstatic const char *s_Name = #name;\\\n\tclass CShader_ ## name : public Shader_t\n\n";
+}