tools.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <!DOCTYPE html>
  2. <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
  3. <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Tools &mdash; bgfx 1.0 documentation</title>
  8. <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  9. <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  10. <script src="_static/jquery.js"></script>
  11. <script src="_static/underscore.js"></script>
  12. <script src="_static/doctools.js"></script>
  13. <script src="_static/language_data.js"></script>
  14. <script type="text/javascript" src="_static/js/theme.js"></script>
  15. <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  16. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  17. <link rel="index" title="Index" href="genindex.html" />
  18. <link rel="search" title="Search" href="search.html" />
  19. <link rel="next" title="Internals" href="internals.html" />
  20. <link rel="prev" title="API Reference" href="bgfx.html" />
  21. </head>
  22. <body class="wy-body-for-nav">
  23. <div class="wy-grid-for-nav">
  24. <nav data-toggle="wy-nav-shift" class="wy-nav-side">
  25. <div class="wy-side-scroll">
  26. <div class="wy-side-nav-search" >
  27. <a href="index.html" class="icon icon-home"> bgfx
  28. </a>
  29. <div class="version">
  30. 1.0
  31. </div>
  32. <div role="search">
  33. <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
  34. <input type="text" name="q" placeholder="Search docs" />
  35. <input type="hidden" name="check_keywords" value="yes" />
  36. <input type="hidden" name="area" value="default" />
  37. </form>
  38. </div>
  39. </div>
  40. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  41. <ul class="current">
  42. <li class="toctree-l1"><a class="reference internal" href="overview.html">Overview</a></li>
  43. <li class="toctree-l1"><a class="reference internal" href="build.html">Building</a></li>
  44. <li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
  45. <li class="toctree-l1"><a class="reference internal" href="bgfx.html">API Reference</a></li>
  46. <li class="toctree-l1 current"><a class="current reference internal" href="#">Tools</a><ul>
  47. <li class="toctree-l2"><a class="reference internal" href="#geometry-compiler-geometryc">Geometry Compiler (geometryc)</a></li>
  48. <li class="toctree-l2"><a class="reference internal" href="#shader-compiler-shaderc">Shader Compiler (shaderc)</a><ul>
  49. <li class="toctree-l3"><a class="reference internal" href="#building-shaders">Building shaders</a></li>
  50. </ul>
  51. </li>
  52. <li class="toctree-l2"><a class="reference internal" href="#texture-compiler-texturec">Texture Compiler (texturec)</a></li>
  53. <li class="toctree-l2"><a class="reference internal" href="#texture-viewer-texturev">Texture Viewer (texturev)</a></li>
  54. </ul>
  55. </li>
  56. <li class="toctree-l1"><a class="reference internal" href="internals.html">Internals</a></li>
  57. <li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
  58. </ul>
  59. </div>
  60. </div>
  61. </nav>
  62. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  63. <nav class="wy-nav-top" aria-label="top navigation">
  64. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  65. <a href="index.html">bgfx</a>
  66. </nav>
  67. <div class="wy-nav-content">
  68. <div class="rst-content">
  69. <div role="navigation" aria-label="breadcrumbs navigation">
  70. <ul class="wy-breadcrumbs">
  71. <li><a href="index.html">Docs</a> &raquo;</li>
  72. <li>Tools</li>
  73. <li class="wy-breadcrumbs-aside">
  74. </li>
  75. </ul>
  76. <hr/>
  77. </div>
  78. <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
  79. <div itemprop="articleBody">
  80. <div class="section" id="tools">
  81. <h1>Tools<a class="headerlink" href="#tools" title="Permalink to this headline">¶</a></h1>
  82. <div class="section" id="geometry-compiler-geometryc">
  83. <h2>Geometry Compiler (geometryc)<a class="headerlink" href="#geometry-compiler-geometryc" title="Permalink to this headline">¶</a></h2>
  84. <p>Converts Wavefront .obj mesh file to format optimal for using with bgfx.</p>
  85. </div>
  86. <div class="section" id="shader-compiler-shaderc">
  87. <h2>Shader Compiler (shaderc)<a class="headerlink" href="#shader-compiler-shaderc" title="Permalink to this headline">¶</a></h2>
  88. <p>bgfx cross-platform shader language is based on GLSL syntax. It’s uses
  89. ANSI C preprocessor to transform GLSL like language syntax into HLSL.
  90. This technique has certain drawbacks, but overall it’s simple and allows
  91. quick authoring of cross-platform shaders.</p>
  92. <p>Some differences between bgfx’s shaderc flavor of GLSL and regular GLSL:</p>
  93. <ul class="simple">
  94. <li><p>No <code class="docutils literal notranslate"><span class="pre">bool/int</span></code> uniforms, all uniforms must be <code class="docutils literal notranslate"><span class="pre">float</span></code>.</p></li>
  95. <li><p>Attributes and varyings can be accessed only from <code class="docutils literal notranslate"><span class="pre">main()</span></code>
  96. function.</p></li>
  97. <li><p>Must use <code class="docutils literal notranslate"><span class="pre">SAMPLER2D/3D/CUBE/etc.</span></code> macros instead of
  98. <code class="docutils literal notranslate"><span class="pre">sampler2D/3D/Cube/etc.</span></code> tokens.</p></li>
  99. <li><p>Must use <code class="docutils literal notranslate"><span class="pre">vec2/3/4_splat(&lt;value&gt;)</span></code> instead of
  100. <code class="docutils literal notranslate"><span class="pre">vec2/3/4(&lt;value&gt;)</span></code>.</p></li>
  101. <li><p>Must use <code class="docutils literal notranslate"><span class="pre">mtxFromCols/mtxFromRows</span></code> when constructing matrices in shaders.</p></li>
  102. <li><p>Must use <code class="docutils literal notranslate"><span class="pre">mul(x,</span> <span class="pre">y)</span></code> when multiplying vectors and matrices.</p></li>
  103. <li><p>Must use <code class="docutils literal notranslate"><span class="pre">varying.def.sc</span></code> to define input/output semantic and
  104. precission instead of using <code class="docutils literal notranslate"><span class="pre">attribute/in</span></code> and <code class="docutils literal notranslate"><span class="pre">varying/in/out</span></code>.</p></li>
  105. <li><p><code class="docutils literal notranslate"><span class="pre">$input/$output</span></code> tokens must appear at the begining of shader.</p></li>
  106. </ul>
  107. <p>For more info see <a class="reference external" href="https://github.com/bkaradzic/bgfx/blob/master/src/bgfx_shader.sh">shader helper
  108. macros</a>.</p>
  109. <div class="section" id="building-shaders">
  110. <h3>Building shaders<a class="headerlink" href="#building-shaders" title="Permalink to this headline">¶</a></h3>
  111. <p>Shaders must be compiled for all renderers by using <cite>shaderc</cite> tool. Makefile to simplify building
  112. shaders is provided in examples. D3D9 and D3D11 shaders can be only compiled on Windows.</p>
  113. </div>
  114. </div>
  115. <div class="section" id="texture-compiler-texturec">
  116. <h2>Texture Compiler (texturec)<a class="headerlink" href="#texture-compiler-texturec" title="Permalink to this headline">¶</a></h2>
  117. <p>Convert PNG, TGA, DDS, KTX, PVR texture into bgfx supported texture formats.</p>
  118. </div>
  119. <div class="section" id="texture-viewer-texturev">
  120. <h2>Texture Viewer (texturev)<a class="headerlink" href="#texture-viewer-texturev" title="Permalink to this headline">¶</a></h2>
  121. <p>Texture viewer.</p>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <footer>
  127. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  128. <a href="internals.html" class="btn btn-neutral float-right" title="Internals" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
  129. <a href="bgfx.html" class="btn btn-neutral float-left" title="API Reference" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
  130. </div>
  131. <hr/>
  132. <div role="contentinfo">
  133. <p>
  134. &copy; Copyright 2010-2019, Branimir Karadžić
  135. </p>
  136. </div>
  137. </footer>
  138. </div>
  139. </div>
  140. </section>
  141. </div>
  142. <script type="text/javascript">
  143. jQuery(function () {
  144. SphinxRtdTheme.Navigation.enable(true);
  145. });
  146. </script>
  147. </body>
  148. </html>