Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > c936229ef0138f42857f36beadbeda30 > files > 958

qt3d5-doc-5.12.2-2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qbuffer.cpp -->
  <title>QBufferDataGenerator Class | Qt 3D 5.12.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qt3d-index.html">Qt 3D</a></td><td ><a href="qt3d-cpp.html">C++ Classes</a></td><td >QBufferDataGenerator</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qt3d-index.html">Qt 5.12.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QBufferDataGenerator Class</h1>
<span class="small-subtitle">(<a href="qt3drender-qbufferdatagenerator.html">Qt3DRender::QBufferDataGenerator</a>)<br/></span>
<!-- $$$QBufferDataGenerator-brief -->
<p>Provides a mechanism to generate buffer data from a job. <a href="#details">More...</a></p>
<!-- @@@QBufferDataGenerator -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QBufferDataGenerator&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += 3drender</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qt3drender-qabstractfunctor.html">Qt3DRender::QAbstractFunctor</a></td></tr></table></div><ul>
<li><a href="qt3drender-qbufferdatagenerator-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qt3drender-qbufferdatagenerator.html#dtor.QBufferDataGenerator">~QBufferDataGenerator</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qt3drender-qbufferdatagenerator.html#operator-28-29">operator()</a></b>() = 0</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qt3drender-qbufferdatagenerator.html#operator-eq-eq">operator==</a></b>(const Qt3DRender::QBufferDataGenerator &amp;<i>other</i>) const = 0</td></tr>
</table></div>
<ul>
<li class="fn">2 public functions inherited from <a href="qt3drender-qabstractfunctor.html#public-functions">Qt3DRender::QAbstractFunctor</a></li>
</ul>
<a name="details"></a>
<!-- $$$QBufferDataGenerator-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>Provides a mechanism to generate buffer data from a job.</p>
<p>The <a href="qt3drender-qbufferdatagenerator.html">Qt3DRender::QBufferDataGenerator</a> should be subclassed to provide a way to fill the data of a <a href="qt3drender-qbuffer.html">Qt3DRender::QBuffer</a>. Such functors are executed at runtime in a Qt 3D job (likely in parallel with many other jobs). When providing a functor you must implement the <a href="qt3drender-qbufferdatagenerator.html#operator-28-29">operator</a>() which will be called to generate the actual data. You must make sure that you have stored copies of anything you might need for it to execute properly. You should also implement the operator==. It will be used to compare with other functors and based on that allow the renderer to decide if a new functor should be executed or not.</p>
<p><b>Note: </b>functors are useful when you can build data from a few set of attributes (e.g: building a sphere from a radius property). If you already have access to the buffer data, using Qt3DRender::QBuffer::setData() is likely more efficient.</p><pre class="cpp">

  <span class="type">QByteArray</span> createSphereMeshVertexData(<span class="type">float</span> radius<span class="operator">,</span> <span class="type">int</span> rings<span class="operator">,</span> <span class="type">int</span> slices)
  {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
  }

  <span class="keyword">class</span> SphereVertexDataFunctor : <span class="keyword">public</span> <span class="type"><a href="qt3drender-qbufferdatagenerator.html">QBufferDataGenerator</a></span>
  {
  <span class="keyword">public</span>:
      SphereVertexDataFunctor(<span class="type">int</span> rings<span class="operator">,</span> <span class="type">int</span> slices<span class="operator">,</span> <span class="type">float</span> radius)
          : m_rings(rings)
          <span class="operator">,</span> m_slices(slices)
          <span class="operator">,</span> m_radius(radius)
      {}

      <span class="type">QByteArray</span> <span class="keyword">operator</span> ()() override
      {
          <span class="keyword">return</span> createSphereMeshVertexData(m_radius<span class="operator">,</span> m_rings<span class="operator">,</span> m_slices);
      }

      bool <span class="keyword">operator</span> <span class="operator">=</span><span class="operator">=</span>(<span class="keyword">const</span> <span class="type"><a href="qt3drender-qbufferdatagenerator.html">QBufferDataGenerator</a></span> <span class="operator">&amp;</span>other) <span class="keyword">const</span> override
      {
          <span class="keyword">const</span> SphereVertexDataFunctor <span class="operator">*</span>otherFunctor <span class="operator">=</span> functor_cast<span class="operator">&lt;</span>SphereVertexDataFunctor<span class="operator">&gt;</span>(<span class="operator">&amp;</span>other);
          <span class="keyword">if</span> (otherFunctor <span class="operator">!</span><span class="operator">=</span> nullptr)
              <span class="keyword">return</span> (otherFunctor<span class="operator">-</span><span class="operator">&gt;</span>m_rings <span class="operator">=</span><span class="operator">=</span> m_rings <span class="operator">&amp;</span><span class="operator">&amp;</span>
                      otherFunctor<span class="operator">-</span><span class="operator">&gt;</span>m_slices <span class="operator">=</span><span class="operator">=</span> m_slices <span class="operator">&amp;</span><span class="operator">&amp;</span>
                      otherFunctor<span class="operator">-</span><span class="operator">&gt;</span>m_radius <span class="operator">=</span><span class="operator">=</span> m_radius);
          <span class="keyword">return</span> <span class="keyword">false</span>;
      }

      QT3D_FUNCTOR(SphereVertexDataFunctor)

  <span class="keyword">private</span>:
      <span class="type">int</span> m_rings;
      <span class="type">int</span> m_slices;
      <span class="type">float</span> m_radius;
  };

</pre>
<p>The <a href="qt3drender-qabstractfunctor.html#QT3D_FUNCTOR">QT3D_FUNCTOR</a> macro should be added when subclassing. This allows you to use <a href="qt3drender-qabstractfunctor.html#functor_cast">functor_cast</a> in your comparison operator to make sure that the other functor is of the same type as the one your are trying to compare against.</p>
</div>
<!-- @@@QBufferDataGenerator -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$~QBufferDataGenerator[overload1]$$$~QBufferDataGenerator -->
<h3 class="fn" id="dtor.QBufferDataGenerator"><a name="dtor.QBufferDataGenerator"></a><code>[virtual] </code>QBufferDataGenerator::<span class="name">~QBufferDataGenerator</span>()</h3>
<p>Destroys the instance of QBufferDataGenerator. The destructor is virtual.</p><!-- @@@~QBufferDataGenerator -->
<!-- $$$operator()[overload1]$$$operator() -->
<h3 class="fn" id="operator-28-29"><a name="operator-28-29"></a><code>[pure virtual] </code><span class="type">QByteArray</span> QBufferDataGenerator::<span class="name">operator()</span>()</h3>
<!-- @@@operator() -->
<!-- $$$operator==[overload1]$$$operator==constQt3DRender::QBufferDataGenerator& -->
<h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><code>[pure virtual] </code><span class="type">bool</span> QBufferDataGenerator::<span class="name">operator==</span>(const <span class="type"><a href="qt3drender-qbufferdatagenerator.html">Qt3DRender::QBufferDataGenerator</a></span> &amp;<i>other</i>) const</h3>
<!-- @@@operator== -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>