1 # ======================================================================
2 # MeshAppearanceTemplate.pm
3 # Copyright 2003, Sony Online Entertainment
5 # ======================================================================
7 package MeshAppearanceTemplate
;
10 use CustomizationVariableCollector
;
13 # ======================================================================
14 # MeshAppearanceTemplate potentially-public variables.
15 # ======================================================================
17 # our $relativePathName;
19 # ======================================================================
20 # Setup variables that can be imported by Exporter into user modules.
21 # ======================================================================
23 use vars
qw(@ISA @EXPORT_OK $VERSION);
28 # These symbols are okay to export if specifically requested.
29 @EXPORT_OK = qw(&install);
31 # ======================================================================
32 # MeshAppearanceTemplate private variables.
33 # ======================================================================
36 my $treeFileRelativeName;
38 # ======================================================================
39 # MeshAppearanceTemplate public functions.
40 # ======================================================================
44 # Register handler with CustomizationVariableCollector
45 CustomizationVariableCollector
::registerHandler
("MESH", \
&processIff
);
48 # ======================================================================
49 # MeshAppearanceTemplate private functions
50 # ======================================================================
56 die "bad iff arg specified" if ref($iff) ne "Iff";
58 $treeFileRelativeName = shift;
59 die "bad tree file relative name" if !defined($treeFileRelativeName);
60 print "MeshAppearanceTemplate: processing file [$treeFileRelativeName]\n" if $debug;
62 # Ensure we're in the proper form.
63 return 0 unless $iff->getCurrentName() eq "MESH";
65 $iff->enterForm("MESH");
67 my $version = $iff->getCurrentName();
68 if ($version =~ m/^000[2-5]$/)
70 process_0002_0005
($iff);
74 print STDERR
"MeshAppearanceTemplate: unsupported version tag [$version].";
78 $iff->exitForm("MESH");
80 print "MeshAppearanceTemplate: finished processing file [$treeFileRelativeName]\n" if $debug;
86 # ----------------------------------------------------------------------
90 print "process_0002_0005(): begin\n" if $debug;
93 die 'bad $iff arg' if ref($iff) ne 'Iff';
97 $iff->walkIff(\
&iffWalker_0002_0005
);
101 print "process_0002_0005(): end\n" if $debug;
104 # ----------------------------------------------------------------------
106 sub iffWalker_0002_0005
109 die 'bad iff arg' if ref($iff) ne 'Iff';
111 my $blockName = shift;
114 printf("iffWalker_0002_0005(): %s=[%s]\n", $isChunk ?
"chunk" : "form", $blockName) if $debug;
116 # Process blocks we understand.
119 if ($blockName eq 'NAME')
121 # Handle specifying linked shader templates.
122 my $shaderTemplateName = $iff->read_string();
123 CustomizationVariableCollector
::logAssetLink
($treeFileRelativeName, $shaderTemplateName);
131 # ======================================================================