【问题标题】:how to pass from farseer vertices list to vertexpositioncolortexture data vertex如何从 farseer 顶点列表传递到 vertexpositioncolortexture 数据顶点
【发布时间】:2013-06-14 09:51:15
【问题描述】:

当我对顶点进行纹理示例 (https://gamedev.stackexchange.com/questions/30050/building-a-shape-out-of-an-texture-with-farseer) 时,我的问题开始了,然后如果可以将这个“远见者顶点”传递给可以在 DrawUserIndexedPrimitives 中使用的顶点数据以便准备好顶点,我会弹出用于修改 alpha 纹理。

示例: 您在三角形带状顶点数据上绘制纹理(在某些地方具有透明度),以便您可以操纵这些点以便像这样使图像混乱: http://www.tutsps.com/images/Water_Design_avec_Photoshop/Water_Design_avec_Photoshop_20.jpg

如您所见,A 字母只是 PNG 文件上的普通图像,但经过转换后,我正在查看它可用于对图像进行分类。

请任何解决方案提供一些代码或教程链接,以帮助我解决这个问题...

谢谢大家!!

P.D.我认为主要问题是如何仅从 PolygonTools.CreatePolygon 制作的顶点制作 indexData 和 textureCoordination。

【问题讨论】:

    标签: xna textures vertex farseer


    【解决方案1】:

    TexturedFixture 多边形 = fixture.UserData as TexturedFixture;

                        effect.Texture = polygon.Texture;
                        effect.CurrentTechnique.Passes[0].Apply();
    
                        VertexPositionColorTexture[] points;
                        int vertexCount;
                        int[] indices;
                        int triangleCount;
    
                        polygon.Polygon.GetTriangleList(fixture.Body.Position, fixture.Body.Rotation, out points, out vertexCount, out indices, out triangleCount);
    
                        GraphicsDevice.SamplerStates[0] = SamplerState.AnisotropicClamp;
                        GraphicsDevice.RasterizerState = new RasterizerState() { FillMode = FillMode.Solid, CullMode = CullMode.None, };
    
                        GraphicsDevice.DrawUserIndexedPrimitives<VertexPositionColorTexture>(PrimitiveType.TriangleList, points, 0, vertexCount, indices, 0, triangleCount);
    

    这样就可以了

    【讨论】:

      猜你喜欢
      • 2017-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-17
      • 2021-05-31
      • 1970-01-01
      相关资源
      最近更新 更多