bgfx/tools.html
Branimir Karadžić 16caef77a6 Updated docs.
2016-05-16 08:59:36 -07:00

253 lines
8.2 KiB
HTML

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tools &mdash; bgfx 1.0 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="top" title="bgfx 1.0 documentation" href="index.html"/>
<link rel="next" title="License" href="license.html"/>
<link rel="prev" title="API Reference" href="bgfx.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> bgfx
</a>
<div class="version">
1.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="build.html">Building</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="bgfx.html">API Reference</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Tools</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#geometry-compiler-geometryc">Geometry Compiler (geometryc)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#shader-compiler-shaderc">Shader Compiler (shaderc)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#building-shaders">Building shaders</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#texture-compiler-texturec">Texture Compiler (texturec)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#texture-viewer-texturev">Texture Viewer (texturev)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">bgfx</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>Tools</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="tools">
<h1>Tools<a class="headerlink" href="#tools" title="Permalink to this headline"></a></h1>
<div class="section" id="geometry-compiler-geometryc">
<h2>Geometry Compiler (geometryc)<a class="headerlink" href="#geometry-compiler-geometryc" title="Permalink to this headline"></a></h2>
<p>Converts Wavefront .obj mesh file to format optimal for using with bgfx.</p>
</div>
<div class="section" id="shader-compiler-shaderc">
<h2>Shader Compiler (shaderc)<a class="headerlink" href="#shader-compiler-shaderc" title="Permalink to this headline"></a></h2>
<p>bgfx cross-platform shader language is based on GLSL syntax. It&#8217;s uses
ANSI C preprocessor to transform GLSL like language syntax into HLSL.
This technique has certain drawbacks, but overall it&#8217;s simple and allows
quick authoring of cross-platform shaders.</p>
<p>Some differences between bgfx&#8217;s shaderc flavor of GLSL and regular GLSL:</p>
<ul class="simple">
<li>No <tt class="docutils literal"><span class="pre">bool/int</span></tt> uniforms, all uniforms must be <tt class="docutils literal"><span class="pre">float</span></tt>.</li>
<li>Attributes and varyings can be accessed only from <tt class="docutils literal"><span class="pre">main()</span></tt>
function.</li>
<li>Must use <tt class="docutils literal"><span class="pre">SAMPLER2D/3D/CUBE/etc.</span></tt> macros instead of
<tt class="docutils literal"><span class="pre">sampler2D/3D/Cube/etc.</span></tt> tokens.</li>
<li>Must use <tt class="docutils literal"><span class="pre">vec2/3/4_splat(&lt;value&gt;)</span></tt> instead of
<tt class="docutils literal"><span class="pre">vec2/3/4(&lt;value&gt;)</span></tt>.</li>
<li>Must use <tt class="docutils literal"><span class="pre">mul(x,</span> <span class="pre">y)</span></tt> when multiplying vectors and matrices.</li>
<li>Must use <tt class="docutils literal"><span class="pre">varying.def.sc</span></tt> to define input/output semantic and
precission instead of using <tt class="docutils literal"><span class="pre">attribute/in</span></tt> and <tt class="docutils literal"><span class="pre">varying/in/out</span></tt>.</li>
<li><tt class="docutils literal"><span class="pre">$input/$output</span></tt> tokens must appear at the begining of shader.</li>
</ul>
<p>For more info see <a class="reference external" href="https://github.com/bkaradzic/bgfx/blob/master/src/bgfx_shader.sh">shader helper
macros</a>.</p>
<div class="section" id="building-shaders">
<h3>Building shaders<a class="headerlink" href="#building-shaders" title="Permalink to this headline"></a></h3>
<p>Shaders must be compiled for all renderers by using <cite>shaderc</cite> tool. Makefile to simplify building
shaders is provided in examples. D3D9 and D3D11 shaders can be only compiled on Windows.</p>
</div>
</div>
<div class="section" id="texture-compiler-texturec">
<h2>Texture Compiler (texturec)<a class="headerlink" href="#texture-compiler-texturec" title="Permalink to this headline"></a></h2>
<p>Convert PNG, TGA, DDS, KTX, PVR texture into bgfx supported texture formats.</p>
</div>
<div class="section" id="texture-viewer-texturev">
<h2>Texture Viewer (texturev)<a class="headerlink" href="#texture-viewer-texturev" title="Permalink to this headline"></a></h2>
<p>Texture viewer.</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="license.html" class="btn btn-neutral float-right" title="License" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="bgfx.html" class="btn btn-neutral" title="API Reference" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2010-2016, Branimir Karadžić.
</p>
</div>
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>