Skip to main content
gamedev.net
🔒 Locked

Direct3D

Started by Asesh Sep 1, 2006 at 2:33 PM 4 replies 1.2k views
Original Post
Asesh
Asesh
Right now am stuck in stencil buffer bcoz of D3DXPLANE. I refer to Frank D. Luna's book, so how does this constructor represent XY plane: D3DXPLANE plane(0.0f, 0.0f, 1.0f, 0.0f); // xy plane Please give me some detail info about it and what's the use of 4th component in D3DXVECTOR4 structure (w component)?
Evil Steve
Evil Steve
Plane Equation

A plane is represented by its normal and distance along it. In your example, the normal is the (x, y, z) component (which is (0, 0, 1) - meaning it faces towards +z), and the distance from the origin to it is 0.
Asesh
Asesh
Thanks guys and what about the fourth component of D3DXVECTOR4 (w component)?
Evil Steve
Evil Steve
Quote:
Original post by Asesh
Thanks guys and what about the fourth component of D3DXVECTOR4 (w component)?
That's the distance from the origin.
adriano_usp
adriano_usp
Quote:
Original post by Evil Steve
Quote:
Original post by Asesh
Thanks guys and what about the fourth component of D3DXVECTOR4 (w component)?
That's the distance from the origin.

If you consider the content of D3DXPLANE is represented by a D3DXVECTOR4 struct, so yes.

But D3DXVECTOR4 is just a 4D vector that could be used to store numeric values, colors data and other things that could be nice to represent with 4 components.

Considering model transformations, a 4D vector is mainly defined for providing a homogenisation on the transformation calculations. In other words, rotation and scaling transformations can be represented by 3x3 matrices, but a translation transformation don't. However, you can describe all the transformations as 4x4 matrices, in order to allow the product of different transformation matrices. And in this case, a vector transformation (by a 4x4 matrix) requires it is 4D. In general, the fourth value is 1.

It is interesting notice that many D3DX math functions transform 3D vectors (D3DXVECTOR3) by using 4x4 matrices (D3DXMATRIX). In true, the 3D vector is internally transformed in a 4D vector to provide the math operation.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.