0

My issue started when i was doing the texture to vertices example (https://gamedev.stackexchange.com/questions/30050/building-a-shape-out-of-an-texture-with-farseer) then i pop up if its posible to pass this "farseer vertices" to vertex data that can be used in DrawUserIndexedPrimitives in order to have the vertices ready for modification on alpha textures.

Example: You draw your texture(with transparency in some places) over the triangle strip vertex data so you can manipulate the points in order to disort the image like this: http://www.tutsps.com/images/Water_Design_avec_Photoshop/Water_Design_avec_Photoshop_20.jpg

As you can see the A letter was just a normal image on a PNG file but after the conversion iam looking it can be used to disort image.

plz any solution give some code or link to tutorial that can help me to figure out this...

Thanks all!!

P.D. i think the main issue is how to make the indexData and the textureCoordination from just the vertices that PolygonTools.CreatePolygon makes.

Community
  • 1
  • 1
poker3
  • 21
  • 1
  • 4

1 Answers1

0

TexturedFixture polygon = 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);

This will do the trick

poker3
  • 21
  • 1
  • 4