<tfoot id='f8E8i'></tfoot>
      <bdo id='f8E8i'></bdo><ul id='f8E8i'></ul>
    <legend id='f8E8i'><style id='f8E8i'><dir id='f8E8i'><q id='f8E8i'></q></dir></style></legend>
  • <small id='f8E8i'></small><noframes id='f8E8i'>

        <i id='f8E8i'><tr id='f8E8i'><dt id='f8E8i'><q id='f8E8i'><span id='f8E8i'><b id='f8E8i'><form id='f8E8i'><ins id='f8E8i'></ins><ul id='f8E8i'></ul><sub id='f8E8i'></sub></form><legend id='f8E8i'></legend><bdo id='f8E8i'><pre id='f8E8i'><center id='f8E8i'></center></pre></bdo></b><th id='f8E8i'></th></span></q></dt></tr></i><div id='f8E8i'><tfoot id='f8E8i'></tfoot><dl id='f8E8i'><fieldset id='f8E8i'></fieldset></dl></div>
      1. 使用 libgdx 绘制带纹理的多边形

        时间:2023-07-27

          <tfoot id='0vQSL'></tfoot>
                <tbody id='0vQSL'></tbody>
              <legend id='0vQSL'><style id='0vQSL'><dir id='0vQSL'><q id='0vQSL'></q></dir></style></legend>

              • <small id='0vQSL'></small><noframes id='0vQSL'>

                  <bdo id='0vQSL'></bdo><ul id='0vQSL'></ul>

                  <i id='0vQSL'><tr id='0vQSL'><dt id='0vQSL'><q id='0vQSL'><span id='0vQSL'><b id='0vQSL'><form id='0vQSL'><ins id='0vQSL'></ins><ul id='0vQSL'></ul><sub id='0vQSL'></sub></form><legend id='0vQSL'></legend><bdo id='0vQSL'><pre id='0vQSL'><center id='0vQSL'></center></pre></bdo></b><th id='0vQSL'></th></span></q></dt></tr></i><div id='0vQSL'><tfoot id='0vQSL'></tfoot><dl id='0vQSL'><fieldset id='0vQSL'></fieldset></dl></div>
                  本文介绍了使用 libgdx 绘制带纹理的多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我使用 libgdx 的渲染周期有问题,基本上我需要用方形纹理填充一个区域,而这个区域的最后一部分可能比纹理更小或形状不同,所以这意味着我需要渲染一个任意形状的四边形并在其上贴上纹理,切割我不需要的部分.

                  I'm having a problem with my rendering cycle using libgdx, basically I need to fill an area with a square texture, and the last part of this area may be smaller or with a different shape than the texture, so it means that i need to render a quad of arbitrary form and slap the texture on it, cutting the parts I don't need.

                  我对如何做到这一点有点迷茫,到目前为止,我已经看到 PolygonRegion 和 PolygonSpriteBatch 可能会为我做这件事,但我对实例化一个我只会使用的新重物有点警惕在一个物体上.

                  I'm a bit lost on how to do this, so far I've seen that the PolygonRegion and PolygonSpriteBatch might do it for me, but I'm a bit wary of instancing a new heavy object I'll use only on one object.

                  还有其他选择吗?也许是 Mesh 类,但我想确定.

                  Is there any alternative? Perhaps the Mesh class but i'd like to be certain.

                  推荐答案

                  我建议使用 Mesh 来准确定义您想要的区域.定义顶点并将它们映射到纹理坐标有点繁琐,但很高兴知道一些更高级别的 API(如 *Batch 位)下面发生了什么.此外,*Batch API 旨在共享跨多个对象上传单个纹理的权重,这听起来可能不适用于这种情况.(另一方面,即使 Batch 对象有点重量级",在实践中它们实际上也可能不是问题.)

                  I suggest using a Mesh to define exactly what region you want. Defining the vertex points and mapping those to the texture coordinates is a bit fiddly, but its good to know what's going on underneath some of the higher level APIs (like the *Batch bits). Additionally, the *Batch APIs are designed to share the weight of uploading a single texture across multiple objects, which sounds like it might not apply in this case. (On the other hand, even if the Batch objects are a bit "heavyweight", they may not actually be a problem in practice.)

                  要考虑的另一种方法是将对象渲染为方形网格,但为区域外的所有像素定义透明像素的纹理.(我假设非方形是您可以离线知道的,并且不是动态的.)

                  Another approach to consider is to render the object as a square mesh, but to define your texture with transparent pixels for all the pixels outside the region. (I'm assuming the non-square shape is something you can know offline, and isn't dynamic.)

                  这篇关于使用 libgdx 绘制带纹理的多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:安卓.如何沿它所面对的方向移动对象(使用 Vect 下一篇:在模拟器中运行时,libgdx 在 helloworld 应用程序上

                  相关文章

                  最新文章

                  <tfoot id='L0drW'></tfoot>

                    <small id='L0drW'></small><noframes id='L0drW'>

                  1. <i id='L0drW'><tr id='L0drW'><dt id='L0drW'><q id='L0drW'><span id='L0drW'><b id='L0drW'><form id='L0drW'><ins id='L0drW'></ins><ul id='L0drW'></ul><sub id='L0drW'></sub></form><legend id='L0drW'></legend><bdo id='L0drW'><pre id='L0drW'><center id='L0drW'></center></pre></bdo></b><th id='L0drW'></th></span></q></dt></tr></i><div id='L0drW'><tfoot id='L0drW'></tfoot><dl id='L0drW'><fieldset id='L0drW'></fieldset></dl></div>
                      <bdo id='L0drW'></bdo><ul id='L0drW'></ul>

                    1. <legend id='L0drW'><style id='L0drW'><dir id='L0drW'><q id='L0drW'></q></dir></style></legend>