Game Development Reference
In-Depth Information
packager : This conditioner parses all the external references, and all their
internal references, in order to create a package that contains all the files that
are needed for a given COLLADA document. This is useful when preparing
a package to be sent via email, for example.
CgToGLSL : This conditioner is not included in Refinery. This is an exam-
ple of a conditioner delivered as a separate project (see http://sourceforge.
net/projects/collada-cg2glsl/ as a standalone or a Refinery conditioner. This
conditioner will take a COLLADA document that has shader code for the
Cg language and automatically convert the shader into the OPen GL shading
language (GLSL). This conditioner can be really useful to convert Cg shaders
for WebGL.
Refinery does not need to be recompiled to add new conditioners; the application
written in Java will parse the .dll available and provide the available conditioners
in the user interface. In other words, it is possible to add more conditioner tools to
the toolbox by providing an extra .dll to Refinery. CgToGLSL is a good example
for adding a conditioner to Refinery.
Writing the equivalent conditioner in C# inside the one-page XML validate
application (where it says “add code here to process the content”) or even adding
functionality to XML Notepad may be a less-involved and easier road if portability
is not a primary issue (although Mono may provide enough portability [Novell 11]).
9.11 XSLT
XSL stands for EXtensible Stylesheet Language, and is a style-sheet language for
XML documents. Its usage can be compared to using CSS with HTML. XSLT
stands for XSL transformations. XSLT is a very useful tool to add to our toolbox:
it can transform a COLLADA document into another or transform a document into
an XHTML page. A lot of information can be found about XSL, as it is a W3C
standard [W3Schools 99], (see W3Schools tutorial [W3Schools 11b] that offers an
online editor and XSLT test tool). Listing 9.3 shows sample code (list-images.xslt):
Because COLLADA is using a namespace definition, we need to declare it at the
beginning of the XSLT file, and we give it the shortname “a” that will be used in
the rest of the script when referencing COLLADA elements, such as a:COLLADA
or a:images.
The script is simple to follow:
First it finds the COLLADA root element using xsl:template match=
"/a:COLLADA" .
Then it loops for all the image elements using xsl:for-each select= '
a:library_images/a:image".
Search WWH ::




Custom Search