[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

Batch drawing with quadrangles.  How can I use individual transform matrices?

Asked by Dr_Spankenstein in 3D Game Programming, DirectX Graphics & Game Programming, Graphics & Game Programming

Tags: Quad Batch Draw Vertex Format Matrix Transform

The code attached creates a quadrangle and stores the 4 corners of the quadrangle in a custom vertex format.  The vertex coordinates are in world space coordinates.  

The problem I am having is if I am to change a parameter such as width or the normal then I have to update all the vertices each time.

How can I create a transform matrix that can be passed to the graphics card so the quad can stay in local space coordinates and then be transformed to world space by the graphics card.

I realize that this is very easy to do for drawing individual quads but when I am batch drawing all quads as an array of vertices then I am not sure how to apply the correct transforms to the individual quads in the array.  How would I also rotate so that the normal is correct?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
public Quad(Vector3 centre, Vector3 normal, Vector3 up, float width, float height, int texture_ListIndex)
        {
            Vertex = new VertexPositionNormalExtra[4];
 
            Centre = centre;
            N = normal;
            Up = up;
 
            Width = width;
            Height = height;
 
            // Calculate the Quad corners
            Left = Vector3.Cross(normal, Up);
            UpperCenter = (Up * height * 0.5f) + centre;
            UpperLeft = UpperCenter + (Left * width * 0.5f);
            UpperRight = UpperCenter - (Left * width * 0.5f);
            LowerLeft = UpperLeft - (Up * height);
            LowerRight = UpperRight - (Up * height);
            //texture = texture_ListIndex;
 
            // [Default Texture Coordinates] 
            // - Fill in texture coordinates to display the entire texture on the quadrangle 
            // - This will rescale the texure to fit the exact size of the quadrangle 
            TextureUpperLeft = new Vector2(0, 0);
            TextureUpperRight = new Vector2(1, 0);
            TextureLowerLeft = new Vector2(0, 1);
            TextureLowerRight = new Vector2(1, 1);
 
            // Fill vertices with the new parameter info
            Vertex[0] = new VertexPositionNormalExtra(LowerLeft, Centre, N, TextureLowerLeft, texture_int, Width, Height);
            Vertex[1] = new VertexPositionNormalExtra(UpperLeft, Centre, N, TextureUpperLeft, texture_int, Width, Height);
            Vertex[2] = new VertexPositionNormalExtra(LowerRight, Centre, N, TextureLowerRight, texture_int, Width, Height);
            Vertex[3] = new VertexPositionNormalExtra(UpperRight, Centre, N, TextureUpperRight, texture_int, Width, Height);
        }
 
Loading Advertisement...
 
[+][-]11/03/09 01:42 AM, ID: 25727291Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/09 02:42 AM, ID: 25727591Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/09 03:34 AM, ID: 25727866Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/09 03:45 AM, ID: 25727943Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/09 05:26 AM, ID: 25728645Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/09 05:28 AM, ID: 25728661Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/09 05:44 AM, ID: 25728809Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/09 06:21 AM, ID: 25729155Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/09 07:27 AM, ID: 25729824Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/09 07:34 AM, ID: 25729914Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/09 07:41 AM, ID: 25729995Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/09 08:29 AM, ID: 25730658Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/09 08:34 AM, ID: 25730699Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/09 08:42 AM, ID: 25730784Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]11/03/09 08:52 AM, ID: 25730920Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/09 08:57 AM, ID: 25730966Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 04:52 AM, ID: 25775401Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: 3D Game Programming, DirectX Graphics & Game Programming, Graphics & Game Programming
Tags: Quad Batch Draw Vertex Format Matrix Transform
Sign Up Now!
Solution Provided By: Dr_Spankenstein
Participating Experts: 1
Solution Grade: A
 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625