HLSL float3x3 constructor?

This topic is 5134 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

If you pass the float3x3 constructor 3 float3 vectors, does it treat them like colomn vectors or row vectors? for example: float3x3 mat = float3x3(A,B,C); is that: mat = {A.x,A.y,A.z, //row 1 B.x,B.y,B.z, //row 2 C.x,C.y,C.z} //row 3 or: mat = {A.x,B.x,C.x, //row 1 A.y,B.y,C.y, //row 2 A.z,B.z,C.z} //row 3 thanks in advance.

Share on other sites
should be columns. Don't know but would be very surprised if otherwise.

Share on other sites
this stuff is explained on the msdn site,
look it up

Share on other sites
Quote:
 Original post by PseudoIf you pass the float3x3 constructor 3 float3 vectors, does it treat them like colomn vectors or row vectors?for example:float3x3 mat = float3x3(A,B,C);is that:mat = {A.x,A.y,A.z, //row 1 B.x,B.y,B.z, //row 2 C.x,C.y,C.z} //row 3or:mat = {A.x,B.x,C.x, //row 1 A.y,B.y,C.y, //row 2 A.z,B.z,C.z} //row 3thanks in advance.

The constructer takes rows.

Note, however that for uniform parameters HLSL default packing order is COLUMN, though this can be changed by using the row_major usage modifier.

Share on other sites
Get documentation from
http://www.opengl.org/documentation/oglsl.html
On page 35 you can see
Quote:
 Andu = m * v;is equivalent tou.x = m[0].x * v.x + m[1].x * v.y + m[2].x * v.z;u.y = m[0].y * v.x + m[1].y * v.y + m[2].y * v.z;u.z = m[0].z * v.x + m[1].z * v.y + m[2].z * v.z;

Looks like matrix are composed of column vectors,so it's why i would be very surprised.
Better quote:
Quote:
 ...5.4.2 Vector and Matrix ConstructorsConstructors can be used to create vectors or matrices from a set of scalars, vectors, or matrices. Thisincludes the ability to shorten vectors.If there is a single scalar parameter to a vector constructor, it is used to initialize all components of theconstructed vector to that scalar’s value. If there is a single scalar parameter to a matrix constructor, it isused to initialize all the components on the matrix’s diagonal, with the remaining components initializedto 0.0. If there are non-scalar parameters, and/or multiple scalar parameters, they will be assigned inorder, from left to right, to the components of the constructed value. In this case, there must be enoughcomponents provided in the parameters to provide an initializer for every component in the constructedvalue. If more components are provided in the last used argument to a constructor than are needed toinitialize the constructed value, the left most components of that argument are used, and the remainingones are ignored. It is an error to provide extra arguments beyond this last used argument. Matrices willbe constructed in column major order. It is an error to construct matrices from other matrices. This isreserved for future use ]...

Share on other sites
He was talking about HLSL, or the Direct3D High Level Shading Language, not glsl. I would be very surprised if that takes column vectors, since Direct3D treats vertices as row vectors (unlike OpenGL, which uses column vectors).

Share on other sites
I'm getting mixed answers on this. And I looked in msdn and couldn't find it. Would anyone care to point on where the docs specify this?

Share on other sites
omg.sorry.misreaded [grin]. btw,there would be no mistake if it were posted into right forum.

Share on other sites
Quote:
 Original post by PseudoIf you pass the float3x3 constructor 3 float3 vectors, does it treat them like colomn vectors or row vectors?for example:float3x3 mat = float3x3(A,B,C);is that:mat = {A.x,A.y,A.z, //row 1 B.x,B.y,B.z, //row 2 C.x,C.y,C.z} //row 3or:mat = {A.x,B.x,C.x, //row 1 A.y,B.y,C.y, //row 2 A.z,B.z,C.z} //row 3thanks in advance.

Its row, or more precisely,

if float3x3 mat = float3x3(A,B,C),

then mat._11_12_13 = A.xyz

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
13
5. 5

• 14
• 10
• 24
• 9
• 57
• Forum Statistics

• Total Topics
632639
• Total Posts
3007611
• Who's Online (See full list)

There are no registered users currently online

×