Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<project name="Graphics Converter" default="atlasses.and.gafs" basedir="..">
<!--путь к air sdk-->
<property name="flex.home" location="C:/Program Files (x86)/FlexSDK/AIR SDK" />
<!--путь к pvr2atf-->
<property name="atf.tool" location="${flex.home}/atftools/pvr2atf.exe" />
<!--путь к PVRTexToolCLI-->
<property name="pvr.tool" location="C:/Program Files/PowerVR/Tool/PVRTexTool/CLI/Windows_x86_32/PVRTexToolCLI.exe" />
<!--путь к атласам в формате pvr-->
<property name="atlasses.source" location="_sources/atlasses_ready" />
<!--путь к папке для атласов в формате atf-->
<property name="atlasses.destanation" location="bin/graphics" />
<!--путь к zip файлам gaf в формате png-->
<property name="gafs.source" location="_sources/gafs" />
<!--пусть к папке c готовыми zip файлам gaf в формате atf-->
<property name="gafs.destanation" location="bin/gaf" />
<property name="temp" location="_temp" />
<macrodef name="pvr2atf">
<attribute name="from" />
<attribute name="to" />
<apply executable="${atf.tool}">
<arg value="-r" />
<srcfile />
<arg value="-o" />
<targetfile />
<fileset dir="@{from}" includes="**/*.pvr" />
<mapper type="glob" from="*.pvr" to="@{to}/*.atf" />
<macrodef name="png2pvr">
<attribute name="from" />
<attribute name="to" />
<apply executable="${pvr.tool}">
<arg value="-i" />
<srcfile />
<arg value="-o" />
<targetfile />
<arg value="-l" />
<arg value="-f" />
<arg value="r8g8b8a8" />
<arg value="-q" />
<arg value="pvrtcbest" />
<fileset dir="@{from}" includes="**/*.png" />
<mapper type="glob" from="*.png" to="@{to}/*.pvr" />
<target name="" description="Convert all pvr atlasses to atf">
<delete dir="${atlasses.destanation}"/>
<mkdir dir="${atlasses.destanation}"/>
<pvr2atf from="${atlasses.source}" to="${atlasses.destanation}" />
<target name="-move.xmls" description="Move xml files to destanation">
<copy todir="${atlasses.destanation}">
<fileset dir="${atlasses.source}" includes="**/*.xml" />
<target name="gafs" description="Convert all PNG gafs graphics to ATF">
<delete dir="${gafs.destanation}"/>
<mkdir dir="${gafs.destanation}"/>
<mkdir dir="${temp}"/>
<unzip dest="${temp}">
<fileset dir="${gafs.source}">
<include name="**/*.zip"/>
<png2pvr from="${temp}" to="${temp}" />
<pvr2atf from="${temp}" to="${temp}" />
<fileset dir="${temp}" includes="**/*.png"/>
<fileset dir="${temp}" includes="**/*.pvr"/>
<!-- команду зиповки для каждого gaf приходится писать отдельно -->
<zip destfile="${gafs.destanation}/" basedir="${temp}/gaf.s1" update="true"/>
<zip destfile="${gafs.destanation}/" basedir="${temp}/gaf.s2" update="true"/>
<zip destfile="${gafs.destanation}/" basedir="${temp}/gaf.s3" update="true"/>
<delete dir="${temp}"/>
<target name="atlasses" depends=", -move.xmls" description="Convert atlasses from PVR to ATF" />
<target name="atlasses.and.gafs" depends=", -move.xmls, gafs" description="Convert atlasses and gafs to ATF" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment