Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by dr_panther. 05/18/24 11:01
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, Ayumi), 702 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
about OpenGL matrix transform to D3D Shader(in a7) #339970
08/30/10 11:04
08/30/10 11:04
Joined: Nov 2007
Posts: 14
D
druid Offline OP
Newbie
druid  Offline OP
Newbie
D

Joined: Nov 2007
Posts: 14
i m working on slin's AckR link

i want to change the source code to matrix transform to fix the Gimbal Lock problem.

what i want to which transform matrix is need to change OpenGL matrix to D3D Shader matrix(in a7);

i know that need mul() or something eles. i have try differernt trans matrix but some direction vector in the matrix still not match.

if anyone can help ,plz~~~~

thank u all
the material matrix transform code like these
Code:
function mtl_init()
{
	float mat_Rot[16];
	float mat_Trans[16];
	float mat_Trans2[16];
	mat_identity(mat_Trans);
	mat_identity(mat_Rot);
	mat_identity(mat_Trans2);
	while(1)
	{
		mat_Trans[2] = 1;
		mat_Trans[5] = 0;
		mat_Trans[6] = 1;
		mat_Trans[9] = -1;
		mat_Trans[10] = 0;
		mat_Rot[0] = fromDllAxisX.x;
		mat_Rot[1] = fromDllAxisX.y;
		mat_Rot[2] = fromDllAxisX.z;
		mat_Rot[3] = 0;
		mat_Rot[4] = fromDllAxisY.x;
		mat_Rot[5] = fromDllAxisY.y;
		mat_Rot[6] = fromDllAxisY.z;
		mat_Rot[7] = 0;
		mat_Rot[8] = fromDllAxisZ.x;
		mat_Rot[9] = fromDllAxisZ.y;
		mat_Rot[10] = fromDllAxisZ.z;
		mat_Rot[11] = 0;
		mat_Rot[12] = 0;
		mat_Rot[13] = 0;
		mat_Rot[14] = 0;
		mat_Rot[15] = 1;
//		mat_multiply(mat_Rot, mat_Trans);
		mat_set(mtl.matrix, mat_Rot);
		wait(1);
	}
}



ps:the position is correct transform .question is about the rotation transform

Re: about OpenGL matrix transform to D3D Shader(in a7) [Re: druid] #340049
08/31/10 03:05
08/31/10 03:05
Joined: Mar 2009
Posts: 5
P
peonytele Offline
Newbie
peonytele  Offline
Newbie
P

Joined: Mar 2009
Posts: 5
hi I am his friend
some additional infos:
the final Opengl matrix is m[3][4]
int arUtilMat2QuatPos( double m[3][4], double q[4], double p[3] )
{
double w;

w = m[0][0] + m[1][1] + m[2][2] + 1;
if( w < 0.0 ) return -1;

w = sqrt( w );
q[0] = (m[1][2] - m[2][1]) / (w*2.0);
q[1] = (m[2][0] - m[0][2]) / (w*2.0);
q[2] = (m[0][1] - m[1][0]) / (w*2.0);
q[3] = w / 2.0;

p[0] = m[0][3];
p[1] = m[1][3];
p[2] = m[2][3];

return 0;
}
the function above is to get the Quaternions(q[]) and the Positions(p[])

in the dll,we save the 3 rows : m[][0] , m[][1], m[][2], to a7 vectors : fromDllAxisX,Y,Z. then build the mat_Rot.The transform matrix (mat_Trans)
is to transform opengl axis to a7 axis.

In the shader, first we do
TempPos = mul(InPos, mtlMat), then
OutPos = mul(TempPos, matWorldViewProj)


Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1